From 9c7465c9e2cb36b9de943cfb6065b80d214ab023 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期四, 21 五月 2026 09:39:18 +0800
Subject: [PATCH] Merge branch 'dev_NEW_pro' of http://114.132.189.42:9002/r/product-inventory-management into dev_NEW_pro
---
src/views/inventoryManagement/receiptManagement/Record.vue | 263 ++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 203 insertions(+), 60 deletions(-)
diff --git a/src/views/inventoryManagement/receiptManagement/Record.vue b/src/views/inventoryManagement/receiptManagement/Record.vue
index cd103ea..56e6f74 100644
--- a/src/views/inventoryManagement/receiptManagement/Record.vue
+++ b/src/views/inventoryManagement/receiptManagement/Record.vue
@@ -1,42 +1,82 @@
<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="search_form" style="margin-bottom: 10px;">
+ <el-form
+ ref="searchFormRef"
+ :model="searchForm"
+ class="demo-form-inline"
+ >
+ <el-row :gutter="20">
+ <el-col :span="4">
+ <el-form-item label="鍏ュ簱鏃ユ湡" prop="timeStr">
+ <el-date-picker v-model="searchForm.timeStr"
+ type="date"
+ placeholder="璇烽�夋嫨鏃ユ湡"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ clearable/>
+ </el-form-item>
+ </el-col>
+ <el-col :span="4">
+ <el-form-item label="浜у搧澶х被" prop="productName">
+ <el-input v-model="searchForm.productName"
+ style="width: 240px"
+ placeholder="璇疯緭鍏�"
+ clearable/>
+ </el-form-item>
+ </el-col>
+
+ <el-col :span="4">
+ <el-form-item label="浜у搧瑙勬牸" prop="model">
+ <el-input v-model="searchForm.model"
+ style="width: 240px"
+ placeholder="璇疯緭鍏�"
+ clearable/>
+ </el-form-item>
+ </el-col>
+ <el-col :span="4">
+ <el-form-item label="鎵瑰彿" prop="batchNo">
+ <el-input v-model="searchForm.batchNo"
+ style="width: 240px"
+ placeholder="璇疯緭鍏�"
+ clearable/>
+ </el-form-item>
+ </el-col>
+ <el-col :span="4">
+ <el-form-item label="鏉ユ簮" prop="recordType">
+ <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-form-item>
+ </el-col>
+ <!-- 鎸夐挳 -->
+ <el-col :span="4">
+ <el-form-item>
+ <el-button type="primary" @click="getList">
+ 鎼滅储
+ </el-button>
+
+ <el-button @click="resetSearch">
+ 閲嶇疆
+ </el-button>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </el-form>
+ </div>
+ <div class="actions">
+ <el-button type="primary" @click="handleBatchApprove">瀹℃壒</el-button>
+ <el-button @click="handleOut">瀵煎嚭</el-button>
+ <el-button type="danger"
+ plain
+ @click="handleDelete">鍒犻櫎
+ </el-button>
</div>
<div class="table_list">
<el-table :data="tableData"
@@ -49,6 +89,7 @@
height="calc(100vh - 18.5em)">
<el-table-column align="center"
type="selection"
+ :selectable="isRowSelectableForApprove"
width="55"/>
<el-table-column align="center"
label="搴忓彿"
@@ -67,6 +108,9 @@
<el-table-column label="瑙勬牸鍨嬪彿"
prop="model"
show-overflow-tooltip/>
+ <el-table-column label="鎵瑰彿"
+ prop="batchNo"
+ show-overflow-tooltip/>
<el-table-column label="鍗曚綅"
prop="unit"
show-overflow-tooltip/>
@@ -81,6 +125,15 @@
show-overflow-tooltip>
<template #default="scope">
{{ getRecordType(scope.row.recordType) }}
+ </template>
+ </el-table-column>
+ <el-table-column label="瀹℃壒鐘舵��"
+ prop="approvalStatus"
+ show-overflow-tooltip>
+ <template #default="scope">
+ <el-tag :type="getApprovalStatusTagType(scope.row.approvalStatus)" size="small">
+ {{ getApprovalStatusLabel(scope.row.approvalStatus) }}
+ </el-tag>
</template>
</el-table-column>
</el-table>
@@ -106,10 +159,12 @@
import {ElMessageBox} from "element-plus";
import {
getStockInRecordListPage,
- batchDeleteStockInRecords,
+ batchDeletePendingStockInRecords,
+ batchApproveStockInRecords,
} from "@/api/inventoryManagement/stockInRecord.js";
import {
- findAllQualifiedStockInRecordTypeOptions, findAllUnQualifiedStockInRecordTypeOptions,
+ findAllQualifiedStockInRecordTypeOptions,
+ // findAllUnQualifiedStockInRecordTypeOptions,
} from "@/api/basicData/enum.js";
const {proxy} = getCurrentInstance();
@@ -119,6 +174,10 @@
type: String,
required: true,
default: '0'
+ },
+ topParentProductId: {
+ type: [String, Number],
+ default: undefined
}
})
@@ -129,28 +188,66 @@
const stockRecordTypeOptions = ref([]);
const page = reactive({
current: 1,
- size: 100,
+ size: 10,
});
const total = ref(0);
const data = reactive({
searchForm: {
productName: "",
+ batchNo: "",
+ model: "",
timeStr: "",
recordType: "",
},
});
const {searchForm} = toRefs(data);
-// 鏌ヨ鍒楄〃
-/** 鎼滅储鎸夐挳鎿嶄綔 */
-const handleQuery = () => {
+const searchFormRef = ref(null);
+
+const resetSearch = () => {
+ searchFormRef.value?.resetFields();
page.current = 1;
getList();
-};
+}
const getRecordType = (recordType) => {
return stockRecordTypeOptions.value.find(item => item.value === recordType)?.label || ''
}
+
+const approvalStatusLabelMap = {
+ 0: "寰呭鎵�",
+ 1: "閫氳繃",
+ 2: "椹冲洖",
+ pending: "寰呭鎵�",
+ approved: "閫氳繃",
+ rejected: "椹冲洖",
+ PENDING: "寰呭鎵�",
+ APPROVED: "閫氳繃",
+ REJECTED: "椹冲洖",
+};
+approvalStatusLabelMap[3] = "寰呯‘璁�";
+
+const getApprovalStatusLabel = (status) => {
+ if (status === null || status === undefined || status === "") {
+ return "寰呭鎵�";
+ }
+ return approvalStatusLabelMap[status] || "寰呭鎵�";
+};
+
+// 閫氳繃/椹冲洖鍥哄畾鑹诧紱鍏朵綑锛堝惈寰呭鎵广�佺┖鍊笺�佹湭鏄犲皠浣嗘枃妗堜负寰呭鎵癸級缁熶竴鐢� warning 棰勮鑹�
+const getApprovalStatusTagType = (status) => {
+ if (status === 1 || status === "1" || status === "approved" || status === "APPROVED") return "success";
+ if (status === 2 || status === "2" || status === "rejected" || status === "REJECTED") return "danger";
+ return "warning";
+};
+
+const isPendingApproval = status => {
+ return status === 0 || status === "0" || status === "pending" || status === "PENDING" || status === null || status === undefined || status === "";
+};
+
+const isRowSelectableForApprove = row => {
+ return isPendingApproval(row?.approvalStatus);
+};
const pageProductChange = obj => {
page.current = obj.page;
@@ -160,13 +257,10 @@
const getList = () => {
tableLoading.value = true;
- const params = {...page, type: props.type};
- params.timeStr = searchForm.value.timeStr;
- params.productName = searchForm.value.productName;
- params.recordType = searchForm.value.recordType;
- getStockInRecordListPage(params)
+ getStockInRecordListPage(Object.assign({}, {...searchForm.value, ...page, topParentProductId: props.topParentProductId}))
.then(res => {
tableData.value = res.data.records;
+ total.value = res.data.total || 0;
}).finally(() => {
tableLoading.value = false;
})
@@ -181,18 +275,56 @@
})
return
}
- findAllUnQualifiedStockInRecordTypeOptions()
- .then(res => {
- stockRecordTypeOptions.value = res.data;
- })
+ // findAllUnQualifiedStockInRecordTypeOptions()
+ // .then(res => {
+ // stockRecordTypeOptions.value = res.data;
+ // })
}
// 琛ㄦ牸閫夋嫨鏁版嵁
const handleSelectionChange = selection => {
- selectedRows.value = selection.filter(item => item.id);
+ selectedRows.value = selection.filter(item => item.id && isPendingApproval(item.approvalStatus));
};
const expandedRowKeys = ref([]);
+
+const handleBatchApprove = () => {
+ if (selectedRows.value.length === 0) {
+ proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
+ return;
+ }
+ const ids = selectedRows.value.map(item => item.id);
+ ElMessageBox.confirm("璇烽�夋嫨瀹℃壒缁撴灉", "瀹℃壒", {
+ confirmButtonText: "閫氳繃",
+ cancelButtonText: "椹冲洖",
+ type: "warning",
+ distinguishCancelAndClose: true,
+ })
+ .then(() => {
+ batchApproveStockInRecords({ids, approvalStatus: 1})
+ .then(() => {
+ proxy.$modal.msgSuccess("瀹℃壒閫氳繃鎴愬姛");
+ getList();
+ })
+ .catch(() => {
+ proxy.$modal.msgError("瀹℃壒閫氳繃澶辫触");
+ });
+ })
+ .catch((action) => {
+ if (action === "cancel") {
+ batchApproveStockInRecords({ids, approvalStatus: 2})
+ .then(() => {
+ proxy.$modal.msgSuccess("瀹℃壒椹冲洖鎴愬姛");
+ getList();
+ })
+ .catch(() => {
+ proxy.$modal.msgError("瀹℃壒椹冲洖澶辫触");
+ });
+ return;
+ }
+ proxy.$modal.msg("宸插彇娑�");
+ });
+};
// 瀵煎嚭
const handleOut = () => {
@@ -224,7 +356,7 @@
type: "warning",
})
.then(() => {
- batchDeleteStockInRecords(ids)
+ batchDeletePendingStockInRecords(ids)
.then(() => {
proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
getList();
@@ -242,9 +374,20 @@
getList();
fetchStockRecordTypeOptions();
});
+
+watch(
+ () => props.topParentProductId,
+ () => {
+ page.current = 1;
+ getList();
+ }
+);
</script>
-<style scoped lang="scss"></style>
-
-
-
+<style scoped lang="scss">
+.actions {
+ display: flex;
+ justify-content: flex-end;
+ margin-bottom: 10px;
+}
+</style>
\ No newline at end of file
--
Gitblit v1.9.3