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
14 KiB

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