From 60a702a3dbcbe6e16a26faab49e66d710d1f8656 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 28 十一月 2025 14:57:36 +0800
Subject: [PATCH] 湟水峡-销售台账/采购台账,有可能同一个公司不同单子,但是开票登记的时候会一起,一对多或者多对一
---
src/views/inventoryManagement/issueManagement/index.vue | 165 ++++++++++++++++++++----------------------------------
1 files changed, 61 insertions(+), 104 deletions(-)
diff --git a/src/views/inventoryManagement/issueManagement/index.vue b/src/views/inventoryManagement/issueManagement/index.vue
index e7b8d6a..dec04a5 100644
--- a/src/views/inventoryManagement/issueManagement/index.vue
+++ b/src/views/inventoryManagement/issueManagement/index.vue
@@ -5,12 +5,20 @@
<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">
@@ -19,21 +27,21 @@
: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="inboundTime" width="100" show-overflow-tooltip />
- <el-table-column label="鍏ュ簱鎵规" prop="inboundBatch" width="160" show-overflow-tooltip />
- <el-table-column label="渚涘簲鍟嗗悕绉�" prop="supplierName" width="160" show-overflow-tooltip />
- <el-table-column label="浜у搧澶х被" prop="productName" width="100" show-overflow-tooltip />
- <el-table-column label="瑙勬牸鍨嬪彿" prop="model" width="160" show-overflow-tooltip />
+ <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="stockQuantity" width="90" show-overflow-tooltip />
+ <el-table-column label="鍏ュ簱鏁伴噺" prop="inboundNum" 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="nickName" width="80" 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>
+ <el-button link type="primary" size="small" @click="openForm(scope.row);">棰嗙敤</el-button>
</template>
</el-table-column>
</el-table>
@@ -43,7 +51,7 @@
<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 v-model="form.inboundQuantity" placeholder="璇疯緭鍏�" clearable />
+ <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.inboundQuantity" placeholder="璇疯緭鍏�" clearable />
</el-form-item>
<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"
@@ -67,68 +75,42 @@
<script setup>
import pagination from '@/components/PIMTable/Pagination.vue'
-import { ref } from 'vue'
+import { ref, reactive, toRefs, onMounted, getCurrentInstance } from 'vue'
import { ElMessageBox } from "element-plus";
import useUserStore from '@/store/modules/user'
-import { userListNoPage } from "@/api/system/user.js";
+import { userListNoPageByTenantId } from "@/api/system/user.js";
import {
- getStockManagePage,
- delStockManage,
- stockOut,
- getStockManageOutPage
+ getStockInPage,
+} from "@/api/inventoryManagement/stockIn.js";
+import {
+ stockOut,
} from "@/api/inventoryManagement/stockManage.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 page = reactive({
current: 1,
size: 100,
})
const total = ref(0)
-const fileList = ref([])
// 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁
const dialogFormVisible = ref(false)
const data = reactive({
searchForm: {
supplierName: '',
+ timeStr: '',
},
form: {
- supplierId: null,
- supplierName: '',
- productId: null,
- productName: '',
- userId: userStore.userId,
- nickName: '',
- productModelId: null,
- model: '',
- unit: '',
- productrecordId: null,
- taxInclusiveUnitPrice: '',
- taxInclusiveTotalPrice: '',
- taxRate: '',
- taxExclusiveTotalPrice: '',
- inboundTime: '',
- inboundBatch: '',
- stockQuantity: '',
- boundTime: '',
+ productrecordId: '',
},
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" }],
inboundTime: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- inboundBatch: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
inboundQuantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- taxInclusiveUnitPrice: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- taxRate: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
nickname: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }]
}
})
@@ -147,34 +129,24 @@
}
const getList = () => {
tableLoading.value = true
- getStockManageOutPage({ ...searchForm.value, ...page }).then(res => {
+ const params = {
+ ...page,
+ supplierName: searchForm.value.supplierName,
+ timeStr: searchForm.value.timeStr
+ }
+
+ getStockInPage(params).then(res => {
tableLoading.value = false
tableData.value = res.data.records
- console.log('res', res.data.records)
+ total.value = res.data.total
}).catch(() => {
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) => {
-
- // 杩囨护鎺夊瓙鏁版嵁
selectedRows.value = selection.filter(item => item.id);
- console.log('selection', selectedRows.value)
}
const expandedRowKeys = ref([])
@@ -182,24 +154,26 @@
const summarizeMainTable = (param) => {
return proxy.summarizeTable(param, ['contractAmount', 'taxInclusiveTotalPrice', 'taxExclusiveTotalPrice']);
};
-const currentRowId = ref(null) // 鏂板锛氬瓨鍌ㄥ綋鍓嶆搷浣滅殑琛孖D
+const currentRowId = ref(null)
+const currentRowNum = ref(0)
+const salesLedgerProductId = ref(null);
// 鎵撳紑寮规
const openForm = async (row) => {
dialogFormVisible.value = true
currentRowId.value = row.id
+ currentRowNum.value = row.inboundNum0
+ salesLedgerProductId.value = row.salesLedgerProductId
form.value = {}
- // 鍒濆鍖栬〃鍗曟暟鎹�
form.value = {
- inboundQuantity: '', // 鍑哄簱鏁伴噺娓呯┖
- inboundTime: getCurrentDate(), // 榛樿褰撳墠鏃ユ湡
- nickName: '', // 榛樿褰撳墠鐢ㄦ埛
+ productrecordId: '',
+ inboundQuantity: '',
+ inboundTime: getCurrentDate(),
+ nickName: '',
}
- console.log('form',form.value)
-
// 鍔犺浇鐢ㄦ埛鍒楄〃
try {
- const userLists = await userListNoPage()
+ const userLists = await userListNoPageByTenantId()
userList.value = userLists.data
} catch (error) {
console.error('鍔犺浇鐢ㄦ埛鍒楄〃澶辫触:', error)
@@ -208,13 +182,19 @@
// 鎻愪氦琛ㄥ崟
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
- outQuantity: form.value.inboundQuantity, // 鍑哄簱鏁伴噺
- outTime: form.value.inboundTime, // 鍑哄簱鏃堕棿
- userId: form.value.userId // 鎿嶄綔浜�
+ id: currentRowId.value,
+ salesLedgerProductId: salesLedgerProductId.value,
+ quantity: form.value.inboundQuantity,
+ time: form.value.inboundTime,
+ userId: form.value.nickName,
+ type: 1 // 閲囪喘鍑哄簱
}
stockOut(outData).then(res => {
@@ -227,6 +207,7 @@
}
})
}
+
// 鍏抽棴寮规
const closeDia = () => {
proxy.resetForm("formRef")
@@ -236,48 +217,24 @@
// 瀵煎嚭
const handleOut = () => {
ElMessageBox.confirm(
- '閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�',
+ '鏄惁纭瀵煎嚭锛�',
'瀵煎嚭', {
confirmButtonText: '纭',
cancelButtonText: '鍙栨秷',
type: 'warning',
}
).then(() => {
- proxy.download("/stockmanagement/export", {}, '鍏ュ簱鍙拌处.xlsx')
+ 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("宸插彇娑�")
- })
-}
+
// 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲涓� YYYY-MM-DD
function getCurrentDate() {
const today = new Date();
const year = today.getFullYear();
- const month = String(today.getMonth() + 1).padStart(2, '0'); // 鏈堜唤浠�0寮�濮�
+ const month = String(today.getMonth() + 1).padStart(2, '0');
const day = String(today.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
}
--
Gitblit v1.9.3