From 1daa22ed05c77e4a8c3069124a1849d5d6504f69 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期四, 30 七月 2026 17:57:00 +0800
Subject: [PATCH] 修改报工审批数据显示
---
src/views/officeProcessAutomation/ApproveManage/approve-list/useApproveList.js | 78 +++++++++++++++++++++++++
src/views/officeProcessAutomation/ApproveManage/approve-list/components/FormPayloadFields.vue | 6 ++
src/api/productionManagement/productionProductMain.js | 7 ++
src/views/officeProcessAutomation/ApproveManage/approve-list/approveListConstants.js | 41 +++++++++++++
src/views/officeProcessAutomation/ApproveManage/approve-list/components/ApproveDetailPanel.vue | 11 +++
5 files changed, 140 insertions(+), 3 deletions(-)
diff --git a/src/api/productionManagement/productionProductMain.js b/src/api/productionManagement/productionProductMain.js
index 902d3e9..a2f6691 100644
--- a/src/api/productionManagement/productionProductMain.js
+++ b/src/api/productionManagement/productionProductMain.js
@@ -10,3 +10,10 @@
});
}
+// 鐢熶骇鎶ュ伐璇︽儏
+export function productionProductMainGetInfo(id) {
+ return request({
+ url: `/productionProductMain/${id}`,
+ method: "get",
+ });
+}
diff --git a/src/views/officeProcessAutomation/ApproveManage/approve-list/approveListConstants.js b/src/views/officeProcessAutomation/ApproveManage/approve-list/approveListConstants.js
index 9b29ff4..78cd8b4 100644
--- a/src/views/officeProcessAutomation/ApproveManage/approve-list/approveListConstants.js
+++ b/src/views/officeProcessAutomation/ApproveManage/approve-list/approveListConstants.js
@@ -560,7 +560,46 @@
/** 鍒楄〃琛� 鈫� 缂栬緫琛ㄥ崟锛堜粎鐢ㄨ鏁版嵁鍥炴樉锛� */
export function buildEditFormFromInstanceRow(row) {
- const { fields, formPayload, templateSnapshot } = resolveInstanceFormFields(row);
+ let { fields, formPayload, templateSnapshot } = resolveInstanceFormFields(row);
+ if (Number(row?.businessType) === 19) {
+ const editableKeys = new Set(["finishedNum", "scrapQty", "reportType"]);
+ const lockedKeys = new Set(["productNo", "userName", "teamInfo", "workOrderNo", "schedulingNum", "pendingNum", "workHour", "auditStatus", "auditRemark"]);
+ const reportTypeOptions = [
+ { label: "鍚堟牸", value: 0 },
+ { label: "杞诲井杩斿伐", value: 1 },
+ { label: "涓ラ噸杩斿伐", value: 2 },
+ { label: "鎶ュ簾", value: 3 },
+ ];
+ fields = (fields || [])
+ .filter(field => String(field?.key || "") !== "schedulingNum")
+ .map(field => ({
+ ...field,
+ label: String(field?.key || "") === "pendingNum" ? `${field.label}锛堝彧璇伙級` : field.label,
+ options: String(field?.key || "") === "reportType" ? (field.options?.length ? field.options : reportTypeOptions) : field.options,
+ disabled: lockedKeys.has(String(field?.key || "")) ? true : !editableKeys.has(String(field?.key || "")),
+ }));
+ templateSnapshot = {
+ ...templateSnapshot,
+ fields,
+ };
+ formPayload = {
+ ...formPayload,
+ };
+ if (formPayload.pendingNum == null) {
+ const schedulingNum = Number(formPayload.schedulingNum ?? row?.schedulingNum ?? row?.planQuantity ?? 0);
+ const finishedNum = Number(formPayload.finishedNum ?? formPayload.quantity ?? row?.finishedNum ?? row?.quantity ?? 0);
+ formPayload.pendingNum = Math.max(schedulingNum - finishedNum, 0);
+ }
+ if (formPayload.finishedNum == null && formPayload.quantity != null) {
+ formPayload.finishedNum = formPayload.quantity;
+ }
+ if (formPayload.scrapQty == null && row?.scrapQty != null) {
+ formPayload.scrapQty = row.scrapQty;
+ }
+ if (formPayload.reportType != null && !Number.isNaN(Number(formPayload.reportType))) {
+ formPayload.reportType = Number(formPayload.reportType);
+ }
+ }
const normalized = normalizeFlowNodes(row?.flowNodes?.length ? row.flowNodes : mapTasksToFlowNodes(row?.tasks));
const flowNodes = normalized.length ? JSON.parse(JSON.stringify(normalized)) : [createEmptyNode(1)];
diff --git a/src/views/officeProcessAutomation/ApproveManage/approve-list/components/ApproveDetailPanel.vue b/src/views/officeProcessAutomation/ApproveManage/approve-list/components/ApproveDetailPanel.vue
index 8bed52b..7c6cd47 100644
--- a/src/views/officeProcessAutomation/ApproveManage/approve-list/components/ApproveDetailPanel.vue
+++ b/src/views/officeProcessAutomation/ApproveManage/approve-list/components/ApproveDetailPanel.vue
@@ -77,7 +77,7 @@
<el-divider content-position="left">鎶ュ伐濉姤鍐呭</el-divider>
<el-descriptions v-if="formResolved.fields.length" :column="2" border>
<el-descriptions-item
- v-for="field in formResolved.fields"
+ v-for="field in visibleFormFields"
:key="field.key"
:label="field.label || field.key"
>
@@ -231,6 +231,15 @@
});
const formResolved = computed(() => resolveInstanceFormFields(props.row));
+ const visibleFormFields = computed(() =>
+ (formResolved.value.fields || []).filter(field => {
+ const key = String(field?.key || "").toLowerCase();
+ const label = String(field?.label || "").trim();
+ if (["approvalstatus", "auditstatus", "status", "workhours", "schedulingnum"].includes(key)) return false;
+ if (["瀹℃壒鐘舵��", "瀹℃牳鐘舵��", "宸ユ椂", "鎺掍骇鏁伴噺"].includes(label)) return false;
+ return true;
+ })
+ );
// 鏄惁涓虹壒娈婂鎵圭被鍨嬶紙閲囪喘銆佸彂璐с�佹姤浠凤級
diff --git a/src/views/officeProcessAutomation/ApproveManage/approve-list/components/FormPayloadFields.vue b/src/views/officeProcessAutomation/ApproveManage/approve-list/components/FormPayloadFields.vue
index 7933db5..9d95a8b 100644
--- a/src/views/officeProcessAutomation/ApproveManage/approve-list/components/FormPayloadFields.vue
+++ b/src/views/officeProcessAutomation/ApproveManage/approve-list/components/FormPayloadFields.vue
@@ -34,6 +34,7 @@
v-model="formPayload[field.key]"
:placeholder="`璇疯緭鍏�${field.label}`"
maxlength="200"
+ :disabled="Boolean(field.disabled)"
/>
<el-input
v-else-if="field.type === 'textarea'"
@@ -43,6 +44,7 @@
:placeholder="`璇峰~鍐�${field.label}`"
maxlength="2000"
show-word-limit
+ :disabled="Boolean(field.disabled)"
/>
<el-input-number
v-else-if="field.type === 'number'"
@@ -51,6 +53,7 @@
:precision="field.precision ?? 0"
controls-position="right"
style="width: 100%"
+ :disabled="Boolean(field.disabled)"
/>
<el-date-picker
v-else-if="field.type === 'date'"
@@ -60,6 +63,7 @@
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
style="width: 100%"
+ :disabled="Boolean(field.disabled)"
/>
<el-date-picker
v-else-if="field.type === 'datetimerange'"
@@ -71,6 +75,7 @@
format="YYYY-MM-DD HH:mm:ss"
value-format="YYYY-MM-DD HH:mm:ss"
style="width: 100%"
+ :disabled="Boolean(field.disabled)"
/>
<el-select
v-else-if="field.type === 'select'"
@@ -79,6 +84,7 @@
style="width: 100%"
clearable
filterable
+ :disabled="Boolean(field.disabled)"
>
<el-option
v-for="o in getOptions(field)"
diff --git a/src/views/officeProcessAutomation/ApproveManage/approve-list/useApproveList.js b/src/views/officeProcessAutomation/ApproveManage/approve-list/useApproveList.js
index 2666741..91cf317 100644
--- a/src/views/officeProcessAutomation/ApproveManage/approve-list/useApproveList.js
+++ b/src/views/officeProcessAutomation/ApproveManage/approve-list/useApproveList.js
@@ -10,6 +10,7 @@
saveApprovalInstance,
updateApprovalInstance,
} from "@/api/officeProcessAutomation/approvalInstance.js";
+import { productionProductMainGetInfo } from "@/api/productionManagement/productionProductMain.js";
import { getQuotationList } from "@/api/salesManagement/salesQuotation.js";
import { getPurchaseByCode } from "@/api/procurementManagement/procurementLedger.js";
import { getDeliveryDetailByShippingNo } from "@/api/salesManagement/deliveryLedger.js";
@@ -183,7 +184,7 @@
{
name: "淇敼",
type: "text",
- disabled: (row) => row.approvalStatus !== "pending",
+ disabled: (row) => row.approvalStatus !== "pending" || Number(row?.businessType) === 19,
clickFun: (row) => openEditDialog(row),
},
{
@@ -327,6 +328,7 @@
// 鎶ュ伐瀹℃壒锛氱洿鎺ュ睍绀哄鎵瑰~鎶ュ唴瀹�
else if (row.businessType === 19) {
detailData.value = {};
+ detailRow.value = await mergeProductionReportDetail(detailRow.value);
}
// 鍏朵粬瀹℃壒绫诲瀷
@@ -377,6 +379,7 @@
// 鎶ュ伐瀹℃壒锛氱洿鎺ュ睍绀哄鎵瑰~鎶ュ唴瀹�
else if (row.businessType === 19) {
detailData.value = {};
+ approveDialog.row = await mergeProductionReportDetail(approveDialog.row);
}
// 鍏朵粬瀹℃壒绫诲瀷
@@ -384,6 +387,76 @@
detailData.value = {};
}
approveDialog.visible = true;
+ }
+
+ async function mergeProductionReportDetail(row) {
+ const businessId = row?.businessId ?? row?.bizId ?? row?.id;
+ if (!businessId) return row;
+ try {
+ const res = await productionProductMainGetInfo(businessId);
+ const report = res?.data || res || {};
+ const formConfigPayload = row?.formConfig?.formPayload || {};
+ const schedulingNum = Number(
+ report?.schedulingNum ?? report?.planQuantity ?? formConfigPayload.schedulingNum ?? row?.schedulingNum ?? 0
+ );
+ const finishedNum = Number(
+ report?.finishedNum ?? report?.quantity ?? formConfigPayload.finishedNum ?? row?.finishedNum ?? row?.quantity ?? 0
+ );
+ const scrapQty = Number(
+ report?.scrapQty ?? formConfigPayload.scrapQty ?? row?.scrapQty ?? 0
+ );
+ const pendingNum = Number(
+ formConfigPayload.pendingNum ?? report?.pendingNum ?? row?.pendingNum ?? Math.max(schedulingNum - finishedNum, 0)
+ );
+ const reportTypeOptions = [
+ { label: "鍚堟牸", value: 0 },
+ { label: "杞诲井杩斿伐", value: 1 },
+ { label: "涓ラ噸杩斿伐", value: 2 },
+ { label: "鎶ュ簾", value: 3 },
+ ];
+ const mergedFields = [
+ { key: "productNo", label: "鎶ュ伐鍗曞彿", type: "text" },
+ { key: "userName", label: "鎶ュ伐浜哄憳", type: "text" },
+ { key: "teamInfo", label: "鐝粍淇℃伅", type: "text" },
+ { key: "workOrderNo", label: "宸ュ崟缂栧彿", type: "text" },
+ { key: "pendingNum", label: "寰呯敓浜ф暟閲�", type: "number", precision: 2 },
+ { key: "finishedNum", label: "鐢熶骇鍚堟牸鏁伴噺", type: "number", precision: 2 },
+ { key: "scrapQty", label: "鎶ュ簾鏁伴噺", type: "number", precision: 2 },
+ { key: "reportType", label: "鎶ュ伐绫诲瀷", type: "select", options: reportTypeOptions },
+ ];
+ const rawReportType = report?.reportType ?? row?.formPayload?.reportType ?? row?.reportType;
+ const reportType = Number.isFinite(Number(rawReportType)) ? Number(rawReportType) : 0;
+ const formPayload = {
+ productNo: report?.productNo || row?.productNo || row?.formPayload?.productNo || "鈥�",
+ userName: report?.userName || row?.applicantName || row?.formPayload?.userName || "鈥�",
+ teamInfo: report?.teamInfo || row?.applicantName || row?.formPayload?.teamInfo || "鈥�",
+ workOrderNo: report?.workOrderNo || row?.workOrderNo || row?.formPayload?.workOrderNo || "鈥�",
+ pendingNum,
+ finishedNum,
+ scrapQty,
+ reportType,
+ };
+ const mergedRow = {
+ ...row,
+ schedulingNum,
+ pendingNum,
+ scrapQty,
+ finishedNum,
+ formFieldDefs: mergedFields,
+ formPayload,
+ formConfig: {
+ ...(typeof row.formConfig === "object" ? row.formConfig : {}),
+ ...(row?.formConfig?.formPayload ? { formPayload: { ...row.formConfig.formPayload } } : {}),
+ fields: mergedFields,
+ formPayload,
+ approvalType: "production_report",
+ },
+ };
+ return mergedRow;
+ } catch (error) {
+ console.error("鍔犺浇鎶ュ伐瀹℃壒涓氬姟璇︽儏澶辫触", error);
+ }
+ return row;
}
function isReimburseApprovalInstance(row) {
@@ -427,6 +500,9 @@
ElMessage.warning("鏃犳硶淇敼锛氱己灏戝鎵瑰疄渚� ID");
return;
}
+ if (row.businessType === 19) {
+ row = await mergeProductionReportDetail(row);
+ }
submitDialog.mode = "edit";
submitDialog.step = 3;
submitEditRow.value = { ...row };
--
Gitblit v1.9.3