(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[7915],{64317:function(Fe,ee,e){"use strict";var le=e(95395),z=e(99653),ue=e(97445),B=e(67294),b=e(67080),se=e(22270),H=e(66758),ve=["fieldProps","children","params","proFieldProps","mode","valueEnum","request","showSearch","options"],de=["fieldProps","children","params","proFieldProps","mode","valueEnum","request","options"],me=B.forwardRef(function(v,re){var U=v.fieldProps,ne=v.children,X=v.params,ae=v.proFieldProps,Y=v.mode,w=v.valueEnum,k=v.request,S=v.showSearch,D=v.options,q=(0,ue.Z)(v,ve),$=(0,B.useContext)(H.Z);return B.createElement(b.Z,(0,le.Z)({mode:"edit",valueEnum:(0,se.h)(w),request:k,params:X,valueType:"select",filedConfig:{customLightMode:!0},fieldProps:(0,z.Z)({options:D,mode:Y,showSearch:S,getPopupContainer:$.getPopupContainer},U),ref:re,proFieldProps:ae},q),ne)}),J=B.forwardRef(function(v,re){var U=v.fieldProps,ne=v.children,X=v.params,ae=v.proFieldProps,Y=v.mode,w=v.valueEnum,k=v.request,S=v.options,D=(0,ue.Z)(v,de),q=(0,z.Z)({options:S,mode:Y||"multiple",labelInValue:!0,showSearch:!0,showArrow:!1,autoClearSearchValue:!0,optionLabelProp:"label"},U),$=(0,B.useContext)(H.Z);return B.createElement(b.Z,(0,le.Z)({mode:"edit",valueEnum:(0,se.h)(w),request:k,params:X,valueType:"select",filedConfig:{customLightMode:!0},fieldProps:(0,z.Z)({getPopupContainer:$.getPopupContainer},q),ref:re,proFieldProps:ae},D),ne)}),fe=me,Q=J,te=fe;te.SearchSelect=Q,te.displayName="ProFormComponent",ee.Z=te},90430:function(Fe,ee,e){"use strict";e.r(ee),e.d(ee,{default:function(){return Xe}});var le=e(13062),z=e(71230),ue=e(57663),B=e(71577),b=e(3182),se=e(89032),H=e(15746),ve=e(59250),de=e(13013),me=e(30887),J=e(54689),fe=e(34792),Q=e(48086),te=e(47673),v=e(4107),re=e(71194),U=e(50146),ne=e(49111),X=e(19650),ae=e(71153),Y=e(60331),w=e(2824),k=e(94043),S=e.n(k),D=e(68489),q=e(57254),$=e(49101),Re=e(70844),Se=e(16894),he=e(77613),n=e(67294),qe=e(43358),Te=e(97268),L=e(11849),_e=e(62999),je=e(51753),W=e(15196),Ie=e(71975),G=e(5966),ie=e(64317),Be=e(86468),De=e(60780),Oe=e.n(De),et=e(9715),Ke=e(93766),oe=e(83273),Me=e(34206),Ve=e(46229),pe=e(72941),be=e(28707),ye=e.n(be),we=e(32597),_=e(17393),Ae=e(21770),Pe=e(22270),Ue=e(48171),$e=e(66646),Le=e(41151),We=["onTableChange","maxLength","formItemProps","recordCreatorProps","rowKey","controlled","defaultValue"],Ge=["record","position","creatorButtonText","newRecordType","parentKey"],ge=n.createContext(void 0);function Ce(t){var f=t.children,o=t.record,d=t.position,A=t.newRecordType,x=t.parentKey,m=(0,n.useContext)(ge);return n.cloneElement(f,(0,_.Z)((0,_.Z)({},f.props),{},{onClick:function(){var N=(0,we.Z)(ye().mark(function h(j){var T,p,i,a;return ye().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return s.next=2,(T=(p=f.props).onClick)===null||T===void 0?void 0:T.call(p,j);case 2:if(a=s.sent,a!==!1){s.next=5;break}return s.abrupt("return");case 5:m==null||(i=m.current)===null||i===void 0||i.addEditRecord(o,{position:d,newRecordType:A,parentKey:x});case 6:case"end":return s.stop()}},h)}));function M(h){return N.apply(this,arguments)}return M}()}))}function Ee(t){var f,o=t.onTableChange,d=t.maxLength,A=t.formItemProps,x=t.recordCreatorProps,m=t.rowKey,N=t.controlled,M=t.defaultValue,h=(0,pe.Z)(t,We),j=(0,n.useRef)(),T=(0,n.useRef)();(0,n.useImperativeHandle)(h.actionRef,function(){return j.current});var p=(0,Ae.Z)(function(){return t.value||M||[]},{value:t.value,onChange:t.onChange}),i=(0,Ve.Z)(p,2),a=i[0],g=i[1],s=n.useMemo(function(){return typeof m=="function"&&m?m:function(I,Z){return I[m]||Z}},[m]);(0,n.useEffect)(function(){!t.controlled||a.forEach(function(I,Z){var P;(P=T.current)===null||P===void 0||P.setFieldsValue((0,Me.Z)({},s(I,Z),I))},{})},[a,t.controlled]);var F=x||{},l=F.record,c=F.position,u=F.creatorButtonText,R=F.newRecordType,y=F.parentKey,C=(0,pe.Z)(F,Ge),V=c==="top",E=(0,n.useMemo)(function(){return d&&d<=(a==null?void 0:a.length)?!1:x!==!1&&n.createElement(Ce,{record:(0,Pe.h)(l,a==null?void 0:a.length,a)||{},position:c,parentKey:(0,Pe.h)(y,a==null?void 0:a.length,a),newRecordType:R},n.createElement(B.Z,(0,oe.Z)({type:"dashed",style:{display:"block",margin:"10px 0",width:"100%"},icon:n.createElement($.Z,null)},C),u||"\u6DFB\u52A0\u4E00\u884C\u6570\u636E"))},[x,d,a==null?void 0:a.length]),Ye=(0,n.useMemo)(function(){return E?V?{components:{header:{wrapper:function(Z){var P,O=Z.className,K=Z.children;return n.createElement("thead",{className:O},K,n.createElement("tr",{style:{position:"relative"}},n.createElement("td",{colSpan:0,style:{visibility:"hidden"}},E),n.createElement("td",{style:{position:"absolute",left:0,width:"100%"},colSpan:(P=h.columns)===null||P===void 0?void 0:P.length},E)))}}}}:{tableViewRender:function(Z,P){var O,K;return n.createElement(n.Fragment,null,(O=(K=t.tableViewRender)===null||K===void 0?void 0:K.call(t,Z,P))!==null&&O!==void 0?O:P,E)}}:{}},[V,E]),xe=(0,_.Z)({},t.editable),ke=(0,Ue.J)(function(I,Z){var P,O,K;if((P=t.editable)===null||P===void 0||(O=P.onValuesChange)===null||O===void 0||O.call(P,I,Z),(K=t.onValuesChange)===null||K===void 0||K.call(t,Z,I),t.controlled){var ce;t==null||(ce=t.onChange)===null||ce===void 0||ce.call(t,Z)}});return((t==null?void 0:t.onValuesChange)||((f=t.editable)===null||f===void 0?void 0:f.onValuesChange)||t.controlled&&(t==null?void 0:t.onChange))&&(xe.onValuesChange=ke),n.createElement(ge.Provider,{value:j},n.createElement(Le.Z,(0,oe.Z)({search:!1,options:!1,pagination:!1,rowKey:m,revalidateOnFocus:!1},h,Ye,{tableLayout:"fixed",actionRef:j,onChange:o,dataSource:a,editable:(0,_.Z)((0,_.Z)({},xe),{},{formProps:{formRef:T}}),onDataSourceChange:function(Z){g(Z)}})))}function Ze(t){var f=t.name,o=t.formItemProps;return f?n.createElement(Ke.Z.Item,(0,oe.Z)({style:{maxWidth:"100%"}},o,{name:t.name}),n.createElement(n.Fragment,null,n.createElement($e.Field,{shouldUpdate:!0,name:t.name,isList:!0},function(d){return n.createElement(Ee,(0,oe.Z)({},t,{value:d.value,onChange:d.onChange}))}))):n.createElement(Ee,t)}Ze.RecordCreator=Ce;var Ne=Ze,r=e(85893),ze=(0,he.P)(function(t){var f,o=t.user,d=t.readonly,A=t.onClose,x=t.onOk,m=(0,D.m2)(),N=(0,n.useRef)(),M=o==null||(f=o.roles)===null||f===void 0?void 0:f.map(function(l){return l.id}),h=!!(o!=null&&o.id),j=m.depts,T=m.positions,p=(0,n.useState)(function(){var l;return(o==null||(l=o.userPositions)===null||l===void 0?void 0:l.map(function(c){return c.id}))||[]}),i=(0,w.Z)(p,2),a=i[0],g=i[1],s=(0,n.useMemo)(function(){return Oe()(j.map(function(l){return{value:l.id,title:l.name,key:l.id,parentId:l.parentId}}),{parentProperty:"parentId",customID:"value"})},[j]);(0,n.useEffect)(function(){T.length===0&&m.loadPositions({pageSize:1024})},[]);var F=[{title:"\u673A\u6784\u540D\u79F0",dataIndex:"deptId",width:"30%",renderFormItem:function(c,u,R){var y=u.type,C=u.defaultRender,V=u.fieldProps;return y==="form"?(0,r.jsx)(je.Z,(0,L.Z)((0,L.Z)({allowClear:!0,treeData:s},V),{},{placeholder:"\u8BF7\u9009\u62E9\u673A\u6784"})):C(c)}},{title:"\u5C97\u4F4D\u540D\u79F0",dataIndex:"positionId",width:"50%",renderFormItem:function(c,u,R){var y=u.type,C=u.defaultRender;return y==="form"?(0,r.jsx)(Te.Z,{options:T.map(function(V){return{label:V.name,value:V.id}}),placeholder:"\u8BF7\u9009\u62E9\u5C97\u4F4D"}):C(c)}},{title:"\u64CD\u4F5C",valueType:"option",width:200}];return(0,r.jsxs)(Ie.Z,{title:d?"\u7CFB\u7EDF\u7528\u6237\u8BE6\u60C5":h?"\u4FEE\u6539\u7528\u6237":"\u65B0\u5EFA\u7528\u6237",formRef:N,visible:!0,initialValues:(0,L.Z)((0,L.Z)({},o),{},{roles:M}),submitter:{submitButtonProps:{style:{display:d?"none":"block"}}},drawerProps:{forceRender:!0,destroyOnClose:!0,onClose:function(){A()}},onFinish:function(){var l=(0,b.Z)(S().mark(function c(u){var R;return S().wrap(function(C){for(;;)switch(C.prev=C.next){case 0:return C.next=2,m.saveOrUpdateUser((0,L.Z)((0,L.Z)({},o),u));case 2:R=C.sent,R.success&&x();case 4:case"end":return C.stop()}},c)}));return function(c){return l.apply(this,arguments)}}(),children:[(0,r.jsxs)(W.ZP.Group,{children:[(0,r.jsx)(G.Z,{name:"name",width:"md",label:"\u7528\u6237\u540D",tooltip:"\u6700\u957F\u4E3A 24 \u4F4D",id:"form-name",placeholder:"\u8BF7\u8F93\u5165\u540D\u79F0",readonly:d,required:!0,rules:[{required:!0,message:"\u7528\u6237\u540D\u4E0D\u80FD\u4E3A\u7A7A"}]}),(0,r.jsx)(G.Z,{width:"md",readonly:d,name:"username",label:"\u767B\u5F55\u540D",placeholder:"\u8BF7\u8F93\u5165\u767B\u5F55\u8D26\u6237\u540D\u79F0",rules:[{required:!0,message:"\u767B\u5F55\u540D\u4E0D\u80FD\u4E3A\u7A7A"},{validator:function(){var l=(0,b.Z)(S().mark(function u(R,y){var C;return S().wrap(function(E){for(;;)switch(E.prev=E.next){case 0:if(y!==(o==null?void 0:o.username)){E.next=2;break}return E.abrupt("return");case 2:return E.next=4,D.hi.checkUsernameExist(y);case 4:if(C=E.sent,!C){E.next=7;break}throw new Error("\u767B\u5F55\u540D\u5DF2\u5B58\u5728!");case 7:case"end":return E.stop()}},u)}));function c(u,R){return l.apply(this,arguments)}return c}()}],required:!0})]}),!h&&(0,r.jsxs)(W.ZP.Group,{children:[(0,r.jsx)(G.Z.Password,{width:"md",readonly:d,name:"password",label:"\u8F93\u5165\u5BC6\u7801",placeholder:"\u8BF7\u8F93\u5165\u5BC6\u7801",rules:[{required:!h,message:"\u8BF7\u8F93\u5165\u5BC6\u7801!"}],required:!h}),(0,r.jsx)(G.Z.Password,{width:"md",readonly:d,name:"rePassword",label:"\u786E\u8BA4\u5BC6\u7801",placeholder:"\u518D\u6B21\u8F93\u5165\u5BC6\u7801",rules:[{required:!h,message:"\u786E\u8BA4\u5BC6\u7801\u4E0D\u80FD\u4E3A\u7A7A!"},function(l){var c=l.getFieldValue;return{validator:function(R,y){return!y||c("password")===y?Promise.resolve():Promise.reject(new Error("\u4E24\u6B21\u8F93\u5165\u5BC6\u7801\u4E0D\u4E00\u81F4!"))}}}],required:!h})]}),(0,r.jsxs)(W.ZP.Group,{children:[(0,r.jsx)(ie.Z,{readonly:d,required:!0,options:[{value:"M",label:"\u7537"},{value:"F",label:"\u5973"}],width:"md",name:"gender",label:"\u6027\u522B"}),(0,r.jsx)(ie.Z,{readonly:d,required:!0,options:[{value:1,label:"\u6FC0\u6D3B"},{value:0,label:"\u5931\u6D3B"}],width:"md",name:"status",label:"\u72B6\u6001"})]}),(0,r.jsxs)(W.ZP.Group,{children:[(0,r.jsx)(G.Z,{name:"phone",readonly:d,width:"md",label:"\u624B\u673A",placeholder:"\u8BF7\u8F93\u5165\u624B\u673A\u53F7"}),(0,r.jsx)(G.Z,{width:"md",name:"email",readonly:d,label:"\u90AE\u7BB1",placeholder:"\u8BF7\u8F93\u5165\u90AE\u7BB1",rules:[{type:"email",message:"\u8BF7\u8F93\u5165\u90AE\u7BB1!"}]}),(0,r.jsx)(Be.FQ,{name:"deptId",width:"md",treeData:s,label:"\u6240\u5C5E\u90E8\u95E8",placeholder:"\u8BF7\u9009\u62E9\u90E8\u95E8",readonly:d,value:o==null?void 0:o.deptId}),(0,r.jsx)(ie.Z,{mode:"tags",readonly:d,request:(0,b.Z)(S().mark(function l(){return S().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.abrupt("return",D.hi.loadRoles({current:1,pageSize:1024}).then(function(R){return R.list.map(function(y){return{label:y.name,value:y.id}})}));case 1:case"end":return u.stop()}},l)})),width:"md",name:"roles",label:"\u89D2\u8272\u5217\u8868"})]}),(0,r.jsx)(W.ZP.Group,{children:(0,r.jsx)(W.ZP.Item,{label:"\u9009\u62E9\u5C97\u4F4D",name:"userPositions",trigger:"onValuesChange",children:(0,r.jsx)(Ne,{rowKey:"id",toolBarRender:!1,columns:F,recordCreatorProps:{newRecordType:"dataSource",position:"top",record:function(){return{id:"".concat(Date.now())}}},editable:{type:"multiple",editableKeys:a,onChange:g,actionRender:function(c,u,R){return[R.delete]}}})})})]})}),He=e(40017),Je=["magenta","volcano","cyan","blue","geekblue","purple"],Qe=(0,he.P)(function(){var t=(0,D.m2)(),f=(0,n.useRef)(),o=(0,n.useRef)(),d=(0,n.useState)(),A=(0,w.Z)(d,2),x=A[0],m=A[1],N=(0,n.useState)(),M=(0,w.Z)(N,2),h=M[0],j=M[1];(0,n.useEffect)(function(){t.loadUsers({deptId:h})},[h,t]),(0,n.useEffect)(function(){t.loadPermissions()},[t]);var T=[{title:"\u7EC4\u7EC7\u673A\u6784",dataIndex:"deptName",hideInSearch:!0},{title:"\u59D3\u540D",dataIndex:"name",ellipsis:!0},{title:"\u89D2\u8272",dataIndex:"phone",hideInSearch:!0,renderFormItem:function(i,a){var g=a.defaultRender;return g(i)},render:function(i,a){var g;return(0,r.jsx)(X.Z,{children:(g=a.roles)===null||g===void 0?void 0:g.map(function(s,F){return(0,r.jsx)(Y.Z,{color:Je[F],children:s.name},s.id)})})}},{title:"\u624B\u673A",dataIndex:"phone",search:!1},{title:"\u72B6\u6001",dataIndex:"status",search:!1,valueEnum:{0:{text:"\u5931\u6D3B",status:"Default"},1:{text:"\u6FC0\u6D3B",status:"Processing"}}},{title:"\u521B\u5EFA\u65F6\u95F4",key:"showTime",dataIndex:"createAt",valueType:"dateTime",hideInSearch:!0},{title:"\u64CD\u4F5C",valueType:"option",render:function(i,a){return[(0,r.jsx)("a",{onClick:function(){m({visible:!0,current:a})},children:"\u7F16\u8F91"},"editable"),(0,r.jsx)(de.Z,{overlay:(0,r.jsxs)(J.Z,{onClick:function(s){var F=s.key;F==="resetPwd"?U.Z.confirm({title:"\u91CD\u7F6E\u5BC6\u7801",content:(0,r.jsx)(v.Z.Password,{placeholder:"\u8F93\u5165\u5BC6\u7801",onChange:function(c){return o.current=c.target.value}}),okType:"primary",okText:"\u4FEE\u6539",onOk:function(c){return o.current?(D.hi.updateUser({id:a.id,password:o.current}).then(function(u){u.success&&(Q.default.success("\u4FEE\u6539\u6210\u529F"),o.current=void 0,c())}),!1):(Q.default.error("\u8BF7\u8F93\u5165\u5BC6\u7801"),!1)}}):F==="delete"&&U.Z.confirm({title:"\u5220\u9664\u7528\u6237",content:"\u786E\u5B9A\u5220\u9664\u5F53\u524D\u7528\u6237\u5417\uFF1F",okType:"danger",okText:"\u5220\u9664",onOk:function(){t.deleteUser(a.id).then(function(c){if(c.success){var u;Q.default.success("\u5220\u9664\u6210\u529F"),(u=f.current)===null||u===void 0||u.reload()}})}})},children:[(0,r.jsx)(J.Z.Item,{children:"\u91CD\u7F6E\u5BC6\u7801"},"resetPwd"),(0,r.jsx)(J.Z.Item,{children:"\u5220\u9664\u7528\u6237"},"delete")]}),children:(0,r.jsxs)("a",{className:"ant-dropdown-link",onClick:function(s){return s.preventDefault()},children:["\u66F4\u591A",(0,r.jsx)(q.Z,{})]})},"action")]}}];return(0,r.jsx)(Re.ZP,{title:!1,children:(0,r.jsxs)(z.Z,{gutter:20,children:[(0,r.jsx)(H.Z,{xs:0,md:8,children:(0,r.jsx)(He.A,{onSelect:function(i){return j(i)}})}),(0,r.jsxs)(H.Z,{xs:24,md:16,children:[(0,r.jsx)(Se.ZP,{columns:T,actionRef:f,dataSource:t.users,request:function(){var p=(0,b.Z)(S().mark(function i(a){return S().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return s.abrupt("return",t.loadUsers(a));case 1:case"end":return s.stop()}},i)}));return function(i){return p.apply(this,arguments)}}(),columnsState:{persistenceKey:"pro-table-singe-demos",persistenceType:"localStorage"},rowKey:"id",search:{labelWidth:"auto"},pagination:{pageSize:5},dateFormatter:"string",headerTitle:"\u7CFB\u7EDF\u7528\u6237\u5217\u8868",toolBarRender:function(){return[(0,r.jsx)(B.Z,{icon:(0,r.jsx)($.Z,{}),type:"primary",onClick:function(){m({visible:!0})},children:"\u65B0\u5EFA"},"button")]}}),(x==null?void 0:x.visible)&&(0,r.jsx)(ze,{onClose:function(){m(void 0)},readonly:x.readonly,onOk:function(){var i;m(void 0),(i=f.current)===null||i===void 0||i.reload()},user:x.current})]})]})})}),Xe=Qe}}]);
