import{u as v}from"./useInstance.233fbdde.js";import{g as x,e as U,a as w}from"./index.c52b1b09.js";import{d as T,s as N,r as E,b as S,p as R,c as n,e as I,k as M,i as l,h as o,u,a2 as $,m as i,E as b}from"./index.0308b213.js";const j=i("\u5F00"),q=i("\u5173"),z=i("\u63D0\u4EA4"),G=i("\u53D6\u6D88"),L=T({props:{modelValue:{type:Boolean,default:!1},id:null},emits:["update:modelValue","onClose"],setup(B,{emit:p}){const d=B,{global:F}=v();let h=N(()=>Number(d.id)>0);const _=E(!1),c=E(),e=S({id:"",name:"",theme_color:"",font_color:"",status:0}),C=()=>{e.id>0?U(e).then(t=>{b({message:"\u7F16\u8F91\u6210\u529F",type:"success"}),r()}):w(e).then(t=>{b({message:"\u65B0\u589E\u6210\u529F",type:"success"}),r()})};R(()=>d.modelValue,t=>{_.value=t,t&&d.id&&(e.id=d.id,y())});const y=()=>{x(d.id).then(t=>{console.log(t,"res"),e.name=t.name||"",e.theme_color=t.theme_color||"",e.font_color=t.font_color||"",e.status=t.status||0})},r=()=>{p("update:modelValue",!1),p("onClose"),F.$resetForm(c.value,e)};return(t,a)=>{const A=n("el-input"),m=n("el-form-item"),f=n("el-color-picker"),V=n("el-radio"),D=n("el-radio-group"),g=n("el-button"),k=n("el-dialog");return I(),M(k,{modelValue:_.value,"onUpdate:modelValue":a[4]||(a[4]=s=>_.value=s),title:u(h)?"\u7F16\u8F91\u4E3B\u9898":"\u6DFB\u52A0\u4E3B\u9898",width:"70%","destroy-on-close":"",onClose:r},{default:l(()=>[o(u($),{ref_key:"formRef",ref:c,model:u(e),"inline-message":!0,"label-width":"160px"},{default:l(()=>[o(m,{label:"\u4E3B\u9898\u540D\u79F0"},{default:l(()=>[o(A,{modelValue:u(e).name,"onUpdate:modelValue":a[0]||(a[0]=s=>u(e).name=s)},null,8,["modelValue"])]),_:1}),o(m,{label:"\u81EA\u5B9A\u4E49\u4E3B\u9898\u989C\u8272"},{default:l(()=>[o(f,{modelValue:u(e).theme_color,"onUpdate:modelValue":a[1]||(a[1]=s=>u(e).theme_color=s)},null,8,["modelValue"])]),_:1}),o(m,{label:"\u81EA\u5B9A\u4E49\u5B57\u4F53\u989C\u8272"},{default:l(()=>[o(f,{modelValue:u(e).font_color,"onUpdate:modelValue":a[2]||(a[2]=s=>u(e).font_color=s)},null,8,["modelValue"])]),_:1}),o(m,{label:"\u72B6\u6001"},{default:l(()=>[o(D,{modelValue:u(e).status,"onUpdate:modelValue":a[3]||(a[3]=s=>u(e).status=s)},{default:l(()=>[o(V,{label:1},{default:l(()=>[j]),_:1}),o(V,{label:0},{default:l(()=>[q]),_:1})]),_:1},8,["modelValue"])]),_:1}),o(m,null,{default:l(()=>[o(g,{type:"primary",onClick:C},{default:l(()=>[z]),_:1}),o(g,{onClick:r},{default:l(()=>[G]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue","title"])}}});export{L as _};
