From ab264123941cd3d345687af92aab2a9e04968960 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 27 五月 2026 14:21:35 +0800
Subject: [PATCH] Merge branch 'dev_NEW_pro' into dev_宁夏_英泽防锈
---
src/views/procurementManagement/procurementLedger/index.vue | 149 ++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 116 insertions(+), 33 deletions(-)
diff --git a/src/views/procurementManagement/procurementLedger/index.vue b/src/views/procurementManagement/procurementLedger/index.vue
index adf7b6e..cbd6e23 100644
--- a/src/views/procurementManagement/procurementLedger/index.vue
+++ b/src/views/procurementManagement/procurementLedger/index.vue
@@ -42,6 +42,20 @@
clearable
@change="changeDaterange" />
</el-form-item>
+ <el-form-item label="鍏ュ簱鐘舵�侊細">
+ <el-select v-model="searchForm.stockInStatus"
+ placeholder="璇烽�夋嫨"
+ clearable
+ style="width: 240px"
+ @change="handleQuery">
+ <el-option label="寰呭叆搴�"
+ value="寰呭叆搴�" />
+ <el-option label="鍏ュ簱涓�"
+ value="鍏ュ簱涓�" />
+ <el-option label="瀹屽叏鍏ュ簱"
+ value="瀹屽叏鍏ュ簱" />
+ </el-select>
+ </el-form-item>
<el-form-item>
<el-button type="primary"
@click="handleQuery"> 鎼滅储
@@ -92,6 +106,16 @@
prop="specificationModel" />
<el-table-column label="鍗曚綅"
prop="unit" />
+ <el-table-column label="鍏ュ簱瀹℃牳鐘舵��"
+ prop="stockInApprovalStatus"
+ width="120">
+ <template #default="scope">
+ <el-tag :type="getStockInApprovalStatusType(scope.row.stockInApprovalStatus)"
+ size="small">
+ {{ scope.row.stockInApprovalStatus || '--' }}
+ </el-tag>
+ </template>
+ </el-table-column>
<el-table-column label="鏁伴噺"
prop="quantity" />
<el-table-column label="鍙敤鏁伴噺"
@@ -143,6 +167,17 @@
</el-tag>
</template>
</el-table-column>
+ <el-table-column label="鍏ュ簱鐘舵��"
+ prop="stockInStatus"
+ width="100"
+ show-overflow-tooltip>
+ <template #default="scope">
+ <el-tag :type="getStockInStatusType(scope.row.stockInStatus)"
+ size="small">
+ {{ scope.row.stockInStatus || '--' }}
+ </el-tag>
+ </template>
+ </el-table-column>
<el-table-column label="绛捐鏃ユ湡"
prop="executionDate"
width="100"
@@ -176,7 +211,7 @@
<el-button link
type="primary"
@click="openForm('edit', scope.row)"
- :disabled="scope.row.approvalStatus !== 1 && scope.row.approvalStatus !== 4">缂栬緫
+ :disabled="scope.row.stockInStatus === '瀹屽叏鍏ュ簱'">缂栬緫
</el-button>
<el-button link
type="primary"
@@ -403,6 +438,16 @@
</el-tag>
</template>
</el-table-column>
+ <el-table-column label="鍏ュ簱瀹℃牳鐘舵��"
+ prop="stockInApprovalStatus"
+ width="120">
+ <template #default="scope">
+ <el-tag :type="getStockInApprovalStatusType(scope.row.stockInApprovalStatus)"
+ size="small">
+ {{ scope.row.stockInApprovalStatus || '--' }}
+ </el-tag>
+ </template>
+ </el-table-column>
<el-table-column fixed="right"
label="鎿嶄綔"
min-width="60"
@@ -410,7 +455,8 @@
<template #default="scope">
<el-button link
type="primary"
- @click="openProductForm('edit', scope.row, scope.$index)">缂栬緫
+ @click="openProductForm('edit', scope.row, scope.$index)"
+ :disabled="scope.row.stockInApprovalStatus === '瀹屽叏鍏ュ簱'">缂栬緫
</el-button>
</template>
</el-table-column>
@@ -727,6 +773,26 @@
return typeMap[status] || "";
};
+ // 鑾峰彇鍏ュ簱鐘舵�佹爣绛剧被鍨�
+ const getStockInStatusType = status => {
+ const typeMap = {
+ "寰呭叆搴�": "info", // 寰呭叆搴� - 鐏拌壊
+ "鍏ュ簱涓�": "warning", // 鍏ュ簱涓� - 姗欒壊
+ "瀹屽叏鍏ュ簱": "success", // 瀹屽叏鍏ュ簱 - 缁胯壊
+ };
+ return typeMap[status] || "";
+ };
+
+ // 鑾峰彇鍏ュ簱瀹℃牳鐘舵�佹爣绛剧被鍨�
+ const getStockInApprovalStatusType = status => {
+ const typeMap = {
+ "寰呭叆搴�": "info", // 寰呭叆搴� - 鐏拌壊
+ "鍏ュ簱涓�": "warning", // 鍏ュ簱涓� - 姗欒壊
+ "瀹屽叏鍏ュ簱": "success", // 瀹屽叏鍏ュ簱 - 缁胯壊
+ };
+ return typeMap[status] || "";
+ };
+
const templateName = ref("");
const filterInputValue = ref("");
const templateList = ref([]);
@@ -857,7 +923,7 @@
},
rules: {
purchaseContractNumber: [
- { required: true, message: "璇疯緭鍏�", trigger: "blur" },
+ { required: false, message: "璇疯緭鍏�", trigger: "blur" },
],
projectName: [
{ required: true, message: "璇疯緭鍏ラ」鐩悕绉�", trigger: "blur" },
@@ -1206,10 +1272,10 @@
};
// 鎵撳紑寮规
const openForm = async (type, row) => {
- // 缂栬緫鏃舵鏌ュ鏍哥姸鎬侊紝鍙湁寰呭鏍�(1)鍜屽鎵瑰け璐�(4)鎵嶈兘缂栬緫
+ // 缂栬緫鏃舵鏌ュ叆搴撶姸鎬侊紝瀹屽叏鍏ュ簱鏃朵笉鑳界紪杈�
if (type === "edit" && row) {
- if (row.approvalStatus !== 1 && row.approvalStatus !== 4) {
- proxy.$modal.msgWarning("鍙湁寰呭鏍稿拰瀹℃壒澶辫触鐘舵�佺殑璁板綍鎵嶈兘缂栬緫");
+ if (row.stockInStatus === '瀹屽叏鍏ュ簱') {
+ proxy.$modal.msgWarning("瀹屽叏鍏ュ簱鐘舵�佺殑璁板綍涓嶈兘缂栬緫");
return;
}
}
@@ -1240,25 +1306,16 @@
form.value.entryDate = getCurrentDate();
- if (type === "add") {
- // 鏂板鏃剁敓鎴愰噰璐悎鍚屽彿
- try {
- const purchaseNoRes = await createPurchaseNo();
- if (purchaseNoRes?.data) {
- form.value.purchaseContractNumber = purchaseNoRes.data;
- }
- } catch (error) {
- console.error("鐢熸垚閲囪喘鍚堝悓鍙峰け璐�:", error);
- proxy.$modal.msgWarning("鐢熸垚閲囪喘鍚堝悓鍙峰け璐�");
- }
- } else if (type === "edit" && row?.id) {
+ if (type === "edit" && row?.id) {
// 缂栬緫鏃跺姞杞芥暟鎹�
currentId.value = row.id;
try {
const purchaseRes = await getPurchaseById({ id: row.id, type: 2 });
- form.value = { ...purchaseRes };
- productData.value = purchaseRes.productData || [];
+ form.value = { ...purchaseRes, stockInStatus: row.stockInStatus };
fileList.value = purchaseRes.storageBlobVOS || [];
+ // 浣跨敤 productList 鎺ュ彛鑾峰彇浜у搧鍒楄〃锛屼互鑾峰彇鍏ュ簱瀹℃牳鐘舵��
+ const productRes = await productList({ salesLedgerId: row.id, type: 2 });
+ productData.value = productRes.data || [];
} catch (error) {
console.error("鍔犺浇閲囪喘鍙拌处鏁版嵁澶辫触:", error);
proxy.$modal.msgError("鍔犺浇鏁版嵁澶辫触");
@@ -1330,7 +1387,7 @@
// 鎻愪氦琛ㄥ崟
const submitForm = () => {
- proxy.$refs["formRef"].validate(valid => {
+ proxy.$refs["formRef"].validate(async valid => {
if (valid) {
if (productData.value.length > 0) {
// 鏂板鏃讹紝闇�瑕佷粠姣忎釜浜у搧瀵硅薄涓垹闄� id 瀛楁
@@ -1360,6 +1417,20 @@
delete submitData.id;
}
+ // 濡傛灉閲囪喘鍚堝悓鍙蜂负绌猴紝鍒欐牴鎹綍鍏ユ棩鏈熻嚜鍔ㄧ敓鎴�
+ if (!submitData.purchaseContractNumber) {
+ try {
+ const purchaseNoRes = await createPurchaseNo(submitData.entryDate);
+ if (purchaseNoRes?.data) {
+ submitData.purchaseContractNumber = purchaseNoRes.data;
+ }
+ } catch (error) {
+ console.error("鐢熸垚閲囪喘鍚堝悓鍙峰け璐�:", error);
+ proxy.$modal.msgWarning("鐢熸垚閲囪喘鍚堝悓鍙峰け璐�");
+ return;
+ }
+ }
+
addOrEditPurchase(submitData).then(res => {
proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
closeDia();
@@ -1375,6 +1446,12 @@
};
// 鎵撳紑浜у搧寮规
const openProductForm = async (type, row, index) => {
+ // 缂栬緫鏃舵鏌ヤ骇鍝佸叆搴撳鏍哥姸鎬侊紝瀹屽叏鍏ュ簱鏃朵笉鑳界紪杈�
+ if (type === "edit" && row && row.stockInApprovalStatus === '瀹屽叏鍏ュ簱') {
+ proxy.$modal.msgWarning("瀹屽叏鍏ュ簱鐘舵�佺殑浜у搧涓嶈兘缂栬緫");
+ return;
+ }
+
productOperationType.value = type;
productOperationIndex.value = index;
productForm.value = {};
@@ -1545,8 +1622,9 @@
addOrUpdateSalesLedgerProduct(productForm.value).then(res => {
proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
closeProductDia();
- getPurchaseById({ id: currentId.value, type: 2 }).then(res => {
- productData.value = res.productData;
+ // 浣跨敤 productList 鎺ュ彛鍒锋柊浜у搧鍒楄〃锛屼互鑾峰彇鍏ュ簱瀹℃牳鐘舵��
+ productList({ salesLedgerId: currentId.value, type: 2 }).then(res => {
+ productData.value = res.data || [];
});
});
};
@@ -1556,15 +1634,19 @@
proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
return;
}
+ // 妫�鏌ラ�変腑鐨勪骇鍝佷腑鏄惁鏈夊畬鍏ㄥ叆搴撶殑
+ const hasFullyStocked = productSelectedRows.value.some(
+ row => row.stockInApprovalStatus === '瀹屽叏鍏ュ簱'
+ );
+ if (hasFullyStocked) {
+ proxy.$modal.msgWarning("閫変腑鐨勪骇鍝佷腑鍖呭惈瀹屽叏鍏ュ簱鐨勪骇鍝侊紝鏃犳硶鍒犻櫎");
+ return;
+ }
if (operationType.value === "add") {
- productSelectedRows.value.forEach(selectedRow => {
- const index = productData.value.findIndex(
- product => product.id === selectedRow.id
- );
- if (index !== -1) {
- productData.value.splice(index, 1);
- }
- });
+ productData.value = productData.value.filter(
+ item => !productSelectedRows.value.includes(item)
+ );
+ productSelectedRows.value = [];
} else {
let ids = [];
if (productSelectedRows.value.length > 0) {
@@ -1579,8 +1661,9 @@
delProduct(ids).then(res => {
proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
closeProductDia();
- getPurchaseById({ id: currentId.value, type: 2 }).then(res => {
- productData.value = res.productData;
+ // 浣跨敤 productList 鎺ュ彛鍒锋柊浜у搧鍒楄〃锛屼互鑾峰彇鍏ュ簱瀹℃牳鐘舵��
+ productList({ salesLedgerId: currentId.value, type: 2 }).then(res => {
+ productData.value = res.data || [];
});
});
})
--
Gitblit v1.9.3