import{_ as N}from"./index-BdFxm7qE.js";import{_ as S,c as V,a as z,b as K,d as P}from"./edit.vue_vue_type_script_setup_true_name_MessageConfigEdit_lang-Ky1pvEeD.js";import{J as j,F as A,k as G,K as I,L as J,M as O,a as _,p as h}from"./element-plus-DckSU5ni.js";import{x as C,s as U,r as w,l as q,y as H,G as c,O as y,u as i,E as s,F as n,C as Q,K as r,an as W,j as X,I as v,L as Y,z as a}from"./vue-vendor-vBC20LeU.js";import"./index-D7dBOFlH.js";import"./axios-CG2WSiiR.js";const Z={class:"message-config"},ee={class:"wd-card-header"},te=C({name:"MessageConfig"}),re=C({...te,setup(ae){const u=U(),f=w(!1),k=w([]),l=w({gateway:{label:"网关标识",visible:!0},gateway_name:{label:"网关名称",visible:!0},status:{label:"状态",visible:!0},operation:{label:"操作",visible:!0}}),m=async()=>{f.value=!0,V().then(t=>{k.value=t||[],f.value=!1}).catch(()=>{f.value=!1})},x=async()=>{u.value?.open("add"),u.value?.setFormData()},B=async t=>{u.value?.open("edit"),u.value?.setFormData(t.gateway)},T=t=>{if(t.status===1){_.info("当前网关已启用");return}h.confirm(`确认启用网关 ${t.gateway_name} 吗？`,"提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(async()=>{z({gateway:t.gateway}).then(()=>{_.success("切换成功"),m()})}).catch(()=>{})},E=t=>{h.prompt("请输入测试手机号","测试发送",{confirmButtonText:"发送",cancelButtonText:"取消",inputPattern:/^1[3-9]\d{9}$/,inputErrorMessage:"手机号格式不正确"}).then(async({value:e})=>{K({gateway:t.gateway,test_mobile:e}).then(()=>{_.success("发送成功")})}).catch(()=>{})},D=t=>{h.confirm(`确认删除网关 ${t.gateway_name} 吗？`,"提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(async()=>{P({gateway:t.gateway}).then(()=>{_.success("删除成功"),m()})}).catch(()=>{})};return q(()=>{m()}),(t,e)=>{const d=G,$=N,p=I,L=J,M=O,R=A,g=W("perms"),F=j;return a(),H("div",Z,[c((a(),s(R,{class:"!border-none",shadow:"never"},{default:n(()=>[Q("div",ee,[c((a(),s(d,{type:"primary",icon:"Plus",onClick:x},{default:n(()=>[...e[1]||(e[1]=[r(" 新增配置 ",-1)])]),_:1})),[[g,["message.smsConfig/save"]]]),y($,{search:!1,columns:i(l),"onUpdate:columns":e[0]||(e[0]=o=>X(l)?l.value=o:null),onRefresh:m},null,8,["columns"])]),y(M,{size:"large",data:i(k)},{default:n(()=>[i(l).gateway.visible?(a(),s(p,{key:0,prop:"gateway",label:"网关标识","min-width":"120",align:"center"})):v("",!0),i(l).gateway_name.visible?(a(),s(p,{key:1,prop:"gateway_name",label:"网关名称","min-width":"150",align:"center"})):v("",!0),i(l).status.visible?(a(),s(p,{key:2,prop:"status",label:"状态","min-width":"90",align:"center"},{default:n(({row:o})=>[y(L,{type:o.status===1?"success":"info"},{default:n(()=>[r(Y(o.status===1?"启用":"禁用"),1)]),_:2},1032,["type"])]),_:1})):v("",!0),i(l).operation.visible?(a(),s(p,{key:3,label:"操作",width:"220",align:"center",fixed:"right"},{default:n(({row:o})=>[c((a(),s(d,{type:"primary",link:"",onClick:b=>B(o)},{default:n(()=>[...e[2]||(e[2]=[r(" 编辑 ",-1)])]),_:1},8,["onClick"])),[[g,["message.smsConfig/save"]]]),c((a(),s(d,{type:"warning",link:"",onClick:b=>T(o)},{default:n(()=>[...e[3]||(e[3]=[r(" 启用 ",-1)])]),_:1},8,["onClick"])),[[g,["message.smsConfig/switch"]]]),c((a(),s(d,{type:"success",link:"",onClick:b=>E(o)},{default:n(()=>[...e[4]||(e[4]=[r(" 测试 ",-1)])]),_:1},8,["onClick"])),[[g,["message.smsConfig/test"]]]),c((a(),s(d,{type:"danger",link:"",onClick:b=>D(o)},{default:n(()=>[...e[5]||(e[5]=[r(" 删除 ",-1)])]),_:1},8,["onClick"])),[[g,["message.smsConfig/delete"]]])]),_:1})):v("",!0)]),_:1},8,["data"])]),_:1})),[[F,i(f)]]),y(S,{ref_key:"editRef",ref:u,onSuccess:m},null,512)])}}});export{re as default};
