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 | 196 ++++++++++++++++++------------------------------
1 files changed, 74 insertions(+), 122 deletions(-)
diff --git a/src/views/salesManagement/invoiceLedger/index.vue b/src/views/salesManagement/invoiceLedger/index.vue
index f7669cc..473969a 100644
--- a/src/views/salesManagement/invoiceLedger/index.vue
+++ b/src/views/salesManagement/invoiceLedger/index.vue
@@ -2,7 +2,7 @@
<div class="app-container">
<div class="search_form">
<div>
- <span class="search_title">寮�绁ㄥ彴璐︼細</span>
+ <span class="search_title">瀹㈡埛鍚嶇О/鍚堝悓鍙凤細</span>
<el-input
v-model="searchForm.searchText"
style="width: 240px"
@@ -11,22 +11,20 @@
clearable
:prefix-icon="Search"
/>
- <span class="search_title">寮�绁ㄦ棩鏈燂細</span>
+ <span class="search_title" style="margin-left: 10px">寮�绁ㄦ棩鏈燂細</span>
<el-date-picker
- style="width: 240px"
- v-model="form.invoiceDate"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- type="date"
- placeholder="璇烽�夋嫨"
- clearable
- />
+ style="width: 240px"
+ v-model="searchForm.invoiceDate"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ type="date"
+ placeholder="璇烽�夋嫨"
+ clearable
+ />
<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>
+ <el-button @click="handleOut" type="primary" style="width: 100px">瀵煎嚭</el-button>
</div>
</div>
<div class="table_list">
@@ -41,12 +39,14 @@
<el-table-column label="閿�鍞悎鍚屽彿" prop="salesContractNo" show-overflow-tooltip/>
<el-table-column label="瀹㈡埛鍚堝悓鍙�" prop="customerContractNo" show-overflow-tooltip/>
<el-table-column label="瀹㈡埛鍚嶇О" prop="customerName" show-overflow-tooltip/>
+ <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="invoiceAmount" 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/>
- <el-table-column label="鍙戠エ" prop="invoiceDate" show-overflow-tooltip>
+ <el-table-column label="鍙戠エ" prop="invoiceFileName" show-overflow-tooltip>
<template #default="scope">
<span v-if="scope.row.invoiceFileName">{{ scope.row.invoiceFileName }}</span>
<el-button v-else link type="primary" @click="handleDownload(scope.row)">涓婁紶</el-button>
@@ -54,26 +54,24 @@
</el-table-column>
<el-table-column fixed="right" label="鎿嶄綔" min-width="60" align="center">
<template #default="scope">
- <el-button link type="primary" size="small" @click="openForm('edit', scope.row);">缂栬緫</el-button>
+ <el-button link type="primary" size="small" @click="openForm(scope.row);">缂栬緫</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" layout="total, sizes, prev, pager, next, jumper" :page="page.current"
:limit="page.size" @pagination="paginationChange" />
</div>
- <el-dialog v-model="dialogFormVisible" :title="operationType === 'add' ? '鏂板寮�绁ㄥ彴璐﹂〉闈�' : '缂栬緫寮�绁ㄥ彴璐﹂〉闈�'" width="70%" @close="closeDia">
+ <el-dialog v-model="dialogFormVisible" title="寮�绁ㄥ彴璐﹂〉闈�" width="70%" @close="closeDia">
<el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef">
<el-row :gutter="30">
<el-col :span="12">
- <el-form-item label="閿�鍞悎鍚屽彿锛�" prop="salesLedgerId">
- <el-select v-model="form.salesLedgerId" placeholder="璇烽�夋嫨" clearable @change="ledgerChange" :disabled="operationType === 'edit'">
- <el-option v-for="item in ledgerList" :key="item.id" :label="item.salesContractNo" :value="item.id"/>
- </el-select>
+ <el-form-item label="閿�鍞悎鍚屽彿锛�" prop="salesContractNo">
+ <el-input v-model="form.salesContractNo" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="瀹㈡埛鍚嶇О锛�" prop="customerName">
- <el-input v-model="form.customerName" placeholder="鑷姩濉厖" clearable :disabled="operationType === 'edit'"/>
+ <el-input v-model="form.customerName" placeholder="鑷姩濉厖" clearable disabled/>
</el-form-item>
</el-col>
</el-row>
@@ -84,24 +82,17 @@
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="鍙戠エ閲戦(鍏�)锛�" prop="invoiceAmount">
- <el-input type="number" :step="0.01" v-model="form.invoiceAmount" placeholder="璇疯緭鍏�" clearable/>
+ <el-form-item label="鍙戠エ閲戦(鍏�)锛�" prop="invoiceTotal">
+ <el-input type="number" :step="0.01" v-model="form.invoiceTotal" placeholder="璇疯緭鍏�" clearable/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
- <el-col :span="12">
- <el-form-item label="绋庣巼锛�" prop="taxRate">
- <el-input type="number" :step="0.01" v-model="form.taxRate" placeholder="璇疯緭鍏�" clearable/>
- </el-form-item>
- </el-col>
<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-row>
- <el-row :gutter="30">
<el-col :span="12">
<el-form-item label="寮�绁ㄦ棩鏈燂細" prop="invoiceDate">
<el-date-picker
@@ -112,6 +103,7 @@
type="date"
placeholder="璇烽�夋嫨"
clearable
+ disabled
/>
</el-form-item>
</el-col>
@@ -126,6 +118,8 @@
ref="fileUpload"
auto-upload
:headers="upload.headers"
+ accept=".pdf"
+ :limit="1"
:before-upload="handleBeforeUpload"
:on-error="handleUploadError"
:on-success="handleUploadSuccess"
@@ -161,6 +155,9 @@
ref="fileUpload"
auto-upload
:headers="upload.headers"
+ accept=".pdf"
+ :limit="1"
+ :on-exceed="handleExceed"
:before-upload="handleBeforeUpload"
:on-error="handleUploadError"
:on-success="handleUploadSuccess"
@@ -168,9 +165,8 @@
>
<el-button type="primary">涓婁紶</el-button>
<template #tip>
- <!-- 鏂囦欢鏍煎紡鏀寔 doc锛宒ocx锛寈ls锛寈lsx锛宲pt锛宲ptx锛宲df锛宼xt锛寈ml锛宩pg锛宩peg锛宲ng锛実if锛宐mp锛宺ar锛寊ip锛�7z-->
<div class="el-upload__tip">
- 鏂囦欢鏍煎紡鏀寔 pdf
+ 鏂囦欢鏍煎紡浠呮敮鎸� pdf
</div>
</template>
</el-upload>
@@ -192,18 +188,14 @@
import { ref } from 'vue'
import {Search} from "@element-plus/icons-vue";
import {ElMessageBox } from "element-plus";
-import {
- getSalesLedgerWithProducts,
- ledgerListNoPage
-} from "@/api/salesManagement/salesLedger.js";
import { getToken } from "@/utils/auth"
import {
- invoiceLedgerList,
- invoiceLedgerDel,
invoiceLedgerSaveOrUpdate,
- invoiceLedgerDetail,
+ invoiceLedgerProductInfo,
commitFile,
+ registrationProductPage
} from "../../../api/salesManagement/invoiceLedger.js";
+import useUserStore from "@/store/modules/user.js";
const { proxy } = getCurrentInstance()
const tableData = ref([])
const productData = ref([])
@@ -215,9 +207,6 @@
})
const total = ref(0)
const fileList = ref([])
-const ledgerList = ref([])
-// 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁
-const operationType = ref('')
const dialogFormVisible = ref(false)
const data = reactive({
searchForm: {
@@ -228,7 +217,7 @@
salesLedgerId: '',
customerId: '',
invoiceNo: '',
- invoiceAmount: '',
+ invoiceTotal: '',
taxRate: '',
invoicePerson: '',
invoiceDate: '',
@@ -248,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",
@@ -256,6 +246,9 @@
})
const matchFileType = ref(['pdf'])
const uploadModal = ref(false)
+const formattedNumber = (row, column, cellValue) => {
+ return parseFloat(cellValue).toFixed(2);
+};
// 鏌ヨ鍒楄〃
/** 鎼滅储鎸夐挳鎿嶄綔 */
const handleQuery = () => {
@@ -269,7 +262,7 @@
}
const getList = () => {
tableLoading.value = true
- invoiceLedgerList({...searchForm.value, ...page}).then(res => {
+ registrationProductPage({...searchForm.value, ...page}).then(res => {
tableLoading.value = false
tableData.value = res.data.records;
total.value = res.data.total;
@@ -281,50 +274,43 @@
}
// 涓昏〃鍚堣鏂规硶
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 = (type, row) => {
- operationType.value = type
+const openForm = (row) => {
form.value = {}
productData.value = []
fileList.value = []
- // 鏌ヨ閿�鍞悎鍚�
- ledgerListNoPage({}).then(res => {
- ledgerList.value = res.data;
+ 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();
+ }
})
- if (type === 'edit') {
- currentId.value = row.id;
- invoiceLedgerDetail({id: row.id}).then(res => {
- form.value = {...res.data}
- fileList.value = res.data.fileList;
- })
- }
dialogFormVisible.value = true
}
+// 涓婁紶澶氫釜鏂囦欢灏辫鐩栧師鏉ョ殑
+const handleExceed = (files) => {
+ proxy.$refs["fileUpload"].clearFiles();
+ const file = files[0];
+ file.uid = genFileId();
+ proxy.$refs["fileUpload"].handleStart(file);
+};
// 涓婁紶鍓嶆牎妫�
function handleBeforeUpload(file) {
+ console.log('file',file)
// 鏍℃鏂囦欢澶у皬
- if (file.size > 1024 * 1024) {
+ if (file.size > 1024 * 1024 * 10) {
proxy.$modal.msgError('涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃10MB!')
return false
}
@@ -394,49 +380,6 @@
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(() => {
- invoiceLedgerDel(ids).then(res => {
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛")
- getList()
- })
- }).catch(() => {
- proxy.$modal.msg("宸插彇娑�")
- })
-}
-
-// 閿�鍞彴璐︾瓫閫�
-const ledgerChange = (val) => {
- if(val){
- getSalesLedgerWithProducts({id: val}).then(res => {
- form.value = {
- salesLedgerId: res.id,
- customerName: res.customerName,
- customerId: res.customerId,
- salesContractNo: res.salesContractNo
- }
- })
- }else {
- form.value.salesLedgerId = ''
- form.value.customerName = ''
- form.value.customerId = ''
- }
-}
// 鎵撳紑闄勪欢涓婁紶寮圭獥
const handleDownload = (val) => {
@@ -463,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