From 4757a82a4d00198dde15dca7aebb7742f163f52a Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期日, 16 八月 2026 11:20:55 +0800
Subject: [PATCH] fix: 采购台账移除供应商等级
---
src/views/procurementManagement/procurementLedger/index.vue | 127 +++++++++++++++++++++++++++++++++---------
1 files changed, 99 insertions(+), 28 deletions(-)
diff --git a/src/views/procurementManagement/procurementLedger/index.vue b/src/views/procurementManagement/procurementLedger/index.vue
index 2c9cec6..2e02c1f 100644
--- a/src/views/procurementManagement/procurementLedger/index.vue
+++ b/src/views/procurementManagement/procurementLedger/index.vue
@@ -45,6 +45,7 @@
<el-button @click="handleOut">瀵煎嚭</el-button>
<el-button type="danger" plain @click="handleDelete">鍒犻櫎
</el-button>
+ <el-button type="warning" plain @click="handlePrint">鎵撳嵃鍗曟嵁</el-button>
</div>
<el-table :data="tableData" border v-loading="tableLoading" @selection-change="handleSelectionChange"
:expand-row-keys="expandedRowKeys" :row-key="(row) => row.id" show-summary :summary-method="summarizeMainTable"
@@ -100,14 +101,14 @@
<el-table-column label="褰曞叆浜�" prop="recorderName" width="120" show-overflow-tooltip />
<el-table-column label="褰曞叆鏃ユ湡" prop="entryDate" width="100" show-overflow-tooltip />
<el-table-column label="澶囨敞" prop="remarks" width="200" show-overflow-tooltip />
- <el-table-column fixed="right" label="鎿嶄綔" width="180" align="center">
+ <el-table-column fixed="right" label="鎿嶄綔" width="220" align="center">
<template #default="scope">
<el-button link type="primary" @click="openForm('detail', scope.row)">璇︽儏
</el-button>
<el-button link type="primary" @click="openForm('edit', scope.row)"
:disabled="scope.row.stockInStatus === '瀹屽叏鍏ュ簱'">缂栬緫
</el-button>
- <el-button link type="primary" @click="openFileDialog(scope.row)">闄勪欢</el-button>
+ <el-button link type="primary" @click="downloadOrder(scope.row.id)">涓嬭浇</el-button>
</template>
</el-table-column>
</el-table>
@@ -136,7 +137,7 @@
<el-col :span="12">
<el-form-item label="渚涘簲鍟嗗悕绉帮細" prop="supplierId">
<el-select v-model="form.supplierId" placeholder="璇烽�夋嫨" filterable clearable>
- <el-option v-for="item in supplierList" :key="item.id" :label="item.supplierName" :value="item.id">{{ item.supplierName + '---' + item.supplierType }}</el-option>
+ <el-option v-for="item in supplierList" :key="item.id" :label="item.supplierName" :value="item.id">{{ item.supplierName }}</el-option>
</el-select>
</el-form-item>
</el-col>
@@ -161,7 +162,7 @@
<el-row :gutter="30">
<el-col :span="12">
<el-form-item label="褰曞叆浜猴細" prop="recorderId">
- <el-select v-model="form.recorderId" placeholder="璇烽�夋嫨" clearable filterable>
+ <el-select v-model="form.recorderId" placeholder="璇烽�夋嫨" clearable filterable disabled>
<el-option v-for="item in userList" :key="item.userId" :label="item.nickName" :value="item.userId" />
</el-select>
</el-form-item>
@@ -310,7 +311,7 @@
<el-row :gutter="30">
<el-col :span="12">
<el-form-item label="鍚◣鍗曚环(鍏�)锛�" prop="taxInclusiveUnitPrice">
- <el-input-number v-model="productForm.taxInclusiveUnitPrice" :precision="2" :step="0.1" :min="0" clearable
+ <el-input-number v-model="productForm.taxInclusiveUnitPrice" :precision="6" :step="0.000001" :min="0" clearable
style="width: 100%" @change="mathNum" />
</el-form-item>
</el-col>
@@ -324,13 +325,13 @@
<el-row :gutter="30">
<el-col :span="12">
<el-form-item label="鍚◣鎬讳环(鍏�)锛�" prop="taxInclusiveTotalPrice">
- <el-input-number v-model="productForm.taxInclusiveTotalPrice" :precision="2" :step="0.1" :min="0"
+ <el-input-number v-model="productForm.taxInclusiveTotalPrice" :precision="6" :step="0.000001" :min="0"
clearable style="width: 100%" @change="reverseMathNum('taxInclusiveTotalPrice')" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="涓嶅惈绋庢�讳环(鍏�)锛�" prop="taxExclusiveTotalPrice">
- <el-input-number v-model="productForm.taxExclusiveTotalPrice" :precision="2" :step="0.1" :min="0"
+ <el-input-number v-model="productForm.taxExclusiveTotalPrice" :precision="6" :step="0.000001" :min="0"
clearable style="width: 100%" @change="reverseMathNum('taxExclusiveTotalPrice')" />
</el-form-item>
</el-col>
@@ -411,6 +412,7 @@
productList,
getPurchaseById,
getOptions,
+ getPrintData,
getPurchaseTemplateList,
delPurchaseTemplate,
} from "@/api/procurementManagement/procurementLedger.js";
@@ -445,6 +447,8 @@
import { modelList, productTreeList } from "@/api/basicData/product.js";
import dayjs from "dayjs";
import FileUpload from "@/components/AttachmentUpload/file/index.vue";
+import { tableAmountFormatter, formatDecimal, buildAmountSummaryFormat } from '@/utils/numberFormat';
+import { downloadPurchaseJpg, printPurchaseMulti } from "@/utils/documentPrint.js";
const userStore = useUserStore();
@@ -771,9 +775,7 @@
handleQuery();
};
-const formattedNumber = (row, column, cellValue) => {
- return parseFloat(cellValue).toFixed(2);
-};
+const formattedNumber = tableAmountFormatter;
// 鏌ヨ鍒楄〃
/** 鎼滅储鎸夐挳鎿嶄綔 */
const handleQuery = () => {
@@ -891,10 +893,19 @@
"futureTickets",
"futureTicketsAmount",
],
- {
- ticketsNum: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
- futureTickets: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
- }
+ buildAmountSummaryFormat(
+ [
+ "taxInclusiveUnitPrice",
+ "taxInclusiveTotalPrice",
+ "taxExclusiveTotalPrice",
+ "ticketsAmount",
+ "futureTicketsAmount",
+ ],
+ {
+ ticketsNum: { noDecimal: true },
+ futureTickets: { noDecimal: true },
+ }
+ )
);
};
const paginationChange = obj => {
@@ -957,15 +968,27 @@
};
// 涓昏〃鍚堣鏂规硶
const summarizeMainTable = param => {
- return proxy.summarizeTable(param, ["contractAmount"]);
+ return proxy.summarizeTable(
+ param,
+ ["contractAmount"],
+ buildAmountSummaryFormat(["contractAmount"])
+ );
};
// 瀛愯〃鍚堣鏂规硶
const summarizeProTable = param => {
- return proxy.summarizeTable(param, [
- "taxInclusiveUnitPrice",
- "taxInclusiveTotalPrice",
- "taxExclusiveTotalPrice",
- ]);
+ return proxy.summarizeTable(
+ param,
+ [
+ "taxInclusiveUnitPrice",
+ "taxInclusiveTotalPrice",
+ "taxExclusiveTotalPrice",
+ ],
+ buildAmountSummaryFormat([
+ "taxInclusiveUnitPrice",
+ "taxInclusiveTotalPrice",
+ "taxExclusiveTotalPrice",
+ ])
+ );
};
// 鎵撳紑寮规
const openForm = async (type, row) => {
@@ -1006,6 +1029,7 @@
);
form.value.entryDate = getCurrentDate();
+ form.value.recorderId = userStore.id;
if (type === "add") {
// 鏂板鏃剁敓鎴愰噰璐悎鍚屽彿
@@ -1415,6 +1439,31 @@
});
};
+// 鎵归噺鎵撳嵃閲囪喘鍗� - 澶氶�夊悎骞堕瑙�
+const handlePrint = async () => {
+ if (selectedRows.value.length === 0) {
+ proxy.$modal.msgWarning("璇烽�夋嫨瑕佹墦鍗扮殑鏁版嵁");
+ return;
+ }
+ proxy.$modal.loading("姝e湪鍔犺浇鎵撳嵃鏁版嵁...");
+ try {
+ const orders = [];
+ let companyName = '';
+ for (const row of selectedRows.value) {
+ const res = await getPrintData(row.id);
+ const data = res.data || res;
+ companyName = data.companyName || companyName;
+ orders.push({ ledger: data.ledger, products: data.products });
+ }
+ printPurchaseMulti(companyName, orders);
+ } catch (e) {
+ console.error('鎵撳嵃澶辫触:', e);
+ proxy.$modal.msgError("鎵撳嵃澶辫触");
+ } finally {
+ proxy.$modal.closeLoading();
+ }
+};
+
// 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲涓� YYYY-MM-DD
function getCurrentDate() {
const today = new Date();
@@ -1474,10 +1523,10 @@
if (field === "taxInclusiveTotalPrice") {
// 宸茬煡鍚◣鎬讳环鍜屾暟閲忥紝鍙嶇畻鍚◣鍗曚环
if (productForm.value.quantity) {
- productForm.value.taxInclusiveUnitPrice = (
+ productForm.value.taxInclusiveUnitPrice = formatDecimal(
Number(productForm.value.taxInclusiveTotalPrice) /
Number(productForm.value.quantity)
- ).toFixed(2);
+ );
// 纭繚缁撴灉涓嶄负璐熸暟
if (Number(productForm.value.taxInclusiveUnitPrice) < 0) {
productForm.value.taxInclusiveUnitPrice = "0";
@@ -1495,30 +1544,30 @@
}
}
// 鍙嶇畻涓嶅惈绋庢�讳环
- productForm.value.taxExclusiveTotalPrice = (
+ productForm.value.taxExclusiveTotalPrice = formatDecimal(
Number(productForm.value.taxInclusiveTotalPrice) /
(1 + taxRate / 100)
- ).toFixed(2);
+ );
// 纭繚缁撴灉涓嶄负璐熸暟
if (Number(productForm.value.taxExclusiveTotalPrice) < 0) {
productForm.value.taxExclusiveTotalPrice = "0";
}
} else if (field === "taxExclusiveTotalPrice") {
// 鍙嶇畻鍚◣鎬讳环
- productForm.value.taxInclusiveTotalPrice = (
+ productForm.value.taxInclusiveTotalPrice = formatDecimal(
Number(productForm.value.taxExclusiveTotalPrice) *
(1 + taxRate / 100)
- ).toFixed(2);
+ );
// 纭繚缁撴灉涓嶄负璐熸暟
if (Number(productForm.value.taxInclusiveTotalPrice) < 0) {
productForm.value.taxInclusiveTotalPrice = "0";
}
// 宸茬煡鏁伴噺锛屽弽绠楀惈绋庡崟浠�
if (productForm.value.quantity) {
- productForm.value.taxInclusiveUnitPrice = (
+ productForm.value.taxInclusiveUnitPrice = formatDecimal(
Number(productForm.value.taxInclusiveTotalPrice) /
Number(productForm.value.quantity)
- ).toFixed(2);
+ );
// 纭繚缁撴灉涓嶄负璐熸暟
if (Number(productForm.value.taxInclusiveUnitPrice) < 0) {
productForm.value.taxInclusiveUnitPrice = "0";
@@ -1568,6 +1617,28 @@
fileListDialogVisible.value = true;
};
+// 涓嬭浇閲囪喘鍗�
+const downloadOrder = async (id) => {
+ try {
+ const res = await getPrintData(id);
+ const data = res.data || res;
+ downloadPurchaseJpg(data.companyName, data.ledger, data.products, '閲囪喘鍗昣' + (data.ledger.purchaseContractNumber || id) + '.jpg');
+ } catch (e) {
+ console.error('涓嬭浇澶辫触:', e);
+ }
+};
+
+// 鎵撳嵃閲囪喘鍗�
+const printOrder = async (id) => {
+ try {
+ const res = await getPrintData(id);
+ const data = res.data || res;
+ printPurchase(data.companyName, data.ledger, data.products);
+ } catch (e) {
+ console.error('鎵撳嵃澶辫触:', e);
+ }
+};
+
// 鍒犻櫎妯℃澘
const handleDeleteTemplate = async item => {
if (!item.id) {
--
Gitblit v1.9.3