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