tg_web_dist/js/template-list.BO7mHcaL.js

2 lines
8.7 KiB
JavaScript
Raw Normal View History

2025-07-01 15:15:05 +08:00
import{ad as e,r as a,b3 as l,bJ as t,c as o,e as r,N as p,w as s,l as u,ak as i,O as d,t as n,a5 as m,a6 as c,g as _,bp as g,bq as f,aj as y,bN as b,bO as h,m as v,aX as D,aZ as V,bn as w}from"./index.Drv-jZX0.js";/* empty css */import{_ as U}from"./index.CabKkQaZ.js";import{E as k}from"./el-text.B_soufBJ.js";import{g as x,d as j,a as F,e as S}from"./template.Crc5ETne.js";import{g as T}from"./group.Kl2kAfhp.js";import{E as q,a as O}from"./index.j4cagKBG.js";import"./lodash.vESyDP0b.js";/* empty css */const C={class:"operate"},J={__name:"template-list",setup(J){let N=[];const E=[{label:"预设模板",value:1},{label:"定制模板",value:2}],R=[{label:"小时",value:1},{label:"天",value:2},{label:"周",value:3},{label:"月",value:4},{label:"年",value:5}],I=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:E},{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}),z=()=>{L.formData={name:"",type:1,group_limit:"",group_ids:[],times:"",times_type:1,cycle:"",cycle_type:2,price:"",id:""}};a(null);const B=()=>{I.searchFields.forEach((e=>{"datetimerange"==e.dateType?e.value=[]:e.value=""})),M()};l((()=>{console.log("onMounted"),G(),M()}));const M=()=>{I.loading=!0;let e={per_page:I.per_page,page:I.page},a=function(e){const a={};return e.forEach((e=>{e.prop&&void 0!==e.value&&(a[e.prop]=e.value)})),a}(I.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,x(Object.assign(e,a)).then((e=>{console.log(e),I.tableData=e.data,I.total=e.total,I.loading=!1})).catch((()=>{I.loading=!1}))},G=async()=>{T({pagination:"off"}).then((e=>{N=[],e.forEach((e=>{N.push({label:e.tg_name,value:e.id})}))}))},H=a(null),P=()=>{H.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?F(e).then((e=>{w.success("操作成功"),L.showDialog=!1,M()})).finally((()=>{z()})):S(e).then((e=>{w.success("操作成功"),L.showDialog=!1,M()})).finally((()=>{z()}))}}))};return(e,a)=>{const l=i,t=k,x=U,F=y,S=f,T=h,J=b,z=O,X=q,Z=g,A=D;return r(),o("div",null,[p(x,{type:"export",columns:_(I).columns,searchFields:_(I).searchFields,"onUpdate:searchFields":a[1]||(a[1]=e=>_(I).searchFields=e),data:_(I).tableData,per_page:_(I).per_page,"onUpdate:per_page":a[2]||(a[2]=e=>_(I).per_page=e),page:_(I).page,"onUpdate:page":a[3]||(a[3]=e=>_(I).page=e),total:_(I).total,onGetTableData:M,onResetForm:B,loading:_(I).loading,showSelection:!1,showRightRefreshSlot:!1},{btns:s(