Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

roleDrawer.100f7a51.js 5.3KB

pirms 2 mēnešiem
1
  1. import{_ as X,d as Y,r as b,o as Z,L as ee,ap as ae,ar as te,N as j,as as le,c as u,e as c,I as D,i as l,h as o,j as h,f as g,F as k,J as R,t as V,g as x,at as oe,au as se,q as ne,s as de,x as ie}from"./index.0660698f.js";import{g as ue}from"./menuManage.8eaf2518.js";const C=m=>(ne("data-v-cd25f452"),m=m(),de(),m),re=C(()=>x("div",{class:"el-descriptions__title mb-16"},"\u57FA\u672C\u4FE1\u606F",-1)),ce=C(()=>x("div",{class:"el-descriptions__title mb-16"},"\u83DC\u5355\u6743\u9650",-1)),me=C(()=>x("div",{class:"el-descriptions__title mb-16"},"\u6570\u636E\u6743\u9650",-1)),pe={class:"ml-18 mb-16"},_e=Y({name:"roleDrawer"}),fe=Object.assign(_e,{props:{visible:{type:Boolean,default:!1,required:!0},data:Object},emits:["close"],setup(m,{emit:q}){const{proxy:N}=ie(),s=m,S=q,I=b(),w=b(),U=b([]),a=b({id:void 0,name:void 0,manageRoleIds:void 0,describe:void 0,menuDataScopeList:[],menuDataScopeList2:[],menuData:[]}),E={name:[{required:!0,message:"\u8BF7\u8F93\u5165\u89D2\u8272\u540D\u79F0",trigger:"blur"}],manageRoleIds:[{required:!1,message:"\u8BF7\u9009\u62E9\u53EF\u63A7\u89D2\u8272",trigger:"change"}]},F=n=>`bgc${n.manageRoleIds}`,J=async n=>{!n||await n.validate(async e=>{var d,i,r;if(e){const f=w.value.getCheckedKeys(),v={...a.value,menuIds:f.map(L=>L),id:(d=s.data)==null?void 0:d.id,manageRoleIds:((i=a.value.manageRoleIds)==null?void 0:i.join(","))||"",menuData:void 0,menuDataScopeList2:void 0};(r=s.data)!=null&&r.id?(await oe(v),N.$message.success("\u7F16\u8F91\u6210\u529F\uFF01")):(await se(v),N.$message.success("\u65B0\u589E\u6210\u529F\uFF01")),S("close",!0)}})},$=n=>{const e=[];return n.forEach(d=>{d.children?$(d.childern):e.push(d.id)}),e},B=b([]),M=b([]),K=n=>n.filter(e=>e!==null),P=(n,e)=>{a.value.menuDataScopeList2[e]={dataScope:n,menuId:e};const d=K(a.value.menuDataScopeList2),i=JSON.parse(JSON.stringify(d));a.value.menuDataScopeList=i};return Z(async()=>{}),ee(()=>s.visible,async n=>{if(n){const e=await ae();if(B.value=e.data.records,s.data&&s.data.id){const r=await te({id:s.data.id});w.value.setCheckedKeys($(r.data.menu));const f=[];r.data.menuDataScopeList.forEach(v=>{f.push(v.dataScope)}),await j(),a.value={id:s.data.id,name:s.data.name,manageRoleIds:r.data.manageRoleIdList,describe:r.data.describe,menuDataScopeList:[],menuDataScopeList2:[],menuData:f}}else a.value.menuData=[];const d=await le();M.value=d.data;const i=await ue({id:s.data&&s.data.id||""});U.value=i.data}else I.value.resetFields(),a.value.id=void 0,await j(),w.value.setCheckedKeys([])}),(n,e)=>{var O;const d=u("el-input"),i=u("el-form-item"),r=u("el-col"),f=u("el-checkbox"),v=u("el-checkbox-group"),L=u("el-row"),A=u("el-tree"),z=u("el-radio"),G=u("el-radio-group"),H=u("el-form"),T=u("el-button"),Q=u("el-drawer");return c(),D(Q,{"model-value":m.visible,title:(O=s==null?void 0:s.data)!=null&&O.id?"\u7F16\u8F91\u89D2\u8272":"\u65B0\u589E\u89D2\u8272",size:"50%",onClose:e[5]||(e[5]=t=>S("close"))},{footer:l(()=>[o(T,{type:"primary",onClick:e[3]||(e[3]=t=>J(I.value))},{default:l(()=>[h(" \u63D0\u4EA4 ")]),_:1}),o(T,{type:"info",onClick:e[4]||(e[4]=t=>S("close"))},{default:l(()=>[h(" \u5173\u95ED ")]),_:1})]),default:l(()=>[o(H,{ref_key:"formRef",ref:I,model:a.value,rules:E,"label-width":"90px","label-suffix":":"},{default:l(()=>[re,o(L,{gutter:20},{default:l(()=>[o(r,{span:24},{default:l(()=>[o(i,{label:"\u89D2\u8272\u540D\u79F0",prop:"name"},{default:l(()=>{var t,p;return[o(d,{modelValue:a.value.name,"onUpdate:modelValue":e[0]||(e[0]=y=>a.value.name=y),placeholder:"\u8BF7\u8F93\u5165",disabled:Boolean(!((t=m.data)!=null&&t.isEdit)&&((p=m.data)==null?void 0:p.rulesId))},null,8,["modelValue","disabled"])]}),_:1})]),_:1}),o(r,{span:24},{default:l(()=>[o(i,{label:"\u53EF\u63A7\u89D2\u8272",prop:"manageRoleIds"},{default:l(()=>[o(v,{modelValue:a.value.manageRoleIds,"onUpdate:modelValue":e[1]||(e[1]=t=>a.value.manageRoleIds=t)},{default:l(()=>[(c(!0),g(k,null,R(B.value,t=>(c(),D(f,{key:t.id,label:t.id},{default:l(()=>[h(V(t.name),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),o(i,{label:"\u89D2\u8272\u63CF\u8FF0",prop:"describe"},{default:l(()=>[o(d,{modelValue:a.value.describe,"onUpdate:modelValue":e[2]||(e[2]=t=>a.value.describe=t),type:"textarea",maxlength:"200","show-word-limit":"",placeholder:"\u8BF7\u8F93\u5165"},null,8,["modelValue"])]),_:1}),ce,o(i,{"label-width":"0px"},{default:l(()=>[o(A,{ref_key:"menuTreeRef",ref:w,data:U.value,class:"w-full","show-checkbox":"","default-expand-all":"","node-key":"id",props:{class:F,label:"title",value:"id"}},null,8,["data","props"])]),_:1}),me,(c(!0),g(k,null,R(M.value,t=>(c(),g("div",{key:t.id},[x("div",pe,V(t.title),1),(c(!0),g(k,null,R(t.children,(p,y)=>(c(),D(i,{key:p.id,"label-width":"130px",label:p.title,prop:"menuData"},{default:l(()=>[o(G,{modelValue:a.value.menuData[y],"onUpdate:modelValue":_=>a.value.menuData[y]=_},{default:l(()=>[(c(!0),g(k,null,R(p.dataScopeOption.split(","),(_,W)=>(c(),D(z,{key:W,label:_*1,onChange:ve=>P(_*1,p.id)},{default:l(()=>[h(V(_*1===1?"\u672C\u5355\u4F4D":_*1===2?"\u672C\u5355\u4F4D\u53CA\u4E0B\u5C5E\u5355\u4F4D":_*1===3?"\u672C\u533A\u57DF":"\u5168\u5E02"),1)]),_:2},1032,["label","onChange"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label"]))),128))]))),128))]),_:1},8,["model"])]),_:1},8,["model-value","title"])}}}),we=X(fe,[["__scopeId","data-v-cd25f452"]]);export{we as default};