2026-05-28 09:48:42 +08:00

88 lines
4.1 KiB
JavaScript

"use strict";
const common_vendor = require("../../../common/vendor.js");
require("../../../common/libraries/request.js");
require("../../../common/store/useWatermarkStore.js");
require("../../../common/store/useWeAppAuthStore.js");
const common_store_useWorkStore = require("../../../common/store/useWorkStore.js");
const common_libraries_apiLoading = require("../../../common/libraries/apiLoading.js");
const common_libraries_naviHelper = require("../../../common/libraries/naviHelper.js");
const common_libraries_userUserLogin = require("../../../common/libraries/userUserLogin.js");
const gen_Apis = require("../../../gen/Apis.js");
const pages_public_asset_houses_model = require("./model.js");
const work = common_store_useWorkStore.useWorkStore();
const getHouseList = () => {
var _a, _b, _c;
if (!((_a = common_libraries_userUserLogin.getUser) == null ? void 0 : _a.getLoginStatus()))
return;
common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Asset.AssetHouses.SelectHouse, (_c = (_b = pages_public_asset_houses_model.useModel) == null ? void 0 : _b.formData) == null ? void 0 : _c.value).then((res) => {
pages_public_asset_houses_model.useModel.dataList.value = res == null ? void 0 : res.data;
console.log(res);
});
};
const getProjectList = () => {
var _a, _b, _c;
if (!((_a = common_libraries_userUserLogin.getUser) == null ? void 0 : _a.getLoginStatus()))
return;
common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Asset.AssetHouses.SelectPermissionProject, (_c = (_b = pages_public_asset_houses_model.useModel) == null ? void 0 : _b.formData) == null ? void 0 : _c.value).then((res) => {
var _a2, _b2, _c2;
pages_public_asset_houses_model.useModel.dataList.value = res == null ? void 0 : res.data;
if (((_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.length) === 1 && pages_public_asset_houses_model.useModel.formData.value.page === 1) {
common_vendor.index.navigateTo({
url: `/ME/instrument/list/index?id=${(_c2 = (_b2 = res == null ? void 0 : res.data) == null ? void 0 : _b2[0]) == null ? void 0 : _c2.id}`
});
}
console.log(res);
});
};
const method = {
getHouseList,
getProjectList,
// getHouseRegistersList,
handleLoadMore(page) {
var _a, _b, _c, _d;
pages_public_asset_houses_model.useModel.formData.value.page = page;
if (((_b = (_a = pages_public_asset_houses_model.useModel) == null ? void 0 : _a.selectType) == null ? void 0 : _b.value) === "work_add") {
getHouseList();
}
if (((_d = (_c = pages_public_asset_houses_model.useModel) == null ? void 0 : _c.selectType) == null ? void 0 : _d.value) === "meter") {
getProjectList();
}
},
onSearch() {
var _a, _b, _c, _d;
pages_public_asset_houses_model.useModel.formData.value.page = 1;
if (((_b = (_a = pages_public_asset_houses_model.useModel) == null ? void 0 : _a.selectType) == null ? void 0 : _b.value) === "work_add") {
getHouseList();
}
if (((_d = (_c = pages_public_asset_houses_model.useModel) == null ? void 0 : _c.selectType) == null ? void 0 : _d.value) === "meter") {
getProjectList();
}
},
handleSelectedHouse(e) {
var _a, _b;
pages_public_asset_houses_model.useModel.selectedHouseEd.value = { id: e == null ? void 0 : e.id };
if (((_b = (_a = pages_public_asset_houses_model.useModel) == null ? void 0 : _a.selectType) == null ? void 0 : _b.value) === "work_add") {
work.selectWorkHouse = e;
common_libraries_naviHelper.showToastBack("选择成功!", 1, true);
return;
}
},
handleSelectedProject(e) {
common_vendor.index.navigateTo({
url: `/ME/instrument/list/index?id=${e == null ? void 0 : e.id}`
});
},
hadnleNewBindingHouse() {
var _a;
common_vendor.index.navigateTo({
url: ((_a = common_libraries_userUserLogin.getUser) == null ? void 0 : _a.getLoginStatus()) ? "/INDEX/binding/index" : "/pages/login"
});
},
handleQueryHouseArchives(e) {
common_vendor.index.navigateTo({
url: `/INDEX/archive_houses/index?id=${e == null ? void 0 : e.asset_houses_id}`
});
}
};
exports.method = method;