import{cF as C,r as w,I as A,aG as P,F as D,W as F}from"./index.17037962789732.js";import"./index.170379627897337.js";import"./index.170379627897315.js";import"./index.170379627897318.js";import"./index.170379627897319.js";import"./index.170379627897314.js";import"./index.1703796278973320.js";import"./index.170379627897316.js";import"./index.170379627897317.js";import"./default.1703796278973.js";import"./index.1703796278973299.js";import L from"./PermissChoose.1703796278973.js";import{M as N}from"./system.1703796278973.js";import{d as U,k as _,v as q,o as v,c as b,a as r,b as i,u as o,t as M,A as g,z as O,a5 as R}from"./vue.1703796278973.js";import{aN as V}from"./index.17037962789733.js";import{_ as J}from"./_plugin-vue_export-helper.1703796278973.js";import"./dayjs.min.1703796278973.js";import"./isArray.1703796278973.js";import"./editor.api.1703796278973.js";import"./preload-helper.1703796278973.js";import"./monaco.contribution.1703796278973.js";import"./index.1703796278973302.js";import"./index.170379627897327.js";import"./permission.17037962789732.js";import"./comm.1703796278973.js";import"./index.170379627897332.js";import"./index.170379627897333.js";import"./index.170379627897334.js";import"./permission.1703796278973.js";import"./consts.1703796278973.js";import"./404.1703796278973.js";const $={class:"message"},z=U({__name:"ButtonAddDialog",props:{menuInfo:null,visible:{type:Boolean},mode:null,data:null},emits:["confirm","update:visible"],setup(x,{emit:p}){const s=x,d=_(!1),h=()=>{u.value&&u.value.validate().then(()=>{var n;const l=R((n=s.menuInfo)==null?void 0:n.buttons)||[],e=l==null?void 0:l.find(m=>m.id===a.data.id);e?Object.entries(a.data).forEach(([m,f])=>{e[m]=f}):l.push({...a.data});const c={...s.menuInfo,buttons:l};d.value=!0,N(c).then(m=>{V.success("操作成功"),p("confirm"),p("update:visible",!1)}).finally(()=>d.value=!1).catch(()=>{d.value=!1})})},k={name:"",id:"",permissions:[],describe:""},u=_(),a=q({data:{...k,...s.data},checkPermission:(l,e)=>!e||e.length<1?Promise.reject("请选择权限"):Promise.resolve()}),j=[{label:"add",value:"add",message:"新增"},{label:"delete",value:"delete",message:"删除"},{label:"update",value:"update",message:"更新"}];return(l,e)=>{const c=C,n=w,m=A,f=P,y=D,B=F;return v(),b(B,{visible:"",title:s.mode,width:"660px",onOk:h,onCancel:e[4]||(e[4]=t=>p("update:visible",!1)),maskClosable:!1,confirmLoading:o(d)},{default:r(()=>[i(y,{model:o(a).data,class:"basic-form",ref_key:"formRef",ref:u},{default:r(()=>[i(n,{label:"编码",name:"id",rules:[{required:!0,message:"请输入编码"},{max:64,message:"最多可输入64个字符"}]},{default:r(()=>[i(c,{value:o(a).data.id,"onUpdate:value":e[0]||(e[0]=t=>o(a).data.id=t),options:j,placeholder:"请输入编码",disabled:s.mode!=="新增"},{option:r(({value:t,message:I})=>[M(g(t)+" ",1),O("span",$,g(I),1)]),_:1},8,["value","disabled"])]),_:1}),i(n,{label:"名称",name:"name",rules:[{required:!0,message:"请输入名称"},{max:64,message:"最多可输入64个字符"}]},{default:r(()=>[i(m,{value:o(a).data.name,"onUpdate:value":e[1]||(e[1]=t=>o(a).data.name=t),disabled:s.mode==="查看",placeholder:"请输入名称"},null,8,["value","disabled"])]),_:1}),i(n,{label:"权限",name:"permissions",rules:[{required:!0,message:"请选择权限",validator:o(a).checkPermission}]},{default:r(()=>[(v(),b(L,{"first-width":8,"max-height":"350px",value:o(a).data.permissions,"onUpdate:value":e[2]||(e[2]=t=>o(a).data.permissions=t),disabled:s.mode==="查看",key:o(a).data.id||""},null,8,["value","disabled"]))]),_:1},8,["rules"]),i(n,{label:"说明",name:"describe"},{default:r(()=>[i(f,{value:o(a).data.describe,"onUpdate:value":e[3]||(e[3]=t=>o(a).data.describe=t),rows:4,placeholder:"请输入说明",disabled:s.mode==="查看"},null,8,["value","disabled"])]),_:1})]),_:1},8,["model"])]),_:1},8,["title","confirmLoading"])}}});const he=J(z,[["__scopeId","data-v-8b6eacf5"]]);export{he as default};
