"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_emergency_list_model = require("./model.js");
const getList = () => {
  var _a, _b;
  common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Emergency.EmergencyEvents.List, (_b = (_a = ME_emergency_list_model.useModel) == null ? void 0 : _a.formData) == null ? void 0 : _b.value).then((res) => {
    ME_emergency_list_model.useModel.listData.value = [...ME_emergency_list_model.useModel.listData.value, ...res == null ? void 0 : res.data];
    ME_emergency_list_model.useModel.metaData.value = res == null ? void 0 : res.meta;
  });
};
const handleSearch = () => {
  ME_emergency_list_model.useModel.formData.value.page = 1;
  ME_emergency_list_model.useModel.listData.value = [];
  getList();
};
const method = {
  getList,
  handleChangeTabs(idx, e) {
    handleSearch();
  },
  handleLoad(res) {
    ME_emergency_list_model.useModel.formData.value.page = res == null ? void 0 : res.page;
    getList();
  },
  handleAdd() {
    common_vendor.index.navigateTo({
      url: "/ME/emergency/add/index"
    });
  },
  onSearch() {
    handleSearch();
  },
  handleDetail(e) {
    common_vendor.index.navigateTo({
      url: `/ME/emergency/show/index?id=${e == null ? void 0 : e.id}`
    });
  }
};
exports.method = method;
