修复业务模块bug

This commit is contained in:
2026-08-14 02:49:46 +08:00
parent eceac8b31f
commit 6e012d766c
7 changed files with 1825 additions and 238 deletions
@@ -218,11 +218,11 @@
<el-input v-model="itemForm.itemName" maxlength="20" />
</el-form-item>
<el-form-item label="分值" required>
<el-input-number v-model="itemForm.score" :min="0" :precision="2" :controls="false" />
<el-input-number v-model="itemForm.score" :min="1" :precision="0" :step="1" :controls="false" />
</el-form-item>
</div>
<el-form-item label="得分说明">
<el-input v-model="itemForm.scoreDescription" maxlength="300" />
<el-input v-model="itemForm.scoreDescription" maxlength="300" class="score-description-input" />
</el-form-item>
<el-form-item label="选项描述">
<el-input v-model="itemForm.optionDescription" maxlength="100" />
@@ -232,7 +232,7 @@
<div class="option-row" v-for="(option, index) in itemForm.options" :key="index">
<el-input v-model="option.optionName" maxlength="100" />
<div class="option-score">
<el-input-number v-model="option.score" :min="0" :precision="2" :controls="false" />
<el-input-number v-model="option.score" :min="1" :precision="0" :step="1" :controls="false" />
<span class="score-unit"></span>
</div>
<el-link
@@ -534,10 +534,10 @@ export default {
emptyItem() {
return {
itemName: '',
score: 0,
score: 1,
scoreDescription: '',
optionDescription: '',
options: [{ optionName: '', score: 0 }],
options: [{ optionName: '', score: 1 }],
};
},
emptyStandard() {
@@ -561,7 +561,7 @@ export default {
items: (category.items || []).map(item => ({
...item,
options:
item.options && item.options.length ? item.options : [{ optionName: '', score: 0 }],
item.options && item.options.length ? item.options : [{ optionName: '', score: 1 }],
})),
};
});
@@ -624,6 +624,10 @@ export default {
this.$message.warning('请输入分值');
return;
}
if (!this.isPositiveInteger(this.itemForm.score)) {
this.$message.warning('分值只能输入正整数');
return;
}
if (!this.itemForm.options.length) {
this.$message.warning('至少添加1条档位选项');
return;
@@ -639,12 +643,18 @@ export default {
this.$message.warning('请完整填写档位选项');
return;
}
if (this.itemForm.options.some(option => !this.isPositiveInteger(option.score))) {
this.$message.warning('选项分数只能输入正整数');
return;
}
const item = JSON.parse(JSON.stringify(this.itemForm));
item.itemName = String(item.itemName || '').trim();
item.options = item.options.map(option => ({
...option,
optionName: String(option.optionName || '').trim(),
score: Number(option.score),
}));
item.score = Number(item.score);
if (this.currentItemIndex >= 0) {
this.currentCategory.items.splice(this.currentItemIndex, 1, item);
} else {
@@ -660,7 +670,7 @@ export default {
this.currentCategory.items.splice(index, 1);
},
addOption() {
this.itemForm.options.push({ optionName: '', score: 0 });
this.itemForm.options.push({ optionName: '', score: 1 });
},
removeOption(index) {
this.itemForm.options.splice(index, 1);
@@ -779,6 +789,9 @@ export default {
isBlankValue(value) {
return value === undefined || value === null || value === '';
},
isPositiveInteger(value) {
return /^\d+$/.test(String(value)) && Number(value) > 0;
},
hasRangeOverlap(list, lowerProp, upperProp) {
const ranges = list
.map(item => ({
@@ -810,10 +823,18 @@ export default {
return false;
}
for (const item of category.items) {
if (!this.isPositiveInteger(item.score)) {
this.$message.warning(`${item.itemName || '评分项目'}的分值只能为正整数`);
return false;
}
if (!item.options || item.options.length === 0) {
this.$message.warning(`${item.itemName}至少存在1条档位选项`);
return false;
}
if (item.options.some(option => !this.isPositiveInteger(option.score))) {
this.$message.warning(`${item.itemName || '评分项目'}的选项分数只能为正整数`);
return false;
}
}
}
const creditLevels = this.configForm.standards
@@ -842,6 +863,10 @@ export default {
this.$message.warning('发布前请完整填写评分项目名称');
return false;
}
if (!this.isPositiveInteger(item.score)) {
this.$message.warning(`${item.itemName || '评分项目'}的分值只能为正整数`);
return false;
}
if (!item.options || item.options.length === 0) {
this.$message.warning(`${item.itemName || '评分项目'}至少配置1个档位选项`);
return false;
@@ -853,6 +878,10 @@ export default {
this.$message.warning(`${item.itemName || '评分项目'}的档位选项未填写完整`);
return false;
}
if (item.options.some(option => !this.isPositiveInteger(option.score))) {
this.$message.warning(`${item.itemName || '评分项目'}的选项分数只能为正整数`);
return false;
}
}
}
@@ -1103,6 +1132,10 @@ export default {
text-align: center;
}
:deep(.score-description-input .el-input__inner) {
text-align: left;
}
&__top {
display: grid;
grid-template-columns: 360px 360px;
+30 -11
View File
@@ -564,9 +564,9 @@
<section-card title="客商材料">
<template #extra>
<div v-if="!readonly" class="section-actions">
<div class="section-actions">
<el-button icon="el-icon-download" @click="downloadAttachments">批量下载</el-button>
<el-button type="primary" icon="el-icon-upload" @click="addAttachment">
<el-button v-if="!readonly" type="primary" icon="el-icon-upload" @click="addAttachment">
OCR上传识别
</el-button>
</div>
@@ -1860,7 +1860,7 @@ export default {
const page = this.changeRecordPage;
getChangeRecordList(this.archiveForm.id, page.currentPage, page.pageSize).then(res => {
const data = res.data.data || {};
page.records = data.records || [];
page.records = this.replaceNegativeOneWithBlank(data.records || []);
page.total = Number(data.total || 0);
page.currentPage = Number(data.current || page.currentPage);
});
@@ -1883,10 +1883,11 @@ export default {
return (this.changeRecordPage.currentPage - 1) * this.changeRecordPage.pageSize + index + 1;
},
formatChangeData(row, column, value) {
if (!value) return '-';
if (!value || value === '-1') return '';
try {
return Object.entries(JSON.parse(value))
.map(([field, fieldValue]) => `${field}${fieldValue ?? '-'}`)
const data = this.replaceNegativeOneWithBlank(JSON.parse(value));
return Object.entries(data)
.map(([field, fieldValue]) => `${field}${fieldValue ?? ''}`)
.join('');
} catch (error) {
return value;
@@ -2866,6 +2867,19 @@ export default {
handleQualificationSelectionChange(rows) {
this.selectedQualificationFiles = rows || [];
},
replaceNegativeOneWithBlank(value) {
if (value === -1 || value === '-1') return '';
if (Array.isArray(value)) {
return value.map(item => this.replaceNegativeOneWithBlank(item));
}
if (value && typeof value === 'object') {
return Object.keys(value).reduce((result, key) => {
result[key] = this.replaceNegativeOneWithBlank(value[key]);
return result;
}, {});
}
return value;
},
normalizeDetail(detail) {
const businessScope = this.splitValue(detail.businessScope);
const registeredDetailAddress =
@@ -2970,12 +2984,15 @@ export default {
this.resetChangeRecordPage();
if (row && row.id) {
getDetail(row.id).then(res => {
this.archiveForm = this.normalizeDetail(res.data.data);
const archive = this.normalizeDetail(res.data.data);
this.archiveForm = readonly ? this.replaceNegativeOneWithBlank(archive) : archive;
this.originalAccessType = this.archiveForm.accessType || '';
this.qualificationFiles = this.parseAttachments(
this.archiveForm.qualificationAttachments
);
const qualificationFiles = this.parseAttachments(this.archiveForm.qualificationAttachments);
this.qualificationFiles = readonly
? this.replaceNegativeOneWithBlank(qualificationFiles)
: qualificationFiles;
this.qualificationUploadFiles = [];
this.selectedQualificationFiles = [];
this.archiveBox = true;
this.loadChangeRecords();
});
@@ -3516,7 +3533,9 @@ export default {
this.handleScoreCurrentChange(1);
},
formatScoreValue(value) {
return value === undefined || value === null || value === '' ? '' : value;
return value === undefined || value === null || value === '' || value === -1 || value === '-1'
? ''
: value;
},
rowDel(row) {
this.$confirm('仅草稿状态客商可删除,确定删除该数据?', {