import{i as e,t}from"./react-B8IZ02wI.js";import{t as n}from"./button-DqbiydrF.js";import{t as r}from"./table-BvNKB5G4.js";import{t as i}from"./select-CDwQ-YxO.js";import{T as a,i as o}from"./authStore-BvQBJ9ky.js";import{On as s,at as c,gt as l,n as u,ut as d}from"./index-Bg7bo8aA.js";import{o as f}from"./fieldAccess-Ce4C729w.js";import{t as p}from"./RealNamePersonFormModal-BSMB2VI1.js";import{n as m}from"./listPagination-CK3zXfpl.js";import{n as h}from"./ListPageStats-WT5HFUip.js";import{t as g}from"./ListFieldCell-DGVaDsHy.js";import{t as _}from"./ListEmpty-Cu2dhr7C.js";import{a as v,o as y}from"./listFieldColumns-DiVqfOMb.js";var b=e(t(),1),x=u();function S(){let e=s(),[t,u]=(0,b.useState)({list:[],total:0}),[S,C]=(0,b.useState)(1),[w,T]=(0,b.useState)(20),[E,D]=(0,b.useState)(``),[O,k]=(0,b.useState)(),[A,j]=(0,b.useState)(!1),[M,N]=(0,b.useState)(null),[P,F]=(0,b.useState)(!1),I=f(`real_name.full_name`),L=f(`real_name.mobile`),R=f(`real_name.id_card_number`),z=o(e=>e.can),B=z(`real_name`,`create`),V=z(`real_name`,`update`),H=()=>{F(!0),a.list({page:S,size:w,keyword:E||void 0,status:O}).then(e=>{u(e.data)}).finally(()=>F(!1))};return(0,b.useEffect)(()=>{H()},[S,w,E,O]),(0,x.jsxs)(`div`,{className:`panel-proto`,children:[(0,x.jsx)(`div`,{className:`panel-proto-header`,children:(0,x.jsxs)(l,{className:`panel-proto-header-actions`,children:[(0,x.jsx)(d.Search,{placeholder:`搜索姓名/编号/手机`,allowClear:!0,onSearch:e=>{D(e),C(1)},style:{width:220}}),(0,x.jsx)(i,{allowClear:!0,placeholder:`状态`,style:{width:120},value:O,onChange:e=>{k(e),C(1)},options:[{value:`ACTIVE`,label:`正常`},{value:`INACTIVE`,label:`停用`}]}),B&&(0,x.jsx)(n,{type:`primary`,size:`small`,onClick:()=>{N(null),j(!0)},children:`+ 新增实名人`})]})}),(0,x.jsx)(`div`,{className:`panel-proto-body`,style:{padding:0},children:(0,x.jsx)(r,{size:`small`,rowKey:`id`,loading:P,dataSource:t.list,locale:_(`暂无实名人`),pagination:m({page:S,total:t.total,pageSize:w,onPageChange:C,onPageSizeChange:T,showTotal:h()}),columns:[{title:`编号`,dataIndex:`personCode`,render:(t,n)=>(0,x.jsx)(`a`,{onClick:()=>e(`/real-name-persons/${n.id}`),children:t})},...I?[{title:`姓名`,dataIndex:`fullName`,render:(t,n)=>(0,x.jsx)(`a`,{onClick:()=>e(`/real-name-persons/${n.id}`),children:(0,x.jsx)(g,{row:n,entity:`real_name`,resourceId:n.id,fieldKey:`real_name.full_name`,apiName:`fullName`,label:`姓名`})})}]:[],...L?[y()]:[],...R?[v()]:[],{title:`关系`,dataIndex:`relationLabel`,render:e=>e||`—`},{title:`关联员工`,dataIndex:`linkedUserName`,render:(t,n)=>t?(0,x.jsx)(`a`,{onClick:()=>e(`/users/${n.linkedUserId}`),children:t}):`—`},{title:`绑定`,render:(e,t)=>`${Number(t.accountBindings||0)} 账号 · ${Number(t.simBindings||0)} SIM`},{title:`关系备注`,dataIndex:`remark`,ellipsis:!0,render:e=>e||`—`},{title:`状态`,dataIndex:`status`,render:e=>(0,x.jsx)(c,{color:e===`ACTIVE`?`green`:`default`,children:e===`ACTIVE`?`正常`:e||`—`})},{title:`操作`,render:(t,r)=>(0,x.jsxs)(l,{size:0,children:[(0,x.jsx)(n,{type:`link`,size:`small`,onClick:()=>e(`/real-name-persons/${r.id}`),children:`详情`}),V&&(0,x.jsx)(n,{type:`link`,size:`small`,onClick:()=>{N(r),j(!0)},children:`编辑`})]})}]})}),(0,x.jsx)(p,{open:A,person:M,onClose:()=>{j(!1),N(null)},onSuccess:()=>H()})]})}export{S as default};