"use strict";const e=require("../../common/vendor.js"),o=require("../../common/libraries/apiLoading.js"),l=require("../../gen/Apis.js"),s=require("./model.js"),n=require("../../common/libraries/naviHelper.js");require("../../common/libraries/request.js");const i=require("../../common/store/useWeAppAuthStore.js"),u=require("../../common/store/useWorkStore.js"),a=require("../../common/libraries/userUserLogin.js");u.useWorkStore();const t=i.useWeAppAuthStore(),r=()=>{var e,n,i;if(!(null==(e=a.getUserLogin)?void 0:e.getLoginStatus()))return;console.log("getList",null==t?void 0:t.data);let u=[],r=[];o.getApiLoading(l.Apis.Archive.HouseOccupants.GetHouseOccupants,{...null==(i=null==(n=s.useModel)?void 0:n.formData)?void 0:i.value}).then((e=>{var o,l;s.useModel.showData.value=null==e?void 0:e.data,null==(l=null==(o=null==e?void 0:e.data)?void 0:o.list)||l.map((e=>{"Owner"===(null==e?void 0:e.house_relation)&&(null==u||u.push(e)),"NonOwner"===(null==e?void 0:e.house_relation)&&(null==r||r.push(e))})),s.useModel.listData.value=[{label:"产权人",list:u||[]},{label:"非产权人",list:r||[]}],console.log(e)}))},d={getList:r,handleSearch:()=>{s.useModel.showData.value={},s.useModel.formData.value.page=1,r()},handleLoadMore(e){s.useModel.formData.value.page=e,r()},handleUnbind(){var i,u,a,t;o.getApiLoading(l.Apis.Archive.HouseOccupants.Unbind,{asset_houses_id:null==(t=null==(a=null==(u=null==(i=s.useModel)?void 0:i.showData)?void 0:u.value)?void 0:a.house_relation)?void 0:t.asset_houses_id}).then((o=>{n.showToast("解绑成功！"),e.index.switchTab({url:"/pages/index/index"}),console.log(o)}))},hadnleNewBindingHouse(){var o;e.index.navigateTo({url:(null==(o=a.getUserLogin)?void 0:o.getLoginStatus())?"/INDEX/binding/index":"/pages/login"})},handleRemove(i){e.index.showModal({title:"提示",content:"确定要移除当前人员!",confirmColor:"#2A7EFB",success:function(e){var u,a,t,d;e.confirm?(o.getApiLoading(l.Apis.Archive.HouseOccupants.DeleteOccupant,{asset_houses_id:null==(d=null==(t=null==(a=null==(u=s.useModel)?void 0:u.showData)?void 0:a.value)?void 0:t.house_relation)?void 0:d.asset_houses_id,house_occupants_id:null==i?void 0:i.id}).then((e=>{r(),n.showToast("移除成功！"),console.log(e)})),console.log("用户点击确定")):e.cancel&&console.log("用户点击取消")}})}};exports.method=d;
