200 lines
6.4 KiB
JavaScript
200 lines
6.4 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const common_assets = require("../../common/assets.js");
|
|
const request_api = require("../../request/api.js");
|
|
const _sfc_main = {
|
|
__name: "index",
|
|
setup(__props) {
|
|
const loading = common_vendor.ref(true);
|
|
const userInfo = common_vendor.reactive({
|
|
userId: "",
|
|
username: "",
|
|
nickName: "",
|
|
deptId: "",
|
|
deptName: ""
|
|
});
|
|
const getUserInfo = () => {
|
|
try {
|
|
const storedUserInfo = common_vendor.index.getStorageSync("userInfo");
|
|
if (storedUserInfo) {
|
|
const info = JSON.parse(storedUserInfo);
|
|
userInfo.userId = info.userId || "";
|
|
userInfo.username = info.username || "";
|
|
userInfo.nickName = info.nickName || "";
|
|
userInfo.deptId = info.deptId || "";
|
|
userInfo.deptName = info.deptName || "";
|
|
}
|
|
} catch (e) {
|
|
console.error("获取用户信息失败:", e);
|
|
}
|
|
};
|
|
const infoList = common_vendor.ref([
|
|
{
|
|
name: "成员管理",
|
|
src: "../../static/组 19378.png"
|
|
},
|
|
{
|
|
name: "企业信息填报",
|
|
src: "../../static/组 19387.png"
|
|
},
|
|
{
|
|
name: "区域设置",
|
|
src: "../../static/组 20253.png"
|
|
},
|
|
{
|
|
name: "检查表",
|
|
src: "../../static/组 20254.png"
|
|
},
|
|
{
|
|
name: "检查记录",
|
|
src: "../../static/组 20255.png"
|
|
},
|
|
{
|
|
name: "证照管理",
|
|
src: "../../static/组 20256.png"
|
|
},
|
|
{
|
|
name: "隐患排查",
|
|
src: "../../static/组 20257.png"
|
|
},
|
|
{
|
|
name: "隐患销号申请",
|
|
src: "../../static/组 20258.png"
|
|
},
|
|
{
|
|
name: "设备登记",
|
|
src: "../../static/组 20259.png"
|
|
}
|
|
]);
|
|
const ViewDetails = (item) => {
|
|
common_vendor.index.navigateTo({
|
|
url: `/pages/plandetail/plandetail?id=${item.id}`
|
|
});
|
|
};
|
|
const goDetails = (item) => {
|
|
common_vendor.index.navigateTo({
|
|
url: `/pages/Inspectionresult/Inspectionresult?id=${item.id}`
|
|
});
|
|
};
|
|
const handleMenuClick = (item) => {
|
|
const menuRoutes = {
|
|
"成员管理": "/pages/membermanagemen/membermanagemen",
|
|
"企业信息填报": "/pages/corporateInformation/corporateInformation",
|
|
"区域设置": "/pages/area/management",
|
|
"检查表": "/pages/checklist/checklist",
|
|
"检查记录": "/pages/Inspectionlog/Inspectionlog",
|
|
"证照管理": "/pages/Idphotomanagement/Idphotomanagement",
|
|
"隐患排查": "/pages/hiddendanger/Inspection",
|
|
"隐患销号申请": "/pages/closeout/application",
|
|
"设备登记": "/pages/equipmentregistration/equipmentregistration"
|
|
// 可以在这里添加其他菜单的跳转路径
|
|
};
|
|
const url = menuRoutes[item.name];
|
|
if (url) {
|
|
common_vendor.index.navigateTo({ url });
|
|
} else {
|
|
common_vendor.index.showToast({ title: "功能开发中", icon: "none" });
|
|
}
|
|
};
|
|
const checkPlanParams = common_vendor.ref({
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
name: ""
|
|
});
|
|
const checkPlanData = common_vendor.ref([]);
|
|
const getCheckPlanLists = async () => {
|
|
try {
|
|
const res = await request_api.getCheckPlanList(checkPlanParams.value);
|
|
console.log(res);
|
|
if (res.code === 0) {
|
|
checkPlanData.value = res.data.records;
|
|
}
|
|
} catch (error) {
|
|
console.error(error);
|
|
} finally {
|
|
loading.value = false;
|
|
}
|
|
};
|
|
const formatDate = (dateStr) => {
|
|
if (!dateStr)
|
|
return "";
|
|
return dateStr.split(" ")[0];
|
|
};
|
|
common_vendor.onLoad(() => {
|
|
getUserInfo();
|
|
getCheckPlanLists();
|
|
});
|
|
const hiddenDangerParams = common_vendor.ref({
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
name: ""
|
|
});
|
|
const hiddenDangerData = common_vendor.ref([]);
|
|
const getHiddenDangerLists = async () => {
|
|
try {
|
|
const res = await request_api.getHiddenDangerList(hiddenDangerParams.value);
|
|
console.log(res);
|
|
if (res.code === 0) {
|
|
hiddenDangerData.value = res.data.records;
|
|
console.log(hiddenDangerData.value, 1111);
|
|
}
|
|
} catch (error) {
|
|
console.error(error);
|
|
} finally {
|
|
loading.value = false;
|
|
}
|
|
};
|
|
common_vendor.onLoad(() => {
|
|
getHiddenDangerLists();
|
|
});
|
|
return (_ctx, _cache) => {
|
|
return common_vendor.e({
|
|
a: common_vendor.t(userInfo.deptName || "未知部门"),
|
|
b: common_vendor.t(userInfo.nickName || userInfo.username || "未登录"),
|
|
c: common_vendor.f(infoList.value, (item, index, i0) => {
|
|
return {
|
|
a: item.src,
|
|
b: common_vendor.t(item.name),
|
|
c: index,
|
|
d: common_vendor.o(($event) => handleMenuClick(item), index)
|
|
};
|
|
}),
|
|
d: checkPlanData.value.length === 0
|
|
}, checkPlanData.value.length === 0 ? {} : {}, {
|
|
e: common_vendor.f(checkPlanData.value, (item, index, i0) => {
|
|
return {
|
|
a: common_vendor.t(item.name),
|
|
b: common_vendor.t(item.runModeName),
|
|
c: common_vendor.t(item.cycle),
|
|
d: common_vendor.t(formatDate(item.planStartTime)),
|
|
e: common_vendor.t(formatDate(item.planEndTime)),
|
|
f: item.progress + "%",
|
|
g: common_vendor.t(item.progress),
|
|
h: common_vendor.t(item.totalCount),
|
|
i: common_vendor.t(item.totalCount - item.finishedCount),
|
|
j: common_vendor.t(item.finishedCount),
|
|
k: common_vendor.o(($event) => ViewDetails(item), item.id),
|
|
l: common_vendor.o(($event) => goDetails(item), item.id),
|
|
m: item.id
|
|
};
|
|
}),
|
|
f: common_assets._imports_0,
|
|
g: common_vendor.f(hiddenDangerData.value, (item, index, i0) => {
|
|
return {
|
|
a: common_vendor.t(item.title),
|
|
b: common_vendor.t(item.source),
|
|
c: common_vendor.t(item.address),
|
|
d: common_vendor.t(item.levelName),
|
|
e: common_vendor.t(item.statusName),
|
|
f: common_vendor.t(item.createdAt),
|
|
g: item.id,
|
|
h: common_vendor.o(($event) => _ctx.HazardList(), item.id)
|
|
};
|
|
})
|
|
});
|
|
};
|
|
}
|
|
};
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-1cf27b2a"]]);
|
|
wx.createPage(MiniProgramPage);
|