隐患详情重新设计,检查计划重新设计成做题排查式
This commit is contained in:
177
unpackage/dist/dev/mp-weixin/pages/index/index.js
vendored
177
unpackage/dist/dev/mp-weixin/pages/index/index.js
vendored
@@ -6,13 +6,16 @@ const request_three_one_api_info = require("../../request/three_one_api/info.js"
|
||||
const request_request = require("../../request/request.js");
|
||||
if (!Array) {
|
||||
const _easycom_u_navbar2 = common_vendor.resolveComponent("u-navbar");
|
||||
_easycom_u_navbar2();
|
||||
const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon");
|
||||
(_easycom_u_navbar2 + _easycom_u_icon2)();
|
||||
}
|
||||
const _easycom_u_navbar = () => "../../uni_modules/uview-plus/components/u-navbar/u-navbar.js";
|
||||
const _easycom_u_icon = () => "../../uni_modules/uview-plus/components/u-icon/u-icon.js";
|
||||
if (!Math) {
|
||||
_easycom_u_navbar();
|
||||
(_easycom_u_navbar + _easycom_u_icon)();
|
||||
}
|
||||
const defaultAvatar = "https://ossweb-img.qq.com/images/lol/web201310/skin/big99008.jpg";
|
||||
const PLAN_INITIAL_SIZE = 4;
|
||||
const _sfc_main = {
|
||||
__name: "index",
|
||||
setup(__props) {
|
||||
@@ -51,7 +54,7 @@ const _sfc_main = {
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
common_vendor.index.__f__("error", "at pages/index/index.vue:229", "获取用户信息失败:", e);
|
||||
common_vendor.index.__f__("error", "at pages/index/index.vue:245", "获取用户信息失败:", e);
|
||||
try {
|
||||
const storedUserInfo = common_vendor.index.getStorageSync("userInfo");
|
||||
if (storedUserInfo) {
|
||||
@@ -66,7 +69,7 @@ const _sfc_main = {
|
||||
userInfo.phone = info.phone || "";
|
||||
}
|
||||
} catch (storageError) {
|
||||
common_vendor.index.__f__("error", "at pages/index/index.vue:245", "从本地存储获取用户信息失败:", storageError);
|
||||
common_vendor.index.__f__("error", "at pages/index/index.vue:261", "从本地存储获取用户信息失败:", storageError);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -111,14 +114,41 @@ const _sfc_main = {
|
||||
}
|
||||
return allMenuList;
|
||||
});
|
||||
const ViewDetails = (item) => {
|
||||
const formatProgress = (progress) => {
|
||||
const num = Number(progress);
|
||||
if (Number.isNaN(num))
|
||||
return 0;
|
||||
return Math.min(100, Math.max(0, num));
|
||||
};
|
||||
const getTodayDateStr = () => {
|
||||
const date = /* @__PURE__ */ new Date();
|
||||
const y = date.getFullYear();
|
||||
const m = String(date.getMonth() + 1).padStart(2, "0");
|
||||
const d = String(date.getDate()).padStart(2, "0");
|
||||
return `${y}-${m}-${d}`;
|
||||
};
|
||||
const goTodayInspect = (item) => {
|
||||
const oneTableId = item.id;
|
||||
const taskDate = getTodayDateStr();
|
||||
const tableId = item.tableId ?? item.id;
|
||||
if (!oneTableId || !taskDate) {
|
||||
common_vendor.index.showToast({ title: "缺少任务参数", icon: "none" });
|
||||
return;
|
||||
}
|
||||
const name = item.name || "";
|
||||
const tableIdQuery = tableId ? `&tableId=${tableId}` : "";
|
||||
common_vendor.index.navigateTo({
|
||||
url: `/pages/plandetail/plandetail?id=${item.id}`
|
||||
url: `/pages/Inspectionresult/detail?oneTableId=${oneTableId}&taskDate=${encodeURIComponent(taskDate)}&name=${encodeURIComponent(name)}${tableIdQuery}`
|
||||
});
|
||||
};
|
||||
const goDetails = (item) => {
|
||||
const goPlanCheckList = (item) => {
|
||||
const tableId = item.tableId ?? item.id;
|
||||
if (!tableId) {
|
||||
common_vendor.index.showToast({ title: "缺少检查表ID", icon: "none" });
|
||||
return;
|
||||
}
|
||||
common_vendor.index.navigateTo({
|
||||
url: `/pages/Inspectionresult/Inspectionresult?id=${item.id}`
|
||||
url: `/pages/Inspectionresult/list?tableId=${tableId}&name=${encodeURIComponent(item.name || "")}`
|
||||
});
|
||||
};
|
||||
const handleMenuClick = (item) => {
|
||||
@@ -142,23 +172,78 @@ const _sfc_main = {
|
||||
};
|
||||
const checkPlanParams = common_vendor.ref({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
pageSize: PLAN_INITIAL_SIZE,
|
||||
name: ""
|
||||
});
|
||||
const checkPlanData = common_vendor.ref([]);
|
||||
const checkPlanTotal = common_vendor.ref(0);
|
||||
const planShowAll = common_vendor.ref(false);
|
||||
const expandedPlanMap = common_vendor.ref({});
|
||||
const hasMoreCheckPlans = common_vendor.computed(() => {
|
||||
return !planShowAll.value && checkPlanTotal.value > PLAN_INITIAL_SIZE;
|
||||
});
|
||||
const initPlanExpandedState = (records = [], { reset = false, expandFirst = false } = {}) => {
|
||||
const map = reset ? {} : { ...expandedPlanMap.value };
|
||||
records.forEach((item, index) => {
|
||||
if (reset) {
|
||||
map[item.id] = expandFirst && index === 0;
|
||||
} else if (!(item.id in map)) {
|
||||
map[item.id] = false;
|
||||
}
|
||||
});
|
||||
expandedPlanMap.value = map;
|
||||
};
|
||||
const isPlanExpanded = (id) => !!expandedPlanMap.value[id];
|
||||
const togglePlanExpand = (id) => {
|
||||
expandedPlanMap.value = {
|
||||
...expandedPlanMap.value,
|
||||
[id]: !expandedPlanMap.value[id]
|
||||
};
|
||||
};
|
||||
const getCheckPlanLists = async () => {
|
||||
var _a, _b;
|
||||
planShowAll.value = false;
|
||||
try {
|
||||
const res = await request_api.getCheckPlanList(checkPlanParams.value);
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:339", res);
|
||||
const res = await request_api.getCheckPlanList({
|
||||
pageNum: 1,
|
||||
pageSize: PLAN_INITIAL_SIZE,
|
||||
name: checkPlanParams.value.name
|
||||
});
|
||||
if (res.code === 0) {
|
||||
checkPlanData.value = res.data.records;
|
||||
const records = ((_a = res.data) == null ? void 0 : _a.records) || [];
|
||||
checkPlanTotal.value = Number(((_b = res.data) == null ? void 0 : _b.total) ?? records.length);
|
||||
checkPlanData.value = records;
|
||||
initPlanExpandedState(records, { reset: true, expandFirst: true });
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("error", "at pages/index/index.vue:344", error);
|
||||
common_vendor.index.__f__("error", "at pages/index/index.vue:431", error);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
const loadMoreCheckPlans = async () => {
|
||||
var _a;
|
||||
if (!hasMoreCheckPlans.value)
|
||||
return;
|
||||
try {
|
||||
const res = await request_api.getCheckPlanList({
|
||||
pageNum: 1,
|
||||
pageSize: checkPlanTotal.value,
|
||||
name: checkPlanParams.value.name
|
||||
});
|
||||
if (res.code === 0) {
|
||||
const records = ((_a = res.data) == null ? void 0 : _a.records) || [];
|
||||
initPlanExpandedState(records);
|
||||
checkPlanData.value = records;
|
||||
planShowAll.value = true;
|
||||
} else {
|
||||
common_vendor.index.showToast({ title: res.msg || "加载失败", icon: "none" });
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("error", "at pages/index/index.vue:454", error);
|
||||
common_vendor.index.showToast({ title: "加载失败", icon: "none" });
|
||||
}
|
||||
};
|
||||
const formatDate = (dateStr) => {
|
||||
if (!dateStr)
|
||||
return "";
|
||||
@@ -197,13 +282,13 @@ const _sfc_main = {
|
||||
const getHiddenDangerLists = async () => {
|
||||
try {
|
||||
const res = await request_api.getHiddenDangerList(hiddenDangerParams.value);
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:403", res);
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:512", res);
|
||||
if (res.code === 0) {
|
||||
hiddenDangerData.value = res.data.records;
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:406", hiddenDangerData.value, 1111);
|
||||
common_vendor.index.__f__("log", "at pages/index/index.vue:515", hiddenDangerData.value, 1111);
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("error", "at pages/index/index.vue:409", error);
|
||||
common_vendor.index.__f__("error", "at pages/index/index.vue:518", error);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
@@ -213,7 +298,7 @@ const _sfc_main = {
|
||||
});
|
||||
const viewHazardDetail = (item) => {
|
||||
common_vendor.index.navigateTo({
|
||||
url: `/pages/hiddendanger/view?hazardId=${item.hazardId}&assignId=${item.assignId}`
|
||||
url: `/pages/hiddendanger/detail2?hazardId=${item.hazardId}&assignId=${item.assignId || ""}`
|
||||
});
|
||||
};
|
||||
const goRectification = (item) => {
|
||||
@@ -237,7 +322,7 @@ const _sfc_main = {
|
||||
return common_vendor.e({
|
||||
a: common_assets._imports_0,
|
||||
b: common_vendor.p({
|
||||
title: "三查一曝光",
|
||||
title: "湘西州“三个一”安全管理平台",
|
||||
placeholder: false,
|
||||
fixed: false,
|
||||
safeAreaInsetTop: true,
|
||||
@@ -259,27 +344,39 @@ const _sfc_main = {
|
||||
}),
|
||||
g: checkPlanData.value.length === 0
|
||||
}, checkPlanData.value.length === 0 ? {} : {}, {
|
||||
h: common_vendor.f(checkPlanData.value, (item, index, i0) => {
|
||||
return common_vendor.e({
|
||||
h: common_vendor.f(checkPlanData.value, (item, k0, 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: item.finishedCount < item.totalCount
|
||||
}, item.finishedCount < item.totalCount ? {
|
||||
m: common_vendor.o(($event) => goDetails(item), item.id)
|
||||
} : {}, {
|
||||
n: item.id
|
||||
});
|
||||
b: "1cf27b2a-1-" + i0,
|
||||
c: common_vendor.p({
|
||||
name: isPlanExpanded(item.id) ? "arrow-down" : "arrow-up",
|
||||
color: "#ffffff",
|
||||
size: "18"
|
||||
}),
|
||||
d: common_vendor.o(($event) => togglePlanExpand(item.id), item.id),
|
||||
e: common_vendor.o(($event) => togglePlanExpand(item.id), item.id),
|
||||
f: common_vendor.t(item.runModeName),
|
||||
g: common_vendor.t(item.cycle),
|
||||
h: common_vendor.t(formatDate(item.planStartTime)),
|
||||
i: common_vendor.t(formatDate(item.planEndTime)),
|
||||
j: formatProgress(item.progress) + "%",
|
||||
k: common_vendor.t(formatProgress(item.progress)),
|
||||
l: common_vendor.t(item.pendingCount ?? 0),
|
||||
m: common_vendor.t(item.waitCheckNum ?? 0),
|
||||
n: common_vendor.t(item.unusualNum ?? 0),
|
||||
o: common_vendor.t(item.finishedCount ?? 0),
|
||||
p: common_vendor.o(($event) => goTodayInspect(item), item.id),
|
||||
q: common_vendor.o(($event) => goPlanCheckList(item), item.id),
|
||||
r: isPlanExpanded(item.id),
|
||||
s: !isPlanExpanded(item.id) ? 1 : "",
|
||||
t: item.id
|
||||
};
|
||||
}),
|
||||
i: common_vendor.f(dangerTabs.value, (tab, index, i0) => {
|
||||
i: hasMoreCheckPlans.value
|
||||
}, hasMoreCheckPlans.value ? {
|
||||
j: common_vendor.o(loadMoreCheckPlans)
|
||||
} : {}, {
|
||||
k: common_vendor.f(dangerTabs.value, (tab, index, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(tab.label),
|
||||
b: activeDangerTab.value === index ? 1 : "",
|
||||
@@ -287,9 +384,9 @@ const _sfc_main = {
|
||||
d: common_vendor.o(($event) => switchDangerTab(index), index)
|
||||
};
|
||||
}),
|
||||
j: filteredDangerData.value.length === 0
|
||||
l: filteredDangerData.value.length === 0
|
||||
}, filteredDangerData.value.length === 0 ? {} : {}, {
|
||||
k: common_vendor.f(filteredDangerData.value, (item, index, i0) => {
|
||||
m: common_vendor.f(filteredDangerData.value, (item, index, i0) => {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.t(item.title),
|
||||
b: common_vendor.t(item.levelName),
|
||||
@@ -316,7 +413,7 @@ const _sfc_main = {
|
||||
q: item.hazardId
|
||||
});
|
||||
}),
|
||||
l: common_vendor.gei(_ctx, "")
|
||||
n: common_vendor.gei(_ctx, "")
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user