wechat-config-template-edit.fe3d1664.js 3.8 KB

1
  1. var q=Object.defineProperty,I=Object.defineProperties;var T=Object.getOwnPropertyDescriptors;var v=Object.getOwnPropertySymbols;var N=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable;var D=(t,o,n)=>o in t?q(t,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[o]=n,w=(t,o)=>{for(var n in o||(o={}))N.call(o,n)&&D(t,n,o[n]);if(v)for(var n of v(o))U.call(o,n)&&D(t,n,o[n]);return t},g=(t,o)=>I(t,T(o));var f=(t,o,n)=>new Promise((c,d)=>{var e=u=>{try{r(n.next(u))}catch(l){d(l)}},m=u=>{try{r(n.throw(u))}catch(l){d(l)}},r=u=>u.done?c(u.value):Promise.resolve(u.value).then(e,m);r((n=n.apply(t,o)).next())});import{J as C,K as M}from"./api.e1d46622.js";import{d as S,u as k,r as b,a as h,B as L,i as a,q as R,ac as x,_ as i,a9 as j,p as y,k as _}from"./index.52190234.js";import{N as s}from"./FormItemGridItem.c165d723.js";const V=S({mpName:"wechat-config-template-edit",props:{appid:{type:String,required:!1},editMode:{type:String,required:!0},rowData:{type:Object,required:!1}},emits:["close","getList"],setup(t,{slots:o,attrs:n,emit:c}){k();const d=b(!1),e=h({wxTemplateId:null,command:null,url:null,description:null,content:{content:null,title:null}}),m=b(),r=h({rowData:null});L(()=>f(this,null,function*(){!t.appid||(r.rowData=t.rowData,t.editMode=="edit"&&t.rowData&&(e.command=r.rowData.command,e.wxTemplateId=r.rowData.wxTemplateId,e.url=r.rowData.url,e.description=r.rowData.description,r.rowData.content&&(e.content.content=r.rowData.content.content,e.content.title=r.rowData.content.title)))}));const u=()=>f(this,null,function*(){m.value.validate(l=>f(this,null,function*(){if(l)return!1;d.value=!0;try{let p;t.editMode=="add"?p=yield C(g(w({},e),{appid:t.appid})):p=yield M(g(w({},e),{id:r.rowData.id,appid:t.appid})),p&&p.code===200&&(c("close"),c("getList"))}catch(p){}d.value=!1}))});return()=>a("div",{style:"background: #fff; padding-top: 12px"},[a(R,{ref:m,labelPlacement:"top",model:e,"label-placement":"left","label-width":"100"},{default:()=>[a(x,{cols:2},{default:()=>[a(s,{label:"\u6807\u9898",path:"content.title",rule:[{required:!0,message:"\u8BF7\u8F93\u5165\u6807\u9898"}]},{default:()=>[a(i,{value:e.content.title,"onUpdate:value":l=>e.content.title=l,placeholder:"\u8BF7\u8F93\u5165\u6807\u9898",clearable:!0},null)]}),a(s,{label:"\u6307\u4EE4",path:"command",rule:[{required:!0,message:"\u8BF7\u8F93\u5165\u6307\u4EE4"}]},{default:()=>[a(i,{value:e.command,"onUpdate:value":l=>e.command=l,placeholder:"\u8BF7\u8F93\u5165\u6307\u4EE4",clearable:!0},null)]}),a(s,{label:"\u6A21\u677FID",path:"wxTemplateId",rule:[{required:!0,message:"\u8BF7\u8F93\u5165\u6A21\u677FID"}]},{default:()=>[a(i,{value:e.wxTemplateId,"onUpdate:value":l=>e.wxTemplateId=l,placeholder:"\u8BF7\u8F93\u5165\u6A21\u677FID",clearable:!0},null)]}),a(s,{label:"\u6A21\u677F\u5730\u5740",path:"appid",rule:[{required:!1,message:"\u8BF7\u8F93\u5165\u6A21\u677F\u5730\u5740"}]},{default:()=>[a(i,{value:e.url,"onUpdate:value":l=>e.url=l,placeholder:"\u8BF7\u8F93\u5165\u6A21\u677F\u5730\u5740",clearable:!0},null)]})]}),a(x,{cols:1},{default:()=>[a(s,{label:"\u5185\u5BB9",path:"content.content",rule:[{required:!0,message:"\u8BF7\u8F93\u5165\u5185\u5BB9"}]},{default:()=>[a(i,{type:"textarea",value:e.content.content,"onUpdate:value":l=>e.content.content=l,placeholder:"\u8BF7\u8F93\u5165\u5185\u5BB9",autosize:{minRows:3}},null)]}),a(s,{label:"\u63CF\u8FF0",path:"description",rule:[{required:!1,message:"\u8BF7\u8F93\u5165\u63CF\u8FF0"}]},{default:()=>[a(i,{type:"textarea",value:e.description,"onUpdate:value":l=>e.description=l,placeholder:"\u8BF7\u8F93\u5165\u63CF\u8FF0",autosize:{minRows:3}},null)]})]})]}),a(j,{justify:"end"},{default:()=>[a(y,{onClick:()=>c("close")},{default:()=>[_("\u53D6\u6D88")]}),a(y,{type:"primary",onClick:u,loading:d.value,disabled:d.value},{default:()=>[_("\u4FDD\u5B58")]})]})])}});export{V as W};