From 00ef76a2e286e338fa3c648ce183e3533ce006ad Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期一, 09 六月 2025 17:48:23 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev --- src/views/warehouseManagement/index.vue | 430 +++++++++++++++++++++++++++++++++++------------------ 1 files changed, 281 insertions(+), 149 deletions(-) diff --git a/src/views/warehouseManagement/index.vue b/src/views/warehouseManagement/index.vue index 06ca93f..cac372d 100644 --- a/src/views/warehouseManagement/index.vue +++ b/src/views/warehouseManagement/index.vue @@ -1,14 +1,6 @@ <template> <div class="app-container"> <el-form :inline="true" :model="queryParams" class="search-form"> - <el-form-item label="鎼滅储"> - <el-input - v-model="queryParams.searchText" - placeholder="璇疯緭鍏ュ叧閿瘝" - clearable - :style="{ width: '100%' }" - /> - </el-form-item> <el-form-item label="渚涘簲鍟嗗悕绉�"> <el-input v-model="queryParams.supplierName" @@ -17,17 +9,9 @@ :style="{ width: '100%' }" /> </el-form-item> - <el-form-item label="缁熶竴浜鸿瘑鍒彿"> + <el-form-item label="鐓ょ"> <el-input - v-model="queryParams.identifyNumber" - placeholder="璇疯緭鍏�" - clearable - :style="{ width: '100%' }" - /> - </el-form-item> - <el-form-item label="缁忚惀鍦板潃"> - <el-input - v-model="queryParams.address" + v-model="queryParams.coal" placeholder="璇疯緭鍏�" clearable :style="{ width: '100%' }" @@ -53,40 +37,214 @@ /> </el-tabs> <!-- 鎿嶄綔鎸夐挳鍖� --> - <el-row :gutter="24" class="table-toolbar"> - <el-button type="primary" :icon="Plus" >鏂板缓</el-button - > + <el-space> <el-button type="danger" :icon="Delete">鍒犻櫎</el-button> - <el-button type="info" :icon="Download">瀵煎嚭</el-button> - </el-row> + <el-button type="info" plain :icon="Download">瀵煎嚭</el-button> + <el-button type="success" plain :icon="Refresh" v-if="activeTab=== 'officialInventory'" @click="mergeRows">鍚堝苟</el-button> + </el-space> <div> - <el-table :data="tableData" border :span-method="mergeSameRows"> + <el-table :data="tableData" border @selection-change="selectionChange" style="width: 100%"> <el-table-column type="selection" width="55" align="center" /> <el-table-column label="搴忓彿" type="index" width="60" align="center" /> - <el-table-column prop="name" label="渚涜揣鍟嗗悕绉�" width="180" /> - <el-table-column prop="type" label="鐓ょ" /> - <el-table-column prop="unit" label="鍗曚綅" /> - <el-table-column prop="number" label="搴撳瓨鏁伴噺" /> - <el-table-column prop="money" label="鍗曚环锛堝惈绋庯級" /> - <el-table-column prop="money1" label="鎬讳环锛堝惈绋庯級" /> - <el-table-column prop="money2" label="鎴愭湰鍗曚环" /> - <el-table-column prop="money3" label="鍒╂鼎" /> - <el-table-column prop="createUser" label="鐧昏浜�" /> - <el-table-column prop="createTime" label="鐧昏鏃ユ湡" /> + <el-table-column prop="supplierName" label="渚涜揣鍟嗗悕绉�" width="180" sortable/> + <el-table-column prop="coal" label="鐓ょ" sortable/> + <el-table-column prop="unit" label="鍗曚綅" width="70"/> + <el-table-column prop="inventoryQuantity" label="搴撳瓨鏁伴噺" sortable min-width="110"/> + <el-table-column prop="priceIncludingTax" label="鍗曚环锛堝惈绋庯級" sortable width="130"/> + <el-table-column prop="totalPriceIncludingTax" label="鎬讳环锛堝惈绋庯級" width="130" /> + <el-table-column prop="costPerUnit" label="鎴愭湰鍗曚环" /> + <el-table-column label="鐓よ川" align="center" v-if="activeTab=== 'officialInventory'" width="600"> + <el-table-column v-for="col in columnTitle" :key="col.prop" :prop="col.prop" :label="col.label" align="center" sortable min-width="200"/> + </el-table-column> + <el-table-column prop="registrant" label="鐧昏浜�" width="180"/> + <el-table-column prop="registrationTime" label="鐧昏鏃ユ湡" width="180"/> + <el-table-column fixed="right" label="鎿嶄綔" min-width="60" align="center" v-if="activeTab !== 'officialInventory'"> + <template #default="scope"> + <el-button link type="primary" size="small" @click="reviewDia(scope.row)">瀹℃牳</el-button> + </template> + </el-table-column> </el-table> + <pagination + v-if="total>0" + :page-num="pageNum" + :page-size="pageSize" + :total="total" + @pagination="handleQuery" + :layout="'total, prev, pager, next, jumper'" + /> </div> </el-card> + <!-- 瀹℃牳寰呭叆搴撳脊妗� --> + <el-dialog title="瀹℃牳鍏ュ簱" v-model="reviewVisible" width="1000px"> + <el-form :model="form" :rules="rules" ref="formRef" label-width="180px"> + <el-row> + <el-col :span="12"> + <el-form-item label="渚涜揣鍟嗗悕绉�" prop="supplierName"> + <el-input v-model="form.supplierName" placeholder="璇疯緭鍏ヤ緵璐у晢鍚嶇О" maxlength="30" /> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鐓ょ" prop="coal"> + <el-input v-model="form.coal" placeholder="璇疯緭鍏ョ叅绉�" maxlength="30" /> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="12"> + <el-form-item label="鍗曚綅" prop="unit"> + <el-input v-model="form.unit" placeholder="璇疯緭鍏ュ崟浣�" maxlength="30" /> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="搴撳瓨鏁伴噺" prop="inventoryQuantity"> + <el-input v-model="form.inventoryQuantity" placeholder="璇疯緭鍏ュ簱瀛樻暟閲�" maxlength="30" /> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="12"> + <el-form-item label="鍗曚环(鍚◣)" prop="priceIncludingTax"> + <el-input v-model="form.priceIncludingTax" placeholder="璇疯緭鍏ュ崟浠�(鍚◣)" maxlength="30" /> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鎬讳环(鍚◣)" prop="totalPriceIncludingTax"> + <el-input v-model="form.totalPriceIncludingTax" placeholder="璇疯緭鍏ユ�讳环(鍚◣)" maxlength="30" /> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="12"> + <el-form-item label="鎴愭湰鍗曚环" prop="costPerUnit"> + <el-input v-model="form.costPerUnit" placeholder="璇疯緭鍏ユ垚鏈崟浠�" maxlength="30" /> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鐓よ川鏂规" prop="qualityPlan"> + <el-select v-model="form.qualityPlan" placeholder="璇烽�夋嫨" @change="coalFieldListOption" clearable> + <el-option + v-for="dict in qualityPlanOption" + :key="dict.id" + :label="dict.plan" + :value="dict.id" + ></el-option> + </el-select> + </el-form-item> + </el-col> + </el-row> + <el-divider></el-divider> + <el-row> + <el-col :span="12" v-for="item in filteredList" :key="item.id"> + <el-form-item :label="item.fieldName"> + <el-input v-model="form[item.fields]" /> + </el-form-item> + </el-col> + </el-row> + </el-form> + <template #footer> + <div class="dialog-footer"> + <el-button type="primary" @click="submitReviewForm">纭� 瀹�</el-button> + <el-button @click="cancelReview">鍙� 娑�</el-button> + </div> + </template> + </el-dialog> + <!-- 鍚堝苟鏁版嵁寮规 --> + <el-dialog title="鍚堝苟搴撳瓨" v-model="mergeVisible" width="800px"> + <el-form :model="form" :rules="rules" ref="userRef" label-width="100px"> + <el-row> + <el-col :span="12"> + <el-form-item label="渚涜揣鍟嗗悕绉�" prop="supplierName"> + <el-input v-model="form.supplierName" placeholder="璇疯緭鍏ユ墜鏈哄彿鐮�" maxlength="30" /> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鐓ょ" prop="coal"> + <el-input v-model="form.coal" placeholder="璇疯緭鍏ュ鍚�" maxlength="30" /> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="12"> + <el-form-item label="鍗曚环(鍚◣)" prop="priceIncludingTax"> + <el-input v-model="form.priceIncludingTax" placeholder="璇疯緭鍏ユ墜鏈哄彿鐮�" maxlength="30" /> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鎬讳环(鍚◣)" prop="totalPriceIncludingTax"> + <el-input v-model="form.totalPriceIncludingTax" placeholder="璇疯緭鍏ユ墜鏈哄彿鐮�" maxlength="30" /> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="12"> + <el-form-item label="鎴愭湰鍗曚环" prop="costPerUnit"> + <el-input v-model="form.costPerUnit" placeholder="璇疯緭鍏ュ鍚�" maxlength="30" /> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鐓よ川" prop="userName"> + <el-input v-model="form.userName" placeholder="璇疯緭鍏ユ墜鏈哄彿鐮�" maxlength="30" /> + </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="cancel">鍙� 娑�</el-button> + </div> + </template> + </el-dialog> </div> </template> <script setup> import {onMounted, ref} from "vue"; -import {Delete, Download, Plus} from "@element-plus/icons-vue"; +import {Delete, Download, Refresh} from "@element-plus/icons-vue"; +import Pagination from "@/components/Pagination/index.vue"; +import { + addOrEditCoalValue, + coalFieldList, + coalPlanList, officialInventoryList, + pendingInventoryList +} from "@/api/warehouseManagement/index.js"; + +const { proxy } = getCurrentInstance() const tableData = ref([]) +const selectedRows = ref([]) const columns = ref([]) +const qualityPlanOption = ref([]) +const filteredList = ref([]) const tableLoading = ref(false); const total = ref(0); +const pageNum = ref(1); +const pageSize = ref(10); +// 瀹℃牳寮规 +const reviewVisible = ref(false); +// 鍚堝苟寮规 +const mergeVisible = ref(false) +const data = reactive({ + form: { + supplierName: '', + coal: '', + unit: '', + inventoryQuantity: '', + priceIncludingTax: '', + totalPriceIncludingTax: '', + costPerUnit: '', + qualityPlan: '', + planId: '', + }, + rules: { + supplierName: [{ required: true, message: "璇疯緭鍏ヤ緵搴斿晢鍚嶇О", trigger: "blur" }], + coal: [{ required: true, message: "璇疯緭鍏ョ叅绉�", trigger: "blur" }], + unit: [{ required: true, message: "璇疯緭鍏ュ崟浣�", trigger: "blur" }], + qualityPlan: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }], + } +}) + +const { form, rules } = toRefs(data) // 褰撳墠鏍囩 const activeTab = ref("pendingInbound"); const tabName = ref("pendingInbound"); @@ -97,54 +255,46 @@ ]); // 鏌ヨ鍙傛暟 const queryParams = reactive({ - searchText: "", supplierName: "", - identifyNumber: "", - address: "", + coal: "", }) +const columnTitle = ref([]) onMounted(() => { handleTabClick({ props: { name: "supplier" } }); }); // 鏍囩椤电偣鍑� const handleTabClick = (tab) => { - getList(); - tableLoading.value = true; tabName.value = tab.props.name; tableData.value = []; getList(); - // switch (tabName.value) { - // case "pendingInbound": - // columns.value = pendingColumns; - // break; - // case "officialInventory": - // columns.value = officialColumns; - // break; - // } - setTimeout(() => { - tableLoading.value = false; - }, 500); }; // 鐐瑰嚮鏌ヨ const handleQuery = () => { - tableLoading.value = true; - setTimeout(() => { - tableLoading.value = false; - }, 500); + pageNum.value = 1 + pageSize.value = 10 + getList() } const getList = () => { tableLoading.value = true; - setTimeout(() => { - // 鏆傛椂寮曞叆娴嬭瘯鏁版嵁 - tableData.value = [ - { name: "渚涘簲鍟咥", type: "鍔ㄥ姏鐓�", unit: "鍚�", number: 100, money: 500 }, - { name: "渚涘簲鍟咥", type: "鍔ㄥ姏鐓�", unit: "鍚�", number: 100, money: 500 }, - { name: "渚涘簲鍟咮", type: "鐒︾叅", unit: "鍚�", number: 300, money: 789 }, - { name: "渚涘簲鍟咮", type: "鐒︾叅", unit: "鍚�", number: 256, money: 800 }, - { name: "渚涘簲鍟咰", type: "鏃犵儫鐓�", unit: "鍚�", number: 256, money: 700 } - ]; - total.value = tableData.value.length; - tableLoading.value = false; - }, 500); + // 璧嬪�肩叅璐ㄨ〃澶村睍绀哄瓧娈� + columnTitle.value = [ + {prop: 'value1', label: '鐧惧垎姣�1'}, + {prop: 'value2', label: '鐧惧垎姣�2'}, + {prop: 'value3', label: '鐧惧垎姣�3'}, + ] + if (tabName.value === "pendingInbound") { + pendingInventoryList({ ...queryParams }).then(res => { + tableLoading.value = false; + tableData.value = res.data.records; + total.value = res.data.total; + }) + } else { + officialInventoryList({ ...queryParams }).then(res => { + tableLoading.value = false; + tableData.value = res.data.records; + total.value = res.data.total; + }) + } }; // 閲嶇疆鏌ヨ const resetQuery = () => { @@ -155,94 +305,76 @@ }); handleQuery(); }; -// 鍚堝苟鐩稿悓琛岀殑鏂规硶 -const mergeSameRows = ({ row, column, rowIndex, columnIndex }) => { - const fieldsToMerge = ['number', 'money'] - - if (fieldsToMerge.includes(column.property)) { - const prevRow = tableData.value[rowIndex - 1] - const nextRow = tableData.value[rowIndex + 1] - // 鍒ゆ柇褰撳墠琛屽拰涓嬩竴琛屾槸鍚︾浉绛� - if ( - (!prevRow || prevRow[column.property] !== row[column.property]) && - (!nextRow || nextRow[column.property] === row[column.property]) - ) { - let count = 1 - while ( - tableData.value[rowIndex + count] && - tableData.value[rowIndex + count][column.property] === row[column.property] - ) { - count++ - } - return { rowspan: count, colspan: 1 } - } else if (prevRow && prevRow[column.property] === row[column.property]) { - // 闅愯棌琚悎骞剁殑鍗曞厓鏍� - return { rowspan: 0, colspan: 0 } +// 琛ㄦ牸閫夋嫨鏁版嵁 +const selectionChange = (rows) => { + selectedRows.value = rows +} +// 鎵撳紑瀹℃牳寮规 +const reviewDia = (row) => { + reviewVisible.value = true + form.value = {...row} + form.value.planId = form.value.id + coalPlanListOptions() +} +// 鏌ヨ鐓よ川鏂规涓嬫媺妗� +const coalPlanListOptions = () => { + coalPlanList().then(res => { + qualityPlanOption.value = res.data + }) +} +// 鏌ヨ鐓よ川鏂规瀛楁 +const coalFieldListOption = (id) => { + coalFieldList({id: id}).then(res => { + filteredList.value = res.data + if (!id) { + filteredList.value = [] } - return { rowspan: 1, colspan: 1 } + }) +} +// 鍚堝苟搴撳瓨鏁版嵁鏂规硶 +const mergeRows = () => { + if (selectedRows.value.length < 2) { + proxy.$modal.msgWarning('璇疯嚦灏戦�夋嫨涓ゆ潯鏁版嵁') + return } - - // 鍏朵粬鍒椾笉鍚堝苟 - return { rowspan: 1, colspan: 1 } + mergeVisible.value = true +} +// 鎻愪氦鍚堝苟琛ㄥ崟 +const submitForm = () => { + +} +// 鍏抽棴鍚堝苟琛ㄥ崟 +const cancel = () => { + mergeVisible.value = false +} +// 鎻愪氦瀹℃牳琛ㄥ崟 +const submitReviewForm = () => { + proxy.$refs.formRef.validate((valid) => { + if (valid) { + delete form.value.registrationTime + delete form.value.createTime + delete form.value.updateTime + delete form.value.id + form.value.fieldValue = filteredList.value.map(item => ({ + [item.fields]: form.value[item.fields] + })) + addOrEditCoalValue(form.value).then(() => { + cancelReview() + proxy.$modal.msgSuccess('鎻愪氦鎴愬姛') + handleQuery() + }) + } + }) +} +// 鍏抽棴瀹℃牳寮规 +const cancelReview = () => { + proxy.$refs.formRef.resetFields() + reviewVisible.value = false } </script> <style scoped> -.app-container{ - box-sizing: border-box; -} -.search-form { - background-color: #fff; - padding: 20px 20px 0 20px; - margin-bottom: 20px; - border-radius: 4px; - box-shadow: var(--el-box-shadow-light); -} -.search-form :deep(.el-form-item) { - margin-bottom: 16px; - width: 100%; -} - -/* 鍝嶅簲寮忓竷灞� */ -@media screen and (min-width: 768px) { - .search-form :deep(.el-form-item) { - width: 50%; - } -} -@media screen and (min-width: 1200px) { - .search-form :deep(.el-form-item) { - width: 18%; - } -} - -.table-toolbar { - margin-bottom: 20px; - display: flex; - flex-wrap: wrap; - gap: 10px; -} - :deep(.el-table) { - margin-bottom: 20px; - overflow-x: auto; -} - -:deep(.el-table th) { - background-color: #f5f7fa; -} - -/* 鍝嶅簲寮忔牱寮� */ -@media screen and (max-width: 768px) { - :deep(.el-table) { - width: 100%; - overflow-x: auto; - } -} -/* 琛ㄦ牸宸ュ叿鏍� */ -.table-toolbar, .table-toolbar > * { - margin: 0 0 0 0 !important; -} -.table-toolbar{ - margin-bottom: 20px !important; + margin: 20px 0; } </style> \ No newline at end of file -- Gitblit v1.9.3