2 lines
3.0 KiB
JavaScript
2 lines
3.0 KiB
JavaScript
var L=Object.defineProperty,T=Object.defineProperties;var B=Object.getOwnPropertyDescriptors;var y=Object.getOwnPropertySymbols;var I=Object.prototype.hasOwnProperty,R=Object.prototype.propertyIsEnumerable;var k=(s,a,t)=>a in s?L(s,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[a]=t,g=(s,a)=>{for(var t in a||(a={}))I.call(a,t)&&k(s,t,a[t]);if(y)for(var t of y(a))R.call(a,t)&&k(s,t,a[t]);return s},_=(s,a)=>T(s,B(a));var v=(s,a,t)=>new Promise((f,o)=>{var m=l=>{try{p(t.next(l))}catch(i){o(i)}},n=l=>{try{p(t.throw(l))}catch(i){o(i)}},p=l=>l.done?f(l.value):Promise.resolve(l.value).then(m,n);p((t=t.apply(s,a)).next())});import{_ as F}from"./form.vue_vue_type_script_setup_true_lang-DXbOk4OV.js";import{n as r,b as P,r as M,fI as V,aA as b,aK as $,ag as q}from"./index-CRmU-Qpi.js";import{u as A,q as U,e as E}from"./system-CqYheEHE.js";function Q(){const s=r(),a=r(!0),t=r([]),f=r(!1),o=r({search_name:""}),m=r([{label:"任务类型",prop:"task_type",type:"select",optionList:[{label:"每日任务",value:1},{label:"每日特殊任务",value:2},{label:"平台常规任务",value:3}]}]),n=r({total:0,pageSize:10,pageSizes:[10,20,50,100],currentPage:1,background:!0}),p=r([{label:"任务ID",prop:"task_id"},{label:"任务名称",prop:"task_name"},{label:"任务类型",prop:"task_type_str"},{label:"状态",prop:"status",cellRenderer:({row:e,props:c})=>P(M("el-switch"),{modelValue:e.is_active,"onUpdate:modelValue":u=>e.is_active=u,onChange:()=>l(e),"active-value":1,"inactive-value":2,"active-text":"激活","inactive-text":"未激活","active-color":"#13ce66","inactive-color":"#ff4949"},null)},{label:"操作",fixed:"right",width:210,slot:"operation"}]),l=e=>v(this,null,function*(){a.value||V.confirm(`确认要<strong>${e.is_active===2?"未激活":"激活"}</strong><strong style='color:var(--el-color-primary)'></strong>吗?`,"系统提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning",dangerouslyUseHTMLString:!0,draggable:!0}).then(()=>v(this,null,function*(){const{data:c,code:u}=yield A({task_id:e.task_id,is_active:e.is_active});u&&b(`已${e.status===2?"未激活":"激活"}`,{type:"success"})})).catch(()=>{e.status==2?e.status=1:e.status=2})}),i=e=>v(this,null,function*(){a.value=!0,o.value=g({},e);const{data:c,code:u}=yield U(_(g({},e),{page:n.value.currentPage,page_limit:n.value.pageSize}));u&&(t.value=c.lists.map(d=>(d.is_active,d)),n.value.total=c.count,n.value.currentPage=c.page),a.value=!1});return{searchForm:o,searchLabel:m,onSearch:i,isShow:f,tableList:t,tableLabel:p,pagination:n,handleSizeChange:e=>{n.value.pageSize=e,i(o.value)},handleCurrentChange:e=>{n.value.currentPage=e,i(o.value)},loading:a,openDialog:(e="新增",c)=>{$({title:`${e}充值规则`,props:{formInline:g({},c)},width:"40%",closeOnClickModal:!1,contentRenderer:()=>q(F,{ref:s,formInline:null}),beforeSure:(u,{options:d})=>{const C=s.value.getRef(),S=d.props.formInline,D=h=>v(this,null,function*(){const{code:x,msg:z}=yield E(_(g({},h),{task_id:c.task_id}));x?(b("修改成功",{type:"success"}),i(o.value),u()):b(z,{type:"error"})});C.validate(h=>{h&&D(S)})}})}}}export{Q as useData};
|