var O=Object.defineProperty,R=Object.defineProperties;var B=Object.getOwnPropertyDescriptors;var L=Object.getOwnPropertySymbols;var z=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable;var U=(n,o,i)=>o in n?O(n,o,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[o]=i,h=(n,o)=>{for(var i in o||(o={}))z.call(o,i)&&U(n,i,o[i]);if(L)for(var i of L(o))V.call(o,i)&&U(n,i,o[i]);return n},D=(n,o)=>R(n,B(o));var c=(n,o,i)=>new Promise((t,s)=>{var l=u=>{try{d(i.next(u))}catch(r){s(r)}},p=u=>{try{d(i.throw(u))}catch(r){s(r)}},d=u=>u.done?t(u.value):Promise.resolve(u.value).then(l,p);d((i=i.apply(n,o)).next())});import{d as x,u as P,r as M,a as C,B as I,i as e,q as G,ac as E,ce as y,_ as b,a9 as k,p as v,k as F,ai as W,l as g,cg as H,aa as $,ch as A,H as X,bC as J,e as Q,U as K,d7 as Y,d8 as Z,bn as ee}from"./index.dbedee1d.js";import{g as ae,s as te}from"./use-async.c10a7996.js";import{c as N,H as S,I as j,B as le}from"./constant.3b7ec83f.js";import{s as ne}from"./api.edac2afc.js";import{S as se}from"./index.77470f2a.js";import{P as oe}from"./index.6c1f867a.js";import{T as q}from"./index.3eb2ac77.js";import{g as w,a as T}from"./objectUtil.ec24ceed.js";import{s as ie,a as re,b as de,c as ue}from"./api.3ce8a132.js";import{N as f}from"./FormItemGridItem.8ac0ca8b.js";import"./searchs.b637f0d6.js";const pe=x({name:"message-template-edit",props:{editMode:{type:String,required:!0},rowData:{type:Object,required:!1}},emits:["close","getList"],setup(n,{slots:o,attrs:i,emit:t}){P();const s=M(!1),l=C({clientId:null,content:null,contentExample:null,description:null,group:null,params:null,triggerCondition:null}),p=M(),d=C({rowData:null,musicSheetCategories:[]});I(()=>c(this,null,function*(){d.rowData=n.rowData,n.editMode=="edit"&&n.rowData&&(l.clientId=d.rowData.clientId,l.content=d.rowData.content,l.contentExample=d.rowData.contentExample,l.description=d.rowData.description,l.group=d.rowData.group,l.params=d.rowData.params,l.triggerCondition=d.rowData.triggerCondition)}));const u=()=>c(this,null,function*(){p.value.validate(r=>c(this,null,function*(){if(r)return!1;s.value=!0;try{let m;n.editMode=="add"?m=yield ie(h({},l)):m=yield re(D(h({},l),{id:d.rowData.id})),m&&m.code===200&&(t("close"),t("getList"))}catch(m){}s.value=!1}))});return()=>e("div",{style:"background: #fff; padding-top: 12px"},[e(G,{ref:p,labelPlacement:"top",model:l,"label-placement":"left","label-width":"100"},{default:()=>[e(E,{cols:2},{default:()=>[e(f,{label:"\u5BA2\u6237\u7AEF",path:"clientId",rule:[{required:!1,message:"\u8BF7\u9009\u62E9\u5BA2\u6237\u7AEF"}]},{default:()=>[e(y,{placeholder:"\u8BF7\u9009\u62E9\u5BA2\u6237\u7AEF",value:l.clientId,"onUpdate:value":r=>l.clientId=r,options:w(N),filterable:!0},null)]}),e(f,{label:"\u529F\u80FD\u6A21\u5757",path:"group",rule:[{required:!0,message:"\u8BF7\u9009\u62E9\u529F\u80FD\u6A21\u5757"}]},{default:()=>[e(y,{placeholder:"\u8BF7\u9009\u62E9\u529F\u80FD\u6A21\u5757",value:l.group,"onUpdate:value":r=>l.group=r,options:w(S),filterable:!0},null)]}),e(f,{label:"\u53C2\u6570",path:"params",rule:[{required:!1,message:"\u8BF7\u8F93\u5165\u53C2\u6570"}]},{default:()=>[e(b,{value:l.params,"onUpdate:value":r=>l.params=r,placeholder:"\u8BF7\u8F93\u5165\u53C2\u6570",clearable:!0},null)]}),e(f,{label:"\u89E6\u53D1\u6761\u4EF6",path:"triggerCondition",rule:[{required:!1,message:"\u8BF7\u8F93\u5165\u89E6\u53D1\u6761\u4EF6"}]},{default:()=>[e(b,{value:l.triggerCondition,"onUpdate:value":r=>l.triggerCondition=r,placeholder:"\u8BF7\u8F93\u5165\u89E6\u53D1\u6761\u4EF6",clearable:!0},null)]})]}),e(E,{cols:1},{default:()=>[e(f,{label:"\u6D88\u606F\u5185\u5BB9",path:"content",rule:[{required:!0,message:"\u8BF7\u8F93\u5165\u6D88\u606F\u5185\u5BB9"}]},{default:()=>[e(b,{value:l.content,"onUpdate:value":r=>l.content=r,placeholder:"\u8BF7\u8F93\u5165\u6D88\u606F\u5185\u5BB9",type:"textarea",autosize:{minRows:3}},null)]}),e(f,{label:"\u6D88\u606F\u5185\u5BB9\u793A\u4F8B",path:"contentExample",rule:[{required:!1,message:"\u8BF7\u8F93\u5165\u6D88\u606F\u5185\u5BB9\u793A\u4F8B"}]},{default:()=>[e(b,{value:l.contentExample,"onUpdate:value":r=>l.contentExample=r,placeholder:"\u8BF7\u8F93\u5165\u6D88\u606F\u5185\u5BB9\u793A\u4F8B",type:"textarea",autosize:{minRows:3}},null)]})]})]}),e(k,{justify:"end"},{default:()=>[e(v,{onClick:()=>t("close")},{default:()=>[F("\u53D6\u6D88")]}),e(v,{type:"primary",onClick:u,loading:s.value,disabled:s.value},{default:()=>[F("\u4FDD\u5B58")]})]})])}}),ce=x({name:"message-template-list",props:{appKey:{type:String,default:"kT"}},setup(n){const o=W(),i=P(),t=C({loading:!1,appId:null,pagination:{page:1,rows:10,pageTotal:0},searchForm:{description:null,sendMode:null,clientId:null,model:null,sendFlag:null},dataList:[],showEdit:!1,editMode:"add",editRowData:{}});I(()=>c(this,null,function*(){u()}));const s=M(),l=()=>{var a;(a=s.value)==null||a.submit()},p=()=>{var a;(a=s.value)==null||a.reset()},d=()=>{t.pagination.page=1,u()};M([]);const u=()=>c(this,null,function*(){try{t.loading=!0;const{data:a}=yield de(D(h(h({},t.pagination),t.searchForm),{appKey:n.appKey}));t.pagination.pageTotal=Number(a.total),t.dataList=a.rows||[]}catch(a){}t.loading=!1}),r=a=>{const _=a.sendFlag?"\u505C\u7528":"\u542F\u7528";o.warning({title:"\u63D0\u793A",content:`\u662F\u5426${_}\uFF1F`,positiveText:"\u786E\u5B9A",negativeText:"\u53D6\u6D88",onPositiveClick:()=>c(this,null,function*(){try{yield ue({id:a.id,sendFlag:a.sendFlag==1?0:1}),u(),i.success(`${_}\u6210\u529F`)}catch(ge){}})})},m=()=>[{title:"\u7F16\u53F7",key:"id"},{title:"\u6D88\u606F\u540D\u79F0",key:"description"},{title:"\u6D88\u606F\u53D1\u9001\u7C7B\u578B",key:"sendMode",render:a=>e("div",null,[T(a.sendMode,new Map(Object.entries(j)))])},{title:"\u5BA2\u6237\u7AEF",key:"clientId",render:a=>e("div",null,[T(a.clientId,new Map(Object.entries(N)))])},{title:"\u6D88\u606F\u7C7B\u578B",key:"messageType"},{title:"\u529F\u80FD\u6A21\u5757",key:"group",render:a=>e("div",null,[T(a.group,new Map(Object.entries(S)))])},{title:"\u89E6\u53D1\u6761\u4EF6",key:"triggerCondition"},{title:"\u53C2\u6570",key:"params"},{title:"\u6D88\u606F\u6A21\u677F",key:"content",minWidth:"200px",render(a){return e(q,{showContentWidth:300,content:a.content},null)}},{title:"\u793A\u4F8B",key:"contentExample",render(a){return e(q,{showContentWidth:300,content:a.contentExample},null)}},{title:"\u66F4\u65B0\u4EBA",key:"operatorName"},{title:"\u66F4\u65B0\u65F6\u95F4",key:"updateTime"},{title:"\u72B6\u6001",key:"sendFlag",render(a){return e(A,{type:a.sendFlag?"primary":"default"},{default:()=>[a.sendFlag?"\u542F\u7528":"\u505C\u7528"]})}},{title:"\u64CD\u4F5C",key:"operation",fixed:"right",render(a){return e(k,null,{default:()=>[X(e(v,{type:"primary",size:"small",text:!0,onClick:()=>r(a)},{default:()=>[a.sendFlag?"\u505C\u7528":"\u542F\u7528"]}),[[J("auth"),"sysMessageConfig/status1790940236048568322"]])]})}}];return()=>e("div",{class:"system-menu-container"},[e(se,{ref:s,model:t.searchForm,onSubmit:d,saveKey:"message-template",onSetModel:a=>t.searchForm=a},{default:()=>[e(g,{label:"\u6D88\u606F\u540D\u79F0",path:"description"},{default:()=>[e(b,{placeholder:"\u8BF7\u8F93\u5165\u6D88\u606F\u540D\u79F0",value:t.searchForm.description,"onUpdate:value":a=>t.searchForm.description=a,clearable:!0},null)]}),e(g,{label:"\u6D88\u606F\u7C7B\u578B",path:"sendMode"},{default:()=>[e(y,{placeholder:"\u5168\u90E8\u7C7B\u578B",value:t.searchForm.sendMode,"onUpdate:value":a=>t.searchForm.sendMode=a,options:w(j),clearable:!0},null)]}),e(g,{label:"\u5BA2\u6237\u7AEF",path:"clientId"},{default:()=>[e(y,{placeholder:"\u8BF7\u9009\u62E9\u6240\u5C5E\u9879\u76EE",value:t.searchForm.clientId,"onUpdate:value":a=>t.searchForm.clientId=a,options:w(N),clearable:!0},null)]}),e(g,{label:"\u529F\u80FD\u6A21\u5757",path:"model"},{default:()=>[e(y,{filterable:!0,placeholder:"\u5168\u90E8\u529F\u80FD\u6A21\u5757",options:w(S),clearable:!0},null)]}),e(g,{label:"\u72B6\u6001",path:"status"},{default:()=>[e(y,{value:t.searchForm.sendFlag,"onUpdate:value":a=>t.searchForm.sendFlag=a,placeholder:"\u8BF7\u9009\u62E9\u72B6\u6001",options:[{label:"\u542F\u7528",value:1},{label:"\u505C\u7528",value:0}],clearable:!0},null)]}),e(g,null,{default:()=>[e(k,null,{default:()=>[e(v,{type:"primary",onClick:l},{default:()=>[F("\u641C\u7D22")]}),e(v,{type:"default",onClick:p},{default:()=>[F("\u91CD\u7F6E")]})]})]})]}),e("div",{class:["section-container"]},[e(H,{loading:t.loading,columns:m(),data:t.dataList,rowKey:a=>a.applicationExtendId,scrollX:"1400"},null),e(oe,{page:t.pagination.page,"onUpdate:page":a=>t.pagination.page=a,pageSize:t.pagination.rows,"onUpdate:pageSize":a=>t.pagination.rows=a,pageTotal:t.pagination.pageTotal,"onUpdate:pageTotal":a=>t.pagination.pageTotal=a,onList:u,sync:!0,saveKey:"message-template"},null)]),e($,{blockScroll:!0,show:t.showEdit,"onUpdate:show":a=>t.showEdit=a,preset:"dialog",showIcon:!1,title:(t.editMode=="add"?"\u65B0\u589E":"\u7F16\u8F91")+"\u6D88\u606F\u6A21\u677F",style:{width:"700px"}},{default:()=>[e(pe,{editMode:t.editMode,rowData:t.editRowData,onClose:()=>t.showEdit=!1,onGetList:()=>{t.pagination.page=1,u()}},null)]})])}});function me(n){return typeof n=="function"||Object.prototype.toString.call(n)==="[object Object]"&&!ee(n)}const Ne=x({name:"message-template-index",setup(){const n=C({tabName:"KT",appKeyList:[],appNameList:[]}),o=M();ae(s=>{s.form.tabName&&(n.tabName=s.form.tabName,K(()=>{var l;return(l=o.value)==null?void 0:l.syncBarPosition()}))});const i=Q(),t=s=>{te(s,"tabName",i)};return I(()=>c(this,null,function*(){Object.keys(le);const{data:s}=yield ne({page:1,rows:99,parentId:0});(s.rows||[]).forEach(p=>{n.appKeyList.push(p.appKey),n.appNameList.push(p.appName)}),K(()=>{var p;return(p=o.value)==null?void 0:p.syncBarPosition()})})),()=>{let s;return e("div",{class:"system-menu-container"},[e("div",{class:["section-container"],style:"padding-top: 0"},[e(Y,{ref:o,type:"line",size:"large",value:n.tabName,"onUpdate:value":[l=>n.tabName=l,l=>t(l)]},me(s=n.appKeyList.map((l,p)=>e(Z,{name:l,tab:n.appNameList[p]},{default:()=>[e(ce,{appKey:l},null)]})))?s:{default:()=>[s]})])])}}});export{Ne as default};