mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-08 09:27:19 +08:00
2 lines
2.8 KiB
JavaScript
2 lines
2.8 KiB
JavaScript
import{m as b}from"./message-7116a117.js";import{b as V}from"./system-c6c7f513.js";import"./index-8c77f9cd.js";import"./index-57451653.js";import"./_commonjsHelpers-042e6b4d.js";import"./hot-cf4dcfeb.js";import"./index-5e5694dd.js";import"./multiTags-d9cd5aad.js";import"./index-4b83e049.js";import"./index-2b23ea72.js";function k(){const o=Vue.reactive({username:"",mobile:"",status:""}),r=Vue.ref([]),n=Vue.ref(!0),a=Vue.ref({}),l=Vue.reactive({total:0,pageSize:10,currentPage:1,background:!0}),s=[{type:"selection",width:55,align:"left",hide:({checkList:e})=>!e.includes("勾选列")},{label:"序号",type:"index",width:70,hide:({checkList:e})=>!e.includes("序号列")},{label:"用户编号",prop:"id",minWidth:130},{label:"用户名称",prop:"username",minWidth:130},{label:"用户昵称",prop:"nickname",minWidth:130},{label:"性别",prop:"sex",minWidth:90,cellRenderer:({row:e,props:t})=>Vue.createVNode(Vue.resolveComponent("el-tag"),{size:t.size,type:e.sex===1?"danger":"",effect:"plain"},{default:()=>[e.sex===1?"女":"男"]})},{label:"部门",prop:"dept",minWidth:90,formatter:({dept:e})=>e.name},{label:"手机号码",prop:"mobile",minWidth:90},{label:"状态",prop:"status",minWidth:90,cellRenderer:e=>{var t;return Vue.createVNode(Vue.resolveComponent("el-switch"),{size:e.props.size==="small"?"small":"default",loading:(t=a.value[e.index])==null?void 0:t.loading,modelValue:e.row.status,"onUpdate:modelValue":v=>e.row.status=v,"active-value":1,"inactive-value":0,"active-text":"已开启","inactive-text":"已关闭","inline-prompt":!0,onChange:()=>m(e)},null)}},{label:"创建时间",minWidth:90,prop:"createTime",formatter:({createTime:e})=>dayjs(e).format("YYYY-MM-DD HH:mm:ss")},{label:"操作",fixed:"right",width:180,slot:"operation"}],u=Vue.computed(()=>["!h-[20px]","reset-margin","!text-gray-500","dark:!text-white","dark:hover:!text-primary"]);function m({row:e,index:t}){ElementPlus.ElMessageBox.confirm(`确认要<strong>${e.status===0?"停用":"启用"}</strong><strong style='color:var(--el-color-primary)'>${e.username}</strong>用户吗?`,"系统提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning",dangerouslyUseHTMLString:!0,draggable:!0}).then(()=>{a.value[t]=Object.assign({},a.value[t],{loading:!0}),setTimeout(()=>{a.value[t]=Object.assign({},a.value[t],{loading:!1}),b("已成功修改用户状态",{type:"success"})},300)}).catch(()=>{e.status===0?e.status=1:e.status=0})}function c(e){}function d(e){}function p(e){}function g(e){}function h(e){}async function i(){n.value=!0;const{data:e}=await V();r.value=e.list,l.total=e.total,setTimeout(()=>{n.value=!1},500)}const f=e=>{e&&(e.resetFields(),i())};return Vue.onMounted(()=>{i()}),{form:o,loading:n,columns:s,dataList:r,pagination:l,buttonClass:u,onSearch:i,resetForm:f,handleUpdate:c,handleDelete:d,handleSizeChange:p,handleCurrentChange:g,handleSelectionChange:h}}export{k as useUser};
|