Files
yusheng-admin/dist/static/js/hook-CrUUUJJN.js
2025-10-23 11:07:17 +08:00

2 lines
2.9 KiB
JavaScript

var $=Object.defineProperty,A=Object.defineProperties;var H=Object.getOwnPropertyDescriptors;var x=Object.getOwnPropertySymbols;var K=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var P=(a,t,n)=>t in a?$(a,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):a[t]=n,z=(a,t)=>{for(var n in t||(t={}))K.call(t,n)&&P(a,n,t[n]);if(x)for(var n of x(t))N.call(t,n)&&P(a,n,t[n]);return a},M=(a,t)=>A(a,H(t));var r=(a,t,n)=>new Promise((h,d)=>{var i=o=>{try{u(n.next(o))}catch(p){d(p)}},g=o=>{try{u(n.throw(o))}catch(p){d(p)}},u=o=>o.done?h(o.value):Promise.resolve(o.value).then(i,g);u((n=n.apply(a,t)).next())});import{_ as T}from"./form.vue_vue_type_script_setup_true_lang-DroLasXj.js";import{n as l,b as q,r as V,aK as j,ag as B,aA as m}from"./index-CRmU-Qpi.js";import{q as E,a as G,b as J,e as Q,f as U}from"./permission-DJnI7MjS.js";function te(){const a=l(),t=l(!0),n=l([]),h=l(!1),d=l([]),i=l({total:0,pageSize:10,pageSizes:[10,20,50,100],currentPage:1,background:!0}),g=l({title:"",isPlatform:""}),u=l([{label:"标题",prop:"title",type:"input"},{label:"来源",prop:"isPlatform",type:"select",optionList:[{label:"平台发布",value:1},{label:"其他平台",value:0}]}]),p=l([{type:"index",index:s=>s+1},{label:"角色名称",prop:"name",cellRenderer:({row:s,props:e})=>q("div",{innerHTML:s.name},null)},{label:"状态",prop:"status",cellRenderer:({row:s,props:e})=>q(V("el-tag"),{type:s.status==="hidden"?"info":"success"},{default:()=>[`${s.status==="hidden"?"隐藏":"正常"}`]})},{label:"操作",fixed:"right",width:210,slot:"operation"}]),c=()=>r(this,null,function*(){t.value=!0;const{data:s,code:e}=yield E();e&&(n.value=s.list,i.value.total=s.total,I()),t.value=!1}),I=()=>r(this,null,function*(){const{data:s,code:e}=yield G();e&&(d.value=s.rows),t.value=!1});return{searchForm:g,searchLabel:u,onSearch:c,isShow:h,tableList:n,tableLabel:p,pagination:i,handleSizeChange:s=>{i.value.pageSize=s,c()},handleCurrentChange:s=>{i.value.currentPage=s,c()},loading:t,openDialog:(s="新增",e)=>{var y,b,R,C;j({title:`${s}角色信息`,props:{formInline:{pid:(y=e==null?void 0:e.pid)!=null?y:0,name:(b=e==null?void 0:e.name)!=null?b:"",rules:(R=e==null?void 0:e.rules)!=null?R:"",status:(C=e==null?void 0:e.status)!=null?C:"normal"},higherMenuOptions:[...n.value],treeData:d},width:"40%",closeOnClickModal:!1,contentRenderer:()=>B(T,{ref:a,formInline:null}),beforeSure:(L,{options:_})=>{const k=a.value.getRef(),S=_.props.formInline,F=f=>r(this,null,function*(){const{code:v}=yield Q(f);v?(m("新增成功",{type:"success"}),c(),L()):m("新增失败",{type:"error"})}),O=f=>r(this,null,function*(){const{code:v}=yield U(M(z({},f),{id:e.id}));v?(m("修改成功",{type:"success"}),c(),L()):m("修改失败",{type:"error"})});k.validate(f=>{f&&(s==="新增"?F(S):O(S))})}})},handleDelete:s=>r(this,null,function*(){const{code:e}=yield J({ids:s.id});e&&(m("删除成功",{type:"success"}),c())})}}export{te as useData};