|
- (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[3560],{83341:function(me,K,n){"use strict";n.d(K,{O:function(){return ce}});function ce(T){T=T||32;for(var J="ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz",N=J.length,m="012345678",l=m.length,b="",Q=0;Q<T;Q++)b+=J.charAt(Math.floor(Math.random()*N));for(var f=0;f<T;f++)b+=m.charAt(Math.floor(Math.random()*l));return b.toUpperCase()}},92363:function(me,K,n){"use strict";n.r(K),n.d(K,{default:function(){return qe}});var ce=n(57663),T=n(71577),J=n(62350),N=n(24565),m=n(2824),l=n(39428),b=n(11849),Q=n(34792),f=n(48086),v=n(3182),p=n(67294),ve=n(49101),ge=n(28790),Ze=n(16894),ye=n(62255),la=n(71194),X=n(50146),sa=n(77883),Se=n(85986),ia=n(9715),O=n(55843),oa=n(47673),q=n(4107),t=n(85893),Ce=function(a){return(0,t.jsx)(X.Z,{title:a.values.id?"\u7F16\u8F91\u89D2\u8272":"\u65B0\u5EFA\u89D2\u8272",width:1e3,visible:a.modalVisible,maskClosable:!1,bodyStyle:{padding:"32px 40px 1px 48px"},footer:null,onCancel:function(){a.onCancel()},destroyOnClose:!0,children:(0,t.jsxs)(O.Z,{layout:"horizontal",preserve:!1,labelCol:{span:4},initialValues:a.values,onFinish:a.onFinish,children:[(0,t.jsx)(O.Z.Item,{name:"id",hidden:!0,children:(0,t.jsx)(q.Z,{})}),(0,t.jsx)(O.Z.Item,{name:"name",label:"\u89D2\u8272\u540D\u79F0",rules:[{required:!0,max:64}],children:(0,t.jsx)(q.Z,{placeholder:"\u8BF7\u8F93\u5165\u89D2\u8272\u540D\u79F0"})}),(0,t.jsx)(O.Z.Item,{name:"sort",label:"\u6392\u5E8F",children:(0,t.jsx)(Se.Z,{style:{width:"100%"},min:1,decimalSeparator:"0"})}),(0,t.jsx)(O.Z.Item,{name:"remark",label:"\u5907\u6CE8",rules:[{max:500}],children:(0,t.jsx)(q.Z.TextArea,{placeholder:"\u8BF7\u8F93\u5165\u5907\u6CE8"})}),(0,t.jsxs)(O.Z.Item,{children:[(0,t.jsx)(T.Z,{htmlType:"button",style:{float:"right",left:10},onClick:a.onCancel,children:"\u53D6\u6D88"}),(0,t.jsx)(T.Z,{type:"primary",htmlType:"submit",style:{float:"right"},children:"\u4FDD\u5B58"})]})]})})},we=Ce,D=n(48971),E=n(96690);function je(r){return _.apply(this,arguments)}function _(){return _=(0,v.Z)((0,l.Z)().mark(function r(a){return(0,l.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,D.WY)((0,E.w)()+"/api/roles/page",{method:"post",data:(0,b.Z)({},a)}));case 1:case"end":return e.stop()}},r)})),_.apply(this,arguments)}function ca(r){return ee.apply(this,arguments)}function ee(){return ee=_asyncToGenerator(_regeneratorRuntime().mark(function r(a){return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",request(getDataBaseUrl()+"/api/roles/enable/?Id=".concat(a)));case 1:case"end":return e.stop()}},r)})),ee.apply(this,arguments)}function da(r){return ae.apply(this,arguments)}function ae(){return ae=_asyncToGenerator(_regeneratorRuntime().mark(function r(a){return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",request(getDataBaseUrl()+"/api/roles/disable/?Id=".concat(a)));case 1:case"end":return e.stop()}},r)})),ae.apply(this,arguments)}function be(r){return re.apply(this,arguments)}function re(){return re=(0,v.Z)((0,l.Z)().mark(function r(a){return(0,l.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,D.WY)((0,E.w)()+"/api/roles/add",{method:"POST",data:(0,b.Z)({},a)}));case 1:case"end":return e.stop()}},r)})),re.apply(this,arguments)}function De(r){return te.apply(this,arguments)}function te(){return te=(0,v.Z)((0,l.Z)().mark(function r(a){return(0,l.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,D.WY)((0,E.w)()+"/api\u200B/roles/update",{method:"POST",data:(0,b.Z)({},a)}));case 1:case"end":return e.stop()}},r)})),te.apply(this,arguments)}function Ee(r){return ne.apply(this,arguments)}function ne(){return ne=(0,v.Z)((0,l.Z)().mark(function r(a){return(0,l.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,D.WY)((0,E.w)()+"/api\u200B/roles/delete",{method:"POST",data:a}));case 1:case"end":return e.stop()}},r)})),ne.apply(this,arguments)}function Fe(r){return ue.apply(this,arguments)}function ue(){return ue=(0,v.Z)((0,l.Z)().mark(function r(a){return(0,l.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,D.WY)((0,E.w)()+"\u200B/api/roles/addorupdatemenurole",{method:"post",data:a}));case 1:case"end":return e.stop()}},r)})),ue.apply(this,arguments)}function Te(r){return le.apply(this,arguments)}function le(){return le=(0,v.Z)((0,l.Z)().mark(function r(a){return(0,l.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,D.WY)((0,E.w)()+"/api/roles/getmenurole/?RoleId=".concat(a)));case 1:case"end":return e.stop()}},r)})),le.apply(this,arguments)}function Oe(r){return se.apply(this,arguments)}function se(){return se=(0,v.Z)((0,l.Z)().mark(function r(a){return(0,l.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,D.WY)((0,E.w)()+"/api/roles/setandalterdatascope",{method:"post",data:a}));case 1:case"end":return e.stop()}},r)})),se.apply(this,arguments)}function Me(r){return ie.apply(this,arguments)}function ie(){return ie=(0,v.Z)((0,l.Z)().mark(function r(a){return(0,l.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,D.WY)((0,E.w)()+"\u200B/api/menu/menuparmytrees?getType=".concat(a.getType,"&&type=").concat(a.type),{method:"Get"}));case 1:case"end":return e.stop()}},r)})),ie.apply(this,arguments)}var fa=n(13062),Ae=n(71230),ha=n(89032),xe=n(15746),pa=n(32157),Ie=n(7573),ma=n(63185),Re=n(9676),Be=function(a){var i=(0,p.useState)(),e=(0,m.Z)(i,2),w=e[0],u=e[1],y=(0,p.useState)(),F=(0,m.Z)(y,2),B=F[0],k=F[1],G=(0,p.useState)(!1),$=(0,m.Z)(G,2),x=$[0],I=$[1],H=(0,p.useState)(!1),M=(0,m.Z)(H,2),R=M[0],V=M[1];(0,p.useEffect)((0,v.Z)((0,l.Z)().mark(function g(){var S,Z,Y;return(0,l.Z)().wrap(function(U){for(;;)switch(U.prev=U.next){case 0:S=[],Z=[],ye.Z.from(a.values).forEach(function(L){L.isParentMenu||S.push(L.id),L.id!==null&&typeof L.id!="undefined"&&Z.push(L)}),k(S),Y=a.treeData,console.log("props.values",a.values),console.log("data",Y),console.log("filteredArr",Z),P(Y)===Z.length?(V(!0),I(!1)):(V(!1),a.values.length==0?I(!1):I(!0)),u(Y);case 10:case"end":return U.stop()}},g)})),[a.modalVisible]);function P(g){for(var S=g.length,Z=0;Z<g.length;Z++)Array.isArray(g[Z].children)&&(S+=P(g[Z].children));return S}var oe=function(S){if(R)k([]),V(!1),I(!1);else{var Z=z(w,[]);k(Z),V(!0),I(!1)}};function z(g,S){console.log(g);for(var Z in g)S.push(g[Z].key),g[Z].children&&z(g[Z].children,S);return S}var A=(0,t.jsx)(X.Z,{width:700,bodyStyle:{padding:"32px 40px 48px"},destroyOnClose:!0,title:"\u83DC\u5355\u5206\u914D",okText:"\u4FDD\u5B58",cancelText:"\u53D6\u6D88",visible:a.modalVisible,onOk:function(){return a.onSubmit(B)},onCancel:function(){return a.onCancel()},maskClosable:!1,children:(0,t.jsx)(Ae.Z,{children:(0,t.jsxs)(xe.Z,{span:12,children:[(0,t.jsx)(Re.Z,{indeterminate:x,onChange:oe,checked:R,children:"\u5168\u9009"}),(0,t.jsx)(Ie.Z,{treeData:w,onCheck:function(S,Z){P(a.treeData)==S.length?(V(!0),I(!1)):(V(!1),I(!0)),k(S)},defaultExpandAll:!1,checkedKeys:B,checkable:!0})]})})});return A},ke=Be,va=n(62999),$e=n(54680),ga=n(43358),W=n(34041);function Ve(r){return(0,D.WY)((0,E.w)()+"/api\u200B/menu/getmenutreepage",{method:"post",data:r})}function We(){return(0,D.WY)((0,E.w)()+"\u200B/api/menu/menutrees/?getType=user")}function Ge(r){return(0,D.WY)((0,E.w)()+"/api/menu/getorglist")}function Pe(r){return(0,D.WY)((0,E.w)()+"\u200B/api\u200B/organize/tree",{data:(0,b.Z)({},r)})}var Ye={menutreepage:Ve,SelectTree:We,GetOrg:Ge,gettree:Pe},Ue=function(a){var i=(0,p.useState)([]),e=(0,m.Z)(i,2),w=e[0],u=e[1],y=(0,p.useState)(0),F=(0,m.Z)(y,2),B=F[0],k=F[1];(0,p.useEffect)(function(){function $(){Ye.gettree().then(function(x){u(x.data)})}$()},[a.values]);var G=function(x){k(x),console.log(x)};return(0,t.jsx)(X.Z,{width:640,bodyStyle:{padding:"32px 40px 1px 48px"},destroyOnClose:!0,title:"\u7ED9 ".concat(a.values.name," \u6388\u6743\u6570\u636E"),visible:a.updateModalVisible,footer:null,onCancel:function(){return a.onCancel()},children:(0,t.jsxs)(O.Z,{preserve:!1,layout:"horizontal",labelCol:{span:4},onFinish:a.onFinish,initialValues:a.values,children:[(0,t.jsx)(O.Z.Item,{name:"dataScopeType",label:"\u6388\u6743\u8303\u56F4",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u6388\u6743\u8303\u56F4"}],children:(0,t.jsxs)(W.Z,{allowClear:!0,placeholder:"\u8BF7\u9009\u62E9\u6388\u6743\u8303\u56F4",onChange:G,children:[(0,t.jsx)(W.Z.Option,{value:1,children:"\u5168\u90E8\u6570\u636E"}),(0,t.jsx)(W.Z.Option,{value:2,children:"\u672C\u90E8\u95E8\u53CA\u4EE5\u4E0B\u6570\u636E"}),(0,t.jsx)(W.Z.Option,{value:3,children:"\u672C\u90E8\u95E8\u6570\u636E"}),(0,t.jsx)(W.Z.Option,{value:4,children:"\u4EC5\u672C\u4EBA\u6570\u636E"}),(0,t.jsx)(W.Z.Option,{value:5,children:"\u81EA\u5B9A\u4E49\u6570\u636E"})]})}),B!=5?null:(0,t.jsx)(O.Z.Item,{name:"sysOrgId",label:"\u9009\u62E9\u673A\u6784",rules:[{required:!0,message:"\u9009\u62E9\u673A\u6784"}],children:(0,t.jsx)($e.Z,{style:{width:"100%"},dropdownStyle:{maxHeight:400,overflow:"auto"},treeData:w,multiple:!0,placeholder:"\u9009\u62E9\u673A\u6784",treeDefaultExpandAll:!0})}),(0,t.jsxs)(O.Z.Item,{children:[(0,t.jsx)(T.Z,{htmlType:"button",style:{float:"right",left:10},onClick:a.onCancel,children:"\u53D6\u6D88"}),(0,t.jsx)(T.Z,{type:"primary",htmlType:"submit",style:{float:"right"},children:"\u4FDD\u5B58"})]})]})})},Le=Ue,ze=n(83341),Ke=function(){var r=(0,v.Z)((0,l.Z)().mark(function a(i){var e,w;return(0,l.Z)().wrap(function(y){for(;;)switch(y.prev=y.next){case 0:return e=f.default.loading("\u6B63\u5728\u6DFB\u52A0"),y.prev=1,w=be((0,b.Z)({},i)).then(function(F){return F.data?f.default.success("\u6DFB\u52A0\u6210\u529F"):f.default.error("\u6DFB\u52A0\u5931\u8D25,"+F.errors),F.data}),e(),y.abrupt("return",w);case 7:return y.prev=7,y.t0=y.catch(1),console.log(y.t0),e(),f.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),y.abrupt("return",!1);case 13:case"end":return y.stop()}},a,null,[[1,7]])}));return function(i){return r.apply(this,arguments)}}(),He=function(){var r=(0,v.Z)((0,l.Z)().mark(function a(i){var e;return(0,l.Z)().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return e=f.default.loading("\u6B63\u5728\u66F4\u65B0"),u.prev=1,u.next=4,De((0,b.Z)({},i));case 4:return e(),f.default.success("\u66F4\u65B0\u6210\u529F"),u.abrupt("return",!0);case 9:return u.prev=9,u.t0=u.catch(1),e(),f.default.error("\u66F4\u65B0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),u.abrupt("return",!1);case 14:case"end":return u.stop()}},a,null,[[1,9]])}));return function(i){return r.apply(this,arguments)}}(),Je=function(a){},Ne=function(){var r=(0,v.Z)((0,l.Z)().mark(function a(i){var e;return(0,l.Z)().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return e=f.default.loading("\u6B63\u5728\u5206\u914D\u83DC\u5355"),u.prev=1,u.next=4,Fe((0,b.Z)({},i));case 4:return e(),f.default.success("\u5206\u914D\u83DC\u5355\u6210\u529F"),u.abrupt("return",!0);case 9:return u.prev=9,u.t0=u.catch(1),e(),f.default.error("\u5206\u914D\u83DC\u5355\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),u.abrupt("return",!1);case 14:case"end":return u.stop()}},a,null,[[1,9]])}));return function(i){return r.apply(this,arguments)}}(),Qe=function(){var r=(0,v.Z)((0,l.Z)().mark(function a(i){var e;return(0,l.Z)().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return e=f.default.loading("\u6B63\u5728\u5206\u914D\u6570\u636E\u6743\u9650"),u.prev=1,u.next=4,Oe((0,b.Z)({},i));case 4:return e(),f.default.success("\u5206\u914D\u6570\u636E\u6743\u9650\u6210\u529F"),u.abrupt("return",!0);case 9:return u.prev=9,u.t0=u.catch(1),e(),f.default.error("\u5206\u914D\u6570\u636E\u6743\u9650\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),u.abrupt("return",!1);case 14:case"end":return u.stop()}},a,null,[[1,9]])}));return function(i){return r.apply(this,arguments)}}(),Za="Role",Xe=function(){var a=(0,p.useState)(),i=(0,m.Z)(a,2),e=i[0],w=i[1],u=(0,p.useState)(),y=(0,m.Z)(u,2),F=y[0],B=y[1],k=(0,p.useState)(),G=(0,m.Z)(k,2),$=G[0],x=G[1],I=(0,p.useState)({}),H=(0,m.Z)(I,2),M=H[0],R=H[1],V=(0,p.useState)({}),P=(0,m.Z)(V,2),oe=P[0],z=P[1],A=(0,p.useRef)(),g=(0,p.useState)(),S=(0,m.Z)(g,2),Z=S[0],Y=S[1],de=(0,p.useState)(),U=(0,m.Z)(de,2),L=U[0],ya=U[1],_e=(0,p.useState)([]),fe=(0,m.Z)(_e,2),Sa=fe[0],Ca=fe[1],ea=(0,p.useState)(),he=(0,m.Z)(ea,2),aa=he[0],ra=he[1],ta=function(){var C=(0,v.Z)((0,l.Z)().mark(function s(c){var d;return(0,l.Z)().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(d=f.default.loading("\u6B63\u5728\u5220\u9664"),c){o.next=3;break}return o.abrupt("return",!0);case 3:return o.prev=3,o.next=6,Ee([c.id]).then(function(h){h.succeeded?(f.default.success("\u5220\u9664\u6210\u529F"),A.current.reload()):f.default.error(h.data)});case 6:return d(),o.abrupt("return",!0);case 10:return o.prev=10,o.t0=o.catch(3),d(),f.default.error("\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"),o.abrupt("return",!1);case 15:case"end":return o.stop()}},s,null,[[3,10]])}));return function(c){return C.apply(this,arguments)}}(),na=function(s){var c=[];return c.push((0,t.jsx)("a",{disabled:s.code=="sys_manager_role",style:{pointerEvents:s.code=="sys_manager_role"?"none":"auto"},onClick:function(){w(!0),z(s)},children:"\u66F4\u65B0"})),c.push((0,t.jsx)(N.Z,{title:"\u786E\u8BA4\u5220\u9664\u5417\uFF1F",onConfirm:function(){ta(s)},onCancel:Je,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",children:(0,t.jsx)("a",{disabled:s.code=="sys_manager_role",style:{pointerEvents:s.code=="sys_manager_role"?"none":"auto"},children:"\u5220\u9664"})})),c.push((0,t.jsx)("a",{disabled:s.code=="sys_manager_role",style:{pointerEvents:s.code=="sys_manager_role"?"none":"auto"},onClick:function(){Te(s.id).then(function(j){Y(j.data),B(!0)}),R(s)},children:"\u6388\u6743\u83DC\u5355"})),c};(0,p.useEffect)(function(){var C={getType:"ALL",type:0};Me(C).then(function(s){s.data&&ra(s.data)})},[]);var ua=[{title:"id",dataIndex:"id",hideInTable:!0,hideInSearch:!0},{title:"\u89D2\u8272\u540D\u79F0",dataIndex:"name",ellipsis:!0},{title:"\u5907\u6CE8",dataIndex:"remark",hideInSearch:!0,ellipsis:!0},{title:"\u521B\u5EFA\u65F6\u95F4",search:!1,dataIndex:"createAt",sorter:!0},{title:"\u64CD\u4F5C",dataIndex:"option",valueType:"option",fixed:"right",width:350,render:function(s,c){return na(c)}}];return(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)(ge.ZP,{host:!0,header:{title:"",breadcrumb:{}},children:[(0,t.jsx)(Ze.ZP,{headerTitle:"\u89D2\u8272\u5217\u8868",actionRef:A,rowKey:"id",pagination:{defaultPageSize:10},search:{labelWidth:120},toolBarRender:function(){return(0,t.jsxs)(T.Z,{type:"primary",onClick:function(){var c={code:(0,ze.O)(4)};z({}),w(!0)},children:[(0,t.jsx)(ve.Z,{})," \u65B0\u5EFA"]},"create")},request:function(){var C=(0,v.Z)((0,l.Z)().mark(function s(c){var d,j;return(0,l.Z)().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return d=[],j=0,h.next=4,je(c).then(function(pe){d=pe.data.data,j=pe.data.total});case 4:return h.abrupt("return",{data:d,success:!0,total:j});case 5:case"end":return h.stop()}},s)}));return function(s){return C.apply(this,arguments)}}(),columns:ua,rowSelection:!1}),(0,t.jsx)(we,{onFinish:function(){var C=(0,v.Z)((0,l.Z)().mark(function s(c){var d;return(0,l.Z)().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(d=!1,!c.id){o.next=7;break}return o.next=4,He(c);case 4:d=o.sent,o.next=10;break;case 7:return o.next=9,Ke(c);case 9:d=o.sent;case 10:d&&(w(!1),A.current&&A.current.reload());case 11:case"end":return o.stop()}},s)}));return function(s){return C.apply(this,arguments)}}(),onCancel:function(){w(!1),R({})},modalVisible:e,values:oe||{}}),M&&Object.keys(M).length?(0,t.jsx)(ke,{onSubmit:function(){var C=(0,v.Z)((0,l.Z)().mark(function s(c){var d,j;return(0,l.Z)().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return d={sysRoleId:M.id,sysMenuId:c},h.next=3,Ne(d);case 3:j=h.sent,j&&(B(!1),R({}),A.current&&A.current.reload());case 5:case"end":return h.stop()}},s)}));return function(s){return C.apply(this,arguments)}}(),onCancel:function(){B(!1),R({})},modalVisible:F,values:Z||{},treeData:aa}):null,M&&Object.keys(M).length?(0,t.jsx)(Le,{onFinish:function(){var C=(0,v.Z)((0,l.Z)().mark(function s(c){var d,j;return(0,l.Z)().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return d={sysRoleId:M.id,dataScopeType:c.dataScopeType,sysOrgId:c.sysOrgId},h.next=3,Qe(d);case 3:j=h.sent,j&&(x(!1),R({}),A.current&&A.current.reload());case 5:case"end":return h.stop()}},s)}));return function(s){return C.apply(this,arguments)}}(),onCancel:function(){x(!1),R({})},updateModalVisible:$,values:M}):null]})})},qe=Xe}}]);
|