"use strict";const e=require("../../common/vendor.js"),s=require("../../common/libraries/apiLoading.js"),o=require("../../gen/Apis.js"),u=require("./model.js"),i=require("../../common/libraries/naviHelper.js");require("../../common/libraries/request.js");const l=require("../../common/store/useWeAppAuthStore.js"),a=require("../../common/store/useWorkStore.js"),t=require("../../common/libraries/userUserLogin.js"),d=a.useWorkStore(),n=l.useWeAppAuthStore(),r=()=>{var e,i,l;(null==(e=t.getUserLogin)?void 0:e.getLoginStatus())&&s.getApiLoading(o.Apis.Archive.HouseOccupants.List,null==(l=null==(i=u.useModel)?void 0:i.formData)?void 0:l.value).then((e=>{u.useModel.dataList.value=[...u.useModel.dataList.value,...null==e?void 0:e.data],u.useModel.meta.value=null==e?void 0:e.meta,console.log(e)}))},v=()=>{var e,i,l;(null==(e=t.getUserLogin)?void 0:e.getLoginStatus())&&s.getApiLoading(o.Apis.Archive.HouseRegisters.List,{...null==(l=null==(i=u.useModel)?void 0:i.formData)?void 0:l.value,status:"Pending"}).then((e=>{u.useModel.dataList.value=[...u.useModel.dataList.value,...null==e?void 0:e.data],u.useModel.meta.value=null==e?void 0:e.meta,console.log(e)}))},g={getHouseList:r,getHouseRegistersList:v,handleLoadMore(e){u.useModel.formData.value.page=e,0===u.useModel.currentTabs.value&&r(),1===u.useModel.currentTabs.value&&v()},handleSelectedHouse(e){var l,a,t;if("work_add"===(null==(a=null==(l=u.useModel)?void 0:l.selectType)?void 0:a.value))return d.selectWorkHouse=e,void i.showToastBack("选择成功！",1,!0);(null==e?void 0:e.asset_houses_id)!==(null==(t=u.useModel.selectedHouseEd.value)?void 0:t.id)?(u.useModel.selectedHouseEd.value={id:null==e?void 0:e.asset_houses_id},s.getApiLoading(o.Apis.Archive.HouseOccupants.UpdateSelectedHouse,{asset_houses_id:null==e?void 0:e.asset_houses_id}).then((e=>{null==n||n.me((()=>{i.showToastBack("选择成功！",1,!0)})),console.log(e)}))):i.showToast("已是该房屋！")},hadnleNewBindingHouse(){var s;e.index.navigateTo({url:(null==(s=t.getUserLogin)?void 0:s.getLoginStatus())?"/INDEX/binding/index":"/pages/login"})},handleQueryHouseArchives(s){e.index.navigateTo({url:`/INDEX/archive_houses/index?id=${null==s?void 0:s.asset_houses_id}`})}};exports.method=g;
