import{M as N,a9 as S,a5 as M,r as O,aK as $,F as q,W as E}from"./index.17037962789732.js";import"./index.170379627897337.js";import"./index.170379627897315.js";import"./index.170379627897318.js";import"./index.170379627897319.js";import"./index.1703796278973305.js";import"./index.170379627897317.js";import"./index.1703796278973301.js";import"./index.1703796278973302.js";import"./index.170379627897332.js";import"./index.1703796278973303.js";import"./index.170379627897339.js";import"./index.170379627897316.js";import"./index.170379627897314.js";import"./index.1703796278973304.js";import{_ as A}from"./index.vue_vue_type_script_setup_true_name_ValueItem_lang.1703796278973.js";import{n as T}from"./template.1703796278973.js";import{_ as J}from"./ToUser.vue_vue_type_script_setup_true_lang.1703796278973.js";import{_ as K}from"./ToOrg.vue_vue_type_script_setup_true_lang.1703796278973.js";import{_ as W}from"./ToTag.vue_vue_type_script_setup_true_lang.1703796278973.js";import{p as z}from"./validate.1703796278973.js";import{d as G,l as H,k as _,m as Q,o as l,c as p,a as r,b as g,u as i,x,F as U,h as X,t as Y,A as D,B as Z,M as ee}from"./vue.1703796278973.js";import{_ as te}from"./_plugin-vue_export-helper.1703796278973.js";import"./index.17037962789733.js";import"./dayjs.min.1703796278973.js";import"./isArray.1703796278973.js";import"./editor.api.1703796278973.js";import"./preload-helper.1703796278973.js";import"./monaco.contribution.1703796278973.js";import"./index.170379627897338.js";import"./index.170379627897329.js";import"./index.170379627897330.js";import"./index.170379627897325.js";import"./index.170379627897322.js";import"./index.170379627897323.js";import"./index.170379627897324.js";import"./style.1703796278973.js";import"./comm.1703796278973.js";import"./system.1703796278973.js";import"./index.170379627897333.js";import"./index.170379627897334.js";import"./default.1703796278973.js";import"./permission.1703796278973.js";import"./consts.1703796278973.js";import"./404.1703796278973.js";const ae={key:0},oe=G({__name:"index",props:{visible:{type:Boolean,default:!1},data:{type:Object,default:()=>({})}},emits:["update:visible"],setup(d,{emit:V}){const u=d,f=H({get:()=>u.visible,set:o=>V("update:visible",o)}),y=_([]),R=async()=>{const o={terms:[{column:"type",value:u.data.type},{column:"provider",value:u.data.provider}]},{result:t}=await T.getConfig(o);y.value=t,y.value.length&&(a.value.configId=u.data.configId)};Q(()=>f.value,o=>{o&&(R(),j())});const j=async()=>{const{result:o}=await T.getTemplateDetail(u.data.id);a.value.templateDetailTable=o.variableDefinitions.map(t=>{var n;return{...t,type:(n=t.expands)!=null&&n.businessType?t.expands.businessType:t.type,value:void 0,otherRules:t.id==="calledNumber"||t.id==="phoneNumber"?[{max:64,message:"最多可输入64个字符",trigger:"change"},{trigger:"change",validator(h,c){return c?z(c)?Promise.resolve():Promise.reject("请输入有效号码"):Promise.resolve()}}]:[]}})},C=[{title:"变量",dataIndex:"id",scopedSlots:{customRender:"id"}},{title:"名称",dataIndex:"name",scopedSlots:{customRender:"name"}},{title:"值",dataIndex:"type",width:160,scopedSlots:{customRender:"type"}}],a=_({configId:"",variableDefinitions:"",templateDetailTable:[]}),v=_(),b=_(!1),w=()=>{v.value.validate().then(async()=>{var t;const o={};(t=a.value.templateDetailTable)==null||t.forEach(n=>{o[n.id]=n.value}),b.value=!0,T.debug(o,a.value.configId,u.data.id).then(n=>{n.success&&(N.success("操作成功"),k())}).finally(()=>{b.value=!1})}).catch(o=>{console.log("err: ",o)})},k=()=>{f.value=!1,v.value.resetFields(),a.value.templateDetailTable=[]};return(o,t)=>{const n=S,h=M,c=O,I=A,L=$,P=q,B=E;return l(),p(B,{visible:i(f),"onUpdate:visible":t[1]||(t[1]=s=>ee(f)?f.value=s:null),title:"调试",cancelText:"取消",okText:"确定",onOk:w,onCancel:k,confirmLoading:i(b)},{default:r(()=>[g(P,{ref_key:"formRef",ref:v,layout:"vertical",model:i(a)},{default:r(()=>[g(c,{label:"通知配置",name:"configId",rules:{required:!0,message:"请选择通知配置"}},{default:r(()=>[g(h,{value:i(a).configId,"onUpdate:value":t[0]||(t[0]=s=>i(a).configId=s),placeholder:"请选择通知配置"},{default:r(()=>[(l(!0),x(U,null,X(i(y),(s,e)=>(l(),p(n,{key:e,value:s.id},{default:r(()=>[Y(D(s.name),1)]),_:2},1032,["value"]))),128))]),_:1},8,["value"])]),_:1}),i(a).templateDetailTable&&i(a).templateDetailTable.length?(l(),p(c,{key:0,label:"变量"},{default:r(()=>[g(L,{"row-key":"id",columns:C,"data-source":i(a).templateDetailTable,pagination:!1,bordered:""},{bodyCell:r(({column:s,record:e,index:F})=>[["id","name"].includes(s.dataIndex)?(l(),x("span",ae,D(e[s.dataIndex]),1)):(l(),p(c,{key:1,name:["templateDetailTable",F,"value"],rules:[{required:e.required,message:"该字段为必填字段"},...e.otherRules]},{default:r(()=>[d.data.type==="dingTalk"||d.data.type==="weixin"?(l(),x(U,{key:0},[e.type==="user"?(l(),p(J,{key:0,toUser:e.value,"onUpdate:toUser":m=>e.value=m,type:d.data.type,"config-id":i(a).configId},null,8,["toUser","onUpdate:toUser","type","config-id"])):e.type==="org"?(l(),p(K,{key:1,type:d.data.type,"config-id":i(a).configId,toParty:e.value,"onUpdate:toParty":m=>e.value=m},null,8,["type","config-id","toParty","onUpdate:toParty"])):e.type==="tag"?(l(),p(W,{key:2,type:d.data.type,"config-id":i(a).configId,toTag:e.value,"onUpdate:toTag":m=>e.value=m},null,8,["type","config-id","toTag","onUpdate:toTag"])):(l(),p(I,{key:3,modelValue:e.value,"onUpdate:modelValue":m=>e.value=m,itemType:e.type},null,8,["modelValue","onUpdate:modelValue","itemType"]))],64)):(l(),p(I,{key:1,modelValue:e.value,"onUpdate:modelValue":m=>e.value=m,itemType:e.type},null,8,["modelValue","onUpdate:modelValue","itemType"]))]),_:2},1032,["name","rules"]))]),_:1},8,["data-source"])]),_:1})):Z("",!0)]),_:1},8,["model"])]),_:1},8,["visible","confirmLoading"])}}});const He=te(oe,[["__scopeId","data-v-7609b5c6"]]);export{He as default};