fix bug
This commit is contained in:
@@ -2,7 +2,6 @@ import {
|
|||||||
auditColumns,
|
auditColumns,
|
||||||
businessTypeOptions,
|
businessTypeOptions,
|
||||||
createCrudOption,
|
createCrudOption,
|
||||||
effectiveTypeOptions,
|
|
||||||
nonNegativeRule,
|
nonNegativeRule,
|
||||||
projectApprovalStatusOptions,
|
projectApprovalStatusOptions,
|
||||||
projectSourceOptions,
|
projectSourceOptions,
|
||||||
@@ -12,6 +11,11 @@ import {
|
|||||||
textRule,
|
textRule,
|
||||||
} from './common';
|
} from './common';
|
||||||
|
|
||||||
|
const projectEffectiveTypeOptions = [
|
||||||
|
{ label: '临时', value: 'temporary' },
|
||||||
|
{ label: '正式', value: 'formal' },
|
||||||
|
];
|
||||||
|
|
||||||
const amountRules = label => [
|
const amountRules = label => [
|
||||||
{ required: true, message: `请输入${label}`, trigger: 'blur' },
|
{ required: true, message: `请输入${label}`, trigger: 'blur' },
|
||||||
nonNegativeRule(label),
|
nonNegativeRule(label),
|
||||||
@@ -379,7 +383,7 @@ export const option = createCrudOption([
|
|||||||
search: true,
|
search: true,
|
||||||
searchPlaceholder: '请选择',
|
searchPlaceholder: '请选择',
|
||||||
searchOrder: 1,
|
searchOrder: 1,
|
||||||
dicData: effectiveTypeOptions,
|
dicData: projectEffectiveTypeOptions,
|
||||||
value: 'temporary',
|
value: 'temporary',
|
||||||
minWidth: 110,
|
minWidth: 110,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -373,7 +373,7 @@ export default {
|
|||||||
searchOrder: 6,
|
searchOrder: 6,
|
||||||
formslot: true,
|
formslot: true,
|
||||||
span: 24,
|
span: 24,
|
||||||
order: 100,
|
order: 102,
|
||||||
dicData: [
|
dicData: [
|
||||||
{ label: '全部', value: '' },
|
{ label: '全部', value: '' },
|
||||||
{ label: '港口', value: '港口' },
|
{ label: '港口', value: '港口' },
|
||||||
|
|||||||
@@ -10125,10 +10125,14 @@ export default {
|
|||||||
downloadFileByUrl(url, this.attachmentName(row));
|
downloadFileByUrl(url, this.attachmentName(row));
|
||||||
},
|
},
|
||||||
handleBatchDownload() {
|
handleBatchDownload() {
|
||||||
const rows = this.selectedAttachmentRows.length
|
const rows = this.isShippingTemplatePage
|
||||||
|
? this.attachmentRows
|
||||||
|
: this.selectedAttachmentRows.length
|
||||||
? this.selectedAttachmentRows
|
? this.selectedAttachmentRows
|
||||||
: this.attachmentRows;
|
: this.attachmentRows;
|
||||||
rows.forEach(row => this.downloadAttachment(row));
|
rows.forEach((row, index) => {
|
||||||
|
window.setTimeout(() => this.downloadAttachment(row), index * 200);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
handleDispatchItemAttachmentChange(list) {
|
handleDispatchItemAttachmentChange(list) {
|
||||||
const userName = this.userInfo?.realName || this.userInfo?.userName || '';
|
const userName = this.userInfo?.realName || this.userInfo?.userName || '';
|
||||||
|
|||||||
@@ -467,6 +467,15 @@ const createTimeRangeMap = {
|
|||||||
createTimeRange: ['createTimeStart', 'createTimeEnd'],
|
createTimeRange: ['createTimeStart', 'createTimeEnd'],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const standardNumberFields = [
|
||||||
|
'scoreRateLower',
|
||||||
|
'scoreRateUpper',
|
||||||
|
'scoreRateIncrease',
|
||||||
|
'creditLimitLower',
|
||||||
|
'creditLimitUpper',
|
||||||
|
'creditLimitIncrease',
|
||||||
|
];
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -657,14 +666,7 @@ export default {
|
|||||||
(detail.categories || []).forEach(category => {
|
(detail.categories || []).forEach(category => {
|
||||||
map[category.categoryCode] = {
|
map[category.categoryCode] = {
|
||||||
...category,
|
...category,
|
||||||
items: (category.items || []).map(item => ({
|
items: (category.items || []).map(item => this.normalizeItem(item)),
|
||||||
...item,
|
|
||||||
optionType: this.normalizeOptionType(item.optionType),
|
|
||||||
options:
|
|
||||||
item.options && item.options.length
|
|
||||||
? item.options.map(option => this.normalizeOption(option))
|
|
||||||
: [this.emptyOption()],
|
|
||||||
})),
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
@@ -673,7 +675,7 @@ export default {
|
|||||||
...(map[category.categoryCode] || category),
|
...(map[category.categoryCode] || category),
|
||||||
categoryName: category.categoryName,
|
categoryName: category.categoryName,
|
||||||
})),
|
})),
|
||||||
standards: detail.standards || [],
|
standards: (detail.standards || []).map(standard => this.normalizeStandard(standard)),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
openConfig(row, readonly = false) {
|
openConfig(row, readonly = false) {
|
||||||
@@ -710,13 +712,16 @@ export default {
|
|||||||
return value === 'score' || value === 2 || String(value) === 'score' ? 'score' : 'option';
|
return value === 'score' || value === 2 || String(value) === 'score' ? 'score' : 'option';
|
||||||
},
|
},
|
||||||
normalizeItem(item = {}) {
|
normalizeItem(item = {}) {
|
||||||
|
const normalized = { ...this.emptyItem(), ...item };
|
||||||
|
const score = Number(this.normalizePlainDecimal(normalized.score));
|
||||||
return {
|
return {
|
||||||
...this.emptyItem(),
|
...normalized,
|
||||||
...item,
|
score: Number.isFinite(score) ? score : normalized.score,
|
||||||
optionType: this.normalizeOptionType(item.optionType),
|
baseValue: this.normalizePlainDecimal(normalized.baseValue),
|
||||||
|
optionType: this.normalizeOptionType(normalized.optionType),
|
||||||
options:
|
options:
|
||||||
item.options && item.options.length
|
normalized.options && normalized.options.length
|
||||||
? item.options.map(option => this.normalizeOption(option))
|
? normalized.options.map(option => this.normalizeOption(option))
|
||||||
: [this.emptyOption()],
|
: [this.emptyOption()],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@@ -724,6 +729,8 @@ export default {
|
|||||||
const normalized = { ...this.emptyOption(), ...option };
|
const normalized = { ...this.emptyOption(), ...option };
|
||||||
return {
|
return {
|
||||||
...normalized,
|
...normalized,
|
||||||
|
score: this.normalizePlainDecimal(normalized.score),
|
||||||
|
changeValue: this.normalizePlainDecimal(normalized.changeValue),
|
||||||
changeType:
|
changeType:
|
||||||
normalized.changeType === 'decrease' ||
|
normalized.changeType === 'decrease' ||
|
||||||
normalized.changeType === '每减少' ||
|
normalized.changeType === '每减少' ||
|
||||||
@@ -738,6 +745,35 @@ export default {
|
|||||||
: 'add',
|
: 'add',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
normalizePlainDecimal(value) {
|
||||||
|
if (value === undefined || value === null || value === '') return '';
|
||||||
|
const text = String(value).trim();
|
||||||
|
const matched = text.match(/^([+-]?)(\d+)(?:\.(\d*))?[eE]([+-]?\d+)$/);
|
||||||
|
if (!matched) return text;
|
||||||
|
const [, sign, integer, decimal = '', exponentText] = matched;
|
||||||
|
const exponent = Number(exponentText);
|
||||||
|
const digits = `${integer}${decimal}`;
|
||||||
|
const decimalIndex = integer.length + exponent;
|
||||||
|
const resultLength =
|
||||||
|
decimalIndex <= 0 ? 2 - decimalIndex + digits.length : Math.max(decimalIndex, digits.length);
|
||||||
|
if (!Number.isSafeInteger(exponent) || resultLength > 1000) return text;
|
||||||
|
let result;
|
||||||
|
if (decimalIndex <= 0) {
|
||||||
|
result = `0.${'0'.repeat(-decimalIndex)}${digits}`;
|
||||||
|
} else if (decimalIndex >= digits.length) {
|
||||||
|
result = `${digits}${'0'.repeat(decimalIndex - digits.length)}`;
|
||||||
|
} else {
|
||||||
|
result = `${digits.slice(0, decimalIndex)}.${digits.slice(decimalIndex)}`;
|
||||||
|
}
|
||||||
|
return `${sign === '-' ? '-' : ''}${result}`;
|
||||||
|
},
|
||||||
|
normalizeStandard(standard = {}) {
|
||||||
|
const normalized = { ...this.emptyStandard(), ...standard };
|
||||||
|
standardNumberFields.forEach(field => {
|
||||||
|
normalized[field] = this.normalizePlainDecimal(normalized[field]);
|
||||||
|
});
|
||||||
|
return normalized;
|
||||||
|
},
|
||||||
handleOptionTypeChange(value) {
|
handleOptionTypeChange(value) {
|
||||||
this.itemForm.optionType = this.normalizeOptionType(value);
|
this.itemForm.optionType = this.normalizeOptionType(value);
|
||||||
this.itemForm.options = (this.itemForm.options || []).map(option =>
|
this.itemForm.options = (this.itemForm.options || []).map(option =>
|
||||||
@@ -770,6 +806,10 @@ export default {
|
|||||||
(payload.categories || []).forEach(category => {
|
(payload.categories || []).forEach(category => {
|
||||||
(category.items || []).forEach(item => {
|
(category.items || []).forEach(item => {
|
||||||
item.score = this.toScoreValue(item.score);
|
item.score = this.toScoreValue(item.score);
|
||||||
|
item.baseValue =
|
||||||
|
this.normalizeOptionType(item.optionType) === 'score'
|
||||||
|
? this.normalizePlainDecimal(item.baseValue)
|
||||||
|
: null;
|
||||||
(item.options || []).forEach(option => {
|
(item.options || []).forEach(option => {
|
||||||
option.score = this.toScoreValue(option.score);
|
option.score = this.toScoreValue(option.score);
|
||||||
if (this.normalizeOptionType(item.optionType) === 'score') {
|
if (this.normalizeOptionType(item.optionType) === 'score') {
|
||||||
@@ -778,6 +818,11 @@ export default {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
(payload.standards || []).forEach(standard => {
|
||||||
|
standardNumberFields.forEach(field => {
|
||||||
|
standard[field] = this.normalizePlainDecimal(standard[field]);
|
||||||
|
});
|
||||||
|
});
|
||||||
return payload;
|
return payload;
|
||||||
},
|
},
|
||||||
hasDuplicateItemName(itemName, currentIndex = -1) {
|
hasDuplicateItemName(itemName, currentIndex = -1) {
|
||||||
@@ -844,7 +889,8 @@ export default {
|
|||||||
const item = JSON.parse(JSON.stringify(this.itemForm));
|
const item = JSON.parse(JSON.stringify(this.itemForm));
|
||||||
item.itemName = String(item.itemName || '').trim();
|
item.itemName = String(item.itemName || '').trim();
|
||||||
item.optionType = this.normalizeOptionType(item.optionType);
|
item.optionType = this.normalizeOptionType(item.optionType);
|
||||||
item.baseValue = item.optionType === 'score' ? String(item.baseValue).trim() : null;
|
item.baseValue =
|
||||||
|
item.optionType === 'score' ? this.normalizePlainDecimal(item.baseValue) : null;
|
||||||
item.options = item.options.map(option => ({
|
item.options = item.options.map(option => ({
|
||||||
...option,
|
...option,
|
||||||
optionName: String(option.optionName || '').trim(),
|
optionName: String(option.optionName || '').trim(),
|
||||||
@@ -874,7 +920,9 @@ export default {
|
|||||||
},
|
},
|
||||||
openStandard(row, index = -1) {
|
openStandard(row, index = -1) {
|
||||||
this.currentStandardIndex = index;
|
this.currentStandardIndex = index;
|
||||||
this.standardForm = row ? JSON.parse(JSON.stringify(row)) : this.emptyStandard();
|
this.standardForm = row
|
||||||
|
? this.normalizeStandard(JSON.parse(JSON.stringify(row)))
|
||||||
|
: this.emptyStandard();
|
||||||
this.standardBox = true;
|
this.standardBox = true;
|
||||||
},
|
},
|
||||||
hasDuplicateCreditLevel(creditLevel, currentIndex = -1) {
|
hasDuplicateCreditLevel(creditLevel, currentIndex = -1) {
|
||||||
@@ -943,14 +991,7 @@ export default {
|
|||||||
}
|
}
|
||||||
const standard = JSON.parse(JSON.stringify(this.standardForm));
|
const standard = JSON.parse(JSON.stringify(this.standardForm));
|
||||||
standard.creditLevel = String(standard.creditLevel || '').trim();
|
standard.creditLevel = String(standard.creditLevel || '').trim();
|
||||||
[
|
standardNumberFields.forEach(field => {
|
||||||
'scoreRateLower',
|
|
||||||
'scoreRateUpper',
|
|
||||||
'scoreRateIncrease',
|
|
||||||
'creditLimitLower',
|
|
||||||
'creditLimitUpper',
|
|
||||||
'creditLimitIncrease',
|
|
||||||
].forEach(field => {
|
|
||||||
standard[field] = Number(standard[field]);
|
standard[field] = Number(standard[field]);
|
||||||
});
|
});
|
||||||
const nextStandards = JSON.parse(JSON.stringify(this.configForm.standards));
|
const nextStandards = JSON.parse(JSON.stringify(this.configForm.standards));
|
||||||
@@ -1130,14 +1171,6 @@ export default {
|
|||||||
this.$message.warning('发布前至少配置1条信用等级评估标准');
|
this.$message.warning('发布前至少配置1条信用等级评估标准');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const requiredFields = [
|
|
||||||
'scoreRateLower',
|
|
||||||
'scoreRateUpper',
|
|
||||||
'scoreRateIncrease',
|
|
||||||
'creditLimitLower',
|
|
||||||
'creditLimitUpper',
|
|
||||||
'creditLimitIncrease',
|
|
||||||
];
|
|
||||||
for (const standard of standards) {
|
for (const standard of standards) {
|
||||||
if (!standard.creditLevel) {
|
if (!standard.creditLevel) {
|
||||||
this.$message.warning('评估标准中的信用等级不能为空');
|
this.$message.warning('评估标准中的信用等级不能为空');
|
||||||
@@ -1147,7 +1180,7 @@ export default {
|
|||||||
this.$message.warning('评估标准中的信用等级只能选择A/B/C/D/E/F');
|
this.$message.warning('评估标准中的信用等级只能选择A/B/C/D/E/F');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (requiredFields.some(field => this.isBlankValue(standard[field]))) {
|
if (standardNumberFields.some(field => this.isBlankValue(standard[field]))) {
|
||||||
this.$message.warning(`${standard.creditLevel}信用等级评估标准必填项未填写完整`);
|
this.$message.warning(`${standard.creditLevel}信用等级评估标准必填项未填写完整`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user