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