"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 ME_instrument_log_model = require("./model.js");
const getList = () => {
  var _a, _b;
  common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Meter.HouseMeterReadings.List, (_b = (_a = ME_instrument_log_model.useModel) == null ? void 0 : _a.formData) == null ? void 0 : _b.value).then((res) => {
    ME_instrument_log_model.useModel.listData.value = [...ME_instrument_log_model.useModel.listData.value, ...res == null ? void 0 : res.data];
    ME_instrument_log_model.useModel.metaData.value = res == null ? void 0 : res.meta;
  });
};
const handleTabSearch = () => {
  ME_instrument_log_model.useModel.formData.value.page = 1;
  ME_instrument_log_model.useModel.listData.value = [];
  getList();
};
const method = {
  getList,
  handleSearch() {
    handleTabSearch();
  },
  handleChangeTabs(idx, e) {
    ME_instrument_log_model.useModel.currentTabs.value = idx;
    ME_instrument_log_model.useModel.formData.value.meter_type = e == null ? void 0 : e.value;
    handleTabSearch();
  },
  handleLoad(page) {
    ME_instrument_log_model.useModel.formData.value.page = page;
    getList();
  },
  handleChangeFilter(e) {
    ME_instrument_log_model.useModel.formData.value = {
      ...ME_instrument_log_model.useModel.formData.value,
      ...e,
      pahe: 1
    };
    ME_instrument_log_model.useModel.listData.value = [];
    getList();
  },
  handleToDetail(e) {
    common_vendor.index.navigateTo({
      url: `/ME/instrument/log_show/index?id=${e == null ? void 0 : e.id}`
    });
  }
};
exports.method = method;
