"use strict";
require("../../common/libraries/request.js");
require("../../common/store/useWatermarkStore.js");
const common_store_useWeAppAuthStore = require("../../common/store/useWeAppAuthStore.js");
require("../../common/store/useWorkStore.js");
const common_libraries_apiLoading = require("../../common/libraries/apiLoading.js");
const gen_Apis = require("../../gen/Apis.js");
const pages_index_model = require("./model.js");
const auth = common_store_useWeAppAuthStore.useWeAppAuthStore();
const getCompanyEmployeeBacklogs = () => {
  var _a, _b;
  common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Company.CompanyEmployeeBacklogs.List, (_b = (_a = pages_index_model.useModel) == null ? void 0 : _a.formData) == null ? void 0 : _b.value).then((res) => {
    var _a2, _b2;
    pages_index_model.useModel.listData.value = [...(_b2 = (_a2 = pages_index_model.useModel) == null ? void 0 : _a2.listData) == null ? void 0 : _b2.value, ...res == null ? void 0 : res.data];
    pages_index_model.useModel.metaData.value = res == null ? void 0 : res.meta;
    console.log(pages_index_model.useModel.metaData.value, "useModel.metaData.value");
  });
};
const method = {
  getCountGridHouse() {
    common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Grid.Grids.CountGridHouse, {}).then((res) => {
      pages_index_model.useModel.userData.value = res.data;
      console.log(res);
    });
  },
  getCompanyEmployeeBacklogs,
  loadMore(res) {
    pages_index_model.useModel.formData.value.page = res == null ? void 0 : res.page;
    getCompanyEmployeeBacklogs();
  },
  async uploadMedia(data) {
    let res = await gen_Apis.Apis.Customer.CustomerMoments.UploadMedia(data);
    return res == null ? void 0 : res.data;
  },
  getIndexCount() {
    common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Count.CommonCount.IndexCount, {}).then((res) => {
      pages_index_model.useModel.IndexCount.value = res.data;
      console.log(res);
    });
  },
  getPageRole() {
    var _a, _b, _c;
    pages_index_model.useModel.loadingPage.value = true;
    pages_index_model.useModel.pageRole.value = ((_c = (_b = (_a = auth == null ? void 0 : auth.data) == null ? void 0 : _a.permissions) == null ? void 0 : _b.find((item) => (item == null ? void 0 : item.key) === "home")) == null ? void 0 : _c.children) || [];
    console.log(pages_index_model.useModel.pageRole.value, "useModel.pageRole.value");
  }
};
exports.method = method;
