"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[24],{36056:function(Ee,G,t){t.r(G);var g=t(15009),C=t.n(g),N=t(99289),j=t.n(N),k=t(5574),p=t.n(k),P=t(67294),x=t(8232),X=t(42075),Q=t(86738),E=t(45360),J=t(14726),Y=t(85576),$=t(49978),oe=t(74330),U=t(99662),L=t(66309),S=t(3579),ae=t(51042),he=t(83145),i=t(85893),se=function(){var le=(0,P.useState)({id:"",name:"",description:""}),q=p()(le,2),b=q[0],z=q[1],ie=(0,P.useState)(!1),ce=p()(ie,2),ee=ce[0],F=ce[1],e=(0,P.useState)(!1),l=p()(e,2),f=l[0],n=l[1],s=(0,P.useState)([]),h=p()(s,2),v=h[0],D=h[1],M=(0,P.useState)([]),A=p()(M,2),O=A[0],I=A[1],R=(0,P.useState)(!1),Z=p()(R,2),w=Z[0],y=Z[1],H=x.Z.useForm(),K=p()(H,1),V=K[0],B=(0,P.useRef)(),re=(0,P.useState)([]),W=p()(re,2),ue=W[0],_=W[1],de=[{title:"\u89D2\u8272\u540D\u79F0",dataIndex:"name",key:"name"},{title:"\u89D2\u8272\u63CF\u8FF0",dataIndex:"description",key:"description",search:!1},{title:"\u64CD\u4F5C",search:!1,key:"action",fixed:"right",render:function(a,r){return(0,i.jsxs)(X.Z,{size:"middle",children:[(0,i.jsx)("a",{onClick:function(){return fe(r)},children:"\u7F16\u8F91"}),(0,i.jsx)("a",{onClick:function(){return ne(r)},children:"\u5206\u914D\u6A21\u5757"}),(0,i.jsx)(Q.Z,{title:"\u786E\u5B9A\u8981\u5220\u9664\u6B64\u89D2\u8272\u5417\uFF1F",onConfirm:function(){return me(r)},okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",children:(0,i.jsx)("a",{children:"\u5220\u9664"})})]})}}],fe=function(a){var r;z(a),V.setFieldsValue(a),F(!0),(r=B.current)===null||r===void 0||r.reload()},me=function(){var u=j()(C()().mark(function a(r){var o,d;return C()().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return m.next=2,S.ar.DeleteRole(r.id);case 2:o=m.sent,o.statusCode===200?(E.ZP.success("\u5220\u9664\u6210\u529F"),(d=B.current)===null||d===void 0||d.reload()):E.ZP.error(o.msg||"\u5220\u9664\u5931\u8D25");case 4:case"end":return m.stop()}},a)}));return function(r){return u.apply(this,arguments)}}(),ge=function(){var u=j()(C()().mark(function a(r){var o,d,c,m;return C()().wrap(function(T){for(;;)switch(T.prev=T.next){case 0:if(!r.id){T.next=7;break}return T.next=3,S.ar.ModifyRole(r);case 3:o=T.sent,o.statusCode===200?(E.ZP.success("\u66F4\u65B0\u89D2\u8272\u4FE1\u606F\u6210\u529F"),F(!1),(d=B.current)===null||d===void 0||d.reload()):E.ZP.error(o.msg||"\u66F4\u65B0\u89D2\u8272\u4FE1\u606F\u5931\u8D25"),T.next=11;break;case 7:return T.next=9,S.ar.CreateRole(r);case 9:c=T.sent,c.statusCode===200?(E.ZP.success("\u521B\u5EFA\u89D2\u8272\u6210\u529F"),F(!1),(m=B.current)===null||m===void 0||m.reload()):E.ZP.error(c.msg||"\u521B\u5EFA\u89D2\u8272\u5931\u8D25");case 11:case"end":return T.stop()}},a)}));return function(r){return u.apply(this,arguments)}}(),ne=function(){var u=j()(C()().mark(function a(r){var o,d;return C()().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return z(r),n(!0),y(!0),m.next=5,S.ar.GetRoleModuleList(r.id);case 5:o=m.sent,y(!1),o.statusCode===200?(console.log(" response.data",o.data),d=[],o.data.forEach(function(pe){d.push(pe.moduleId)}),I(d)):I([]);case 8:case"end":return m.stop()}},a)}));return function(r){return u.apply(this,arguments)}}(),ve=function u(a){return a.forEach(function(r){r.children&&r.children.length>0&&u(r.children)}),a};(0,P.useEffect)(function(){var u=function(){var a=j()(C()().mark(function r(){var o;return C()().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,S.Ru.GetTreeGridModule();case 2:o=c.sent,o.statusCode===200?_(ve(o.data)):E.ZP.error(o.errors||"\u83B7\u53D6\u6A21\u677F\u5217\u8868\u5931\u8D25");case 4:case"end":return c.stop()}},r)}));return function(){return a.apply(this,arguments)}}();u()},[]);var Ce=function(){var u=j()(C()().mark(function a(r){var o;return C()().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,S.ar.AddRoleModule({roleId:r,moduleIds:v});case 2:o=c.sent,o.statusCode===200?E.ZP.success("\u6388\u6743\u6210\u529F"):E.ZP.error(o.errors||"\u6388\u6743\u5931\u8D25"),n(!1);case 5:case"end":return c.stop()}},a)}));return function(r){return u.apply(this,arguments)}}(),te=function(){z({id:"",name:"",description:""}),V.resetFields(),F(!0)};return(0,i.jsxs)("div",{children:[(0,i.jsx)(he.Z,{columns:de,actionRef:B,cardBordered:!0,bordered:!0,scroll:{x:!0},rowClassName:function(a,r,o){return r%2===0?"":"even-row-background"},request:j()(C()().mark(function u(){var a,r,o=arguments;return C()().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return a=o.length>0&&o[0]!==void 0?o[0]:{},c.next=3,S.ar.GetRolePagedList({keyword:a.name,sortName:"",sortByAsc:!1,pageIndex:a.current||1,pageSize:a.pageSize||10});case 3:if(r=c.sent,r.statusCode!==200){c.next=8;break}return c.abrupt("return",{data:r.data.items,success:!0,total:r.data.total});case 8:return E.ZP.error(r.errors||"\u83B7\u53D6\u89D2\u8272\u5217\u8868\u5931\u8D25"),c.abrupt("return",{data:[],success:!1,total:0});case 10:case"end":return c.stop()}},u)})),rowKey:"id",pagination:{pageSize:10,showSizeChanger:!1},dateFormatter:"string",headerTitle:"\u89D2\u8272\u5217\u8868",toolBarRender:function(){return[(0,i.jsx)(J.ZP,{icon:(0,i.jsx)(ae.Z,{}),type:"primary",onClick:te,children:"\u6DFB\u52A0"},"button")]}}),(0,i.jsx)(Y.Z,{maskClosable:!1,footer:null,title:b.id===""?"\u6DFB\u52A0\u89D2\u8272":"\u7F16\u8F91\u89D2\u8272",open:ee,onCancel:function(){return F(!1)},children:(0,i.jsxs)(x.Z,{name:"basic",form:V,onFinish:ge,children:[(0,i.jsx)(x.Z.Item,{label:"id",name:"id",hidden:!0,children:(0,i.jsx)($.Z,{})}),(0,i.jsx)(x.Z.Item,{label:"\u540D\u79F0",name:"name",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u89D2\u8272\u540D\u79F0\uFF01"}],children:(0,i.jsx)($.Z,{})}),(0,i.jsx)(x.Z.Item,{label:"\u63CF\u8FF0",name:"description",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u89D2\u8272\u63CF\u8FF0\uFF01"}],children:(0,i.jsx)($.Z,{})}),(0,i.jsx)(x.Z.Item,{children:(0,i.jsx)(J.ZP,{type:"primary",htmlType:"submit",children:"\u786E\u5B9A"})})]})}),(0,i.jsx)(Y.Z,{maskClosable:!1,title:"\u5206\u914D\u6388\u6743\u6A21\u5757\u3010".concat(b==null?void 0:b.name,"\u3011"),open:f,onOk:function(){Ce(b==null?void 0:b.id)},onCancel:function(){return n(!1)},children:(0,i.jsx)(oe.Z,{size:"large",spinning:w,children:(0,i.jsx)(U.Z,{rowSelection:{checkStrictly:!1,type:"checkbox",selectedRowKeys:O,onChange:function(a,r){var o=r;console.log(r),console.log(a),o.map(function(d){return d.moduleId=d.id}),D(o),I(a)}},pagination:!1,columns:[{title:"\u540D\u79F0",dataIndex:"name",key:"name"},{title:"\u7C7B\u578B",dataIndex:"category",render:function(a,r){return(0,i.jsx)(i.Fragment,{children:function(){return r.category===1?(0,i.jsx)(L.Z,{color:"green",children:"\u83DC\u5355"}):r.category===2?(0,i.jsx)(L.Z,{color:"geekblue",children:"\u89C6\u56FE"}):(0,i.jsx)(L.Z,{color:"volcano",children:"\u529F\u80FD"})}()})}}],dataSource:ue,rowKey:"id"})})})]})};G.default=se},66309:function(Ee,G,t){t.d(G,{Z:function(){return F}});var g=t(67294),C=t(93967),N=t.n(C),j=t(98423),k=t(98787),p=t(69760),P=t(96159),x=t(45353),X=t(53124),Q=t(85088),E=t(10274),J=t(14747),Y=t(45503),$=t(27036);const oe=e=>{const{paddingXXS:l,lineWidth:f,tagPaddingHorizontal:n,componentCls:s,calc:h}=e,v=h(n).sub(f).equal(),D=h(l).sub(f).equal();return{[s]:Object.assign(Object.assign({},(0,J.Wf)(e)),{display:"inline-block",height:"auto",marginInlineEnd:e.marginXS,paddingInline:v,fontSize:e.tagFontSize,lineHeight:e.tagLineHeight,whiteSpace:"nowrap",background:e.defaultBg,border:`${(0,Q.bf)(e.lineWidth)} ${e.lineType} ${e.colorBorder}`,borderRadius:e.borderRadiusSM,opacity:1,transition:`all ${e.motionDurationMid}`,textAlign:"start",position:"relative",[`&${s}-rtl`]:{direction:"rtl"},"&, a, a:hover":{color:e.defaultColor},[`${s}-close-icon`]:{marginInlineStart:D,fontSize:e.tagIconSize,color:e.colorTextDescription,cursor:"pointer",transition:`all ${e.motionDurationMid}`,"&:hover":{color:e.colorTextHeading}},[`&${s}-has-color`]:{borderColor:"transparent",[`&, a, a:hover, ${e.iconCls}-close, ${e.iconCls}-close:hover`]:{color:e.colorTextLightSolid}},"&-checkable":{backgroundColor:"transparent",borderColor:"transparent",cursor:"pointer",[`&:not(${s}-checkable-checked):hover`]:{color:e.colorPrimary,backgroundColor:e.colorFillSecondary},"&:active, &-checked":{color:e.colorTextLightSolid},"&-checked":{backgroundColor:e.colorPrimary,"&:hover":{backgroundColor:e.colorPrimaryHover}},"&:active":{backgroundColor:e.colorPrimaryActive}},"&-hidden":{display:"none"},[`> ${e.iconCls} + span, > span + ${e.iconCls}`]:{marginInlineStart:v}}),[`${s}-borderless`]:{borderColor:"transparent",background:e.tagBorderlessBg}}},U=e=>{const{lineWidth:l,fontSizeIcon:f,calc:n}=e,s=e.fontSizeSM;return(0,Y.TS)(e,{tagFontSize:s,tagLineHeight:(0,Q.bf)(n(e.lineHeightSM).mul(s).equal()),tagIconSize:n(f).sub(n(l).mul(2)).equal(),tagPaddingHorizontal:8,tagBorderlessBg:e.defaultBg})},L=e=>({defaultBg:new E.C(e.colorFillQuaternary).onBackground(e.colorBgContainer).toHexString(),defaultColor:e.colorText});var S=(0,$.I$)("Tag",e=>{const l=U(e);return oe(l)},L),ae=function(e,l){var f={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&l.indexOf(n)<0&&(f[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(e);s{const{prefixCls:f,style:n,className:s,checked:h,onChange:v,onClick:D}=e,M=ae(e,["prefixCls","style","className","checked","onChange","onClick"]),{getPrefixCls:A,tag:O}=g.useContext(X.E_),I=K=>{v==null||v(!h),D==null||D(K)},R=A("tag",f),[Z,w,y]=S(R),H=N()(R,`${R}-checkable`,{[`${R}-checkable-checked`]:h},O==null?void 0:O.className,s,w,y);return Z(g.createElement("span",Object.assign({},M,{ref:l,style:Object.assign(Object.assign({},n),O==null?void 0:O.style),className:H,onClick:I})))}),se=t(98719);const _e=e=>(0,se.Z)(e,(l,f)=>{let{textColor:n,lightBorderColor:s,lightColor:h,darkColor:v}=f;return{[`${e.componentCls}${e.componentCls}-${l}`]:{color:n,background:h,borderColor:s,"&-inverse":{color:e.colorTextLightSolid,background:v,borderColor:v},[`&${e.componentCls}-borderless`]:{borderColor:"transparent"}}}});var le=(0,$.bk)(["Tag","preset"],e=>{const l=U(e);return _e(l)},L);function q(e){return typeof e!="string"?e:e.charAt(0).toUpperCase()+e.slice(1)}const b=(e,l,f)=>{const n=q(f);return{[`${e.componentCls}${e.componentCls}-${l}`]:{color:e[`color${f}`],background:e[`color${n}Bg`],borderColor:e[`color${n}Border`],[`&${e.componentCls}-borderless`]:{borderColor:"transparent"}}}};var z=(0,$.bk)(["Tag","status"],e=>{const l=U(e);return[b(l,"success","Success"),b(l,"processing","Info"),b(l,"error","Error"),b(l,"warning","Warning")]},L),ie=function(e,l){var f={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&l.indexOf(n)<0&&(f[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(e);s{const{prefixCls:f,className:n,rootClassName:s,style:h,children:v,icon:D,color:M,onClose:A,bordered:O=!0,visible:I}=e,R=ie(e,["prefixCls","className","rootClassName","style","children","icon","color","onClose","bordered","visible"]),{getPrefixCls:Z,direction:w,tag:y}=g.useContext(X.E_),[H,K]=g.useState(!0),V=(0,j.Z)(R,["closeIcon","closable"]);g.useEffect(()=>{I!==void 0&&K(I)},[I]);const B=(0,k.o2)(M),re=(0,k.yT)(M),W=B||re,ue=Object.assign(Object.assign({backgroundColor:M&&!W?M:void 0},y==null?void 0:y.style),h),_=Z("tag",f),[de,fe,me]=S(_),ge=N()(_,y==null?void 0:y.className,{[`${_}-${M}`]:W,[`${_}-has-color`]:M&&!W,[`${_}-hidden`]:!H,[`${_}-rtl`]:w==="rtl",[`${_}-borderless`]:!O},n,s,fe,me),ne=r=>{r.stopPropagation(),A==null||A(r),!r.defaultPrevented&&K(!1)},[,ve]=(0,p.Z)((0,p.w)(e),(0,p.w)(y),{closable:!1,closeIconRender:r=>{const o=g.createElement("span",{className:`${_}-close-icon`,onClick:ne},r);return(0,P.wm)(r,o,d=>({onClick:c=>{var m;(m=d==null?void 0:d.onClick)===null||m===void 0||m.call(d,c),ne(c)},className:N()(d==null?void 0:d.className,`${_}-close-icon`)}))}}),Ce=typeof R.onClick=="function"||v&&v.type==="a",te=D||null,u=te?g.createElement(g.Fragment,null,te,v&&g.createElement("span",null,v)):v,a=g.createElement("span",Object.assign({},V,{ref:l,className:ge,style:ue}),u,ve,B&&g.createElement(le,{key:"preset",prefixCls:_}),re&&g.createElement(z,{key:"status",prefixCls:_}));return de(Ce?g.createElement(x.Z,{component:"Tag"},a):a)});ee.CheckableTag=i;var F=ee}}]);