"use strict";
const common_vendor = require("../../common/vendor.js");
const WORKORDER_list_log_model = require("./model.js");
const common_libraries_apiLoading = require("../../common/libraries/apiLoading.js");
const gen_Apis = require("../../gen/Apis.js");
const getList = () => {
  var _a, _b;
  common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.WorkOrder.HouseWorkOrders.MySubmitList, (_b = (_a = WORKORDER_list_log_model.useModel) == null ? void 0 : _a.formData) == null ? void 0 : _b.value).then(
    (res) => {
      var _a2, _b2;
      WORKORDER_list_log_model.useModel.dataList.value = [...(_b2 = (_a2 = WORKORDER_list_log_model.useModel) == null ? void 0 : _a2.dataList) == null ? void 0 : _b2.value, ...res == null ? void 0 : res.data];
      WORKORDER_list_log_model.useModel.meta.value = res == null ? void 0 : res.meta;
    }
  );
};
const handleSearch = () => {
  WORKORDER_list_log_model.useModel.formData.value.page = 1;
  WORKORDER_list_log_model.useModel.dataList.value = [];
  getList();
};
const method = {
  getList,
  handleToDetail(e) {
    common_vendor.index.navigateTo({
      url: `/WORKORDER/show_log/index?id=${e == null ? void 0 : e.id}`
    });
  },
  handleAdd() {
    common_vendor.index.navigateTo({
      url: "/WORKORDER/add/index"
    });
  },
  handleChangeTabs(idx, e) {
    WORKORDER_list_log_model.useModel.currentTabs.value = idx;
    WORKORDER_list_log_model.useModel.formData.value.type = e == null ? void 0 : e.value;
    handleSearch();
  },
  handleAssignEmployee(e) {
    if ((e == null ? void 0 : e.status) === "PendingAcceptance") {
      common_vendor.index.navigateTo({
        url: `/WORKORDER/acceptance/index?id=${e == null ? void 0 : e.id}`
      });
      return false;
    }
    console.log(e, "eee");
  },
  handleChangeStatus(e) {
    WORKORDER_list_log_model.useModel.formData.value.status = e == null ? void 0 : e.value;
    handleSearch();
  },
  handleLoad(page) {
    WORKORDER_list_log_model.useModel.formData.value.page = page;
    getList();
  }
};
exports.method = method;
