"use strict";
const common_vendor = require("../../common/vendor.js");
const CUSTOMER_list_house_model = require("./model.js");
const gen_Apis = require("../../gen/Apis.js");
const common_libraries_apiLoading = require("../../common/libraries/apiLoading.js");
require("../../common/libraries/userUserLogin.js");
const getList = () => {
  var _a, _b;
  common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Grid.Grids.GridAssetHouse, (_b = (_a = CUSTOMER_list_house_model.useModel) == null ? void 0 : _a.formData) == null ? void 0 : _b.value).then((res) => {
    CUSTOMER_list_house_model.useModel.listData.value = (res == null ? void 0 : res.data) || [];
    CUSTOMER_list_house_model.useModel.metaData.value = (res == null ? void 0 : res.meta) || {};
    console.log(res);
  });
};
const handleSearch = () => {
  CUSTOMER_list_house_model.useModel.formData.value.page = 1;
  CUSTOMER_list_house_model.useModel.listData.value = [];
  getList();
};
const method = {
  handleChangeBuilding(e) {
    if ((e == null ? void 0 : e.id) !== CUSTOMER_list_house_model.useModel.formData.value.asset_buildings_id) {
      CUSTOMER_list_house_model.useModel.formData.value.asset_buildings_id = e == null ? void 0 : e.id;
      handleSearch();
    }
    console.log(e, "e");
  },
  getGridAssetBuilding() {
    common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Grid.Grids.GridAssetBuilding, {}).then((res) => {
      var _a, _b;
      CUSTOMER_list_house_model.useModel.buildingData.value = (res == null ? void 0 : res.data) || [];
      if ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.length) {
        CUSTOMER_list_house_model.useModel.formData.value.asset_buildings_id = (_b = res == null ? void 0 : res.data[0]) == null ? void 0 : _b.id;
        getList();
      }
      console.log(res);
    });
  },
  handleSearch,
  toDetaile(e) {
    common_vendor.index.navigateTo({
      url: `/BILL/outstanding_fee/show/index?id=${e == null ? void 0 : e.id}`
    });
  }
};
exports.method = method;
