From db4baa7759b46a23faa3ff536220aa255542af59 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期一, 25 五月 2026 13:31:49 +0800
Subject: [PATCH] OA审批的修改中的附件列表没有带出来
---
src/views/officeProcessAutomation/ApproveManage/approve-shared/approvalInstanceFormConfigTable.js | 58 +++-----------
src/views/officeProcessAutomation/ApproveManage/approve-list/approveListConstants.js | 125 +++++++-----------------------
src/views/officeProcessAutomation/ApproveManage/approve-list/components/ApproveDetailPanel.vue | 15 ++-
3 files changed, 54 insertions(+), 144 deletions(-)
diff --git a/src/views/officeProcessAutomation/ApproveManage/approve-list/approveListConstants.js b/src/views/officeProcessAutomation/ApproveManage/approve-list/approveListConstants.js
index ea61076..3251f0c 100644
--- a/src/views/officeProcessAutomation/ApproveManage/approve-list/approveListConstants.js
+++ b/src/views/officeProcessAutomation/ApproveManage/approve-list/approveListConstants.js
@@ -1,21 +1,7 @@
-import {
- createEmptyNode,
- formatDisplayTime,
- mapNodesFromApi,
- mapSignModeFromApi,
- mapSignModeToApi,
- normalizeFlowNodes,
- nodeSignModeLabel,
-} from "../approve-template/approveTemplateConstants.js";
+import { createEmptyNode, formatDisplayTime, mapNodesFromApi, mapSignModeFromApi, mapSignModeToApi, normalizeFlowNodes, nodeSignModeLabel } from "../approve-template/approveTemplateConstants.js";
import { buildFormPayloadFromFields, parseFormConfigToData } from "../approve-template/formConfigUtils.js";
-import {
- isDynamicOptionSource,
- resolveSelectDisplayLabel,
-} from "../approve-template/selectOptionSource.js";
-import {
- appendDotNotationQuery,
- buildApprovalInstanceSearchDto,
-} from "../approve-shared/approvalInstanceListSearch.js";
+import { isDynamicOptionSource, resolveSelectDisplayLabel } from "../approve-template/selectOptionSource.js";
+import { appendDotNotationQuery, buildApprovalInstanceSearchDto } from "../approve-shared/approvalInstanceListSearch.js";
/** 瀹℃壒绫诲瀷锛堜笌鍚庣瀛楁 approvalType 瀵归綈锛屽悗鏈熷彲鍚屾锛� */
export const APPROVAL_TYPE_OPTIONS = [
@@ -80,24 +66,11 @@
if (upper === "APPROVED" || upper === "APPROVE" || upper === "PASS" || upper === "AGREE") {
return "approved";
}
- if (
- upper === "REJECTED" ||
- upper === "REJECT" ||
- upper === "REFUSE" ||
- upper === "REFUSED" ||
- upper === "DENIED"
- ) {
+ if (upper === "REJECTED" || upper === "REJECT" || upper === "REFUSE" || upper === "REFUSED" || upper === "DENIED") {
return "rejected";
}
if (upper === "CANCELLED" || upper === "CANCEL" || upper === "REVOKED") return "cancelled";
- if (
- upper === "PENDING" ||
- upper === "IN_PROGRESS" ||
- upper === "PROCESSING" ||
- upper === "RUNNING" ||
- upper === "WAIT" ||
- upper === "WAITING"
- ) {
+ if (upper === "PENDING" || upper === "IN_PROGRESS" || upper === "PROCESSING" || upper === "RUNNING" || upper === "WAIT" || upper === "WAITING") {
return "pending";
}
if (s.includes("鑽夌")) return "draft";
@@ -134,13 +107,9 @@
}
const tasks = row.tasks;
if (Array.isArray(tasks) && tasks.length) {
- const rejected = tasks.some((t) =>
- normalizeApprovalStatusKey(t?.status ?? t?.taskStatus) === "rejected"
- );
+ const rejected = tasks.some(t => normalizeApprovalStatusKey(t?.status ?? t?.taskStatus) === "rejected");
if (rejected) return "REJECTED";
- const allApproved = tasks.every((t) =>
- normalizeApprovalStatusKey(t?.status ?? t?.taskStatus) === "approved"
- );
+ const allApproved = tasks.every(t => normalizeApprovalStatusKey(t?.status ?? t?.taskStatus) === "approved");
if (allApproved) return "APPROVED";
}
return "";
@@ -175,7 +144,7 @@
/** 鍚庣 records 鈫� 鏃堕棿绾垮睍绀虹粨鏋� */
export function mapRecordsFromApi(records) {
const list = Array.isArray(records) ? records : [];
- return list.map((r) => ({
+ return list.map(r => ({
id: r.id,
operatorName: r.approverName || r.operatorName || r.createUserName || "",
result: mapRecordResultFromApi(r.approveAction ?? r.action ?? r.status),
@@ -198,7 +167,7 @@
const list = Array.isArray(tasks) ? tasks : [];
if (!list.length) return [];
const byLevel = new Map();
- list.forEach((t) => {
+ list.forEach(t => {
const level = Number(t.levelNo ?? t.taskLevel ?? t.nodeOrder ?? 1);
if (!byLevel.has(level)) {
byLevel.set(level, {
@@ -226,16 +195,14 @@
node.signMode = mapSignModeFromApi(t.approveType);
}
});
- return [...byLevel.entries()]
- .sort(([a], [b]) => a - b)
- .map(([, node]) => node);
+ return [...byLevel.entries()].sort(([a], [b]) => a - b).map(([, node]) => node);
}
/** 椤甸潰 flowNodes 鈫� 鍚庣 tasks */
export function mapFlowNodesToTasks(flowNodes, { instanceId, templateId } = {}) {
const nodes = normalizeFlowNodes(flowNodes);
const tasks = [];
- nodes.forEach((n) => {
+ nodes.forEach(n => {
const levelNo = n.nodeOrder ?? 1;
const approveType = mapSignModeToApi(n.signMode);
n.approvers.forEach((a, idx) => {
@@ -278,7 +245,7 @@
return String(val);
}
if (field?.type === "select" && field.options?.length) {
- const hit = field.options.find((o) => String(o.value) === String(val));
+ const hit = field.options.find(o => String(o.value) === String(val));
return hit?.label || String(val);
}
if (Array.isArray(val)) return val.join(" 鑷� ");
@@ -298,8 +265,8 @@
};
if (!fields.length && Object.keys(formPayload).length) {
fields = Object.keys(formPayload)
- .filter((k) => k && k !== "summary")
- .map((k) => ({
+ .filter(k => k && k !== "summary")
+ .map(k => ({
key: k,
label: k,
type: guessFieldTypeFromValue(formPayload[k]),
@@ -366,11 +333,7 @@
export function buildInstanceDto({ submitForm, activeTemplate, userStore, flowNodes, existingRow }) {
const payload = submitForm?.formPayload || {};
const tpl = activeTemplate || {};
- const title =
- String(payload.summary || payload.title || "").trim() ||
- tpl.label ||
- submitForm?.templateName ||
- "瀹℃壒鐢宠";
+ const title = String(payload.summary || payload.title || "").trim() || tpl.label || submitForm?.templateName || "瀹℃壒鐢宠";
const templateId = submitForm?.templateId || tpl.templateId;
const instanceId = existingRow?.id ?? submitForm?.instanceId;
const taskList = mapFlowNodesToTasks(flowNodes || submitForm?.flowNodes, {
@@ -388,20 +351,13 @@
tasks: taskList,
};
- const attachments =
- (Array.isArray(submitForm?.storageBlobDTOs) && submitForm.storageBlobDTOs.length
- ? submitForm.storageBlobDTOs
- : null) || tpl.storageBlobDTOs;
+ const attachments = (Array.isArray(submitForm?.storageBlobDTOs) && submitForm.storageBlobDTOs.length ? submitForm.storageBlobDTOs : null) || tpl.storageBlobDTOs;
if (attachments?.length) dto.storageBlobDTOs = attachments;
if (isUpdate) {
dto.id = existingRow?.id ?? submitForm?.instanceId;
dto.instanceNo = existingRow?.instanceNo ?? submitForm?.instanceNo ?? "";
- dto.status =
- submitForm?.saveStatusApi ||
- existingRow?.statusRaw ||
- mapInstanceStatusToApi(existingRow?.approvalStatus) ||
- "PENDING";
+ dto.status = submitForm?.saveStatusApi || existingRow?.statusRaw || mapInstanceStatusToApi(existingRow?.approvalStatus) || "PENDING";
dto.currentLevel = existingRow?.currentLevel ?? submitForm?.currentLevel ?? 1;
dto.applicantId = existingRow?.applicantId ?? existingRow?.applicantNo;
dto.applicantName = existingRow?.applicantName || "";
@@ -440,7 +396,7 @@
/** 椤甸潰 approvalStatus 鈫� 鍚庣 status */
export function mapInstanceStatusToApi(approvalStatus) {
const key = normalizeApprovalStatusKey(approvalStatus);
- const hit = APPROVAL_STATUS_OPTIONS.find((x) => x.value === key);
+ const hit = APPROVAL_STATUS_OPTIONS.find(x => x.value === key);
return hit?.api || "PENDING";
}
@@ -463,9 +419,7 @@
const resolved = resolveInstanceFormFields(row);
const { fields, formPayload, templateSnapshot } = resolved;
const tasks = Array.isArray(row.tasks) ? row.tasks : [];
- const flowNodes = tasks.length
- ? mapTasksToFlowNodes(tasks)
- : mapNodesFromApi(row.nodes || row.flowNodes);
+ const flowNodes = tasks.length ? mapTasksToFlowNodes(tasks) : mapNodesFromApi(row.nodes || row.flowNodes);
const approvalRecords = mapRecordsFromApi(row.records);
return {
id: row.id,
@@ -497,12 +451,12 @@
tasks,
records: Array.isArray(row.records) ? row.records : [],
storageBlobVOList: row.storageBlobVOList || [],
+ storageBlobDTOs: row.storageBlobVOList || row.storageBlobDTOs || [],
flowNodes,
approvalFlowNodes: [],
currentNodeIndex: 0,
approvalRecords,
- rejectReason:
- approvalRecords.find((r) => r.result === "rejected")?.opinion || "",
+ rejectReason: approvalRecords.find(r => r.result === "rejected")?.opinion || "",
};
}
@@ -525,12 +479,7 @@
};
}
-export function buildApprovalInstanceListParams({
- page,
- searchForm,
- businessType,
- extraParams,
-}) {
+export function buildApprovalInstanceListParams({ page, searchForm, businessType, extraParams }) {
const dto = buildApprovalInstanceSearchDto(searchForm, extraParams);
const bizType = businessType ?? searchForm?.businessType;
if (bizType != null && bizType !== "") {
@@ -549,11 +498,11 @@
}
export function approvalTypeLabel(v) {
- return APPROVAL_TYPE_OPTIONS.find((x) => x.value === v)?.label || v || "鈥�";
+ return APPROVAL_TYPE_OPTIONS.find(x => x.value === v)?.label || v || "鈥�";
}
export function approvalTypeStyle(v) {
- const hit = APPROVAL_TYPE_OPTIONS.find((x) => x.value === v);
+ const hit = APPROVAL_TYPE_OPTIONS.find(x => x.value === v);
if (!hit) return {};
return {
backgroundColor: hit.cellBg,
@@ -564,7 +513,7 @@
export function approvalStatusLabel(v) {
const key = normalizeApprovalStatusKey(v);
- return APPROVAL_STATUS_OPTIONS.find((x) => x.value === key)?.label || "鈥�";
+ return APPROVAL_STATUS_OPTIONS.find(x => x.value === key)?.label || "鈥�";
}
/** 涓氬姟鐢宠椤电姸鎬佹枃妗堬細PENDING鈫掕繘琛屼腑 APPROVED鈫掑凡瀹屾垚 REJECTED鈫掑凡椹冲洖 */
@@ -583,9 +532,7 @@
* 杩涜涓�(PENDING)銆佸凡瀹屾垚(APPROVED) 涓嶅彲淇敼锛涘凡椹冲洖銆佸凡鎾ら攢绛夊彲淇敼
*/
export function canEditBusinessInstanceRow(row) {
- const key = normalizeApprovalStatusKey(
- row?.approvalStatus ?? row?.statusRaw ?? row?.status
- );
+ const key = normalizeApprovalStatusKey(row?.approvalStatus ?? row?.statusRaw ?? row?.status);
return key !== "pending" && key !== "approved";
}
@@ -610,12 +557,8 @@
/** 鍒楄〃琛� 鈫� 缂栬緫琛ㄥ崟锛堜粎鐢ㄨ鏁版嵁鍥炴樉锛� */
export function buildEditFormFromInstanceRow(row) {
const { fields, formPayload, templateSnapshot } = resolveInstanceFormFields(row);
- const normalized = normalizeFlowNodes(
- row?.flowNodes?.length ? row.flowNodes : mapTasksToFlowNodes(row?.tasks)
- );
- const flowNodes = normalized.length
- ? JSON.parse(JSON.stringify(normalized))
- : [createEmptyNode(1)];
+ const normalized = normalizeFlowNodes(row?.flowNodes?.length ? row.flowNodes : mapTasksToFlowNodes(row?.tasks));
+ const flowNodes = normalized.length ? JSON.parse(JSON.stringify(normalized)) : [createEmptyNode(1)];
return {
templateKey: String(row?.templateId || ""),
@@ -632,9 +575,7 @@
formPayload,
flowNodes,
templateAttachments: initTemplateAttachmentsFromSnapshot(templateSnapshot),
- storageBlobDTOs: row?.storageBlobDTOs?.length
- ? JSON.parse(JSON.stringify(row.storageBlobDTOs))
- : [],
+ storageBlobDTOs: (row?.storageBlobDTOs?.length ? row.storageBlobDTOs : row?.storageBlobVOList || []).map(f => JSON.parse(JSON.stringify(f))),
};
}
@@ -642,9 +583,7 @@
const tpl = templateOverride || null;
const payload = tpl?.fields?.length ? buildFormPayloadFromFields(tpl.fields) : { summary: "" };
const normalized = normalizeFlowNodes(flowNodesOverride);
- const flowNodes = normalized.length
- ? JSON.parse(JSON.stringify(normalized))
- : [createEmptyNode(1)];
+ const flowNodes = normalized.length ? JSON.parse(JSON.stringify(normalized)) : [createEmptyNode(1)];
return {
templateKey: templateKey || "",
templateId: tpl?.templateId || "",
@@ -659,9 +598,7 @@
formFieldDefs: tpl?.fields || [],
formPayload: payload,
flowNodes,
- templateAttachments: tpl?.storageBlobDTOs
- ? JSON.parse(JSON.stringify(tpl.storageBlobDTOs))
- : [],
+ templateAttachments: tpl?.storageBlobDTOs ? JSON.parse(JSON.stringify(tpl.storageBlobDTOs)) : [],
storageBlobDTOs: [],
};
}
diff --git a/src/views/officeProcessAutomation/ApproveManage/approve-list/components/ApproveDetailPanel.vue b/src/views/officeProcessAutomation/ApproveManage/approve-list/components/ApproveDetailPanel.vue
index 6b18f8f..721a5c2 100644
--- a/src/views/officeProcessAutomation/ApproveManage/approve-list/components/ApproveDetailPanel.vue
+++ b/src/views/officeProcessAutomation/ApproveManage/approve-list/components/ApproveDetailPanel.vue
@@ -39,11 +39,11 @@
:form-payload="formResolved.formPayload"
readonly />
</div>
- <div v-if="row.storageBlobVOList && row.storageBlobVOList.length"
+ <div v-if="attachmentList.length"
class="detail-block">
<div class="detail-block-title">闄勪欢鍒楄〃</div>
<div class="attachment-list">
- <div v-for="file in row.storageBlobVOList"
+ <div v-for="file in attachmentList"
:key="file.id"
class="attachment-item">
<el-icon class="file-icon">
@@ -54,11 +54,11 @@
{{ file.name || file.originalFilename }}
</span>
<div class="file-actions">
- <el-link v-if="file.previewURL"
+ <el-link v-if="file.previewURL || file.url"
type="primary"
:underline="false"
- @click="openFile(file.previewURL)">棰勮</el-link>
- <el-divider v-if="file.previewURL && file.downloadURL"
+ @click="openFile(file.previewURL || file.url)">棰勮</el-link>
+ <el-divider v-if="(file.previewURL || file.url) && file.downloadURL"
direction="vertical" />
<el-link v-if="file.downloadURL"
type="primary"
@@ -90,6 +90,11 @@
const formResolved = computed(() => resolveInstanceFormFields(props.row));
+ const attachmentList = computed(() => {
+ const list = props.row.storageBlobVOList || props.row.storageBlobDTOs || [];
+ return Array.isArray(list) ? list : [];
+ });
+
function openFile(url) {
if (!url) return;
window.open(url, "_blank");
diff --git a/src/views/officeProcessAutomation/ApproveManage/approve-shared/approvalInstanceFormConfigTable.js b/src/views/officeProcessAutomation/ApproveManage/approve-shared/approvalInstanceFormConfigTable.js
index 0251647..d6bec18 100644
--- a/src/views/officeProcessAutomation/ApproveManage/approve-shared/approvalInstanceFormConfigTable.js
+++ b/src/views/officeProcessAutomation/ApproveManage/approve-shared/approvalInstanceFormConfigTable.js
@@ -1,25 +1,9 @@
import { computed } from "vue";
-import {
- businessApprovalStatusLabel,
- businessApprovalStatusTagType,
- formatFieldDisplayValue,
- resolveInstanceFormFields,
-} from "../approve-list/approveListConstants.js";
-import {
- INSTANCE_NO_SEARCH_MODULE_KEYS,
- INSTANCE_NO_TABLE_COLUMN,
-} from "./approvalInstanceListSearch.js";
+import { businessApprovalStatusLabel, businessApprovalStatusTagType, formatFieldDisplayValue, resolveInstanceFormFields } from "../approve-list/approveListConstants.js";
+import { INSTANCE_NO_SEARCH_MODULE_KEYS, INSTANCE_NO_TABLE_COLUMN } from "./approvalInstanceListSearch.js";
/** 鍒楄〃/璇︽儏涓嶅洖鏄句负鐙珛鍒楃殑濉姤椤� key锛堥伩鍏嶈鐩栧疄渚嬬郴缁熷瓧娈碉級 */
-const DEFAULT_EXCLUDE_KEYS = new Set([
- "summary",
- "status",
- "approvalStatus",
- "approvalstatus",
- "instanceStatus",
- "publishStatus",
- "newsStatus",
-]);
+const DEFAULT_EXCLUDE_KEYS = new Set(["summary", "status", "approvalStatus", "approvalstatus", "instanceStatus", "publishStatus", "newsStatus"]);
/** enrich 鍚庡繀椤讳繚鐣欑殑瀹炰緥瀛楁锛堜笉琚� formConfig 閾哄钩瑕嗙洊锛� */
const PRESERVE_INSTANCE_FIELDS = [
@@ -44,6 +28,8 @@
"unread",
"currentLevel",
"newsStatus",
+ "storageBlobVOList",
+ "storageBlobDTOs",
];
/**
@@ -64,14 +50,8 @@
if (!f?.key || DEFAULT_EXCLUDE_KEYS.has(f.key)) continue;
const val = formPayload[f.key];
let text = formatFieldDisplayValue(f, val, caches);
- if (
- text === String(val) &&
- row?.applicantName &&
- (f.label === "鐢宠浜�" || f.key === "applicant" || f.key === "applicantName")
- ) {
- const idMatch =
- String(val) === String(row.applicantId) ||
- String(val) === String(row.applicantNo);
+ if (text === String(val) && row?.applicantName && (f.label === "鐢宠浜�" || f.key === "applicant" || f.key === "applicantName")) {
+ const idMatch = String(val) === String(row.applicantId) || String(val) === String(row.applicantNo);
if (idMatch) text = row.applicantName;
}
formDisplay[f.key] = text;
@@ -89,10 +69,8 @@
* 浠庡垪琛ㄩ琛� formConfig 鐢熸垚涓昏〃鍔ㄦ�佸垪锛坙abel 鍙栬嚜妯℃澘瀛楁 label锛�
*/
export function getFormConfigFieldColumns(firstRow, { excludeKeys = DEFAULT_EXCLUDE_KEYS } = {}) {
- const fields = (firstRow?.formFieldDefs || []).filter(
- (f) => f?.key && !excludeKeys.has(f.key)
- );
- return fields.map((f) => ({
+ const fields = (firstRow?.formFieldDefs || []).filter(f => f?.key && !excludeKeys.has(f.key));
+ return fields.map(f => ({
label: f.label || f.key,
prop: f.key,
minWidth: f.type === "textarea" ? 200 : f.type === "datetimerange" ? 160 : 120,
@@ -104,19 +82,9 @@
* 涓氬姟鐢宠涓昏〃鍒楋細鍥哄畾鍒� + formConfig 鍔ㄦ�佸垪 + 瀹℃壒鐘舵�� + 鎿嶄綔
*/
export function buildInstanceTableColumns(tableDataRef, buildTableActions, options = {}) {
- const {
- moduleKey,
- excludeKeys = DEFAULT_EXCLUDE_KEYS,
- beforeFormColumns = [],
- extraColumns = [],
- afterFormColumns = [],
- actionWidth = 260,
- } = options;
+ const { moduleKey, excludeKeys = DEFAULT_EXCLUDE_KEYS, beforeFormColumns = [], extraColumns = [], afterFormColumns = [], actionWidth = 260 } = options;
- const leadingCols =
- moduleKey && INSTANCE_NO_SEARCH_MODULE_KEYS.has(moduleKey)
- ? [INSTANCE_NO_TABLE_COLUMN]
- : [];
+ const leadingCols = moduleKey && INSTANCE_NO_SEARCH_MODULE_KEYS.has(moduleKey) ? [INSTANCE_NO_TABLE_COLUMN] : [];
return computed(() => {
const formCols = getFormConfigFieldColumns(tableDataRef.value?.[0], { excludeKeys });
@@ -132,8 +100,8 @@
prop: "approvalStatus",
width: 110,
dataType: "tag",
- formatData: (v) => businessApprovalStatusLabel(v),
- formatType: (v) => businessApprovalStatusTagType(v),
+ formatData: v => businessApprovalStatusLabel(v),
+ formatType: v => businessApprovalStatusTagType(v),
},
{
dataType: "action",
--
Gitblit v1.9.3