"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 BILL_collection_record_index_model = require("./model.js");
const gen_Enums = require("../../../gen/Enums.js");
const getList = () => {
  var _a, _b;
  gen_Apis.Apis.Collection.HouseCollectionTasks.List((_b = (_a = BILL_collection_record_index_model.useModel) == null ? void 0 : _a.formData) == null ? void 0 : _b.value).then((res) => {
    BILL_collection_record_index_model.useModel.dataList.value = [...BILL_collection_record_index_model.useModel.dataList.value, ...res == null ? void 0 : res.data];
    BILL_collection_record_index_model.useModel.meta.value = res == null ? void 0 : res.meta;
    console.log("登录", res == null ? void 0 : res.data);
  });
};
const getTaskRecords = (id) => {
  common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Collection.HouseCollectionRecords.GetTaskRecords, {
    collection_tasks_id: id
  }).then((res) => {
    BILL_collection_record_index_model.useModel.showDataTable.value = res == null ? void 0 : res.data;
  });
};
const method = {
  getList,
  changeTab(idx, e) {
    BILL_collection_record_index_model.useModel.tabCurrent.value = idx;
    BILL_collection_record_index_model.useModel.formData.value.status = e == null ? void 0 : e.value;
    BILL_collection_record_index_model.useModel.formData.value.page = 1;
    BILL_collection_record_index_model.useModel.dataList.value = [];
    getList();
  },
  load(e) {
    BILL_collection_record_index_model.useModel.formData.value.page = e == null ? void 0 : e.page;
    getList();
  },
  goDetail(e) {
    common_vendor.index.navigateTo({
      url: `/BILL/collection_record/show?id=${e == null ? void 0 : e.id}`
    });
  },
  getShow(id) {
    common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Collection.HouseCollectionTasks.Show, { id }).then((res) => {
      var _a;
      BILL_collection_record_index_model.useModel.showData.value = res == null ? void 0 : res.data;
      getTaskRecords((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.id);
    });
  },
  getTaskRecords,
  getShowChannel(list) {
    let enums = "";
    list == null ? void 0 : list.map((key) => {
      var _a;
      enums += key ? `${(_a = gen_Enums.HouseCollectionTasksChannelEnum[key]) == null ? void 0 : _a.text} ` : "";
    });
    return enums;
  }
};
exports.method = method;
