v1.2.1版本,优化调整了很多,整改验收阶段新加字段

This commit is contained in:
王利强
2026-06-13 08:50:51 +08:00
parent 2af9f1fd59
commit 1fe87ec438
591 changed files with 5072 additions and 2706 deletions

View File

@@ -103,7 +103,7 @@ const _sfc_main = {
executorList.value = res.data || [];
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:496", "获取部门用户失败:", error);
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:505", "获取部门用户失败:", error);
}
};
const toggleExecutorSelect = (item) => {
@@ -132,7 +132,7 @@ const _sfc_main = {
initDeptCascader(res.data);
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:534", "获取部门树失败:", error);
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:543", "获取部门树失败:", error);
}
};
const initDeptCascader = (data) => {
@@ -213,11 +213,22 @@ const _sfc_main = {
showEndDatePicker.value = false;
};
const manualCheckItems = common_vendor.ref([]);
const checkItems = common_vendor.ref([]);
const libraryCheckItems = common_vendor.ref([]);
const checkItemCount = common_vendor.computed(() => {
const libraryCount = checkItems.value.reduce((sum, item) => sum + item.count, 0);
return manualCheckItems.value.length + libraryCount;
return manualCheckItems.value.length + libraryCheckItems.value.length;
});
const getExistingPointIds = () => {
const ids = /* @__PURE__ */ new Set();
manualCheckItems.value.forEach((item) => {
if (item.id)
ids.add(Number(item.id));
});
libraryCheckItems.value.forEach((item) => {
if (item.pointId)
ids.add(Number(item.pointId));
});
return ids;
};
const deleteManualCheckItem = (item, index) => {
common_vendor.index.showModal({
title: "提示",
@@ -238,7 +249,7 @@ const _sfc_main = {
}
} catch (error) {
common_vendor.index.hideLoading();
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:681", "删除检查项失败:", error);
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:700", "删除检查项失败:", error);
common_vendor.index.showToast({ title: "删除失败", icon: "none" });
}
} else {
@@ -249,14 +260,14 @@ const _sfc_main = {
}
});
};
const deleteCheckItem = (index) => {
const deleteLibraryCheckItem = (index) => {
common_vendor.index.showModal({
title: "提示",
content: "确定要删除该检查项吗?",
confirmColor: "#F56C6C",
success: (res) => {
if (res.confirm) {
checkItems.value.splice(index, 1);
libraryCheckItems.value.splice(index, 1);
common_vendor.index.showToast({ title: "删除成功", icon: "success" });
}
}
@@ -314,7 +325,7 @@ const _sfc_main = {
hasMoreLaw.value = lawList.value.length < total;
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:768", "获取法规列表失败:", error);
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:787", "获取法规列表失败:", error);
} finally {
lawLoading.value = false;
}
@@ -394,7 +405,7 @@ const _sfc_main = {
}
} catch (error) {
common_vendor.index.hideLoading();
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:868", "添加检查项失败:", error);
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:887", "添加检查项失败:", error);
common_vendor.index.showToast({ title: "添加失败", icon: "none" });
}
};
@@ -443,7 +454,7 @@ const _sfc_main = {
hasMoreLibrary.value = libraryList.value.length < total;
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:928", "获取检查库列表失败:", error);
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:947", "获取检查库列表失败:", error);
} finally {
libraryLoading.value = false;
}
@@ -468,6 +479,61 @@ const _sfc_main = {
selectedLibraries.value.push(item.id);
}
};
const fetchLibraryDetailAll = async (libraryId) => {
const pageSize = 50;
let pageNum = 1;
let allRecords = [];
let total = 0;
while (true) {
const res = await request_api.getCheckItemListDetail({
id: libraryId,
pageNum,
pageSize
});
if (res.code !== 0 || !res.data)
break;
const records = res.data.records || [];
total = Number(res.data.total) || 0;
allRecords = [...allRecords, ...records];
if (records.length === 0 || allRecords.length >= total)
break;
pageNum += 1;
}
return allRecords;
};
const getLibraryDisplayName = (libraryId, records) => {
const library = libraryList.value.find((item) => String(item.id) === String(libraryId));
if (library == null ? void 0 : library.name)
return library.name;
if (records.length > 0)
return records[0].name || "";
return "";
};
const appendLibraryRecords = (libraryId, records, sourceLibraryName) => {
const existingPointIds = getExistingPointIds();
let addedCount = 0;
records.forEach((record) => {
if (!record.pointId)
return;
const pointId = Number(record.pointId);
if (existingPointIds.has(pointId))
return;
existingPointIds.add(pointId);
libraryCheckItems.value.push({
pointId,
itemId: record.itemId,
sourceLibraryId: libraryId,
sourceLibraryName,
name: record.name || "",
point: record.point || "",
industry: record.industry || "",
leadDept: record.leadDept || "",
regulation: record.regulation || ""
});
addedCount += 1;
});
return addedCount;
};
const addSelectedLibrary = async () => {
if (selectedLibraries.value.length === 0) {
common_vendor.index.showToast({ title: "请选择检查库", icon: "none" });
@@ -475,28 +541,23 @@ const _sfc_main = {
}
common_vendor.index.showLoading({ title: "加载中..." });
try {
let totalAdded = 0;
for (const id of selectedLibraries.value) {
const res = await request_api.getCheckItemListDetail({ id });
if (res.code === 0 && res.data) {
const records = res.data.records || [];
const total = res.data.total || 0;
const tableName = records.length > 0 ? records[0].name : "";
checkItems.value.push({
itemId: id,
tableName,
count: total,
details: records
// 保存详情数据,以便后续使用
});
}
const records = await fetchLibraryDetailAll(id);
const sourceLibraryName = getLibraryDisplayName(id, records);
totalAdded += appendLibraryRecords(id, records, sourceLibraryName);
}
common_vendor.index.hideLoading();
common_vendor.index.showToast({ title: "添加成功", icon: "success" });
if (totalAdded === 0) {
common_vendor.index.showToast({ title: "没有可添加的新检查项", icon: "none" });
return;
}
common_vendor.index.showToast({ title: `已添加${totalAdded}`, icon: "success" });
showLibraryPopup.value = false;
selectedLibraries.value = [];
} catch (error) {
common_vendor.index.hideLoading();
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:993", "获取检查库详情失败:", error);
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:1067", "获取检查库详情失败:", error);
common_vendor.index.showToast({ title: "添加失败", icon: "none" });
}
};
@@ -536,16 +597,12 @@ const _sfc_main = {
const items = [];
manualCheckItems.value.forEach((item) => {
if (item.id) {
items.push(item.id);
items.push(Number(item.id));
}
});
checkItems.value.forEach((lib) => {
if (lib.details && lib.details.length > 0) {
lib.details.forEach((detail) => {
if (detail.itemId) {
items.push(detail.itemId);
}
});
libraryCheckItems.value.forEach((item) => {
if (item.pointId) {
items.push(Number(item.pointId));
}
});
if (items.length === 0) {
@@ -562,12 +619,9 @@ const _sfc_main = {
"每月一次": 3,
"每季度一次": 4
};
const itemIds = [];
checkItems.value.forEach((lib) => {
if (lib.itemId) {
itemIds.push(lib.itemId);
}
});
const itemIds = [...new Set(
libraryCheckItems.value.map((item) => item.sourceLibraryId).filter(Boolean).map((id) => Number(id))
)];
const params = {
name: formData.name,
deptId: formData.deptId,
@@ -600,7 +654,7 @@ const _sfc_main = {
}
} catch (error) {
common_vendor.index.hideLoading();
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:1117", "保存失败:", error);
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:1185", "保存失败:", error);
common_vendor.index.showToast({ title: "保存失败", icon: "none" });
}
};
@@ -708,12 +762,14 @@ const _sfc_main = {
f: "manual-" + index
};
}),
ah: common_vendor.f(checkItems.value, (item, index, i0) => {
ah: common_vendor.f(libraryCheckItems.value, (item, index, i0) => {
return {
a: common_vendor.t(item.tableName),
b: common_vendor.t(item.count),
c: common_vendor.o(($event) => deleteCheckItem(index), "lib-" + index),
d: "lib-" + index
a: common_vendor.t(item.sourceLibraryName || "-"),
b: common_vendor.t(item.name),
c: common_vendor.t(item.point),
d: common_vendor.t(item.regulation || "-"),
e: common_vendor.o(($event) => deleteLibraryCheckItem(index), "lib-" + item.pointId),
f: "lib-" + item.pointId
};
}),
ai: common_vendor.o(($event) => showAddPopup.value = true),

File diff suppressed because one or more lines are too long

View File

@@ -135,10 +135,12 @@
.check-card .check-action .btn-delete.data-v-98282eb3::after {
border: none;
}
.manual-card.data-v-98282eb3 {
.manual-card.data-v-98282eb3,
.library-card.data-v-98282eb3 {
padding-top: 50rpx;
}
.manual-card .card-tag.data-v-98282eb3 {
.manual-card .card-tag.data-v-98282eb3,
.library-card .card-tag.data-v-98282eb3 {
position: absolute;
left: 0;
top: 0;
@@ -148,6 +150,9 @@
padding: 6rpx 20rpx;
border-radius: 0 0 12rpx 0;
}
.library-card .library-tag.data-v-98282eb3 {
background: #67C23A;
}
.add-btns.data-v-98282eb3 {
display: flex;
justify-content: space-between;