2 lines
2.5 KiB
JavaScript
2 lines
2.5 KiB
JavaScript
var U=Object.defineProperty,I=Object.defineProperties;var L=Object.getOwnPropertyDescriptors;var b=Object.getOwnPropertySymbols;var k=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable;var z=(e,a,t)=>a in e?U(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t,C=(e,a)=>{for(var t in a||(a={}))k.call(a,t)&&z(e,t,a[t]);if(b)for(var t of b(a))w.call(a,t)&&z(e,t,a[t]);return e},T=(e,a)=>I(e,L(a));var g=(e,a,t)=>new Promise((m,s)=>{var h=r=>{try{d(t.next(r))}catch(p){s(p)}},o=r=>{try{d(t.throw(r))}catch(p){s(p)}},d=r=>r.done?m(r.value):Promise.resolve(r.value).then(h,o);d((t=t.apply(e,a)).next())});import{_ as x}from"./form.vue_vue_type_script_setup_true_lang-DOzyNmG6.js";import{aw as f,n as l,aA as u,aK as M,ag as O}from"./index-CRmU-Qpi.js";const $=e=>f.request("get","/adminapi/UserTag/tag_lists",{params:e}),A=e=>f.request("post","/adminapi/UserTag/add_tag",{data:e}),F=e=>f.request("post","/adminapi/UserTag/edit_tag",{data:e}),K=e=>f.request("post","/adminapi/UserTag/del_tag",{data:e});function G(){const e=l(),a=l(!0),t=l([]),m=l(!1),s=l({total:0,pageSize:10,currentPage:1,pageSizes:[10,20,50,100],background:!0}),h=l([{label:"分类名称",prop:"tag_name"},{label:"创建时间",prop:"createtime"},{label:"操作",fixed:"right",width:210,slot:"operation"}]),o=()=>g(this,null,function*(){a.value=!0;const{data:n,code:i}=yield $({pageNum:s.value.currentPage,pageSize:s.value.pageSize});i&&(t.value=n.lists,s.value.total=n.count,s.value.currentPage=n.page),a.value=!1});return{onSearch:o,isShow:m,tableList:t,tableLabel:h,pagination:s,handleSizeChange:n=>{s.value.pageSize=n,o()},handleCurrentChange:n=>{s.value.currentPage=n,o()},loading:a,handleDelete:n=>g(this,null,function*(){const{code:i}=yield K({tag_id:n.id});i&&(u(`您删除了标签名称为【${n.tag_name}】的这条数据`,{type:"success"}),o())}),openDialog:(n="新增",i)=>{var y;M({title:`${n}标签`,props:{formInline:{tag_name:(y=i==null?void 0:i.tag_name)!=null?y:""}},width:"40%",closeOnClickModal:!1,contentRenderer:()=>O(x,{ref:e,formInline:null}),beforeSure:(S,{options:D})=>{const q=e.value.getRef(),_=D.props.formInline;delete _.higherMenuOptions;const P=c=>g(this,null,function*(){const{code:v}=yield A(c);v?(u("新增成功",{type:"success"}),o(),S()):u("新增失败",{type:"error"})}),R=c=>g(this,null,function*(){const{code:v}=yield F(T(C({},c),{tag_id:i.id}));v?(u("修改成功",{type:"success"}),o(),S()):u("修改失败",{type:"error"})});q.validate(c=>{c&&(n==="新增"?P(_):R(_))})}})}}}export{G as useData};
|