"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[685],{54784:function(ue,q,n){n.r(q),n.d(q,{default:function(){return he}});var te=n(5574),x=n.n(te),i=n(62435),K=n(59530),G=n(28459),ae=n(15009),P=n.n(ae),re=n(99289),z=n.n(re),le=n(95338),J=n(14726),u=n(39680),e=n(86074),h=function(a){var f=a.dispatch,W=a.openModel,O=a.getId,p=(0,i.useRef)(),b=(0,i.useState)([]),Z=x()(b,2),R=Z[0],Q=Z[1],L=(0,i.useState)(0),H=x()(L,2),T=H[0],_=H[1],V=(0,i.useState)(1),C=x()(V,2),d=C[0],g=C[1],y=(0,i.useState)(10),U=x()(y,2),X=U[0],c=U[1],$=function(t){O(t)};return(0,i.useEffect)(function(){W.openModal||p.current.reload()},[W.openModal]),(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(G.ZP,{theme:{token:{colorPrimary:"#4FBE70",colorLink:"#4FBE70"}},children:(0,e.jsx)(le.Z,{scroll:{y:480,x:"auto"},bordered:!0,actionRef:p,dataSource:R,search:{span:8,labelWidth:"auto"},columns:[{title:"ID",dataIndex:"id",search:!1},{title:"\u89D2\u8272\u540D",dataIndex:"name"},{title:"\u522B\u540D",dataIndex:"code",search:!1},{title:"\u63CF\u8FF0",dataIndex:"description",search:!1},{title:"\u64CD\u4F5C",key:"option",valueType:"option",render:function(t,r,s){return[(0,e.jsx)(J.ZP,{type:"link",onClick:function(){$(r.id),f({type:"openModel/getOpenModal",payload:!0})},children:"\u7F16\u8F91"},"1"),(0,e.jsx)(J.ZP,{type:"link",onClick:function(){$(r.id),f({type:"openModel/getOpenDispenseModal",payload:!0})},children:"\u5206\u914D\u6743\u9650"},"2"),(0,e.jsx)(J.ZP,{type:"link",onClick:function(){},children:"\u5220\u9664"},"3")]}}],rowKey:"id",pagination:{current:d,pageSize:X,showSizeChanger:!0,total:T,pageSizeOptions:[9,18,27,99],onChange:function(t,r){g(t),c(r)},onShowSizeChange:function(t,r){g(t),c(r)}},request:z()(P()().mark(function A(){var t,r=arguments;return P()().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return t=r.length>0&&r[0]!==void 0?r[0]:{},o.abrupt("return",(0,u.ccM)({page:d,pagesize:X,sort:"id",sortby:"desc",keyword:t.name}).then(function(l){Q(l.data.roles),_(l.data.total)}));case 2:case"end":return o.stop()}},A)})),headerTitle:"\u89D2\u8272\u5217\u8868",toolBarRender:function(){return[(0,e.jsx)(J.ZP,{type:"primary",onClick:function(){f({type:"openModel/getOpenModal",payload:!0})},children:"\u6DFB\u52A0\u89D2\u8272"})]}})})})},v=(0,K.connect)(function(j){var a=j.openModel;return{openModel:a}})(h),M=n(97269),I=n(5966),D=n(17788),S=n(86250),F=n(42075),m=n(68872),N=function(a){var f=a.dispatch,W=a.dictModel,O=a.openModel,p=a.id,b=(0,i.useRef)(),Z=(0,i.useState)(!1),R=x()(Z,2),Q=R[0],L=R[1],H=(0,i.useState)(null),T=x()(H,2),_=T[0],V=T[1];return(0,i.useEffect)(function(){L(O.openModal)},[O.openModal]),(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(G.ZP,{theme:{token:{colorPrimary:"#4FBE70"}},children:(0,e.jsx)(D.Z,{open:Q,title:p?"\u7F16\u8F91\u89D2\u8272":"\u6DFB\u52A0\u89D2\u8272",centered:!0,maskClosable:!1,footer:null,destroyOnClose:!0,width:600,onCancel:function(){f({type:"openModel/getOpenModal",payload:!1})},children:(0,e.jsxs)(M.A,{formRef:b,request:z()(P()().mark(function C(){var d;return P()().wrap(function(y){for(;;)switch(y.prev=y.next){case 0:if(!p){y.next=8;break}return y.next=3,(0,u.MPF)({id:p});case 3:return d=y.sent,V(d.data),y.abrupt("return",d.data);case 8:return y.abrupt("return",{name:"",code:"",description:""});case 9:case"end":return y.stop()}},C)})),submitter:{searchConfig:{resetText:"\u53D6\u6D88",submitText:"\u4FDD\u5B58"},render:function(d,g){return(0,e.jsxs)(S.Z,{justify:"flex-end",children:[" ",(0,e.jsx)(F.Z,{children:g})]})},onReset:function(){V(null),f({type:"openModel/getOpenModal",payload:!1})}},onFinish:function(){var C=z()(P()().mark(function d(g){var y,U;return P()().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(console.log(g),!p){c.next=10;break}return g.id=p,c.next=5,(0,u.W$o)(g);case 5:y=c.sent,m.ZP.success("\u63D0\u4EA4\u6210\u529F"),f({type:"openModel/getOpenModal",payload:!1}),c.next=15;break;case 10:return c.next=12,(0,u.o5s)(g);case 12:U=c.sent,m.ZP.success("\u63D0\u4EA4\u6210\u529F"),f({type:"openModel/getOpenModal",payload:!1});case 15:case"end":return c.stop()}},d)}));return function(d){return C.apply(this,arguments)}}(),children:[(0,e.jsx)(I.Z,{label:"\u89D2\u8272\u540D",name:"name",placeholder:"\u8BF7\u8F93\u5165\u89D2\u8272\u540D",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u89D2\u8272\u540D"}]}),(0,e.jsx)(I.Z,{label:"\u89D2\u8272\u522B\u540D",name:"code",placeholder:"\u8BF7\u8F93\u5165\u8DEF\u5F84",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u8DEF\u5F84"}]}),(0,e.jsx)(I.Z,{label:"\u63CF\u8FF0",name:"description",placeholder:"\u8BF7\u8F93\u5165\u63CF\u8FF0",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u63CF\u8FF0"}]})]})})})})},E=(0,K.connect)(function(j){var a=j.dictModel,f=j.openModel;return{dictModel:a,openModel:f}})(N),ee=n(19632),ne=n.n(ee),de=n(47221),se=n(71230),w=n(15746),oe=n(66309),ie=n(36998),ce=function(a){var f=a.dispatch,W=a.dictModel,O=a.openModel,p=a.id,b=(0,i.useState)(!1),Z=x()(b,2),R=Z[0],Q=Z[1],L=(0,i.useState)(null),H=x()(L,2),T=H[0],_=H[1],V=(0,i.useState)([0]),C=x()(V,2),d=C[0],g=C[1],y=(0,i.useState)([]),U=x()(y,2),X=U[0],c=U[1];(0,i.useEffect)(function(){Q(O.openDispenseModal)},[O.openDispenseModal]);var $=function(r,s){var o=s?[].concat(ne()(d),[r]):d.filter(function(l){return l!==r});g(o),s?(0,u.kOe)({role_id:p,permission_id:r}).then(function(l){m.ZP.success("\u5206\u914D\u6210\u529F")}).catch(function(l){m.ZP.error("\u6DFB\u52A0\u5931\u8D25")}):(0,u.tFF)({role_id:p,permission_id:r}).then(function(l){m.ZP.success("\u79FB\u9664\u6210\u529F")}).catch(function(l){m.ZP.error("\u79FB\u9664\u6210\u529F")})};function A(t,r){var s=[];if(t&&t.length>0){t.forEach(function(l){var B=r.findIndex(function(Y){return Y.id===l});B!==-1&&s.push((B+1).toString())});var o=ne()(new Set(s));return o}else return s}return(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(G.ZP,{theme:{},children:(0,e.jsx)(D.Z,{title:"\u5206\u914D\u6743\u9650",open:R,centered:!0,maskClosable:!0,destroyOnClose:!0,width:1200,footer:null,onCancel:function(){f({type:"openModel/getOpenDispenseModal",payload:!1})},afterOpenChange:function(){var t=z()(P()().mark(function r(s){var o,l,B,Y;return P()().wrap(function(k){for(;;)switch(k.prev=k.next){case 0:if(!s){k.next=18;break}return _(null),g([]),c([]),k.next=6,(0,u.hWI)();case 6:return o=k.sent,_(o.data),k.next=10,(0,u._Gv)({id:p});case 10:l=k.sent,console.log((0,ie.aT)(l.data.permissionIds,"53")),(0,ie.aT)(l.data.permissionIds,"53")||($(53,!0),l.data.permissionIds.push("53")),B=l.data.permissionIds&&l.data.permissionIds.map(function(ve){return Number(ve)}),g(B),Y=A(B,o.data.permissions),console.log(Y),Y.length>0?c(Y):c(["1"]);case 18:case"end":return k.stop()}},r)}));return function(r){return t.apply(this,arguments)}}(),onOk:z()(P()().mark(function t(){return P()().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:case"end":return s.stop()}},t)})),children:T&&X.length>0&&(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(F.Z,{direction:"vertical",children:T&&T.permissions.map(function(t,r){return(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(de.Z,{defaultActiveKey:X,items:[{key:(r+1).toString(),label:(0,e.jsx)(e.Fragment,{children:t.name}),children:(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(se.Z,{gutter:[16,16],children:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(w.Z,{span:6,style:{display:"flex",justifyContent:"flex-start",alignItems:"center"},children:(0,e.jsx)(oe.Z.CheckableTag,{checked:d.includes(t.id),onChange:function(o){$(t.id,o)},children:t.name})}),(0,e.jsx)(w.Z,{span:18,children:(0,e.jsx)(se.Z,{gutter:[16,16],children:t.childs&&t.childs.length>0&&t.childs.map(function(s){return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(w.Z,{span:6,style:{display:"flex",justifyContent:"flex-start",alignItems:"center"},children:(0,e.jsx)(oe.Z.CheckableTag,{checked:d.includes(s.id),onChange:function(l){$(s.id,l)},children:s.name})}),(0,e.jsx)(w.Z,{span:18,style:{display:"flex",justifyContent:"flex-start",alignItems:"center"},children:(0,e.jsx)(se.Z,{gutter:[16,16],children:s.childs&&s.childs.length>0&&s.childs.map(function(o){return(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(w.Z,{children:(0,e.jsx)(oe.Z.CheckableTag,{checked:d.includes(o.id),onChange:function(B){$(o.id,B)},children:o.name})})})})})})]})})})})]})})})}]})})})})})})})})},fe=(0,K.connect)(function(j){var a=j.dictModel,f=j.openModel;return{dictModel:a,openModel:f}})(ce),pe=function(a){var f=a.dispatch,W=a.openModel,O=(0,i.useState)(0),p=x()(O,2),b=p[0],Z=p[1],R=function(L){Z(L)};return(0,i.useEffect)(function(){W.openModal||Z(0)},[W.openModal]),(0,e.jsx)(e.Fragment,{children:(0,e.jsxs)(G.ZP,{theme:{token:{colorPrimary:"#4FBE70"}},children:[(0,e.jsx)(v,{getId:R}),(0,e.jsx)(E,{id:b}),(0,e.jsx)(fe,{id:b})]})})},he=(0,K.connect)(function(j){var a=j.openModel;return{openModel:a}})(pe)},36998:function(ue,q,n){n.d(q,{Zq:function(){return re},aT:function(){return P},wi:function(){return z}});var te=n(19632),x=n.n(te),i=n(64599),K=n.n(i),G=n(52677),ae=n.n(G),P=function(e,h){var v=!1;return v=e.includes(h),v},re=function(e,h){return e.every(function(v){return ae()(v)===h})};function z(u,e){var h=[];function v(S){if(S.id===e)return!0;if(S.children){var F=K()(S.children),m;try{for(F.s();!(m=F.n()).done;){var N=m.value;if(v(N))return h.unshift(S.id),!0}}catch(E){F.e(E)}finally{F.f()}}return!1}var M=K()(u),I;try{for(M.s();!(I=M.n()).done;){var D=I.value;v(D)}}catch(S){M.e(S)}finally{M.f()}return h}function le(u,e){var h=[],v=function I(D,S){var F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],m=_createForOfIteratorHelper(D),N;try{for(m.s();!(N=m.n()).done;){var E=N.value;if(E.name===S)return[].concat(_toConsumableArray(F),[E]);if(E.children){var ee=I(E.children,S,[].concat(_toConsumableArray(F),[E]));if(ee.length>0)return ee}}}catch(ne){m.e(ne)}finally{m.f()}return[]},M=v(u,e);return M}function J(u,e){var h=_createForOfIteratorHelper(u),v;try{for(h.s();!(v=h.n()).done;){var M=v.value;if(M.id===e)return!0;if(M.children&&Array.isArray(M.children)){var I=J(M.children,e);if(I)return!0}}}catch(D){h.e(D)}finally{h.f()}return!1}}}]);