modal.82c577.js 2.2 KB

1
  1. import{_ as I,d as M,ag as U,bs as _,w as E,x as j,r as l,o as d,G as y,C as o,j as s,l as a,c as G,F as N,D as R,M as v,h as S,aq as z}from"./index.js";import{e as O}from"./index.da6d65fd.js";const P={class:"flex w-full justify-end"},L=M({__name:"modal",props:{data:{type:null,required:!0,default:{price:"",type:""}},visible:{type:Boolean,required:!0},disabled:{type:Boolean,required:!0}},emits:["submit"],setup(p,{emit:C}){const i=p,b={price:"",type:""},B=U(()=>t.value.id?i.disabled?"\u67E5\u770B\u89C4\u683C":"\u7F16\u8F91\u89C4\u683C":"\u6DFB\u52A0\u89C4\u683C"),n=_(i,"visible"),c=E(null),t=_(i,"data"),m=E([]),D={price:[{required:!0,trigger:"change",message:"\u91D1\u5C5E\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A"}],type:[{required:!0,trigger:"change",message:"\u6700\u65B0\u4EF7\u683C\u4E0D\u80FD\u4E3A\u7A7A"}]};async function F(){const r=await O({size:100});m.value=r.code===0?r.data:[]}function V(){t.value={...b},n.value=!1}async function g(){try{await c.value.validate(),C("submit")}catch{}}return j(F),(r,u)=>{const w=l("ElOption"),x=l("ElSelect"),f=l("ElFormItem"),A=l("ElInput"),k=l("ElButton"),q=l("ElForm"),h=l("ElDialog");return d(),y(h,{modelValue:a(n),"onUpdate:modelValue":u[2]||(u[2]=e=>z(n)?n.value=e:null),title:a(B),center:"",onClose:V},{default:o(()=>[s(q,{model:a(t),rules:D,size:"small",ref_key:"formRef",ref:c,disabled:p.disabled,"label-width":"100px"},{default:o(()=>[s(f,{label:"\u91D1\u5C5E\u7C7B\u578B",prop:"type"},{default:o(()=>[s(x,{modelValue:a(t).type,"onUpdate:modelValue":u[0]||(u[0]=e=>a(t).type=e),style:{width:"100%"}},{default:o(()=>[(d(!0),G(N,null,R(m.value,e=>(d(),y(w,{key:e.type,value:e.type,label:e.type_cn},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1}),s(f,{label:"\u6700\u65B0\u4EF7\u683C",prop:"price"},{default:o(()=>[s(A,{modelValue:a(t).price,"onUpdate:modelValue":u[1]||(u[1]=e=>a(t).price=e)},{append:o(()=>[v(" \u5143 ")]),_:1},8,["modelValue"])]),_:1}),S("div",P,[s(k,{type:"primary",onClick:g},{default:o(()=>[v("\u4FDD\u5B58")]),_:1})])]),_:1},8,["model","disabled"])]),_:1},8,["modelValue","title"])}}});var J=I(L,[["__file","C:/Users/Administrator/Desktop/projects/purchase-vue3/src/views/serviceParam/goldPrice/components/modal.vue"]]);export{J as default};