From 4d97a259f3069f9b18d87ac3fab710618f2c6087 Mon Sep 17 00:00:00 2001
From: lishenao <3065849776@qq.com>
Date: 星期四, 03 七月 2025 15:19:31 +0800
Subject: [PATCH] 库存管理数据修改
---
src/views/inventoryManagement/receiptManagement/index.vue | 401 +++++++++++++++++++++++++------------------------
src/views/inventoryManagement/dispatchLog/index.vue | 39 ----
2 files changed, 206 insertions(+), 234 deletions(-)
diff --git a/src/views/inventoryManagement/dispatchLog/index.vue b/src/views/inventoryManagement/dispatchLog/index.vue
index 1e56a3d..c83b0b0 100644
--- a/src/views/inventoryManagement/dispatchLog/index.vue
+++ b/src/views/inventoryManagement/dispatchLog/index.vue
@@ -73,33 +73,24 @@
show-overflow-tooltip
/>
<el-table-column
- label="鍚◣鍗曚环"
- prop="taxInclusiveUnitPrice"
label="鍚◣鍗曚环(鍏�)"
prop="entryDate"
width="100"
show-overflow-tooltip
/>
<el-table-column
- label="鍚◣鎬讳环"
- prop="taxInclusiveTotalPrice"
label="鍚◣鎬讳环(鍏�)"
prop="executionDate"
width="100"
show-overflow-tooltip
/>
<el-table-column
- label="绋庣巼"
- prop="taxRate"
label="绋庣巼(%)"
prop="executionDate"
width="100"
show-overflow-tooltip
/>
<el-table-column
- label="涓嶅惈绋庢�讳环"
- prop="taxExclusiveTotalPrice"
- width="100"
label="涓嶅惈绋庢�讳环(鍏�)"
prop="executionDate"
width="180"
@@ -148,24 +139,16 @@
import { userListNoPage } from "@/api/system/user.js";
import {
getStockOutPage,
- addStockOut,
- updateStockOut,
delStockOut,
- exportStockOut,
- getStockManageById
} from "@/api/inventoryManagement/stockOut.js";
const userStore = useUserStore();
const { proxy } = getCurrentInstance();
const tableData = ref([]);
-// const productData = ref([]);
const selectedRows = ref([]);
const userList = ref([]);
-// const customerOption = ref([]);
const tableLoading = ref(false);
-const supplierList = ref([])
const productList = ref([])
-const productModelList = ref([])
const page = reactive({
current: 1,
size: 100,
@@ -199,12 +182,6 @@
inboundBatch: '',
inboundQuantity: ''
},
- rules: {
- supplierId: [{ required: true, message: '璇烽�夋嫨渚涘簲鍟�', trigger: 'change' }],
- productRecordid: [{ required: true, message: '璇烽�夋嫨浜у搧', trigger: 'change' }],
- inboundTime: [{ required: true, message: '璇烽�夋嫨鍏ュ簱鏃堕棿', trigger: 'change' }],
- inboundQuantity: [{ required: true, message: '璇疯緭鍏ュ叆搴撴暟閲�', trigger: 'blur' }]
- },
});
const { searchForm } = toRefs(data);
@@ -234,20 +211,7 @@
tableLoading.value = false;
});
};
-// 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) => {
// 杩囨护鎺夊瓙鏁版嵁
@@ -279,6 +243,7 @@
proxy.$modal.msg("宸插彇娑�");
});
};
+
// 鍒犻櫎
const handleDelete = () => {
let ids = [];
diff --git a/src/views/inventoryManagement/receiptManagement/index.vue b/src/views/inventoryManagement/receiptManagement/index.vue
index 7f877fa..ad9a9d8 100644
--- a/src/views/inventoryManagement/receiptManagement/index.vue
+++ b/src/views/inventoryManagement/receiptManagement/index.vue
@@ -190,17 +190,20 @@
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
- ttotal.value = res.data.total
+ total.value = res.data.total
+ console.log('tableData:', tableData.value)
}).catch(() => {
tableLoading.value = false
})
@@ -242,247 +245,251 @@
}
return null; // 娌℃湁鎵惧埌鑺傜偣锛岃繑鍥瀗ull
};
+
// 琛ㄦ牸閫夋嫨鏁版嵁
-const handleSelectionChange = (selection) => {
+// const handleSelectionChange = (selection) => {
// 鍔犺浇瑙勬牸鍨嬪彿鍒楄〃
-const loadProductModels = async (productId) => {
- if (!productId) {
- productModelList.value = [];
- return;
- }
+ const loadProductModels = async (productId) => {
+ if (!productId) {
+ productModelList.value = [];
+ return;
+ }
- try {
- const res = await modelListPage({
- id: productId,
- current: 1,
- size: 100
- });
+ try {
+ const res = await modelListPage({
+ id: productId,
+ current: 1,
+ size: 100
+ });
- productModelList.value = res.data.records.map(item => ({
- id: item.id,
- model: item.model,
- unit: item.unit
- }));
+ productModelList.value = res.data.records.map(item => ({
+ id: item.id,
+ model: item.model,
+ unit: item.unit
+ }));
- } catch (error) {
- console.error('鍔犺浇瑙勬牸鍨嬪彿澶辫触:', error);
- proxy.$modal.msgError('鍔犺浇瑙勬牸鍨嬪彿澶辫触');
- }
-};
+ } catch (error) {
+ console.error('鍔犺浇瑙勬牸鍨嬪彿澶辫触:', error);
+ proxy.$modal.msgError('鍔犺浇瑙勬牸鍨嬪彿澶辫触');
+ }
+ };
// 浜у搧閫夋嫨鍙樺寲
-const handleProductChange = (productId) => {
- form.value.productModelId = null
- form.value.productrecordId = null
- resetPurchaseFields()
- if (productId) {
- loadProductModels(productId)
- } else {
- productModelList.value = []
+ const handleProductChange = (productId) => {
+ form.value.productModelId = null
+ form.value.productrecordId = null
+ resetPurchaseFields()
+ if (productId) {
+ loadProductModels(productId)
+ } else {
+ productModelList.value = []
+ }
}
-}
// 瑙勬牸鍨嬪彿閫夋嫨鍙樺寲
-const handleModelChange = async (modelId) => {
- if (!form.value.productId || !modelId) return
+ const handleModelChange = async (modelId) => {
+ if (!form.value.productId || !modelId) return
- try {
- // 鏍规嵁浜у搧ID鍜屽瀷鍙稩D鏌ヨ閲囪喘璁板綍
- const res = await getPurchaseRecords({
- productId: form.value.productId,
- productModelId: form.value.productModelId,
- type: 2 // 鍋囪2琛ㄧず宸叉壒鍑嗙殑閲囪喘璁板綍
- })
+ try {
+ // 鏍规嵁浜у搧ID鍜屽瀷鍙稩D鏌ヨ閲囪喘璁板綍
+ const res = await getPurchaseRecords({
+ productId: form.value.productId,
+ productModelId: form.value.productModelId,
+ type: 2 // 鍋囪2琛ㄧず宸叉壒鍑嗙殑閲囪喘璁板綍
+ })
- purchaseRecords.value = res.data.records
+ purchaseRecords.value = res.data.records
- if (purchaseRecords.value.length > 0) {
- // 榛樿鍙栫涓�鏉¢噰璐褰�
- const record = purchaseRecords.value[0]
- fillFormFromPurchaseRecord(record)
+ if (purchaseRecords.value.length > 0) {
+ // 榛樿鍙栫涓�鏉¢噰璐褰�
+ const record = purchaseRecords.value[0]
+ fillFormFromPurchaseRecord(record)
+ }
+ } catch (error) {
+ console.error('鏌ヨ閲囪喘璁板綍澶辫触:', error)
+ proxy.$modal.msgError('鏌ヨ閲囪喘璁板綍澶辫触')
}
- } catch (error) {
- console.error('鏌ヨ閲囪喘璁板綍澶辫触:', error)
- proxy.$modal.msgError('鏌ヨ閲囪喘璁板綍澶辫触')
}
-}
// 浠庨噰璐褰曞~鍏呰〃鍗�
-const fillFormFromPurchaseRecord = (record) => {
- form.value.productrecordId = record.id
- form.value.taxInclusiveUnitPrice = record.taxInclusiveUnitPrice
- form.value.taxRate = record.taxRate
- form.value.taxInclusiveTotalPrice = record.taxInclusiveTotalPrice
- form.value.taxExclusiveTotalPrice = record.taxExclusiveTotalPrice
-}
+ const fillFormFromPurchaseRecord = (record) => {
+ form.value.productrecordId = record.id
+ form.value.taxInclusiveUnitPrice = record.taxInclusiveUnitPrice
+ form.value.taxRate = record.taxRate
+ form.value.taxInclusiveTotalPrice = record.taxInclusiveTotalPrice
+ form.value.taxExclusiveTotalPrice = record.taxExclusiveTotalPrice
+ }
// 閲嶇疆閲囪喘鐩稿叧瀛楁
-const resetPurchaseFields = () => {
- form.value.productrecordId = null
- form.value.unit = ''
- form.value.taxInclusiveUnitPrice = null
- form.value.taxRate = null
- form.value.taxInclusiveTotalPrice = null
- form.value.taxExclusiveTotalPrice = null
-}
-
-const loadUserList = async () => {
- try {
- const res = await userListNoPage()
- userList.value = res.data
- } catch (error) {
- console.error('鍔犺浇鐢ㄦ埛鍒楄〃澶辫触:', error)
+ const resetPurchaseFields = () => {
+ form.value.productrecordId = null
+ form.value.unit = ''
+ form.value.taxInclusiveUnitPrice = null
+ form.value.taxRate = null
+ form.value.taxInclusiveTotalPrice = null
+ form.value.taxExclusiveTotalPrice = null
}
-}
-const loadSupplierList = async () => {
- try {
- const res = await listSupplier()
- supplierLists.value = res.data.records
- } catch (error) {
- console.error('鍔犺浇渚涘簲鍟嗗垪琛ㄥけ璐�:', error)
+ const loadUserList = async () => {
+ try {
+ const res = await userListNoPage()
+ userList.value = res.data
+ } catch (error) {
+ console.error('鍔犺浇鐢ㄦ埛鍒楄〃澶辫触:', error)
+ }
}
-}
+
+ const loadSupplierList = async () => {
+ try {
+ const res = await listSupplier()
+ supplierLists.value = res.data.records
+ } catch (error) {
+ console.error('鍔犺浇渚涘簲鍟嗗垪琛ㄥけ璐�:', error)
+ }
+ }
// 鎵撳紑寮规
-const openForm = async (type, row) => {
- operationType.value = type
- dialogFormVisible.value = true
- // 鍔犺浇蹇呰鏁版嵁
- await Promise.all([
- loadUserList(),
- loadSupplierList(),
- loadProductList()
- ])
+ const openForm = async (type, row) => {
+ operationType.value = type
+ dialogFormVisible.value = true
+ // 鍔犺浇蹇呰鏁版嵁
+ await Promise.all([
+ loadUserList(),
+ loadSupplierList(),
+ loadProductList()
+ ])
- if (type === 'add') {
- // 鏂板鏃堕噸缃〃鍗�
- form.value = {
- userId: userStore.userId // 璁剧疆榛樿鍏ュ簱浜轰负褰撳墠鐢ㄦ埛
- }
- } else {
- // 缂栬緫鏃跺~鍏呰〃鍗曟暟鎹�
- form.value = { ...row ,
- supplierId: row.supplierId,
- productId: row.productId,
- productModelId: row.productModelId,
- userId: row.userId
- }
- if (row.productId) {
- await loadProductModels(row.productId)
+ if (type === 'add') {
+ // 鏂板鏃堕噸缃〃鍗�
+ form.value = {
+ userId: userStore.userId // 璁剧疆榛樿鍏ュ簱浜轰负褰撳墠鐢ㄦ埛
+ }
+ } else {
+ // 缂栬緫鏃跺~鍏呰〃鍗曟暟鎹�
+ form.value = {
+ ...row,
+ supplierId: row.supplierId,
+ productId: row.productId,
+ productModelId: row.productModelId,
+ userId: row.userId
+ }
+ if (row.productId) {
+ await loadProductModels(row.productId)
+ }
}
}
-}
// 鎻愪氦琛ㄥ崟
-const submitForm = async () => {
- try {
- await proxy.$refs.formRef.validate()
+ const submitForm = async () => {
+ try {
+ await proxy.$refs.formRef.validate()
- if (!form.value.productrecordId) {
- proxy.$modal.msgError('璇烽�夋嫨浜у搧澶х被鍜岃鏍煎瀷鍙蜂互鑾峰彇閲囪喘璁板綍')
- return
- }
+ if (!form.value.productrecordId) {
+ proxy.$modal.msgError('璇烽�夋嫨浜у搧澶х被鍜岃鏍煎瀷鍙蜂互鑾峰彇閲囪喘璁板綍')
+ return
+ }
- const submitData = {
- productrecordId: form.value.productrecordId,
- supplierId: form.value.supplierId,
- inboundQuantity: form.value.inboundQuantity,
- userId: form.value.userId,
- }
+ const submitData = {
+ productrecordId: form.value.productrecordId,
+ supplierId: form.value.supplierId,
+ inboundQuantity: form.value.inboundQuantity,
+ userId: form.value.userId,
+ }
- const apiMethod = operationType.value === 'add' ? addSutockIn : updateStockIn
- await apiMethod(submitData)
+ const apiMethod = operationType.value === 'add' ? addSutockIn : updateStockIn
+ await apiMethod(submitData)
- proxy.$modal.msgSuccess(operationType.value === 'add' ? '鏂板鎴愬姛' : '淇敼鎴愬姛')
- closeDia()
- getList()
- } catch (error) {
- console.error('鎻愪氦澶辫触:', error)
- if (!error.errors) {
- proxy.$modal.msgError('鎿嶄綔澶辫触锛岃閲嶈瘯')
+ proxy.$modal.msgSuccess(operationType.value === 'add' ? '鏂板鎴愬姛' : '淇敼鎴愬姛')
+ closeDia()
+ getList()
+ } catch (error) {
+ console.error('鎻愪氦澶辫触:', error)
+ if (!error.errors) {
+ proxy.$modal.msgError('鎿嶄綔澶辫触锛岃閲嶈瘯')
+ }
}
}
-}
// 鍏抽棴寮规
-const closeDia = () => {
- proxy.$refs.formRef.resetFields()
- dialogFormVisible.value = false
-}
+ const closeDia = () => {
+ proxy.$refs.formRef.resetFields()
+ dialogFormVisible.value = false
+ }
// 琛ㄦ牸閫夋嫨鏁版嵁
-const handleSelectionChange = (selection) => {
- // 杩囨护鎺夊瓙鏁版嵁
- selectedRows.value = selection.filter(item => item.id);
- console.log('selection', selectedRows.value)
-}
-const expandedRowKeys = ref([])
+ 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 summarizeMainTable = (param) => {
+ return proxy.summarizeTable(param, ['contractAmount', 'taxInclusiveTotalPrice', 'taxExclusiveTotalPrice']);
+ };
// 瀵煎嚭
-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(() => {
- delStockIn(ids).then(res => {
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛")
- getList()
+ const handleOut = () => {
+ ElMessageBox.confirm(
+ '閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�',
+ '瀵煎嚭', {
+ confirmButtonText: '纭',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning',
+ }
+ ).then(() => {
+ proxy.download("/stockin/export", {}, '鍏ュ簱鍙拌处.xlsx')
+ }).catch(() => {
+ proxy.$modal.msg("宸插彇娑�")
})
- }).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(() => {
+ delStockIn(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 productSelectedRows = ref([])
+ const productSelected = (selectedRows) => {
+ productSelectedRows.value = selectedRows;
+ };
+
+ const formattedNumber = (row, column, cellValue) => {
+ return parseFloat(cellValue).toFixed(2);
+ };
+ onMounted(() => {
+ getList()
})
}
-// 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲涓� 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 productSelectedRows = ref([])
-const productSelected = (selectedRows) => {
- productSelectedRows.value = selectedRows;
-};
-
-const formattedNumber = (row, column, cellValue) => {
- return parseFloat(cellValue).toFixed(2);
-};
-onMounted(() => {
- getList()
-})
</script>
<style scoped lang="scss"></style>
--
Gitblit v1.9.3