You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1 lines
11 KiB

"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[816],{85099:function(Pe,Y,t){t.r(Y),t.d(Y,{default:function(){return Ie}});var oe=t(15009),v=t.n(oe),ce=t(99289),B=t.n(ce),fe=t(5574),j=t.n(fe),E=t(48357),ve=t(35312),f=t(8232),q=t(66309),I=t(71230),A=t(15746),w=t(14726),he=t(13169),T=t(72051),R=t(17788),V=t(55102),y=t(34041),Q=t(37804),P=t(16250),x=t(67294),me=t(72269),e=t(85893),je=function(d){var D=function(){d.onSubmit()},C=[{title:"\u59D3\u540D",dataIndex:"name",ellipsis:!0},{title:"\u89D2\u8272",dataIndex:"role",render:function(p){var h="";switch(p){case 1:h="\u8D85\u7EA7\u7BA1\u7406\u5458";break;case 2:h="\u7BA1\u7406\u5458";break;case 3:h="\u6E38\u620F\u4E3B";break;case 4:h="\u8BBE\u5907\u4E3B";break;default:h=""}return h}},{title:"\u9690\u85CF",render:function(p){return(0,e.jsx)(me.Z,{defaultValue:p.hide!==0,onClick:function(k){p.id&&(0,E.tQ)({adminId:p.id,hide:k?1:0})}},p.id)}}];return(0,e.jsx)(R.Z,{title:"\u6279\u91CF\u7F16\u8F91",visible:!0,footer:[],onCancel:D,children:(0,e.jsx)(T.Z,{columns:C,dataSource:d.data})})},xe=je,Ze=t(19632),z=t.n(Ze),Ce=t(81072),pe=t(3089),Fe=t(55241),_=t(86250),M=t(2453),ee=t(42767),ge=function(d){var D=(0,x.useState)([]),C=j()(D,2),S=C[0],p=C[1],h=(0,x.useState)([]),k=j()(h,2),Z=k[0],U=k[1],L=f.Z.useForm(),G=j()(L,1),O=G[0],J=function(){var s=B()(v()().mark(function m(F){var u;return v()().wrap(function(g){for(;;)switch(g.prev=g.next){case 0:return g.next=2,(0,E.yC)({adminId:F});case 2:u=g.sent,p(u.data||[]);case 4:case"end":return g.stop()}},m)}));return function(F){return s.apply(this,arguments)}}();return(0,x.useEffect)(function(){d.data.id&&J(d.data.id)},[d.data.id]),(0,e.jsxs)(R.Z,{title:"\u7ED1\u5B9A\u8D26\u53F7",visible:!0,centered:!0,onCancel:function(){d.onCancel()},footer:[(0,e.jsx)(w.ZP,{onClick:function(){d.onCancel()},children:"\u53D6\u6D88"},"back"),(0,e.jsx)(Fe.Z,{title:"\u786E\u5B9A\u4FDD\u5B58\u5417",content:(0,e.jsxs)("div",{style:{textAlign:"center"},children:[(0,e.jsx)("p",{children:"\u8D26\u53F7\u4E00\u65E6\u7ED1\u5B9A\u540E\uFF0C\u65E0\u6CD5\u88AB\u5220\u9664"}),(0,e.jsx)("a",{onClick:B()(v()().mark(function s(){var m;return v()().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(m=[].concat(z()(S),z()(Z)).map(function(b){return b.id}).filter(Boolean),!(d.data.id&&m)){u.next=7;break}return u.next=4,(0,E.cH)({adminId:d.data.id},m);case 4:d.onSubmit(),u.next=8;break;case 7:d.onCancel();case 8:case"end":return u.stop()}},s)})),children:"\u786E\u5B9A"})]}),children:(0,e.jsx)(w.ZP,{type:"primary",children:"\u4FDD\u5B58"})},"confirm")],children:[S.length>0&&(0,e.jsxs)(I.Z,{gutter:6,style:{marginTop:20},children:[(0,e.jsx)(A.Z,{span:4,children:"\u5DF2\u7ED1\u5B9A:"}),(0,e.jsx)(_.Z,{vertical:!0,gap:"small",children:S.map(function(s){return(0,e.jsx)(I.Z,{children:(0,e.jsx)(ee.Z,{data:s})},s.id)})})]}),Z.length>0&&(0,e.jsxs)(I.Z,{gutter:6,style:{marginTop:20},children:[(0,e.jsx)(A.Z,{span:4,children:"\u672C\u6B21\u65B0\u589E:"}),(0,e.jsx)(_.Z,{vertical:!0,gap:"small",children:Z.map(function(s){return(0,e.jsxs)(I.Z,{children:[(0,e.jsx)(ee.Z,{data:s}),(0,e.jsx)(pe.Z,{style:{marginLeft:20},onClick:function(){U(Z.filter(function(F){return F.id!==s.id}))}})]},s.id)})})]}),(0,e.jsx)(f.Z,{style:{marginTop:20},labelCol:{span:4},wrapperCol:{span:18},form:O,onFinish:function(){var s=B()(v()().mark(function m(F){var u,b;return v()().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(u=F.uid,u){c.next=4;break}return M.ZP.error("uid\u4E0D\u80FD\u4E3A\u7A7A"),c.abrupt("return");case 4:if(!(d.data.id&&u)){c.next=15;break}if(!(Z.filter(function($){return $.id===u}).length>0)){c.next=8;break}return M.ZP.error("\u8BE5\u8D26\u53F7\u5DF2\u6DFB\u52A0"),c.abrupt("return");case 8:if(!(S.filter(function($){return $.id===u}).length>0)){c.next=11;break}return M.ZP.error("\u8BE5\u8D26\u53F7\u5DF2\u6DFB\u52A0"),c.abrupt("return");case 11:return c.next=13,(0,Ce.fn)({adminId:d.data.id,userId:u});case 13:b=c.sent,b.data?U([].concat(z()(Z),[b.data])):M.ZP.error("uid\u975E\u6CD5");case 15:case"end":return c.stop()}},m)}));return function(m){return s.apply(this,arguments)}}(),children:(0,e.jsxs)(I.Z,{children:[(0,e.jsx)(f.Z.Item,{name:"uid",label:"uid",children:(0,e.jsx)(Q.Z,{style:{width:200}})}),(0,e.jsx)(f.Z.Item,{wrapperCol:{offset:8,span:16},children:(0,e.jsx)(w.ZP,{type:"primary",htmlType:"submit",children:"\u6DFB\u52A0"})})]})})]})},Se=ge,be=function(){var d=(0,x.useState)([]),D=j()(d,2),C=D[0],S=D[1],p=(0,x.useState)(!1),h=j()(p,2),k=h[0],Z=h[1],U=(0,x.useState)(void 0),L=j()(U,2),G=L[0],O=L[1],J=(0,x.useState)(!1),s=j()(J,2),m=s[0],F=s[1],u=(0,x.useState)(!1),b=j()(u,2),g=b[0],c=b[1],$=(0,x.useState)(0),re=j()($,2),ae=re[0],K=re[1],Ae=f.Z.useForm(),ye=j()(Ae,1),N=ye[0],Be=(0,x.useState)([]),te=j()(Be,2),ie=te[0],Ee=te[1],De=(0,ve.useModel)("@@initialState"),W=De.initialState,o=W==null?void 0:W.currentUser,X=function(a){return a?parseFloat((a/1e5).toFixed(2)):0},ue=function(a){var n=ie.find(function(l){return l.id===a});return n?n.name:""},le=function(a){N.setFieldsValue(a),Z(!0),c(!0),K(a.role?a.role:0)},se=[{title:"\u59D3\u540D",dataIndex:"name"},{title:"\u5E94\u7528IDs",dataIndex:"appIds",render:function(a){return(0,e.jsx)("div",{children:a==null?void 0:a.map(function(n){return(0,e.jsx)(q.Z,{color:"blue",children:ue(n)},n)})})}},{title:"\u89D2\u8272",dataIndex:"role",render:function(a){var n="";switch(a){case 1:n="\u8D85\u7EA7\u7BA1\u7406\u5458";break;case 2:n="\u7BA1\u7406\u5458";break;case 3:n="\u6E38\u620F\u4E3B";break;case 4:n="\u8BBE\u5907\u4E3B";break;default:n=""}return n}},{title:"\u64CD\u4F5C",render:function(a){return[(0,e.jsx)("a",{onClick:function(){return le(a)},children:"\u7F16\u8F91"},"edit")]}}],de=[{title:"\u59D3\u540D",dataIndex:"name",ellipsis:!0},{title:"\u5E94\u7528IDs",dataIndex:"appIds",render:function(a){return(0,e.jsx)("div",{children:a==null?void 0:a.map(function(n){return(0,e.jsx)(q.Z,{color:"blue",children:ue(n)},n)})})}},{title:"\u89D2\u8272",dataIndex:"role",render:function(a){var n="";switch(a){case 1:n="\u8D85\u7EA7\u7BA1\u7406\u5458";break;case 2:n="\u7BA1\u7406\u5458";break;case 3:n="\u6E38\u620F\u4E3B";break;case 4:n="\u8BBE\u5907\u4E3B";break;case 5:n="\u4EE3\u7406";break;default:n=""}return n}},{title:"\u672C\u6708\u6536\u5165\uFF08\u5143\uFF09",dataIndex:"incomeThisMonth",render:function(a,n){var l;return X((l=n.overview)===null||l===void 0?void 0:l.thisMonthIncome)}},{title:"\u4E0A\u6708\u6536\u5165\uFF08\u5143\uFF09",dataIndex:"incomeLastMonth",render:function(a,n){var l;return X((l=n.overview)===null||l===void 0?void 0:l.lastMonthIncome)}},{title:"\u7D2F\u8BA1\u6536\u5165\uFF08\u5143\uFF09",dataIndex:"incomeTotal",render:function(a,n){var l;return X((l=n.overview)===null||l===void 0?void 0:l.totalIncome)}},{title:"\u5F53\u524D\u5206\u6210\u6BD4\u4F8B",dataIndex:"incomeRate"},{title:"\u64CD\u4F5C",render:function(a){return(0,e.jsxs)(I.Z,{gutter:6,children:[(0,e.jsx)(A.Z,{children:(0,e.jsx)("a",{onClick:function(){return le(a)},children:"\u7F16\u8F91"},"edit")}),a.role===5&&(0,e.jsx)(A.Z,{children:(0,e.jsx)("a",{onClick:function(){O(a)},children:"\u7ED1\u5B9A\u8D26\u53F7"},"grant")})]})}}],ke=function(){N.submit()},we=function(){Z(!1)},H=function(){var r=B()(v()().mark(function a(){var n;return v()().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,(0,E.N0)();case 2:n=i.sent,n.data&&S(n.data);case 4:case"end":return i.stop()}},a)}));return function(){return r.apply(this,arguments)}}(),Te=function(){var r=B()(v()().mark(function a(){var n;return v()().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,(0,E.ln)();case 2:n=i.sent,n.data&&Ee(n.data);case 4:case"end":return i.stop()}},a)}));return function(){return r.apply(this,arguments)}}();(0,x.useEffect)(function(){H(),Te()},[]);var Oe=function(){N.resetFields(),Z(!0),c(!1),K(0)},$e=function(){var r=B()(v()().mark(function a(n){return v()().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.prev=0,i.next=3,(0,E.P7)(n);case 3:i.next=8;break;case 5:return i.prev=5,i.t0=i.catch(0),i.abrupt("return");case 8:Z(!1),H();case 10:case"end":return i.stop()}},a,null,[[0,5]])}));return function(n){return r.apply(this,arguments)}}();return(0,e.jsxs)("div",{children:[(0,e.jsxs)(I.Z,{align:"stretch",gutter:20,children:[(0,e.jsx)(A.Z,{children:(0,e.jsx)(w.ZP,{onClick:Oe,children:"\u65B0\u5EFA\u8D26\u53F7"})}),(0,e.jsx)(A.Z,{children:(0,e.jsx)(w.ZP,{onClick:function(){F(!0)},children:"\u6279\u91CF\u7F16\u8F91"})})]}),(0,e.jsxs)(he.Z,{centered:!0,style:{backgroundColor:"white",padding:"20px",marginTop:20},children:[(o==null?void 0:o.role)&&o.role<3&&(0,e.jsx)(P.Z,{tab:"\u6E38\u620F\u4E3B",children:(0,e.jsx)(T.Z,{columns:se,dataSource:C.filter(function(r){return r.role===3&&r.hide===0})})},"1"),(0,e.jsx)(P.Z,{tab:"\u8BBE\u5907\u4E3B",children:(0,e.jsx)(T.Z,{columns:de,dataSource:C.filter(function(r){return r.role===4&&r.hide===0})})},"2"),(0,e.jsx)(P.Z,{tab:"\u4EE3\u7406",children:(0,e.jsx)(T.Z,{columns:de,dataSource:C.filter(function(r){return r.role===5&&r.hide===0})})},"3"),(o==null?void 0:o.role)&&o.role<2&&(0,e.jsx)(P.Z,{tab:"\u7BA1\u7406\u5458",children:(0,e.jsx)(T.Z,{columns:se,dataSource:C.filter(function(r){return r.role===2&&r.hide===0})})},"4")]}),(0,e.jsx)(R.Z,{title:"\u7F16\u8F91",visible:k,onOk:ke,onCancel:we,children:(0,e.jsxs)(f.Z,{labelCol:{span:4},wrapperCol:{span:18},form:N,onFinish:$e,children:[(0,e.jsx)(f.Z.Item,{name:"id",style:{display:"none"},children:(0,e.jsx)(V.Z,{type:"hidden"})}),(0,e.jsx)(f.Z.Item,{label:"\u7528\u6237\u540D",name:"name",children:(0,e.jsx)(V.Z,{disabled:g})}),(0,e.jsx)(f.Z.Item,{label:"\u5BC6\u7801",name:"password",children:(0,e.jsx)(V.Z.Password,{disabled:g})}),(0,e.jsx)(f.Z.Item,{label:"\u5E94\u7528",name:"appIds",children:(0,e.jsx)(y.Z,{filterOption:function(a,n){var l=typeof(n==null?void 0:n.children)=="string"?n.children:"";return l.toLowerCase().includes(a.toLowerCase())},showSearch:!0,mode:"multiple",children:ie.map(function(r){return(0,e.jsx)(y.Z.Option,{value:r.id,children:r.name},r.id)})})}),(0,e.jsx)(f.Z.Item,{label:"\u89D2\u8272",name:"role",children:(0,e.jsxs)(y.Z,{disabled:g,onSelect:K,children:[(0,e.jsx)(y.Z.Option,{disabled:(o==null?void 0:o.role)&&o.role>1,value:2,children:"\u7BA1\u7406\u5458"}),(0,e.jsx)(y.Z.Option,{disabled:(o==null?void 0:o.role)&&o.role>2,value:3,children:"\u6E38\u620F\u4E3B"}),(0,e.jsx)(y.Z.Option,{value:4,children:"\u8BBE\u5907\u4E3B"}),(0,e.jsx)(y.Z.Option,{value:5,children:"\u4EE3\u7406"})]})}),ae>3&&(0,e.jsxs)(I.Z,{children:[(0,e.jsx)(A.Z,{span:12,children:(0,e.jsx)(f.Z.Item,{labelCol:{span:8},label:"\u6536\u5165\u6BD4\u4F8B",name:"incomeRate",children:(0,e.jsx)(Q.Z,{placeholder:"1-100\u6574\u6570",style:{width:"80%"}})})}),ae===4?(0,e.jsx)(A.Z,{span:12,children:(0,e.jsx)(f.Z.Item,{labelCol:{span:8},label:"\u8BBE\u5907\u6570",name:"deviceCnt",children:(0,e.jsx)(Q.Z,{style:{width:"80%"}})})}):""]})]})}),m&&(0,e.jsx)(xe,{data:C,onSubmit:function(){F(!1),H()}}),G&&(0,e.jsx)(Se,{data:G,onCancel:function(){O(void 0)},onSubmit:function(){O(void 0),H()}})]})},Ie=be}}]);