var I=Object.defineProperty,M=Object.defineProperties;var R=Object.getOwnPropertyDescriptors;var T=Object.getOwnPropertySymbols;var A=Object.prototype.hasOwnProperty,L=Object.prototype.propertyIsEnumerable;var k=(n,s,o)=>s in n?I(n,s,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[s]=o,C=(n,s)=>{for(var o in s||(s={}))A.call(s,o)&&k(n,o,s[o]);if(T)for(var o of T(s))L.call(s,o)&&k(n,o,s[o]);return n},b=(n,s)=>M(n,R(s));var c=(n,s,o)=>new Promise((h,u)=>{var g=i=>{try{d(o.next(i))}catch(l){u(l)}},t=i=>{try{d(o.throw(i))}catch(l){u(l)}},d=i=>i.done?h(i.value):Promise.resolve(i.value).then(g,t);d((o=o.apply(n,s)).next())});import{d as P,e as U,c as z,ai as B,u as V,a as H,B as K,r as $,i as a,l as v,_ as q,ce as G,a9 as x,p as r,k as m,H as f,cg as W,aa as j,ch as X,bC as w,dj as J}from"./index.4dd4953c.js";import{u as O}from"./tabsView.a9557599.js";import{S as Q}from"./index.326b402b.js";import{P as Y}from"./index.8bcb0a62.js";import{W as Z}from"./wechat-config-template-edit.7cb6365e.js";import{T as ee}from"./index.fa56e54c.js";import{F as te,G as ae,H as oe,I as se}from"./api.5c0466cc.js";import{N as ne}from"./PageHeader.366e6cad.js";import"./searchs.b637f0d6.js";import"./FormItemGridItem.6d7b31e8.js";const ye=P({name:"wechat-config-template",setup(n,s){const o=U(),h=z(),u=B(),g=V(),t=H({loading:!1,pagination:{page:1,rows:10,pageTotal:0},searchForm:{keyword:null,status:null},mpName:null,dataList:[],showEdit:!1,editMode:"add",editRowData:{},wxConfigAppId:null,appid:null}),d=O(),i=()=>{d.closeCurrentTab(o),h.push({path:"/message/messageConfig"})};K(()=>c(this,null,function*(){if(!!o.query){t.wxConfigAppId=o.query.id;{const{data:e}=yield te(t.wxConfigAppId);if(e)t.appid=e.appid,t.mpName=e.mpName,t.wxConfigAppId=e.appid;else return}p()}}));const l=$(),S=()=>{var e;(e=l.value)==null||e.submit()},F=()=>{var e;(e=l.value)==null||e.reset()},N=()=>{t.pagination.page=1,p()},p=()=>c(this,null,function*(){if(!!t.wxConfigAppId){try{t.loading=!0;const{data:e}=yield ae(b(C(C({},t.pagination),t.searchForm),{appid:t.wxConfigAppId}));t.pagination.pageTotal=Number(e.total),t.dataList=e.rows||[]}catch(e){}t.loading=!1}}),_=e=>{const y=e.status?"\u505C\u7528":"\u542F\u7528";u.warning({title:"\u63D0\u793A",content:`\u662F\u5426${y}\uFF1F`,positiveText:"\u786E\u5B9A",negativeText:"\u53D6\u6D88",onPositiveClick:()=>c(this,null,function*(){try{yield oe({id:e.id,status:!e.status}),p(),g.success(`${y}\u6210\u529F`)}catch(ie){}})})},D=e=>{u.warning({title:"\u63D0\u793A",content:`\u5220\u9664"${e.name}"\uFF0C\u662F\u5426\u7EE7\u7EED\uFF1F`,positiveText:"\u786E\u5B9A",negativeText:"\u53D6\u6D88",onPositiveClick:()=>c(this,null,function*(){try{yield se(e.id),p(),g.success("\u5220\u9664\u6210\u529F")}catch(y){}})})},E=()=>[{title:"\u7F16\u53F7",key:"id"},{title:"\u6307\u4EE4",key:"command"},{title:"\u6A21\u677FID",key:"wxTemplateId"},{title:"\u6A21\u677F\u5730\u5740",key:"url"},{title:"\u6807\u9898",key:"content.title"},{title:"\u5185\u5BB9",key:"content.content",render(e){return a(ee,{content:e.content.content},null)}},{title:"\u72B6\u6001",key:"status",render(e){return a(X,{type:e.status?"primary":"default"},{default:()=>[e.status?"\u542F\u7528":"\u505C\u7528"]})}},{title:"\u64CD\u4F5C",key:"operation",fixed:"right",render(e){return a(x,null,{default:()=>[f(a(r,{type:"primary",size:"small",text:!0,onClick:()=>{_(e)}},{default:()=>[e.status?"\u505C\u7528":"\u542F\u7528"]}),[[w("auth"),"wxTemplateConfig/status1790945458334535681"]]),f(a(r,{type:"primary",size:"small",text:!0,onClick:()=>{t.showEdit=!0,t.editRowData=J(e),t.editMode="edit"}},{default:()=>[m("\u4FEE\u6539")]}),[[w("auth"),"wxTemplateConfig/update1790945691365871618"]]),f(a(r,{type:"primary",size:"small",text:!0,disabled:!!e.status,onClick:()=>{D(e)}},{default:()=>[m("\u5220\u9664")]}),[[w("auth"),"wxTemplateConfig/remove1790945187923562498"]])]})}}];return()=>a("div",{class:"system-menu-container"},[a(ne,{"on-back":()=>i(),title:t.mpName},null),a("div",{class:["section-container"]},[a("div",{class:"system-menu-container"},[a(Q,{ref:l,model:t.searchForm,onSubmit:N,saveKey:"wechat-config-template",onSetModel:e=>t.searchForm=e},{default:()=>[a(v,{label:"\u5173\u952E\u5B57",path:"keyword"},{default:()=>[a(q,{placeholder:"\u7F16\u53F7",value:t.searchForm.keyword,"onUpdate:value":e=>t.searchForm.keyword=e,clearable:!0},null)]}),a(v,{label:"\u72B6\u6001",path:"status"},{default:()=>[a(G,{value:t.searchForm.status,"onUpdate:value":e=>t.searchForm.status=e,clearable:!0,options:[{label:"\u542F\u7528",value:1},{label:"\u505C\u7528",value:0}],placeholder:"\u5168\u90E8\u72B6\u6001"},null)]}),a(v,null,{default:()=>[a(x,null,{default:()=>[a(r,{type:"primary",onClick:S},{default:()=>[m("\u641C\u7D22")]}),a(r,{type:"default",onClick:F},{default:()=>[m("\u91CD\u7F6E")]})]})]})]}),a(x,{style:{paddingBottom:"12px"}},{default:()=>[f(a(r,{type:"primary",onClick:()=>{t.showEdit=!0,t.editMode="add"}},{default:()=>[m("\u65B0\u589E\u6A21\u677F")]}),[[w("auth"),"wxTemplateConfig/save1790945603360985090"]])]}),a("div",{class:["section-container"]},[a(W,{loading:t.loading,columns:E(),data:t.dataList,rowKey:e=>e.id,scrollX:"1400"},null),a(Y,{page:t.pagination.page,"onUpdate:page":e=>t.pagination.page=e,pageSize:t.pagination.rows,"onUpdate:pageSize":e=>t.pagination.rows=e,pageTotal:t.pagination.pageTotal,"onUpdate:pageTotal":e=>t.pagination.pageTotal=e,onList:p,sync:!0,saveKey:"wechat-config-template"},null)]),a(j,{blockScroll:!0,show:t.showEdit,"onUpdate:show":e=>t.showEdit=e,preset:"dialog",showIcon:!1,title:(t.editMode=="add"?"\u65B0\u589E":"\u7F16\u8F91")+"\u6A21\u677F",style:{width:"700px"}},{default:()=>[a(Z,{appid:t.appid,editMode:t.editMode,rowData:t.editRowData,onClose:()=>t.showEdit=!1,onGetList:()=>{t.pagination.page=1,p()}},null)]})])])])}});export{ye as default};