"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 INDEX_owner_audit_list_model = require("./model.js");
const getOwnerAuditList = () => {
  var _a, _b;
  common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Archive.HouseRegisters.OwnerAuditList, (_b = (_a = INDEX_owner_audit_list_model.useModel) == null ? void 0 : _a.formData) == null ? void 0 : _b.value).then((res) => {
    INDEX_owner_audit_list_model.useModel.dataList.value = [...INDEX_owner_audit_list_model.useModel.dataList.value, ...res == null ? void 0 : res.data];
    INDEX_owner_audit_list_model.useModel.meta.value = res == null ? void 0 : res.meta;
    console.log(res);
  });
};
const getHouseRegisters = () => {
  var _a, _b;
  common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Archive.HouseRegisters.List, (_b = (_a = INDEX_owner_audit_list_model.useModel) == null ? void 0 : _a.formData) == null ? void 0 : _b.value).then((res) => {
    INDEX_owner_audit_list_model.useModel.dataList.value = [...INDEX_owner_audit_list_model.useModel.dataList.value, ...res == null ? void 0 : res.data];
    INDEX_owner_audit_list_model.useModel.meta.value = res == null ? void 0 : res.meta;
    console.log(res);
  });
};
const handleSrarch = () => {
  INDEX_owner_audit_list_model.useModel.dataList.value = [];
  INDEX_owner_audit_list_model.useModel.formData.value.page = 1;
  if (INDEX_owner_audit_list_model.useModel.currentTabs.value === 0) {
    getOwnerAuditList();
  }
  if (INDEX_owner_audit_list_model.useModel.currentTabs.value === 1) {
    getHouseRegisters();
  }
};
const method = {
  getOwnerAuditList,
  handleSrarch,
  getHouseRegisters,
  handleLoadMore(page) {
    INDEX_owner_audit_list_model.useModel.formData.value.page = page;
    if (INDEX_owner_audit_list_model.useModel.currentTabs.value === 0) {
      getOwnerAuditList();
    }
    if (INDEX_owner_audit_list_model.useModel.currentTabs.value === 1) {
      getHouseRegisters();
    }
  },
  handleAudit(e) {
    common_vendor.index.showModal({
      title: "提示",
      content: "请仔细确认好注册用户信息！",
      confirmText: "通过",
      confirmColor: "#2A7EFB",
      success: function(res) {
        if (res.confirm) {
          common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Archive.HouseRegisters.Audit, {
            status: "Approved",
            id: e == null ? void 0 : e.id
          }).then((res2) => {
            handleSrarch();
            console.log(res2);
          });
          console.log("用户点击确定");
        } else if (res.cancel) {
          console.log("用户点击取消");
        }
      }
    });
  }
};
exports.method = method;
