wechat-config-template-message.59f91348.js 5.4 KB

1
  1. var E=Object.defineProperty,D=Object.defineProperties;var N=Object.getOwnPropertyDescriptors;var k=Object.getOwnPropertySymbols;var I=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable;var C=(i,s,o)=>s in i?E(i,s,{enumerable:!0,configurable:!0,writable:!0,value:o}):i[s]=o,w=(i,s)=>{for(var o in s||(s={}))I.call(s,o)&&C(i,o,s[o]);if(k)for(var o of k(s))P.call(s,o)&&C(i,o,s[o]);return i},v=(i,s)=>D(i,N(s));var c=(i,s,o)=>new Promise((f,u)=>{var g=n=>{try{p(o.next(n))}catch(l){u(l)}},t=n=>{try{p(o.throw(n))}catch(l){u(l)}},p=n=>n.done?f(n.value):Promise.resolve(n.value).then(g,t);p((o=o.apply(i,s)).next())});import{d as R,e as B,c as L,ai as U,u as z,a as V,B as H,r as K,i as a,l as h,_ as W,ce as $,a9 as T,p as d,k as m,cg as q,aa as A,ch as j,dj as G}from"./index.8b77fe3c.js";import{u as X}from"./tabsView.00baef7b.js";import{S as J}from"./index.b2377817.js";import{P as O}from"./index.a8e246f1.js";import{W as Q}from"./wechat-config-template-edit.1c16d201.js";import{L as Y,M as Z,H as ee,I as te}from"./api.bf919566.js";import{N as ae}from"./PageHeader.5a914630.js";import"./searchs.b637f0d6.js";import"./FormItemGridItem.8b64101c.js";const ge=R({name:"wechat-config-template",setup(i,s){const o=B(),f=L(),u=U(),g=z(),t=V({loading:!1,pagination:{page:1,rows:10,pageTotal:0},searchForm:{keyword:null,status:null},dataList:[],showEdit:!1,editMode:"add",editRowData:{},appid:null,wxTemplateConfigId:null}),p=X(),n=()=>{p.closeCurrentTab(o),f.push({path:"/message/wxTemplateConfig",query:t.appid})};H(()=>c(this,null,function*(){if(t.wxTemplateConfigId=o.query,!!t.wxTemplateConfigId){{const{data:e}=yield Y(t.wxTemplateConfigId);if(e)t.appid=e.appid;else return}r()}}));const l=K(),x=()=>{var e;(e=l.value)==null||e.submit()},b=()=>{var e;(e=l.value)==null||e.reset()},S=()=>{t.pagination.page=1,r()},r=()=>c(this,null,function*(){if(!!t.appid){try{t.loading=!0;const{data:e}=yield Z(v(w(w({},t.pagination),t.searchForm),{appid:t.appid}));t.pagination.pageTotal=Number(e.total),t.dataList=e.rows||[]}catch(e){}t.loading=!1}}),F=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 ee({id:e.id,status:!e.status}),r(),g.success(`${y}\u6210\u529F`)}catch(oe){}})})},M=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 te(e.id),r(),g.success("\u5220\u9664\u6210\u529F")}catch(y){}})})},_=()=>[{title:"\u7F16\u53F7",key:"id"},{title:"\u5E94\u7528\u6807\u5FD7",key:"command"},{title:"\u6307\u4EE4",key:"wxTemplateId"},{title:"\u6807\u9898",key:"url"},{title:"\u5185\u5BB9",key:"description"},{title:"\u7248\u672C",key:"description"},{title:"\u7C7B\u578BWECHAT",key:"description"},{title:"APP",key:"description"},{title:"\u63CF\u8FF0",key:"description"},{title:"\u72B6\u6001",key:"status",render(e){return a(j,{type:e.status?"primary":"default"},{default:()=>[e.status?"\u542F\u7528":"\u505C\u7528"]})}},{title:"\u64CD\u4F5C",key:"operation",fixed:"right",render(e){return a(T,null,{default:()=>[a(d,{type:"primary",size:"small",text:!0,onClick:()=>{F(e)}},{default:()=>[e.status?"\u505C\u7528":"\u542F\u7528"]}),a(d,{type:"primary",size:"small",text:!0,onClick:()=>{t.showEdit=!0,t.editRowData=G(e),t.editMode="edit"}},{default:()=>[m("\u4FEE\u6539")]}),a(d,{type:"primary",size:"small",text:!0,disabled:!!e.status,onClick:()=>{M(e)}},{default:()=>[m("\u5220\u9664")]})]})}}];return()=>a("div",{class:"system-menu-container"},[a(ae,{"on-back":()=>n(),title:t.wxTemplateConfigId},null),a("div",{class:["section-container"]},[a("div",{class:"system-menu-container"},[a(J,{ref:l,model:t.searchForm,onSubmit:S,saveKey:"wechat-config-template",onSetModel:e=>t.searchForm=e},{default:()=>[a(h,{label:"\u5173\u952E\u5B57",path:"keyword"},{default:()=>[a(W,{placeholder:"\u5E73\u53F0\u7F16\u53F7/\u540D\u79F0",value:t.searchForm.keyword,"onUpdate:value":e=>t.searchForm.keyword=e,clearable:!0},null)]}),a(h,{label:"\u72B6\u6001",path:"status"},{default:()=>[a($,{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(h,null,{default:()=>[a(T,null,{default:()=>[a(d,{type:"primary",onClick:x},{default:()=>[m("\u641C\u7D22")]}),a(d,{type:"default",onClick:b},{default:()=>[m("\u91CD\u7F6E")]})]})]})]}),a(T,{style:{paddingBottom:"12px"}},{default:()=>[a(d,{type:"primary",onClick:()=>{t.showEdit=!0,t.editMode="add"}},{default:()=>[m("\u65B0\u589E\u6D88\u606F\u5185\u5BB9")]})]}),a("div",{class:["section-container"]},[a(q,{loading:t.loading,columns:_(),data:t.dataList,rowKey:e=>e.id,scrollX:"1400"},null),a(O,{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:r,sync:!0,saveKey:"wechat-config-template"},null)]),a(A,{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:"auto"}},{default:()=>[a(Q,{editMode:t.editMode,rowData:t.editRowData,style:{width:"450"},onClose:()=>t.showEdit=!1,onGetList:()=>{t.pagination.page=1,r()}},null)]})])])])}});export{ge as default};