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