|
- (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[3912,1322],{95172:function(Le,ae,u){"use strict";u.r(ae),u.d(ae,{default:function(){return Ye}});var ze=u(57663),P=u(71577),C=u(2824),x=u(11849),He=u(34792),p=u(48086),o=u(3182),le=u(94043),s=u.n(le),m=u(67294),ie=u(49101),ce=u(78009),de=u(16894),G=u(62255),Je=u(71194),U=u(50146),Ne=u(77883),oe=u(85482),Qe=u(13062),K=u(71230),Xe=u(89032),M=u(15746),qe=u(9715),b=u(86835),_e=u(47673),A=u(4107),r=u(85893),he=function(n){return(0,r.jsx)(U.Z,{title:n.values.id?"\u7F16\u8F91\u89D2\u8272":"\u65B0\u5EFA\u89D2\u8272",width:1e3,visible:n.modalVisible,bodyStyle:{padding:"32px 40px 48px"},footer:null,onCancel:function(){n.onCancel()},destroyOnClose:!0,children:(0,r.jsxs)(b.Z,{layout:"horizontal",preserve:!1,labelCol:{span:4},initialValues:n.values,onFinish:n.onFinish,children:[(0,r.jsx)(b.Z.Item,{name:"id",hidden:!0,children:(0,r.jsx)(A.Z,{})}),(0,r.jsxs)(K.Z,{children:[(0,r.jsx)(M.Z,{span:12,children:(0,r.jsx)(b.Z.Item,{name:"code",label:"\u89D2\u8272\u7F16\u7801",rules:[{required:!0,max:20}],children:(0,r.jsx)(A.Z,{disabled:!!n.values.id,placeholder:"\u8BF7\u8F93\u5165\u89D2\u8272\u7F16\u7801"})})}),(0,r.jsx)(M.Z,{span:12,children:(0,r.jsx)(b.Z.Item,{name:"name",label:"\u89D2\u8272\u540D\u79F0",rules:[{required:!0,max:64}],children:(0,r.jsx)(A.Z,{placeholder:"\u8BF7\u8F93\u5165\u89D2\u8272\u540D\u79F0"})})})]}),(0,r.jsxs)(K.Z,{children:[(0,r.jsx)(M.Z,{span:12,children:(0,r.jsx)(b.Z.Item,{name:"remark",label:"\u5907\u6CE8",rules:[{max:500}],children:(0,r.jsx)(A.Z.TextArea,{placeholder:"\u8BF7\u8F93\u5165\u5907\u6CE8"})})}),(0,r.jsx)(M.Z,{span:12,children:(0,r.jsx)(b.Z.Item,{name:"sort",label:"\u6392\u5E8F",children:(0,r.jsx)(oe.Z,{min:1,decimalSeparator:"0"})})})]}),(0,r.jsx)(b.Z.Item,{children:(0,r.jsx)(P.Z,{type:"primary",htmlType:"submit",style:{float:"right"},children:"\u4FDD\u5B58"})})]})})},fe=he,Z=u(48971);function pe(t){return L.apply(this,arguments)}function L(){return L=(0,o.Z)(s().mark(function t(n){return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,Z.WY)("/kitchen/api/role/page",{method:"post",data:(0,x.Z)({},n)}));case 1:case"end":return e.stop()}},t)})),L.apply(this,arguments)}function me(t){return z.apply(this,arguments)}function z(){return z=(0,o.Z)(s().mark(function t(n){return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,Z.WY)("/kitchen/api/role/enable/?Id=".concat(n)));case 1:case"end":return e.stop()}},t)})),z.apply(this,arguments)}function ve(t){return H.apply(this,arguments)}function H(){return H=(0,o.Z)(s().mark(function t(n){return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,Z.WY)("/kitchen/api/role/disable/?Id=".concat(n)));case 1:case"end":return e.stop()}},t)})),H.apply(this,arguments)}function ge(t){return J.apply(this,arguments)}function J(){return J=(0,o.Z)(s().mark(function t(n){return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,Z.WY)("/kitchen/api/role/add",{method:"POST",data:(0,x.Z)({},n)}));case 1:case"end":return e.stop()}},t)})),J.apply(this,arguments)}function ye(t){return N.apply(this,arguments)}function N(){return N=(0,o.Z)(s().mark(function t(n){return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,Z.WY)("/kitchen/api\u200B/role/update",{method:"POST",data:(0,x.Z)({},n)}));case 1:case"end":return e.stop()}},t)})),N.apply(this,arguments)}function Ze(t){return Q.apply(this,arguments)}function Q(){return Q=(0,o.Z)(s().mark(function t(n){return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,Z.WY)("/kitchen/api\u200B/role/delete",{method:"POST",data:n}));case 1:case"end":return e.stop()}},t)})),Q.apply(this,arguments)}function Se(t){return X.apply(this,arguments)}function X(){return X=(0,o.Z)(s().mark(function t(n){return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,Z.WY)("\u200B/kitchen/api/role/addorupdatemenurole",{method:"post",data:n}));case 1:case"end":return e.stop()}},t)})),X.apply(this,arguments)}function Ce(t){return q.apply(this,arguments)}function q(){return q=(0,o.Z)(s().mark(function t(n){return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,Z.WY)("/kitchen/api/role/getmenurole/?RoleId=".concat(n)));case 1:case"end":return e.stop()}},t)})),q.apply(this,arguments)}function je(t){return _.apply(this,arguments)}function _(){return _=(0,o.Z)(s().mark(function t(n){return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,Z.WY)("/kitchen/api/role/setandalterdatascope",{method:"post",data:n}));case 1:case"end":return e.stop()}},t)})),_.apply(this,arguments)}var ea=u(32157),be=u(7573),aa=u(71153),Ee=u(60331);function we(t){return(0,Z.WY)("/kitchen/api\u200B/menu/getmenutreepage",{method:"post",data:t})}function Fe(){return(0,Z.WY)("\u200B/kitchen/api/select/menutree/?GetType=user")}function xe(t){return(0,Z.WY)("/kitchen/api/select/getorglist")}function Oe(t){return(0,Z.WY)("\u200B/kitchen/api\u200B/sysOrg\u200B/tree",{data:(0,x.Z)({},t)})}var ne={menutreepage:we,SelectTree:Fe,GetOrg:xe,gettree:Oe},ke=function(n){var i=(0,m.useState)(),e=(0,C.Z)(i,2),S=e[0],a=e[1],w=(0,m.useState)(),k=(0,C.Z)(w,2),T=k[0],W=k[1],$=(0,m.useState)(),O=(0,C.Z)($,2),E=O[0],B=O[1];(0,m.useEffect)((0,o.Z)(s().mark(function v(){var h,I,V;return s().wrap(function(D){for(;;)switch(D.prev=D.next){case 0:return h=[],G.Z.from(n.values).forEach(function(ee){h.push(ee.id)}),B(h),D.next=5,ne.SelectTree();case 5:I=D.sent,V=G.Z.from(I.data).toArray(),a(V);case 8:case"end":return D.stop()}},v)})),[n.modalVisible]);var Y=function(){var h=[];return G.Z.from(n.values).forEach(function(I){h.push((0,r.jsx)(Ee.Z,{style:{width:68,margin:"Center"},color:"processing",children:I.name}))}),h},F=(0,r.jsx)(U.Z,{width:700,bodyStyle:{padding:"32px 40px 48px"},destroyOnClose:!0,title:"\u83DC\u5355\u5206\u914D",visible:n.modalVisible,onOk:function(){return n.onSubmit(E)},onCancel:function(){return n.onCancel()},maskClosable:!1,children:(0,r.jsxs)(K.Z,{children:[(0,r.jsx)(M.Z,{span:12,children:(0,r.jsx)(be.Z,{treeData:S,onCheck:function(h,I){B(h)},defaultExpandAll:!0,checkedKeys:E,checkable:!0})}),(0,r.jsxs)(M.Z,{span:12,children:[(0,r.jsx)("div",{children:"\u5DF2\u9009\u83DC\u5355"}),n.values==null?"":Y()]})]})});return F},Ie=ke,na=u(62999),De=u(54680),ra=u(43358),R=u(34041),Me=function(n){var i=(0,m.useState)([]),e=(0,C.Z)(i,2),S=e[0],a=e[1],w=(0,m.useState)(0),k=(0,C.Z)(w,2),T=k[0],W=k[1];(0,m.useEffect)(function(){function O(){ne.gettree().then(function(E){a(E.data)})}O()},[n.values]);var $=function(E){W(E),console.log(E)};return(0,r.jsx)(U.Z,{width:640,bodyStyle:{padding:"32px 40px 48px"},destroyOnClose:!0,title:"\u7ED9 ".concat(n.values.name," \u6388\u6743\u6570\u636E"),visible:n.updateModalVisible,footer:null,onCancel:function(){return n.onCancel()},children:(0,r.jsxs)(b.Z,{preserve:!1,layout:"horizontal",labelCol:{span:4},onFinish:n.onFinish,initialValues:n.values,children:[(0,r.jsx)(b.Z.Item,{name:"dataScopeType",label:"\u6388\u6743\u8303\u56F4",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u6388\u6743\u8303\u56F4"}],children:(0,r.jsxs)(R.Z,{allowClear:!0,placeholder:"\u8BF7\u9009\u62E9\u6388\u6743\u8303\u56F4",onChange:$,children:[(0,r.jsx)(R.Z.Option,{value:1,children:"\u5168\u90E8\u6570\u636E"}),(0,r.jsx)(R.Z.Option,{value:2,children:"\u672C\u90E8\u95E8\u53CA\u4EE5\u4E0B\u6570\u636E"}),(0,r.jsx)(R.Z.Option,{value:3,children:"\u672C\u90E8\u95E8\u6570\u636E"}),(0,r.jsx)(R.Z.Option,{value:4,children:"\u4EC5\u672C\u4EBA\u6570\u636E"}),(0,r.jsx)(R.Z.Option,{value:5,children:"\u81EA\u5B9A\u4E49\u6570\u636E"})]})}),T!=5?null:(0,r.jsx)(b.Z.Item,{name:"sysOrgId",label:"\u9009\u62E9\u673A\u6784",rules:[{required:!0,message:"\u9009\u62E9\u673A\u6784"}],children:(0,r.jsx)(De.Z,{style:{width:"100%"},dropdownStyle:{maxHeight:400,overflow:"auto"},treeData:S,multiple:!0,placeholder:"\u9009\u62E9\u673A\u6784",treeDefaultExpandAll:!0})}),(0,r.jsx)(b.Z.Item,{children:(0,r.jsx)(P.Z,{type:"primary",htmlType:"submit",style:{float:"right"},children:"\u4FDD\u5B58"})})]})})},Re=Me,Te=function(){var t=(0,o.Z)(s().mark(function n(i){var e;return s().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return e=p.default.loading("\u6B63\u5728\u6DFB\u52A0"),a.prev=1,ge((0,x.Z)({},i)).then(function(w){w.data||p.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01")}),e(),p.default.success("\u6DFB\u52A0\u6210\u529F"),a.abrupt("return",!0);case 8:return a.prev=8,a.t0=a.catch(1),console.log(a.t0),e(),p.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),a.abrupt("return",!1);case 14:case"end":return a.stop()}},n,null,[[1,8]])}));return function(i){return t.apply(this,arguments)}}(),$e=function(){var t=(0,o.Z)(s().mark(function n(i){var e;return s().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return e=p.default.loading("\u6B63\u5728\u66F4\u65B0"),a.prev=1,a.next=4,ye((0,x.Z)({},i));case 4:return e(),p.default.success("\u66F4\u65B0\u6210\u529F"),a.abrupt("return",!0);case 9:return a.prev=9,a.t0=a.catch(1),e(),p.default.error("\u66F4\u65B0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),a.abrupt("return",!1);case 14:case"end":return a.stop()}},n,null,[[1,9]])}));return function(i){return t.apply(this,arguments)}}(),Ve=function(){var t=(0,o.Z)(s().mark(function n(i){var e;return s().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(e=p.default.loading("\u6B63\u5728\u5220\u9664"),i){a.next=3;break}return a.abrupt("return",!0);case 3:return a.prev=3,a.next=6,Ze([i.id]).then(function(w){p.default.success(w.data)});case 6:return e(),a.abrupt("return",!0);case 10:return a.prev=10,a.t0=a.catch(3),e(),p.default.error("\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"),a.abrupt("return",!1);case 15:case"end":return a.stop()}},n,null,[[3,10]])}));return function(i){return t.apply(this,arguments)}}(),Ae=function(){var t=(0,o.Z)(s().mark(function n(i){var e;return s().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return e=p.default.loading("\u6B63\u5728\u5206\u914D\u83DC\u5355"),a.prev=1,a.next=4,Se((0,x.Z)({},i));case 4:return e(),p.default.success("\u5206\u914D\u83DC\u5355\u6210\u529F"),a.abrupt("return",!0);case 9:return a.prev=9,a.t0=a.catch(1),e(),p.default.error("\u5206\u914D\u83DC\u5355\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),a.abrupt("return",!1);case 14:case"end":return a.stop()}},n,null,[[1,9]])}));return function(i){return t.apply(this,arguments)}}(),We=function(){var t=(0,o.Z)(s().mark(function n(i){var e;return s().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return e=p.default.loading("\u6B63\u5728\u5206\u914D\u6570\u636E\u6743\u9650"),a.prev=1,a.next=4,je((0,x.Z)({},i));case 4:return e(),p.default.success("\u5206\u914D\u6570\u636E\u6743\u9650\u6210\u529F"),a.abrupt("return",!0);case 9:return a.prev=9,a.t0=a.catch(1),e(),p.default.error("\u5206\u914D\u6570\u636E\u6743\u9650\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),a.abrupt("return",!1);case 14:case"end":return a.stop()}},n,null,[[1,9]])}));return function(i){return t.apply(this,arguments)}}(),ta="Role",Be=function(){var n=(0,m.useState)(),i=(0,C.Z)(n,2),e=i[0],S=i[1],a=(0,m.useState)(),w=(0,C.Z)(a,2),k=w[0],T=w[1],W=(0,m.useState)(),$=(0,C.Z)(W,2),O=$[0],E=$[1],B=(0,m.useState)({}),Y=(0,C.Z)(B,2),F=Y[0],v=Y[1],h=(0,m.useRef)(),I=(0,m.useState)(),V=(0,C.Z)(I,2),re=V[0],D=V[1],ee=(0,m.useState)(),te=(0,C.Z)(ee,2),ua=te[0],Pe=te[1],Ge=(0,m.useState)([]),ue=(0,C.Z)(Ge,2),sa=ue[0],la=ue[1],Ue=function(l){var c=[];return c.push((0,r.jsx)("a",{disabled:l.code=="sys_manager_role",style:{pointerEvents:l.code=="sys_manager_role"?"none":"auto"},onClick:function(){S(!0),v(l)},children:"\u4FEE\u6539"})),l.status==1&&c.push((0,r.jsx)("a",{disabled:l.code=="sys_manager_role",style:{pointerEvents:l.code=="sys_manager_role"?"none":"auto"},onClick:function(){me(l.id).then(function(y){h.current.reload()})},children:"\u542F\u7528"})),l.status==0&&c.push((0,r.jsx)("a",{disabled:l.code=="sys_manager_role",style:{pointerEvents:l.code=="sys_manager_role"?"none":"auto"},onClick:function(){ve(l.id).then(function(y){h.current.reload()})},children:"\u7981\u7528"})),c.push((0,r.jsx)("a",{disabled:l.code=="sys_manager_role",style:{pointerEvents:l.code=="sys_manager_role"?"none":"auto"},onClick:function(){Ve(l)},children:"\u5220\u9664"})),c.push((0,r.jsx)("a",{disabled:l.code=="sys_manager_role",style:{pointerEvents:l.code=="sys_manager_role"?"none":"auto"},onClick:function(){Ce(l.id).then(function(y){D(y.data),T(!0)}),v(l)},children:"\u6388\u6743\u83DC\u5355"})),c.push((0,r.jsx)("a",{disabled:l.code=="sys_manager_role",style:{pointerEvents:l.code=="sys_manager_role"?"none":"auto"},onClick:function(){E(!0),v(l)},children:"\u6388\u6743\u6570\u636E"})),c},Ke=[{title:"id",dataIndex:"id",hideInTable:!0,hideInSearch:!0},{title:"\u89D2\u8272\u7F16\u7801",dataIndex:"code"},{title:"\u89D2\u8272\u540D\u79F0",dataIndex:"name"},{title:"\u5907\u6CE8",dataIndex:"remark",hideInSearch:!0},{title:"\u72B6\u6001",dataIndex:"status",hideInSearch:!0,valueEnum:{0:{text:"\u542F\u7528",status:"Success"},1:{text:"\u7981\u7528",status:"Warning"}}},{title:"\u521B\u5EFA\u65F6\u95F4",search:!1,dataIndex:"createAt",sorter:!0},{title:"\u64CD\u4F5C",dataIndex:"option",valueType:"option",render:function(l,c){return Ue(c)}}];return(0,r.jsxs)(ce.ZP,{children:[(0,r.jsx)(de.ZP,{headerTitle:"\u89D2\u8272\u5217\u8868",actionRef:h,rowKey:"id",pagination:{defaultPageSize:20},search:{labelWidth:120},toolBarRender:function(){return(0,r.jsxs)(P.Z,{type:"primary",onClick:function(){S(!0)},children:[(0,r.jsx)(ie.Z,{})," \u65B0\u5EFA"]},"create")},request:function(){var g=(0,o.Z)(s().mark(function l(c){var d,y;return s().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:return d=[],y=0,f.next=4,pe(c).then(function(se){d=se.data.data,y=se.data.total});case 4:return f.abrupt("return",{data:d,success:!0,total:y});case 5:case"end":return f.stop()}},l)}));return function(l){return g.apply(this,arguments)}}(),columns:Ke,rowSelection:{onChange:function(l,c){return Pe(c)}}}),(0,r.jsx)(fe,{onFinish:function(){var g=(0,o.Z)(s().mark(function l(c){var d;return s().wrap(function(j){for(;;)switch(j.prev=j.next){case 0:if(d=!1,!c.id){j.next=7;break}return j.next=4,$e(c);case 4:d=j.sent,j.next=10;break;case 7:return j.next=9,Te(c);case 9:d=j.sent;case 10:d&&(S(!1),h.current&&h.current.reload());case 11:case"end":return j.stop()}},l)}));return function(l){return g.apply(this,arguments)}}(),onCancel:function(){S(!1),v({})},modalVisible:e,values:F||{}}),F&&Object.keys(F).length?(0,r.jsx)(Ie,{onSubmit:function(){var g=(0,o.Z)(s().mark(function l(c){var d,y;return s().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:return d={sysRoleId:F.id,sysMenuId:c},f.next=3,Ae(d);case 3:y=f.sent,y&&(T(!1),v({}),h.current&&h.current.reload());case 5:case"end":return f.stop()}},l)}));return function(l){return g.apply(this,arguments)}}(),onCancel:function(){T(!1),v({})},modalVisible:k,values:re||{}}):null,F&&Object.keys(F).length?(0,r.jsx)(Re,{onFinish:function(){var g=(0,o.Z)(s().mark(function l(c){var d,y;return s().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:return d={sysRoleId:F.id,dataScopeType:c.dataScopeType,sysOrgId:c.sysOrgId},f.next=3,We(d);case 3:y=f.sent,y&&(E(!1),v({}),h.current&&h.current.reload());case 5:case"end":return f.stop()}},l)}));return function(l){return g.apply(this,arguments)}}(),onCancel:function(){E(!1),v({})},updateModalVisible:O,values:F}):null]})},Ye=Be}}]);
|