tg_web_dist/js/template-list.Cpll_yO3.js

2 lines
8.8 KiB
JavaScript
Raw Normal View History

2025-07-01 15:36:27 +08:00
import{aR as e,H as a,aA as l,aB as t,G as o,aU as r,aV as p,af as s,ag as u,ay as i}from"./index.D1_OMcDq.js";/* empty css */import{_ as d}from"./index.QgL7qSO-.js";import{E as n}from"./el-text.K-o0B5G6.js";import{g as m,d as c,a as _,e as g}from"./template.DCnSOza9.js";import{g as f}from"./group.BLvnVVKy.js";import{E as y,a as b}from"./index.QrL91wAP.js";import{V as h,r as v,a0 as D,x as V,y as w,M as U,K as x,B as j,a2 as k,P as F,H as S,aa as T,u as q,J as C}from"./editor-vue.xUJDThhq.js";import"./lodash.lGe4XDVY.js";import"./editor.Ppghu3lf.js";/* empty css */const J={class:"operate"},O={__name:"template-list",setup(O){let R=[];const E=[{label:"预设模板",value:1},{label:"定制模板",value:2}],N=[{label:"小时",value:1},{label:"天",value:2},{label:"周",value:3},{label:"月",value:4},{label:"年",value:5}],B=h({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=h({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:""}};v(null);const G=()=>{B.searchFields.forEach((e=>{"datetimerange"==e.dateType?e.value=[]:e.value=""})),H()};D((()=>{console.log("onMounted"),I(),H()}));const H=()=>{B.loading=!0;let a={per_page:B.per_page,page:B.page},l=function(e){const a={};return e.forEach((e=>{e.prop&&void 0!==e.value&&(a[e.prop]=e.value)})),a}(B.searchFields);l.created_at_start=l.created_at[0]?e(l.created_at[0]):"",l.created_at_end=l.created_at[1]?e(l.created_at[1]):"",delete l.created_at,m(Object.assign(a,l)).then((e=>{console.log(e),B.tableData=e.data,B.total=e.total,B.loading=!1})).catch((()=>{B.loading=!1}))},I=async()=>{f({pagination:"off"}).then((e=>{R=[],e.forEach((e=>{R.push({label:e.tg_name,value:e.id})}))}))},K=v(null),M=()=>{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?_(e).then((e=>{i.success("操作成功"),L.showDialog=!1,H()})).finally((()=>{z()})):g(e).then((e=>{i.success("操作成功"),L.showDialog=!1,H()})).finally((()=>{z()}))}}))};return(e,m)=>{const _=a,g=n,f=d,h=o,v=t,D=p,O=r,z=b,A=y,P=l,Q=s;return w(),V("div",null,[U(f,{type:"export",columns:q(B).columns,searchFields:q(B).searchFields,"onUpdate:searchFields":m[1]||(m[1]=e=>q(B).searchFields=e),data:q(B).tableData,per_page:q(B).per_page,"onUpdate:per_page":m[2]||(m[2]=e=>q(B).per_page=e),page:q(B).page,"onUpdate:page":m[3]||(m[3]=e=>q(B).page=e),total:q(B).total,onGetTableData:H,onResetForm:G,loading