From 47bae1f938f915206e3934ea960aff975e5738c9 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期五, 12 六月 2026 16:09:49 +0800
Subject: [PATCH] feat(teachingDemo): 新增工艺路线与BOM教学演示模块
---
src/views/procurementManagement/procurementLedger/index.vue | 62 +++++++++++++++++++++++++------
1 files changed, 50 insertions(+), 12 deletions(-)
diff --git a/src/views/procurementManagement/procurementLedger/index.vue b/src/views/procurementManagement/procurementLedger/index.vue
index cbd6e23..2d42b57 100644
--- a/src/views/procurementManagement/procurementLedger/index.vue
+++ b/src/views/procurementManagement/procurementLedger/index.vue
@@ -66,6 +66,9 @@
</div>
<div class="table_list">
<div style="display: flex;justify-content: flex-end;margin-bottom: 20px;">
+ <el-button type="success"
+ plain
+ @click="handleBatchGenerate">鎵归噺鐢熸垚鏁版嵁</el-button>
<el-button type="primary"
@click="openForm('add')">鏂板鍙拌处</el-button>
<el-button type="primary"
@@ -106,7 +109,7 @@
prop="specificationModel" />
<el-table-column label="鍗曚綅"
prop="unit" />
- <el-table-column label="鍏ュ簱瀹℃牳鐘舵��"
+ <el-table-column label="鍏ュ簱瀹℃牳鐘舵��"
prop="stockInApprovalStatus"
width="120">
<template #default="scope">
@@ -721,6 +724,7 @@
getOptions,
getPurchaseTemplateList,
delPurchaseTemplate,
+ batchGeneratePurchaseInboundSteps,
} from "@/api/procurementManagement/procurementLedger.js";
import useFormData from "@/hooks/useFormData.js";
const FileList = defineAsyncComponent(() =>
@@ -776,9 +780,9 @@
// 鑾峰彇鍏ュ簱鐘舵�佹爣绛剧被鍨�
const getStockInStatusType = status => {
const typeMap = {
- "寰呭叆搴�": "info", // 寰呭叆搴� - 鐏拌壊
- "鍏ュ簱涓�": "warning", // 鍏ュ簱涓� - 姗欒壊
- "瀹屽叏鍏ュ簱": "success", // 瀹屽叏鍏ュ簱 - 缁胯壊
+ 寰呭叆搴�: "info", // 寰呭叆搴� - 鐏拌壊
+ 鍏ュ簱涓�: "warning", // 鍏ュ簱涓� - 姗欒壊
+ 瀹屽叏鍏ュ簱: "success", // 瀹屽叏鍏ュ簱 - 缁胯壊
};
return typeMap[status] || "";
};
@@ -786,9 +790,9 @@
// 鑾峰彇鍏ュ簱瀹℃牳鐘舵�佹爣绛剧被鍨�
const getStockInApprovalStatusType = status => {
const typeMap = {
- "寰呭叆搴�": "info", // 寰呭叆搴� - 鐏拌壊
- "鍏ュ簱涓�": "warning", // 鍏ュ簱涓� - 姗欒壊
- "瀹屽叏鍏ュ簱": "success", // 瀹屽叏鍏ュ簱 - 缁胯壊
+ 寰呭叆搴�: "info", // 寰呭叆搴� - 鐏拌壊
+ 鍏ュ簱涓�: "warning", // 鍏ュ簱涓� - 姗欒壊
+ 瀹屽叏鍏ュ簱: "success", // 瀹屽叏鍏ュ簱 - 缁胯壊
};
return typeMap[status] || "";
};
@@ -1274,7 +1278,7 @@
const openForm = async (type, row) => {
// 缂栬緫鏃舵鏌ュ叆搴撶姸鎬侊紝瀹屽叏鍏ュ簱鏃朵笉鑳界紪杈�
if (type === "edit" && row) {
- if (row.stockInStatus === '瀹屽叏鍏ュ簱') {
+ if (row.stockInStatus === "瀹屽叏鍏ュ簱") {
proxy.$modal.msgWarning("瀹屽叏鍏ュ簱鐘舵�佺殑璁板綍涓嶈兘缂栬緫");
return;
}
@@ -1314,7 +1318,10 @@
form.value = { ...purchaseRes, stockInStatus: row.stockInStatus };
fileList.value = purchaseRes.storageBlobVOS || [];
// 浣跨敤 productList 鎺ュ彛鑾峰彇浜у搧鍒楄〃锛屼互鑾峰彇鍏ュ簱瀹℃牳鐘舵��
- const productRes = await productList({ salesLedgerId: row.id, type: 2 });
+ const productRes = await productList({
+ salesLedgerId: row.id,
+ type: 2,
+ });
productData.value = productRes.data || [];
} catch (error) {
console.error("鍔犺浇閲囪喘鍙拌处鏁版嵁澶辫触:", error);
@@ -1447,7 +1454,7 @@
// 鎵撳紑浜у搧寮规
const openProductForm = async (type, row, index) => {
// 缂栬緫鏃舵鏌ヤ骇鍝佸叆搴撳鏍哥姸鎬侊紝瀹屽叏鍏ュ簱鏃朵笉鑳界紪杈�
- if (type === "edit" && row && row.stockInApprovalStatus === '瀹屽叏鍏ュ簱') {
+ if (type === "edit" && row && row.stockInApprovalStatus === "瀹屽叏鍏ュ簱") {
proxy.$modal.msgWarning("瀹屽叏鍏ュ簱鐘舵�佺殑浜у搧涓嶈兘缂栬緫");
return;
}
@@ -1636,7 +1643,7 @@
}
// 妫�鏌ラ�変腑鐨勪骇鍝佷腑鏄惁鏈夊畬鍏ㄥ叆搴撶殑
const hasFullyStocked = productSelectedRows.value.some(
- row => row.stockInApprovalStatus === '瀹屽叏鍏ュ簱'
+ row => row.stockInApprovalStatus === "瀹屽叏鍏ュ簱"
);
if (hasFullyStocked) {
proxy.$modal.msgWarning("閫変腑鐨勪骇鍝佷腑鍖呭惈瀹屽叏鍏ュ簱鐨勪骇鍝侊紝鏃犳硶鍒犻櫎");
@@ -1712,6 +1719,37 @@
proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
getList();
});
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+ };
+
+ const handleBatchGenerate = async () => {
+ if (selectedRows.value.length === 0) {
+ proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
+ return;
+ }
+ const ids = selectedRows.value.map((item) => item.id);
+
+ ElMessageBox.confirm("纭鎵归噺鐢熸垚鏁版嵁锛�", "鎵归噺鐢熸垚", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "info",
+ })
+ .then(() => {
+ proxy.$modal.loading("姝e湪鎵归噺鐢熸垚鏁版嵁锛岃绋嶅��...");
+ batchGeneratePurchaseInboundSteps({ ids })
+ .then((res) => {
+ proxy.$modal.msgSuccess("鎵归噺鐢熸垚鎴愬姛");
+ getList();
+ })
+ .catch(() => {
+ proxy.$modal.msgError("鎵归噺鐢熸垚澶辫触");
+ })
+ .finally(() => {
+ proxy.$modal.closeLoading();
+ });
})
.catch(() => {
proxy.$modal.msg("宸插彇娑�");
@@ -1855,7 +1893,7 @@
contractNo: form.value.salesLedgerId,
});
if (code == 200) {
- productData.value = data;
+ productData.value = data || [];
}
};
--
Gitblit v1.9.3