var ee=Object.defineProperty,ae=Object.defineProperties;var te=Object.getOwnPropertyDescriptors;var _=Object.getOwnPropertySymbols;var M=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable;var B=(e,n,o)=>n in e?ee(e,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[n]=o,N=(e,n)=>{for(var o in n||(n={}))M.call(n,o)&&B(e,o,n[o]);if(_)for(var o of _(n))O.call(n,o)&&B(e,o,n[o]);return e},L=(e,n)=>ae(e,te(n));var z=(e,n)=>{var o={};for(var r in e)M.call(e,r)&&n.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&_)for(var r of _(e))n.indexOf(r)<0&&O.call(e,r)&&(o[r]=e[r]);return o};var m=(e,n,o)=>new Promise((r,s)=>{var c=i=>{try{d(o.next(i))}catch(p){s(p)}},v=i=>{try{d(o.throw(i))}catch(p){s(p)}},d=i=>i.done?r(i.value):Promise.resolve(i.value).then(c,v);d((o=o.apply(e,n)).next())});import{S as le}from"./index.9329952a.js";import{P as se}from"./index.a4c46506.js";import{h as oe,i as ne,j as ie,k as re,c as ue,l as de}from"./api.48439db0.js";import{d as C,f as ce,g as G,o as pe,a as K,aN as me,r as f,u as V,B as j,i as a,q as fe,l as k,ac as he,_ as D,a8 as ge,a9 as w,a7 as P,k as u,a0 as ve,m as ye,d4 as be,p as b,dh as ke,ai as we,H as R,cg as Ne,aa as _e,ch as E,bC as x}from"./index.52190234.js";import{N as H}from"./Cascader.e05af7a7.js";import{N as q}from"./FormItemGridItem.c165d723.js";import{f as De}from"./urlUtils.fecf42a6.js";import"./searchs.b637f0d6.js";const Fe={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},Ie=G("path",{d:"M221.09 64a157.09 157.09 0 1 0 157.09 157.09A157.1 157.1 0 0 0 221.09 64z",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"},null,-1),Le=G("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-miterlimit":"10","stroke-width":"32",d:"M338.29 338.29L448 448"},null,-1),Re=[Ie,Le],xe=C({name:"SearchOutline",render:function(n,o){return pe(),ce("svg",Fe,Re)}}),Ce=C({name:"role-operation",props:{type:{type:String,default:"add"},applyList:{type:Array,default:()=>[]},data:{type:Object,default:()=>{}}},emits:["close","getList"],setup(e,{slots:n,attrs:o,emit:r}){const s=K({appId:null,roleName:null,menuId:[],enable:!1,roleDesc:null}),c=me([]),v=f(""),d=f(!1),i=f(!1),p=f([]),h=f(!1),t=f([]),y=f({}),S=f(),F=f(),T=V(),Q=()=>m(this,null,function*(){const l=F.value.getCheckedData(),g=F.value.getIndeterminateData(),Y=[...l.keys,...g.keys];S.value.validate(Z=>m(this,null,function*(){if(Z)return!1;try{const I=z(s,[]),A=[...new Set(Y)];d.value=!0,e.type==="add"?(yield oe(L(N({},I),{menuId:A})),T.success("\u6DFB\u52A0\u6210\u529F")):e.type==="edit"&&(yield ne(L(N({},I),{menuId:A,id:e.data.id})),T.success("\u4FEE\u6539\u6210\u529F")),r("getList"),r("close")}catch(I){}d.value=!1}))}),$=l=>{l.length>=p.value.length?(i.value=!0,h.value=!1):l.length>0?(h.value=!0,i.value=!1):(h.value=!1,i.value=!1),s.menuId=l},J=l=>{i.value=l,l?(s.menuId=[...p.value],i.value=!0):(s.menuId=[],i.value=!1),h.value=!1,t.value=[]},W=()=>m(this,null,function*(){try{const l=yield ke({delFlag:!1});c.value=l.data,U(l.data)}catch(l){}}),U=l=>m(this,null,function*(){l.map(g=>{p.value.push(g.id),g.children&&g.children.length>0&&U(g.children)})}),X=()=>m(this,null,function*(){try{const l=e.data,g=yield ie({id:l.id});y.value=g.data||{}}catch(l){}});return j(()=>m(this,null,function*(){if(yield W(),e.type==="edit"){yield X();const l=e.data;s.appId=l.appId,s.roleName=l.roleName,s.enable=l.enable,s.roleDesc=l.roleDesc,s.menuId=y.value.menuLeafId,y.value.menuId.length>=p.value.length?(i.value=!0,h.value=!1):s.menuId.length>0&&(h.value=!0,i.value=!1)}})),()=>a("div",{style:"background: #fff; padding-top: 12px"},[a(fe,{model:s,ref:S,"label-placement":"left","label-width":"100"},{default:()=>[a(k,{label:"\u5E94\u7528\u5206\u7C7B",path:"appId",rule:[{required:!0,message:"\u8BF7\u9009\u62E9\u5E94\u7528\u5206\u7C7B"}]},{default:()=>[a(H,{value:s.appId,"onUpdate:value":l=>s.appId=l,options:e.applyList,showPath:!0,allowCheckingNotLoaded:!1,checkStrategy:"child",valueField:"id",labelField:"appName",childrenField:"bizApps",expandTrigger:"hover",placeholder:"\u8BF7\u9009\u62E9\u5E94\u7528\u5206\u7C7B",clearable:!0},null)]}),a(he,{cols:2},{default:()=>[a(q,{label:"\u89D2\u8272\u540D\u79F0",path:"roleName",rule:[{required:!0,message:"\u8BF7\u8F93\u5165\u89D2\u8272\u540D\u79F0"}]},{default:()=>[a(D,{value:s.roleName,"onUpdate:value":l=>s.roleName=l,placeholder:"\u8BF7\u8F93\u5165\u89D2\u8272\u540D\u79F0",clearable:!0,maxlength:100},null)]}),a(q,{label:"\u89D2\u8272\u72B6\u6001",path:"enable",rule:[{required:!0,message:"\u8BF7\u9009\u62E9\u89D2\u8272\u72B6\u6001"}]},{default:()=>[a(ge,{value:s.enable,"onUpdate:value":l=>s.enable=l},{default:()=>[a(w,null,{default:()=>[a(P,{value:!0},{default:()=>[u("\u542F\u7528")]}),a(P,{value:!1},{default:()=>[u("\u505C\u7528")]})]})]})]})]}),a(k,{label:"\u5907\u6CE8",path:"roleDesc"},{default:()=>[a(D,{value:s.roleDesc,"onUpdate:value":l=>s.roleDesc=l,maxlength:180,type:"textarea",rows:2,placeholder:"\u8BF7\u8F93\u5165\u5907\u6CE8",clearable:!0},null)]}),a(k,{label:"\u6743\u9650",path:"status"},{default:()=>[a(w,{vertical:!0,style:{width:"100%"}},{default:()=>[a(D,{placeholder:"\u8F93\u5165\u83DC\u5355\u540D\u641C\u7D22",value:v.value,"onUpdate:value":l=>v.value=l,clearable:!0},{suffix:()=>a(ve,null,{default:()=>[a(xe,null,null)]})}),a(ye,{indeterminate:h.value,checked:i.value,onUpdateChecked:J},{default:()=>[u("\u5168\u9009")]}),a(be,{style:{width:"100%",border:"1px solid #e0e0e6",height:"250px",borderRadius:"3px"},ref:F,"virtual-scroll":!0,cascade:!0,checkable:!0,showIrrelevantNodes:!1,pattern:v.value,data:c.value,checkedKeys:s.menuId,"onUpdate:checkedKeys":$,keyField:"id",labelField:"name",childrenField:"children"},null)]})]})]}),a(w,{justify:"end"},{default:()=>[a(b,{type:"default",onClick:()=>r("close")},{default:()=>[u("\u53D6\u6D88")]}),a(b,{type:"primary",onClick:()=>Q(),loading:d.value},{default:()=>[u("\u4FDD\u5B58")]})]})])}}),Ee=C({name:"subsidy-list",setup(){const e=K({loading:!1,pagination:{page:1,rows:10,pageTotal:0},searchForm:{appId:null,roleName:null},dataList:[],applyList:[],visiableRole:!1,roleOperation:"add",roleData:{}}),n=we(),o=V(),r=()=>[{title:"\u7F16\u53F7",key:"id"},{title:"\u5E94\u7528\u540D",key:"appName"},{title:"\u89D2\u8272\u540D\u79F0",key:"roleName"},{title:"\u89D2\u8272\u72B6\u6001",key:"enable",render(t){return t.enable?a(E,{type:"primary"},{default:()=>[u("\u5F00\u542F")]}):a(E,{type:"default"},{default:()=>[u("\u5173\u95ED")]})}},{title:"\u89D2\u8272\u63CF\u8FF0",key:"roleDesc"},{title:"\u521B\u5EFA\u65F6\u95F4",key:"createTime"},{title:"\u64CD\u4F5C",key:"operation",render(t){return a(w,null,{default:()=>[R(a(b,{type:"primary",size:"small",text:!0,onClick:()=>{e.visiableRole=!0,e.roleOperation="edit",e.roleData=t}},{default:()=>[u("\u4FEE\u6539")]}),[[x("auth"),"sysRole/update1674690192555945985"]]),R(a(b,{type:"primary",size:"small",text:!0,onClick:()=>s(t)},{default:()=>[u("\u5220\u9664")]}),[[x("auth"),"sysRole/remove1674690265977237505"]])]})}}],s=t=>{console.log(t,"row"),n.warning({title:"\u8B66\u544A",content:`\u5220\u9664"${t.roleName}"\uFF0C\u662F\u5426\u7EE7\u7EED\uFF1F`,positiveText:"\u786E\u5B9A",negativeText:"\u53D6\u6D88",onPositiveClick:()=>m(this,null,function*(){try{yield de({id:t.id}),c(),o.success("\u5220\u9664\u6210\u529F")}catch(y){}})})},c=()=>m(this,null,function*(){try{e.loading=!0;const{data:t}=yield re(N(N({},e.pagination),e.searchForm));e.loading=!1,e.pagination.pageTotal=Number(t.total),e.dataList=t.rows||[]}catch(t){e.loading=!1}}),v=(t=0)=>m(this,null,function*(){try{const{data:y}=yield ue({page:1,rows:999,leafQuery:!0,parentId:t});e.applyList=De(y.rows||[],"bizApps")}catch(y){}}),d=f(),i=()=>{e.pagination.page=1,c()},p=()=>{var t;(t=d.value)==null||t.submit()},h=()=>{var t;(t=d.value)==null||t.reset()};return j(()=>{c(),v()}),()=>a("div",{class:"system-menu-container"},[a(le,{ref:d,model:e.searchForm,onSubmit:i,onSetModel:t=>e.searchForm=t},{default:()=>[a(k,{label:"\u5E94\u7528\u5206\u7C7B",path:"appId"},{default:()=>[a(H,{value:e.searchForm.appId,"onUpdate:value":t=>e.searchForm.appId=t,options:e.applyList,showPath:!0,allowCheckingNotLoaded:!1,checkStrategy:"child",valueField:"id",labelField:"appName",childrenField:"bizApps",expandTrigger:"hover",placeholder:"\u8BF7\u9009\u62E9\u5E94\u7528\u5206\u7C7B",clearable:!0},null)]}),a(k,{label:"\u89D2\u8272\u540D\u79F0",path:"roleName"},{default:()=>[a(D,{value:e.searchForm.roleName,"onUpdate:value":t=>e.searchForm.roleName=t,placeholder:"\u8BF7\u8F93\u5165\u89D2\u8272\u540D\u79F0"},null)]}),a(k,null,{default:()=>[a(w,null,{default:()=>[a(b,{type:"primary",onClick:p},{default:()=>[u("\u641C\u7D22")]}),a(b,{type:"default",onClick:h},{default:()=>[u("\u91CD\u7F6E")]})]})]})]}),a("div",{class:["section-container"]},[a(w,{style:{paddingBottom:"12px"}},{default:()=>[R(a(b,{type:"primary",onClick:()=>{e.visiableRole=!0,e.roleData={},e.roleOperation="add"}},{default:()=>[u("\u6DFB\u52A0\u89D2\u8272")]}),[[x("auth"),"sysRole/save1674690114734829569"]])]}),a(Ne,{loading:e.loading,columns:r(),data:e.dataList},null),a(se,{page:e.pagination.page,"onUpdate:page":t=>e.pagination.page=t,pageSize:e.pagination.rows,"onUpdate:pageSize":t=>e.pagination.rows=t,pageTotal:e.pagination.pageTotal,"onUpdate:pageTotal":t=>e.pagination.pageTotal=t,onList:c,sync:!0},null)]),a(_e,{show:e.visiableRole,"onUpdate:show":t=>e.visiableRole=t,preset:"dialog",showIcon:!1,title:e.roleOperation==="add"?"\u65B0\u589E\u89D2\u8272":"\u4FEE\u6539\u89D2\u8272",style:{width:"600px"}},{default:()=>[a(Ce,{type:e.roleOperation,data:e.roleData,applyList:e.applyList,onClose:()=>e.visiableRole=!1,onGetList:c},null)]})])}});export{Ee as default};