From 0805c8f58834e70b2a654cfa9f54fdaeaa0ddda1 Mon Sep 17 00:00:00 2001 From: chenrui <1187576398@qq.com> Date: 星期五, 06 六月 2025 15:59:03 +0800 Subject: [PATCH] bug修改 --- src/views/salesManagement/invoiceLedger/index.vue | 54 +++++++++++++++++++++++++++++++----------------------- 1 files changed, 31 insertions(+), 23 deletions(-) diff --git a/src/views/salesManagement/invoiceLedger/index.vue b/src/views/salesManagement/invoiceLedger/index.vue index 8d217c8..473969a 100644 --- a/src/views/salesManagement/invoiceLedger/index.vue +++ b/src/views/salesManagement/invoiceLedger/index.vue @@ -14,7 +14,7 @@ <span class="search_title" style="margin-left: 10px">寮�绁ㄦ棩鏈燂細</span> <el-date-picker style="width: 240px" - v-model="form.invoiceDate" + v-model="searchForm.invoiceDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD" type="date" @@ -42,7 +42,7 @@ <el-table-column label="浜у搧澶х被" prop="productCategory" /> <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" /> <el-table-column label="鍙戠エ鍙�" prop="invoiceNo" show-overflow-tooltip/> - <el-table-column label="鍙戠エ閲戦(鍏�)" prop="invoiceTotal" show-overflow-tooltip/> + <el-table-column label="鍙戠エ閲戦(鍏�)" prop="invoiceTotal" show-overflow-tooltip :formatter="formattedNumber"/> <el-table-column label="绋庣巼" prop="taxRate" show-overflow-tooltip/> <el-table-column label="寮�绁ㄤ汉" prop="invoicePerson" show-overflow-tooltip/> <el-table-column label="寮�绁ㄦ棩鏈�" prop="invoiceDate" show-overflow-tooltip/> @@ -90,7 +90,7 @@ <el-row :gutter="30"> <el-col :span="12"> <el-form-item label="寮�绁ㄤ汉锛�" prop="invoicePerson"> - <el-input v-model="form.invoicePerson" placeholder="璇疯緭鍏�" clearable/> + <el-input v-model="form.invoicePerson" placeholder="璇疯緭鍏�" clearable disabled/> </el-form-item> </el-col> <el-col :span="12"> @@ -103,6 +103,7 @@ type="date" placeholder="璇烽�夋嫨" clearable + disabled /> </el-form-item> </el-col> @@ -194,6 +195,7 @@ commitFile, registrationProductPage } from "../../../api/salesManagement/invoiceLedger.js"; +import useUserStore from "@/store/modules/user.js"; const { proxy } = getCurrentInstance() const tableData = ref([]) const productData = ref([]) @@ -235,6 +237,7 @@ }) const { searchForm, form, rules } = toRefs(data) const currentId = ref('') +const userStore = useUserStore() const upload = reactive({ // 涓婁紶鐨勫湴鍧� url: import.meta.env.VITE_APP_BASE_API + "/invoiceLedger/uploadFile", @@ -243,6 +246,9 @@ }) const matchFileType = ref(['pdf']) const uploadModal = ref(false) +const formattedNumber = (row, column, cellValue) => { + return parseFloat(cellValue).toFixed(2); +}; // 鏌ヨ鍒楄〃 /** 鎼滅储鎸夐挳鎿嶄綔 */ const handleQuery = () => { @@ -268,26 +274,10 @@ } // 涓昏〃鍚堣鏂规硶 const summarizeMainTable = (param) => { - const { columns, data } = param; - const sums = []; - columns.forEach((column, index) => { - if (index === 0) { - sums[index] = '鍚堣'; - return; - } - const prop = column.property; - if (['invoiceAmount'].includes(prop)) { - const values = data.map(item => Number(item[prop])); - if (!values.every(value => isNaN(value))) { - sums[index] = values.reduce((acc, val) => (!isNaN(val) ? acc + val : acc), 0); - } else { - sums[index] = ''; - } - } else { - sums[index] = ''; - } - }) - return sums; + return proxy.summarizeTable(param, ['invoiceTotal'], { + ticketsNum: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁� + futureTickets: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁� + }); }; // 鎵撳紑寮规 const openForm = (row) => { @@ -295,9 +285,17 @@ productData.value = [] fileList.value = [] currentId.value = row.id; + invoiceLedgerProductInfo({id: row.id}).then(res => { form.value = {...res.data} fileList.value = res.data.fileList; + if(!form.value.invoicePerson){ + form.value.invoicePerson = userStore.nickName + form.value.entryDate = getCurrentDate(); + } + if(!form.value.invoiceDate){ + form.value.invoiceDate = getCurrentDate(); + } }) dialogFormVisible.value = true } @@ -310,6 +308,7 @@ }; // 涓婁紶鍓嶆牎妫� function handleBeforeUpload(file) { + console.log('file',file) // 鏍℃鏂囦欢澶у皬 if (file.size > 1024 * 1024 * 10) { proxy.$modal.msgError('涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃10MB!') @@ -407,6 +406,15 @@ } +// 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲涓� 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}`; +} + getList() </script> -- Gitblit v1.9.3