columns.389184.js 1.8 KB

1
  1. import{x as l,l as s,r as u,ae as c,be as i}from"./index.js";import{A as d,E as p}from"./index.29a6d90d.js";function h(){const t=l({}),r=l([{label:"\u7528\u6237\u7F16\u7801",prop:"id"},{label:"\u7528\u6237\u540D\u79F0",prop:"username"},{label:"\u7528\u6237\u6635\u79F0",prop:"nickname"},{label:"\u6027\u522B",prop:"sex",cellRenderer:({row:e,props:a})=>s(u("el-tag"),{size:a.size,type:e.sex===1?"danger":"",effect:"plain"},{default:()=>[e.sex===1?"\u5973":"\u7537"]})},{label:"\u90E8\u95E8",prop:"dept",formatter:({dept:e})=>e.name},{label:"\u624B\u673A\u53F7\u7801",prop:"mobile"},{label:"\u72B6\u6001",prop:"status",width:130,cellRenderer:e=>{var a;return s(d,{size:e.props.size==="small"?"small":"default",loading:(a=t.value[e.index])==null?void 0:a.loading,checked:e.row.status,"onUpdate:checked":o=>e.row.status=o,checkedValue:1,unCheckedValue:0,"checked-children":"\u5DF2\u5F00\u542F","un-checked-children":"\u5DF2\u5173\u95ED",onChange:()=>n(e)},null)}},{label:"\u521B\u5EFA\u65F6\u95F4",width:180,prop:"createTime",formatter:({createTime:e})=>c(e).format("YYYY-MM-DD HH:mm:ss")},{label:"\u64CD\u4F5C",fixed:"right",width:180,slot:"operation"}]);function n({row:e,index:a}){i.confirm(`\u786E\u8BA4\u8981<strong>${e.status===0?"\u505C\u7528":"\u542F\u7528"}</strong><strong style='color:var(--el-color-primary)'>${e.username}</strong>\u7528\u6237\u5417?`,"\u7CFB\u7EDF\u63D0\u793A",{confirmButtonText:"\u786E\u5B9A",cancelButtonText:"\u53D6\u6D88",type:"warning",dangerouslyUseHTMLString:!0,draggable:!0}).then(()=>{t.value[a]=Object.assign({},t.value[a],{loading:!0}),setTimeout(()=>{t.value[a]=Object.assign({},t.value[a],{loading:!1}),p.success("\u5DF2\u6210\u529F\u4FEE\u6539\u7528\u6237\u72B6\u6001")},300)}).catch(()=>{e.status===0?e.status=1:e.status=0})}return{columns:r}}export{h as useColumns};