"use strict";
const common_vendor = require("../../../common/vendor.js");
const common_libraries_apiLoading = require("../../../common/libraries/apiLoading.js");
const gen_Apis = require("../../../gen/Apis.js");
const pages_public_asset_houses_model = require("./model.js");
const common_libraries_naviHelper = require("../../../common/libraries/naviHelper.js");
require("../../../common/libraries/request.js");
require("../../../common/store/useWatermarkStore.js");
require("../../../common/store/useWeAppAuthStore.js");
const common_store_useWorkStore = require("../../../common/store/useWorkStore.js");
const common_libraries_userUserLogin = require("../../../common/libraries/userUserLogin.js");
const work = common_store_useWorkStore.useWorkStore();
const getHouseList = () => {
  var _a, _b, _c;
  if (!((_a = common_libraries_userUserLogin.getUser) == null ? void 0 : _a.getLoginStatus()))
    return;
  common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Grid.Grids.GridSelectHouse, (_c = (_b = pages_public_asset_houses_model.useModel) == null ? void 0 : _b.formData) == null ? void 0 : _c.value).then((res) => {
    pages_public_asset_houses_model.useModel.dataList.value = res == null ? void 0 : res.data;
    console.log(res);
  });
};
const method = {
  getHouseList,
  // getHouseRegistersList,
  handleLoadMore(page) {
    pages_public_asset_houses_model.useModel.formData.value.page = page;
    if (pages_public_asset_houses_model.useModel.currentTabs.value === 0) {
      getHouseList();
    }
  },
  handleSelectedHouse(e) {
    var _a, _b;
    pages_public_asset_houses_model.useModel.selectedHouseEd.value = { id: e == null ? void 0 : e.value };
    if (((_b = (_a = pages_public_asset_houses_model.useModel) == null ? void 0 : _a.selectType) == null ? void 0 : _b.value) === "work_add") {
      work.selectWorkHouse = e;
      common_libraries_naviHelper.showToastBack("选择成功！", 1, true);
      return;
    }
  },
  hadnleNewBindingHouse() {
    var _a;
    common_vendor.index.navigateTo({
      url: ((_a = common_libraries_userUserLogin.getUser) == null ? void 0 : _a.getLoginStatus()) ? "/INDEX/binding/index" : "/pages/login"
    });
  },
  handleQueryHouseArchives(e) {
    common_vendor.index.navigateTo({
      url: `/INDEX/archive_houses/index?id=${e == null ? void 0 : e.asset_houses_id}`
    });
  }
};
exports.method = method;
