import{u as e,a,r as t,b as l,d,e as s,f as o,h as r,w as i,g as m,j as u,k as n,i as p,n as c,am as f,E as _,q as b}from"./index.286e9b79.js";import{v}from"./loading.c49775a6.js";import{E as j,a as h}from"./form.ad10dcd5.js";import{E as g,a as x}from"./tab-pane.1cc0f769.js";/* empty css                    *//* empty css              */import{E as w}from"./input.31de1b37.js";import"./form-item.9355e6dc.js";import{_ as V}from"./page-header.29890ed0.js";import{g as y,p as k}from"./http.f588794f.js";import{E,a as q}from"./index.569c0449.js";import"./_initCloneObject.fb8fbaea.js";import"./strings.8c60bfae.js";import"./event.776e7e11.js";import"./index.ed3ed02e.js";import"./divider.948c4b18.js";const C={class:"card goods-wrap"},D={class:"editor-card"},I={class:"editor-card-box"},U={class:"tool"},F={class:"tool-box"},N={__name:"editor",setup(N){const O=e(),R=a().query.id;let T=t(!1),z=t(!1),A=t(0),B=t();const G=(e,a)=>{A.value=e.paneName};let H=l({data:{scene_id:"",scene_type:"",scene_name:"",template_id:"",template_content:"",status:1,id:0}});const J=l({template_id:[{required:!0,message:"请输入模板ID",trigger:"blur"}]});T.value=!0,y("addons.sms/editor",{id:R}).then((e=>{T.value=!1,e.code&&(H.data=e.data)}));const K=async()=>{B.value&&await B.value.validate(((e,a)=>{z.value=!1,e?(z.value=!0,k("addons.sms/editor",{id:H.data.id,template_id:H.data.template_id,status:H.data.status}).then((e=>{z.value=!1,e.code?(B.value.resetFields(),O.replace("/addons/sms/index"),_.success("编辑成功")):_.error(e.msg)})).catch((e=>{_.error(e)}))):_.error("请完善内容")}))},L=()=>{O.go(-1)};return(e,a)=>{const t=V,l=j,_=w,y=E,k=q,N=g,O=x,R=h,M=b,P=v;return d(),s("div",C,[o(t,{title:"编辑模板"}),r("div",D,[i((d(),u(R,{model:m(H).data,rules:m(J),ref_key:"ruleFormRef",ref:B},{default:n((()=>[r("div",I,[o(O,{modelValue:m(A),"onUpdate:modelValue":a[3]||(a[3]=e=>p(A)?A.value=e:A=e),onTabClick:G},{default:n((()=>[o(N,{label:"基本信息",name:0},{default:n((()=>[o(l,{label:"场景名称","label-width":"100px"},{default:n((()=>[c(f(m(H).data.scene_name),1)])),_:1}),o(l,{label:"通知类型","label-width":"100px"},{default:n((()=>[c(f(1==m(H).data.scene_type?"验证码":"业务通知"),1)])),_:1}),o(l,{label:"场景ID","label-width":"100px"},{default:n((()=>[c(f(m(H).data.scene_id),1)])),_:1}),o(l,{label:"模板ID",prop:"template_id","label-width":"100px"},{default:n((()=>[o(_,{modelValue:m(H).data.template_id,"onUpdate:modelValue":a[0]||(a[0]=e=>m(H).data.template_id=e),"show-word-limit":"",maxlength:"50",placeholder:"请输入模板ID"},null,8,["modelValue"])])),_:1}),o(l,{label:"短信内容","label-width":"100px"},{default:n((()=>[o(_,{modelValue:m(H).data.template_content,"onUpdate:modelValue":a[1]||(a[1]=e=>m(H).data.template_content=e),rows:5,type:"textarea",readonly:!0,placeholder:"请输入短信内容"},null,8,["modelValue"])])),_:1}),o(l,{label:"状态",required:!0,"label-width":"100px"},{default:n((()=>[o(k,{modelValue:m(H).data.status,"onUpdate:modelValue":a[2]||(a[2]=e=>m(H).data.status=e)},{default:n((()=>[o(y,{label:1},{default:n((()=>[c("开启")])),_:1}),o(y,{label:0},{default:n((()=>[c("关闭")])),_:1})])),_:1},8,["modelValue"])])),_:1})])),_:1})])),_:1},8,["modelValue"])])])),_:1},8,["model","rules"])),[[P,m(T)]])]),r("div",U,[r("div",F,[o(M,{onClick:L},{default:n((()=>[c("取消")])),_:1}),o(M,{type:"primary",loading:m(z),onClick:K},{default:n((()=>[c("保存")])),_:1},8,["loading"])])])])}}};export{N as default};
