import{d as y,e as A,a as k}from"./degree.24566a4c.js";import{d as h,s as x,r as _,b as V,p as w,c as i,e as N,k as U,i as o,h as t,u,a2 as R,m as F,E}from"./index.0308b213.js";const M=F("\u63D0\u4EA4"),T=F("\u53D6\u6D88"),z=h({props:{modelValue:{type:Boolean,default:!1},id:null},emits:["update:modelValue","onClose"],setup(g,{emit:r}){const s=g;let C=x(()=>Number(s.id)>0);const m=_(!1),v=_(),e=V({id:"",title:"",value:""}),D=()=>{e.id>0?A(e).then(l=>{E({message:"\u7F16\u8F91\u6210\u529F",type:"success"}),n()}):k(e).then(l=>{E({message:"\u65B0\u589E\u6210\u529F",type:"success"}),n()})};w(()=>s.modelValue,l=>{m.value=l,l&&s.id&&(e.id=s.id,b())}),V({list:[]});const b=()=>{y({id:s.id}).then(l=>{console.log("res",l),e.id=l.data.id,e.title=l.data.title,e.value=l.data.value})},n=()=>{r("update:modelValue",!1),r("onClose")};return(l,a)=>{const f=i("el-input"),p=i("el-form-item"),c=i("el-button"),B=i("el-dialog");return N(),U(B,{modelValue:m.value,"onUpdate:modelValue":a[2]||(a[2]=d=>m.value=d),title:u(C)?"\u67E5\u770B":"\u65B0\u589E",width:"70%","destroy-on-close":"",onClose:n},{default:o(()=>[t(u(R),{ref_key:"formRef",ref:v,model:u(e),"inline-message":!0,"label-width":"160px"},{default:o(()=>[t(p,{label:"\u7B49\u7EA7\u540D\u79F0"},{default:o(()=>[t(f,{modelValue:u(e).title,"onUpdate:modelValue":a[0]||(a[0]=d=>u(e).title=d)},null,8,["modelValue"])]),_:1}),t(p,{label:"\u5E8F\u53F7\uFF08\u4ECE\u4F4E\u5230\u9AD8\u4F9D\u6B21\u4E3A12345\uFF09"},{default:o(()=>[t(f,{modelValue:u(e).value,"onUpdate:modelValue":a[1]||(a[1]=d=>u(e).value=d)},null,8,["modelValue"])]),_:1}),t(p,null,{default:o(()=>[t(c,{type:"primary",onClick:D},{default:o(()=>[M]),_:1}),t(c,{onClick:n},{default:o(()=>[T]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue","title"])}}});export{z as _};
