From a32e60bf3366bf3b2d8d0d53b8257290acfb3d4e Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期五, 12 六月 2026 10:26:58 +0800
Subject: [PATCH] 班次配置,夜班不限制时间顺序
---
src/views/procurementManagement/procurementLedger/index.vue | 171 ++++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 156 insertions(+), 15 deletions(-)
diff --git a/src/views/procurementManagement/procurementLedger/index.vue b/src/views/procurementManagement/procurementLedger/index.vue
index 3994855..cab2a26 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"
@@ -122,6 +125,12 @@
prop="availableQuality" />
<el-table-column label="閫�璐ф暟閲�"
prop="returnQuality" />
+ <el-table-column label="杩愯垂鍗曚环(鍏�)"
+ prop="freightUnitPrice"
+ :formatter="formattedNumber" />
+ <el-table-column label="鎬昏繍璐�(鍏�)"
+ prop="totalFreight"
+ :formatter="formattedNumber" />
<el-table-column label="绋庣巼(%)"
prop="taxRate" />
<el-table-column label="鍚◣鍗曚环(鍏�)"
@@ -186,6 +195,14 @@
width="100"
prop="paymentMethod"
show-overflow-tooltip />
+ <el-table-column label="杞︾墝鍙�"
+ prop="carPlateNumber"
+ width="140"
+ show-overflow-tooltip />
+ <el-table-column label="杩愯緭鍗曚綅/涓汉"
+ prop="transportUnitOrPerson"
+ width="180"
+ show-overflow-tooltip />
<el-table-column label="鍚堝悓閲戦(鍏�)"
prop="contractAmount"
width="200"
@@ -215,8 +232,8 @@
</el-button>
<el-button link
type="primary"
- @click="handleStockIn(scope.row)"
- :disabled="scope.row.approvalStatus !== 3 || scope.row.stockInStatus === '瀹屽叏鍏ュ簱'">鍏ュ簱
+ :disabled="scope.row.approvalStatus !== 3 || scope.row.stockInStatus === '瀹屽叏鍏ュ簱'"
+ @click="handleStockIn(scope.row)">鍏ュ簱
</el-button>
<el-button link
type="primary"
@@ -311,6 +328,24 @@
type="date"
placeholder="璇烽�夋嫨"
clearable />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="杞︾墝鍙凤細"
+ prop="carPlateNumber">
+ <el-input v-model="form.carPlateNumber"
+ placeholder="璇疯緭鍏�"
+ clearable />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="杩愯緭鍗曚綅/涓汉锛�"
+ prop="transportUnitOrPerson">
+ <el-input v-model="form.transportUnitOrPerson"
+ placeholder="璇疯緭鍏�"
+ clearable />
</el-form-item>
</el-col>
</el-row>
@@ -415,6 +450,14 @@
<el-table-column label="鏁伴噺"
prop="quantity"
width="70" />
+ <el-table-column label="杩愯垂鍗曚环(鍏�)"
+ prop="freightUnitPrice"
+ :formatter="formattedNumber"
+ width="150" />
+ <el-table-column label="鎬昏繍璐�(鍏�)"
+ prop="totalFreight"
+ :formatter="formattedNumber"
+ width="150" />
<el-table-column label="搴撳瓨棰勮鏁伴噺"
prop="warnNum"
width="120"
@@ -613,7 +656,32 @@
style="width: 100%"
v-model="productForm.quantity"
placeholder="璇疯緭鍏�"
- @change="mathNum" />
+ @change="handleQuantityChange" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="杩愯垂鍗曚环(鍏�)锛�"
+ prop="freightUnitPrice">
+ <el-input-number v-model="productForm.freightUnitPrice"
+ :precision="2"
+ :step="0.1"
+ :min="0"
+ clearable
+ style="width: 100%"
+ @change="handleFreightUnitPriceChange" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鎬昏繍璐�(鍏�)锛�"
+ prop="totalFreight">
+ <el-input-number v-model="productForm.totalFreight"
+ :precision="2"
+ :step="0.1"
+ :min="0"
+ clearable
+ style="width: 100%" />
</el-form-item>
</el-col>
</el-row>
@@ -806,8 +874,9 @@
getOptions,
getPurchaseTemplateList,
delPurchaseTemplate,
+ batchGeneratePurchaseInboundSteps,
+ manualStockIn,
} from "@/api/procurementManagement/procurementLedger.js";
- import { addSutockIn } from "@/api/inventoryManagement/stockIn.js";
import useFormData from "@/hooks/useFormData.js";
const FileList = defineAsyncComponent(() =>
import("@/components/Dialog/FileList.vue")
@@ -841,12 +910,9 @@
});
const total = ref(0);
const fileList = ref([]);
- import useUserStore from "@/store/modules/user";
import { modelList, productTreeList } from "@/api/basicData/product.js";
import dayjs from "dayjs";
import FileUpload from "@/components/AttachmentUpload/file/index.vue";
-
- const userStore = useUserStore();
// 璁㈠崟瀹℃壒鐘舵�佹樉绀烘枃鏈�
const approvalStatusText = {
@@ -1012,6 +1078,8 @@
supplierName: "",
supplierId: "",
paymentMethod: "",
+ carPlateNumber: "",
+ transportUnitOrPerson: "",
executionDate: "",
isChecked: false,
},
@@ -1052,6 +1120,8 @@
specificationModel: "",
unit: "",
quantity: "",
+ freightUnitPrice: "",
+ totalFreight: "",
taxInclusiveUnitPrice: "",
taxRate: "",
taxInclusiveTotalPrice: "",
@@ -1169,7 +1239,12 @@
};
const formattedNumber = (row, column, cellValue) => {
- return parseFloat(cellValue).toFixed(2);
+ if (cellValue === undefined || cellValue === null || cellValue === "") {
+ return "0.00";
+ }
+ const num = Number(cellValue);
+ if (Number.isNaN(num)) return "0.00";
+ return num.toFixed(2);
};
// 鏌ヨ鍒楄〃
/** 鎼滅储鎸夐挳鎿嶄綔 */
@@ -1280,6 +1355,8 @@
return proxy.summarizeTable(
param,
[
+ "freightUnitPrice",
+ "totalFreight",
"taxInclusiveUnitPrice",
"taxInclusiveTotalPrice",
"taxExclusiveTotalPrice",
@@ -1403,18 +1480,16 @@
stockInLoading.value = true;
const params = {
purchaseLedgerId: stockInForm.purchaseLedgerId,
- purchaseContractNumber: stockInForm.purchaseContractNumber,
- nickName: userStore.nickName,
details: stockInForm.details.map(item => ({
id: item.id,
- inboundQuantity: item.inboundQuantity,
- isContainsWater: item.isContainsWater,
- waterContent: item.isContainsWater ? item.waterContent : 0,
- actualInboundQuantity: item.actualInboundQuantity,
+ inboundQuantity: Number(item.inboundQuantity),
+ isContainsWater: !!item.isContainsWater,
+ waterContent: item.isContainsWater ? Number(item.waterContent || 0) : 0,
+ actualInboundQuantity: Number(item.actualInboundQuantity),
})),
};
- const res = await addSutockIn(params);
+ const res = await manualStockIn(params);
if (res.code === 200) {
proxy.$modal.msgSuccess("鍏ュ簱鎴愬姛");
stockInDialogVisible.value = false;
@@ -1464,6 +1539,7 @@
"taxInclusiveUnitPrice",
"taxInclusiveTotalPrice",
"taxExclusiveTotalPrice",
+ "totalFreight",
]);
};
// 鎵撳紑寮规
@@ -1670,6 +1746,12 @@
if (type === "edit") {
// 澶嶅埗琛屾暟鎹�
productForm.value = { ...row };
+ if (productForm.value.freightUnitPrice === undefined) {
+ productForm.value.freightUnitPrice = "";
+ }
+ if (productForm.value.totalFreight === undefined) {
+ productForm.value.totalFreight = "";
+ }
// 濡傛灉鏄粠妯℃澘鍔犺浇鐨勬暟鎹紝鍙兘娌℃湁 productId 鍜� productModelId
// 闇�瑕佹牴鎹� productCategory 鍜� specificationModel 鏉ユ煡鎵惧搴旂殑 ID
@@ -1734,6 +1816,34 @@
// 鏈�鍚庡啀绛夊緟涓�娆� DOM 鏇存柊锛岀‘淇濇墍鏈夋暟鎹兘宸茶缃�
await nextTick();
}
+ computeTotalFreight();
+ };
+
+ const computeTotalFreight = () => {
+ const hasQuantity =
+ productForm.value.quantity !== "" &&
+ productForm.value.quantity !== null &&
+ productForm.value.quantity !== undefined;
+ const hasFreightUnitPrice =
+ productForm.value.freightUnitPrice !== "" &&
+ productForm.value.freightUnitPrice !== null &&
+ productForm.value.freightUnitPrice !== undefined;
+ if (!hasQuantity || !hasFreightUnitPrice) return;
+
+ const quantity = Number(productForm.value.quantity);
+ const freightUnitPrice = Number(productForm.value.freightUnitPrice);
+ if (!Number.isFinite(quantity) || !Number.isFinite(freightUnitPrice)) return;
+
+ productForm.value.totalFreight = (quantity * freightUnitPrice).toFixed(2);
+ };
+
+ const handleQuantityChange = () => {
+ mathNum();
+ computeTotalFreight();
+ };
+
+ const handleFreightUnitPriceChange = () => {
+ computeTotalFreight();
};
const getProductOptions = () => {
return productTreeList().then(res => {
@@ -1918,6 +2028,37 @@
});
};
+ 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("宸插彇娑�");
+ });
+ };
+
// 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲涓� YYYY-MM-DD
function getCurrentDate() {
const today = new Date();
--
Gitblit v1.9.3