diff --git a/src/api/enterpriseLibrary/performance/performance.js b/src/api/enterpriseLibrary/performance/performance.js index 77e35ed..16f8981 100644 --- a/src/api/enterpriseLibrary/performance/performance.js +++ b/src/api/enterpriseLibrary/performance/performance.js @@ -37,11 +37,11 @@ export function updatePerformance(data) { } // 删除业绩库 -export function delPerformance(performanceId) { +export function delPerformance(data) { return request({ url: '/smartBid/performance/delete', method: 'post', - data: { performanceId } + data: data }) } diff --git a/src/components/TableModel2/index.vue b/src/components/TableModel2/index.vue index 05e9a85..92e0abc 100644 --- a/src/components/TableModel2/index.vue +++ b/src/components/TableModel2/index.vue @@ -216,11 +216,6 @@ export default { type: Boolean, default: false, }, - // 表格最大高度(像素),默认600px - tableMaxHeight: { - type: [Number, String], - default: 600, - }, // 是否自动加载数据 默认自动加载 autoLoad: { type: Boolean, @@ -253,20 +248,19 @@ export default { }, /* 表格卡片动态高度 */ tableCardStyle() { - const baseHeight = this.showSearch ? 200 : 120 // 搜索区域高度 - const toolbarHeight = this.showRightTools ? 40 : 0 // 工具栏高度 - const paginationHeight = 60 // 分页区域高度 - const availableHeight = `calc(100vh - ${baseHeight + toolbarHeight + paginationHeight + 25 - }px)` return { - height: availableHeight, display: 'flex', flexDirection: 'column', + // 去掉固定高度,让卡片自然适应内容 } }, /* 表格容器样式 */ tableContainerStyle() { - return {} + return { + flex: 1, // 占满父元素剩余空间 + overflow: 'auto', // 超出部分显示滚动条 + maxHeight: `calc(100vh - 200px)`, // 可根据实际情况调整 + } }, }, watch: { @@ -285,6 +279,7 @@ export default { }, data() { return { + tableMaxHeight: 'calc(100vh - 220px)', // 动态计算最大高度 // 表单校验 formRules: {}, loading: false, @@ -702,6 +697,8 @@ export default { // 新增表格容器样式 .table-container { width: 100%; + flex: 1; + overflow: auto; ::v-deep .el-table { width: 100%; diff --git a/src/views/enterpriseLibrary/finance/components/FinanceForm.vue b/src/views/enterpriseLibrary/finance/components/FinanceForm.vue index 0aa0ec0..81fed37 100644 --- a/src/views/enterpriseLibrary/finance/components/FinanceForm.vue +++ b/src/views/enterpriseLibrary/finance/components/FinanceForm.vue @@ -140,21 +140,11 @@ export default { formData.delFiles.push(...financialStatementData.delFileList) } - // 5. 后续的文件名唯一性校验、接口调用逻辑不变... - // if (this.type !== 'add') { - // const uniqueCheck = await checkFileNameUnique({ - // fileName: formData.fileName, - // financeId: formData.id ? Number(formData.id) : null, - // enterpriseId: this.enterpriseId - // }) - // if (!uniqueCheck) { - // throw new Error('同一企业下文件名已存在,请更换') - // } - // } - if (this.type === 'add') { + console.log('asdad',formData) await addFinance(formData) } else { + console.log('年份编辑',formData) await updateFinance(formData) } diff --git a/src/views/enterpriseLibrary/finance/components/child/FinanceReportDetail.vue b/src/views/enterpriseLibrary/finance/components/child/FinanceReportDetail.vue index 5afe663..b8c2384 100644 --- a/src/views/enterpriseLibrary/finance/components/child/FinanceReportDetail.vue +++ b/src/views/enterpriseLibrary/finance/components/child/FinanceReportDetail.vue @@ -42,7 +42,7 @@ @@ -38,8 +39,8 @@ v-model="formData.fileName" placeholder="文件上传后自动提取" class="form-control" - maxlength="100" - readonly + show-word-limit + maxlength="32" > @@ -114,6 +115,16 @@ export default { }, methods: { + handleUploadFail() { + + + // 将文件名和报告年份置空 + this.formData.fileName = ''; + this.formData.reportYear = ''; + + + }, + handleDocxContent(text) { // 模拟OCR返回格式,将docx文本包装成现有逻辑可处理的结构 diff --git a/src/views/enterpriseLibrary/finance/components/child/FinancialStatement.vue b/src/views/enterpriseLibrary/finance/components/child/FinancialStatement.vue index 1d6a8bf..8ac7ef0 100644 --- a/src/views/enterpriseLibrary/finance/components/child/FinancialStatement.vue +++ b/src/views/enterpriseLibrary/finance/components/child/FinancialStatement.vue @@ -38,6 +38,8 @@ v-model="formData.operatingIncome" placeholder="自动提取" class="form-control auto-input" + show-word-limit + maxlength="16" > @@ -47,6 +49,8 @@ v-model="formData.currentAssets" placeholder="自动提取" class="form-control auto-input" + show-word-limit + maxlength="16" > @@ -56,6 +60,8 @@ v-model="formData.currentLiabilities" placeholder="自动提取" class="form-control auto-input" + show-word-limit + maxlength="16" > @@ -68,6 +74,8 @@ v-model="formData.currentRatio" placeholder="自动提取" class="form-control auto-input" + show-word-limit + maxlength="16" > @@ -77,6 +85,10 @@ v-model="formData.netProfit" placeholder="自动提取" class="form-control auto-input" + show-word-limit + maxlength="16" + :precision="2" + @change="handleNumberInput('netProfit')" > @@ -86,6 +98,8 @@ v-model="formData.shareholdersEquity" placeholder="自动提取" class="form-control auto-input" + show-word-limit + maxlength="16" > @@ -98,6 +112,8 @@ v-model="formData.returnOnNetAssets" placeholder="自动提取" class="form-control auto-input" + show-word-limit + maxlength="16" > @@ -107,6 +123,8 @@ v-model="formData.totalLiabilities" placeholder="自动提取" class="form-control auto-input" + show-word-limit + maxlength="16" > @@ -116,6 +134,10 @@ v-model="formData.totalAssets" placeholder="自动提取" class="form-control auto-input" + :precision="2" + @change="handleNumberInput('totalAssets')" + show-word-limit + maxlength="16" > @@ -128,6 +150,8 @@ v-model="formData.assetLiabilityRatio" placeholder="自动提取" class="form-control auto-input" + show-word-limit + maxlength="16" > @@ -249,7 +273,7 @@ export default { } }, -// 从文本中提取财务数据(核心逻辑) + // 从文本中提取财务数据(核心逻辑) extractFinancialDataFromText(text) { const data = {}; const keywords = Object.keys(this.ocrResultParams); // 获取所有财务指标关键词 @@ -269,13 +293,20 @@ export default { return data; }, -// 将提取的财务数据填充到表单 + // 将提取的财务数据填充到表单 fillFormWithFinancialData(financialData) { Object.keys(financialData).forEach(keyword => { const formField = this.ocrResultParams[keyword]; if (formField) { // 保留数字、小数点和百分号(清除其他字符) - this.formData[formField] = financialData[keyword].replace(/[^\d.%]/g, ''); + const cleanedValue = financialData[keyword].replace(/[^\d.%]/g, ''); + + // 对特定字段进行两位小数格式化 + if (formField === 'netProfit' || formField === 'totalAssets') { + this.formData[formField] = this.formatToTwoDecimalPlaces(cleanedValue); + } else { + this.formData[formField] = cleanedValue; + } } }); // 触发表单验证 @@ -296,7 +327,16 @@ export default { : []; this.formData = { - ...(data || {}), + operatingIncome: data.operatingIncome, + currentAssets: data.currentAssets, + currentLiabilities: data.currentLiabilities, + currentRatio: data.currentRatio, + netProfit: data.netProfit, + shareholdersEquity: data.shareholdersEquity, + returnOnNetAssets: data.returnOnNetAssets, + totalLiabilities: data.totalLiabilities, + totalAssets: data.totalAssets, + assetLiabilityRatio: data.assetLiabilityRatio, fileList: financialFiles, delFileList: [] } @@ -363,13 +403,14 @@ export default { Object.keys(chat_res).forEach(key => { const formField = this.ocrResultParams[key] if (formField && chat_res[key]) { - if (['operatingIncome', 'currentAssets', 'currentLiabilities', 'currentRatio', - 'netProfit', 'shareholdersEquity', 'returnOnNetAssets', 'totalLiabilities', - 'totalAssets', 'assetLiabilityRatio'].includes(formField)) { - this.formData[formField] = chat_res[key].replace(/[^\d.]/g, '') - } else { - this.formData[formField] = chat_res[key] + let processedValue = chat_res[key].replace(/[^\d.]/g, '') + + // 对特定字段进行两位小数格式化 + if (formField === 'netProfit' || formField === 'totalAssets') { + processedValue = this.formatToTwoDecimalPlaces(processedValue) } + + this.formData[formField] = processedValue } }) this.$message.success('OCR识别成功,已自动填充财务数据') @@ -398,16 +439,12 @@ export default { validate() { return new Promise((resolve, reject) => { - if (!this.$refs.financialStatementForm) { - reject(new Error('表单实例未加载完成')) - return - } - this.$refs.financialStatementForm.validate((valid) => { if (valid) { resolve(this.formData) } else { - reject(new Error('财务报表信息填写不完整')) + // 前端验证失败,不继续提交到后端 + reject(new Error('请完善表单信息')) } }) }) @@ -454,7 +491,36 @@ export default { } this.fileUploadList.push(item) + }, + + /** + * 将数值格式化为最多保留两位小数的字符串 + * @param {string|number} value - 需要格式化的数值 + * @returns {string} 格式化后的字符串 + */ + formatToTwoDecimalPlaces(value) { + if (value === null || value === undefined || value === '') { + return ''; + } + // 尝试将输入值转换为数字 + const num = Number(value); + // 检查转换是否成功 + if (isNaN(num)) { + return value; // 如果无法转换,返回原始值 + } + // 使用 toFixed(2) 进行四舍五入并保留两位小数 + // 注意:toFixed会返回一个字符串 + return num.toFixed(2); + }, + + /** + * 处理数字输入框的change事件,确保格式正确 + * @param {string} fieldName - 表单字段名 + */ + handleNumberInput(fieldName) { + this.formData[fieldName] = this.formatToTwoDecimalPlaces(this.formData[fieldName]); } + } } diff --git a/src/views/enterpriseLibrary/finance/index.vue b/src/views/enterpriseLibrary/finance/index.vue index ec4f225..9f0f564 100644 --- a/src/views/enterpriseLibrary/finance/index.vue +++ b/src/views/enterpriseLibrary/finance/index.vue @@ -232,8 +232,9 @@ export default {