tg_web_dist/js/template-list.DzGCHqyD.js

2 lines
8.7 KiB
JavaScript
Raw Normal View History

2025-06-27 16:21:05 +08:00
import{ad as e,r as a,b3 as l,bK as t,c as o,e as r,N as p,w as u,l as s,ak as d,O as i,t as n,a5 as m,a6 as c,g as _,bq as g,br as f,aj as b,bO as y,bP as h,m as D,aX as v,aZ as V,bo as w}from"./index.DBufqXQZ.js";import{E as U,a as k}from"./el-col.BPCnpV4Q.js";import{_ as F}from"./index.CHsbg_KM.js";import{E as x}from"./el-text.Dfh5NCmD.js";import{g as S,d as j,a as q,e as T}from"./template.CVg2qx58.js";import{g as C}from"./group.CwR2kbB7.js";const O={class:"operate"},E={__name:"template-list",setup(E){let N=[];const I=[{label:"预设模板",value:1},{label:"定制模板",value:2}],J=[{label:"小时",value:1},{label:"天",value:2},{label:"周",value:3},{label:"月",value:4},{label:"年",value:5}],R=e({columns:[{prop:"id",label:"ID",width:80,align:"center"},{prop:"name",label:"模板名称",align:"center"},{prop:"type",label:"模板类型",align:"center",slot:"type_slot"},{prop:"type",label:"群组数量",align:"center",slot:"group_num_slot"},{prop:"type",label:"群组",align:"center",slot:"group_slot"},{prop:"times",label:"频率",align:"center",slot:"times_slot"},{prop:"cycle",label:"周期",align:"center",slot:"cycle_slot"},{prop:"price",label:"USDT金额",align:"center"},{prop:"created_at",label:"创建时间",align:"center"},{prop:"operate",label:"操作",width:160,align:"center",slot:"operate",fixed:"right"}],tableData:[],searchFields:[{label:"模板名称",prop:"name",type:"input",value:""},{label:"模板类型",prop:"type",type:"select",value:"",options:I},{prop:"created_at",label:"创建时间",type:"date",dateType:"datetimerange",value:[]}],total:0,page:1,per_page:10,loading:!1}),L=e({formData:{name:"",type:1,group_limit:"",group_ids:[],times:"",times_type:1,cycle:"",cycle_type:2,price:"",id:""},rules:{name:[{required:!0,message:"请输入模板名称",trigger:"blur"}],type:[{required:!0,message:"请选择模板类型",trigger:"change"}],group_limit:[{required:!0,message:"请输入模板数量",trigger:"blur"}],group_ids:[{required:!0,message:"请选择模板",trigger:"change"}],times:[{required:!0,message:"请输入执行频率",trigger:"blur"}],cycle:[{required:!0,message:"请输入执行周期",trigger:"blur"}],price:[{required:!0,message:"请输入USDT价格",trigger:"blur"}]},showDialog:!1});a(null);const z=()=>{R.searchFields.forEach((e=>{"datetimerange"==e.dateType?e.value=[]:e.value=""})),B()};l((()=>{G(),B()}));const B=()=>{R.loading=!0;let e={per_page:R.per_page,page:R.page},a=function(e){const a={};return e.forEach((e=>{e.prop&&void 0!==e.value&&(a[e.prop]=e.value)})),a}(R.searchFields);a.created_at_start=a.created_at[0]?t(a.created_at[0]):"",a.created_at_end=a.created_at[1]?t(a.created_at[1]):"",delete a.created_at,S(Object.assign(e,a)).then((e=>{R.tableData=e.data,R.total=e.total,R.loading=!1})).catch((()=>{R.loading=!1}))},G=async()=>{C({pagination:"off"}).then((e=>{N=[],e.forEach((e=>{N.push({label:e.tg_name,value:e.id})}))}))},P=()=>{L.formData.group_ids=[]},K=a(null),X=()=>{K.value.validate(((e,a)=>{if(e){let e={name:L.formData.name,type:L.formData.type,group_ids:L.formData.group_ids,times:L.formData.times,cycle:L.formData.cycle,price:L.formData.price,id:L.formData.id};""==e.id?q(e).then((e=>{w.success("操作成功"),L.showDialog=!1,B()})):T(e).then((e=>{w.success("操作成功"),L.showDialog=!1,B()}))}}))};return(e,a)=>{const l=d,t=x,S=F,q=b,T=f,C=h,E=y,Z=k,A=U,H=g,M=v;return r(),o("div",null,[p(S,{type:"export",columns:_(R).columns,searchFields:_(R).searchFields,"onUpdate:searchFields":a[1]||(a[1]=e=>_(R).searchFields=e),data:_(R).tableData,per_page:_(R).per_page,"onUpdate:per_page":a[2]||(a[2]=e=>_(R).per_page=e),page:_(R).page,"onUpdate:page":a[3]||(a[3]=e=>_(R).page=e),total:_(R).total,onGetTableData:B,onResetForm:z,loading:_(R).loading,showSelection:!1,showRightRefreshSlot:!1},{btns:u((()=>[p(l,{type:"primary",onClick:a[0]||(a[0]=a=>(e.row,L.showDialog=!0,void G()))},{default:u((()=>a[16]||(a[16]=[i(" 创建预设模版 ")]))),_:1,__:[16]})])),type_slot:u((({row:e})=>[p(t,null,{default:u((()=>[i(n(1===e.type?"预设模板":"定制模板"),1)])),_:2},1024)])),group_num_slot:u((({row:e})