var P=Object.defineProperty,z=Object.defineProperties;var B=Object.getOwnPropertyDescriptors;var _=Object.getOwnPropertySymbols;var V=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable;var N=(s,n,o)=>n in s?P(s,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):s[n]=o,v=(s,n)=>{for(var o in n||(n={}))V.call(n,o)&&N(s,o,n[o]);if(_)for(var o of _(n))j.call(n,o)&&N(s,o,n[o]);return s},C=(s,n)=>z(s,B(n));var m=(s,n,o)=>new Promise((d,p)=>{var i=u=>{try{r(o.next(u))}catch(l){p(l)}},a=u=>{try{r(o.throw(u))}catch(l){p(l)}},r=u=>u.done?d(u.value):Promise.resolve(u.value).then(i,a);r((o=o.apply(s,n)).next())});import{d as E,r as S,a as T,B as F,i as t,q as G,ac as A,ce as I,_ as M,a9 as b,p as g,k as y,ai as $,e as H,u as O,c as X,l as k,H as w,cg as J,aa as Q,ch as W,bC as D,dj as Y}from"./index.1121c4e8.js";import{u as Z}from"./tabsView.0a5e287f.js";import{S as ee}from"./index.1ac4415f.js";import{P as ae}from"./index.aea83c68.js";import{z as te,A as se,B as oe,C as ne,D as ie,E as le}from"./api.e06af54b.js";import{N as x}from"./FormItemGridItem.9227cd2b.js";import{s as re}from"./api.66c2b040.js";import{T as ue}from"./index.ac33b3ef.js";import{N as pe}from"./PageHeader.94b0b0ec.js";import"./searchs.b637f0d6.js";const de=E({name:"sms-config-app-edit",props:{editMode:{type:String,required:!0},smsConfigId:{type:Number,required:!0},rowData:{type:Object,required:!1},appData:{type:Array,required:!0}},emits:["close","getList"],setup(s,{slots:n,attrs:o,emit:d}){const p=S(!1),i=T({appKey:null,sign:null,extendData:null}),a=S(),r=T({rowData:null,musicSheetCategories:[]});F(()=>m(this,null,function*(){r.rowData=s.rowData,s.editMode=="edit"&&s.rowData&&(i.appKey=r.rowData.appKey,i.sign=r.rowData.sign,i.extendData=r.rowData.extendData)}));const u=()=>m(this,null,function*(){a.value.validate(l=>m(this,null,function*(){if(l)return!1;p.value=!0;try{let f;s.editMode=="add"?f=yield te(C(v({},i),{sysConfigId:s.smsConfigId})):f=yield se(C(v({},i),{id:r.rowData.id})),f&&f.code===200&&(d("close"),d("getList"))}catch(f){}p.value=!1}))});return()=>t("div",{style:"background: #fff; padding-top: 12px"},[t(G,{ref:a,labelPlacement:"top",model:i,"label-placement":"left","label-width":"100"},{default:()=>[t(A,{cols:2},{default:()=>[t(x,{label:"\u5E94\u7528",path:"appKey",rule:[{required:!0,message:"\u8BF7\u8F93\u5165\u5E73\u53F0\u540D\u79F0"}]},{default:()=>[t(I,{placeholder:"\u8BF7\u9009\u62E9\u5E73\u53F0",value:i.appKey,"onUpdate:value":l=>i.appKey=l,options:s.appData,filterable:!0},null)]}),t(x,{label:"\u7B7E\u540D",path:"sign",rule:[{required:!0,message:"\u8BF7\u8F93\u5165\u7B7E\u540D"}]},{default:()=>[t(M,{value:i.sign,"onUpdate:value":l=>i.sign=l,placeholder:"\u8BF7\u8F93\u5165\u7B7E\u540D",clearable:!0},null)]})]}),t(A,{cols:1},{default:()=>[t(x,{label:"\u62D3\u5C55\u53C2\u6570",path:"extendData",rule:[{required:!1,message:"\u8BF7\u8F93\u5165\u62D3\u5C55\u53C2\u6570"}]},{default:()=>[t(M,{value:i.extendData,"onUpdate:value":l=>i.extendData=l,placeholder:"\u8BF7\u8F93\u5165\u62D3\u5C55\u53C2\u6570",autosize:{minRows:3},type:"textarea"},null)]})]})]}),t(b,{justify:"end"},{default:()=>[t(g,{onClick:()=>d("close")},{default:()=>[y("\u53D6\u6D88")]}),t(g,{type:"primary",onClick:u,loading:p.value,disabled:p.value},{default:()=>[y("\u4FDD\u5B58")]})]})])}}),xe=E({name:"sms-config-app",setup(s,n){const o=$(),d=H(),p=O(),i=X(),a=T({loading:!1,appId:null,pagination:{page:1,rows:10,pageTotal:0},searchForm:{keyword:null,status:null},name:null,smsConfigId:null,dataList:[],showEdit:!1,editMode:"add",editRowData:{},appData:[],appMap:new Map}),r=Z(),u=()=>{r.closeCurrentTab(d),i.push({path:"/message/messageConfig"})};F(()=>m(this,null,function*(){if(!!d.query){a.smsConfigId=d.query.id;{const{data:e}=yield oe(a.smsConfigId);e&&(a.name=e.name)}{a.appData=[];const{data:e}=yield re({page:1,rows:999});e&&e.rows&&e.rows.forEach(c=>{a.appData.push({label:c.appName,value:c.appKey}),a.appMap.set(c.appKey,c.appName)})}h()}}));const l=S(),f=()=>{var e;(e=l.value)==null||e.submit()},K=()=>{var e;(e=l.value)==null||e.reset()},q=()=>{a.pagination.page=1,h()},h=()=>m(this,null,function*(){if(!!a.smsConfigId){try{a.loading=!0;const{data:e}=yield ne(C(v(v({},a.pagination),a.searchForm),{sysConfigId:a.smsConfigId}));a.pagination.pageTotal=Number(e.total),a.dataList=e.rows||[]}catch(e){}a.loading=!1}}),R=e=>{const c=e.status?"\u505C\u7528":"\u542F\u7528";o.warning({title:"\u63D0\u793A",content:`\u662F\u5426${c}\uFF1F`,positiveText:"\u786E\u5B9A",negativeText:"\u53D6\u6D88",onPositiveClick:()=>m(this,null,function*(){try{yield ie({id:e.id,status:!e.status}),h(),p.success(`${c}\u6210\u529F`)}catch(ce){}})})},U=e=>{o.warning({title:"\u63D0\u793A",content:`\u5220\u9664"${e.name}"\uFF0C\u662F\u5426\u7EE7\u7EED\uFF1F`,positiveText:"\u786E\u5B9A",negativeText:"\u53D6\u6D88",onPositiveClick:()=>m(this,null,function*(){try{yield le(e.id),h(),p.success("\u5220\u9664\u6210\u529F")}catch(c){}})})},L=()=>[{title:"\u7F16\u53F7",key:"id"},{title:"\u5E94\u7528",key:"appKey",render(e){return a.appMap.get(e.appKey)}},{title:"\u7B7E\u540D",key:"sign"},{title:"\u62D3\u5C55\u53C2\u6570",key:"extendData",render:e=>t(ue,{content:e.extendData},null)},{title:"\u72B6\u6001",key:"status",render(e){return t(W,{type:e.status?"primary":"default"},{default:()=>[e.status?"\u542F\u7528":"\u505C\u7528"]})}},{title:"\u64CD\u4F5C",key:"operation",fixed:"right",render(e){return t(b,null,{default:()=>[w(t(g,{type:"primary",size:"small",text:!0,onClick:()=>{R(e)}},{default:()=>[e.status?"\u505C\u7528":"\u542F\u7528"]}),[[D("auth"),"smsAppConfig/status1790942026752135170"]]),w(t(g,{type:"primary",size:"small",text:!0,onClick:()=>{a.showEdit=!0,a.editRowData=Y(e),a.editMode="edit"}},{default:()=>[y("\u4FEE\u6539")]}),[[D("auth"),"smsAppConfig/update1790942447902199809"]]),w(t(g,{type:"primary",size:"small",text:!0,disabled:!!e.status,onClick:()=>{U(e)}},{default:()=>[y("\u5220\u9664")]}),[[D("auth"),"smsAppConfig/remove1790942087347245058"]])]})}}];return()=>t("div",{class:"system-menu-container"},[t(pe,{"on-back":()=>u(),title:a.name},null),t("div",{class:["section-container"]},[t("div",{class:"system-menu-container"},[t(ee,{ref:l,model:a.searchForm,onSubmit:q,saveKey:"sms-config-app",onSetModel:e=>a.searchForm=e},{default:()=>[t(k,{label:"\u5173\u952E\u5B57",path:"keyword"},{default:()=>[t(M,{placeholder:"\u5E94\u7528\u7F16\u53F7/\u540D\u79F0",value:a.searchForm.keyword,"onUpdate:value":e=>a.searchForm.keyword=e,clearable:!0},null)]}),t(k,{label:"\u72B6\u6001",path:"status"},{default:()=>[t(I,{value:a.searchForm.status,"onUpdate:value":e=>a.searchForm.status=e,clearable:!0,options:[{label:"\u542F\u7528",value:1},{label:"\u505C\u7528",value:0}],placeholder:"\u5168\u90E8\u72B6\u6001"},null)]}),t(k,null,{default:()=>[t(b,null,{default:()=>[t(g,{type:"primary",onClick:f},{default:()=>[y("\u641C\u7D22")]}),t(g,{type:"default",onClick:K},{default:()=>[y("\u91CD\u7F6E")]})]})]})]}),t(b,{style:{paddingBottom:"12px"}},{default:()=>[w(t(g,{type:"primary",onClick:()=>{a.showEdit=!0,a.editMode="add"}},{default:()=>[y("\u65B0\u589E\u5E94\u7528")]}),[[D("auth"),"smsAppConfig/save1790942383565770753"]])]}),t("div",{class:["section-container"]},[t(J,{loading:a.loading,columns:L(),data:a.dataList,rowKey:e=>e.id,scrollX:"1400"},null),t(ae,{page:a.pagination.page,"onUpdate:page":e=>a.pagination.page=e,pageSize:a.pagination.rows,"onUpdate:pageSize":e=>a.pagination.rows=e,pageTotal:a.pagination.pageTotal,"onUpdate:pageTotal":e=>a.pagination.pageTotal=e,onList:h,sync:!0,saveKey:"sms-config-app"},null)]),t(Q,{blockScroll:!0,show:a.showEdit,"onUpdate:show":e=>a.showEdit=e,preset:"dialog",showIcon:!1,title:(a.editMode=="add"?"\u65B0\u589E":"\u7F16\u8F91")+"\u5E94\u7528",style:{width:"700px"}},{default:()=>[t(de,{editMode:a.editMode,rowData:a.editRowData,appData:a.appData,smsConfigId:a.smsConfigId,onClose:()=>a.showEdit=!1,onGetList:()=>{a.pagination.page=1,h()}},null)]})])])])}});export{xe as default};