From 8dc3efeb84c11e046ef2a77ccf7cbefb83bdc373 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期二, 27 一月 2026 13:22:45 +0800
Subject: [PATCH] 迁移仓储物流页面
---
src/api/basicData/enum.js | 23
src/views/inventoryManagement/stockManagement/New.vue | 180 +
src/api/inventoryManagement/stockUninventory.js | 27
src/api/inventoryManagement/stockInRecord.js | 27
src/views/inventoryManagement/issueManagement/index.vue | 848 ++------
src/views/inventoryManagement/stockManagement/Qualified.vue | 179 +
src/views/inventoryManagement/stockWarning/index.vue | 3
src/api/inventoryManagement/stockInventory.js | 43
src/api/inventoryManagement/stockManage.js | 36
src/views/inventoryManagement/dispatchLog/Record.vue | 711 +++++++
src/views/inventoryManagement/stockManagement/Import.vue | 93
/dev/null | 147 -
src/api/inventoryManagement/stockOut.js | 37
src/views/inventoryManagement/receiptManagement/index.vue | 548 -----
src/views/inventoryManagement/stockManagement/index.vue | 738 -------
src/utils/index.js | 13
vite.config.js | 2
src/views/inventoryManagement/stockManagement/Subtract.vue | 199 ++
src/views/inventoryManagement/stockManagement/Unqualified.vue | 158 +
src/views/inventoryManagement/stockReport/index.vue | 333 +--
src/views/inventoryManagement/dispatchLog/index.vue | 1003 ----------
src/views/inventoryManagement/receiptManagement/Record.vue | 250 ++
22 files changed, 2,382 insertions(+), 3,216 deletions(-)
diff --git a/src/api/basicData/enum.js b/src/api/basicData/enum.js
new file mode 100644
index 0000000..0d35692
--- /dev/null
+++ b/src/api/basicData/enum.js
@@ -0,0 +1,23 @@
+import request from "@/utils/request.js";
+
+export function findAllStockRecordTypeOptions() {
+ return request({
+ url: '/basic/enum/stockRecordType',
+ method: 'get'
+ })
+}
+
+
+export function findAllQualifiedStockRecordTypeOptions() {
+ return request({
+ url: '/basic/enum/StockQualifiedRecordTypeEnum',
+ method: 'get'
+ })
+}
+
+export function findAllUnqualifiedStockRecordTypeOptions() {
+ return request({
+ url: '/basic/enum/StockUnQualifiedRecordTypeEnum',
+ method: 'get'
+ })
+}
diff --git a/src/api/inventoryManagement/stockInRecord.js b/src/api/inventoryManagement/stockInRecord.js
new file mode 100644
index 0000000..1746bfe
--- /dev/null
+++ b/src/api/inventoryManagement/stockInRecord.js
@@ -0,0 +1,27 @@
+import request from "@/utils/request";
+
+// 鏌ヨ鍏ュ簱淇℃伅鍒楄〃
+export const getStockInRecordListPage = (params) => {
+ return request({
+ url: "/stockInRecord/listPage",
+ method: "get",
+ params,
+ });
+};
+
+
+export const updateStockInRecord = (id, data) => {
+ return request({
+ url: "/stockInRecord/" + id,
+ method: "put",
+ data: data,
+ });
+};
+
+export const batchDeleteStockInRecords = (ids) => {
+ return request({
+ url: "/stockInRecord",
+ method: "delete",
+ data: ids,
+ });
+};
\ No newline at end of file
diff --git a/src/api/inventoryManagement/stockInventory.js b/src/api/inventoryManagement/stockInventory.js
new file mode 100644
index 0000000..15e1b3a
--- /dev/null
+++ b/src/api/inventoryManagement/stockInventory.js
@@ -0,0 +1,43 @@
+import request from "@/utils/request.js";
+// 鍒嗛〉鏌ヨ搴撳瓨璁板綍鍒楄〃
+export const getStockInventoryListPage = (params) => {
+ return request({
+ url: "/stockInventory/pagestockInventory",
+ method: "get",
+ params,
+ });
+};
+
+// 鍒涘缓搴撳瓨璁板綍
+export const createStockInventory = (params) => {
+ return request({
+ url: "/stockInventory/addstockInventory",
+ method: "post",
+ data: params,
+ });
+};
+
+// 鍑忓皯搴撳瓨璁板綍
+export const subtractStockInventory = (params) => {
+ return request({
+ url: "/stockInventory/subtractStockInventory",
+ method: "post",
+ data: params,
+ });
+};
+
+export const getStockInventoryReportList = (params) => {
+ return request({
+ url: "/stockInventory/stockInventoryPage",
+ method: "get",
+ params,
+ });
+};
+
+export const getStockInventoryInAndOutReportList = (params) => {
+ return request({
+ url: "/stockInventory/stockInAndOutRecord",
+ method: "get",
+ params,
+ });
+};
diff --git a/src/api/inventoryManagement/stockManage.js b/src/api/inventoryManagement/stockManage.js
index 8278be3..e2a4ebf 100644
--- a/src/api/inventoryManagement/stockManage.js
+++ b/src/api/inventoryManagement/stockManage.js
@@ -80,38 +80,4 @@
})
}
-// 閲囪喘鍏ュ簱-搴撳瓨绠$悊-鍐荤粨涓嶅悎鏍间骇鍝�
-export function frozenQuality(ids) {
- return request({
- url: '/stockin/frozenStorageQuality',
- method: 'post',
- data: ids
- })
-}
-
-// 閲囪喘鍏ュ簱-搴撳瓨绠$悊-瑙e喕涓嶅悎鏍间骇鍝�
-export function thawQuality(ids) {
- return request({
- url: '/stockin/thawStorageQuality',
- method: 'post',
- data: ids
- })
-}
-
-// 鎴愬搧鍏ュ簱-搴撳瓨绠$悊-鍐荤粨涓嶅悎鏍间骇鍝�
-export function frozenFinishedQuality(ids) {
- return request({
- url: '/stockin/frozenFinishedQuality',
- method: 'post',
- data: ids
- })
-}
-
-// 鎴愬搧鍏ュ簱-搴撳瓨绠$悊-瑙e喕涓嶅悎鏍间骇鍝�
-export function thawFinishedQuality(ids) {
- return request({
- url: '/stockin/thawFinishedQuality',
- method: 'post',
- data: ids
- })
-}
\ No newline at end of file
+//
\ No newline at end of file
diff --git a/src/api/inventoryManagement/stockOut.js b/src/api/inventoryManagement/stockOut.js
index f1b36d9..3d260b3 100644
--- a/src/api/inventoryManagement/stockOut.js
+++ b/src/api/inventoryManagement/stockOut.js
@@ -3,44 +3,17 @@
// 鍑哄簱鍙拌处-閲囪喘鍑哄簱鏌ヨ鍑哄簱鍒楄〃
export const getStockOutPage = (params) => {
return request({
- url: "/stockmanagement/listPage",
+ url: "/stockOutRecord/listPage",
method: "get",
params,
});
};
-
-// 鍑哄簱鍙拌处-鐢熶骇鍑哄簱鏌ヨ鍑哄簱鍒楄〃
-export const getStockOutSemiProductPage = (params) => {
- return request({
- url: "/stockmanagement/listPageBySemiProduct",
- method: "get",
- params,
- });
-};
-
-//鏂板鍑哄簱淇℃伅
-export const addStockOut = (data) => {
- return request({
- url: '/stockout/add',
- method: 'post',
- data: data
- })
-}
-
-//淇敼鍑哄簱淇℃伅
-export const updateStockOut = (data) => {
- return request({
- url: "/stockout/update",
- method: "put",
- data,
- });
-}
//鍒犻櫎鍑哄簱淇℃伅
export const delStockOut = (ids) => {
return request({
- url: '/stockmanagement/del',
- method: 'post',
- data: ids
- })
+ url: "/stockOutRecord",
+ method: "delete",
+ data: ids,
+ });
}
diff --git a/src/api/inventoryManagement/stockUninventory.js b/src/api/inventoryManagement/stockUninventory.js
new file mode 100644
index 0000000..bdde283
--- /dev/null
+++ b/src/api/inventoryManagement/stockUninventory.js
@@ -0,0 +1,27 @@
+import request from "@/utils/request.js";
+// 鍒嗛〉鏌ヨ搴撳瓨璁板綍鍒楄〃
+export const getStockUninventoryListPage = (params) => {
+ return request({
+ url: "/stockUninventory/pagestockUninventory",
+ method: "get",
+ params,
+ });
+};
+
+// 鍒涘缓搴撳瓨璁板綍
+export const createStockUnInventory = (params) => {
+ return request({
+ url: "/stockUninventory/addstockUninventory",
+ method: "post",
+ data: params,
+ });
+};
+
+// 鍑忓皯搴撳瓨璁板綍
+export const subtractStockUnInventory = (params) => {
+ return request({
+ url: "/stockUninventory/subtractstockUninventory",
+ method: "post",
+ data: params,
+ });
+};
diff --git a/src/utils/index.js b/src/utils/index.js
index e522c3c..809593f 100644
--- a/src/utils/index.js
+++ b/src/utils/index.js
@@ -396,3 +396,16 @@
export function isEqual(obj1, obj2) {
return JSON.stringify(obj1) === JSON.stringify(obj2);
}
+
+/**
+ * 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲涓� YYYY-MM-DD
+ * @returns {string} 鏍煎紡鍖栫殑鏃ユ湡瀛楃涓�
+ */
+export function getCurrentDate() {
+ const today = new Date();
+ const year = today.getFullYear();
+ const month = String(today.getMonth() + 1).padStart(2, '0'); // 鏈堜唤浠�0寮�濮�
+ const day = String(today.getDate()).padStart(2, '0');
+ return `${year}-${month}-${day}`;
+}
+
diff --git a/src/views/inventoryManagement/dispatchLog/Record.vue b/src/views/inventoryManagement/dispatchLog/Record.vue
new file mode 100644
index 0000000..6fa29c8
--- /dev/null
+++ b/src/views/inventoryManagement/dispatchLog/Record.vue
@@ -0,0 +1,711 @@
+<template>
+ <div class="app-container">
+ <div class="search_form">
+ <div>
+ <span class="search_title ml10">鍑哄簱鏃ユ湡锛�</span>
+ <el-date-picker
+ v-model="searchForm.timeStr"
+ type="date"
+ placeholder="璇烽�夋嫨鏃ユ湡"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ clearable
+ @change="handleQuery"
+ />
+ <span class="search_title ml10">鏉ユ簮锛�</span>
+ <el-select v-model="searchForm.recordType"
+ style="width: 240px"
+ placeholder="璇烽�夋嫨"
+ clearable>
+ <el-option v-for="item in stockRecordTypeOptions"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value"/>
+ </el-select>
+ <el-button type="primary" @click="handleQuery" style="margin-left: 10px"
+ >鎼滅储</el-button
+ >
+ </div>
+ <div>
+ <el-button @click="handleOut">瀵煎嚭</el-button>
+ <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>
+ <el-button type="primary" plain @click="handlePrint">鎵撳嵃</el-button>
+ </div>
+ </div>
+ <div class="table_list">
+ <el-table
+ :data="tableData"
+ border
+ v-loading="tableLoading"
+ @selection-change="handleSelectionChange"
+ :expand-row-keys="expandedRowKeys"
+ :row-key="(row) => row.id"
+ style="width: 100%"
+ height="calc(100vh - 18.5em)"
+ >
+ <el-table-column align="center" type="selection" width="55" />
+ <el-table-column align="center" label="搴忓彿" type="index" width="60" />
+ <el-table-column
+ label="鍑哄簱鎵规"
+ prop="outboundBatches"
+ min-width="100"
+ show-overflow-tooltip
+ />
+ <el-table-column
+ label="鍑哄簱鏃ユ湡"
+ prop="createTime"
+ show-overflow-tooltip
+ />
+ <el-table-column
+ label="浜у搧澶х被"
+ prop="productName"
+ show-overflow-tooltip
+ />
+ <el-table-column
+ label="瑙勬牸鍨嬪彿"
+ prop="model"
+ show-overflow-tooltip
+ />
+ <el-table-column
+ label="鍗曚綅"
+ prop="unit"
+ show-overflow-tooltip
+ />
+ <el-table-column
+ label="鍑哄簱鏁伴噺"
+ prop="stockOutNum"
+ show-overflow-tooltip
+ />
+ <el-table-column
+ label="鍑哄簱浜�"
+ prop="createBy"
+ show-overflow-tooltip
+ />
+ <el-table-column label="鏉ユ簮"
+ prop="recordType"
+ show-overflow-tooltip>
+ <template #default="scope">
+ {{ getRecordType(scope.row.recordType) }}
+ </template>
+ </el-table-column>
+ </el-table>
+ <pagination
+ v-show="total > 0"
+ :total="total"
+ layout="total, sizes, prev, pager, next, jumper"
+ :page="page.current"
+ :limit="page.size"
+ @pagination="paginationChange"
+ />
+ </div>
+ </div>
+</template>
+
+<script setup>
+import pagination from "@/components/PIMTable/Pagination.vue";
+import { ref } from "vue";
+import { ElMessageBox } from "element-plus";
+import useUserStore from "@/store/modules/user";
+import { getCurrentDate } from "@/utils/index.js";
+import {
+ getStockOutPage,
+ delStockOut,
+} from "@/api/inventoryManagement/stockOut.js";
+import {
+ findAllQualifiedStockRecordTypeOptions,
+ findAllStockRecordTypeOptions,
+ findAllUnqualifiedStockRecordTypeOptions
+} from "@/api/basicData/enum.js";
+
+const userStore = useUserStore();
+const { proxy } = getCurrentInstance();
+const tableData = ref([]);
+const selectedRows = ref([]);
+const tableLoading = ref(false);
+// 鏉ユ簮绫诲瀷閫夐」
+const stockRecordTypeOptions = ref([]);
+const page = reactive({
+ current: 1,
+ size: 100,
+});
+const total = ref(0);
+
+const props = defineProps({
+ type: {
+ type: String,
+ required: true,
+ default: '0'
+ }
+})
+
+// 鎵撳嵃鐩稿叧
+const printPreviewVisible = ref(false);
+const printData = ref([]);
+
+// 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁
+const data = reactive({
+ searchForm: {
+ supplierName: "",
+ timeStr: "",
+ recordType: "",
+ }
+});
+const { searchForm } = toRefs(data);
+
+// 鏌ヨ鍒楄〃
+/** 鎼滅储鎸夐挳鎿嶄綔 */
+const handleQuery = () => {
+ page.current = 1;
+ getList();
+};
+const paginationChange = (obj) => {
+ page.current = obj.page;
+ page.size = obj.limit;
+ getList();
+};
+const getList = () => {
+ tableLoading.value = true;
+ getStockOutPage({ ...searchForm.value, ...page, type: props.type })
+ .then((res) => {
+ tableLoading.value = false;
+ tableData.value = res.data.records;
+ tableData.value.map((item) => {
+ item.children = [];
+ });
+ total.value = res.data.total;
+ })
+ .catch(() => {
+ tableLoading.value = false;
+ });
+};
+
+const getRecordType = (recordType) => {
+ return stockRecordTypeOptions.value.find(item => item.value === recordType)?.label || ''
+}
+
+// 鑾峰彇鏉ユ簮绫诲瀷閫夐」
+const fetchStockRecordTypeOptions = () => {
+ if (props.type === '0') {
+ findAllQualifiedStockRecordTypeOptions()
+ .then(res => {
+ stockRecordTypeOptions.value = res.data;
+ })
+ return
+ }
+ findAllUnqualifiedStockRecordTypeOptions()
+ .then(res => {
+ stockRecordTypeOptions.value = res.data;
+ })
+}
+
+// 琛ㄦ牸閫夋嫨鏁版嵁
+const handleSelectionChange = (selection) => {
+ // 杩囨护鎺夊瓙鏁版嵁
+ selectedRows.value = selection.filter((item) => item.id);
+ console.log("selection", selectedRows.value);
+};
+const expandedRowKeys = ref([]);
+
+// 瀵煎嚭
+const handleOut = () => {
+ ElMessageBox.confirm("鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ proxy.download("/stockOutRecord/exportStockOutRecord", {type: props.type}, props.type === '0' ? "鍚堟牸鍑哄簱鍙拌处.xlsx" : "涓嶅悎鏍煎嚭搴撳彴璐�.xlsx");
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+};
+
+// 鍒犻櫎
+const handleDelete = () => {
+ 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(() => {
+ delStockOut(ids).then((res) => {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ getList();
+ });
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+};
+
+// 鎵撳嵃鍔熻兘
+const handlePrint = () => {
+ if (selectedRows.value.length === 0) {
+ proxy.$modal.msgWarning("璇烽�夋嫨瑕佹墦鍗扮殑鏁版嵁");
+ return;
+ }
+ printData.value = [...selectedRows.value];
+ console.log('鎵撳嵃鏁版嵁:', printData.value);
+ printPreviewVisible.value = true;
+};
+
+// 鎵ц鎵撳嵃
+const executePrint = () => {
+ console.log('寮�濮嬫墽琛屾墦鍗帮紝鏁版嵁鏉℃暟:', printData.value.length);
+ console.log('鎵撳嵃鏁版嵁:', printData.value);
+
+ // 鍒涘缓涓�涓柊鐨勬墦鍗扮獥鍙�
+ const printWindow = window.open('', '_blank', 'width=800,height=600');
+
+ // 鏋勫缓鎵撳嵃鍐呭
+ let printContent = `
+ <!DOCTYPE html>
+ <html>
+ <head>
+ <meta charset="UTF-8">
+ <title>鎵撳嵃棰勮</title>
+ <style>
+ body {
+ margin: 0;
+ padding: 0;
+ font-family: "SimSun", serif;
+ background: white;
+ }
+ .print-page {
+ width: 200mm;
+ height: 75mm;
+ padding: 10mm;
+ padding-left: 20mm;
+ background: white;
+ box-sizing: border-box;
+ page-break-after: always;
+ page-break-inside: avoid;
+ }
+ .print-page:last-child {
+ page-break-after: avoid;
+ }
+ .delivery-note {
+ width: 100%;
+ height: 100%;
+ font-size: 12px;
+ line-height: 1.2;
+ display: flex;
+ flex-direction: column;
+ color: #000;
+ }
+ .header {
+ text-align: center;
+ margin-bottom: 8px;
+ }
+ .company-name {
+ font-size: 18px;
+ font-weight: bold;
+ margin-bottom: 4px;
+ }
+ .document-title {
+ font-size: 16px;
+ font-weight: bold;
+ }
+ .info-section {
+ margin-bottom: 8px;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ }
+ .info-row {
+ line-height: 20px;
+ }
+ .label {
+ font-weight: bold;
+ width: 60px;
+ font-size: 12px;
+ }
+ .value {
+ margin-right: 20px;
+ min-width: 80px;
+ font-size: 12px;
+ }
+ .table-section {
+ margin-bottom: 40px;
+ // flex: 0.6;
+ }
+ .product-table {
+ width: 100%;
+ border-collapse: collapse;
+ border: 1px solid #000;
+ }
+ .product-table th, .product-table td {
+ border: 1px solid #000;
+ padding: 6px;
+ text-align: center;
+ font-size: 12px;
+ line-height: 1.4;
+ }
+ .product-table th {
+ font-weight: bold;
+ }
+ .total-value {
+ font-weight: bold;
+ }
+ .footer-section {
+ margin-top: auto;
+ }
+ .footer-row {
+ display: flex;
+ margin-bottom: 3px;
+ line-height: 22px;
+ justify-content: space-between;
+ }
+ .footer-item {
+ display: flex;
+ margin-right: 20px;
+ }
+ .footer-item .label {
+ font-weight: bold;
+ width: 80px;
+ font-size: 12px;
+ }
+ .footer-item .value {
+ min-width: 80px;
+ font-size: 12px;
+ }
+ .address-item .address-value {
+ min-width: 200px;
+ }
+ @media print {
+ body {
+ margin: 0;
+ padding: 0;
+ }
+ .print-page {
+ margin: 0;
+ padding: 10mm;
+ /* padding-left: 20mm; */
+ page-break-inside: avoid;
+ page-break-after: always;
+ }
+ .print-page:last-child {
+ page-break-after: avoid;
+ }
+ }
+ </style>
+ </head>
+ <body>
+ `;
+
+ // 涓烘瘡鏉℃暟鎹敓鎴愭墦鍗伴〉闈�
+ printData.value.forEach((item, index) => {
+ printContent += `
+ <div class="print-page">
+ <div class="delivery-note">
+ <div class="header">
+ <div class="company-name">榧庤瘹鐟炲疄涓氭湁闄愯矗浠诲叕鍙�</div>
+ <div class="document-title">闆跺敭鍙戣揣鍗�</div>
+ </div>
+
+ <div class="info-section">
+ <div class="info-row">
+ <div>
+ <span class="label">鍙戣揣鏃ユ湡锛�</span>
+ <span class="value">${formatDate(item.createTime)}</span>
+ </div>
+ <div>
+ <span class="label">瀹㈡埛鍚嶇О锛�</span>
+ <span class="value">${item.supplierName || '寮犵埍鏈�'}</span>
+ </div>
+ </div>
+ <div class="info-row">
+ <span class="label">鍗曞彿锛�</span>
+ <span class="value">${item.code || ''}</span>
+ </div>
+ </div>
+
+ <div class="table-section">
+ <table class="product-table">
+ <thead>
+ <tr>
+ <th>浜у搧鍚嶇О</th>
+ <th>瑙勬牸鍨嬪彿</th>
+ <th>鍗曚綅</th>
+ <th>鍗曚环</th>
+ <th>闆跺敭鏁伴噺</th>
+ <th>闆跺敭閲戦</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>${item.productName || '鐮傜伆鐮�'}</td>
+ <td>${item.model || '鏍囧噯'}</td>
+ <td>${item.unit || '鍧�'}</td>
+ <td>${item.taxInclusiveUnitPrice || '0'}</td>
+ <td>${item.inboundNum || '2000'}</td>
+ <td>${item.taxInclusiveTotalPrice || '0'}</td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td class="label">鍚堣</td>
+ <td class="total-value"></td>
+ <td class="total-value"></td>
+ <td class="total-value"></td>
+ <td class="total-value">${item.inboundNum || '2000'}</td>
+ <td class="total-value">${item.taxInclusiveTotalPrice || '0'}</td>
+ </tr>
+ </tfoot>
+ </table>
+ </div>
+
+ <div class="footer-section">
+ <div class="footer-row">
+ <div class="footer-item">
+ <span class="label">鏀惰揣鐢佃瘽锛�</span>
+ <span class="value"></span>
+ </div>
+ <div class="footer-item">
+ <span class="label">鏀惰揣浜猴細</span>
+ <span class="value"></span>
+ </div>
+ <div class="footer-item address-item">
+ <span class="label">鏀惰揣鍦板潃锛�</span>
+ <span class="value address-value"></span>
+ </div>
+ </div>
+ <div class="footer-row">
+ <div class="footer-item">
+ <span class="label">鎿嶄綔鍛橈細</span>
+ <span class="value">${userStore.nickName || '鎾曞紑鍓�'}</span>
+ </div>
+ <div class="footer-item">
+ <span class="label">鎵撳嵃鏃ユ湡锛�</span>
+ <span class="value">${formatDateTime(new Date())}</span>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ `;
+ });
+
+ printContent += `
+ </body>
+ </html>
+ `;
+
+ // 鍐欏叆鍐呭鍒版柊绐楀彛
+ printWindow.document.write(printContent);
+ printWindow.document.close();
+
+ // 绛夊緟鍐呭鍔犺浇瀹屾垚鍚庢墦鍗�
+ printWindow.onload = () => {
+ setTimeout(() => {
+ printWindow.print();
+ printWindow.close();
+ printPreviewVisible.value = false;
+ }, 500);
+ };
+};
+
+
+
+// 鏍煎紡鍖栨棩鏈�
+const formatDate = (dateString) => {
+ if (!dateString) return getCurrentDate();
+ const date = new Date(dateString);
+ const year = date.getFullYear();
+ const month = String(date.getMonth() + 1).padStart(2, "0");
+ const day = String(date.getDate()).padStart(2, "0");
+ return `${year}/${month}/${day}`;
+};
+
+// 鏍煎紡鍖栨棩鏈熸椂闂�
+const formatDateTime = (date) => {
+ const year = date.getFullYear();
+ const month = String(date.getMonth() + 1).padStart(2, "0");
+ const day = String(date.getDate()).padStart(2, "0");
+ const hours = String(date.getHours()).padStart(2, "0");
+ const minutes = String(date.getMinutes()).padStart(2, "0");
+ const seconds = String(date.getSeconds()).padStart(2, "0");
+ return `${year}/${month}/${day} ${hours}:${minutes}:${seconds}`;
+};
+onMounted(() => {
+ getList();
+ fetchStockRecordTypeOptions();
+});
+</script>
+
+<style scoped lang="scss">
+.print-preview-dialog {
+ .el-dialog__body {
+ padding: 0;
+ max-height: 80vh;
+ overflow-y: auto;
+ }
+}
+
+.print-preview-container {
+ .print-preview-header {
+ padding: 15px;
+ border-bottom: 1px solid #e4e7ed;
+ text-align: center;
+
+ .el-button {
+ margin: 0 10px;
+ }
+ }
+
+ .print-preview-content {
+ padding: 20px;
+ background-color: #f5f5f5;
+ min-height: 400px;
+ }
+}
+
+.print-page {
+ width: 220mm;
+ height: 90mm;
+ padding: 10mm;
+ margin: 0 auto;
+ background: white;
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
+ margin-bottom: 10px;
+ box-sizing: border-box;
+}
+
+.delivery-note {
+ width: 100%;
+ height: 100%;
+ font-family: "SimSun", serif;
+ font-size: 10px;
+ line-height: 1.2;
+ display: flex;
+ flex-direction: column;
+}
+
+.header {
+ text-align: center;
+ margin-bottom: 8px;
+
+ .company-name {
+ font-size: 18px;
+ font-weight: bold;
+ margin-bottom: 4px;
+ }
+
+ .document-title {
+ font-size: 16px;
+ font-weight: bold;
+ }
+}
+
+.info-section {
+ margin-bottom: 8px;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+
+ .info-row {
+ line-height: 20px;
+
+ .label {
+ font-weight: bold;
+ width: 60px;
+ font-size: 14px;
+ }
+
+ .value {
+ margin-right: 20px;
+ min-width: 80px;
+ font-size: 14px;
+ }
+ }
+}
+
+.table-section {
+ margin-bottom: 4px;
+ flex: 1;
+
+ .product-table {
+ width: 100%;
+ border-collapse: collapse;
+ border: 1px solid #000;
+
+ th, td {
+ border: 1px solid #000;
+ padding: 6px;
+ text-align: center;
+ font-size: 14px;
+ line-height: 1.4;
+ }
+
+ th {
+ font-weight: bold;
+ }
+
+ .total-label {
+ text-align: right;
+ font-weight: bold;
+ }
+
+ .total-value {
+ font-weight: bold;
+ }
+ }
+}
+
+.footer-section {
+ .footer-row {
+ display: flex;
+ margin-bottom: 3px;
+ line-height: 20px;
+ justify-content: space-between;
+
+ .footer-item {
+ display: flex;
+ margin-right: 20px;
+
+ .label {
+ font-weight: bold;
+ width: 80px;
+ font-size: 14px;
+ }
+
+ .value {
+ min-width: 80px;
+ font-size: 14px;
+ }
+
+ &.address-item {
+ .address-value {
+ min-width: 200px;
+ }
+ }
+ }
+ }
+}
+
+@media print {
+ .app-container {
+ display: none;
+ }
+
+ .print-page {
+ box-shadow: none;
+ margin: 0;
+ padding: 10mm;
+ padding-left: 20mm;
+ page-break-inside: avoid;
+ page-break-after: always;
+ }
+ .print-page:last-child {
+ page-break-after: avoid;
+ }
+}
+</style>
diff --git a/src/views/inventoryManagement/dispatchLog/index.vue b/src/views/inventoryManagement/dispatchLog/index.vue
index 12e6fcf..88d9984 100644
--- a/src/views/inventoryManagement/dispatchLog/index.vue
+++ b/src/views/inventoryManagement/dispatchLog/index.vue
@@ -1,981 +1,38 @@
+<!-- 鍦ㄤ綘鐨勪富椤甸潰涓� -->
<template>
- <div class="app-container">
- <el-tabs v-model="activeTab" @tab-change="handleTabChange">
- <el-tab-pane label="鎴愬搧鍑哄簱" name="production">
- <div class="search_form">
- <div>
- <span class="search_title ml10">鍑哄簱鏃ユ湡锛�</span>
- <el-date-picker
- v-model="searchForm.timeStr"
- type="date"
- placeholder="璇烽�夋嫨鏃ユ湡"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- clearable
- @change="handleQuery"
- />
- <span class="search_title ml10">浜у搧澶х被锛�</span>
- <el-input
- v-model="searchForm.productCategory"
- style="width: 240px"
- placeholder="璇疯緭鍏�"
- clearable
- />
- <el-button type="primary" @click="handleQuery" style="margin-left: 10px">鎼滅储</el-button>
- </div>
- <div>
- <el-button @click="handleOut">瀵煎嚭</el-button>
- <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>
- <el-button type="primary" plain @click="handlePrint">鎵撳嵃</el-button>
- </div>
- </div>
- <div class="table_list">
- <el-table
- :data="tableData"
- border
- v-loading="tableLoading"
- @selection-change="handleSelectionChange"
- :expand-row-keys="expandedRowKeys"
- :row-key="(row) => row.id"
- show-summary
- style="width: 100%"
- :summary-method="summarizeMainTable"
- height="calc(100vh - 18.5em)"
- >
- <el-table-column align="center" type="selection" width="55" />
- <el-table-column align="center" label="搴忓彿" type="index" width="60" />
- <el-table-column label="鍑哄簱鏃ユ湡" prop="createTime" width="120" show-overflow-tooltip />
- <el-table-column label="閿�鍞悎鍚屽彿" prop="salesContractNo" width="180" show-overflow-tooltip />
- <el-table-column label="浜у搧澶х被" prop="productCategory" show-overflow-tooltip />
- <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" show-overflow-tooltip />
- <el-table-column label="鍗曚綅" prop="unit" width="80" show-overflow-tooltip />
- <el-table-column label="鍑哄簱鏁伴噺" prop="inboundNum" width="100" 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 label="鍑哄簱浜�" prop="createBy" width="80" show-overflow-tooltip />
- </el-table>
- <pagination
- v-show="total > 0"
- :total="total"
- layout="total, sizes, prev, pager, next, jumper"
- :page="page.current"
- :limit="page.size"
- @pagination="paginationChange"
- />
- </div>
- </el-tab-pane>
-
- <el-tab-pane label="鍘熸枡鍑哄簱" name="purchase">
- <div class="search_form">
- <div>
- <span class="search_title ml10">鍑哄簱鏃ユ湡锛�</span>
- <el-date-picker
- v-model="searchForm.timeStr"
- type="date"
- placeholder="璇烽�夋嫨鏃ユ湡"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- clearable
- @change="handleQuery"
- />
- <span class="search_title ml10">浜у搧澶х被锛�</span>
- <el-input
- v-model="searchForm.productCategory"
- style="width: 240px"
- placeholder="璇疯緭鍏�"
- clearable
- />
- <el-button type="primary" @click="handleQuery" style="margin-left: 10px">鎼滅储</el-button>
- </div>
- <div>
- <el-button @click="handleOut">瀵煎嚭</el-button>
- <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>
- <el-button type="primary" plain @click="handlePrint">鎵撳嵃</el-button>
- </div>
- </div>
- <div class="table_list">
- <el-table
- :data="tableData"
- border
- v-loading="tableLoading"
- @selection-change="handleSelectionChange"
- :expand-row-keys="expandedRowKeys"
- :row-key="(row) => row.id"
- show-summary
- style="width: 100%"
- :summary-method="summarizeMainTable"
- height="calc(100vh - 18.5em)"
- >
- <el-table-column align="center" type="selection" width="55" />
- <el-table-column align="center" label="搴忓彿" type="index" width="60" />
- <el-table-column label="鍑哄簱鏃ユ湡" prop="createTime" width="120" show-overflow-tooltip />
- <el-table-column label="閲囪喘鍚堝悓鍙�" prop="purchaseContractNumber" width="180" show-overflow-tooltip />
- <el-table-column label="浜у搧澶х被" prop="productCategory" show-overflow-tooltip />
- <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" show-overflow-tooltip />
- <el-table-column label="鍗曚綅" prop="unit" width="80" show-overflow-tooltip />
- <el-table-column label="鍑哄簱鏁伴噺" prop="inboundNum" width="100" show-overflow-tooltip />
- <el-table-column label="鍚◣鍗曚环(鍏�)" prop="taxInclusiveUnitPrice" width="150"></el-table-column>
- <el-table-column label="鍚◣鎬讳环(鍏�)" prop="taxInclusiveTotalPrice" width="150"></el-table-column>
- <el-table-column label="鍑哄簱浜�" prop="createBy" width="80" show-overflow-tooltip />
- </el-table>
- <pagination
- v-show="total > 0"
- :total="total"
- layout="total, sizes, prev, pager, next, jumper"
- :page="page.current"
- :limit="page.size"
- @pagination="paginationChange"
- />
- </div>
- </el-tab-pane>
-
- <el-tab-pane label="鐢熶骇鍑哄簱" name="semiProduct">
- <div class="search_form">
- <div>
- <span class="search_title ml10">鍑哄簱鏃ユ湡锛�</span>
- <el-date-picker
- v-model="searchForm.timeStr"
- type="date"
- placeholder="璇烽�夋嫨鏃ユ湡"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- clearable
- @change="handleQuery"
- />
- <span class="search_title ml10">浜у搧澶х被锛�</span>
- <el-input
- v-model="searchForm.productCategory"
- style="width: 240px"
- placeholder="璇疯緭鍏�"
- clearable
- />
- <el-button type="primary" @click="handleQuery" style="margin-left: 10px">鎼滅储</el-button>
- </div>
- <div>
- <el-button @click="handleOut">瀵煎嚭</el-button>
- <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>
- <el-button type="primary" plain @click="handlePrint">鎵撳嵃</el-button>
- </div>
- </div>
- <div class="table_list">
- <el-table
- :data="tableData"
- border
- v-loading="tableLoading"
- @selection-change="handleSelectionChange"
- :expand-row-keys="expandedRowKeys"
- :row-key="(row) => row.id"
- show-summary
- style="width: 100%"
- :summary-method="summarizeMainTable"
- height="calc(100vh - 18.5em)"
- >
- <el-table-column align="center" type="selection" width="55" />
- <el-table-column align="center" label="搴忓彿" type="index" width="60" />
- <el-table-column label="鍑哄簱鏃ユ湡" prop="createTime" width="220" show-overflow-tooltip />
- <el-table-column label="浜у搧澶х被" prop="productCategory" show-overflow-tooltip />
- <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" show-overflow-tooltip />
- <el-table-column label="鍗曚綅" prop="unit" width="100" show-overflow-tooltip />
- <el-table-column label="鍑哄簱鏁伴噺" prop="inboundNum" width="220" show-overflow-tooltip />
- <el-table-column label="鍑哄簱浜�" prop="createBy" width="220" show-overflow-tooltip />
- </el-table>
- <pagination
- v-show="total > 0"
- :total="total"
- layout="total, sizes, prev, pager, next, jumper"
- :page="page.current"
- :limit="page.size"
- @pagination="paginationSemiProductChange"
- />
- </div>
+ <div class="app-container">
+ <el-tabs v-model="activeTab" @tab-change="handleTabChange">
+ <el-tab-pane v-for="tab in tabs"
+ :label="tab.label"
+ :name="tab.name"
+ :key="tab.name">
+ <record :type="tab.type" v-if="activeTab === tab.name" />
</el-tab-pane>
- </el-tabs>
-
- <!-- 鎵撳嵃棰勮寮圭獥 -->
- <el-dialog
- v-model="printPreviewVisible"
- title="鎵撳嵃棰勮"
- width="90%"
- :close-on-click-modal="false"
- class="print-preview-dialog"
- >
- <div class="print-preview-container">
- <div class="print-preview-header">
- <el-button type="primary" @click="executePrint">鎵ц鎵撳嵃</el-button>
- <el-button @click="printPreviewVisible = false">鍏抽棴棰勮</el-button>
- </div>
- <div class="print-preview-content">
- <div v-if="printData.length === 0" style="text-align: center; padding: 50px; color: #999;">
- 鏆傛棤鎵撳嵃鏁版嵁
- </div>
- <div v-else style="text-align: center; padding: 10px; color: #666; font-size: 14px; background: #e8f4fd; margin-bottom: 10px;">
- 鍏� {{ printData.length }} 鏉℃暟鎹緟鎵撳嵃
- </div>
- <div v-for="(item, index) in printData" :key="index" class="print-page">
- <div class="delivery-note">
- <div class="header">
- <div class="company-name">鍐涙嘲浼熶笟锛堝ぉ娲ワ級鏈夐檺鍏徃</div>
- <div class="document-title">闆跺敭鍙戣揣鍗�</div>
- </div>
-
- <div class="info-section">
- <div class="info-row">
- <div>
- <span class="label">鍙戣揣鏃ユ湡锛�</span>
- <span class="value">{{ formatDate(item.createTime) }}</span>
- </div>
- <div>
-
- <span class="label">瀹㈡埛鍚嶇О锛�</span>
- <span class="value">{{ item.supplierName || '寮犵埍鏈�' }}</span>
- </div>
- </div>
- <div class="info-row">
- <span class="label">鍗曞彿锛�</span>
- <span class="value">{{ item.code }}</span>
- </div>
- </div>
-
- <div class="table-section">
- <table class="product-table">
- <thead>
- <tr>
- <th>浜у搧鍚嶇О</th>
- <th>瑙勬牸鍨嬪彿</th>
- <th>鍗曚綅</th>
- <th>鍗曚环</th>
- <th>闆跺敭鏁伴噺</th>
- <th>闆跺敭閲戦</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>{{ item.productCategory || '鐮傜伆鐮�' }}</td>
- <td>{{ item.specificationModel || '鏍囧噯' }}</td>
- <td>{{ item.unit || '鍧�' }}</td>
- <td>{{ item.taxInclusiveUnitPrice || '0' }}</td>
- <td>{{ item.inboundNum || '2000' }}</td>
- <td>{{ item.taxInclusiveTotalPrice || '0' }}</td>
- </tr>
- </tbody>
- <tfoot>
- <tr>
- <td class="label">鍚堣</td>
- <td class="total-value"></td>
- <td class="total-value"></td>
- <td class="total-value"></td>
- <td class="total-value">{{ item.inboundNum || '2000' }}</td>
- <td class="total-value">{{ item.taxInclusiveTotalPrice || '0' }}</td>
- </tr>
- </tfoot>
- </table>
- </div>
-
- <div class="footer-section">
- <div class="footer-row">
- <div class="footer-item">
- <span class="label">鏀惰揣鐢佃瘽锛�</span>
- <span class="value"></span>
- </div>
- <div class="footer-item">
- <span class="label">鏀惰揣浜猴細</span>
- <span class="value"></span>
- </div>
- <div class="footer-item address-item">
- <span class="label">鏀惰揣鍦板潃锛�</span>
- <span class="value address-value"></span>
- </div>
- </div>
- <div class="footer-row">
- <div class="footer-item">
- <span class="label">鎿嶄綔鍛橈細</span>
- <span class="value">{{ userStore.nickName || '鎾曞紑鍓�' }}</span>
- </div>
- <div class="footer-item">
- <span class="label">鎵撳嵃鏃ユ湡锛�</span>
- <span class="value">{{ formatDateTime(new Date()) }}</span>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </el-dialog>
-
-
- </div>
+ </el-tabs>
+ </div>
</template>
<script setup>
-import pagination from "@/components/PIMTable/Pagination.vue";
-import { ref, reactive, toRefs, onMounted, getCurrentInstance } from "vue";
-import { ElMessageBox } from "element-plus";
-import useUserStore from "@/store/modules/user";
-import {
- getStockOutPage,
- delStockOut,
- getStockOutSemiProductPage,
-} from "@/api/inventoryManagement/stockOut.js";
-import {
- getStockInPageByProduct,
-} from "@/api/inventoryManagement/stockIn.js";
+import Record from "@/views/inventoryManagement/dispatchLog/Record.vue";
+const activeTab = ref('qualified')
+const type = ref(0)
+const tabs = computed(() => {
+ return [
+ {
+ label: '鍚堟牸鍑哄簱',
+ name: 'qualified',
+ type: '0'
+ },
+ {
+ label: '涓嶅悎鏍煎嚭搴�',
+ name: 'unqualified',
+ type: '1'
+ }
+ ]
+})
-const userStore = useUserStore();
-const { proxy } = getCurrentInstance();
-const tableData = ref([]);
-const activeTab = ref('production');
-const selectedRows = ref([]);
-const tableLoading = ref(false);
-const page = reactive({
- current: 1,
- size: 100,
-});
-const total = ref(0);
-
-// 鎵撳嵃鐩稿叧
-const printPreviewVisible = ref(false);
-const printData = ref([]);
-
-// 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁
-const data = reactive({
- searchForm: {
- supplierName: "",
- customerName: "",
- productCategory:'',
- timeStr: '',
- },
- form: {
- supplierId: null,
- supplierName: '',
- productId: null,
- productName: '',
- userId: userStore.userId,
- nickName: '',
- model: '',
- productModelId: null,
- unit: '',
- productrecordId: null,
- taxInclusiveUnitPrice: '',
- taxInclusiveTotalPrice: '',
- taxRate: '',
- taxExclusiveTotalPrice: '',
- inboundTime: '',
- inboundBatch: '',
- inboundQuantity: ''
- },
-});
-const { searchForm } = toRefs(data);
-
-// 鏌ヨ鍒楄〃
-/** 鎼滅储鎸夐挳鎿嶄綔 */
-const handleQuery = () => {
- page.current = 1;
- getList();
-};
-const paginationChange = (obj) => {
- page.current = obj.page;
- page.size = obj.limit;
- getList();
-};
-const paginationSemiProductChange = (obj) => {
- page.current = obj.page;
- page.size = obj.limit;
- getList();
-};
-const getList = () => {
- tableLoading.value = true;
- const params = { ...page }
- if (activeTab.value === 'production') {
- params.customerName = searchForm.value.customerName
- params.timeStr = searchForm.value.timeStr
- } else {
- params.supplierName = searchForm.value.supplierName
- params.timeStr = searchForm.value.timeStr
- }
- params.productCategory = searchForm.value.productCategory
-
- // 鏍规嵁涓嶅悓鐨� tab 绫诲瀷璋冪敤涓嶅悓鐨勬帴鍙
- if (activeTab.value === 'semiProduct') {
- const apiCall = getStockOutSemiProductPage(params)
- apiCall
- .then((res) => {
- tableLoading.value = false;
- tableData.value = res.data.records;
- })
- }else {
- const apiCall = activeTab.value === 'production'
- ? getStockInPageByProduct(params)
- : getStockOutPage(params)
-
- apiCall
- .then((res) => {
- tableLoading.value = false;
- tableData.value = res.data.records;
- tableData.value.map((item) => {
- item.children = [];
- // 鍓嶇璁$畻鎬讳环
- const inboundNum = Number(item.inboundNum) || 0;
- if (activeTab.value === 'production') {
- // 鎴愬搧鍑哄簱锛氭�讳环 = unitPrice 脳 inboundNum
- const unitPrice = Number(item.unitPrice) || 0;
- item.totalPrice = (unitPrice * inboundNum).toFixed(2);
- } else {
- // 鍘熸枡鍑哄簱锛氭�讳环 = taxInclusiveUnitPrice 脳 inboundNum
- const taxInclusiveUnitPrice = Number(item.taxInclusiveUnitPrice) || 0;
- item.taxInclusiveTotalPrice = (taxInclusiveUnitPrice * inboundNum).toFixed(2);
- }
- });
- total.value = res.data.total;
- })
- .catch(() => {
- tableLoading.value = false;
- });
- }
-
-};
-
-const handleTabChange = () => {
- page.current = 1
- searchForm.value.supplierName = ''
- searchForm.value.customerName = ''
- searchForm.value.timeStr = ''
- selectedRows.value = []
- searchForm.value.productCategory = ''
- getList()
-};
-
-// 琛ㄦ牸閫夋嫨鏁版嵁
-const handleSelectionChange = (selection) => {
- // 杩囨护鎺夊瓙鏁版嵁
- selectedRows.value = selection.filter((item) => item.id);
- console.log("selection", selectedRows.value);
-};
-const expandedRowKeys = ref([]);
-
-// 涓昏〃鍚堣鏂规硶
-const summarizeMainTable = (param) => {
- return proxy.summarizeTable(param, [
- "contractAmount",
- "taxInclusiveTotalPrice",
- "taxExclusiveTotalPrice",
- ]);
-};
-
-// 瀵煎嚭
-const handleOut = () => {
- ElMessageBox.confirm("鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
- confirmButtonText: "纭",
- cancelButtonText: "鍙栨秷",
- type: "warning",
- })
- .then(() => {
- // 鏍规嵁涓嶅悓鐨� tab 绫诲瀷璋冪敤涓嶅悓鐨勫鍑烘帴鍙�
- let exportUrl = "/stockmanagement/export"
- if (activeTab.value === 'production') {
- exportUrl = "/stockmanagement/exportone"
- }
- proxy.download(exportUrl, {}, "鍑哄簱鍙拌处.xlsx");
- })
- .catch(() => {
- proxy.$modal.msg("宸插彇娑�");
- });
-};
-
-// 鍒犻櫎
-const handleDelete = () => {
- 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(() => {
- delStockOut({ids:ids}).then((res) => {
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
- getList();
- });
- })
- .catch(() => {
- proxy.$modal.msg("宸插彇娑�");
- });
-};
-
-// 鎵撳嵃鍔熻兘
-const handlePrint = () => {
- if (selectedRows.value.length === 0) {
- proxy.$modal.msgWarning("璇烽�夋嫨瑕佹墦鍗扮殑鏁版嵁");
- return;
- }
- printData.value = [...selectedRows.value];
- console.log('鎵撳嵃鏁版嵁:', printData.value);
- printPreviewVisible.value = true;
-};
-
-// 鎵ц鎵撳嵃
-const executePrint = () => {
- console.log('寮�濮嬫墽琛屾墦鍗帮紝鏁版嵁鏉℃暟:', printData.value.length);
- console.log('鎵撳嵃鏁版嵁:', printData.value);
-
- // 鍒涘缓涓�涓柊鐨勬墦鍗扮獥鍙�
- const printWindow = window.open('', '_blank', 'width=800,height=600');
-
- // 鏋勫缓鎵撳嵃鍐呭
- let printContent = `
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>鎵撳嵃棰勮</title>
- <style>
- body {
- margin: 0;
- padding: 0;
- font-family: "SimSun", serif;
- background: white;
- }
- .print-page {
- width: 200mm;
- height: 75mm;
- padding: 10mm;
- padding-left: 20mm;
- background: white;
- box-sizing: border-box;
- page-break-after: always;
- page-break-inside: avoid;
- }
- .print-page:last-child {
- page-break-after: avoid;
- }
- .delivery-note {
- width: 100%;
- height: 100%;
- font-size: 12px;
- line-height: 1.2;
- display: flex;
- flex-direction: column;
- color: #000;
- }
- .header {
- text-align: center;
- margin-bottom: 8px;
- }
- .company-name {
- font-size: 18px;
- font-weight: bold;
- margin-bottom: 4px;
- }
- .document-title {
- font-size: 16px;
- font-weight: bold;
- }
- .info-section {
- margin-bottom: 8px;
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
- .info-row {
- line-height: 20px;
- }
- .label {
- font-weight: bold;
- width: 60px;
- font-size: 12px;
- }
- .value {
- margin-right: 20px;
- min-width: 80px;
- font-size: 12px;
- }
- .table-section {
- margin-bottom: 40px;
- // flex: 0.6;
- }
- .product-table {
- width: 100%;
- border-collapse: collapse;
- border: 1px solid #000;
- }
- .product-table th, .product-table td {
- border: 1px solid #000;
- padding: 6px;
- text-align: center;
- font-size: 12px;
- line-height: 1.4;
- }
- .product-table th {
- font-weight: bold;
- }
- .total-value {
- font-weight: bold;
- }
- .footer-section {
- margin-top: auto;
- }
- .footer-row {
- display: flex;
- margin-bottom: 3px;
- line-height: 22px;
- justify-content: space-between;
- }
- .footer-item {
- display: flex;
- margin-right: 20px;
- }
- .footer-item .label {
- font-weight: bold;
- width: 80px;
- font-size: 12px;
- }
- .footer-item .value {
- min-width: 80px;
- font-size: 12px;
- }
- .address-item .address-value {
- min-width: 200px;
- }
- @media print {
- body {
- margin: 0;
- padding: 0;
- }
- .print-page {
- margin: 0;
- padding: 10mm;
- /* padding-left: 20mm; */
- page-break-inside: avoid;
- page-break-after: always;
- }
- .print-page:last-child {
- page-break-after: avoid;
- }
- }
- </style>
- </head>
- <body>
- `;
-
- // 涓烘瘡鏉℃暟鎹敓鎴愭墦鍗伴〉闈�
- printData.value.forEach((item, index) => {
- printContent += `
- <div class="print-page">
- <div class="delivery-note">
- <div class="header">
- <div class="company-name">鍐涙嘲浼熶笟锛堝ぉ娲ワ級鏈夐檺鍏徃</div>
- <div class="document-title">闆跺敭鍙戣揣鍗�</div>
- </div>
-
- <div class="info-section">
- <div class="info-row">
- <div>
- <span class="label">鍙戣揣鏃ユ湡锛�</span>
- <span class="value">${formatDate(item.createTime)}</span>
- </div>
- <div>
- <span class="label">瀹㈡埛鍚嶇О锛�</span>
- <span class="value">${item.supplierName || '寮犵埍鏈�'}</span>
- </div>
- </div>
- <div class="info-row">
- <span class="label">鍗曞彿锛�</span>
- <span class="value">${item.code || ''}</span>
- </div>
- </div>
-
- <div class="table-section">
- <table class="product-table">
- <thead>
- <tr>
- <th>浜у搧鍚嶇О</th>
- <th>瑙勬牸鍨嬪彿</th>
- <th>鍗曚綅</th>
- <th>鍗曚环</th>
- <th>闆跺敭鏁伴噺</th>
- <th>闆跺敭閲戦</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>${item.productCategory || '鐮傜伆鐮�'}</td>
- <td>${item.specificationModel || '鏍囧噯'}</td>
- <td>${item.unit || '鍧�'}</td>
- <td>${item.taxInclusiveUnitPrice || '0'}</td>
- <td>${item.inboundNum || '2000'}</td>
- <td>${item.taxInclusiveTotalPrice || '0'}</td>
- </tr>
- </tbody>
- <tfoot>
- <tr>
- <td class="label">鍚堣</td>
- <td class="total-value"></td>
- <td class="total-value"></td>
- <td class="total-value"></td>
- <td class="total-value">${item.inboundNum || '2000'}</td>
- <td class="total-value">${item.taxInclusiveTotalPrice || '0'}</td>
- </tr>
- </tfoot>
- </table>
- </div>
-
- <div class="footer-section">
- <div class="footer-row">
- <div class="footer-item">
- <span class="label">鏀惰揣鐢佃瘽锛�</span>
- <span class="value"></span>
- </div>
- <div class="footer-item">
- <span class="label">鏀惰揣浜猴細</span>
- <span class="value"></span>
- </div>
- <div class="footer-item address-item">
- <span class="label">鏀惰揣鍦板潃锛�</span>
- <span class="value address-value"></span>
- </div>
- </div>
- <div class="footer-row">
- <div class="footer-item">
- <span class="label">鎿嶄綔鍛橈細</span>
- <span class="value">${userStore.nickName || '鎾曞紑鍓�'}</span>
- </div>
- <div class="footer-item">
- <span class="label">鎵撳嵃鏃ユ湡锛�</span>
- <span class="value">${formatDateTime(new Date())}</span>
- </div>
- </div>
- </div>
- </div>
- </div>
- `;
- });
-
- printContent += `
- </body>
- </html>
- `;
-
- // 鍐欏叆鍐呭鍒版柊绐楀彛
- printWindow.document.write(printContent);
- printWindow.document.close();
-
- // 绛夊緟鍐呭鍔犺浇瀹屾垚鍚庢墦鍗�
- printWindow.onload = () => {
- setTimeout(() => {
- printWindow.print();
- printWindow.close();
- printPreviewVisible.value = false;
- }, 500);
- };
-};
-
-
-
-// 鏍煎紡鍖栨棩鏈�
-const formatDate = (dateString) => {
- if (!dateString) return getCurrentDate();
- const date = new Date(dateString);
- const year = date.getFullYear();
- const month = String(date.getMonth() + 1).padStart(2, "0");
- const day = String(date.getDate()).padStart(2, "0");
- return `${year}/${month}/${day}`;
-};
-
-// 鏍煎紡鍖栨棩鏈熸椂闂�
-const formatDateTime = (date) => {
- const year = date.getFullYear();
- const month = String(date.getMonth() + 1).padStart(2, "0");
- const day = String(date.getDate()).padStart(2, "0");
- const hours = String(date.getHours()).padStart(2, "0");
- const minutes = String(date.getMinutes()).padStart(2, "0");
- const seconds = String(date.getSeconds()).padStart(2, "0");
- return `${year}/${month}/${day} ${hours}:${minutes}:${seconds}`;
-};
-// 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲涓� YYYY-MM-DD
-function getCurrentDate() {
- const today = new Date();
- const year = today.getFullYear();
- const month = String(today.getMonth() + 1).padStart(2, "0"); // 鏈堜唤浠�0寮�濮�
- const day = String(today.getDate()).padStart(2, "0");
- return `${year}-${month}-${day}`;
+const handleTabChange = (tabName) => {
+ activeTab.value = tabName;
+ type.value = tabName === 'qualified' ? 0 : 1
}
-onMounted(() => {
- getList();
-});
</script>
-
-<style scoped lang="scss">
-.print-preview-dialog {
- .el-dialog__body {
- padding: 0;
- max-height: 80vh;
- overflow-y: auto;
- }
-}
-
-.print-preview-container {
- .print-preview-header {
- padding: 15px;
- border-bottom: 1px solid #e4e7ed;
- text-align: center;
-
- .el-button {
- margin: 0 10px;
- }
- }
-
- .print-preview-content {
- padding: 20px;
- background-color: #f5f5f5;
- min-height: 400px;
- }
-}
-
-.print-page {
- width: 220mm;
- height: 90mm;
- padding: 10mm;
- margin: 0 auto;
- background: white;
- box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
- margin-bottom: 10px;
- box-sizing: border-box;
-}
-
-.delivery-note {
- width: 100%;
- height: 100%;
- font-family: "SimSun", serif;
- font-size: 10px;
- line-height: 1.2;
- display: flex;
- flex-direction: column;
-}
-
-.header {
- text-align: center;
- margin-bottom: 8px;
-
- .company-name {
- font-size: 18px;
- font-weight: bold;
- margin-bottom: 4px;
- }
-
- .document-title {
- font-size: 16px;
- font-weight: bold;
- }
-}
-
-.info-section {
- margin-bottom: 8px;
- display: flex;
- justify-content: space-between;
- align-items: center;
-
- .info-row {
- line-height: 20px;
-
- .label {
- font-weight: bold;
- width: 60px;
- font-size: 14px;
- }
-
- .value {
- margin-right: 20px;
- min-width: 80px;
- font-size: 14px;
- }
- }
-}
-
-.table-section {
- margin-bottom: 4px;
- flex: 1;
-
- .product-table {
- width: 100%;
- border-collapse: collapse;
- border: 1px solid #000;
-
- th, td {
- border: 1px solid #000;
- padding: 6px;
- text-align: center;
- font-size: 14px;
- line-height: 1.4;
- }
-
- th {
- font-weight: bold;
- }
-
- .total-label {
- text-align: right;
- font-weight: bold;
- }
-
- .total-value {
- font-weight: bold;
- }
- }
-}
-
-.footer-section {
- .footer-row {
- display: flex;
- margin-bottom: 3px;
- line-height: 20px;
- justify-content: space-between;
-
- .footer-item {
- display: flex;
- margin-right: 20px;
-
- .label {
- font-weight: bold;
- width: 80px;
- font-size: 14px;
- }
-
- .value {
- min-width: 80px;
- font-size: 14px;
- }
-
- &.address-item {
- .address-value {
- min-width: 200px;
- }
- }
- }
- }
-}
-
-@media print {
- .app-container {
- display: none;
- }
-
- .print-page {
- box-shadow: none;
- margin: 0;
- padding: 10mm;
- padding-left: 20mm;
- page-break-inside: avoid;
- page-break-after: always;
- }
- .print-page:last-child {
- page-break-after: avoid;
- }
-}
-</style>
-
-
diff --git a/src/views/inventoryManagement/issueManagement/index.vue b/src/views/inventoryManagement/issueManagement/index.vue
index 6e345d1..f5d2ea9 100644
--- a/src/views/inventoryManagement/issueManagement/index.vue
+++ b/src/views/inventoryManagement/issueManagement/index.vue
@@ -1,306 +1,74 @@
<template>
<div class="app-container">
- <el-tabs v-model="activeTab"
- @tab-change="handleTabChange">
- <el-tab-pane label="鎴愬搧鍑哄簱"
- name="production">
- <div class="search_form">
- <div>
- <span class="search_title ml10">浜у搧澶х被锛�</span>
- <el-input v-model="searchForm.productCategory"
- style="width: 240px"
- placeholder="璇疯緭鍏�"
- clearable />
- <el-button type="primary"
- @click="handleQuery"
- style="margin-left: 10px">鎼滅储</el-button>
- </div>
- <div>
- <el-button @click="handleOut">瀵煎嚭</el-button>
- </div>
- </div>
- <div class="table_list">
- <el-table :data="tableData"
- border
- v-loading="tableLoading"
- :expand-row-keys="expandedRowKeys"
- :row-key="row => row.id"
- show-summary
- style="width: 100%"
- :summary-method="summarizeMainTable"
- height="calc(100vh - 18.5em)">
- <el-table-column align="center"
- label="搴忓彿"
- type="index"
- width="60" />
- <el-table-column label="閿�鍞悎鍚屽彿"
- prop="salesContractNo"
- width="180"
- show-overflow-tooltip />
- <el-table-column label="浜у搧澶х被"
- prop="productCategory"
- show-overflow-tooltip />
- <el-table-column label="瑙勬牸鍨嬪彿"
- prop="specificationModel"
- show-overflow-tooltip />
- <el-table-column label="鍗曚綅"
- prop="unit"
- width="70"
- show-overflow-tooltip />
- <el-table-column label="鍓╀綑搴撳瓨"
- prop="inboundNum0"
- width="90"
- show-overflow-tooltip />
- <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-column fixed="right"
- label="鎿嶄綔"
- min-width="60"
- align="center">
- <template #default="scope">
- <el-button :disabled="scope.row.inboundNum0 <= 0 || scope.row.isFrozen"
- link
- type="primary"
- size="small"
- @click="openForm(scope.row);">鍙戣揣</el-button>
- </template>
- </el-table-column>
- </el-table>
- <pagination v-show="total > 0"
- :total="total"
- layout="total, sizes, prev, pager, next, jumper"
- :page="page.current"
- :limit="page.size"
- @pagination="paginationChange" />
- </div>
- </el-tab-pane>
- <el-tab-pane label="鍘熸枡鍑哄簱"
- name="purchase">
- <div class="search_form">
- <div>
- <span class="search_title ml10">浜у搧澶х被锛�</span>
- <el-input v-model="searchForm.productCategory"
- style="width: 240px"
- placeholder="璇疯緭鍏�"
- clearable />
- <el-button type="primary"
- @click="handleQuery"
- style="margin-left: 10px">鎼滅储</el-button>
- </div>
- <div>
- <el-button @click="handleOut">瀵煎嚭</el-button>
- </div>
- </div>
- <div class="table_list">
- <el-table :data="tableData"
- border
- v-loading="tableLoading"
- @selection-change="handleSelectionChange"
- :expand-row-keys="expandedRowKeys"
- :row-key="row => row.id"
- show-summary
- style="width: 100%"
- :summary-method="summarizeMainTable"
- height="calc(100vh - 18.5em)">
- <el-table-column align="center"
- type="selection"
- width="55" />
- <el-table-column align="center"
- label="搴忓彿"
- type="index"
- width="60" />
- <el-table-column label="閲囪喘鍚堝悓鍙�"
- prop="purchaseContractNumber"
- width="180"
- show-overflow-tooltip />
- <el-table-column label="浜у搧澶х被"
- prop="productCategory"
- show-overflow-tooltip />
- <el-table-column label="瑙勬牸鍨嬪彿"
- prop="specificationModel"
- show-overflow-tooltip />
- <el-table-column label="鍗曚綅"
- prop="unit"
- width="70"
- show-overflow-tooltip />
- <el-table-column label="鍓╀綑搴撳瓨"
- prop="inboundNum0"
- width="90"
- show-overflow-tooltip />
- <el-table-column label="鍚◣鍗曚环(鍏�)"
- prop="taxInclusiveUnitPrice"
- width="150"></el-table-column>
- <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-column fixed="right"
- label="鎿嶄綔"
- min-width="60"
- align="center">
- <template #default="scope">
- <el-button link
- :disabled="scope.row.inboundNum0 <= 0 || scope.row.isFrozen"
- type="primary"
- size="small"
- @click="openForm(scope.row);">棰嗙敤</el-button>
- </template>
- </el-table-column>
- </el-table>
- <pagination v-show="total > 0"
- :total="total"
- layout="total, sizes, prev, pager, next, jumper"
- :page="page.current"
- :limit="page.size"
- @pagination="paginationChange" />
- </div>
- </el-tab-pane>
- <el-tab-pane label="鐢熶骇鍑哄簱"
- name="product">
- <div class="search_form">
- <div>
- <span class="search_title ml10">浜у搧澶х被锛�</span>
- <el-input v-model="searchForm.productCategory"
- style="width: 240px"
- placeholder="璇疯緭鍏�"
- clearable />
- <el-button type="primary"
- @click="handleQuery"
- style="margin-left: 10px">鎼滅储</el-button>
- </div>
- <div>
- <el-button @click="handleOut">瀵煎嚭</el-button>
- </div>
- </div>
- <div class="table_list">
- <el-table :data="tableData"
- border
- v-loading="tableLoading"
- @selection-change="handleSelectionChange"
- :expand-row-keys="expandedRowKeys"
- :row-key="row => row.id"
- show-summary
- style="width: 100%"
- :summary-method="summarizeMainTable"
- height="calc(100vh - 18.5em)">
- <el-table-column align="center"
- type="selection"
- width="55" />
- <el-table-column align="center"
- label="搴忓彿"
- type="index"
- width="60" />
- <el-table-column label="浜у搧澶х被"
- prop="productCategory"
- show-overflow-tooltip />
- <el-table-column label="瑙勬牸鍨嬪彿"
- prop="specificationModel"
- show-overflow-tooltip />
- <el-table-column label="鍗曚綅"
- prop="unit"
- width="70"
- show-overflow-tooltip />
- <el-table-column label="鍓╀綑搴撳瓨"
- prop="inboundNum0"
- width="90"
- show-overflow-tooltip />
- <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-column fixed="right"
- label="鎿嶄綔"
- min-width="60"
- align="center">
- <template #default="scope">
- <el-button link
- :disabled="scope.row.inboundNum0 <= 0 || scope.row.isFrozen"
- type="primary"
- size="small"
- @click="openForm(scope.row);">棰嗙敤</el-button>
- </template>
- </el-table-column>
- </el-table>
- <pagination v-show="total > 0"
- :total="total"
- layout="total, sizes, prev, pager, next, jumper"
- :page="page.current"
- :limit="page.size"
- @pagination="paginationChange" />
- </div>
- </el-tab-pane>
- </el-tabs>
- <el-dialog v-model="dialogFormVisible"
- :title="getDialogTitle()"
- width="40%"
- @close="closeDia">
- <el-form :model="form"
- label-width="140px"
- label-position="top"
- :rules="rules"
- ref="formRef">
- <div>{{getAvailableQuantityText()}}:{{currentRowNum}}</div>
- <el-form-item :label="getQuantityLabel()"
- prop="salesContractNo">
- <el-input-number :step="0.01"
- :min="0"
- style="width: 100%"
- v-model="form.inboundQuantity"
- placeholder="璇疯緭鍏�"
- clearable />
+ <div class="search_form">
+ <div>
+ <span class="search_title">渚涘簲鍟嗗悕绉帮細</span>
+ <el-input v-model="searchForm.supplierName" style="width: 240px" placeholder="璇疯緭鍏�" @change="handleQuery"
+ clearable prefix-icon="Search" />
+ <span class="search_title ml10">鍏ュ簱鏃ユ湡锛�</span>
+ <el-date-picker
+ v-model="searchForm.timeStr"
+ type="date"
+ placeholder="璇烽�夋嫨鏃ユ湡"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ clearable
+ @change="handleQuery"
+ />
+ <el-button type="primary" @click="handleQuery" style="margin-left: 10px">鎼滅储</el-button>
+ </div>
+ <div>
+ <!-- <el-button type="primary" @click="openForm('add')">鏂板鍑哄簱</el-button> -->
+ <el-button @click="handleOut">瀵煎嚭</el-button>
+ <!-- <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button> -->
+ </div>
+ </div>
+ <div class="table_list">
+ <el-table :data="tableData" border v-loading="tableLoading" @selection-change="handleSelectionChange"
+ :expand-row-keys="expandedRowKeys" :row-key="row => row.id" show-summary style="width: 100%"
+ :summary-method="summarizeMainTable" height="calc(100vh - 18.5em)">
+ <el-table-column align="center" type="selection" width="55" />
+ <el-table-column align="center" label="搴忓彿" type="index" width="60" />
+ <el-table-column label="鍏ュ簱鏃堕棿" prop="createTime" width="100" show-overflow-tooltip />
+ <el-table-column label="鍏ュ簱鎵规" prop="inboundBatches" width="160" show-overflow-tooltip />
+ <el-table-column label="渚涘簲鍟嗗悕绉�" prop="supplierName" width="240" show-overflow-tooltip />
+ <el-table-column label="浜у搧澶х被" prop="productCategory" width="100" show-overflow-tooltip />
+ <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" width="200" show-overflow-tooltip />
+ <el-table-column label="鍗曚綅" prop="unit" width="70" show-overflow-tooltip />
+ <el-table-column label="鍏ュ簱鏁伴噺" prop="inboundNum" width="90" show-overflow-tooltip />
+ <el-table-column label="搴撳瓨鏁伴噺" prop="inboundNum0" width="90" show-overflow-tooltip />
+ <el-table-column label="鍚◣鍗曚环" prop="taxInclusiveUnitPrice" width="100" show-overflow-tooltip />
+ <el-table-column label="鍚◣鎬讳环" prop="taxInclusiveTotalPrice" width="100" show-overflow-tooltip />
+ <el-table-column label="绋庣巼(%)" prop="taxRate" width="80" show-overflow-tooltip />
+ <el-table-column label="涓嶅惈绋庢�讳环" prop="taxExclusiveTotalPrice" width="100" show-overflow-tooltip />
+ <el-table-column label="鍏ュ簱浜�" prop="createBy" width="80" show-overflow-tooltip />
+ <el-table-column fixed="right" label="鎿嶄綔" min-width="60" align="center">
+ <template #default="scope">
+ <el-button link type="primary" size="small" @click="openForm(scope.row);">棰嗙敤</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ <pagination v-show="total > 0" :total="total" layout="total, sizes, prev, pager, next, jumper"
+ :page="page.current" :limit="page.size" @pagination="paginationChange" />
+ </div>
+ <el-dialog v-model="dialogFormVisible" :title="'鏂板鍑哄簱'" width="40%" @close="closeDia">
+ <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef">
+ <el-form-item label="鍑哄簱鏁伴噺锛�" prop="salesContractNo">
+ <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.inboundQuantity" placeholder="璇疯緭鍏�" clearable />
</el-form-item>
- <el-form-item :label="getDateLabel()"
- prop="projectName">
- <el-date-picker style="width: 100%"
- v-model="form.inboundTime"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- type="date"
- placeholder="璇烽�夋嫨"
- clearable />
+ <el-form-item label="鍑哄簱鏃ユ湡锛�" prop="projectName">
+ <el-date-picker style="width: 100%" v-model="form.inboundTime" value-format="YYYY-MM-DD" format="YYYY-MM-DD"
+ type="date" placeholder="璇烽�夋嫨" clearable />
</el-form-item>
- <el-form-item :label="getPersonLabel()"
- prop="entryPerson">
- <el-select v-model="form.nickName"
- filterable
- default-first-option
- :reserve-keyword="false"
- placeholder="璇烽�夋嫨"
- clearable>
- <el-option v-for="item in userList"
- :key="item.userId"
- :label="item.nickName"
- :value="item.userId" />
+ <el-form-item label="鍑哄簱浜猴細" prop="entryPerson">
+ <el-select v-model="form.nickName" placeholder="璇烽�夋嫨" clearable>
+ <el-option v-for="item in userList" :key="item.userId" :label="item.nickName" :value="item.userId" />
</el-select>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
- <el-button type="primary"
- @click="submitForm">纭</el-button>
+ <el-button type="primary" @click="submitForm">纭</el-button>
<el-button @click="closeDia">鍙栨秷</el-button>
</div>
</template>
@@ -309,317 +77,209 @@
</template>
<script setup>
- import pagination from "@/components/PIMTable/Pagination.vue";
- import { ref, reactive, toRefs, onMounted, getCurrentInstance } from "vue";
- import { ElMessageBox } from "element-plus";
- import useUserStore from "@/store/modules/user";
- import { userListNoPageByTenantId } from "@/api/system/user.js";
- import {
- getStockInPage,
- getStockInPageByProduction,
- getStockInPageByProductProduction,
- } from "@/api/inventoryManagement/stockIn.js";
- import {
- getStockManagePage,
+import pagination from '@/components/PIMTable/Pagination.vue'
+import { ref } from 'vue'
+import { ElMessageBox } from "element-plus";
+import useUserStore from '@/store/modules/user'
+import { userListNoPageByTenantId } from "@/api/system/user.js";
+import {
+ getStockInPage
+} from "@/api/inventoryManagement/stockIn.js";
+import {
+ getStockManagePage,
delStockManage,
stockOut,
- } from "@/api/inventoryManagement/stockManage.js";
+} from "@/api/inventoryManagement/stockManage.js";
- const userStore = useUserStore();
- const { proxy } = getCurrentInstance();
- const tableData = ref([]);
- const selectedRows = ref([]);
- const userList = ref([]);
- const tableLoading = ref(false);
- const page = reactive({
- current: 1,
- size: 100,
- });
- const total = ref(0);
- const fileList = ref([]);
+const userStore = useUserStore()
+const { proxy } = getCurrentInstance()
+const tableData = ref([])
+const selectedRows = ref([])
+const userList = ref([])
+const tableLoading = ref(false)
+const page = reactive({
+ current: 1,
+ size: 100,
+})
+const total = ref(0)
+const fileList = ref([])
- // 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁
- const dialogFormVisible = ref(false);
- const activeTab = ref("production");
- const data = reactive({
- searchForm: {
- supplierName: "",
- customerName: "",
- inboundQuantity: "",
- inboundTime: "",
- nickName: "",
- userId: "",
- productCategory: "",
- timeStr: "",
- },
- form: {
- productrecordId: "",
- },
- rules: {
- inboundTime: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- inboundQuantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- nickname: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- },
- });
- const { searchForm, form, rules } = toRefs(data);
-
- // 鏌ヨ鍒楄〃
- /** 鎼滅储鎸夐挳鎿嶄綔 */
- const handleQuery = () => {
- page.current = 1;
- getList();
- };
- const paginationChange = obj => {
- page.current = obj.page;
- page.size = obj.limit;
- getList();
- };
- const getList = () => {
- tableLoading.value = true;
- const params = { ...page };
- if (activeTab.value === "production") {
- params.customerName = searchForm.value.customerName;
- params.timeStr = searchForm.value.timeStr;
- } else {
- params.supplierName = searchForm.value.supplierName;
- params.timeStr = searchForm.value.timeStr;
- }
- params.productCategory = searchForm.value.productCategory;
- let apiCall;
- if (activeTab.value === "production") {
- apiCall = getStockInPageByProduction(params);
- } else if (activeTab.value === "product") {
- apiCall = getStockInPageByProductProduction(params);
- }else {
- apiCall = getStockInPage(params);
- }
- apiCall
- .then(res => {
- tableLoading.value = false;
- tableData.value = res.data.records;
- total.value = res.data.total;
- })
- .catch(() => {
- tableLoading.value = false;
- });
- };
-
- const handleTabChange = () => {
- page.current = 1;
- searchForm.value.supplierName = "";
- searchForm.value.customerName = "";
- searchForm.value.timeStr = "";
- selectedRows.value = [];
- searchForm.value.productCategory = "";
- getList();
- };
-
- const findNodeById = (nodes, productId) => {
- for (let i = 0; i < nodes.length; i++) {
- if (nodes[i].value === productId) {
- return nodes[i].label; // 鎵惧埌鑺傜偣锛岃繑鍥炶鑺傜偣
- }
- if (nodes[i].children && nodes[i].children.length > 0) {
- const foundNode = findNodeById(nodes[i].children, productId);
- if (foundNode) {
- return foundNode.label; // 鍦ㄥ瓙鑺傜偣涓壘鍒帮紝杩斿洖璇ヨ妭鐐�
- }
- }
- }
- return null; // 娌℃湁鎵惧埌鑺傜偣锛岃繑鍥瀗ull
- };
- // 琛ㄦ牸閫夋嫨鏁版嵁
- const handleSelectionChange = selection => {
- // 杩囨护鎺夊瓙鏁版嵁
- selectedRows.value = selection.filter(item => item.id);
- console.log("selection", selectedRows.value);
- };
- const expandedRowKeys = ref([]);
-
- // 涓昏〃鍚堣鏂规硶
- const summarizeMainTable = param => {
- return proxy.summarizeTable(param, [
- "contractAmount",
- "taxInclusiveTotalPrice",
- "taxExclusiveTotalPrice",
- ]);
- };
- const currentRowId = ref(null); // 鏂板锛氬瓨鍌ㄥ綋鍓嶆搷浣滅殑琛孖D
-
- const currentRowNum = ref(0);
- const salesLedgerProductId = ref(null);
-const productModelId = ref(null);
- // 鎵撳紑寮规
- const openForm = async row => {
- if (row.isFrozen) {
- return proxy.$modal.msgError("璇ヤ骇鍝佸凡鍐荤粨锛屾棤娉曢鐢�");
- }
- dialogFormVisible.value = true;
- currentRowId.value = row.id;
- currentRowNum.value = row.inboundNum0;
- salesLedgerProductId.value = row.salesLedgerProductId;
- productModelId.value = row.productModelId;
- form.value = {};
- // 鍒濆鍖栬〃鍗曟暟鎹�
- form.value = {
- productrecordId: "",
- inboundQuantity: "", // 鍑哄簱鏁伴噺娓呯┖
- inboundTime: getCurrentDate(), // 榛樿褰撳墠鏃ユ湡
- nickName: "", // 榛樿褰撳墠鐢ㄦ埛
- };
- console.log("form", form.value);
- // 鍔犺浇鐢ㄦ埛鍒楄〃
- try {
- const userLists = await userListNoPageByTenantId();
- userList.value = userLists.data;
- } catch (error) {
- console.error("鍔犺浇鐢ㄦ埛鍒楄〃澶辫触:", error);
- }
- };
-
- // 鎻愪氦琛ㄥ崟
- const submitForm = () => {
- let num = Number(form.value.inboundQuantity);
- if (num <= 0 || num > currentRowNum.value) {
- return proxy.$modal.msgWarning("璇峰~鍏ユ湁鏁堟暟瀛�");
- }
- if (!form.value.nickName) {
- return proxy.$modal.msgWarning("璇烽�夋嫨鎿嶄綔浜�");
- }
- proxy.$refs["formRef"].validate(valid => {
- if (valid && currentRowId.value) {
- const typeMap = { production: 2, purchase: 1, product: 4 };
- const outData = {
- id: currentRowId.value, // 鍘熷璁板綍ID
- salesLedgerProductId: salesLedgerProductId.value,
- quantity: form.value.inboundQuantity, // 鍑哄簱鏁伴噺
- time: form.value.inboundTime, // 鍑哄簱鏃堕棿
- userId: form.value.nickName, // 鎿嶄綔浜�
- type: typeMap[activeTab.value], // 鍑哄簱绫诲瀷锛氶噰璐�1锛岀敓浜�2
- productModelId: productModelId.value,
- };
- console.log(outData);
-
- stockOut(outData)
- .then(res => {
- proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
- closeDia();
- getList();
- })
- .catch(err => {
- proxy.$modal.msgError("鍑哄簱澶辫触");
- });
- }
- });
- };
- // 鍏抽棴寮规
- const closeDia = () => {
- proxy.resetForm("formRef");
- dialogFormVisible.value = false;
- };
-
- // 瀵煎嚭
- const handleOut = () => {
- ElMessageBox.confirm("鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
- confirmButtonText: "纭",
- cancelButtonText: "鍙栨秷",
- type: "warning",
- })
- .then(() => {
- // 鏍规嵁涓嶅悓鐨� tab 绫诲瀷璋冪敤涓嶅悓鐨勫鍑烘帴鍙�
- let exportUrl = "/stockin/export";
- if (activeTab.value === "production") {
- exportUrl = "/stockin/exportOne";
- }
- proxy.download(exportUrl, {}, "鍏ュ簱鍙拌处.xlsx");
- })
- .catch(() => {
- proxy.$modal.msg("宸插彇娑�");
- });
- };
- // 鍒犻櫎
- const handleDelete = () => {
- 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(() => {
- delStockManage(ids).then(res => {
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
- getList();
- });
- })
- .catch(() => {
- proxy.$modal.msg("宸插彇娑�");
- });
- };
- // 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲涓� YYYY-MM-DD
- function getCurrentDate() {
- const today = new Date();
- const year = today.getFullYear();
- const month = String(today.getMonth() + 1).padStart(2, "0"); // 鏈堜唤浠�0寮�濮�
- const day = String(today.getDate()).padStart(2, "0");
- return `${year}-${month}-${day}`;
+// 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁
+const dialogFormVisible = ref(false)
+const data = reactive({
+ searchForm: {
+ supplierName: '',
+ inboundQuantity:'',
+ inboundTime:'',
+ nickName: '',
+ userId: '',
+ timeStr: '',
+ },
+ form: {
+ productrecordId: '',
+ },
+ rules: {
+ inboundTime: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ inboundQuantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ nickname: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }]
}
+})
+const { searchForm, form, rules } = toRefs(data)
- // 鏍规嵁tab绫诲瀷鑾峰彇寮规鏍囬
- const getDialogTitle = () => {
- const titleMap = {
- production: "鏂板鍙戣揣",
- purchase: "鏂板棰嗙敤",
- };
- return titleMap[activeTab.value] || "鏂板鍑哄簱";
- };
+// 鏌ヨ鍒楄〃
+/** 鎼滅储鎸夐挳鎿嶄綔 */
+const handleQuery = () => {
+ page.current = 1
+ getList()
+}
+const paginationChange = (obj) => {
+ page.current = obj.page;
+ page.size = obj.limit;
+ getList()
+}
+const getList = () => {
+ tableLoading.value = true
+ getStockInPage({ ...searchForm.value, ...page }).then(res => {
+ tableLoading.value = false
+ tableData.value = res.data.records
+ total.value = res.data.total
+ console.log('res', res.data.records)
+ }).catch(() => {
+ tableLoading.value = false
+ })
+}
- // 鏍规嵁tab绫诲瀷鑾峰彇鍙嚭搴撴暟閲忔枃鏈�
- const getAvailableQuantityText = () => {
- const textMap = {
- production: "鍙彂璐ф暟閲�",
- purchase: "鍙鐢ㄦ暟閲�",
- };
- return textMap[activeTab.value] || "鍙嚭搴撴暟閲�";
- };
+const findNodeById = (nodes, productId) => {
+ for (let i = 0; i < nodes.length; i++) {
+ if (nodes[i].value === productId) {
+ return nodes[i].label; // 鎵惧埌鑺傜偣锛岃繑鍥炶鑺傜偣
+ }
+ if (nodes[i].children && nodes[i].children.length > 0) {
+ const foundNode = findNodeById(nodes[i].children, productId);
+ if (foundNode) {
+ return foundNode.label; // 鍦ㄥ瓙鑺傜偣涓壘鍒帮紝杩斿洖璇ヨ妭鐐�
+ }
+ }
+ }
+ return null; // 娌℃湁鎵惧埌鑺傜偣锛岃繑鍥瀗ull
+};
+// 琛ㄦ牸閫夋嫨鏁版嵁
+const handleSelectionChange = (selection) => {
+ // 杩囨护鎺夊瓙鏁版嵁
+ selectedRows.value = selection.filter(item => item.id);
+ console.log('selection', selectedRows.value)
+}
+const expandedRowKeys = ref([])
- // 鏍规嵁tab绫诲瀷鑾峰彇鏁伴噺瀛楁鏍囩
- const getQuantityLabel = () => {
- const labelMap = {
- production: "鍙戣揣鏁伴噺锛�",
- purchase: "棰嗙敤鏁伴噺锛�",
- };
- return labelMap[activeTab.value] || "鍑哄簱鏁伴噺锛�";
- };
+// 涓昏〃鍚堣鏂规硶
+const summarizeMainTable = (param) => {
+ return proxy.summarizeTable(param, ['contractAmount', 'taxInclusiveTotalPrice', 'taxExclusiveTotalPrice']);
+};
+const currentRowId = ref(null) // 鏂板锛氬瓨鍌ㄥ綋鍓嶆搷浣滅殑琛孖D
- // 鏍规嵁tab绫诲瀷鑾峰彇鏃ユ湡瀛楁鏍囩
- const getDateLabel = () => {
- const labelMap = {
- production: "鍙戣揣鏃ユ湡锛�",
- purchase: "棰嗙敤鏃ユ湡锛�",
- };
- return labelMap[activeTab.value] || "鍑哄簱鏃ユ湡锛�";
- };
+const currentRowNum = ref(0)
+const salesLedgerProductId = ref(null);
- // 鏍规嵁tab绫诲瀷鑾峰彇浜哄憳瀛楁鏍囩
- const getPersonLabel = () => {
- const labelMap = {
- production: "鍙戣揣浜猴細",
- purchase: "棰嗙敤浜猴細",
- };
- return labelMap[activeTab.value] || "鍑哄簱浜猴細";
- };
+// 鎵撳紑寮规
+const openForm = async (row) => {
+ dialogFormVisible.value = true
+ currentRowId.value = row.id
+ currentRowNum.value = row.inboundNum0
+ salesLedgerProductId.value = row.salesLedgerProductId
+ form.value = {}
+ // 鍒濆鍖栬〃鍗曟暟鎹�
+ form.value = {
+ productrecordId: '',
+ inboundQuantity: '', // 鍑哄簱鏁伴噺娓呯┖
+ inboundTime: getCurrentDate(), // 榛樿褰撳墠鏃ユ湡
+ nickName: '', // 榛樿褰撳墠鐢ㄦ埛
+ }
+ console.log('form',form.value)
+ // 鍔犺浇鐢ㄦ埛鍒楄〃
+ try {
+ const userLists = await userListNoPageByTenantId()
+ userList.value = userLists.data
+ } catch (error) {
+ console.error('鍔犺浇鐢ㄦ埛鍒楄〃澶辫触:', error)
+ }
+}
- onMounted(() => {
- getList();
- });
+// 鎻愪氦琛ㄥ崟
+const submitForm = () => {
+ let num = Number(form.value.inboundQuantity)
+ if(num <= 0 || num > currentRowNum.value){
+ return proxy.$modal.msgWarning("璇峰~鍏ユ湁鏁堟暟瀛�")
+ }
+ proxy.$refs["formRef"].validate(valid => {
+ if (valid && currentRowId.value) {
+ const outData = {
+ id: currentRowId.value, // 鍘熷璁板綍ID
+ salesLedgerProductId: salesLedgerProductId.value,
+ quantity: form.value.inboundQuantity, // 鍑哄簱鏁伴噺
+ time: form.value.inboundTime, // 鍑哄簱鏃堕棿
+ userId: form.value.nickName // 鎿嶄綔浜�
+ }
+ console.log(outData)
+
+ stockOut(outData).then(res => {
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛")
+ closeDia()
+ getList()
+ }).catch(err => {
+ proxy.$modal.msgError("鍑哄簱澶辫触")
+ })
+ }
+ })
+}
+// 鍏抽棴寮规
+const closeDia = () => {
+ proxy.resetForm("formRef")
+ dialogFormVisible.value = false
+}
+
+// 瀵煎嚭
+const handleOut = () => {
+ ElMessageBox.confirm(
+ '鏄惁纭瀵煎嚭锛�',
+ '瀵煎嚭', {
+ confirmButtonText: '纭',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning',
+ }
+ ).then(() => {
+ proxy.download("/stockin/export", {}, '鍏ュ簱鍙拌处.xlsx')
+ }).catch(() => {
+ proxy.$modal.msg("宸插彇娑�")
+ })
+}
+// 鍒犻櫎
+const handleDelete = () => {
+ 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(() => {
+ delStockManage(ids).then(res => {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛")
+ getList()
+ })
+ }).catch(() => {
+ proxy.$modal.msg("宸插彇娑�")
+ })
+}
+onMounted(() => {
+ getList()
+})
</script>
<style scoped lang="scss"></style>
-
-
diff --git a/src/views/inventoryManagement/receiptManagement/Record.vue b/src/views/inventoryManagement/receiptManagement/Record.vue
new file mode 100644
index 0000000..e36c787
--- /dev/null
+++ b/src/views/inventoryManagement/receiptManagement/Record.vue
@@ -0,0 +1,250 @@
+<template>
+ <div class="app-container">
+ <div class="search_form">
+ <div>
+ <span class="search_title ml10">鍏ュ簱鏃ユ湡锛�</span>
+ <el-date-picker v-model="searchForm.timeStr"
+ type="date"
+ placeholder="璇烽�夋嫨鏃ユ湡"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ clearable
+ @change="handleQuery"/>
+ <span class="search_title ml10">浜у搧澶х被锛�</span>
+ <el-input v-model="searchForm.productName"
+ style="width: 240px"
+ placeholder="璇疯緭鍏�"
+ clearable/>
+ <span class="search_title ml10">鏉ユ簮锛�</span>
+ <el-select v-model="searchForm.recordType"
+ style="width: 240px"
+ placeholder="璇烽�夋嫨"
+ clearable>
+ <el-option v-for="item in stockRecordTypeOptions"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value"/>
+ </el-select>
+ <el-button type="primary"
+ @click="handleQuery"
+ style="margin-left: 10px">鎼滅储
+ </el-button>
+ </div>
+ <div>
+ <el-button @click="handleOut">瀵煎嚭</el-button>
+ <el-button type="danger"
+ plain
+ @click="handleDelete">鍒犻櫎
+ </el-button>
+ </div>
+ </div>
+ <div class="table_list">
+ <el-table :data="tableData"
+ border
+ v-loading="tableLoading"
+ @selection-change="handleSelectionChange"
+ :expand-row-keys="expandedRowKeys"
+ :row-key="row => row.id"
+ style="width: 100%"
+ height="calc(100vh - 18.5em)">
+ <el-table-column align="center"
+ type="selection"
+ width="55"/>
+ <el-table-column align="center"
+ label="搴忓彿"
+ type="index"
+ width="60"/>
+ <el-table-column label="鍏ュ簱鎵规"
+ prop="inboundBatches"
+ width="280"
+ show-overflow-tooltip/>
+ <el-table-column label="鍏ュ簱鏃堕棿"
+ prop="createTime"
+ show-overflow-tooltip/>
+ <el-table-column label="浜у搧澶х被"
+ prop="productName"
+ show-overflow-tooltip/>
+ <el-table-column label="瑙勬牸鍨嬪彿"
+ prop="model"
+ show-overflow-tooltip/>
+ <el-table-column label="鍗曚綅"
+ prop="unit"
+ show-overflow-tooltip/>
+ <el-table-column label="鍏ュ簱鏁伴噺"
+ prop="stockInNum"
+ show-overflow-tooltip/>
+ <el-table-column label="鍏ュ簱浜�"
+ prop="createBy"
+ show-overflow-tooltip/>
+ <el-table-column label="鏉ユ簮"
+ prop="recordType"
+ show-overflow-tooltip>
+ <template #default="scope">
+ {{ getRecordType(scope.row.recordType) }}
+ </template>
+ </el-table-column>
+ </el-table>
+ <pagination v-show="total > 0"
+ :total="total"
+ layout="total, sizes, prev, pager, next, jumper"
+ :page="page.current"
+ :limit="page.size"
+ @pagination="pageProductChange"/>
+ </div>
+ </div>
+</template>
+
+<script setup>
+import pagination from "@/components/PIMTable/Pagination.vue";
+import {
+ ref,
+ reactive,
+ toRefs,
+ onMounted,
+ getCurrentInstance,
+} from "vue";
+import {ElMessageBox} from "element-plus";
+import {
+ getStockInRecordListPage,
+ batchDeleteStockInRecords,
+} from "@/api/inventoryManagement/stockInRecord.js";
+import {
+ findAllQualifiedStockRecordTypeOptions,
+ findAllUnqualifiedStockRecordTypeOptions
+} from "@/api/basicData/enum.js";
+
+const {proxy} = getCurrentInstance();
+
+const props = defineProps({
+ type: {
+ type: String,
+ required: true,
+ default: '0'
+ }
+})
+
+const tableData = ref([]);
+const selectedRows = ref([]);
+const tableLoading = ref(false);
+// 鏉ユ簮绫诲瀷閫夐」
+const stockRecordTypeOptions = ref([]);
+const page = reactive({
+ current: 1,
+ size: 100,
+});
+const total = ref(0);
+
+const data = reactive({
+ searchForm: {
+ productName: "",
+ timeStr: "",
+ recordType: "",
+ },
+});
+const {searchForm} = toRefs(data);
+// 鏌ヨ鍒楄〃
+/** 鎼滅储鎸夐挳鎿嶄綔 */
+const handleQuery = () => {
+ page.current = 1;
+ getList();
+};
+
+const getRecordType = (recordType) => {
+ return stockRecordTypeOptions.value.find(item => item.value === recordType)?.label || ''
+}
+
+const pageProductChange = obj => {
+ page.current = obj.page;
+ page.size = obj.limit;
+ getList();
+};
+
+const getList = () => {
+ tableLoading.value = true;
+ const params = {...page, type: props.type};
+ params.timeStr = searchForm.value.timeStr;
+ params.productName = searchForm.value.productName;
+ getStockInRecordListPage(params)
+ .then(res => {
+ tableData.value = res.data.records;
+ }).finally(() => {
+ tableLoading.value = false;
+ })
+};
+
+// 鑾峰彇鏉ユ簮绫诲瀷閫夐」
+const fetchStockRecordTypeOptions = () => {
+ if (props.type === '0') {
+ findAllQualifiedStockRecordTypeOptions()
+ .then(res => {
+ stockRecordTypeOptions.value = res.data;
+ })
+ return
+ }
+ findAllUnqualifiedStockRecordTypeOptions()
+ .then(res => {
+ stockRecordTypeOptions.value = res.data;
+ })
+}
+
+// 琛ㄦ牸閫夋嫨鏁版嵁
+const handleSelectionChange = selection => {
+ selectedRows.value = selection.filter(item => item.id);
+};
+
+const expandedRowKeys = ref([]);
+
+// 瀵煎嚭
+const handleOut = () => {
+ ElMessageBox.confirm("鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ // 鏍规嵁涓嶅悓鐨� tab 绫诲瀷璋冪敤涓嶅悓鐨勫鍑烘帴鍙�
+ proxy.download("/stockInRecord/exportStockInRecord", {type: props.type}, props.type === '0' ? "鍚堟牸鍏ュ簱.xlsx" : "涓嶅悎鏍煎叆搴�.xlsx");
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+};
+
+// 鍒犻櫎
+const handleDelete = () => {
+ if (selectedRows.value.length === 0) {
+ proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
+ return;
+ }
+ const ids = selectedRows.value.map(item => item.id);
+
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ batchDeleteStockInRecords(ids)
+ .then(() => {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ getList();
+ })
+ .catch(() => {
+ proxy.$modal.msgError("鍒犻櫎澶辫触");
+ });
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+};
+
+onMounted(() => {
+ getList();
+ fetchStockRecordTypeOptions();
+});
+</script>
+
+<style scoped lang="scss"></style>
+
+
+
diff --git a/src/views/inventoryManagement/receiptManagement/components/formDia.vue b/src/views/inventoryManagement/receiptManagement/components/formDia.vue
deleted file mode 100644
index 5ea86b2..0000000
--- a/src/views/inventoryManagement/receiptManagement/components/formDia.vue
+++ /dev/null
@@ -1,400 +0,0 @@
-<template>
- <el-dialog v-model="dialogFormVisible" :title="getDialogTitle()" width="70%"
- @close="closeDia">
- <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef">
- <el-form-item label="閲囪喘璁㈠崟鍙�" prop="purchaseContractNumber">
- <el-select
- v-model="form.purchaseContractNumber"
- placeholder="璇烽�夋嫨閲囪喘璁㈠崟鍙�"
- clearable
- filterable
- :loading="loadingPurchaseOptions"
- @change="handlePurchaseChange"
- :disabled="operationType === 'edit'"
- style="width: 100%"
- >
- <el-option
- v-for="item in purchaseOptions"
- :key="item.purchaseContractNumber"
- :label="formatPurchaseOption(item)"
- :value="item.purchaseContractNumber"
- />
- </el-select>
- </el-form-item>
- <el-table
- :data="productList"
- border
- v-loading="loadingProducts"
- @selection-change="handleSelectionChange"
- >
- <el-table-column align="center" type="selection" width="55" />
- <el-table-column
- align="center"
- label="搴忓彿"
- type="index"
- width="60"
- />
- <el-table-column label="浜у搧澶х被" prop="productCategory" />
- <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" />
- <el-table-column label="鍗曚綅" prop="unit" width="70" />
- <!-- <el-table-column label="渚涘簲鍟�" prop="supplierName" width="100" /> -->
- <el-table-column label="閲囪喘鏁伴噺" prop="quantity" width="100" />
- <el-table-column label="寰呭叆搴撴暟閲�" prop="quantity0" width="100" />
- <el-table-column label="鏈鍏ュ簱鏁伴噺" prop="quantityStock" width="150">
- <template #default="scope">
- <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.quantityStock" @change="() => calculateTotalPrice(scope.row)" />
- </template>
- </el-table-column>
- <el-table-column label="绋庣巼(%)" prop="taxRate" width="120" />
- <el-table-column label="鍗曚环(鍏�)" prop="taxInclusiveUnitPrice" width="150">
- <template #default="scope">
- <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.taxInclusiveUnitPrice" @change="() => calculateTotalPrice(scope.row)" :disabled="operationType === 'edit'"/>
- </template>
- </el-table-column>
- <el-table-column
- label="鎬讳环(鍏�)"
- :formatter="formattedNumber"
- prop="taxInclusiveTotalPrice"
- width="150"
- >
- </el-table-column>
- </el-table>
- </el-form>
- <template #footer>
- <div class="dialog-footer">
- <el-button type="primary" @click="submitForm">纭</el-button>
- <el-button @click="closeDia">鍙栨秷</el-button>
- </div>
- </template>
- </el-dialog>
-</template>
-
-<script setup>
-import { ref, reactive, toRefs, getCurrentInstance } from 'vue'
-import useUserStore from '@/store/modules/user'
-import {
- updateStockIn,
- addSutockIn,
- selectProductRecordListByPuechaserId
-} from "@/api/inventoryManagement/stockIn.js";
-import { purchaseListPage } from "@/api/procurementManagement/procurementLedger.js";
-
-const userStore = useUserStore()
-const { proxy } = getCurrentInstance()
-const emit = defineEmits(['close', 'success'])
-
-const operationType = ref('')// 鎿嶄綔绫诲瀷: 'add' 鎴� 'edit'
-const dialogFormVisible = ref(false)// 寮规鏄剧ず鐘舵��
-const productList = ref([]);// 浜у搧鍒楄〃鏁版嵁
-const loadingProducts = ref(false);// 浜у搧鍔犺浇鐘舵��
-const selectedRows = ref([]) // 浜у搧琛ㄦ牸閫変腑琛�
-const purchaseOptions = ref([])
-const loadingPurchaseOptions = ref(false)
-const loading = ref(false);
-
-const data = reactive({
- form: {
- id: null,
- purchaseContractNumber: '', // 閲囪喘璁㈠崟鍙�
- supplierId: null, // 渚涘簲鍟咺D
- supplierName: '', // 渚涘簲鍟嗗悕绉�
- inboundTime: '', // 鍏ュ簱鏃堕棿
- inboundBatch: '', // 鍏ュ簱鎵规
- recorderId: userStore.userId, // 褰曞叆浜篒D
- recorderName: userStore.name, // 褰曞叆浜哄鍚�
- entryDate: getCurrentDate(), // 褰曞叆鏃ユ湡
- remark: '', // 澶囨敞
- },
- rules: {
- purchaseContractNumber: [{ required: true, message: "璇疯緭鍏ラ噰璐悎鍚屽彿", trigger: "blur" }],
- supplierId: [{ required: true, message: "璇烽�夋嫨渚涘簲鍟�", trigger: "change" }],
- inboundTime: [{ required: true, message: "璇烽�夋嫨鍏ュ簱鏃堕棿", trigger: "change" }],
- inboundBatch: [{ required: true, message: "璇疯緭鍏ュ叆搴撴壒娆�", trigger: "blur" }]
- }
-})
-const { form, rules } = toRefs(data)
-
-// 鍔ㄦ�佽绠楀璇濇鏍囬
-const getDialogTitle = () => {
- return operationType.value === 'add' ? '鏂板鍏ュ簱' : '缂栬緫鍏ュ簱'
-}
-
-const formatPurchaseOption = (item = {}) => {
- const contract = item.purchaseContractNumber || '--';
- const supplier = item.supplierName ? ` 路 ${item.supplierName}` : '';
- return `${contract}${supplier}`;
-};
-
-const loadPurchaseOptions = async (keyword = '') => {
- try {
- loadingPurchaseOptions.value = true;
- const res = await purchaseListPage({
- current: -1,
- size: -1,
- purchaseContractNumber: keyword,
- });
- const records = res.data?.records || [];
- purchaseOptions.value = records;
- if (
- form.value.purchaseContractNumber &&
- !purchaseOptions.value.find(
- (item) => item.purchaseContractNumber === form.value.purchaseContractNumber
- )
- ) {
- purchaseOptions.value.push({
- purchaseContractNumber: form.value.purchaseContractNumber,
- supplierName: form.value.supplierName,
- supplierId: form.value.supplierId,
- });
- }
- } finally {
- loadingPurchaseOptions.value = false;
- }
-};
-
-const handlePurchaseChange = (value) => {
- form.value.purchaseContractNumber = value || '';
- const matched = purchaseOptions.value.find(
- (item) => item.purchaseContractNumber === value
- );
- if (matched) {
- form.value.supplierName = matched.supplierName || form.value.supplierName;
- form.value.supplierId = matched.supplierId || form.value.supplierId;
- }
- if (!value) {
- productList.value = [];
- return;
- }
- fetchProductsByContract();
-};
-
-const exceedsAddLimit = (product) => {
- const stock = Number(product?.quantityStock ?? 0);
- const waiting = Number(product?.quantity0 ?? 0);
- if (!Number.isFinite(stock) || !Number.isFinite(waiting)) {
- return false;
- }
- return stock > waiting;
-};
-
-const exceedsEditLimit = (product) => {
- const stock = Number(product?.quantityStock ?? 0);
- const waiting = Number(product?.quantity0 ?? 0);
- const original = Number(product?.originalQuantityStock ?? 0);
- if (!Number.isFinite(stock) || !Number.isFinite(waiting) || !Number.isFinite(original)) {
- return false;
- }
- return stock > waiting + original;
-};
-
-const formattedNumber = (row, column, cellValue) => {
- return parseFloat(cellValue).toFixed(2);
-};
-
-// 璁$畻鎬讳环
-const calculateTotalPrice = (row) => {
- const quantityStock = Number(row?.quantityStock ?? 0);
- const taxInclusiveUnitPrice = Number(row?.taxInclusiveUnitPrice ?? 0);
-
- if (Number.isFinite(quantityStock) && Number.isFinite(taxInclusiveUnitPrice)) {
- row.taxInclusiveTotalPrice = quantityStock * taxInclusiveUnitPrice;
- } else {
- row.taxInclusiveTotalPrice = 0;
- }
-};
-
-const fetchProductsByContract = async () => {
- if (!form.value.purchaseContractNumber) {
- proxy.$modal.msgWarning('璇烽�夋嫨鍚堝悓鍙�')
- return
- }
- try {
- loadingProducts.value = true
- const productRes = await selectProductRecordListByPuechaserId({
- purchaseContractNumber: form.value.purchaseContractNumber
- });
- if (!productRes.data || productRes.data.length === 0) {
- proxy.$modal.msgWarning('璇ュ悎鍚屼笅娌℃湁浜у搧璁板綍')
- productList.value = [];
- return
- }
- productList.value = productRes.data.map(item => ({
- ...item,
- quantityStock: 0,
- taxInclusiveUnitPrice: Number(item?.taxInclusiveUnitPrice ?? 0),
- taxInclusiveTotalPrice: 0,
- originalQuantityStock: Number(item.quantityStock ?? item.inboundQuantity ?? 0),
- }))
- } catch (error) {
- console.error('鏌ヨ浜у搧璁板綍澶辫触:', error)
- proxy.$modal.msgError('鏌ヨ浜у搧璁板綍澶辫触')
- productList.value = [];
- } finally {
- loadingProducts.value = false
- }
-}
-
-const updatePro = async () => {
- if (selectedRows.value.length === 0) {
- proxy.$modal.msgWarning('璇峰厛閫夋嫨浜у搧');
- return;
- }
- const target = selectedRows.value[0];
- const stock = Number(target?.quantityStock ?? 0);
- if (!Number.isFinite(stock) || stock <= 0) {
- proxy.$modal.msgWarning('璇峰~鍐欐湁鏁堢殑鍏ュ簱鏁伴噺');
- return;
- }
- if (exceedsEditLimit(target)) {
- proxy.$modal.msgError('鏈鍏ュ簱鏁伴噺涓嶈兘瓒呰繃鍘熷叆搴撴暟閲忎笌寰呭叆搴撴暟閲忎箣鍜�');
- return;
- }
- const stockInData = {
- id: selectedRows.value[0].recordId,
- quantityStock: Number(selectedRows.value[0].quantityStock),
- };
- await updateStockIn(stockInData)
- proxy.$modal.msgSuccess('淇敼鍏ュ簱鎴愬姛')
- closeDia()
- emit('success')
-}
-
-const submitForm = async () => {
- if (selectedRows.value.length === 0) {
- proxy.$modal.msgWarning('璇峰厛閫夋嫨閲囪喘鍚堝悓骞堕�夋嫨浜у搧')
- return
- }
- if(operationType.value !== 'add'){
- await updatePro()
- return
- }
- try {
- await proxy.$refs.formRef.validate()
- const invalidProducts = selectedRows.value.filter((product) => {
- const stock = Number(product?.quantityStock ?? 0);
- if (!Number.isFinite(stock) || stock <= 0) {
- return true;
- }
- return exceedsAddLimit(product);
- })
-
- if (invalidProducts.length > 0) {
- proxy.$modal.msgError('鏈鍏ュ簱鏁伴噺闇�澶т簬0锛屼笖涓嶈兘瓒呰繃寰呭叆搴撴暟閲�')
- return
- }
-
- const stockInData = {
- ...form.value,
- inboundTime: formatDateTime(form.value.inboundTime),
- nickName: userStore.nickName,
- details: selectedRows.value.map(product => ({
- id: product.id,
- inboundQuantity: Number(product.quantityStock),
- unitPrice: Number(product.taxInclusiveUnitPrice),
- taxRate: Number(product.taxRate),
- taxInclusiveTotalPrice: Number(product.taxInclusiveTotalPrice)
- })),
- };
- loading.value = true
- await addSutockIn(stockInData)
-
- proxy.$modal.msgSuccess('鏂板鍏ュ簱鎴愬姛')
- closeDia()
- emit('success')
-
- } catch (error) {
- console.error('鎻愪氦澶辫触:', error)
- if (!error.errors) {
- proxy.$modal.msgError('鎿嶄綔澶辫触锛岃閲嶈瘯')
- }
- } finally {
- loading.value = false
- }
-}
-
-const closeDia = () => {
- proxy.$refs.formRef.resetFields()
- dialogFormVisible.value = false
- emit('close')
-}
-
-const handleSelectionChange = (selection) => {
- selectedRows.value = selection.filter(item => item.id);
-}
-
-function formatDateTime(date = new Date(), includeTime = true) {
- const d = new Date(date);
- const year = d.getFullYear();
- const month = String(d.getMonth() + 1).padStart(2, '0');
- const day = String(d.getDate()).padStart(2, '0');
-
- if (!includeTime) {
- return `${year}-${month}-${day}`;
- }
-
- const hours = String(d.getHours()).padStart(2, '0');
- const minutes = String(d.getMinutes()).padStart(2, '0');
- const seconds = String(d.getSeconds()).padStart(2, '0');
-
- return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
-}
-
-function getCurrentDate() {
- return formatDateTime(new Date(), false);
-}
-
-const openDialog = async (type, row) => {
- operationType.value = type
- dialogFormVisible.value = true
- selectedRows.value = []
- await loadPurchaseOptions();
-
- if (type === 'add') {
- form.value = {
- id: null,
- purchaseContractNumber: '',
- supplierId: null,
- supplierName: '',
- inboundTime: '',
- inboundBatch: '',
- recorderId: userStore.userId,
- recorderName: userStore.name,
- entryDate: getCurrentDate(),
- remark: ''
- }
- productList.value = []
- } else {
- form.value = JSON.parse(JSON.stringify(row))
- try {
- loadingProducts.value = true
- const res = await selectProductRecordListByPuechaserId({
- purchaseContractNumber: form.value.purchaseContractNumber,
- id: row.id
- });
- productList.value = res.data.map(item => ({
- ...item,
- quantityStock: Number(item.quantityStock ?? item.inboundQuantity ?? row.inboundNum ?? 0),
- taxInclusiveUnitPrice: Number(item?.taxInclusiveUnitPrice ?? 0),
- taxInclusiveTotalPrice: Number(item?.quantityStock ?? 0) * Number(item?.taxInclusiveUnitPrice ?? 0),
- originalQuantityStock: Number(item.quantityStock ?? item.inboundQuantity ?? row.inboundNum ?? 0),
- }))
- selectedRows.value = productList.value
- } catch (error) {
- console.error('鍔犺浇浜у搧澶辫触:', error)
- proxy.$modal.msgError('鍔犺浇浜у搧澶辫触')
- productList.value = []
- } finally {
- loadingProducts.value = false
- }
- }
-}
-
-defineExpose({
- openDialog,
-})
-</script>
-
-<style scoped lang="scss"></style>
-
-
-
diff --git a/src/views/inventoryManagement/receiptManagement/components/formDiaProduct.vue b/src/views/inventoryManagement/receiptManagement/components/formDiaProduct.vue
deleted file mode 100644
index 6048e18..0000000
--- a/src/views/inventoryManagement/receiptManagement/components/formDiaProduct.vue
+++ /dev/null
@@ -1,302 +0,0 @@
-<template>
- <el-dialog v-model="dialogFormVisible" :title="operationType === 'add' ? '鏂板鑷畾涔夊叆搴�' : '缂栬緫鑷畾涔夊叆搴�'" width="70%"
- @close="closeDia">
- <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef">
- <div style="margin-bottom: 10px;" v-if="operationType === 'add'">
- <el-button type="primary" @click="addProductRow">鏂板</el-button>
- </div>
- <el-table
- :data="productList"
- border
- v-loading="loadingProducts"
- >
- <el-table-column
- align="center"
- label="搴忓彿"
- type="index"
- width="60"
- />
- <el-table-column label="浜у搧澶х被" prop="productCategory" width="200">
- <template #default="scope">
- <el-input v-model="scope.row.productCategory" placeholder="璇疯緭鍏ヤ骇鍝佸ぇ绫�" />
- </template>
- </el-table-column>
- <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" width="200">
- <template #default="scope">
- <el-input v-model="scope.row.specificationModel" placeholder="璇疯緭鍏ヨ鏍煎瀷鍙�" />
- </template>
- </el-table-column>
- <el-table-column label="鍗曚綅" prop="unit" width="100">
- <template #default="scope">
- <el-input v-model="scope.row.unit" placeholder="璇疯緭鍏ュ崟浣�" />
- </template>
- </el-table-column>
- <el-table-column label="鍏ュ簱鏁伴噺" prop="inboundNum" width="150">
- <template #default="scope">
- <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.inboundNum" @change="() => calculateTotalPrice(scope.row)" />
- </template>
- </el-table-column>
- <el-table-column label="鍏ュ簱鏃ユ湡" prop="inboundDate" width="180">
- <template #default="scope">
- <el-date-picker
- v-model="scope.row.inboundDate"
- type="date"
- placeholder="璇烽�夋嫨鍏ュ簱鏃ユ湡"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- style="width: 100%"
- />
- </template>
- </el-table-column>
- <el-table-column label="鍗曚环(鍏�)" prop="unitPrice" width="150">
- <template #default="scope">
- <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.unitPrice" @change="() => calculateTotalPrice(scope.row)" />
- </template>
- </el-table-column>
- <el-table-column
- label="鎬讳环(鍏�)"
- prop="totalPrice"
- width="150"
- >
- </el-table-column>
- <el-table-column label="鎿嶄綔" width="80" v-if="operationType === 'add'">
- <template #default="scope">
- <el-button type="danger" size="small" @click="removeProductRow(scope.$index)">鍒犻櫎</el-button>
- </template>
- </el-table-column>
- </el-table>
- </el-form>
- <template #footer>
- <div class="dialog-footer">
- <el-button type="primary" @click="submitForm">纭</el-button>
- <el-button @click="closeDia">鍙栨秷</el-button>
- </div>
- </template>
- </el-dialog>
-</template>
-
-<script setup>
-import { ref, reactive, toRefs, getCurrentInstance } from 'vue'
-import useUserStore from '@/store/modules/user'
-import {
- addStockInCustom, updateProduct
-} from "@/api/inventoryManagement/stockIn.js";
-
-const userStore = useUserStore()
-const { proxy } = getCurrentInstance()
-const emit = defineEmits(['close', 'success'])
-
-const operationType = ref('')// 鎿嶄綔绫诲瀷: 'add' 鎴� 'edit'
-const dialogFormVisible = ref(false)// 寮规鏄剧ず鐘舵��
-const productList = ref([]);// 浜у搧鍒楄〃鏁版嵁
-const loadingProducts = ref(false);// 浜у搧鍔犺浇鐘舵��
-const loading = ref(false);
-
-function formatDateTime(date = new Date(), includeTime = true) {
- const d = new Date(date);
- const year = d.getFullYear();
- const month = String(d.getMonth() + 1).padStart(2, '0');
- const day = String(d.getDate()).padStart(2, '0');
-
- if (!includeTime) {
- return `${year}-${month}-${day}`;
- }
-
- const hours = String(d.getHours()).padStart(2, '0');
- const minutes = String(d.getMinutes()).padStart(2, '0');
- const seconds = String(d.getSeconds()).padStart(2, '0');
-
- return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
-}
-
-function getCurrentDate() {
- return formatDateTime(new Date(), false);
-}
-
-const itemTypeOptions = [
- { label: '鐗╂枡', value: '鐗╂枡' },
- { label: '鍘熸枡', value: '鍘熸枡' },
- { label: '鎴愬搧', value: '鎴愬搧' },
- { label: '鍏朵粬', value: '鍏朵粬' },
-]
-
-const taxRateOptions = [
- { label: '1', value: 1 },
- { label: '6', value: 6 },
- { label: '13', value: 13 },
-]
-
-const data = reactive({
- form: {
- id: null,
- supplierId: null, // 渚涘簲鍟咺D
- supplierName: '', // 渚涘簲鍟嗗悕绉�
- recorderId: userStore.userId, // 褰曞叆浜篒D
- recorderName: userStore.name, // 褰曞叆浜哄鍚�
- entryDate: getCurrentDate(), // 褰曞叆鏃ユ湡
- remark: '', // 澶囨敞
- },
- rules: {
- supplierName: [{ required: true, message: "璇疯緭鍏ヤ緵搴斿晢鍚嶇О", trigger: "blur" }]
- }
-})
-const { form, rules } = toRefs(data)
-
-// 鏂板浜у搧琛�
-const addProductRow = () => {
- productList.value.push({
- id: null,
- productCategory: '',
- specificationModel: '',
- unit: '',
- supplierName: form.value.supplierName || '',
- itemType: '',
- inboundNum: 0,
- inboundDate: '',
- quantityStock: 0,
- unitPrice: 0,
- totalPrice: 0,
- taxRate: null,
- taxExclusiveTotalPrice: 0,
- });
-};
-
-// 鍒犻櫎浜у搧琛�
-const removeProductRow = (index) => {
- productList.value.splice(index, 1);
-};
-
-// 璁$畻鎬讳环锛堟牴鎹暟閲忋�佸崟浠峰拰鍚◣鍗曚环锛�
-const calculateTotalPrice = (row) => {
- // 璁$畻鏅�氭�讳环锛歩nboundNum * unitPrice
- const quantity = Number(row.inboundNum || 0);
- const unitPrice = Number(row.unitPrice || 0);
- row.totalPrice = quantity * unitPrice;
- calculateExclusivePrice(row);
-};
-
-// 璁$畻涓嶅惈绋庢�讳环锛堟牴鎹惈绋庢�讳环鍜岀◣鐜囷級
-const calculateExclusivePrice = (row) => {
- const totalPrice = Number(row.totalPrice || 0);
- const taxRate = Number(row.taxRate || 0);
- row.taxExclusiveTotalPrice = totalPrice / (1 + taxRate / 100);
-};
-
-const submitForm = async () => {
- try {
- await proxy.$refs.formRef.validate()
-
- if (!productList.value.length) {
- proxy.$modal.msgError('璇疯嚦灏戞坊鍔犱竴鏉′骇鍝佹暟鎹�')
- return
- }
-
- // 楠岃瘉鑷畾涔夋坊鍔犵殑鏁版嵁蹇呭~瀛楁
- for (let i = 0; i < productList.value.length; i++) {
- const product = productList.value[i];
- if (!product.productCategory || !product.specificationModel || !product.unit) {
- proxy.$modal.msgError(`绗�${i + 1}琛屼骇鍝佹暟鎹湭濉啓瀹屾暣锛堜骇鍝佸ぇ绫汇�佽鏍煎瀷鍙枫�佸崟浣嶄负蹇呭~锛塦)
- return
- }
- if (!product.inboundDate) {
- proxy.$modal.msgError(`绗�${i + 1}琛岃閫夋嫨鍏ュ簱鏃ユ湡`)
- return
- }
- const stock = Number(product?.inboundNum ?? 0);
- if (!Number.isFinite(stock) || stock <= 0) {
- proxy.$modal.msgError(`绗�${i + 1}琛屾湰娆″叆搴撴暟閲忛渶澶т簬0`)
- return
- }
- }
-
- const payloadList = productList.value.map(product => ({
- id: product.id ?? null,
- inboundNum: Number(product.inboundNum),
- productCategory: product.productCategory,
- specificationModel: product.specificationModel,
- unit: product.unit,
- supplierName: product.supplierName || form.value.supplierName,
- itemType: product.itemType,
- inboundDate: formatDateTime(product.inboundDate, false),
- taxRate: Number(product.taxRate || 0),
- taxExclusiveTotalPrice: Number(product.taxExclusiveTotalPrice || 0),
- unitPrice: Number(product.unitPrice || 0),
- }));
- loading.value = true
- if (operationType.value === 'edit') {
- const editPayload = payloadList[0]
- await updateProduct(editPayload)
- } else {
- await addStockInCustom(payloadList)
- }
-
- proxy.$modal.msgSuccess(operationType.value === 'edit' ? '缂栬緫鑷畾涔夊叆搴撴垚鍔�' : '鏂板鑷畾涔夊叆搴撴垚鍔�')
- closeDia()
- emit('success')
-
- } catch (error) {
- console.error('鎻愪氦澶辫触:', error)
- if (!error.errors) {
- proxy.$modal.msgError('鎿嶄綔澶辫触锛岃閲嶈瘯')
- }
- } finally {
- loading.value = false
- }
-}
-
-const closeDia = () => {
- proxy.$refs.formRef.resetFields()
- dialogFormVisible.value = false
- productList.value = []
- emit('close')
-}
-
-const openDialog = async (type, row) => {
- operationType.value = type
- dialogFormVisible.value = true
-
- if (type === 'add') {
- form.value = {
- id: null,
- supplierId: null,
- supplierName: '',
- recorderId: userStore.userId,
- recorderName: userStore.name,
- entryDate: getCurrentDate(),
- remark: ''
- }
- productList.value = []
- } else {
- // 缂栬緫妯″紡锛氬皢琛屾暟鎹~鍏呭埌琛ㄦ牸涓互鏀寔淇敼
- form.value = {
- id: row?.id ?? null,
- supplierId: row?.supplierId ?? null,
- supplierName: row?.supplierName ?? '',
- recorderId: userStore.userId,
- recorderName: userStore.name,
- entryDate: getCurrentDate(),
- remark: row?.remark ?? ''
- }
- productList.value = [{
- id: row?.id ?? null,
- productCategory: row?.productCategory ?? '',
- specificationModel: row?.specificationModel ?? '',
- unit: row?.unit ?? '',
- supplierName: row?.supplierName ?? '',
- itemType: row?.itemType ?? '',
- inboundNum: Number(row?.inboundNum ?? row?.inboundQuantity ?? 0),
- inboundDate: row?.inboundDate ?? row?.createTime ?? '',
- taxRate: Number(row?.taxRate ?? 0),
- unitPrice: Number(row?.unitPrice ?? 0),
- taxExclusiveTotalPrice: Number(row?.taxExclusiveTotalPrice ?? 0),
- }]
- }
-}
-
-defineExpose({
- openDialog,
-})
-</script>
-
-<style scoped lang="scss"></style>
-
diff --git a/src/views/inventoryManagement/receiptManagement/index.vue b/src/views/inventoryManagement/receiptManagement/index.vue
index 9aebae4..8ca110f 100644
--- a/src/views/inventoryManagement/receiptManagement/index.vue
+++ b/src/views/inventoryManagement/receiptManagement/index.vue
@@ -1,538 +1,36 @@
<template>
<div class="app-container">
- <el-tabs v-model="activeTab"
- @tab-change="handleTabChange">
- <el-tab-pane label="鎴愬搧鍏ュ簱"
- name="production">
- <div class="search_form">
- <div>
- <span class="search_title ml10">鍏ュ簱鏃ユ湡锛�</span>
- <el-date-picker v-model="searchForm.timeStr"
- type="date"
- placeholder="璇烽�夋嫨鏃ユ湡"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- clearable
- @change="handleQuery"/>
- <span class="search_title ml10">浜у搧澶х被锛�</span>
- <el-input v-model="searchForm.productCategory"
- style="width: 240px"
- placeholder="璇疯緭鍏�"
- clearable/>
- <el-button type="primary"
- @click="handleQuery"
- style="margin-left: 10px">鎼滅储
- </el-button>
- </div>
- <div>
- <el-button @click="handleOut">瀵煎嚭</el-button>
- <el-button type="danger"
- plain
- @click="handleDelete">鍒犻櫎
- </el-button>
- </div>
- </div>
- <div class="table_list">
- <el-table :data="tableData"
- border
- v-loading="tableLoading"
- @selection-change="handleSelectionChange"
- :expand-row-keys="expandedRowKeys"
- :row-key="row => row.id"
- show-summary
- style="width: 100%"
- :summary-method="summarizeMainTable"
- height="calc(100vh - 18.5em)">
- <el-table-column align="center"
- type="selection"
- width="55"/>
- <el-table-column align="center"
- label="搴忓彿"
- type="index"
- width="60"/>
- <el-table-column label="鍏ュ簱鏃堕棿"
- prop="createTime"
- show-overflow-tooltip/>
- <el-table-column label="閿�鍞悎鍚屽彿"
- prop="salesContractNo"
- width="180"
- show-overflow-tooltip/>
- <el-table-column label="浜у搧澶х被"
- prop="productCategory"
- show-overflow-tooltip/>
- <el-table-column label="瑙勬牸鍨嬪彿"
- prop="specificationModel"
- show-overflow-tooltip/>
- <el-table-column label="鍗曚綅"
- prop="unit"
- width="70"
- show-overflow-tooltip/>
- <el-table-column label="鍏ュ簱鏁伴噺"
- prop="inboundNum"
- width="100"
- 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, 'production');">缂栬緫</el-button>
- </template>
- </el-table-column> -->
- </el-table>
- <pagination v-show="total > 0"
- :total="total"
- layout="total, sizes, prev, pager, next, jumper"
- :page="page.current"
- :limit="page.size"
- @pagination="paginationChange"/>
- </div>
- </el-tab-pane>
- <el-tab-pane label="鍘熸枡鍏ュ簱"
- name="purchase">
- <div class="search_form">
- <div>
- <span class="search_title ml10">鍏ュ簱鏃ユ湡锛�</span>
- <el-date-picker v-model="searchForm.timeStr"
- type="date"
- placeholder="璇烽�夋嫨鏃ユ湡"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- clearable
- @change="handleQuery"/>
- <span class="search_title ml10">浜у搧澶х被锛�</span>
- <el-input v-model="searchForm.productCategory"
- style="width: 240px"
- placeholder="璇疯緭鍏�"
- clearable/>
- <el-button type="primary"
- @click="handleQuery"
- style="margin-left: 10px">鎼滅储
- </el-button>
- </div>
- <div>
- <el-button type="primary"
- @click="openForm('add', 'purchase')">鏂板鍏ュ簱
- </el-button>
- <el-button @click="handleOut">瀵煎嚭</el-button>
- <el-button type="danger"
- plain
- @click="handleDelete">鍒犻櫎
- </el-button>
- </div>
- </div>
- <div class="table_list">
- <el-table :data="tableData"
- border
- v-loading="tableLoading"
- @selection-change="handleSelectionChange"
- :expand-row-keys="expandedRowKeys"
- :row-key="row => row.id"
- show-summary
- style="width: 100%"
- :summary-method="summarizeMainTable"
- height="calc(100vh - 18.5em)">
- <el-table-column align="center"
- type="selection"
- width="55"/>
- <el-table-column align="center"
- label="搴忓彿"
- type="index"
- width="60"/>
- <el-table-column label="鍏ュ簱鏃堕棿"
- prop="createTime"
- width="100"
- show-overflow-tooltip/>
- <el-table-column label="閲囪喘鍚堝悓鍙�"
- prop="purchaseContractNumber"
- width="180"
- show-overflow-tooltip/>
- <el-table-column label="渚涘簲鍟嗗悕绉�"
- prop="supplierName"
- width="240"
- show-overflow-tooltip/>
- <el-table-column label="浜у搧澶х被"
- prop="productCategory"
- show-overflow-tooltip/>
- <el-table-column label="瑙勬牸鍨嬪彿"
- prop="specificationModel"
- show-overflow-tooltip/>
- <el-table-column label="鍗曚綅"
- prop="unit"
- width="70"
- show-overflow-tooltip/>
- <el-table-column label="鍏ュ簱鏁伴噺"
- prop="inboundNum"
- width="100"
- show-overflow-tooltip/>
- <el-table-column label="鍚◣鍗曚环(鍏�)"
- prop="taxInclusiveUnitPrice"
- width="150"></el-table-column>
- <el-table-column label="鍚◣鎬讳环(鍏�)"
- prop="taxInclusiveTotalPrice"
- width="150"></el-table-column>
- <el-table-column label="鍏ュ簱浜�"
- prop="createBy"
- width="80"
- show-overflow-tooltip/>
- <el-table-column fixed="right"
- label="鎿嶄綔"
- min-width="60"
- align="center">
- <template #default="scope">
- <el-button link
- :disabled="scope.row.type == 1"
- type="primary"
- size="small"
- @click="openForm('edit', scope.row, 'purchase');">缂栬緫
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <pagination v-show="total > 0"
- :total="total"
- layout="total, sizes, prev, pager, next, jumper"
- :page="page.current"
- :limit="page.size"
- @pagination="paginationChange"/>
- </div>
- </el-tab-pane>
- <el-tab-pane label="鐢熶骇鍏ュ簱"
- name="product">
- <div class="search_form">
- <div>
- <span class="search_title ml10">鍏ュ簱鏃ユ湡锛�</span>
- <el-date-picker v-model="searchForm.timeStr"
- type="date"
- placeholder="璇烽�夋嫨鏃ユ湡"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- clearable
- @change="handleQuery"/>
- <span class="search_title ml10">浜у搧澶х被锛�</span>
- <el-input v-model="searchForm.productCategory"
- style="width: 240px"
- placeholder="璇疯緭鍏�"
- clearable/>
- <el-button type="primary"
- @click="handleQuery"
- style="margin-left: 10px">鎼滅储
- </el-button>
- </div>
- <div>
- <el-button type="primary"
- @click="openForm('add', 'purchase')">鏂板鍏ュ簱
- </el-button>
- <el-button @click="handleOut">瀵煎嚭</el-button>
- <el-button type="danger"
- plain
- @click="handleDelete">鍒犻櫎
- </el-button>
- </div>
- </div>
- <div class="table_list">
- <el-table :data="tableData"
- border
- v-loading="tableLoading"
- @selection-change="handleSelectionChange"
- :expand-row-keys="expandedRowKeys"
- :row-key="row => row.id"
- show-summary
- style="width: 100%"
- :summary-method="summarizeMainTable"
- height="calc(100vh - 18.5em)">
- <el-table-column align="center"
- type="selection"
- width="55"/>
- <el-table-column align="center"
- label="搴忓彿"
- type="index"
- width="60"/>
- <el-table-column label="鍏ュ簱鏃堕棿"
- prop="createTime"
- width="100"
- show-overflow-tooltip/>
- <el-table-column label="浜у搧澶х被"
- prop="productCategory"
- show-overflow-tooltip/>
- <el-table-column label="瑙勬牸鍨嬪彿"
- prop="specificationModel"
- show-overflow-tooltip/>
- <el-table-column label="鍗曚綅"
- prop="unit"
- width="220"
- show-overflow-tooltip/>
- <el-table-column label="鍏ュ簱鏁伴噺"
- prop="inboundNum"
- width="220"
- show-overflow-tooltip/>
- <el-table-column label="鍏ュ簱浜�"
- prop="createBy"
- width="220"
- show-overflow-tooltip/>
- </el-table>
- <pagination v-show="total > 0"
- :total="total"
- layout="total, sizes, prev, pager, next, jumper"
- :page="page.current"
- :limit="page.size"
- @pagination="pageProductChange"/>
- </div>
+ <el-tabs v-model="activeTab" @tab-change="handleTabChange">
+ <el-tab-pane v-for="tab in tabs"
+ :label="tab.label"
+ :name="tab.name"
+ :key="tab.name">
+ <record :type="tab.type" v-if="activeTab === tab.name" />
</el-tab-pane>
</el-tabs>
- <form-dia ref="formDia"
- @close="handleQuery"
- @success="handleQuery"></form-dia>
- <form-dia-product ref="formDiaProduct"
- @close="handleQuery"
- @success="handleQuery"></form-dia-product>
</div>
</template>
<script setup>
-import pagination from "@/components/PIMTable/Pagination.vue";
-import {
- ref,
- reactive,
- toRefs,
- onMounted,
- getCurrentInstance,
- nextTick,
-} from "vue";
-import {ElMessageBox} from "element-plus";
-import useUserStore from "@/store/modules/user";
-import dayjs from "dayjs";
-import {
- getStockInPage,
- getStockInPageByProduction,
- getStockInPageByProductProduction,
- delStockIn,
-} from "@/api/inventoryManagement/stockIn.js";
-import FormDia from "./components/formDia.vue";
-import FormDiaProduct from "./components/formDiaProduct.vue";
+import Record from "@/views/inventoryManagement/receiptManagement/Record.vue";
-// 鑾峰彇褰撳墠鏃ユ湡
-function getCurrentDate() {
- return dayjs().format("YYYY-MM-DD");
-}
-
-const {proxy} = getCurrentInstance();
-
-const tableData = ref([]);
-const selectedRows = ref([]);
-const tableLoading = ref(false);
-const formDia = ref();
-const formDiaProduct = ref();
-const activeTab = ref("production"); // 褰撳墠婵�娲荤殑 tab
-
-const page = reactive({
- current: 1,
- size: 100,
-});
-const total = ref(0);
-
-const data = reactive({
- searchForm: {
- supplierName: "",
- customerName: "",
- productCategory: "",
- timeStr: "",
+const activeTab = ref('qualified')
+const type = ref(0)
+const tabs = ref([
+ {
+ label: '鍚堟牸鍏ュ簱',
+ name: 'qualified',
+ type: '0'
},
-});
-const {searchForm} = toRefs(data);
-// 鏌ヨ鍒楄〃
-/** 鎼滅储鎸夐挳鎿嶄綔 */
-const handleQuery = () => {
- page.current = 1;
- getList();
-};
-const paginationChange = obj => {
- page.current = obj.page;
- page.size = obj.limit;
- getList();
-};
-const pageProductChange = obj => {
- page.current = obj.page;
- page.size = obj.limit;
- getList();
-};
-const getList = () => {
- tableLoading.value = true;
- const params = {...page};
-
- // 鏍规嵁涓嶅悓鐨� tab 绫诲瀷浼犻�掍笉鍚岀殑鏌ヨ鍙傛暟
- if (activeTab.value === "production") {
- params.customerName = searchForm.value.customerName;
- params.timeStr = searchForm.value.timeStr;
- } else {
- params.supplierName = searchForm.value.supplierName;
- params.timeStr = searchForm.value.timeStr;
+ {
+ label: '涓嶅悎鏍煎叆搴�',
+ name: 'unqualified',
+ type: '1'
}
- params.productCategory = searchForm.value.productCategory;
- if (activeTab.value === "product") {
- getStockInPageByProductProduction(params)
- .then(res => {
- tableLoading.value = false;
- tableData.value = res.data.records;
- });
+])
- }else {
- // 鏍规嵁涓嶅悓鐨� tab 绫诲瀷璋冪敤涓嶅悓鐨勬帴鍙�
- const apiCall =
- activeTab.value === "production"
- ? getStockInPageByProduction(params)
- : getStockInPage(params);
-
- apiCall
- .then(res => {
- tableLoading.value = false;
- tableData.value = res.data.records;
-
- // 鍓嶇璁$畻鎬讳环锛氭�讳环 = unitPrice * inboundNum
- tableData.value = tableData.value.map(item => {
- // 浣跨敤鍏ュ簱鏁伴噺璁$畻鎬讳环
- const inboundNum = Number(item.inboundNum) || 0;
- const unitPrice = Number(item.unitPrice) || 0;
- const taxInclusiveUnitPrice = Number(item.taxInclusiveUnitPrice) || 0;
-
- // 鏍规嵁鏍囩椤电被鍨嬭绠椾笉鍚岀殑鎬讳环
- if (activeTab.value === "production") {
- // 鎴愬搧搴撳瓨锛氭�讳环 = unitPrice * 鍏ュ簱鏁伴噺
- item.totalPrice = (unitPrice * inboundNum).toFixed(2);
- } else {
- // 鍘熸枡鍜屾潗鏂欏簱瀛橈細鍚◣鎬讳环 = taxInclusiveUnitPrice * 鍏ュ簱鏁伴噺
- item.taxInclusiveTotalPrice = (
- taxInclusiveUnitPrice * inboundNum
- ).toFixed(2);
- }
-
- return item;
- });
-
- total.value = res.data.total;
- })
- .catch(() => {
- tableLoading.value = false;
- });
- }
-
-};
-
-// 鍒囨崲 tab
-const handleTabChange = tabName => {
- page.current = 1;
- // 鍒囨崲 tab 鏃舵竻绌烘悳绱㈡潯浠�
- searchForm.value.supplierName = "";
- searchForm.value.customerName = "";
- searchForm.value.timeStr = "";
- searchForm.value.productCategory = "";
- getList();
-};
-
-// 鎵撳紑寮规
-const openForm = async (type, row, tabType) => {
- const currentTab = tabType || activeTab.value;
- await nextTick(() => {
- if (currentTab === "production") {
- formDiaProduct.value?.openDialog(type, row);
- } else {
- formDia.value?.openDialog(type, row);
- }
- });
-};
-
-// 琛ㄦ牸閫夋嫨鏁版嵁
-const handleSelectionChange = selection => {
- selectedRows.value = selection.filter(item => item.id);
-};
-
-const expandedRowKeys = ref([]);
-
-// 涓昏〃鍚堣鏂规硶
-const summarizeMainTable = param => {
- return proxy.summarizeTable(param, [
- "contractAmount",
- "taxInclusiveTotalPrice",
- "taxExclusiveTotalPrice",
- ]);
-};
-
-// 瀵煎嚭
-const handleOut = () => {
- ElMessageBox.confirm("鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
- confirmButtonText: "纭",
- cancelButtonText: "鍙栨秷",
- type: "warning",
- })
- .then(() => {
- // 鏍规嵁涓嶅悓鐨� tab 绫诲瀷璋冪敤涓嶅悓鐨勫鍑烘帴鍙�
- let exportUrl = "/stockin/export";
- if (activeTab.value === "production") {
- exportUrl = "/stockin/exportOne";
- }
- proxy.download(exportUrl, {}, "鍏ュ簱鍙拌处.xlsx");
- })
- .catch(() => {
- proxy.$modal.msg("宸插彇娑�");
- });
-};
-
-// 鍒犻櫎
-const handleDelete = () => {
- if (selectedRows.value.length === 0) {
- proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
- return;
- }
- const ids = selectedRows.value.map(item => item.id);
-
- ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎", {
- confirmButtonText: "纭",
- cancelButtonText: "鍙栨秷",
- type: "warning",
- })
- .then(() => {
- // 鏍规嵁褰撳墠 tab 绫诲瀷閫夋嫨涓嶅悓鐨勫垹闄ゆ帴鍙e拰type鍙傛暟
- let deleteApi, deleteParams;
-
- if (activeTab.value === "production") {
- // 鎴愬搧鍒犻櫎锛宼ype浼�2
- deleteApi = delStockIn;
- deleteParams = {ids, type: 2};
- } else {
- // 鍘熸枡鍒犻櫎锛宼ype浼�1
- deleteApi = delStockIn;
- deleteParams = {ids, type: 1};
- }
-
- deleteApi(deleteParams)
- .then(() => {
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
- getList();
- })
- .catch(() => {
- proxy.$modal.msgError("鍒犻櫎澶辫触");
- });
- })
- .catch(() => {
- proxy.$modal.msg("宸插彇娑�");
- });
-};
-
-onMounted(() => {
- getList();
-});
+const handleTabChange = (tabName) => {
+ activeTab.value = tabName;
+ type.value = tabName === 'qualified' ? 0 : 1
+}
</script>
-
-<style scoped lang="scss"></style>
-
-
-
diff --git a/src/views/inventoryManagement/stockManagement/Import.vue b/src/views/inventoryManagement/stockManagement/Import.vue
new file mode 100644
index 0000000..2f3ff00
--- /dev/null
+++ b/src/views/inventoryManagement/stockManagement/Import.vue
@@ -0,0 +1,93 @@
+<template>
+ <el-dialog v-model="isShow" title="瀵煎叆搴撳瓨" @close="closeModal">
+ <FileUpload
+ ref="fileUploadRef"
+ accept=".xlsx, .xls"
+ :headers="upload.headers"
+ :action="upload.url"
+ :disabled="upload.isUploading"
+ :showTip="true"
+ @success="handleFileSuccess"
+ :downloadTemplate="downloadTemplate"
+ />
+ <template #footer>
+ <div class="dialog-footer">
+ <el-button type="primary" @click="submitFileForm">纭� 瀹�</el-button>
+ <el-button @click="closeModal">鍙� 娑�</el-button>
+ </div>
+ </template>
+ </el-dialog>
+</template>
+
+<script setup>
+import {computed, getCurrentInstance, reactive} from "vue";
+import { getToken } from "@/utils/auth.js";
+import { FileUpload } from "@/components/Upload";
+import { ElMessage } from "element-plus";
+
+defineOptions({
+ name: "瀵煎叆搴撳瓨",
+});
+
+const { proxy } = getCurrentInstance()
+
+const props = defineProps({
+ visible: {
+ type: Boolean,
+ required: true,
+ },
+
+ type: {
+ type: String,
+ required: true,
+ default: 'qualified',
+ },
+});
+
+const emit = defineEmits(['update:visible', 'uploadSuccess']);
+
+
+const isShow = computed({
+ get() {
+ return props.visible;
+ },
+ set(val) {
+ emit('update:visible', val);
+ },
+});
+
+const fileUploadRef = ref();
+const upload = reactive({
+ // 鏄惁鏄剧ず寮瑰嚭灞傦紙搴撳瓨瀵煎叆锛�
+ open: false,
+ // 鏄惁绂佺敤涓婁紶
+ isUploading: false,
+ // 璁剧疆涓婁紶鐨勮姹傚ご閮�
+ headers: { Authorization: "Bearer " + getToken() },
+ // 涓婁紶鐨勫湴鍧�
+ url: import.meta.env.VITE_APP_BASE_API + "/stockInventory/importStockInventory",
+});
+
+const submitFileForm = () => {
+ fileUploadRef.value.uploadApi();
+};
+
+const handleFileSuccess = (response) => {
+ const { code, msg } = response;
+ if (code == 200) {
+ ElMessage({ message: "瀵煎叆鎴愬姛", type: "success" });
+ emit('uploadSuccess');
+ closeModal();
+ } else {
+ ElMessage({ message: msg, type: "error" });
+ }
+};
+
+const downloadTemplate = () => {
+ proxy.download("/stockInventory/downloadStockInventory", {}, "搴撳瓨瀵煎叆妯℃澘.xlsx");
+}
+
+const closeModal = () => {
+ isShow.value = false;
+};
+</script>
diff --git a/src/views/inventoryManagement/stockManagement/New.vue b/src/views/inventoryManagement/stockManagement/New.vue
new file mode 100644
index 0000000..751c639
--- /dev/null
+++ b/src/views/inventoryManagement/stockManagement/New.vue
@@ -0,0 +1,180 @@
+<template>
+ <div>
+ <el-dialog
+ v-model="isShow"
+ title="鏂板搴撳瓨"
+ width="800"
+ @close="closeModal"
+ >
+ <el-form label-width="140px" :model="formState" label-position="top" ref="formRef">
+ <el-form-item
+ label="浜у搧鍚嶇О"
+ prop="productModelId"
+ :rules="[
+ {
+ required: true,
+ message: '璇烽�夋嫨浜у搧',
+ trigger: 'change',
+ }
+ ]"
+ >
+ <el-button type="primary" @click="showProductSelectDialog = true">
+ {{ formState.productName ? formState.productName : '閫夋嫨浜у搧' }}
+ </el-button>
+ </el-form-item>
+
+ <el-form-item
+ label="瑙勬牸"
+ prop="productModelName"
+ >
+ <el-input v-model="formState.productModelName" disabled />
+ </el-form-item>
+
+ <el-form-item
+ label="鍗曚綅"
+ prop="unit"
+ >
+ <el-input v-model="formState.unit" disabled />
+ </el-form-item>
+
+ <el-form-item
+ label="鏁伴噺"
+ prop="qualitity"
+ >
+ <el-input-number v-model="formState.qualitity" :step="1" :min="0" style="width: 100%" />
+ </el-form-item>
+
+ <el-form-item label="澶囨敞" prop="remark">
+ <el-input v-model="formState.remark" type="textarea" />
+ </el-form-item>
+ </el-form>
+
+ <!-- 浜у搧閫夋嫨寮圭獥 -->
+ <ProductSelectDialog
+ v-model="showProductSelectDialog"
+ @confirm="handleProductSelect"
+ single
+ />
+ <template #footer>
+ <div class="dialog-footer">
+ <el-button type="primary" @click="handleSubmit">纭</el-button>
+ <el-button @click="closeModal">鍙栨秷</el-button>
+ </div>
+ </template>
+ </el-dialog>
+ </div>
+</template>
+
+<script setup>
+import {ref, computed, getCurrentInstance} from "vue";
+import ProductSelectDialog from "@/views/basicData/product/ProductSelectDialog.vue";
+import {createStockInventory} from "@/api/inventoryManagement/stockInventory.js";
+import {createStockUnInventory} from "@/api/inventoryManagement/stockUninventory.js";
+
+const props = defineProps({
+ visible: {
+ type: Boolean,
+ required: true,
+ },
+
+ type: {
+ type: String,
+ required: true,
+ default: 'qualified',
+ },
+});
+
+const emit = defineEmits(['update:visible', 'completed']);
+
+// 鍝嶅簲寮忔暟鎹紙鏇夸唬閫夐」寮忕殑 data锛�
+const formState = ref({
+ productId: undefined,
+ productModelId: undefined,
+ productName: "",
+ productModelName: "",
+ unit: "",
+ qualitity: 0,
+ remark: '',
+});
+
+const isShow = computed({
+ get() {
+ return props.visible;
+ },
+ set(val) {
+ emit('update:visible', val);
+ },
+});
+
+const showProductSelectDialog = ref(false);
+
+let { proxy } = getCurrentInstance()
+
+const closeModal = () => {
+ // 閲嶇疆琛ㄥ崟鏁版嵁
+ formState.value = {
+ productId: undefined,
+ productModelId: undefined,
+ productName: "",
+ productModelName: "",
+ description: '',
+ };
+ isShow.value = false;
+};
+
+// 浜у搧閫夋嫨澶勭悊
+const handleProductSelect = async (products) => {
+ if (products && products.length > 0) {
+ const product = products[0];
+ formState.value.productId = product.productId;
+ formState.value.productName = product.productName;
+ formState.value.productModelName = product.model;
+ formState.value.productModelId = product.id;
+ formState.value.unit = product.unit;
+ showProductSelectDialog.value = false;
+ // 瑙﹀彂琛ㄥ崟楠岃瘉鏇存柊
+ proxy.$refs["formRef"]?.validateField('productModelId');
+ }
+};
+
+const handleSubmit = () => {
+ proxy.$refs["formRef"].validate(valid => {
+ if (valid) {
+ // 楠岃瘉鏄惁閫夋嫨浜嗕骇鍝佸拰瑙勬牸
+ if (!formState.value.productModelId) {
+ proxy.$modal.msgError("璇烽�夋嫨浜у搧");
+ return;
+ }
+ if (!formState.value.productModelId) {
+ proxy.$modal.msgError("璇烽�夋嫨瑙勬牸");
+ return;
+ }
+ if (props.type === 'qualified') {
+ createStockInventory(formState.value).then(res => {
+ // 鍏抽棴妯℃�佹
+ isShow.value = false;
+ // 鍛婄煡鐖剁粍浠跺凡瀹屾垚
+ emit('completed');
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ })
+ } else {
+ createStockUnInventory(formState.value).then(res => {
+ // 鍏抽棴妯℃�佹
+ isShow.value = false;
+ // 鍛婄煡鐖剁粍浠跺凡瀹屾垚
+ emit('completed');
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ })
+ }
+
+ }
+ })
+};
+
+
+defineExpose({
+ closeModal,
+ handleSubmit,
+ isShow,
+});
+</script>
diff --git a/src/views/inventoryManagement/stockManagement/Qualified.vue b/src/views/inventoryManagement/stockManagement/Qualified.vue
new file mode 100644
index 0000000..2ee39db
--- /dev/null
+++ b/src/views/inventoryManagement/stockManagement/Qualified.vue
@@ -0,0 +1,179 @@
+<template>
+ <div class="app-container">
+ <div class="search_form">
+ <div>
+ <span class="search_title ml10">浜у搧澶х被锛�</span>
+ <el-input v-model="searchForm.productName"
+ style="width: 240px"
+ placeholder="璇疯緭鍏�"
+ clearable/>
+ <el-button type="primary" @click="handleQuery" style="margin-left: 10px">鎼滅储</el-button>
+ </div>
+ <div>
+ <el-button type="primary" @click="isShowNewModal = true">鏂板搴撳瓨</el-button>
+ <el-button type="info" plain icon="Upload" @click="isShowImportModal = true">
+ 瀵煎叆搴撳瓨
+ </el-button>
+ <el-button @click="handleOut">瀵煎嚭</el-button>
+ </div>
+ </div>
+ <div class="table_list">
+ <el-table :data="tableData" border v-loading="tableLoading" @selection-change="handleSelectionChange"
+ :expand-row-keys="expandedRowKeys" :row-key="row => row.id" style="width: 100%"
+ :row-class-name="tableRowClassName" height="calc(100vh - 18.5em)">
+ <el-table-column align="center" type="selection" width="55" />
+ <el-table-column align="center" label="搴忓彿" type="index" width="60" />
+ <el-table-column label="浜у搧澶х被" prop="productName" show-overflow-tooltip />
+ <el-table-column label="瑙勬牸鍨嬪彿" prop="model" show-overflow-tooltip />
+ <el-table-column label="鍗曚綅" prop="unit" show-overflow-tooltip />
+ <el-table-column label="搴撳瓨鏁伴噺" prop="qualitity" show-overflow-tooltip />
+ <el-table-column label="搴撳瓨棰勮鏁伴噺" prop="warnNum" show-overflow-tooltip />
+ <el-table-column label="澶囨敞" prop="remark" show-overflow-tooltip />
+ <el-table-column label="鏈�杩戞洿鏂版椂闂�" prop="updateTime" show-overflow-tooltip />
+ <el-table-column fixed="right" label="鎿嶄綔" min-width="60" align="center">
+ <template #default="scope">
+ <el-button link type="primary" size="small" @click="showSubtractModal(scope.row)" :disabled="scope.row.qualitity === 0">棰嗙敤</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ <pagination v-show="total > 0" :total="total" layout="total, sizes, prev, pager, next, jumper"
+ :page="page.current" :limit="page.size" @pagination="paginationChange" />
+ </div>
+ <new-stock-inventory v-if="isShowNewModal"
+ v-model:visible="isShowNewModal"
+ type="qualified"
+ @completed="handleQuery" />
+
+ <subtract-stock-inventory v-if="isShowSubtractModal"
+ v-model:visible="isShowSubtractModal"
+ :record="record"
+ @completed="handleQuery" />
+ <!-- 瀵煎叆搴撳瓨-->
+ <import-stock-inventory v-if="isShowImportModal"
+ v-model:visible="isShowImportModal"
+ type="qualified"
+ @uploadSuccess="handleQuery" />
+ </div>
+</template>
+
+<script setup>
+import pagination from '@/components/PIMTable/Pagination.vue'
+import { ref, reactive, toRefs, onMounted, getCurrentInstance } from 'vue'
+import {ElMessage, ElMessageBox} from "element-plus";
+import { getStockInventoryListPage } from "@/api/inventoryManagement/stockInventory.js";
+const NewStockInventory = defineAsyncComponent(() => import("@/views/inventoryManagement/stockManagement/New.vue"));
+const SubtractStockInventory = defineAsyncComponent(() => import("@/views/inventoryManagement/stockManagement/Subtract.vue"));
+const ImportStockInventory = defineAsyncComponent(() => import("@/views/inventoryManagement/stockManagement/Import.vue"));
+const { proxy } = getCurrentInstance()
+const tableData = ref([])
+const selectedRows = ref([])
+const record = ref({})
+const tableLoading = ref(false)
+const page = reactive({
+ current: 1,
+ size: 100,
+})
+const total = ref(0)
+// 鏄惁鏄剧ず鏂板寮规
+const isShowNewModal = ref(false)
+// 鏄惁鏄剧ず棰嗙敤寮规
+const isShowSubtractModal = ref(false)
+// 鏄惁鏄剧ず瀵煎叆寮规
+const isShowImportModal = ref(false)
+const data = reactive({
+ searchForm: {
+ productName: '',
+ }
+})
+const { searchForm } = toRefs(data)
+
+// 鏌ヨ鍒楄〃
+/** 鎼滅储鎸夐挳鎿嶄綔 */
+const handleQuery = () => {
+ page.current = 1
+ getList()
+}
+const paginationChange = (obj) => {
+ page.current = obj.page;
+ page.size = obj.limit;
+ getList()
+}
+const getList = () => {
+ tableLoading.value = true
+ getStockInventoryListPage({ ...searchForm.value, ...page }).then(res => {
+ tableLoading.value = false
+ tableData.value = res.data.records
+ total.value = res.data.total
+ // 鏁版嵁鍔犺浇瀹屾垚鍚庢鏌ュ簱瀛�
+ // checkStockAndCreatePurchase();
+ }).catch(() => {
+ tableLoading.value = false
+ })
+}
+
+const handleFileSuccess = (response) => {
+ const { code, msg } = response;
+ if (code == 200) {
+ ElMessage({ message: "瀵煎叆鎴愬姛", type: "success" });
+ upload.open = false;
+ emits("uploadSuccess");
+ } else {
+ ElMessage({ message: msg, type: "error" });
+ }
+};
+
+// 鐐瑰嚮棰嗙敤
+const showSubtractModal = (row) => {
+ record.value = row
+ isShowSubtractModal.value = true
+}
+
+// 琛ㄦ牸閫夋嫨鏁版嵁
+const handleSelectionChange = (selection) => {
+ // 杩囨护鎺夊瓙鏁版嵁
+ selectedRows.value = selection.filter(item => item.id);
+ console.log('selection', selectedRows.value)
+}
+const expandedRowKeys = ref([])
+
+// 琛ㄦ牸琛岀被鍚�
+const tableRowClassName = ({ row }) => {
+ const stock = Number(row?.inboundNum0 ?? 0);
+ const warn = Number(row?.warnNum ?? 0);
+ if (!Number.isFinite(stock) || !Number.isFinite(warn)) {
+ return '';
+ }
+ return stock < warn ? 'row-low-stock' : '';
+};
+
+// 瀵煎嚭
+const handleOut = () => {
+ ElMessageBox.confirm(
+ '鏄惁纭瀵煎嚭锛�',
+ '瀵煎嚭', {
+ confirmButtonText: '纭',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning',
+ }
+ ).then(() => {
+ proxy.download("/stockInventory/exportStockInventory", {}, '鍚堟牸搴撳瓨淇℃伅.xlsx')
+ }).catch(() => {
+ proxy.$modal.msg("宸插彇娑�")
+ })
+}
+
+onMounted(() => {
+ getList()
+})
+</script>
+
+<style scoped lang="scss">
+:deep(.row-low-stock td) {
+ background-color: #fde2e2;
+ color: #c45656;
+}
+
+:deep(.row-low-stock:hover > td) {
+ background-color: #fcd4d4;
+}
+</style>
diff --git a/src/views/inventoryManagement/stockManagement/Subtract.vue b/src/views/inventoryManagement/stockManagement/Subtract.vue
new file mode 100644
index 0000000..082153c
--- /dev/null
+++ b/src/views/inventoryManagement/stockManagement/Subtract.vue
@@ -0,0 +1,199 @@
+<template>
+ <div>
+ <el-dialog
+ v-model="isShow"
+ title="棰嗙敤"
+ width="800"
+ @close="closeModal"
+ >
+ <el-form label-width="140px" :model="formState" label-position="top" ref="formRef">
+ <el-form-item
+ label="浜у搧鍚嶇О"
+ prop="productModelId"
+ :rules="[
+ {
+ required: true,
+ message: '璇烽�夋嫨浜у搧',
+ trigger: 'change',
+ }
+ ]"
+ >
+ <el-button type="primary" @click="showProductSelectDialog = true" disabled>
+ {{ formState.productName ? formState.productName : '閫夋嫨浜у搧' }}
+ </el-button>
+ </el-form-item>
+
+ <el-form-item
+ label="瑙勬牸"
+ prop="productModelName"
+ >
+ <el-input v-model="formState.model" disabled />
+ </el-form-item>
+
+ <el-form-item
+ label="鍗曚綅"
+ prop="unit"
+ >
+ <el-input v-model="formState.unit" disabled />
+ </el-form-item>
+
+ <el-form-item
+ label="鏁伴噺"
+ prop="qualitity"
+ >
+ <el-input-number v-model="formState.qualitity" :step="1" :min="1" :max="maxQuality" style="width: 100%" />
+ </el-form-item>
+
+ <el-form-item label="澶囨敞" prop="remark">
+ <el-input v-model="formState.remark" type="textarea" />
+ </el-form-item>
+ </el-form>
+
+ <!-- 浜у搧閫夋嫨寮圭獥 -->
+ <ProductSelectDialog
+ v-model="showProductSelectDialog"
+ @confirm="handleProductSelect"
+ single
+ />
+ <template #footer>
+ <div class="dialog-footer">
+ <el-button type="primary" @click="handleSubmit">纭</el-button>
+ <el-button @click="closeModal">鍙栨秷</el-button>
+ </div>
+ </template>
+ </el-dialog>
+ </div>
+</template>
+
+<script setup>
+import {ref, computed, getCurrentInstance} from "vue";
+import ProductSelectDialog from "@/views/basicData/product/ProductSelectDialog.vue";
+import {subtractStockInventory} from "@/api/inventoryManagement/stockInventory.js";
+import {subtractStockUnInventory} from "@/api/inventoryManagement/stockUninventory.js";
+
+const props = defineProps({
+ visible: {
+ type: Boolean,
+ required: true,
+ },
+ record: {
+ type: Object,
+ default: () => {},
+ },
+ type: {
+ type: String,
+ required: true,
+ default: 'qualified',
+ },
+});
+
+const emit = defineEmits(['update:visible', 'completed']);
+
+onMounted(() => {
+ initFormData()
+})
+
+const maxQuality = computed(() => {
+ return props.record.qualitity ? props.record.qualitity : 0;
+})
+
+const initFormData = () => {
+ if (props.record) {
+ formState.value = {
+ ...props.record,
+ }
+ }
+}
+
+// 鍝嶅簲寮忔暟鎹紙鏇夸唬閫夐」寮忕殑 data锛�
+const formState = ref({
+ productId: undefined,
+ productModelId: undefined,
+ productName: "",
+ model: "",
+ unit: "",
+ qualitity: 0,
+ remark: '',
+});
+
+const isShow = computed({
+ get() {
+ return props.visible;
+ },
+ set(val) {
+ emit('update:visible', val);
+ },
+});
+
+const showProductSelectDialog = ref(false);
+
+let { proxy } = getCurrentInstance()
+
+const closeModal = () => {
+ // 閲嶇疆琛ㄥ崟鏁版嵁
+ formState.value = {
+ productId: undefined,
+ productModelId: undefined,
+ productName: "",
+ productModelName: "",
+ description: '',
+ };
+ isShow.value = false;
+};
+
+// 浜у搧閫夋嫨澶勭悊
+const handleProductSelect = async (products) => {
+ if (products && products.length > 0) {
+ const product = products[0];
+ console.log(product)
+ formState.value.productId = product.productId;
+ formState.value.productName = product.productName;
+ formState.value.productModelName = product.model;
+ formState.value.productModelId = product.id;
+ formState.value.unit = product.unit;
+ showProductSelectDialog.value = false;
+ // 瑙﹀彂琛ㄥ崟楠岃瘉鏇存柊
+ proxy.$refs["formRef"]?.validateField('productModelId');
+ }
+};
+
+const handleSubmit = () => {
+ proxy.$refs["formRef"].validate(valid => {
+ if (valid) {
+ // 楠岃瘉鏄惁閫夋嫨浜嗕骇鍝佸拰瑙勬牸
+ if (!formState.value.productModelId) {
+ proxy.$modal.msgError("璇烽�夋嫨浜у搧");
+ return;
+ }
+ if (!formState.value.productModelId) {
+ proxy.$modal.msgError("璇烽�夋嫨瑙勬牸");
+ return;
+ }
+ if (props.type === 'qualified') {
+ subtractStockInventory(formState.value).then(res => {
+ // 鍏抽棴妯℃�佹
+ isShow.value = false;
+ // 鍛婄煡鐖剁粍浠跺凡瀹屾垚
+ emit('completed');
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ })
+ } else {
+ subtractStockUnInventory(formState.value).then(res => {
+ // 鍏抽棴妯℃�佹
+ isShow.value = false;
+ // 鍛婄煡鐖剁粍浠跺凡瀹屾垚
+ emit('completed');
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ })
+ }
+ }
+ })
+};
+
+
+defineExpose({
+ closeModal,
+ handleSubmit,
+ isShow,
+});
+</script>
diff --git a/src/views/inventoryManagement/stockManagement/Unqualified.vue b/src/views/inventoryManagement/stockManagement/Unqualified.vue
new file mode 100644
index 0000000..67d5f58
--- /dev/null
+++ b/src/views/inventoryManagement/stockManagement/Unqualified.vue
@@ -0,0 +1,158 @@
+<template>
+ <div class="app-container">
+ <div class="search_form">
+ <div>
+ <span class="search_title ml10">浜у搧澶х被锛�</span>
+ <el-input v-model="searchForm.productName"
+ style="width: 240px"
+ placeholder="璇疯緭鍏�"
+ clearable/>
+ <el-button type="primary" @click="handleQuery" style="margin-left: 10px">鎼滅储</el-button>
+ </div>
+ <div>
+ <el-button type="primary" @click="isShowNewModal = true">鏂板搴撳瓨</el-button>
+ <el-button @click="handleOut">瀵煎嚭</el-button>
+ </div>
+ </div>
+ <div class="table_list">
+ <el-table :data="tableData" border v-loading="tableLoading" @selection-change="handleSelectionChange"
+ :expand-row-keys="expandedRowKeys" :row-key="row => row.id" style="width: 100%"
+ :row-class-name="tableRowClassName" height="calc(100vh - 18.5em)">
+ <el-table-column align="center" type="selection" width="55" />
+ <el-table-column align="center" label="搴忓彿" type="index" width="60" />
+ <el-table-column label="浜у搧澶х被" prop="productName" show-overflow-tooltip />
+ <el-table-column label="瑙勬牸鍨嬪彿" prop="model" show-overflow-tooltip />
+ <el-table-column label="鍗曚綅" prop="unit" show-overflow-tooltip />
+ <el-table-column label="搴撳瓨鏁伴噺" prop="qualitity" show-overflow-tooltip />
+ <el-table-column label="搴撳瓨棰勮鏁伴噺" prop="warnNum" show-overflow-tooltip />
+ <el-table-column label="澶囨敞" prop="remark" show-overflow-tooltip />
+ <el-table-column label="鏈�杩戞洿鏂版椂闂�" prop="updateTime" show-overflow-tooltip />
+ <el-table-column fixed="right" label="鎿嶄綔" min-width="60" align="center">
+ <template #default="scope">
+ <el-button link type="primary" size="small" @click="showSubtractModal(scope.row)" :disabled="scope.row.qualitity === 0">棰嗙敤</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ <pagination v-show="total > 0" :total="total" layout="total, sizes, prev, pager, next, jumper"
+ :page="page.current" :limit="page.size" @pagination="paginationChange" />
+ </div>
+ <new-stock-inventory v-if="isShowNewModal"
+ v-model:visible="isShowNewModal"
+ type="unqualified"
+ @completed="handleQuery" />
+
+ <subtract-stock-inventory v-if="isShowSubtractModal"
+ v-model:visible="isShowSubtractModal"
+ :record="record"
+ @completed="handleQuery" />
+ </div>
+</template>
+
+<script setup>
+import pagination from '@/components/PIMTable/Pagination.vue'
+import { ref, reactive, toRefs, onMounted, getCurrentInstance } from 'vue'
+import { ElMessageBox } from "element-plus";
+import { getStockUninventoryListPage } from "@/api/inventoryManagement/stockUninventory.js";
+const NewStockInventory = defineAsyncComponent(() => import("@/views/inventoryManagement/stockManagement/New.vue"));
+const SubtractStockInventory = defineAsyncComponent(() => import("@/views/inventoryManagement/stockManagement/Subtract.vue"));
+
+const { proxy } = getCurrentInstance()
+const tableData = ref([])
+const selectedRows = ref([])
+const record = ref({})
+const tableLoading = ref(false)
+const page = reactive({
+ current: 1,
+ size: 100,
+})
+const total = ref(0)
+// 鏄惁鏄剧ず鏂板寮规
+const isShowNewModal = ref(false)
+// 鏄惁鏄剧ず棰嗙敤寮规
+const isShowSubtractModal = ref(false)
+const data = reactive({
+ searchForm: {
+ productName: '',
+ }
+})
+const { searchForm } = toRefs(data)
+
+// 鏌ヨ鍒楄〃
+/** 鎼滅储鎸夐挳鎿嶄綔 */
+const handleQuery = () => {
+ page.current = 1
+ getList()
+}
+const paginationChange = (obj) => {
+ page.current = obj.page;
+ page.size = obj.limit;
+ getList()
+}
+const getList = () => {
+ tableLoading.value = true
+ getStockUninventoryListPage({ ...searchForm.value, ...page }).then(res => {
+ tableLoading.value = false
+ tableData.value = res.data.records
+ total.value = res.data.total
+ // 鏁版嵁鍔犺浇瀹屾垚鍚庢鏌ュ簱瀛�
+ // checkStockAndCreatePurchase();
+ }).catch(() => {
+ tableLoading.value = false
+ })
+}
+
+// 鐐瑰嚮棰嗙敤
+const showSubtractModal = (row) => {
+ record.value = row
+ isShowSubtractModal.value = true
+}
+
+// 琛ㄦ牸閫夋嫨鏁版嵁
+const handleSelectionChange = (selection) => {
+ // 杩囨护鎺夊瓙鏁版嵁
+ selectedRows.value = selection.filter(item => item.id);
+ console.log('selection', selectedRows.value)
+}
+const expandedRowKeys = ref([])
+
+// 琛ㄦ牸琛岀被鍚�
+const tableRowClassName = ({ row }) => {
+ const stock = Number(row?.inboundNum0 ?? 0);
+ const warn = Number(row?.warnNum ?? 0);
+ if (!Number.isFinite(stock) || !Number.isFinite(warn)) {
+ return '';
+ }
+ return stock < warn ? 'row-low-stock' : '';
+};
+
+// 瀵煎嚭
+const handleOut = () => {
+ ElMessageBox.confirm(
+ '鏄惁纭瀵煎嚭锛�',
+ '瀵煎嚭', {
+ confirmButtonText: '纭',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning',
+ }
+ ).then(() => {
+ proxy.download("/stockUninventory/exportStockUninventory", {}, '涓嶅悎鏍煎簱瀛樹俊鎭�.xlsx')
+ }).catch(() => {
+ proxy.$modal.msg("宸插彇娑�")
+ })
+}
+
+onMounted(() => {
+ getList()
+})
+</script>
+
+<style scoped lang="scss">
+:deep(.row-low-stock td) {
+ background-color: #fde2e2;
+ color: #c45656;
+}
+
+:deep(.row-low-stock:hover > td) {
+ background-color: #fcd4d4;
+}
+</style>
diff --git a/src/views/inventoryManagement/stockManagement/components/FormDiaProduction.vue b/src/views/inventoryManagement/stockManagement/components/FormDiaProduction.vue
deleted file mode 100644
index 1653307..0000000
--- a/src/views/inventoryManagement/stockManagement/components/FormDiaProduction.vue
+++ /dev/null
@@ -1,147 +0,0 @@
-<template>
- <el-dialog :model-value="dialogFormVisible" :title="operationType === 'add' ? '鏂板鎴愬搧搴撳瓨' : '缂栬緫鎴愬搧搴撳瓨'" width="70%"
- @update:model-value="$emit('update:dialogFormVisible', $event)" @close="closeDia">
- <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef">
- <el-row :gutter="30">
- <el-col :span="12">
- <el-form-item label="浜у搧澶х被锛�" prop="productCategory">
- <el-input disabled v-model="form.productCategory" placeholder="璇疯緭鍏�" clearable />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="瑙勬牸鍨嬪彿锛�" prop="specificationModel">
- <el-input disabled v-model="form.specificationModel" placeholder="璇疯緭鍏�" clearable />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="30">
- <el-col :span="12">
- <el-form-item label="鍗曚綅锛�" prop="unit">
- <el-input disabled v-model="form.unit" placeholder="璇疯緭鍏�" clearable />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="鍏ュ簱鏃堕棿锛�" prop="createTime">
- <el-date-picker style="width: 100%" v-model="form.createTime" value-format="YYYY-MM-DD" format="YYYY-MM-DD"
- type="date" placeholder="璇烽�夋嫨" clearable />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="30">
- <el-col :span="12">
- <el-form-item label="搴撳瓨鏁伴噺锛�" prop="inboundNum">
- <el-input v-model="form.inboundNum" placeholder="璇疯緭鍏�" clearable @input="calculateTotalPrice" />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="宸插嚭搴撴暟閲忥細" prop="totalInboundNum">
- <el-input disabled v-model="form.totalInboundNum" placeholder="璇疯緭鍏�" clearable />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="30">
- <el-col :span="12">
- <el-form-item label="寰呭嚭搴撴暟閲忥細" prop="inboundNum0">
- <el-input disabled v-model="form.inboundNum0" placeholder="璇疯緭鍏�" clearable />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="鍗曚环(鍏�)锛�" prop="unitPrice">
- <el-input v-model="form.unitPrice" placeholder="璇疯緭鍏�" clearable @input="calculateTotalPrice" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="30">
- <el-col :span="12">
- <el-form-item label="鎬讳环(鍏�)锛�" prop="totalPrice">
- <el-input disabled v-model="form.totalPrice" placeholder="鑷姩璁$畻" clearable />
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <template #footer>
- <div class="dialog-footer">
- <el-button type="primary" @click="submitForm">纭</el-button>
- <el-button @click="closeDia">鍙栨秷</el-button>
- </div>
- </template>
- </el-dialog>
-</template>
-
-<script setup>
-import { ref, reactive, toRefs, watch } from 'vue'
-
-const props = defineProps({
- dialogFormVisible: Boolean,
- operationType: String,
- formData: Object
-})
-
-const emit = defineEmits(['update:dialogFormVisible', 'submit', 'close'])
-
-const formRef = ref()
-
-const data = reactive({
- form: {
- productCategory: '',
- specificationModel: '',
- unit: '',
- createTime: '',
- inboundNum: '',
- totalInboundNum: '',
- inboundNum0: '',
- unitPrice: '',
- totalPrice: ''
- },
- rules: {
- productCategory: [{ required: true, message: '璇疯緭鍏ヤ骇鍝佸ぇ绫�', trigger: 'blur' }],
- specificationModel: [{ required: true, message: '璇疯緭鍏ヨ鏍煎瀷鍙�', trigger: 'blur' }],
- unit: [{ required: true, message: '璇疯緭鍏ュ崟浣�', trigger: 'blur' }],
- createTime: [{ required: true, message: '璇烽�夋嫨鍏ュ簱鏃堕棿', trigger: 'change' }],
- inboundNum: [{ required: true, message: '璇疯緭鍏ュ簱瀛樻暟閲�', trigger: 'blur' }],
- unitPrice: [{ required: true, message: '璇疯緭鍏ュ崟浠�', trigger: 'blur' }]
- }
-})
-
-const { form, rules } = toRefs(data)
-
-// 璁$畻鎬讳环锛氭�讳环 = 鍗曚环 脳 鍓╀綑搴撳瓨
-const calculateTotalPrice = () => {
- const unitPrice = parseFloat(form.value.unitPrice) || 0
- const stockQuantity = parseFloat(form.value.inboundNum) || 0 // 搴撳瓨鏁伴噺
- const outboundQuantity = parseFloat(form.value.totalInboundNum) || 0 // 宸插嚭搴撴暟閲�
- const remainingStock = stockQuantity - outboundQuantity // 鍓╀綑搴撳瓨
- form.value.totalPrice = (unitPrice * remainingStock).toFixed(2)
-}
-
-// 鐩戝惉formData鍙樺寲
-watch(() => props.formData, (newVal) => {
- if (newVal) {
- form.value = { ...newVal }
- // 鏁版嵁鍙樺寲鍚庨噸鏂拌绠楁�讳环
- calculateTotalPrice()
- }
-}, { immediate: true })
-
-// 鎻愪氦琛ㄥ崟
-const submitForm = () => {
- formRef.value.validate(valid => {
- if (valid) {
- emit('submit', form.value)
- }
- })
-}
-
-// 鍏抽棴寮规
-const closeDia = () => {
- emit('close')
- emit('update:dialogFormVisible', false)
-}
-
-</script>
-
-<style scoped lang="scss">
-.dialog-footer {
- text-align: center;
-}
-</style>
\ No newline at end of file
diff --git a/src/views/inventoryManagement/stockManagement/components/FormDiaPurchase.vue b/src/views/inventoryManagement/stockManagement/components/FormDiaPurchase.vue
deleted file mode 100644
index 5da2eee..0000000
--- a/src/views/inventoryManagement/stockManagement/components/FormDiaPurchase.vue
+++ /dev/null
@@ -1,147 +0,0 @@
-<template>
- <el-dialog :model-value="dialogFormVisible" :title="operationType === 'add' ? '鏂板鍘熸枡搴撳瓨' : '缂栬緫鍘熸枡搴撳瓨'" width="70%"
- @update:model-value="$emit('update:dialogFormVisible', $event)" @close="closeDia">
- <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef">
- <el-row :gutter="30">
- <el-col :span="12">
- <el-form-item label="浜у搧澶х被锛�" prop="productCategory">
- <el-input disabled v-model="form.productCategory" placeholder="璇疯緭鍏�" clearable />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="瑙勬牸鍨嬪彿锛�" prop="specificationModel">
- <el-input disabled v-model="form.specificationModel" placeholder="璇疯緭鍏�" clearable />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="30">
- <el-col :span="12">
- <el-form-item label="鍗曚綅锛�" prop="unit">
- <el-input disabled v-model="form.unit" placeholder="璇疯緭鍏�" clearable />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="鍏ュ簱鏃堕棿锛�" prop="createTime">
- <el-date-picker style="width: 100%" v-model="form.createTime" value-format="YYYY-MM-DD" format="YYYY-MM-DD"
- type="date" placeholder="璇烽�夋嫨" clearable />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="30">
- <el-col :span="12">
- <el-form-item label="搴撳瓨鏁伴噺锛�" prop="inboundNum">
- <el-input v-model="form.inboundNum" placeholder="璇疯緭鍏�" clearable @input="calculateTotalPrice" />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="宸插嚭搴撴暟閲忥細" prop="totalInboundNum">
- <el-input disabled v-model="form.totalInboundNum" placeholder="璇疯緭鍏�" clearable />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="30">
- <el-col :span="12">
- <el-form-item label="寰呭嚭搴撴暟閲忥細" prop="inboundNum0">
- <el-input disabled v-model="form.inboundNum0" placeholder="璇疯緭鍏�" clearable />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="鍚◣鍗曚环(鍏�)锛�" prop="taxInclusiveUnitPrice">
- <el-input v-model="form.taxInclusiveUnitPrice" placeholder="璇疯緭鍏�" clearable @input="calculateTotalPrice" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="30">
- <el-col :span="12">
- <el-form-item label="鍚◣鎬讳环(鍏�)锛�" prop="taxInclusiveTotalPrice">
- <el-input disabled v-model="form.taxInclusiveTotalPrice" placeholder="鑷姩璁$畻" clearable />
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <template #footer>
- <div class="dialog-footer">
- <el-button type="primary" @click="submitForm">纭</el-button>
- <el-button @click="closeDia">鍙栨秷</el-button>
- </div>
- </template>
- </el-dialog>
-</template>
-
-<script setup>
-import { ref, reactive, toRefs, watch } from 'vue'
-
-const props = defineProps({
- dialogFormVisible: Boolean,
- operationType: String,
- formData: Object
-})
-
-const emit = defineEmits(['update:dialogFormVisible', 'submit', 'close'])
-
-const formRef = ref()
-
-const data = reactive({
- form: {
- productCategory: '',
- specificationModel: '',
- unit: '',
- createTime: '',
- inboundNum: '',
- totalInboundNum: '',
- inboundNum0: '',
- taxInclusiveUnitPrice: '',
- taxInclusiveTotalPrice: ''
- },
- rules: {
- productCategory: [{ required: true, message: '璇疯緭鍏ヤ骇鍝佸ぇ绫�', trigger: 'blur' }],
- specificationModel: [{ required: true, message: '璇疯緭鍏ヨ鏍煎瀷鍙�', trigger: 'blur' }],
- unit: [{ required: true, message: '璇疯緭鍏ュ崟浣�', trigger: 'blur' }],
- createTime: [{ required: true, message: '璇烽�夋嫨鍏ュ簱鏃堕棿', trigger: 'change' }],
- inboundNum: [{ required: true, message: '璇疯緭鍏ュ簱瀛樻暟閲�', trigger: 'blur' }],
- taxInclusiveUnitPrice: [{ required: true, message: '璇疯緭鍏ュ惈绋庡崟浠�', trigger: 'blur' }]
- }
-})
-
-const { form, rules } = toRefs(data)
-
-// 璁$畻鎬讳环锛氬惈绋庢�讳环 = 鍚◣鍗曚环 脳 鍓╀綑搴撳瓨
-const calculateTotalPrice = () => {
- const unitPrice = parseFloat(form.value.taxInclusiveUnitPrice) || 0
- const stockQuantity = parseFloat(form.value.inboundNum) || 0 // 搴撳瓨鏁伴噺
- const outboundQuantity = parseFloat(form.value.totalInboundNum) || 0 // 宸插嚭搴撴暟閲�
- const remainingStock = stockQuantity - outboundQuantity // 鍓╀綑搴撳瓨
- form.value.taxInclusiveTotalPrice = (unitPrice * remainingStock).toFixed(2)
-}
-
-// 鐩戝惉formData鍙樺寲
-watch(() => props.formData, (newVal) => {
- if (newVal) {
- form.value = { ...newVal }
- // 鏁版嵁鍙樺寲鍚庨噸鏂拌绠楁�讳环
- calculateTotalPrice()
- }
-}, { immediate: true })
-
-// 鎻愪氦琛ㄥ崟
-const submitForm = () => {
- formRef.value.validate(valid => {
- if (valid) {
- emit('submit', form.value)
- }
- })
-}
-
-// 鍏抽棴寮规
-const closeDia = () => {
- emit('close')
- emit('update:dialogFormVisible', false)
-}
-
-</script>
-
-<style scoped lang="scss">
-.dialog-footer {
- text-align: center;
-}
-</style>
\ No newline at end of file
diff --git a/src/views/inventoryManagement/stockManagement/index.vue b/src/views/inventoryManagement/stockManagement/index.vue
index 19d3b85..347de38 100644
--- a/src/views/inventoryManagement/stockManagement/index.vue
+++ b/src/views/inventoryManagement/stockManagement/index.vue
@@ -1,729 +1,33 @@
<template>
<div class="app-container">
- <el-tabs v-model="activeTab"
- @tab-change="handleTabChange">
- <el-tab-pane label="鎴愬搧搴撳瓨"
- name="production">
- <div class="search_form">
- <div>
- <span class="search_title ml10">鍏ュ簱鏃ユ湡锛�</span>
- <el-date-picker v-model="searchForm.timeStr"
- type="date"
- placeholder="璇烽�夋嫨鏃ユ湡"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- clearable
- @change="handleQuery" />
- <span class="search_title ml10">浜у搧澶х被锛�</span>
- <el-input v-model="searchForm.productCategory"
- style="width: 240px"
- placeholder="璇疯緭鍏�"
- clearable />
- <el-button type="primary"
- @click="handleQuery"
- style="margin-left: 10px">鎼滅储</el-button>
- </div>
- <div>
- <el-button @click="handleOut">瀵煎嚭</el-button>
- <el-button type="danger"
- plain
- @click="handleFrozenFinished">鍐荤粨</el-button>
- <el-button type="success"
- plain
- @click="handleThawFinished">瑙e喕</el-button>
- <!-- <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>-->
- </div>
- </div>
- <div class="table_list">
- <el-table :data="tableData"
- border
- v-loading="tableLoading"
- @selection-change="handleSelectionChange"
- :expand-row-keys="expandedRowKeys"
- :row-key="row => row.id"
- show-summary
- style="width: 100%"
- :row-class-name="tableRowClassName"
- :summary-method="summarizeMainTable"
- height="calc(100vh - 18.5em)">
- <el-table-column align="center"
- type="selection"
- width="55" />
- <el-table-column align="center"
- label="搴忓彿"
- type="index"
- width="60" />
- <el-table-column label="鍏ュ簱鏃ユ湡"
- prop="createTime"
- 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="model"
- show-overflow-tooltip />
- <el-table-column label="鍗曚綅"
- prop="unit"
- width="80"
- show-overflow-tooltip />
- <el-table-column label="宸插嚭搴撴暟閲�"
- prop="outboundNum"
- show-overflow-tooltip />
- <el-table-column label="鍓╀綑搴撳瓨"
- prop="stockQuantity"
- show-overflow-tooltip />
- <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-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>
- </template>
- </el-table-column> -->
- </el-table>
- <pagination v-show="total > 0"
- :total="total"
- layout="total, sizes, prev, pager, next, jumper"
- :page="page.current"
- :limit="page.size"
- @pagination="paginationChange" />
- </div>
- </el-tab-pane>
- <el-tab-pane label="鍘熸枡搴撳瓨"
- name="purchase">
- <div class="search_form">
- <div>
- <span class="search_title ml10">鍏ュ簱鏃ユ湡锛�</span>
- <el-date-picker v-model="searchForm.timeStr"
- type="date"
- placeholder="璇烽�夋嫨鏃ユ湡"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- clearable
- @change="handleQuery" />
- <span class="search_title ml10">浜у搧澶х被锛�</span>
- <el-input v-model="searchForm.productCategory"
- style="width: 240px"
- placeholder="璇疯緭鍏�"
- clearable />
- <el-button type="primary"
- @click="handleQuery"
- style="margin-left: 10px">鎼滅储</el-button>
- </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>
- <div class="table_list">
- <el-table :data="tableData"
- border
- v-loading="tableLoading"
- @selection-change="handleSelectionChange"
- :expand-row-keys="expandedRowKeys"
- :row-key="row => row.id"
- show-summary
- style="width: 100%"
- :row-class-name="tableRowClassName"
- :summary-method="summarizeMainTable"
- height="calc(100vh - 18.5em)">
- <el-table-column align="center"
- type="selection"
- width="55" />
- <el-table-column align="center"
- label="搴忓彿"
- type="index"
- width="60" />
- <el-table-column label="鍏ュ簱鏃ユ湡"
- prop="createTime"
- 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"
- show-overflow-tooltip />
- <el-table-column label="浜у搧澶х被"
- prop="productCategory"
- show-overflow-tooltip />
- <el-table-column label="瑙勬牸鍨嬪彿"
- prop="specificationModel"
- show-overflow-tooltip />
- <el-table-column label="鍗曚綅"
- prop="unit"
- width="80"
- show-overflow-tooltip />
- <el-table-column label="宸插嚭搴撴暟閲�"
- prop="totalInboundNum"
- show-overflow-tooltip />
- <el-table-column label="鍓╀綑搴撳瓨"
- prop="inboundNum0"
- show-overflow-tooltip />
- <el-table-column label="鍚◣鍗曚环(鍏�)"
- prop="taxInclusiveUnitPrice"
- width="150"></el-table-column>
- <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"
- layout="total, sizes, prev, pager, next, jumper"
- :page="page.current"
- :limit="page.size"
- @pagination="paginationChange" />
- </div>
+ <el-tabs v-model="activeTab" @tab-change="handleTabChange">
+ <el-tab-pane v-for="tab in tabs"
+ :label="tab.label"
+ :name="tab.name"
+ :key="tab.name">
+ <component :is="tab.name === 'qualified' ? QualifiedRecord : UnqualifiedRecord" />
</el-tab-pane>
</el-tabs>
- <!-- 鎴愬搧搴撳瓨寮规 -->
- <FormDiaProduction v-model:dialogFormVisible="productionDialogVisible"
- :operationType="operationType"
- :formData="form"
- @submit="submitForm"
- @close="closeDia" />
- <!-- 鍘熸枡搴撳瓨寮规 -->
- <FormDiaPurchase v-model:dialogFormVisible="purchaseDialogVisible"
- :operationType="operationType"
- :formData="form"
- @submit="submitForm"
- @close="closeDia" />
</div>
</template>
<script setup>
- import pagination from "@/components/PIMTable/Pagination.vue";
- import { ref, reactive, toRefs, onMounted, getCurrentInstance } from "vue";
- import { ElMessageBox } from "element-plus";
- import useUserStore from "@/store/modules/user";
- import { userListNoPageByTenantId } from "@/api/system/user.js";
- import { productTreeList, modelList } from "@/api/basicData/product.js";
- import {
- getStockManagePage,
- getStockManagePageByProduction,
- delStockManage, getStockManageProduction,
- frozenQuality,
- thawQuality,
- frozenFinishedQuality,
- thawFinishedQuality,
- } from "@/api/inventoryManagement/stockManage.js";
- import {
- updateManagement,
- updateManagementByCustom,
- updateStockIn,
- } from "@/api/inventoryManagement/stockIn.js";
+import QualifiedRecord from "@/views/inventoryManagement/stockManagement/Qualified.vue";
+import UnqualifiedRecord from "@/views/inventoryManagement/stockManagement/Unqualified.vue";
- // 瀵煎叆涓や釜鐙珛鐨勫脊妗嗙粍浠�
- import FormDiaProduction from "./components/FormDiaProduction.vue";
- import FormDiaPurchase from "./components/FormDiaPurchase.vue";
-
- const userStore = useUserStore();
- const { proxy } = getCurrentInstance();
- const tableData = ref([]);
- const productData = ref([]);
- const selectedRows = ref([]);
- const userList = ref([]);
- const productList = ref([]);
- const productModelList = ref([]);
- // const customerOption = ref([])
- const tableLoading = ref(false);
- const page = reactive({
- current: 1,
- size: 100,
- });
- const total = ref(0);
- const fileList = ref([]);
- const loading = ref(false);
- // 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁
- const operationType = ref("");
- const activeTab = ref("production");
-
- // 寮规鏄剧ず鐘舵��
- const productionDialogVisible = ref(false);
- const purchaseDialogVisible = ref(false);
-
- const data = reactive({
- searchForm: {
- // supplierName: '',
- productCategory: "",
- customerName: "",
- timeStr: "",
- },
- form: {
- supplierId: null,
- // supplierName: '',
- productId: null,
- productName: "",
- userId: userStore.userId,
- nickName: "",
- productModelId: null,
- model: "",
- unit: "",
- productrecordId: null,
- unitPrice: "", // 娣诲姞鎴愬搧搴撳瓨鐨勫崟浠峰瓧娈�
- taxInclusiveUnitPrice: "",
- taxInclusiveTotalPrice: "",
- taxRate: "",
- taxExclusiveTotalPrice: "",
- inboundTime: "",
- inboundBatch: "",
- stockQuantity: "",
- boundTime: "",
- warnNum: "", // 鏂板鏈�浣庡簱瀛樺瓧娈�
- salesLedgerProductId: null,
- },
- rules: {
- // supplierName: [{ required: true, message: '璇疯緭鍏ヤ緵搴斿晢鍚嶇О', trigger: 'blur' }],
- productCategory: [
- { required: true, message: "璇烽�夋嫨浜у搧澶х被", trigger: "change" },
- ],
- specificationModel: [
- { required: true, message: "璇疯緭鍏ヨ鏍煎瀷鍙�", trigger: "blur" },
- ],
- unit: [{ required: true, message: "璇疯緭鍏ュ崟浣�", trigger: "blur" }],
- stockQuantity: [
- { required: true, message: "璇疯緭鍏ュ嚭搴撴暟閲�", trigger: "blur" },
- ],
- unitPrice: [{ required: true, message: "璇疯緭鍏ュ崟浠�", trigger: "blur" }], // 娣诲姞鎴愬搧搴撳瓨鍗曚环鐨勯獙璇佽鍒�
- taxInclusiveUnitPrice: [
- { required: true, message: "璇疯緭鍏ュ惈绋庡崟浠�", trigger: "blur" },
- ],
- taxInclusiveTotalPrice: [
- { required: true, message: "璇疯緭鍏ュ惈绋庢�讳环", trigger: "blur" },
- ],
- taxRate: [{ required: true, message: "璇疯緭鍏ョ◣鐜�", trigger: "blur" }],
- taxExclusiveTotalPrice: [
- { required: true, message: "璇疯緭鍏ヤ笉鍚◣鎬讳环", trigger: "blur" },
- ],
- boundTime: [
- { required: true, message: "璇烽�夋嫨搴撳瓨鏃堕棿", trigger: "change" },
- ],
- inboundTime: [
- { required: true, message: "璇烽�夋嫨鍏ュ簱鏃堕棿", trigger: "change" },
- ],
- inboundPerson: [
- { required: true, message: "璇烽�夋嫨鍑哄簱浜�", trigger: "change" },
- ],
- warnNum: [{ required: true, message: "璇疯緭鍏ユ渶浣庡簱瀛�", trigger: "blur" }],
- },
- });
- const { searchForm, form, rules } = toRefs(data);
-
- // 鏌ヨ鍒楄〃
- /** 鎼滅储鎸夐挳鎿嶄綔 */
- const handleQuery = () => {
- page.current = 1;
- getList();
- };
- const paginationChange = obj => {
- page.current = obj.page;
- page.size = obj.limit;
- getList();
- };
- const buildQueryParams = () => {
- const params = {
- ...page,
- timeStr: searchForm.value.timeStr,
- };
- params.productCategory = searchForm.value.productCategory;
- if (activeTab.value === "production") {
- params.customerName = searchForm.value.customerName;
- } else {
- // params.supplierName = searchForm.value.supplierName
- }
- return params;
- };
-
- const getList = () => {
- tableLoading.value = true;
- const params = buildQueryParams();
- const apiCall =
- activeTab.value === "production"
- ? getStockManageProduction(params)
- : getStockManagePage(params);
- apiCall
- .then(res => {
- tableLoading.value = false;
- 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;
- // });
-
- total.value = res.data.total;
- // 鏁版嵁鍔犺浇瀹屾垚鍚庢鏌ュ簱瀛�
- // checkStockAndCreatePurchase();
- })
- .catch(() => {
- tableLoading.value = false;
- });
- };
-
- // 鍒囨崲 tab
- const handleTabChange = () => {
- page.current = 1;
- // searchForm.value.supplierName = ''
- searchForm.value.customerName = "";
- searchForm.value.timeStr = "";
- selectedRows.value = [];
- searchForm.value.productCategory = "";
- getList();
- };
-
- // 琛ㄦ牸閫夋嫨鏁版嵁
- const handleSelectionChange = selection => {
- // 杩囨护鎺夊瓙鏁版嵁
- selectedRows.value = selection.filter(item => item.id);
- console.log("selection", selectedRows.value);
- };
- const expandedRowKeys = ref([]);
-
- // 涓昏〃鍚堣鏂规硶
- const summarizeMainTable = param => {
- return proxy.summarizeTable(param, [
- "contractAmount",
- "taxInclusiveTotalPrice",
- "taxExclusiveTotalPrice",
- ]);
- };
-
- // 琛ㄦ牸琛岀被鍚�
- const tableRowClassName = ({ row }) => {
- const stock = Number(row?.inboundNum0 ?? 0);
- const warn = Number(row?.warnNum ?? 0);
- if (!Number.isFinite(stock) || !Number.isFinite(warn)) {
- return "";
- }
- return stock < warn ? "row-low-stock" : "";
- };
-
- // 鎵撳紑寮规
- const openForm = async (type, row) => {
- operationType.value = type;
- form.value = {};
- productData.value = [];
- let userLists = await userListNoPageByTenantId();
- userList.value = userLists.data;
- if (type === "edit") {
- form.value = { ...row };
- productTreeList().then(res => {
- productList.value = res;
- productList.value.forEach(i => {
- if (i.label === row.productCategory) {
- modelList({ id: i.id }).then(res => {
- productModelList.value = res;
- });
- }
- });
- });
- }
- form.value.entryDate = getCurrentDate(); // 璁剧疆榛樿褰曞叆鏃ユ湡涓哄綋鍓嶆棩鏈�
-
- // 鏍规嵁褰撳墠鏍囩椤垫樉绀哄搴旂殑寮规
- if (activeTab.value === "production") {
- productionDialogVisible.value = true;
- } else if (activeTab.value === "purchase") {
- purchaseDialogVisible.value = true;
- }
- };
-
- // 鎻愪氦琛ㄥ崟
- const submitForm = submittedData => {
- console.log("瀛愮粍浠舵彁浜ょ殑鏁版嵁:", submittedData);
-
- // 浣跨敤瀛愮粍浠舵彁浜ょ殑鏁版嵁锛岃�屼笉鏄埗缁勪欢鐨刦orm瀵硅薄
- const submitData = { ...submittedData };
-
- // 鏍规嵁褰撳墠鏍囩椤电Щ闄ゅ搴旂殑鎬讳环瀛楁
- if (activeTab.value === "production") {
- // 鎴愬搧搴撳瓨锛氱Щ闄ゆ�讳环瀛楁
- delete submitData.totalPrice;
- } else if (activeTab.value === "purchase") {
- // 鍘熸枡搴撳瓨锛氱Щ闄ゅ惈绋庢�讳环瀛楁
- delete submitData.taxInclusiveTotalPrice;
- }
-
- // 绉婚櫎鍏朵粬鍙兘鐨勬�讳环瀛楁
- delete submitData.taxExclusiveTotalPrice;
-
- console.log("鎻愪氦缁欏悗绔殑鏁版嵁锛堝凡绉婚櫎鎬讳环瀛楁锛�:", submitData);
-
- // 鏍规嵁褰撳墠鏍囩椤佃皟鐢ㄤ笉鍚岀殑鎻愪氦鎺ュ彛
- let apiCall;
- if (activeTab.value === "production") {
- // 鎴愬搧搴撳瓨浣跨敤 updateManagement 鎺ュ彛
- apiCall = updateManagement(submitData);
- } else {
- // 鍘熸枡搴撳瓨浣跨敤 updateManagementByCustom 鎺ュ彛
- apiCall = updateManagementByCustom(submitData);
- }
-
- apiCall
- .then(res => {
- proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
- closeDia();
- getList();
- // 鎻愪氦鍚庢鏌ュ簱瀛樺苟灏濊瘯鍒涘缓璇疯喘鍗�
- // checkStockAndCreatePurchase();
- })
- .catch(error => {
- console.error("鎻愪氦澶辫触:", error);
- proxy.$modal.msgError("鎻愪氦澶辫触锛岃閲嶈瘯");
- });
- };
- // 妫�鏌ュ簱瀛樺苟鍒涘缓璇疯喘鍗�
- // const checkStockAndCreatePurchase = async () => {
- // const stockList = tableData.value;
- // // handList()
- // for (const item of stockList) {
- // if (item.inboundNum0 < item.warnNum) {
- // try {
- // const stockInData = {
- // id: item.id,
- // quantityStock: item.warnNum + item.totalInboundNum,// 浣跨敤鏂版牸寮忓寲鍑芥暟
- // };
- // loading.value = true
- // await updateStockIn(stockInData)
- // proxy.$modal.msgSuccess(`浜у搧 ${item.productCategory} 淇敼鍏ュ簱鎴愬姛`)
- // loading.value = false
- // } catch (error) {
- // proxy.$modal.msgError(`浜у搧 ${item.productCategory} 鐢熸垚璇疯喘鍗曞け璐ワ紝璇锋墜鍔ㄥ鐞哷);
- //
- // }
- // }
- // }
- // };
- // 鍏抽棴寮规
- const closeDia = () => {
- proxy.resetForm("formRef");
- productionDialogVisible.value = false;
- purchaseDialogVisible.value = false;
- };
-
- // 瀵煎嚭
- const handleOut = () => {
- ElMessageBox.confirm("鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
- confirmButtonText: "纭",
- cancelButtonText: "鍙栨秷",
- type: "warning",
- })
- .then(() => {
- const exportParams = buildQueryParams();
- // 鏍规嵁涓嶅悓鐨� tab 绫诲瀷璋冪敤涓嶅悓鐨勫鍑烘帴鍙�
- let exportUrl = "/stockin/exportCopy";
- if (activeTab.value === "production") {
- exportUrl = "/stockin/exportCopyOne";
- }
- proxy.download(exportUrl, exportParams, "搴撳瓨淇℃伅.xlsx");
- })
- .catch(() => {
- proxy.$modal.msg("宸插彇娑�");
- });
- };
-
- // 鍐荤粨
- const handleFrozen = () => {
- let ids = [];
- if (selectedRows.value.length > 0) {
- ids = selectedRows.value.map(item => item.salesLedgerProductId);
- } 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 handleFrozenFinished = () => {
- let ids = [];
- if (selectedRows.value.length > 0) {
- ids = selectedRows.value.map(item => item.productId);
- } else {
- proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
- return;
- }
- console.log(ids);
- ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚爣璁颁负涓嶅悎鏍间骇鍝佸苟鍐荤粨锛屾槸鍚︾‘璁�?", "璀﹀憡", {
- confirmButtonText: "纭",
- cancelButtonText: "鍙栨秷",
- type: "warning",
- })
- .then(() => {
- frozenFinishedQuality(ids).then(res => {
- proxy.$modal.msgSuccess("鎿嶄綔鎴愬姛");
- getList();
- });
- })
- .catch(() => {
- proxy.$modal.msg("宸插彇娑�");
- });
- };
-
- // 鎴愬搧瑙e喕
- const handleThawFinished = () => {
- let ids = [];
- if (selectedRows.value.length > 0) {
- ids = selectedRows.value.map(item => item.productId);
- } else {
- proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
- return;
- }
- console.log(ids);
- ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚В鍐伙紝鏄惁纭?", "鎻愮ず", {
- confirmButtonText: "纭",
- cancelButtonText: "鍙栨秷",
- type: "success",
- })
- .then(() => {
- thawFinishedQuality(ids).then(res => {
- proxy.$modal.msgSuccess("鎿嶄綔鎴愬姛");
- getList();
- });
- })
- .catch(() => {
- proxy.$modal.msg("宸插彇娑�");
- });
- };
- // 鍒犻櫎
- const handleDelete = () => {
- 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(() => {
- delStockManage({ ids: ids }).then(res => {
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
- getList();
- });
- })
- .catch(() => {
- proxy.$modal.msg("宸插彇娑�");
- });
- };
- // 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲涓� YYYY-MM-DD
- function getCurrentDate() {
- const today = new Date();
- const year = today.getFullYear();
- const month = String(today.getMonth() + 1).padStart(2, "0"); // 鏈堜唤浠�0寮�濮�
- const day = String(today.getDate()).padStart(2, "0");
- return `${year}-${month}-${day}`;
+const activeTab = ref('qualified')
+const tabs = ref([
+ {
+ label: '鍚堟牸搴撳瓨',
+ name: 'qualified'
+ },
+ {
+ label: '涓嶅悎鏍煎簱瀛�',
+ name: 'unqualified'
}
- onMounted(() => {
- getList();
- // checkStockAndCreatePurchase();
- // 姣忓皬鏃舵鏌ヤ竴娆″簱瀛�
- // const intervalId = setInterval(checkStockAndCreatePurchase, 60 * 60 * 1000);
+])
- // onUnmounted(() => {
- // // 缁勪欢鍗歌浇鏃舵竻闄ゅ畾鏃跺櫒
- // clearInterval(intervalId);
- // });
- });
+const handleTabChange = (tabName) => {
+ activeTab.value = tabName;
+}
</script>
-
-<style scoped lang="scss">
- :deep(.row-low-stock td) {
- background-color: #fde2e2;
- color: #c45656;
- }
-
- :deep(.row-low-stock:hover > td) {
- background-color: #fcd4d4;
- }
-</style>
\ No newline at end of file
diff --git a/src/views/inventoryManagement/stockReport/index.vue b/src/views/inventoryManagement/stockReport/index.vue
index 354c775..a0a1f67 100644
--- a/src/views/inventoryManagement/stockReport/index.vue
+++ b/src/views/inventoryManagement/stockReport/index.vue
@@ -12,7 +12,6 @@
>
<el-option label="鏃ユ姤" value="daily" />
<el-option label="鏈堟姤" value="monthly" />
- <el-option label="浣滀笟鎶ヨ〃" value="work" />
<el-option label="杩涘嚭瀛樻姤琛�" value="inout" />
</el-select>
@@ -54,93 +53,93 @@
</el-button>
<el-button @click="handleReset">閲嶇疆</el-button>
</div>
-
+
<div class="search_right">
- <el-button type="success" @click="handleExport" icon="Download">
- 瀵煎嚭鎶ヨ〃
- </el-button>
+<!-- <el-button type="success" @click="handleExport" icon="Download">-->
+<!-- 瀵煎嚭鎶ヨ〃-->
+<!-- </el-button>-->
</div>
</div>
- <!-- 缁熻鍗$墖 -->
- <div class="stats_cards" v-if="reportData.summary">
- <el-row :gutter="20">
- <el-col :span="6">
- <el-card class="stats_card">
- <div class="stats_content">
- <div class="stats_icon in">
- <el-icon><TrendCharts /></el-icon>
- </div>
- <div class="stats_info">
- <div class="stats_value">{{ reportData.summary.totalIn || 0 }}</div>
- <div class="stats_label">鎬诲叆搴撻噺</div>
- </div>
- </div>
- </el-card>
- </el-col>
- <el-col :span="6">
- <el-card class="stats_card">
- <div class="stats_content">
- <div class="stats_icon out">
- <el-icon><TrendCharts /></el-icon>
- </div>
- <div class="stats_info">
- <div class="stats_value">{{ reportData.summary.totalOut || 0 }}</div>
- <div class="stats_label">鎬诲嚭搴撻噺</div>
- </div>
- </div>
- </el-card>
- </el-col>
- <el-col :span="6">
- <el-card class="stats_card">
- <div class="stats_content">
- <div class="stats_icon stock">
- <el-icon><Box /></el-icon>
- </div>
- <div class="stats_info">
- <div class="stats_value">{{ reportData.summary.currentStock || 0 }}</div>
- <div class="stats_label">褰撳墠搴撳瓨</div>
- </div>
- </div>
- </el-card>
- </el-col>
- <el-col :span="6">
- <el-card class="stats_card">
- <div class="stats_content">
- <div class="stats_icon turnover">
- <el-icon><Refresh /></el-icon>
- </div>
- <div class="stats_info">
- <div class="stats_value">{{ reportData.summary.turnoverRate || 0 }}%</div>
- <div class="stats_label">鍛ㄨ浆鐜�</div>
- </div>
- </div>
- </el-card>
- </el-col>
- </el-row>
- </div>
+<!-- <!– 缁熻鍗$墖 –>-->
+<!-- <div class="stats_cards" v-if="reportData.summary">-->
+<!-- <el-row :gutter="20">-->
+<!-- <el-col :span="6">-->
+<!-- <el-card class="stats_card">-->
+<!-- <div class="stats_content">-->
+<!-- <div class="stats_icon in">-->
+<!-- <el-icon><TrendCharts /></el-icon>-->
+<!-- </div>-->
+<!-- <div class="stats_info">-->
+<!-- <div class="stats_value">{{ reportData.summary.totalIn || 0 }}</div>-->
+<!-- <div class="stats_label">鎬诲叆搴撻噺</div>-->
+<!-- </div>-->
+<!-- </div>-->
+<!-- </el-card>-->
+<!-- </el-col>-->
+<!-- <el-col :span="6">-->
+<!-- <el-card class="stats_card">-->
+<!-- <div class="stats_content">-->
+<!-- <div class="stats_icon out">-->
+<!-- <el-icon><TrendCharts /></el-icon>-->
+<!-- </div>-->
+<!-- <div class="stats_info">-->
+<!-- <div class="stats_value">{{ reportData.summary.totalOut || 0 }}</div>-->
+<!-- <div class="stats_label">鎬诲嚭搴撻噺</div>-->
+<!-- </div>-->
+<!-- </div>-->
+<!-- </el-card>-->
+<!-- </el-col>-->
+<!-- <el-col :span="6">-->
+<!-- <el-card class="stats_card">-->
+<!-- <div class="stats_content">-->
+<!-- <div class="stats_icon stock">-->
+<!-- <el-icon><Box /></el-icon>-->
+<!-- </div>-->
+<!-- <div class="stats_info">-->
+<!-- <div class="stats_value">{{ reportData.summary.currentStock || 0 }}</div>-->
+<!-- <div class="stats_label">褰撳墠搴撳瓨</div>-->
+<!-- </div>-->
+<!-- </div>-->
+<!-- </el-card>-->
+<!-- </el-col>-->
+<!-- <el-col :span="6">-->
+<!-- <el-card class="stats_card">-->
+<!-- <div class="stats_content">-->
+<!-- <div class="stats_icon turnover">-->
+<!-- <el-icon><Refresh /></el-icon>-->
+<!-- </div>-->
+<!-- <div class="stats_info">-->
+<!-- <div class="stats_value">{{ reportData.summary.turnoverRate || 0 }}%</div>-->
+<!-- <div class="stats_label">鍛ㄨ浆鐜�</div>-->
+<!-- </div>-->
+<!-- </div>-->
+<!-- </el-card>-->
+<!-- </el-col>-->
+<!-- </el-row>-->
+<!-- </div>-->
- <!-- 鍥捐〃鍖哄煙 -->
- <div class="chart_section" v-if="reportData.chartData">
- <el-row :gutter="20">
- <el-col :span="12">
- <el-card>
- <template #header>
- <span>搴撳瓨瓒嬪娍鍥�</span>
- </template>
- <div ref="trendChart" style="height: 300px;"></div>
- </el-card>
- </el-col>
- <el-col :span="12">
- <el-card>
- <template #header>
- <span>杩涘嚭搴撳姣�</span>
- </template>
- <div ref="comparisonChart" style="height: 300px;"></div>
- </el-card>
- </el-col>
- </el-row>
- </div>
+<!-- <!– 鍥捐〃鍖哄煙 –>-->
+<!-- <div class="chart_section" v-if="reportData.chartData">-->
+<!-- <el-row :gutter="20">-->
+<!-- <el-col :span="12">-->
+<!-- <el-card>-->
+<!-- <template #header>-->
+<!-- <span>搴撳瓨瓒嬪娍鍥�</span>-->
+<!-- </template>-->
+<!-- <div ref="trendChart" style="height: 300px;"></div>-->
+<!-- </el-card>-->
+<!-- </el-col>-->
+<!-- <el-col :span="12">-->
+<!-- <el-card>-->
+<!-- <template #header>-->
+<!-- <span>杩涘嚭搴撳姣�</span>-->
+<!-- </template>-->
+<!-- <div ref="comparisonChart" style="height: 300px;"></div>-->
+<!-- </el-card>-->
+<!-- </el-col>-->
+<!-- </el-row>-->
+<!-- </div>-->
<!-- 璇︾粏鏁版嵁琛ㄦ牸 -->
<div class="table_section">
@@ -163,122 +162,72 @@
width="60"
/>
<el-table-column
- v-if="searchForm.reportType === 'daily'"
- label="鏃ユ湡"
- prop="createTime"
- width="100"
- align="center"
- />
- <el-table-column
- v-if="searchForm.reportType === 'monthly'"
- label="鏈堜唤"
- prop="createTime"
- width="100"
- align="center"
- />
- <el-table-column
label="鍏ュ簱鏃堕棿"
prop="createTime"
- width="100"
+ width="200"
show-overflow-tooltip
+ v-if="searchForm.reportType !== 'inout'"
/>
<el-table-column
label="鍏ュ簱鎵规"
prop="inboundBatches"
- width="160"
+ width="240"
show-overflow-tooltip
- />
- <el-table-column
- label="渚涘簲鍟嗗悕绉�"
- prop="supplierName"
- min-width="240"
- show-overflow-tooltip
+ v-if="searchForm.reportType !== 'inout'"
/>
<el-table-column
label="浜у搧澶х被"
- prop="productCategory"
- width="100"
+ prop="productName"
show-overflow-tooltip
/>
<el-table-column
label="瑙勬牸鍨嬪彿"
- prop="specificationModel"
- min-width="200"
+ prop="model"
show-overflow-tooltip
/>
<el-table-column
label="鍗曚綅"
prop="unit"
- width="70"
show-overflow-tooltip
/>
- <!-- <el-table-column
- label="鏈熷垵搴撳瓨"
- prop="beginStock"
- width="100"
- align="center"
- /> -->
<el-table-column
label="鍏ュ簱鏁伴噺"
- prop="inboundNum"
- width="100"
+ prop="totalStockIn"
align="center"
+ v-if="searchForm.reportType === 'inout'"
/>
- <!-- <el-table-column
+ <el-table-column
+ label="鍏ュ簱鏁伴噺"
+ prop="stockInNum"
+ align="center"
+ v-else
+ />
+ <el-table-column
label="鍑哄簱鏁伴噺"
- prop=""
+ prop="totalStockOut"
width="100"
align="center"
- /> -->
+ v-if="searchForm.reportType === 'inout'"
+ />
<el-table-column
label="鐜板湪搴撳瓨"
- prop="inboundNum0"
- width="100"
+ prop="currentStock"
align="center"
/>
- <el-table-column
- label="鍚◣鍗曚环"
- prop="taxInclusiveUnitPrice"
- width="100"
- show-overflow-tooltip
- />
- <el-table-column
- label="鍚◣鎬讳环"
- prop="taxInclusiveTotalPrice"
- width="100"
- show-overflow-tooltip
- />
- <el-table-column
- label="绋庣巼(%)"
- prop="taxRate"
- width="80"
- show-overflow-tooltip
- />
- <el-table-column
- label="涓嶅惈绋庢�讳环"
- prop="taxExclusiveTotalPrice"
- width="100"
- show-overflow-tooltip
- />
+ <el-table-column label="鏉ユ簮"
+ prop="recordType"
+ v-if="searchForm.reportType !== 'inout'"
+ show-overflow-tooltip>
+ <template #default="scope">
+ {{ getRecordType(scope.row.recordType) }}
+ </template>
+ </el-table-column>
<el-table-column
label="鍏ュ簱浜�"
prop="createBy"
width="80"
+ v-if="searchForm.reportType !== 'inout'"
show-overflow-tooltip
- />
- <el-table-column
- v-if="searchForm.reportType === 'work'"
- label="鎿嶄綔浜哄憳"
- prop="operator"
- width="80"
- align="center"
- />
- <el-table-column
- v-if="searchForm.reportType === 'work'"
- label="鎿嶄綔鏃堕棿"
- prop="operateTime"
- width="150"
- align="center"
/>
</el-table>
</el-card>
@@ -291,12 +240,14 @@
import { ElMessage } from 'element-plus'
import * as echarts from 'echarts'
import {
- getStockDailyReport,
getStockMonthlyReport,
- getWorkReport,
getStockInOutReport,
- exportStockReport
} from '@/api/inventoryManagement/stockReport'
+import {
+ getStockInventoryInAndOutReportList,
+ getStockInventoryReportList
+} from "@/api/inventoryManagement/stockInventory.js";
+import {findAllQualifiedStockRecordTypeOptions} from "@/api/basicData/enum.js";
const { proxy } = getCurrentInstance()
@@ -318,12 +269,25 @@
tableData: []
})
+const stockRecordTypeOptions = ref([])
+
+const getRecordType = (recordType) => {
+ return stockRecordTypeOptions.value.find(item => item.value === recordType)?.label || ''
+}
+
+// 鑾峰彇鏉ユ簮绫诲瀷閫夐」
+const fetchStockRecordTypeOptions = () => {
+ findAllQualifiedStockRecordTypeOptions()
+ .then(res => {
+ stockRecordTypeOptions.value = res.data;
+ })
+}
+
// 鑾峰彇琛ㄦ牸鏍囬
const getTableTitle = () => {
const typeMap = {
daily: '鏃ユ姤璇︾粏鏁版嵁',
monthly: '鏈堟姤璇︾粏鏁版嵁',
- work: '浣滀笟鎶ヨ〃璇︾粏鏁版嵁',
inout: '杩涘嚭瀛樻姤琛ㄨ缁嗘暟鎹�'
}
return typeMap[searchForm.reportType] || '鎶ヨ〃璇︾粏鏁版嵁'
@@ -348,32 +312,19 @@
try {
const params = getQueryParams()
let response
-
- switch (searchForm.reportType) {
- case 'daily':
- response = await getStockDailyReport(params)
- break
- case 'monthly':
- response = await getStockMonthlyReport(params)
- break
- case 'work':
- response = await getWorkReport(params)
- break
- case 'inout':
- response = await getStockInOutReport(params)
- break
- default:
- throw new Error('鏈煡鐨勬姤琛ㄧ被鍨�')
+
+ if (searchForm.reportType === 'inout') {
+ response = await getStockInventoryInAndOutReportList(params)
+ } else {
+ response = await getStockInventoryReportList(params)
}
-
if (response.code === 200) {
- // generateMockData()
- reportData.value.tableData = response.data.tableData
- reportData.value.summary = response.data.summary
- reportData.value.chartData = response.data.chartData
- nextTick(() => {
- initCharts()
- })
+ reportData.value.tableData = response.data.records
+ // reportData.value.summary = response.data.summary
+ // reportData.value.chartData = response.data.chartData
+ // nextTick(() => {
+ // initCharts()
+ // })
}
} catch (error) {
@@ -420,7 +371,7 @@
ElMessage.warning('璇烽�夋嫨鏃ユ湡')
return false
}
- } else if (searchForm.reportType === 'work' || searchForm.reportType === 'inout') {
+ } else if (searchForm.reportType === 'inout') {
if (!searchForm.dateRange || searchForm.dateRange.length !== 2) {
ElMessage.warning('璇烽�夋嫨鏃ユ湡鑼冨洿')
return false
@@ -599,6 +550,8 @@
yesterday.toISOString().split('T')[0],
today.toISOString().split('T')[0]
]
+
+ fetchStockRecordTypeOptions()
})
</script>
diff --git a/src/views/inventoryManagement/stockWarning/index.vue b/src/views/inventoryManagement/stockWarning/index.vue
index 8d3df17..d0d5834 100644
--- a/src/views/inventoryManagement/stockWarning/index.vue
+++ b/src/views/inventoryManagement/stockWarning/index.vue
@@ -306,9 +306,8 @@
<template #footer>
<div class="dialog-footer">
- <el-button type="primary" @click="submitForm">纭</el-button>
<el-button @click="closeDialog">鍙栨秷</el-button>
-
+ <el-button type="primary" @click="submitForm">纭</el-button>
</div>
</template>
</el-dialog>
diff --git a/vite.config.js b/vite.config.js
index 13e1ee1..bfc6128 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -6,7 +6,7 @@
export default defineConfig(({ mode, command }) => {
const env = loadEnv(mode, process.cwd());
const { VITE_APP_ENV } = env;
- const baseUrl = env.VITE_APP_ENV === "development" ? "http://1.15.17.182:9001" : env.VITE_BASE_API;
+ const baseUrl = env.VITE_APP_ENV === "development" ? "http://192.168.0.244:7005" : env.VITE_BASE_API;
const javaUrl = env.VITE_APP_ENV === "development" ? "http://1.15.17.182:9000" : env.VITE_JAVA_API;
return {
define: {
--
Gitblit v1.9.3