You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1 lines
3.4 KiB

import{b as T,c as h,u as q,e as M}from"./dataDictDetailApi-CT6MIz2g.js";import{g as R,i as j,r as a,k as O,o as g,h as z,w as t,a as f,d as o,e as V,l as A,c as G,E as D}from"./index-CL0IOL6c.js";const H={class:"app-container",style:{"min-height":"200px"}},J={class:"el-custom-dialog-footer"},Q={__name:"editDictDetailDialog",props:{dictId:{type:String,default:""}},emits:["onClose"],setup(b,{expose:y,emit:v}){const p=v,w=b,e=R({isShowDialog:!1,form:{},loading:!1,menuTreeData:[]}),r=j(),k={dictKey:[{required:!0,message:"请输入字典键!",trigger:"blur"}],dictValue:[{required:!0,message:"请输入字典值!",trigger:"blur"}]};function x(n){e.loading=!0,S(),n?T(n).then(l=>{e.form=l.data}).finally(()=>e.loading=!1):h().then(l=>{e.form.sort=l.data}).finally(()=>e.loading=!1),e.isShowDialog=!0}function S(){var n;e.form={id:null,dictTypeId:w.dictId,dictKey:"",dictValue:"",sort:0,status:1,remark:""},(n=r.value)==null||n.resetFields()}function C(){r.value.validate(n=>{if(n){e.loading=!0;let l=Object.assign({},e.form);e.form.id?q(l).then(()=>{p("onClose"),D({message:"更新成功",type:"success"}),e.isShowDialog=!1}).finally(()=>e.loading=!1):M(l).then(()=>{p("onClose"),D({message:"新增成功",type:"success"}),e.isShowDialog=!1}).finally(()=>e.loading=!1)}})}return y({openDialog:x}),(n,l)=>{const U=a("Edit"),E=a("el-icon"),u=a("el-input"),i=a("el-form-item"),d=a("el-col"),m=a("el-row"),K=a("el-input-number"),c=a("el-radio"),B=a("el-radio-group"),F=a("el-form"),_=a("el-button"),I=a("el-dialog"),N=O("loading");return g(),z(I,{modelValue:e.isShowDialog,"onUpdate:modelValue":l[6]||(l[6]=s=>e.isShowDialog=s),draggable:"","close-on-click-modal":!1,width:"700px"},{header:t(()=>[f("div",null,[o(E,{class:"el-custom-dialog-icon"},{default:t(()=>[o(U)]),_:1}),l[7]||(l[7]=f("span",null,"字典信息",-1))])]),footer:t(()=>[f("div",J,[o(_,{type:"primary",onClick:C,disabled:e.loading},{default:t(()=>l[8]||(l[8]=[V("确定")])),_:1},8,["disabled"]),o(_,{onClick:l[5]||(l[5]=()=>e.isShowDialog=!1),disabled:e.loading},{default:t(()=>l[9]||(l[9]=[V("取消")])),_:1},8,["disabled"])])]),default:t(()=>[A((g(),G("div",H,[o(F,{ref_key:"elFormRef",ref:r,model:e.form,rules:k,"label-width":"90px"},{default:t(()=>[o(m,null,{default:t(()=>[o(d,{span:12},{default:t(()=>[o(i,{label:"字典键",prop:"dictKey"},{default:t(()=>[o(u,{modelValue:e.form.dictKey,"onUpdate:modelValue":l[0]||(l[0]=s=>e.form.dictKey=s)},null,8,["modelValue"])]),_:1})]),_:1}),o(d,{span:12},{default:t(()=>[o(i,{label:"字典值",prop:"dictValue"},{default:t(()=>[o(u,{modelValue:e.form.dictValue,"onUpdate:modelValue":l[1]||(l[1]=s=>e.form.dictValue=s)},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),o(m,null,{default:t(()=>[o(d,{span:12},{default:t(()=>[o(i,{label:"排序"},{default:t(()=>[o(K,{modelValue:e.form.sort,"onUpdate:modelValue":l[2]||(l[2]=s=>e.form.sort=s)},null,8,["modelValue"])]),_:1})]),_:1}),o(d,{span:12},{default:t(()=>[o(i,{label:"状态"},{default:t(()=>[o(B,{modelValue:e.form.status,"onUpdate:modelValue":l[3]||(l[3]=s=>e.form.status=s)},{default:t(()=>[o(c,{label:"启用",value:1}),o(c,{label:"禁用",value:0})]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),o(m,null,{default:t(()=>[o(d,{span:24},{default:t(()=>[o(i,{label:"备注"},{default:t(()=>[o(u,{modelValue:e.form.remark,"onUpdate:modelValue":l[4]||(l[4]=s=>e.form.remark=s),type:"textarea"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])])),[[N,e.loading]])]),_:1},8,["modelValue"])}}};export{Q as default};