修复了2个bug
This commit is contained in:
1 parent
ce8372e878
commit
2a64dc7395
64 files changed
+1050
-39
No files matched your search
@@ -0,0 +1 @@
|
||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[430],{534:(e,a,t)=>{"use strict";t.d(a,{A:()=>n});let n=(0,t(1847).A)("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]])},1770:(e,a,t)=>{Promise.resolve().then(t.bind(t,3438))},2902:(e,a,t)=>{"use strict";t.d(a,{Rx:()=>n,mC:()=>s});let n=[{value:"today",label:"今天"},{value:"7d",label:"近 7 天"},{value:"30d",label:"近 30 天"},{value:"month",label:"本月"}];function s(e){var a;let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date,s=function(e){let a=Object.fromEntries(new Intl.DateTimeFormat("en-CA",{timeZone:"Asia/Shanghai",year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(e).map(e=>[e.type,e.value]));return"".concat(a.year,"-").concat(a.month,"-").concat(a.day)}(t),c=s;return"7d"===e&&(c=r(s,-6)),"30d"===e&&(c=r(s,-29)),"month"===e&&(c="".concat(s.slice(0,7),"-01")),function(e,a,t){var n,s;if(!l(e)||!l(a))throw i("日期格式必须为 YYYY-MM-DD。");if(e>a)throw i("开始日期不能晚于结束日期。");let c=(n=e,s=a,Math.round((Date.parse("".concat(s,"T00:00:00Z"))-Date.parse("".concat(n,"T00:00:00Z")))/864e5)+1);if(c>3660)throw i("单次查询最多支持 10 年。");return{from:"".concat(e,"T00:00:00+08:00"),to:"".concat(r(a,1),"T00:00:00+08:00"),startDate:e,endDate:a,label:t||(e===a?e:"".concat(e," 至 ").concat(a)),dayCount:c}}(c,s,null==(a=n.find(a=>a.value===e))?void 0:a.label)}function r(e,a){let t=new Date("".concat(e,"T00:00:00Z"));return t.setUTCDate(t.getUTCDate()+a),t.toISOString().slice(0,10)}function l(e){return!!/^\d{4}-\d{2}-\d{2}$/.test(e)&&new Date("".concat(e,"T00:00:00Z")).toISOString().slice(0,10)===e}function i(e){return Object.assign(Error(e),{status:400})}},3438:(e,a,t)=>{"use strict";t.r(a),t.d(a,{default:()=>w});var n=t(5155),s=t(2115),r=t(8314),l=t(5299),i=t(9559),c=t(534),o=t(1847);let d=(0,o.A)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);var u=t(9408);let h=(0,o.A)("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);var m=t(7612),p=t(2902);function x(){let e=(0,p.mC)("month");return{startDate:e.startDate,endDate:e.endDate,organizationId:"",ownerId:"",capability:"",provider:""}}function j(e){var a,t;let{isSuperAdmin:o}=e,[p,j]=(0,s.useState)(x),[N,w]=(0,s.useState)(null),[k,A]=(0,s.useState)(!0),[M,C]=(0,s.useState)(null),E=(0,s.useRef)(null),D=(0,s.useRef)(null),z=(0,s.useRef)(null);async function R(e){A(!0),C(null);try{let a=new URLSearchParams;for(let[e,t]of Object.entries(p))t&&a.set(e,t);let t=await fetch("/api/admin/usage?".concat(a.toString()),{cache:"no-store",signal:e}),n=await t.json();if(!t.ok)throw Error(n.error||"读取用量数据失败");w(n)}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)return;C(e instanceof Error?e.message:String(e))}finally{(null==e?void 0:e.aborted)||A(!1)}}function I(e,a){j(t=>({...t,[e]:a}))}return(0,s.useEffect)(()=>{let e=new AbortController;return R(e.signal),()=>e.abort()},[p]),(0,s.useEffect)(()=>(0,m.It)(E,e=>(0,m.xr)(e)),[]),(0,s.useEffect)(()=>{(0,m.c8)(D.current)},[N]),(0,s.useEffect)(()=>{(0,m.Js)(z.current)},[M,null==N?void 0:N.warnings]),(0,n.jsxs)("div",{className:"usage-manager",ref:E,children:[(0,n.jsxs)("div",{className:"workspace-head","data-animate":!0,children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"workspace-title",children:"用量管理"}),(0,n.jsx)("p",{className:"workspace-copy",children:"按成功任务统计平台内账号与组织的真实服务用量。"})]}),(0,n.jsxs)("div",{className:"workspace-meta",children:[(0,n.jsx)("span",{className:"status",children:"北京时间"}),(0,n.jsx)("span",{className:"status running",children:(null==N?void 0:N.range.label)||"本月"})]})]}),(0,n.jsxs)("section",{className:"panel usage-filters","data-animate":!0,"aria-label":"用量筛选",children:[(0,n.jsxs)("label",{className:"field",children:[(0,n.jsx)("span",{children:"开始日期"}),(0,n.jsx)("input",{type:"date",value:p.startDate,max:p.endDate,onChange:e=>I("startDate",e.target.value)})]}),(0,n.jsxs)("label",{className:"field",children:[(0,n.jsx)("span",{children:"结束日期"}),(0,n.jsx)("input",{type:"date",value:p.endDate,min:p.startDate,onChange:e=>I("endDate",e.target.value)})]}),o?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("label",{className:"field",children:[(0,n.jsx)("span",{children:"组织"}),(0,n.jsxs)(Line truncated
|
||||
Reference in new issue
Block a user