|
- (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[8054],{95816:function(Ie,H,n){"use strict";n.r(H),n.d(H,{default:function(){return Fe}});var Re=n(57338),ne=n(273),Me=n(57663),N=n(71577),be=n(62350),J=n(24565),S=n(2824),o=n(39428),Te=n(34792),v=n(48086),x=n(3182),te=n(49101),p=n(67294),re=n(28790),ue=n(85224),le=n(16894),se=n(12826),Ee=n(71194),Q=n(50146),Be=n(9715),M=n(55843),we=n(47673),P=n(4107),Oe=n(43358),X=n(34041),t=n(85893),ie=function(a){var d=X.Z.Option,A=X.Z.OptGroup;return(0,t.jsx)(Q.Z,{title:a.values.id?"\u7F16\u8F91":"\u65B0\u5EFA",width:640,visible:a.modalVisible,bodyStyle:{padding:"32px 40px 1px 48px"},footer:null,onCancel:function(){a.onCancel()},destroyOnClose:!0,maskClosable:!1,children:(0,t.jsxs)(M.Z,{layout:"horizontal",labelCol:{span:6},preserve:!1,initialValues:a.values,onFinish:a.onFinish,children:[(0,t.jsx)(M.Z.Item,{name:"id",hidden:!0,children:(0,t.jsx)(P.Z,{})}),(0,t.jsx)(M.Z.Item,{name:"name",label:"\u4F01\u4E1A\u540D\u79F0",rules:[{required:!0,max:30}],children:(0,t.jsx)(P.Z,{placeholder:"\u8BF7\u8F93\u5165\u4F01\u4E1A\u540D\u79F0"})}),(0,t.jsx)(M.Z.Item,{name:"adminName",label:"\u7BA1\u7406\u5458\u59D3\u540D",rules:[{required:!0,max:20}],children:(0,t.jsx)(P.Z,{placeholder:"\u8BF7\u8F93\u5165\u7BA1\u7406\u5458\u59D3\u540D"})}),(0,t.jsx)(M.Z.Item,{name:"email",label:"\u767B\u9646\u8D26\u53F7(\u624B\u673A\u53F7)",tooltip:"\u521D\u59CB\u5BC6\u7801\u4E3A:123456",rules:[{required:!0,max:50,message:"\u8BF7\u8F93\u5165\u624B\u673A\u53F7"},{pattern:/^1[3-9][0-9]{9}$/,message:"\u624B\u673A\u53F7\u683C\u5F0F\u4E0D\u6B63\u786E"}],children:(0,t.jsx)(P.Z,{placeholder:"\u624B\u673A\u53F7\u662F\u767B\u5F55\u8D26\u6237",disabled:!!a.values.id})}),(0,t.jsx)(M.Z.Item,{name:"remark",label:"\u5907\u6CE8",rules:[{max:100}],children:(0,t.jsx)(P.Z,{placeholder:"\u8BF7\u8F93\u5165\u5907\u6CE8"})}),(0,t.jsxs)(M.Z.Item,{children:[(0,t.jsx)(N.Z,{htmlType:"button",style:{float:"right",left:10},onClick:a.onCancel,children:"\u53D6\u6D88"}),(0,t.jsx)(N.Z,{type:"primary",htmlType:"submit",style:{float:"right"},children:"\u4FDD\u5B58"})]})]})})},oe=ie,Pe=n(13062),de=n(71230),$e=n(89032),ce=n(15746),Ge=n(32157),fe=n(7573),Ve=n(63185),he=n(9676),F=n(48971),j=n(96690),I={companyPage:function(a){return(0,F.WY)((0,j.w)()+"/api/company/companypage",{method:"POST",data:a})},addCompany:function(a){return(0,F.WY)((0,j.w)()+"/api/company/add",{method:"POST",data:a})},updateCompany:function(a){return(0,F.WY)((0,j.w)()+"/api/company/update",{method:"POST",data:a})},removeCompany:function(a){return(0,F.WY)((0,j.w)()+"/api/company/delete",{method:"POST",data:a})},Enable:function(a){return(0,F.WY)((0,j.w)()+"/api/company/enable/?Id=".concat(a),{method:"Get"})},Disable:function(a){return(0,F.WY)((0,j.w)()+"/api/company/disable/?Id=".concat(a),{method:"Get"})},addRoleMenu:function(a){return(0,F.WY)((0,j.w)()+"/api/roles/addorupdatemenurole",{method:"POST",data:a})},GetMenu:function(a){return(0,F.WY)((0,j.w)()+"\u200B/api/menu/menuparmytrees?getType=".concat(a.getType,"&&type=").concat(a.type),{method:"Get"})},GetRoleMenu:function(a){return(0,F.WY)((0,j.w)()+"/api/roles/getmenurole/?RoleId=".concat(a))},menutreepage:function(a){return(0,F.WY)((0,j.w)()+"/api\u200B/menu/getmenutreepage",{method:"post",data:a})}},me=n(62255),ve=function(a){var d=(0,p.useState)([]),A=(0,S.Z)(d,2),e=A[0],h=A[1],k=(0,p.useState)(),Y=(0,S.Z)(k,2),E=Y[0],B=Y[1],K=(0,p.useState)(!1),R=(0,S.Z)(K,2),b=R[0],D=R[1],L=(0,p.useState)(!1),U=(0,S.Z)(L,2),$=U[0],y=U[1];(0,p.useEffect)((0,x.Z)((0,o.Z)().mark(function c(){var m,l,w;return(0,o.Z)().wrap(function(O){for(;;)switch(O.prev=O.next){case 0:m=[],l=[],me.Z.from(a.values).forEach(function(T){T.isParentMenu||m.push(T.id),T.id!==null&&typeof T.id!="undefined"&&l.push(T)}),B(m),w=a.treeData,G(w)===l.length?(y(!0),D(!1)):(y(!1),a.values.length==0?D(!1):D(!0)),h(w);case 7:case"end":return O.stop()}},c)})),[a.modalVisible]);function G(c){for(var m=c.length,l=0;l<c.length;l++)Array.isArray(c[l].children)&&(m+=G(c[l].children));return m}var z=function(m){if($)B([]),y(!1),D(!1);else{var l=Z(e,[]);B(l),y(!0),D(!1)}};function Z(c,m){console.log(c);for(var l in c)m.push(c[l].key),c[l].children&&Z(c[l].children,m);return m}var V=(0,t.jsx)(Q.Z,{width:700,bodyStyle:{padding:"32px 40px 48px"},destroyOnClose:!0,title:"\u83DC\u5355\u5206\u914D",visible:a.modalVisible,onOk:function(){return a.onSubmit(E)},onCancel:function(){return a.onCancel()},maskClosable:!1,children:(0,t.jsx)(de.Z,{children:(0,t.jsxs)(ce.Z,{span:8,children:[(0,t.jsx)(he.Z,{indeterminate:b,onChange:z,checked:$,children:"\u5168\u9009"}),(0,t.jsx)(fe.Z,{treeData:e,onCheck:function(m,l){G(a.treeData)==m.length?(y(!0),D(!1)):(y(!1),D(!0)),B(m)},defaultExpandAll:!1,checkedKeys:E,checkable:!0})]})})});return V},pe=ve,ye=function(){var i=(0,x.Z)((0,o.Z)().mark(function a(d){return(0,o.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,I.addCompany(d).then(function(h){if(!h.succeeded)return v.default.error(h.errors),!1;h.data?v.default.success("\u6DFB\u52A0\u6210\u529F"):v.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01")});case 3:return e.abrupt("return",!0);case 6:return e.prev=6,e.t0=e.catch(0),v.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),e.abrupt("return",!1);case 10:case"end":return e.stop()}},a,null,[[0,6]])}));return function(d){return i.apply(this,arguments)}}(),Ce=function(){var i=(0,x.Z)((0,o.Z)().mark(function a(d){return(0,o.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,I.updateCompany(d).then(function(h){if(!h.succeeded)return v.default.error(h.errors),!1;h.data?v.default.success("\u914D\u7F6E\u6210\u529F"):v.default.error("\u914D\u7F6E\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01")});case 3:return e.abrupt("return",!0);case 6:return e.prev=6,e.t0=e.catch(0),v.default.error("\u914D\u7F6E\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),e.abrupt("return",!1);case 10:case"end":return e.stop()}},a,null,[[0,6]])}));return function(d){return i.apply(this,arguments)}}(),Ze=function(){var i=(0,x.Z)((0,o.Z)().mark(function a(d){return(0,o.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(d){e.next=2;break}return e.abrupt("return",!0);case 2:return e.prev=2,e.next=5,I.removeCompany(d.map(function(h){return h.id})).then(function(h){if(h)return v.default.success("\u5220\u9664\u6210\u529F"),!0;v.default.error("\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5")});case 5:return e.abrupt("return",!0);case 8:return e.prev=8,e.t0=e.catch(2),v.default.error("\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"),e.abrupt("return",!1);case 12:case"end":return e.stop()}},a,null,[[2,8]])}));return function(d){return i.apply(this,arguments)}}(),ge=function(){var i=(0,x.Z)((0,o.Z)().mark(function a(d){return(0,o.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,I.addRoleMenu(d).then(function(h){h.data?v.default.success("\u6388\u6743\u6210\u529F"):v.default.error("\u6388\u6743\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01")});case 3:return e.abrupt("return",!0);case 6:return e.prev=6,e.t0=e.catch(0),v.default.error("\u6388\u6743\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),e.abrupt("return",!1);case 10:case"end":return e.stop()}},a,null,[[0,6]])}));return function(d){return i.apply(this,arguments)}}(),Se=function(){var a=(0,p.useState)(),d=(0,S.Z)(a,2),A=d[0],e=d[1],h=(0,p.useState)(),k=(0,S.Z)(h,2),Y=k[0],E=k[1],B=(0,p.useState)({}),K=(0,S.Z)(B,2),R=K[0],b=K[1],D=(0,p.useState)(),L=(0,S.Z)(D,2),U=L[0],$=L[1],y=(0,p.useRef)(),G=(0,p.useState)(),z=(0,S.Z)(G,2),Z=z[0],V=z[1],c=(0,p.useState)(),m=(0,S.Z)(c,2),l=m[0],w=m[1],q=(0,p.useState)(),O=(0,S.Z)(q,2),T=O[0],je=O[1],xe=(0,p.useState)(),_=(0,S.Z)(xe,2),Ae=_[0],De=_[1];(0,p.useEffect)(function(){var f={getType:"ALL",type:0};I.GetMenu(f).then(function(u){u.data&&je(u.data)})},[]);var ee=[{title:"\u4E3B\u952E",dataIndex:"id",tip:"key",hideInSearch:!0,hideInTable:!0,render:function(u,r){return(0,t.jsx)("a",{onClick:function(){V(r),$(!0)},children:u})}},{title:"\u4F01\u4E1A\u540D\u79F0",dataIndex:"name",ellipsis:!0},{title:"\u7BA1\u7406\u5458\u59D3\u540D",dataIndex:"adminName",ellipsis:!0},{title:"\u90AE\u7BB1\u8D26\u53F7",dataIndex:"email",ellipsis:!0},{title:"\u7535\u8BDD",dataIndex:"phone",hideInSearch:!0},{title:"\u5907\u6CE8",dataIndex:"remark",hideInSearch:!0},{title:"\u521B\u5EFA\u65F6\u95F4",dataIndex:"createAt",valueType:"date",hideInForm:!0,hideInSearch:!0},{title:"\u64CD\u4F5C",dataIndex:"option",valueType:"option",fixed:"right",width:350,render:function(u,r){var g=[(0,t.jsxs)("a",{onClick:function(){e(!0),b(r)},children:[" ","\u66F4\u65B0"]}),(0,t.jsxs)("a",{onClick:function(){I.GetRoleMenu(r.sysRoleId).then(function(W){De(W.data),E(!0)}),b(r)},children:[" ","\u4F01\u4E1A\u83DC\u5355\u6388\u6743"]}),(0,t.jsx)(J.Z,{type:"primary",title:"\u5220\u9664\u52A0\u76DF\u5546\u5C06\u4F1A\u5220\u9664\u4E0B\u9762\u7684\u7528\u6237\u4EE5\u53CA\u83DC\u5355\u6743\u9650\uFF0C\u786E\u8BA4\u5220\u9664\u5417\uFF1F",okText:"\u662F",cancelText:"\u5426",onConfirm:function(){I.removeCompany([r.id]).then(function(W){v.default.success("\u5220\u9664\u6210\u529F"),y.current.reload()})},onCancel:function(){},children:(0,t.jsx)("a",{href:"#",children:"\u5220\u9664"})},"primary")];return g}}];return(0,t.jsxs)(re.ZP,{host:!0,header:{title:"",breadcrumb:{}},children:[(0,t.jsx)(le.ZP,{headerTitle:"\u4F01\u4E1A\u4FE1\u606F\u5217\u8868",actionRef:y,rowKey:"id",pagination:{defaultPageSize:10},search:{labelWidth:120},toolBarRender:function(){return[(0,t.jsxs)(N.Z,{type:"primary",onClick:function(){e(!0)},children:[(0,t.jsx)(te.Z,{})," \u65B0\u5EFA"]},"primary")]},request:function(){var f=(0,x.Z)((0,o.Z)().mark(function u(r){var g,C;return(0,o.Z)().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return g=[],C=0,s.next=4,I.companyPage(r).then(function(ae){g=ae.data.data,C=ae.data.total});case 4:return s.abrupt("return",{data:g,success:!0,total:C});case 5:case"end":return s.stop()}},u)}));return function(u){return f.apply(this,arguments)}}(),columns:ee,rowSelection:{onChange:function(u,r){w(r)}}}),(l==null?void 0:l.length)>0&&(0,t.jsx)(ue.Z,{extra:(0,t.jsxs)("div",{children:["\u5DF2\u9009\u62E9"," ",(0,t.jsx)("a",{style:{fontWeight:600},children:l.length})," ","\u9879 \xA0\xA0"]}),children:(0,t.jsx)(J.Z,{type:"primary",title:"\u786E\u8BA4\u5220\u9664\u5417\uFF1F",okText:"\u662F",cancelText:"\u5426",onConfirm:function(){var u,r;Ze(l),w([]),(u=y.current)===null||u===void 0||(r=u.reloadAndRest)===null||r===void 0||r.call(u)},onCancel:function(){},children:(0,t.jsx)("a",{href:"#",children:"\u6279\u91CF\u5220\u9664"})},"primary")}),(0,t.jsx)(oe,{onFinish:function(){var f=(0,x.Z)((0,o.Z)().mark(function u(r){var g,C;return(0,o.Z)().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(C=!1,!r.id){s.next=7;break}return s.next=4,Ce(r);case 4:C=s.sent,s.next=11;break;case 7:return r.phone=r.email,s.next=10,ye(r);case 10:C=s.sent;case 11:C&&(e(!1),V(void 0),y.current&&y.current.reload()),(g=y.current)===null||g===void 0||g.reload();case 13:case"end":return s.stop()}},u)}));return function(u){return f.apply(this,arguments)}}(),onCancel:function(){e(!1),b({})},modalVisible:A,values:R||{}}),R&&Object.keys(R).length?(0,t.jsx)(pe,{treeData:T,onSubmit:function(){var f=(0,x.Z)((0,o.Z)().mark(function u(r){var g,C;return(0,o.Z)().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return g={sysRoleId:R.sysRoleId,sysMenuId:r},s.next=3,ge(g);case 3:C=s.sent,C&&(E(!1),b({}),y.current&&y.current.reload());case 5:case"end":return s.stop()}},u)}));return function(u){return f.apply(this,arguments)}}(),onCancel:function(){E(!1),b({})},modalVisible:Y,values:Ae||{},datas:R||{}}):null,(0,t.jsx)(ne.Z,{width:600,visible:U,onClose:function(){V(void 0),$(!1)},closable:!1,children:(Z==null?void 0:Z.name)&&(0,t.jsx)(se.ZP,{column:2,title:Z==null?void 0:Z.name,request:(0,x.Z)((0,o.Z)().mark(function f(){return(0,o.Z)().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",{data:Z||{}});case 1:case"end":return r.stop()}},f)})),params:{id:Z==null?void 0:Z.name},columns:ee})})]})},Fe=Se}}]);
|