import{d as C,h as i,Y as E,r as s,o as K,f as S,w as o,b as a,a7 as c,a8 as _,a2 as k,l as F,E as w}from"./index.e3896b23.js";import{u as B,b as U}from"./app.22c193c2.js";const R=F("\u53D6\u6D88"),$=F("\u786E\u5B9A"),j=C({__name:"add-or-update",emits:["refreshDataList"],setup(q,{expose:V,emit:b}){const p=i(!1),n=i(),l=E({appKey:"",appSecret:"",name:"",note:"",expireDesc:""}),v=i({name:[{required:!0,message:"\u5FC5\u586B\u9879\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],expireDesc:[{required:!0,message:"\u5FC5\u586B\u9879\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}]}),D=u=>{p.value=!0,l.id="",n.value&&n.value.resetFields(),u&&y(u)},y=u=>{B(u).then(e=>{Object.assign(l,e.data)})},m=()=>{n.value.validate(u=>{if(!u)return!1;U(l).then(()=>{w.success({message:"\u64CD\u4F5C\u6210\u529F",duration:500,onClose:()=>{p.value=!1,b("refreshDataList")}})})})};return V({init:D}),(u,e)=>{const d=s("el-input"),r=s("el-form-item"),g=s("fast-select"),x=s("el-form"),f=s("el-button"),A=s("el-dialog");return K(),S(A,{modelValue:p.value,"onUpdate:modelValue":e[8]||(e[8]=t=>p.value=t),title:l.id?"\u4FEE\u6539":"\u65B0\u589E","close-on-click-modal":!1},{footer:o(()=>[a(f,{onClick:e[6]||(e[6]=t=>p.value=!1)},{default:o(()=>[R]),_:1}),a(f,{type:"primary",onClick:e[7]||(e[7]=t=>m())},{default:o(()=>[$]),_:1})]),default:o(()=>[a(x,{ref_key:"dataFormRef",ref:n,model:l,rules:v.value,"label-width":"100px",onKeyup:e[5]||(e[5]=k(t=>m(),["enter"]))},{default:o(()=>[c(a(r,{label:"appKey",prop:"appKey"},{default:o(()=>[a(d,{disabled:"",modelValue:l.appKey,"onUpdate:modelValue":e[0]||(e[0]=t=>l.appKey=t),placeholder:"appKey"},null,8,["modelValue"])]),_:1},512),[[_,!!l.id]]),c(a(r,{label:"appSecret",prop:"appSecret"},{default:o(()=>[a(d,{disabled:"",modelValue:l.appSecret,"onUpdate:modelValue":e[1]||(e[1]=t=>l.appSecret=t),placeholder:"appSecret"},null,8,["modelValue"])]),_:1},512),[[_,!!l.id]]),a(r,{label:"\u540D\u79F0",prop:"name"},{default:o(()=>[a(d,{modelValue:l.name,"onUpdate:modelValue":e[2]||(e[2]=t=>l.name=t),placeholder:"\u540D\u79F0"},null,8,["modelValue"])]),_:1}),a(r,{label:"\u63CF\u8FF0",prop:"note"},{default:o(()=>[a(d,{type:"textarea",rows:"2",modelValue:l.note,"onUpdate:modelValue":e[3]||(e[3]=t=>l.note=t),placeholder:"\u63CF\u8FF0"},null,8,["modelValue"])]),_:1}),a(r,{label:"token\u6709\u6548\u671F",prop:"expireDesc"},{default:o(()=>[a(g,{modelValue:l.expireDesc,"onUpdate:modelValue":e[4]||(e[4]=t=>l.expireDesc=t),placeholder:"\u6709\u6548\u671F","dict-type":"api_expire_desc",clearable:""},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["modelValue","title"])}}});export{j as _};
