| | |
| | | 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 = [ |
| | |
| | | "unread", |
| | | "currentLevel", |
| | | "newsStatus", |
| | | "storageBlobVOList", |
| | | "storageBlobDTOs", |
| | | ]; |
| | | |
| | | /** |
| | |
| | | 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; |
| | |
| | | * 从列表首行 formConfig 生成主表动态列(label 取自模板字段 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, |
| | |
| | | * 业务申请主表列:固定列 + 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 }); |
| | |
| | | prop: "approvalStatus", |
| | | width: 110, |
| | | dataType: "tag", |
| | | formatData: (v) => businessApprovalStatusLabel(v), |
| | | formatType: (v) => businessApprovalStatusTagType(v), |
| | | formatData: v => businessApprovalStatusLabel(v), |
| | | formatType: v => businessApprovalStatusTagType(v), |
| | | }, |
| | | { |
| | | dataType: "action", |