From dacc95761cf7090c628fc37a5d4f8bb825ccbbb0 Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期六, 16 五月 2026 15:41:45 +0800
Subject: [PATCH] 企业新闻和通知公告
---
src/views/productionManagement/productionOrder/index.vue | 277 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 265 insertions(+), 12 deletions(-)
diff --git a/src/views/productionManagement/productionOrder/index.vue b/src/views/productionManagement/productionOrder/index.vue
index f348aae..90ca51d 100644
--- a/src/views/productionManagement/productionOrder/index.vue
+++ b/src/views/productionManagement/productionOrder/index.vue
@@ -40,6 +40,8 @@
value="3" />
<el-option label="宸插彇娑�"
value="4" />
+ <el-option label="宸茬粨鏉�"
+ value="5" />
</el-select>
</el-form-item>
<el-form-item>
@@ -65,12 +67,33 @@
:tableLoading="tableLoading"
:row-class-name="tableRowClassName"
:isSelection="true"
+ :selectable="row => !row.endOrder"
@selection-change="handleSelectionChange"
@pagination="pagination">
<template #completionStatus="{ row }">
<el-progress :percentage="toProgressPercentage(row?.completionStatus)"
:color="progressColor(toProgressPercentage(row?.completionStatus))"
:status="toProgressPercentage(row?.completionStatus) >= 100 ? 'success' : ''" />
+ </template>
+ <template #processRouteStatus="{ row }">
+ <div v-if="row.processRouteStatus && row.processRouteStatus.length"
+ class="process-progress-container">
+ <div v-for="(item, index) in row.processRouteStatus"
+ :key="index"
+ class="process-step">
+ <div class="step-content">
+ <div class="step-circle"
+ :class="{ 'is-completed': item.percentage >= 100 }">
+ <span class="step-percentage"
+ :style="{ color: item.percentage >= 70 ? item.percentage >= 100 ? '#67c23a' : '#f56c6c' : '#000' }">{{ item.percentage }}%</span>
+ </div>
+ <div class="step-name">{{ item.name }}</div>
+ </div>
+ <div v-if="index < row.processRouteStatus.length - 1"
+ class="step-line"></div>
+ </div>
+ </div>
+ <span v-else>-</span>
</template>
</PIMTable>
</div>
@@ -175,9 +198,18 @@
<MaterialDetailDialog v-model="materialDetailDialogVisible"
:order-row="currentMaterialDetailOrder"
@confirmed="getList" />
+ <MaterialSupplementDialog v-model="materialSupplementDialogVisible"
+ :order-row="currentMaterialSupplementOrder"
+ @saved="getList" />
<new-product-order v-if="isShowNewModal"
v-model:visible="isShowNewModal"
@completed="handleQuery" />
+ <!-- 鎵撳嵃棰嗘枡鍗曠粍浠� -->
+ <div class="print-requisition-wrapper">
+ <PrintMaterialRequisition ref="printRef"
+ :order-row="printOrderRow"
+ :material-list="printMaterialList" />
+ </div>
</div>
</template>
@@ -201,12 +233,20 @@
listProcessBom,
delProductOrder,
getProductOrderSource,
+ updateProductOrder,
} from "@/api/productionManagement/productionOrder.js";
+ import { productWorkOrderPage } from "@/api/productionManagement/workOrder.js";
import { listMain as getOrderProcessRouteMain } from "@/api/productionManagement/productProcessRoute.js";
import MaterialLedgerDialog from "@/views/productionManagement/productionOrder/components/MaterialLedgerDialog.vue";
import MaterialDetailDialog from "@/views/productionManagement/productionOrder/components/MaterialDetailDialog.vue";
+ import MaterialSupplementDialog from "@/views/productionManagement/productionOrder/components/MaterialSupplementDialog.vue";
+ import PrintMaterialRequisition from "@/views/productionManagement/productionOrder/components/PrintMaterialRequisition.vue";
import PIMTable from "@/components/PIMTable/PIMTable.vue";
import { listPage } from "@/api/productionManagement/processRoute.js";
+ import {
+ listMaterialPickingDetail,
+ listMaterialPickingBom,
+ } from "@/api/productionManagement/productionOrder.js";
const NewProductOrder = defineAsyncComponent(() =>
import("@/views/productionManagement/productionOrder/New.vue")
);
@@ -222,13 +262,23 @@
total: 0,
});
- const tableColumn = ref([
+ const processColumnWidth = computed(() => {
+ if (!tableData.value || tableData.value.length === 0) return "200px";
+ const maxProcesses = Math.max(
+ ...tableData.value.map(row => row.processRouteStatus?.length || 0)
+ );
+ if (maxProcesses === 0) return "100px";
+ // 姣忎釜宸ュ簭鍦嗗湀 36px + 绾挎潯 30px = 66px锛岄澶栧姞 60px 杈硅窛鍜屾枃瀛楃┖闂�
+ return `${maxProcesses * 66 + 60}px`;
+ });
+
+ const tableColumn = computed(() => [
{
label: "鐢熶骇璁㈠崟鍙�",
prop: "npsNo",
width: "150px",
},
- // 1.寰呭紑濮嬨��2.杩涜涓��3.宸插畬鎴愩��4.宸插彇娑�
+ // 1.寰呭紑濮嬨��2.杩涜涓��3.宸插畬鎴愩��4.宸插彇娑堛��5.宸茬粨鏉�
{
label: "鐘舵��",
prop: "status",
@@ -241,6 +291,8 @@
? "杩涜涓�"
: val === 3
? "宸插畬鎴�"
+ : val === 5
+ ? "宸茬粨鏉�"
: "宸插彇娑�",
formatType: val =>
val === 1
@@ -249,7 +301,9 @@
? "warning"
: val === 3
? "success"
- : "danger",
+ : val === 5
+ ? "danger"
+ : "info",
},
{
label: "浜у搧鍚嶇О",
@@ -273,6 +327,13 @@
{
label: "瀹屾垚鏁伴噺",
prop: "completeQuantity",
+ },
+ {
+ label: "宸ュ簭鐢熶骇杩涘害",
+ prop: "processRouteStatus",
+ dataType: "slot",
+ slot: "processRouteStatus",
+ width: processColumnWidth.value,
},
{
dataType: "slot",
@@ -304,7 +365,7 @@
label: "鎿嶄綔",
align: "center",
fixed: "right",
- width: 360,
+ width: 280,
operation: [
{
name: "宸ヨ壓璺嚎",
@@ -317,7 +378,7 @@
{
name: "缁戝畾宸ヨ壓璺嚎",
type: "text",
- showHide: row => !row.processRouteCode,
+ showHide: row => !row.processRouteCode && !row.endOrder,
clickFun: row => {
openBindRouteDialog(row, "add");
},
@@ -325,7 +386,7 @@
{
name: "鏇存崲宸ヨ壓璺嚎",
type: "text",
- showHide: row => row.processRouteCode,
+ showHide: row => row.processRouteCode && !row.endOrder,
clickFun: row => {
openBindRouteDialog(row, "change");
},
@@ -340,15 +401,60 @@
{
name: "棰嗘枡",
type: "text",
+ color: "#5EC7AB",
+ showHide: row => !row.endOrder && !row.returned,
clickFun: row => {
openMaterialDialog(row);
},
},
{
+ name: "琛ユ枡",
+ type: "text",
+ color: "#5EC7AB",
+ showHide: row => !row.endOrder && !row.returned,
+ clickFun: row => {
+ openMaterialSupplementDialog(row);
+ },
+ },
+ {
name: "棰嗘枡璇︽儏",
type: "text",
+ color: "#5EC7AB",
clickFun: row => {
openMaterialDetailDialog(row);
+ },
+ },
+ {
+ name: "鎵撳嵃棰嗘枡鍗�",
+ type: "text",
+ color: "#5EC7AB",
+ showHide: row => !row.endOrder,
+ clickFun: row => {
+ handlePrint(row);
+ },
+ },
+ {
+ name: "鐢熶骇杩芥函",
+ type: "text",
+ color: "#409eff",
+ clickFun: row => {
+ router.push({
+ path: "/productionManagement/productionTraceability",
+ query: {
+ npsNo: row.npsNo,
+ productName: row.productName,
+ model: row.model,
+ },
+ });
+ },
+ },
+ {
+ name: "缁撴潫璁㈠崟",
+ type: "text",
+ color: "red",
+ showHide: row => !row.endOrder,
+ clickFun: row => {
+ handleEndOrder(row);
},
},
],
@@ -423,10 +529,48 @@
const currentMaterialOrder = ref(null);
const materialDetailDialogVisible = ref(false);
const currentMaterialDetailOrder = ref(null);
+ const materialSupplementDialogVisible = ref(false);
+ const currentMaterialSupplementOrder = ref(null);
+
+ // 鎵撳嵃鐩稿叧
+ const printOrderRow = ref(null);
+ const printMaterialList = ref([]);
+ const handlePrint = async row => {
+ printOrderRow.value = row;
+ proxy.$modal.loading("姝e湪鑾峰彇棰嗘枡鏁版嵁...");
+ try {
+ printMaterialList.value = [];
+ const detailRes = await listMaterialPickingDetail(row.id);
+ const detailList = Array.isArray(detailRes?.data)
+ ? detailRes.data
+ : detailRes?.data?.records || [];
+
+ if (detailList.length > 0) {
+ printMaterialList.value = detailList;
+ }
+
+ if (printMaterialList.value.length === 0) {
+ proxy.$modal.msgWarning("鏆傛棤棰嗘枡鏁版嵁");
+ return;
+ }
+
+ // 绛夊緟 DOM 鏇存柊鍚庢墽琛屾墦鍗�
+ proxy.$nextTick(() => {
+ setTimeout(() => {
+ window.print();
+ }, 800);
+ });
+ } catch (e) {
+ console.error("鑾峰彇棰嗘枡鏁版嵁澶辫触锛�", e);
+ proxy.$modal.msgError("鑾峰彇棰嗘枡鏁版嵁澶辫触");
+ } finally {
+ proxy.$modal.closeLoading();
+ }
+ };
const openBindRouteDialog = async (row, type) => {
bindForm.orderId = row.id;
- bindForm.routeId = type === "add" ? null : row.processRouteCode;
+ bindForm.routeId = type === "add" ? null : row.technologyRoutingId;
bindRouteDialogVisible.value = true;
routeOptions.value = [];
if (!row.productModelId) {
@@ -478,6 +622,11 @@
materialDetailDialogVisible.value = true;
};
+ const openMaterialSupplementDialog = row => {
+ currentMaterialSupplementOrder.value = row;
+ materialSupplementDialogVisible.value = true;
+ };
+
const handleReset = () => {
searchForm.value = {
...searchForm.value,
@@ -519,10 +668,35 @@
const params = { ...searchForm.value, ...page };
params.entryDate = undefined;
productOrderListPage(params)
- .then(res => {
- tableLoading.value = false;
- tableData.value = res.data.records;
+ .then(async res => {
+ const records = res.data.records || [];
+ // 涓烘瘡涓鍗曟煡璇㈠搴旂殑宸ュ簭杩涘害鏁版嵁
+ const processPromises = records.map(async item => {
+ if (item.npsNo) {
+ try {
+ const workOrderRes = await productWorkOrderPage({
+ npsNo: item.npsNo,
+ size: 100,
+ });
+ const workOrders = workOrderRes.data.records || [];
+ // 鎸夌収宸ュ簭椤哄簭鎺掑簭锛堝鏋滄湁椤哄簭瀛楁锛屽亣璁句负 orderNum 鎴栨寜杩斿洖椤哄簭锛�
+ // 杞崲涓� processRouteStatus 鏍煎紡
+ const processRouteStatus = workOrders.map(wo => ({
+ name: wo.operationName || "鏈煡宸ュ簭",
+ percentage: wo.completionStatus > 100 ? 100 : wo.completionStatus,
+ }));
+ return { ...item, processRouteStatus };
+ } catch (error) {
+ console.error(`鑾峰彇宸ュ崟 ${item.npsNo} 杩涘害澶辫触:`, error);
+ return { ...item, processRouteStatus: [] };
+ }
+ }
+ return { ...item, processRouteStatus: [] };
+ });
+
+ tableData.value = await Promise.all(processPromises);
page.total = res.data.total;
+ tableLoading.value = false;
})
.catch(() => {
tableLoading.value = false;
@@ -551,6 +725,7 @@
quantity: row.quantity || 0,
orderId,
type: "order",
+ editable: !row.endOrder,
},
});
} catch (e) {
@@ -635,14 +810,34 @@
})
.then(() => {
proxy.download(
- "/productOrder/export",
+ "/productionOrder/export",
{ ...searchForm.value },
- "鐢熶骇璁㈠崟.xlsx"
+ "鐢熶骇璁㈠崟鏁版嵁.xlsx"
);
})
.catch(() => {
proxy.$modal.msg("宸插彇娑�");
});
+ };
+
+ // 缁撴潫璁㈠崟
+ const handleEndOrder = row => {
+ ElMessageBox.confirm(`鏄惁纭缁撴潫璁㈠崟锛�${row.npsNo}锛焋, "鎻愮ず", {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ const params = {
+ id: row.id,
+ endOrder: true,
+ };
+ updateProductOrder(params).then(() => {
+ proxy.$modal.msgSuccess("缁撴潫璁㈠崟鎴愬姛");
+ getList();
+ });
+ })
+ .catch(() => {});
};
const handleConfirmRoute = () => {};
@@ -681,6 +876,64 @@
.table_list {
margin-top: unset;
}
+
+ .process-progress-container {
+ display: inline-flex;
+ align-items: center;
+ padding: 10px 0;
+ white-space: nowrap;
+
+ .process-step {
+ display: flex;
+ align-items: center;
+ position: relative;
+
+ .step-content {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ z-index: 1;
+
+ .step-circle {
+ width: 36px;
+ height: 36px;
+ border-radius: 50%;
+ border: 2px solid #409eff;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ background-color: #fff;
+ margin-bottom: 4px;
+
+ .step-percentage {
+ font-size: 11px;
+ font-weight: bold;
+ }
+
+ &.is-completed {
+ border-color: #67c23a;
+ .step-percentage {
+ color: #67c23a;
+ }
+ }
+ }
+
+ .step-name {
+ font-size: 12px;
+ color: #606266;
+ white-space: nowrap;
+ }
+ }
+
+ .step-line {
+ width: 30px;
+ height: 1px;
+ background-color: #dcdfe6;
+ margin: 0 -2px;
+ margin-top: -20px; // 鍚戜笂鍋忕Щ浠ュ榻愬渾蹇�
+ }
+ }
+ }
</style>
<style lang="scss">
.status-cell {
--
Gitblit v1.9.3