"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[24],{56160:function(b,M,e){var h=e(97857),_=e.n(h),E=e(12578);M.Z={CreateRole:function(u){return(0,E.request)("/api/authorize/AddRole",{method:"POST",data:_()({},u)})},DeleteRole:function(u){return(0,E.request)("/api/authorize/RemoveRole?input=".concat(u),{method:"GET"})},ModifyRole:function(u){return(0,E.request)("/api/authorize/EditRole",{method:"POST",data:_()({},u)})},GetRoleList:function(){return(0,E.request)("/api/authorize/GetRoleList",{method:"GET"})},GetRolePagedList:function(u){return(0,E.request)("/api/authorize/QueryRole",{method:"POST",data:_()({},u)})}}},36056:function(b,M,e){e.r(M);var h=e(15009),_=e.n(h),E=e(99289),d=e.n(E),u=e(5574),v=e.n(u),p=e(67294),f=e(12029),B=e(42075),I=e(86738),c=e(2453),C=e(71577),L=e(22247),O=e(12096),D=e(56160),g=e(51042),K=e(80954),r=e(85893),S=function(){var y=(0,p.useState)({id:"",name:"",description:""}),j=v()(y,2),F=j[0],Z=j[1],U=(0,p.useState)(!1),A=v()(U,2),W=A[0],P=A[1],x=f.Z.useForm(),G=v()(x,1),T=G[0],z=[{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",render:function(t,n){return(0,r.jsxs)(B.Z,{size:"middle",children:[(0,r.jsx)("a",{onClick:function(){return $(n)},children:"\u7F16\u8F91"}),(0,r.jsx)(I.Z,{title:"\u786E\u5B9A\u8981\u5220\u9664\u6B64\u89D2\u8272\u5417\uFF1F",onConfirm:function(){return J(n)},okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",children:(0,r.jsx)("a",{children:"\u5220\u9664"})})]})}}],$=function(t){var n;Z(t),T.setFieldsValue(t),P(!0),(n=R.current)===null||n===void 0||n.reload()},J=function(){var o=d()(_()().mark(function t(n){var s,m;return _()().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.next=2,D.Z.DeleteRole(n.id);case 2:s=l.sent,s.statusCode===200?(c.ZP.success("\u5220\u9664\u6210\u529F"),(m=R.current)===null||m===void 0||m.reload()):c.ZP.error(s.msg||"\u5220\u9664\u5931\u8D25");case 4:case"end":return l.stop()}},t)}));return function(n){return o.apply(this,arguments)}}(),V=function(){var o=d()(_()().mark(function t(n){var s,m,a,l;return _()().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:if(!n.id){i.next=7;break}return i.next=3,D.Z.ModifyRole(n);case 3:s=i.sent,s.statusCode===200?(c.ZP.success("\u66F4\u65B0\u89D2\u8272\u4FE1\u606F\u6210\u529F"),P(!1),(m=R.current)===null||m===void 0||m.reload()):c.ZP.error(s.msg||"\u66F4\u65B0\u89D2\u8272\u4FE1\u606F\u5931\u8D25"),i.next=11;break;case 7:return i.next=9,D.Z.CreateRole(n);case 9:a=i.sent,a.statusCode===200?(c.ZP.success("\u521B\u5EFA\u89D2\u8272\u6210\u529F"),P(!1),(l=R.current)===null||l===void 0||l.reload()):c.ZP.error(a.msg||"\u521B\u5EFA\u89D2\u8272\u5931\u8D25");case 11:case"end":return i.stop()}},t)}));return function(n){return o.apply(this,arguments)}}(),N=function(){Z({id:"",name:"",description:""}),T.resetFields(),P(!0)},R=(0,p.useRef)();return(0,r.jsxs)("div",{children:[(0,r.jsx)(K.Z,{columns:z,actionRef:R,cardBordered:!0,request:d()(_()().mark(function o(){var t,n,s=arguments;return _()().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return t=s.length>0&&s[0]!==void 0?s[0]:{},a.next=3,D.Z.GetRolePagedList({keyword:t.name,sortName:"",sortByAsc:!1,pageIndex:t.current||1,pageSize:t.pageSize||10});case 3:if(n=a.sent,n.statusCode!==200){a.next=8;break}return a.abrupt("return",{data:n.data.items,success:!0,total:n.data.total});case 8:return c.ZP.error(n.errors||"\u83B7\u53D6\u89D2\u8272\u5217\u8868\u5931\u8D25"),a.abrupt("return",{data:[],success:!1,total:0});case 10:case"end":return a.stop()}},o)})),rowKey:"id",pagination:{pageSize:10},dateFormatter:"string",headerTitle:"\u89D2\u8272\u5217\u8868",toolBarRender:function(){return[(0,r.jsx)(C.ZP,{icon:(0,r.jsx)(g.Z,{}),type:"primary",onClick:N,children:"\u6DFB\u52A0"},"button")]}}),(0,r.jsx)(L.Z,{footer:null,title:F.id===""?"\u6DFB\u52A0\u89D2\u8272":"\u7F16\u8F91\u89D2\u8272",open:W,onCancel:function(){return P(!1)},children:(0,r.jsxs)(f.Z,{name:"basic",form:T,onFinish:V,children:[(0,r.jsx)(f.Z.Item,{label:"id",name:"id",hidden:!0,children:(0,r.jsx)(O.Z,{})}),(0,r.jsx)(f.Z.Item,{label:"\u540D\u79F0",name:"name",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u89D2\u8272\u540D\u79F0\uFF01"}],children:(0,r.jsx)(O.Z,{})}),(0,r.jsx)(f.Z.Item,{label:"\u63CF\u8FF0",name:"description",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u89D2\u8272\u63CF\u8FF0\uFF01"}],children:(0,r.jsx)(O.Z,{})}),(0,r.jsx)(f.Z.Item,{children:(0,r.jsx)(C.ZP,{type:"primary",htmlType:"submit",children:"\u786E\u5B9A"})})]})})]})};M.default=S}}]);
