Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

2 lignes
5.2KB

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