import{u as U}from"./useInstance.233fbdde.js";import{az as i,d as q,a6 as x,s as w,r as b,b as k,p as P,c as _,e as O,k as T,i as n,h as t,u as l,a2 as N,m as F,E as v}from"./index.0308b213.js";const h=d=>i.request({url:"addon/print.template/list",params:d}),j=d=>i.request({url:"addon/print.template/delete",method:"POST",data:d}),S=d=>i.request({url:"addon/print.template/detail",params:d}),R=d=>i.request({url:"addon/print.template/edit",method:"POST",data:d}),z=d=>i.request({url:"addon/print.template/add",method:"POST",data:d}),I=F("\u63D0\u4EA4"),L=F("\u53D6\u6D88"),G=q({props:{modelValue:{type:Boolean,default:!1},id:null},emits:["update:modelValue","onClose"],setup(d,{emit:f}){const s=d,{OpPlatform:V}=x(),{global:A}=U();let B=w(()=>Number(s.id)>0);const c=b(!1),g=b(),e=k({id:"",app_id:"",app_key:"",url:"",tmpname:"",tmpcode:"",content:"",voice_content:""}),D=()=>{V.value=="shangpu"&&(e.id>0?R(e).then(o=>{v({message:"\u7F16\u8F91\u6210\u529F",type:"success"}),r()}):z(e).then(o=>{v({message:"\u65B0\u589E\u6210\u529F",type:"success"}),r()}))};P(()=>s.modelValue,o=>{c.value=o,o&&s.id&&(e.id=s.id,E())}),k({list:[]});const E=()=>{V.value=="shangpu"&&S({id:s.id}).then(o=>{o=o.data,e.id=o.id,e.app_id=o.app_id,e.app_key=o.app_key,e.url=o.url,e.tmpname=o.tmpname,e.tmpcode=o.tmpcode,e.content=o.content,e.voice_content=o.voice_content})},r=()=>{f("update:modelValue",!1),f("onClose"),A.$resetForm(g.value,e)};return(o,u)=>{const m=_("el-input"),p=_("el-form-item"),y=_("el-button"),C=_("el-dialog");return O(),T(C,{modelValue:c.value,"onUpdate:modelValue":u[7]||(u[7]=a=>c.value=a),title:l(B)?"\u67E5\u770B":"\u65B0\u589E",width:"70%","destroy-on-close":"",onClose:r},{default:n(()=>[t(l(N),{ref_key:"formRef",ref:g,model:l(e),"inline-message":!0,"label-width":"160px"},{default:n(()=>[t(p,{label:"app_id",prop:"app_id"},{default:n(()=>[t(m,{modelValue:l(e).app_id,"onUpdate:modelValue":u[0]||(u[0]=a=>l(e).app_id=a)},null,8,["modelValue"])]),_:1}),t(p,{label:"app_key",prop:"app_key"},{default:n(()=>[t(m,{modelValue:l(e).app_key,"onUpdate:modelValue":u[1]||(u[1]=a=>l(e).app_key=a)},null,8,["modelValue"])]),_:1}),t(p,{label:"\u63A5\u53E3\u5730\u5740",prop:"url"},{default:n(()=>[t(m,{modelValue:l(e).url,"onUpdate:modelValue":u[2]||(u[2]=a=>l(e).url=a)},null,8,["modelValue"])]),_:1}),t(p,{label:"\u6A21\u677F\u540D\u79F0",prop:"tmpname"},{default:n(()=>[t(m,{modelValue:l(e).tmpname,"onUpdate:modelValue":u[3]||(u[3]=a=>l(e).tmpname=a)},null,8,["modelValue"])]),_:1}),t(p,{label:"\u6A21\u677F\u7F16\u53F7",prop:"tmpno"},{default:n(()=>[t(m,{modelValue:l(e).tmpcode,"onUpdate:modelValue":u[4]||(u[4]=a=>l(e).tmpcode=a)},null,8,["modelValue"])]),_:1}),t(p,{label:"\u6A21\u677F\u5185\u5BB9",prop:"content"},{default:n(()=>[t(m,{modelValue:l(e).content,"onUpdate:modelValue":u[5]||(u[5]=a=>l(e).content=a),type:"textarea",rows:10},null,8,["modelValue"])]),_:1}),t(p,{label:"\u8BED\u97F3\u64AD\u62A5\u5185\u5BB9",prop:"voice_content"},{default:n(()=>[t(m,{modelValue:l(e).voice_content,"onUpdate:modelValue":u[6]||(u[6]=a=>l(e).voice_content=a)},null,8,["modelValue"])]),_:1}),t(p,null,{default:n(()=>[t(y,{type:"primary",onClick:D},{default:n(()=>[I]),_:1}),t(y,{onClick:r},{default:n(()=>[L]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue","title"])}}});export{G as _,j as d,h as g};
