|
- (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[3101],{85651:function(_e,O,u){"use strict";u.r(O),u.d(O,{default:function(){return Ie}});var et=u(57663),w=u(71577),tt=u(62350),A=u(24565),C=u(2824),E=u(11849),g=u(39428),at=u(34792),d=u(48086),R=u(3182),X=u(49101),m=u(67294),q=u(28790),_=u(16894),nt=u(71194),B=u(50146),rt=u(62999),V=u(85733),ut=u(9715),o=u(55843),st=u(47673),F=u(4107),lt=u(43358),W=u(34041),p=u(48971),v=u(96690);function ee(a){return(0,p.WY)((0,v.w)()+"/api/organize/getorglist")}function te(a){return(0,p.WY)((0,v.w)()+"\u200B/api\u200B/organize/tree",{data:(0,E.Z)({},a)})}var Y={GetOrg:ee,gettree:te},e=u(85893),ae=function(t){var f=(0,m.useState)(),h=(0,C.Z)(f,2),s=h[0],l=h[1];return(0,m.useEffect)(function(){Y.GetOrg().then(function(b){var j=[];for(var S in b.data)j.push((0,e.jsx)(W.Z.Option,{value:S,children:b.data[S]}));l(j)})},[t.values]),(0,e.jsx)(B.Z,{title:t.values.id?"\u7F16\u8F91\u7528\u6237":"\u65B0\u5EFA\u7528\u6237",width:640,visible:t.modalVisible,maskClosable:!1,bodyStyle:{padding:"32px 40px 1px 48px"},footer:null,onCancel:function(){t.onCancel()},destroyOnClose:!0,children:(0,e.jsxs)(o.Z,{preserve:!1,layout:"horizontal",labelCol:{span:6},initialValues:t.values,onFinish:t.onFinish,children:[(0,e.jsx)(o.Z.Item,{name:"id",hidden:!0,children:(0,e.jsx)(F.Z,{})}),(0,e.jsx)(o.Z.Item,{name:"sysOrgId",label:"\u6240\u5C5E\u7EC4\u7EC7",rules:[{required:!0}],children:(0,e.jsx)(V.Z,{style:{width:"100%"},dropdownStyle:{maxHeight:400,overflow:"auto"},treeData:t.treeDatas,placeholder:"\u8BF7\u9009\u62E9\u4E0A\u7EA7\u540D\u79F0",treeDefaultExpandAll:!0})}),(0,e.jsx)(o.Z.Item,{name:"account",label:"\u767B\u5F55\u8D26\u6237(\u624B\u673A\u53F7)",tooltip:"\u521D\u59CB\u5BC6\u7801\u4E3A:123456",rules:[{required:!0,max:255,pattern:/0?(13|14|15|18|17)[0-9]{9}$/,message:"\u624B\u673A\u53F7\u683C\u5F0F\u4E0D\u6B63\u786E"}],children:(0,e.jsx)(F.Z,{placeholder:"\u8BF7\u8F93\u5165\u767B\u5F55\u8D26\u6237",disabled:!!t.values.id})}),(0,e.jsx)(o.Z.Item,{name:"name",label:"\u7528\u6237\u59D3\u540D",rules:[{required:!0,max:255}],children:(0,e.jsx)(F.Z,{placeholder:"\u8BF7\u8F93\u5165\u7528\u6237\u59D3\u540D"})}),(0,e.jsxs)(o.Z.Item,{children:[(0,e.jsx)(w.Z,{htmlType:"button",style:{float:"right",left:10},onClick:t.onCancel,children:"\u53D6\u6D88"}),(0,e.jsx)(w.Z,{type:"primary",htmlType:"submit",style:{float:"right"},children:"\u4FDD\u5B58"})]})]})})},ne=ae,re=function(t){return(0,m.useEffect)(function(){console.log(t)}),(0,e.jsx)(B.Z,{title:"\u53D8\u66F4\u5BC6\u7801",width:640,visible:t.pwdVisible,bodyStyle:{padding:"32px 40px 1px 48px"},footer:null,maskClosable:!1,onCancel:function(){t.onCancel()},destroyOnClose:!0,children:(0,e.jsxs)(o.Z,{layout:"vertical",preserve:!1,labelCol:{span:4},initialValues:t.values,onFinish:t.onFinish,children:[(0,e.jsx)(o.Z.Item,{name:"id",hidden:!0,children:(0,e.jsx)(F.Z,{})}),(0,e.jsx)(o.Z.Item,{name:"account",label:"\u7528\u6237\u8D26\u6237",rules:[{required:!0}],children:(0,e.jsx)(F.Z,{placeholder:"\u8BF7\u8F93\u5165\u7528\u6237\u8D26\u6237",disabled:!0})}),(0,e.jsx)(o.Z.Item,{name:"oPwd",label:"\u65E7\u5BC6\u7801",rules:[{required:!0}],children:(0,e.jsx)(F.Z.Password,{placeholder:"\u8BF7\u8F93\u5165\u65E7\u5BC6\u7801"})}),(0,e.jsx)(o.Z.Item,{name:"nPwd",label:"\u65B0\u5BC6\u7801",rules:[{required:!0}],children:(0,e.jsx)(F.Z.Password,{placeholder:"\u8BF7\u8F93\u5165\u65B0\u5BC6\u7801"})}),(0,e.jsxs)(o.Z.Item,{children:[(0,e.jsx)(w.Z,{htmlType:"button",style:{float:"right",left:10},onClick:t.onCancel,children:"\u53D6\u6D88"}),(0,e.jsx)(w.Z,{type:"primary",htmlType:"submit",style:{float:"right"},children:"\u4FDD\u5B58"})]})]})})},ue=re,se=function(t){return(0,e.jsx)(B.Z,{title:"\u89D2\u8272\u6388\u6743",width:640,visible:t.roleVisible,maskClosable:!1,bodyStyle:{padding:"32px 40px 1px 48px"},footer:null,onCancel:function(){t.onCancel()},destroyOnClose:!0,children:(0,e.jsxs)(o.Z,{layout:"vertical",preserve:!1,labelCol:{span:4},initialValues:t.values,onFinish:t.onFinish,children:[(0,e.jsx)(o.Z.Item,{name:"id",hidden:!0,children:(0,e.jsx)(F.Z,{})}),(0,e.jsx)(o.Z.Item,{name:"sysUserId",hidden:!0,children:(0,e.jsx)(F.Z,{})}),(0,e.jsx)(o.Z.Item,{name:"sysRoleId",rules:[{required:!0}],label:"\u89D2\u8272\u6388\u6743",children:(0,e.jsx)(W.Z,{mode:"multiple",style:{width:"100%"},placeholder:"\u8BF7\u9009\u62E9\u89D2\u8272",children:t.selectData})}),(0,e.jsxs)(o.Z.Item,{children:[(0,e.jsx)(w.Z,{htmlType:"button",style:{float:"right",left:10},onClick:t.onCancel,children:"\u53D6\u6D88"}),(0,e.jsx)(w.Z,{type:"primary",htmlType:"submit",style:{float:"right"},children:"\u4FDD\u5B58"})]})]})})},le=se,ie=function(t){var f=(0,m.useState)([]),h=(0,C.Z)(f,2),s=h[0],l=h[1];return(0,m.useEffect)(function(){function b(){Y.gettree().then(function(j){l(j.data)})}b()},[t.values]),(0,e.jsx)(B.Z,{width:640,bodyStyle:{padding:"32px 40px 48px"},destroyOnClose:!0,title:"\u7ED9 ".concat(t.values.name," \u6388\u6743\u6570\u636E"),visible:t.updateModalVisible,footer:null,onCancel:function(){return t.onCancel()},children:(0,e.jsxs)(o.Z,{preserve:!1,labelCol:{span:4},onFinish:t.onFinish,initialValues:t.values,children:[(0,e.jsx)(o.Z.Item,{name:"orgId",label:"\u9009\u62E9\u673A\u6784",rules:[{required:!0,message:"\u9009\u62E9\u673A\u6784"}],children:(0,e.jsx)(V.Z,{style:{width:"100%"},dropdownStyle:{maxHeight:400,overflow:"auto"},treeData:s,multiple:!0,placeholder:"\u9009\u62E9\u673A\u6784",treeDefaultExpandAll:!0})}),(0,e.jsx)(o.Z.Item,{children:(0,e.jsx)(w.Z,{type:"primary",htmlType:"submit",style:{float:"right"},children:"\u4FDD\u5B58"})})]})})},de=ie;function oe(a){return(0,p.WY)((0,v.w)()+"/api/user/userpage",{method:"post",data:a})}function ce(a){return(0,p.WY)((0,v.w)()+"/api/user/enable/?Id=".concat(a))}function fe(a){return(0,p.WY)((0,v.w)()+"/api/user/disable/?Id=".concat(a))}function he(a){return(0,p.WY)((0,v.w)()+"/api\u200B/user/delete",{method:"POST",data:a})}function me(a){return(0,p.WY)((0,v.w)()+"/api\u200B/user/add",{method:"POST",data:a})}function pe(a){return(0,p.WY)((0,v.w)()+"/api\u200B/user/update",{method:"POST",data:a})}function ve(a){return(0,p.WY)((0,v.w)()+"/api/user/resetuserpwd/?Id=".concat(a))}function Ze(a){return(0,p.WY)((0,v.w)()+"/api/user/updatepwd",{method:"POST",data:a})}function ye(){return(0,p.WY)((0,v.w)()+"/api/roles/getrole")}function ge(a){return(0,p.WY)((0,v.w)()+"/api/user/getuserrole?UserId=".concat(a))}function xe(a){return(0,p.WY)((0,v.w)()+"/api/user/adduserrole",{method:"POST",data:a})}function Ce(a){return(0,p.WY)((0,v.w)()+"/api/user/updateuserrole",{method:"POST",data:a})}function je(a){return P.apply(this,arguments)}function P(){return P=(0,R.Z)((0,g.Z)().mark(function a(t){return(0,g.Z)().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return h.abrupt("return",(0,p.WY)((0,v.w)()+"/api/user/setandalteruserscope",{method:"post",data:t}));case 1:case"end":return h.stop()}},a)})),P.apply(this,arguments)}function Se(a){return(0,p.WY)((0,v.w)()+"\u200B/api\u200B/sysOrg\u200B/tree",{data:(0,E.Z)({},a)})}function De(a){return(0,p.WY)((0,v.w)()+"\u200B/api\u200B/organize/tree",{method:"GET",data:(0,E.Z)({},a)})}var x={Page:oe,Enable:ce,Disable:fe,RemoveUser:he,Update:pe,Add:me,ResetPwd:ve,UpdatePwd:Ze,GetRoleDic:ye,GetUserRole:ge,AddUserRole:xe,UpdateUserRole:Ce,SetDataRole:je,gettree:Se,gettree2:De},it=u(62255),Fe=function(){var a=(0,R.Z)((0,g.Z)().mark(function t(f){return(0,g.Z)().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return s.prev=0,s.next=3,x.Add(f).then(function(l){l.data?d.default.success("\u6DFB\u52A0\u6210\u529F"):d.default.error("\u6DFB\u52A0\u5931\u8D25,"+l.errors)});case 3:return s.abrupt("return",!0);case 6:return s.prev=6,s.t0=s.catch(0),d.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),s.abrupt("return",!1);case 10:case"end":return s.stop()}},t,null,[[0,6]])}));return function(f){return a.apply(this,arguments)}}(),be=function(){var a=(0,R.Z)((0,g.Z)().mark(function t(f){var h;return(0,g.Z)().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return h=d.default.loading("\u6B63\u5728\u5206\u914D\u6570\u636E\u6743\u9650"),l.prev=1,l.next=4,x.SetDataRole((0,E.Z)({},f));case 4:return h(),d.default.success("\u5206\u914D\u6570\u636E\u6743\u9650\u6210\u529F"),l.abrupt("return",!0);case 9:return l.prev=9,l.t0=l.catch(1),h(),d.default.error("\u5206\u914D\u6570\u636E\u6743\u9650\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),l.abrupt("return",!1);case 14:case"end":return l.stop()}},t,null,[[1,9]])}));return function(f){return a.apply(this,arguments)}}(),we=function(){var a=(0,R.Z)((0,g.Z)().mark(function t(f){return(0,g.Z)().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return s.prev=0,s.next=3,x.Update(f).then(function(l){l.data?d.default.success("\u4FEE\u6539\u6210\u529F"):d.default.error("\u4FEE\u6539\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01")});case 3:return s.abrupt("return",!0);case 6:return s.prev=6,s.t0=s.catch(0),d.default.error("\u4FEE\u6539\u5931\u8D25\u8BF7\u91CD\u8BD5!"),s.abrupt("return",!1);case 10:case"end":return s.stop()}},t,null,[[0,6]])}));return function(f){return a.apply(this,arguments)}}(),dt="User",Re=function(){var t=(0,m.useState)(),f=(0,C.Z)(t,2),h=f[0],s=f[1],l=(0,m.useState)({}),b=(0,C.Z)(l,2),j=b[0],S=b[1],Ee=(0,m.useState)(),G=(0,C.Z)(Ee,2),Be=G[0],$=G[1],I=(0,m.useRef)(),Ue=(0,m.useState)(),M=(0,C.Z)(Ue,2),ot=M[0],ct=M[1],Pe=(0,m.useState)(!1),z=(0,C.Z)(Pe,2),Te=z[0],T=z[1],Oe=(0,m.useState)(!1),k=(0,C.Z)(Oe,2),Ae=k[0],U=k[1],Ve=(0,m.useState)(),L=(0,C.Z)(Ve,2),We=L[0],Ye=L[1],Ge=(0,m.useState)(),H=(0,C.Z)(Ge,2),$e=H[0],Me=H[1],ze=(0,m.useState)(),K=(0,C.Z)(ze,2),ft=K[0],ht=K[1],ke=(0,m.useState)(),N=(0,C.Z)(ke,2),Le=N[0],He=N[1],Ke=function(n){Me(n),x.GetRoleDic().then(function(r){var c=[];for(var Z in r.data)c.push((0,e.jsx)(Option,{value:Z,children:r.data[Z]}));Ye(c),x.GetUserRole(n).then(function(y){S(y.data),U(!0)})})},Ne=function(){var i=(0,R.Z)((0,g.Z)().mark(function n(r){return(0,g.Z)().wrap(function(Z){for(;;)switch(Z.prev=Z.next){case 0:if(console.log(r),r){Z.next=5;break}d.default.error("\u8BF7\u9009\u62E9\u6570\u636E"),Z.next=7;break;case 5:return Z.next=7,x.RemoveUser(r.map(function(y){return y.id})).then(function(y){y.data?(d.default.success("\u5220\u9664\u6210\u529F\uFF0C\u5373\u5C06\u5237\u65B0"),I.current.reloadAndRest()):d.default.error("\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5")});case 7:case"end":return Z.stop()}},n)}));return function(r){return i.apply(this,arguments)}}(),J=function(n){},Je=function(n){x.ResetPwd(n.id).then(function(r){r.data?d.default.success("\u91CD\u7F6E\u6210\u529F"):d.default.error("\u91CD\u7F6E\u5931\u8D25")})},Qe=function(n){var r=[];return r.push((0,e.jsx)("a",{disabled:n.adminType==2,style:{pointerEvents:n.adminType==2?"none":"auto"},onClick:function(){s(!0),S(n)},children:"\u4FEE\u6539"})),r.push((0,e.jsx)(A.Z,{title:"\u786E\u8BA4\u5220\u9664\u5417\uFF1F",onConfirm:function(){Ne([n])},onCancel:J,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",children:(0,e.jsx)("a",{disabled:n.adminType==2,style:{pointerEvents:n.adminType==2?"none":"auto"},children:"\u5220\u9664"})})),r.push((0,e.jsx)(A.Z,{title:"\u786E\u8BA4\u91CD\u7F6E\u5BC6\u7801\u5417\uFF1F",onConfirm:function(){Je(n)},onCancel:J,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",children:(0,e.jsx)("a",{children:"\u91CD\u7F6E\u5BC6\u7801"})})),r.push((0,e.jsx)("a",{onClick:function(){T(!0),S(n)},children:"\u4FEE\u6539\u5BC6\u7801"})),r.push((0,e.jsx)("a",{disabled:n.adminType==2,style:{pointerEvents:n.adminType==2?"none":"auto"},onClick:function(){Ke(n.id)},children:"\u89D2\u8272\u6388\u6743"})),r},Xe=[{title:"\u4E3B\u952E",dataIndex:"id",tip:"key",hideInSearch:!0,hideInTable:!0},{title:"\u7528\u6237\u59D3\u540D",dataIndex:"name"},{title:"\u767B\u5F55\u8D26\u6237",dataIndex:"account"},{title:"\u6240\u5C5E\u52A0\u76DF\u5546",dataIndex:"companyName"},{title:"\u521B\u5EFA\u65F6\u95F4",dataIndex:"createAt",hideInSearch:!0,sorter:!1},{title:"\u64CD\u4F5C",dataIndex:"option",valueType:"option",fixed:"right",width:350,render:function(n,r){return Qe(r)}}];(0,m.useEffect)(function(){qe()},[]);function qe(){x.gettree2().then(function(i){He(i.data)})}return(0,e.jsxs)(q.ZP,{host:!0,header:{title:"",breadcrumb:{}},children:[(0,e.jsx)(_.ZP,{actionRef:I,rowKey:"id",pagination:{defaultPageSize:10},search:{labelWidth:120},toolBarRender:function(){return(0,e.jsxs)(w.Z,{type:"primary",onClick:function(){s(!0)},children:[(0,e.jsx)(X.Z,{})," \u65B0\u5EFA"]},"create")},request:function(){var i=(0,R.Z)((0,g.Z)().mark(function n(r){var c,Z;return(0,g.Z)().wrap(function(D){for(;;)switch(D.prev=D.next){case 0:return c=[],Z=0,D.next=4,x.Page(r).then(function(Q){c=Q.data.data,Z=Q.data.total});case 4:return D.abrupt("return",{data:c,success:!0,total:Z});case 5:case"end":return D.stop()}},n)}));return function(n){return i.apply(this,arguments)}}(),columns:Xe}),(0,e.jsx)(ne,{onFinish:function(){var i=(0,R.Z)((0,g.Z)().mark(function n(r){var c;return(0,g.Z)().wrap(function(y){for(;;)switch(y.prev=y.next){case 0:if(c=!1,!r.id){y.next=7;break}return y.next=4,we(r);case 4:c=y.sent,y.next=11;break;case 7:return r.phone=r.account,y.next=10,Fe(r);case 10:c=y.sent;case 11:c&&(s(!1),S({}),I.current&&I.current.reloadAndRest()),I.current.reloadAndRest();case 13:case"end":return y.stop()}},n)}));return function(n){return i.apply(this,arguments)}}(),onCancel:function(){s(!1),S({})},treeDatas:Le,modalVisible:h,values:j||{}}),(0,e.jsx)(ue,{onFinish:function(n){x.UpdatePwd(n).then(function(r){r.data?d.default.success("\u4FEE\u6539\u6210\u529F"):d.default.error("\u4FEE\u6539\u5931\u8D25"),T(!1)})},onCancel:function(){T(!1)},values:j||{},pwdVisible:Te}),(0,e.jsx)(le,{onFinish:function(n){n.id?x.UpdateUserRole(n).then(function(r){r.data?d.default.success("\u4FEE\u6539\u6210\u529F"):d.default.error("\u4FEE\u6539\u5931\u8D25"),U(!1)}):(n.sysUserId=$e,x.AddUserRole(n).then(function(r){r.data?d.default.success("\u6DFB\u52A0\u6210\u529F"):d.default.error("\u6DFB\u52A0\u5931\u8D25"),U(!1)}))},selectData:We,values:j,onCancel:function(){S({}),U(!1)},roleVisible:Ae}),j&&Object.keys(j).length?(0,e.jsx)(de,{onFinish:function(){var i=(0,R.Z)((0,g.Z)().mark(function n(r){var c,Z;return(0,g.Z)().wrap(function(D){for(;;)switch(D.prev=D.next){case 0:return c={sysUserId:j.id,sysOrgId:r.orgId},D.next=3,be(c);case 3:Z=D.sent,Z&&($(!1),S({}),I.current&&I.current.reloadAndRest());case 5:case"end":return D.stop()}},n)}));return function(n){return i.apply(this,arguments)}}(),onCancel:function(){$(!1),S({})},updateModalVisible:Be,values:j}):null]})},Ie=Re}}]);
|