import{d as M,u as E,v as L,o as Q,c as G,b as s,w as n,x as H,e as l,y as J,p as W,g as y,f as r,h as X,i as w,j as u,N as Y,B as z,k as f,z as Z,t as $,n as C,q as ee}from"./index-CkzfmDGw.js";import{u as N}from"./system-CZIyXjgT.js";import{S as te}from"./SearchOutline-BKr0yDBJ.js";import{R as ae}from"./RefreshOutline-DXhpU5zO.js";const se={class:"page-container"},ne={class:"search-form"},oe={class:"pagination-container",style:{display:"flex","justify-content":"flex-end","margin-top":"12px"}},de=M({__name:"index",setup(ie){const T=E(),x=L(),c=H(),D=e=>x.hasPermission(e),U=l([]),g=l([]),d=l(void 0);async function O(){try{const e=await J.deptTree();U.value=e}catch{}try{const e=await W.listByType("assets_state");g.value=e.map(t=>({label:t.dictLabel,value:Number(t.dictValue)||t.dictValue}))}catch{}}const o=y({username:"",status:null,userType:null}),k=y({...{id:null,deptId:null,deptName:"",username:"",password:"",nickname:"",avatar:"",email:"",phone:"",gender:null,status:0,assetsState:0,bankCard:"",bankOpenName:"",remark:"",userType:"",openId:"",isQuit:null,postNames:"",createTime:""}}),_=l([]),m=l(!1),h=l([]),a=y({page:1,pageSize:10,itemCount:0}),P=[{type:"selection"},{title:"用户名",key:"username",width:100},{title:"昵称",key:"nickname",width:100},{title:"姓名",key:"name",width:100},{title:"手机号",key:"phone",width:120,render(e){return e.phone||"-"}},{title:"银行卡号",key:"bankCard"},{title:"开户行名称",key:"bankOpenName"},{title:"资产人资图片",key:"assetsUrl",render(e){return e.assetsUrl?C("img",{src:e.assetsUrl,style:{width:"60px",height:"60px",objectFit:"cover",borderRadius:"4px"},onClick:()=>R(e.assetsUrl)}):"-"}},{title:"资产审核结果",key:"assetsState",render(e){return C(ee,{value:e.assetsState,"onUpdate:value":t=>{e.assetsState=t,Object.assign(k,e),V()},options:g.value,disabled:e.assetsState!==3||!D("biz:user:audit")})}},{title:"注册时间",key:"createTime",width:170}];async function p(){m.value=!0;try{const e=await N.page({page:a.page,pageSize:a.pageSize,username:o.username||void 0,status:o.status??void 0,userType:o.userType||void 0,deptId:d.value});_.value=e.list,a.itemCount=Number(e.total),console.log("Pagination updated:",a.itemCount)}catch{}finally{m.value=!1}}function R(e){console.log(e)}function v(){a.page=1,p()}function q(){o.username="",o.status=null,d.value=void 0,v()}function B(e){a.page=e,p()}function I(e){a.pageSize=e,a.page=1,p()}async function V(){try{const e={...k};e.id&&(await N.update1(e),T.success("修改成功")),p()}catch{}}return Q(()=>{const e=c.query.deptId;e&&(d.value=Number(e));const t=Array.isArray(c.query.userType)?c.query.userType[0]:c.query.userType;o.userType=t??null,O(),p()}),(e,t)=>{const j=r("n-input"),b=r("n-form-item"),S=r("n-icon"),A=r("n-form"),F=r("n-data-table"),K=r("n-card");return X(),G("div",se,[s(K,{class:"user-list-card",size:"small"},{default:n(()=>[w("div",ne,[s(A,{inline:"",model:o,"label-placement":"left"},{default:n(()=>[s(b,{label:"用户名"},{default:n(()=>[s(j,{value:o.username,"onUpdate:value":t[0]||(t[0]=i=>o.username=i),placeholder:"请输入用户名",clearable:""},null,8,["value"])]),_:1}),s(b,null,{default:n(()=>[s(u(Y),null,{default:n(()=>[s(u(z),{type:"primary",onClick:v},{icon:n(()=>[s(S,null,{default:n(()=>[s(u(te))]),_:1})]),default:n(()=>[t[4]||(t[4]=f(" 搜索 ",-1))]),_:1}),s(u(z),{onClick:q},{icon:n(()=>[s(S,null,{default:n(()=>[s(u(ae))]),_:1})]),default:n(()=>[t[5]||(t[5]=f(" 重置 ",-1))]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])]),s(F,{columns:P,data:_.value,loading:m.value,"row-key":i=>i.id,"checked-row-keys":h.value,"onUpdate:checkedRowKeys":t[1]||(t[1]=i=>h.value=i),remote:""},null,8,["data","loading","row-key","checked-row-keys"]),w("div",oe,[s(u(Z),{page:a.page,"onUpdate:page":[t[2]||(t[2]=i=>a.page=i),B],"page-size":a.pageSize,"onUpdate:pageSize":[t[3]||(t[3]=i=>a.pageSize=i),I],"item-count":a.itemCount,"page-sizes":[10,20,50,100],"show-size-picker":"","show-quick-jumper":""},{prefix:n(()=>[f(" 共 "+$(a.itemCount)+" 条 ",1)]),_:1},8,["page","page-size","item-count"])])]),_:1})])}}});export{de as default};
