import{r as c}from"./index-8db2df2c.js";import{l as H}from"./sms-0c643c2b.js";import{t as J}from"./table-85dc8ff4.js";import{B as k,M as m,S as Q,L as W,j as X,R as Y,F as Z,d as ee,I as te,g as ae,e as le,f as oe,b as se}from"./ui-ba7aaa7e.js";import{e as ne,l as I,r,P as ie,a3 as de,a4 as l,f as t,I as p,H as C}from"./vue-bf422dc1.js";import"./libs-51817cd7.js";import"./plugins-ca970193.js";import"./others-9f318174.js";import"./echarts-bf9d612c.js";import"./icons-a8498fb6.js";import"./global-0d825ba6.js";function me(i){return c.post({url:"/adminapi/system/notification/list",params:i})}function ue(i){return c.post({url:"/adminapi/system/notification/add",params:i})}function re(i){return c.post({url:"/adminapi/system/notification/edit",params:i})}function pe(i){return c.post({url:"/adminapi/system/notification/del",params:i})}function ce(i){return c.post({url:"/adminapi/system/notification/setSmsConfig",params:i})}const fe={name:"SystemNotificationIndex"},De=ne({...fe,setup(i){const S=[{title:"ID",colKey:"id",width:50},{title:"通知名称",colKey:"name"},{title:"通知标识",colKey:"mark"},{title:"短信通知",colKey:"is_sms",width:180,cell:(o,{row:e})=>{const V=o(k,{size:"small",theme:e.is_sms===1?"success":"danger"},()=>e.is_sms===1?"开启":"禁用"),b=o(k,{theme:"primary",size:"small",style:"margin-left: 10px",onClick:()=>{L(e)}},()=>"编辑配置");return[V,b]}},{title:"操作",colKey:"operate",width:100}],{pagination:O,fetchData:f,dataLoading:$,headerAffixedTop:T,rehandlePageChange:j,lists:K}=J({fetchFun:me});f();const s=I({}),_=r(!1),L=async o=>{Object.keys(s).forEach(e=>{delete s[e]}),P(),s.id=o.id,s.status=o.is_sms,_.value=!0,Object.assign(s,{...o.sms_config})},x=r([]),P=async()=>{x.value=(await H({})).data.list??[]},B=async()=>{const o=await ce({data:s});o.code===1?(m.success("操作成功"),_.value=!1,f()):m.error(`${o.msg}`)},v=r("add"),y=r("新增配置"),n=I({}),u=r(!1),F=o=>{v.value="edit",y.value="编辑配置",u.value=!0,Object.assign(n,{...o})},z=()=>{v.value="add",y.value="新增配置",u.value=!0,Object.keys(n).forEach(o=>{delete n[o]})},E=async o=>{const e=await pe({id:o.id});e.code===1?(m.success("操作成功"),f()):m.error(`${e.msg}`)},N=async()=>{const o=v.value==="add"?await ue({data:n}):await re({data:n});o.code===1?(m.success("操作成功"),u.value=!1,f()):m.error(`${o.msg}`)};return(o,e)=>{const V=k,b=Q,w=W,A=X,h=Y,d=Z,M=ee,g=te,R=ae,D=le,U=oe,q=se;return ie(),de(q,{title:"通知场景",class:"basic-container",bordered:!1},{default:l(()=>[t(A,{size:"small",data:p(K),columns:S,"row-key":"id","vertical-align":"middle",loading:p($),pagination:p(O),"header-affixed-top":p(T),"table-layout":"fixed","max-height":"100%",onPageChange:p(j)},{topContent:l(()=>[t(b,{style:{margin:"15px 0"}},{default:l(()=>[t(V,{theme:"primary",onClick:e[0]||(e[0]=a=>z())},{default:l(()=>[C("新增")]),_:1})]),_:1})]),operate:l(({row:a})=>[t(b,null,{default:l(()=>[t(w,{theme:"primary",onClick:G=>F(a)},{default:l(()=>[C("编辑")]),_:2},1032,["onClick"]),t(w,{theme:"danger",onClick:G=>E(a)},{default:l(()=>[C("删除")]),_:2},1032,["onClick"])]),_:2},1024)]),_:1},8,["data","loading","pagination","header-affixed-top","onPageChange"]),t(U,{visible:_.value,"onUpdate:visible":e[5]||(e[5]=a=>_.value=a),header:"短信配置","on-confirm":B},{default:l(()=>[t(D,null,{default:l(()=>[t(d,{label:"状态"},{default:l(()=>[t(h,{modelValue:s.status,"onUpdate:modelValue":e[1]||(e[1]=a=>s.status=a),options:[{label:"开启",value:1},{label:"关闭",value:0}]},null,8,["modelValue"])]),_:1}),t(d,{label:"短信平台"},{default:l(()=>[t(M,{modelValue:s.sms_gateway,"onUpdate:modelValue":e[2]||(e[2]=a=>s.sms_gateway=a),clearable:"",placeholder:"请选择短信模板",options:x.value},null,8,["modelValue","options"])]),_:1}),t(d,{label:"模板ID"},{default:l(()=>[t(g,{modelValue:s.sms_template_id,"onUpdate:modelValue":e[3]||(e[3]=a=>s.sms_template_id=a),clearable:"",placeholder:"请输入短信模板ID"},null,8,["modelValue"])]),_:1}),t(d,{label:"短信内容",help:"复制短信内容到对应平台"},{default:l(()=>[t(R,{modelValue:s.sms_template_content,"onUpdate:modelValue":e[4]||(e[4]=a=>s.sms_template_content=a),clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1},8,["visible"]),t(U,{visible:u.value,"onUpdate:visible":e[10]||(e[10]=a=>u.value=a),header:y.value,"on-confirm":N},{default:l(()=>[t(D,null,{default:l(()=>[t(d,{label:"短信通知"},{default:l(()=>[t(h,{modelValue:n.is_sms,"onUpdate:modelValue":e[6]||(e[6]=a=>n.is_sms=a),options:[{label:"开启",value:1},{label:"关闭",value:0}]},null,8,["modelValue"])]),_:1}),t(d,{label:"通知名称"},{default:l(()=>[t(g,{modelValue:n.name,"onUpdate:modelValue":e[7]||(e[7]=a=>n.name=a),clearable:"",placeholder:"请输入通知场景名称"},null,8,["modelValue"])]),_:1}),t(d,{label:"通知说明"},{default:l(()=>[t(g,{modelValue:n.title,"onUpdate:modelValue":e[8]||(e[8]=a=>n.title=a),clearable:"",placeholder:"请输入通知场景说明"},null,8,["modelValue"])]),_:1}),t(d,{label:"通知标识"},{default:l(()=>[t(g,{modelValue:n.mark,"onUpdate:modelValue":e[9]||(e[9]=a=>n.mark=a),clearable:"",placeholder:"请输入通知标识"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1},8,["visible","header"])]),_:1})}}});export{De as default};
