import{i as e,t}from"./react-B8IZ02wI.js";import{t as n}from"./switch-DhBIfeVT.js";import{T as r}from"./authStore-BvQBJ9ky.js";import{ct as i,n as a,pt as o,st as s,ut as c}from"./index-Bg7bo8aA.js";import{a as l}from"./fieldAccess-Ce4C729w.js";import{t as u}from"./DictSelect-C1YarcTG.js";import{t as d}from"./UserSelect-DwxgSkKp.js";var f=e(t(),1),p=a();function m({open:e,person:t,defaultLinkedUserId:a,onClose:m,onSuccess:h}){let[g]=o.useForm(),[_,v]=(0,f.useState)(!1),y=!!t,b=l(`real_name.full_name`),x=l(`real_name.mobile`),S=l(`real_name.id_card_number`),C=l(`real_name.bank_card_number`),w=l(`real_name.bank_reserved_mobile`);return(0,f.useEffect)(()=>{e&&(t?g.setFieldsValue({full_name:t.fullName,mobile:t.mobile,id_card_valid_from:t.idCardValidFrom,id_card_valid_to:t.idCardValidTo,id_card_long_term:t.idCardLongTerm,bank_name:t.bankName,bank_reserved_mobile:t.bankReservedMobile,relation_to_company:t.relationToCompany,linked_user_id:t.linkedUserId,status:t.status||`ACTIVE`,remark:t.remark}):(g.resetFields(),g.setFieldsValue({status:`ACTIVE`,id_card_long_term:!1,linked_user_id:a,relation_to_company:a?`SELF`:void 0})))},[e,t,a,g]),(0,p.jsx)(s,{title:y?`编辑实名人`:`新增实名人`,open:e,onCancel:m,onOk:()=>g.submit(),confirmLoading:_,okButtonProps:{disabled:_},width:640,destroyOnHidden:!0,children:(0,p.jsxs)(o,{form:g,layout:`vertical`,onFinish:async e=>{if(!_){v(!0);try{if(y){let{id_card_number:n,bank_card_number:a,...o}=e,s={...o};n&&(s.id_card_number=n),a&&(s.bank_card_number=a);let c=await r.update(t.id,s);i.success(`实名人已更新`),h(c.data)}else{let t=await r.create(e);i.success(`实名人已创建`),h(t.data)}m()}catch(e){i.error(e instanceof Error?e.message:`保存失败`)}finally{v(!1)}}},children:[(0,p.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:12},children:[(0,p.jsx)(o.Item,{name:`full_name`,label:`姓名`,rules:[{required:!0}],children:(0,p.jsx)(c,{disabled:!b})}),(0,p.jsx)(o.Item,{name:`mobile`,label:`联系电话（本人手机）`,children:(0,p.jsx)(c,{placeholder:`非号码池手机号`,disabled:!x})}),(0,p.jsx)(o.Item,{name:`id_card_number`,label:`身份证号码`,extra:y?`留空表示不修改`:`加密存储`,children:(0,p.jsx)(c.Password,{placeholder:y?`留空不修改`:``,disabled:!S})}),(0,p.jsx)(o.Item,{name:`relation_to_company`,label:`与公司关系`,children:(0,p.jsx)(u,{dictCode:`real_name_relation`,allowClear:!0})}),(0,p.jsx)(o.Item,{name:`id_card_valid_from`,label:`身份证有效期起`,children:(0,p.jsx)(c,{type:`date`})}),(0,p.jsx)(o.Item,{name:`id_card_valid_to`,label:`身份证有效期止`,children:(0,p.jsx)(c,{type:`date`})}),(0,p.jsx)(o.Item,{name:`id_card_long_term`,label:`长期有效`,valuePropName:`checked`,children:(0,p.jsx)(n,{})}),(0,p.jsx)(o.Item,{name:`linked_user_id`,label:`关联员工（若本人是员工）`,children:(0,p.jsx)(d,{placeholder:`选择员工`})}),(0,p.jsx)(o.Item,{name:`bank_card_number`,label:`银行卡号`,extra:y?`留空表示不修改`:`加密存储`,children:(0,p.jsx)(c.Password,{placeholder:y?`留空不修改`:``,disabled:!C})}),(0,p.jsx)(o.Item,{name:`bank_name`,label:`开户行`,children:(0,p.jsx)(c,{})}),(0,p.jsx)(o.Item,{name:`bank_reserved_mobile`,label:`银行预留手机号`,children:(0,p.jsx)(c,{disabled:!w})})]}),(0,p.jsx)(o.Item,{name:`remark`,label:`关系备注说明`,extra:`可说明该实名人与公司、员工的具体关系，如亲属关系、代实名原因、解绑注意事项等`,children:(0,p.jsx)(c.TextArea,{rows:5,placeholder:`例如：赵六表姐，代其本人实名抖音号以防离职解绑；解绑需本人到场…`,showCount:!0,maxLength:2e3})})]})})}export{m as t};