From 0d0505232d49c9d09f15f03cb66a4f9be6257fce Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期一, 26 一月 2026 14:23:19 +0800
Subject: [PATCH] feat: BOM导入模板下载功能
---
src/views/inventoryManagement/stockManagement/index.vue | 154 ++++++++++++++++++++++++++++++++++++---------------
1 files changed, 109 insertions(+), 45 deletions(-)
diff --git a/src/views/inventoryManagement/stockManagement/index.vue b/src/views/inventoryManagement/stockManagement/index.vue
index e6fb48d..dd27462 100644
--- a/src/views/inventoryManagement/stockManagement/index.vue
+++ b/src/views/inventoryManagement/stockManagement/index.vue
@@ -49,36 +49,28 @@
width="60" />
<el-table-column label="鍏ュ簱鏃ユ湡"
prop="createTime"
- width="100"
- show-overflow-tooltip />
- <el-table-column label="閿�鍞悎鍚屽彿"
- prop="salesContractNo"
+ width="120">
+ <template #default="scope">
+ {{ parseTime(scope.row.createTime, '{y}-{m}-{d}') || '-' }}
+ </template>
+ </el-table-column>
+ <el-table-column label="浜у搧鍚嶇О"
+ prop="productName"
width="180"
show-overflow-tooltip />
- <el-table-column label="浜у搧澶х被"
- prop="productCategory"
- show-overflow-tooltip />
- <el-table-column label="瑙勬牸鍨嬪彿"
- prop="specificationModel"
+ <el-table-column label="浜у搧瑙勬牸"
+ prop="model"
show-overflow-tooltip />
<el-table-column label="鍗曚綅"
prop="unit"
width="80"
show-overflow-tooltip />
<el-table-column label="宸插嚭搴撴暟閲�"
- prop="totalInboundNum"
- width="100"
+ prop="outboundNum"
show-overflow-tooltip />
<el-table-column label="鍓╀綑搴撳瓨"
- prop="inboundNum0"
- width="100"
+ prop="stockQuantity"
show-overflow-tooltip />
- <el-table-column label="鍗曚环(鍏�)"
- prop="unitPrice"
- width="150"></el-table-column>
- <el-table-column label="鎬讳环(鍏�)"
- prop="totalPrice"
- width="150"></el-table-column>
<!-- <el-table-column fixed="right" label="鎿嶄綔" min-width="60" align="center">
<template #default="scope">
<el-button link type="primary" size="small" @click="openForm('edit', scope.row);">缂栬緫</el-button>
@@ -116,6 +108,12 @@
</div>
<div>
<el-button @click="handleOut">瀵煎嚭</el-button>
+ <el-button type="danger"
+ plain
+ @click="handleFrozen">鍐荤粨</el-button>
+ <el-button type="success"
+ plain
+ @click="handleThaw">瑙e喕</el-button>
<!-- <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>-->
</div>
</div>
@@ -140,8 +138,12 @@
width="60" />
<el-table-column label="鍏ュ簱鏃ユ湡"
prop="createTime"
- width="100"
- show-overflow-tooltip />
+ width="120"
+ show-overflow-tooltip>
+ <template #default="scope">
+ {{ parseTime(scope.row.createTime, '{y}-{m}-{d}') || '-' }}
+ </template>
+ </el-table-column>
<el-table-column label="閲囪喘鍚堝悓鍙�"
prop="purchaseContractNumber"
width="180"
@@ -168,6 +170,16 @@
<el-table-column label="鍚◣鎬讳环(鍏�)"
prop="taxInclusiveTotalPrice"
width="150"></el-table-column>
+ <el-table-column label="鐘舵��"
+ align="center"
+ prop="isFrozen"
+ width="100">
+ <template #default="scope">
+ <el-tag :type="scope.row.isFrozen ? 'danger' : 'success'">
+ {{ scope.row.isFrozen ? '宸插喕缁�' : '姝e父' }}
+ </el-tag>
+ </template>
+ </el-table-column>
</el-table>
<pagination v-show="total > 0"
:total="total"
@@ -203,7 +215,9 @@
import {
getStockManagePage,
getStockManagePageByProduction,
- delStockManage,
+ delStockManage, getStockManageProduction,
+ frozenQuality,
+ thawQuality,
} from "@/api/inventoryManagement/stockManage.js";
import {
updateManagement,
@@ -337,7 +351,7 @@
const params = buildQueryParams();
const apiCall =
activeTab.value === "production"
- ? getStockManagePageByProduction(params)
+ ? getStockManageProduction(params)
: getStockManagePage(params);
apiCall
.then(res => {
@@ -345,28 +359,28 @@
tableData.value = res.data.records;
// 涓鸿〃鏍兼暟鎹嚜鍔ㄨ绠楁�讳环
- tableData.value = tableData.value.map(item => {
- // 璁$畻鍓╀綑搴撳瓨
- const stockQuantity = parseFloat(item.inboundNum) || 0;
- const outboundQuantity = parseFloat(item.totalInboundNum) || 0;
- const remainingStock = Math.max(stockQuantity - outboundQuantity, 0);
-
- // 鏍规嵁鏍囩椤电被鍨嬭绠楁�讳环
- if (activeTab.value === "production") {
- // 鎴愬搧搴撳瓨锛氭�讳环 = 鍗曚环 脳 鍓╀綑搴撳瓨
- const unitPrice = parseFloat(item.unitPrice) || 0;
- item.totalPrice = (unitPrice * remainingStock).toFixed(2);
- } else if (activeTab.value === "purchase") {
- // 鍘熸枡搴撳瓨锛氬惈绋庢�讳环 = 鍚◣鍗曚环 脳 鍓╀綑搴撳瓨
- const taxInclusiveUnitPrice =
- parseFloat(item.taxInclusiveUnitPrice) || 0;
- item.taxInclusiveTotalPrice = (
- taxInclusiveUnitPrice * remainingStock
- ).toFixed(2);
- }
-
- return item;
- });
+ // tableData.value = tableData.value.map(item => {
+ // // 璁$畻鍓╀綑搴撳瓨
+ // const stockQuantity = parseFloat(item.inboundNum) || 0;
+ // const outboundQuantity = parseFloat(item.totalInboundNum) || 0;
+ // const remainingStock = Math.max(stockQuantity - outboundQuantity, 0);
+ //
+ // // 鏍规嵁鏍囩椤电被鍨嬭绠楁�讳环
+ // if (activeTab.value === "production") {
+ // // 鎴愬搧搴撳瓨锛氭�讳环 = 鍗曚环 脳 鍓╀綑搴撳瓨
+ // const unitPrice = parseFloat(item.unitPrice) || 0;
+ // item.totalPrice = (unitPrice * remainingStock).toFixed(2);
+ // } else if (activeTab.value === "purchase") {
+ // // 鍘熸枡搴撳瓨锛氬惈绋庢�讳环 = 鍚◣鍗曚环 脳 鍓╀綑搴撳瓨
+ // const taxInclusiveUnitPrice =
+ // parseFloat(item.taxInclusiveUnitPrice) || 0;
+ // item.taxInclusiveTotalPrice = (
+ // taxInclusiveUnitPrice * remainingStock
+ // ).toFixed(2);
+ // }
+ //
+ // return item;
+ // });
total.value = res.data.total;
// 鏁版嵁鍔犺浇瀹屾垚鍚庢鏌ュ簱瀛�
@@ -538,6 +552,56 @@
proxy.$modal.msg("宸插彇娑�");
});
};
+
+ // 鍐荤粨
+ const handleFrozen = () => {
+ let ids = [];
+ if (selectedRows.value.length > 0) {
+ ids = selectedRows.value.map(item => item.id);
+ } else {
+ proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
+ return;
+ }
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚爣璁颁负涓嶅悎鏍间骇鍝佸苟鍐荤粨锛屾槸鍚︾‘璁�?", "璀﹀憡", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ frozenQuality(ids).then(res => {
+ proxy.$modal.msgSuccess("鎿嶄綔鎴愬姛");
+ getList();
+ });
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+ };
+
+ // 瑙e喕
+ const handleThaw = () => {
+ let ids = [];
+ if (selectedRows.value.length > 0) {
+ ids = selectedRows.value.map(item => item.id);
+ } else {
+ proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
+ return;
+ }
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚В鍐伙紝鏄惁纭?", "鎻愮ず", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "success",
+ })
+ .then(() => {
+ thawQuality(ids).then(res => {
+ proxy.$modal.msgSuccess("鎿嶄綔鎴愬姛");
+ getList();
+ });
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+ };
// 鍒犻櫎
const handleDelete = () => {
let ids = [];
--
Gitblit v1.9.3