import{r as e,B as l,Q as a,R as t,y as i}from"./element-plus-DSMJnpwa.js";import{d as u}from"./index-mv7arXuk.js";/* empty css                  */import{_ as n}from"./index-CY3mI-ZB.js";/* empty css                    *//* empty css                        */import{_ as o}from"./index-ppR_FSA-.js";/* empty css               */import{B as s,g as d,a4 as r,d as p,e as v,ag as c,H as g,L as m,F as f,G as y,P as _,M as h,O as b,Z as x,u as w,V as S,_ as j,Y as k,c as N,n as V}from"./vue-vendor-DZekML78.js";import{c as I}from"./index-C9waQ9oZ.js";const R={key:0,class:"defaultbox"},C={key:1,class:"overflow-auto overflow-hidden w-full text-ellipsis text-nowrap"},T={class:"dialog-footer flex flex-items-center flex-justify-between"},z=u(s({__name:"repairUser",props:{userid:{type:[String,Number],default:""},returnvalue:{type:String,default:"id"},titleName:{type:String,default:"选择维修人员"},userType:{type:String,default:"repair"},isMultiple:{type:Boolean,default:!1}},emits:["change"],setup(u,{expose:s,emit:z}){const{proxy:B}=d(),{com_resident_type:U}=r(B?.useDict("com_resident_type")),{com_certification_status:D}=r(B?.useDict("com_certification_status")),{sys_user_sex:M}=r(B?.useDict("sys_user_sex")),P=u,{userid:$,titleName:Q,userType:F,returnvalue:G}=r(P),H=z,L=p({dialogVisible:!1,dialogTitle:Q.value}),O=p({pageNum:1,pageSize:10,date:null,type:null,status:"",ownerRelationship:null,name:null,houseId:null,villageId:null,buildingId:null,unitNo:null}),Y=p(),Z=p([]),q=p(0),A=p(!1),E=p([]),J=N(()=>P.isMultiple??!1),K=()=>{if(!$.value||!Z.value.length)return;const e=Z.value.find(e=>e.userId==$.value);e&&!E.value.some(l=>l.id===e.id)&&(E.value=[e],V(()=>{Y.value?.setSelection([e])}))};function W(){L.value.dialogVisible=!0}function X(){A.value=!0,I(F.value).then(e=>{Z.value=e.data,q.value=e.total}).catch(e=>{}).finally(()=>{A.value=!1})}function ee(e){J.value&&(E.value=e)}function le(e){if(J.value){const l=E.value.findIndex(l=>l.id===e.id);l>-1?(E.value.splice(l,1),Y.value?.toggleRowSelection(e,!1)):(E.value.push(e),Y.value?.toggleRowSelection(e,!0))}else E.value=[e],Y.value?.setSelection([e])}function ae(){L.value.dialogVisible=!1,O.value={pageNum:1,pageSize:10,ownerRelationship:null,name:null,date:null,type:null,status:"",houseId:null,villageId:null,buildingId:null,unitNo:null},X()}function te(){L.value.dialogVisible=!1,E.value.length>0&&(J.value?"*"===G.value?H("change",E.value):H("change",E.value.map(e=>e[G.value])):"*"===G.value?H("change",E.value[0]):H("change",E.value[0][G.value]))}return v($,K,{immediate:!0}),v(Z,()=>{$.value&&K()}),X(),s({open:()=>{L.value.dialogVisible=!0}}),(u,s)=>{const d=c("Search"),r=e,p=t,v=o,N=a,V=n,I=i,z=l;return g(),m(f,null,[u.$slots.default?y(u.$slots,"default",{key:0},void 0,!0):(g(),m("div",{key:1,class:"residentBox",onClick:W},[0===E.value.length?(g(),m("div",R,[s[3]||(s[3]=_("span",null,"请选择",-1)),h(r,null,{default:b(()=>[h(d)]),_:1})])):(g(),m("div",C,[_("span",null,"姓名："+x(E.value[0]?.name),1)]))])),h(z,{"append-to-body":"",modelValue:L.value.dialogVisible,"onUpdate:modelValue":s[2]||(s[2]=e=>L.value.dialogVisible=e),title:L.value.dialogTitle,width:"1050"},{footer:b(()=>[_("div",T,[S(h(V,{style:{"margin-top":"0"},layout:"total, prev, pager, next, jumper",total:q.value,page:O.value.pageNum,"onUpdate:page":s[0]||(s[0]=e=>O.value.pageNum=e),limit:O.value.pageSize,"onUpdate:limit":s[1]||(s[1]=e=>O.value.pageSize=e),onPagination:X},null,8,["total","page","limit"]),[[j,q.value>0]]),_("div",null,[h(I,{onClick:ae},{default:b(()=>[...s[4]||(s[4]=[k("退出",-1)])]),_:1}),h(I,{type:"primary",onClick:te},{default:b(()=>[...s[5]||(s[5]=[k(" 确定 ",-1)])]),_:1})])])]),default:b(()=>[h(N,{onRowClick:le,ref_key:"multipleTableRef",ref:Y,data:Z.value,border:"",onSelectionChange:ee},{default:b(()=>[h(p,{type:"selection",width:"55",align:"center"}),h(p,{label:"序号",align:"center",width:"55",type:"index"}),h(p,{label:"姓名",align:"center",prop:"nickName"}),h(p,{label:"性别",align:"center",width:"85",prop:"sex"},{default:b(({row:e})=>[h(v,{options:w(M),value:e.sex},null,8,["options","value"])]),_:1}),h(p,{label:"角色",align:"center",width:"85",prop:"roleName"}),h(p,{label:"手机号码",align:"center",prop:"phonenumber"})]),_:1},8,["data"])]),_:1},8,["modelValue","title"])],64)}}}),[["__scopeId","data-v-637dd10c"]]);export{z as R};
