diff --git a/src/option/business/project-apply.js b/src/option/business/project-apply.js index 9b3168f..998e5b8 100644 --- a/src/option/business/project-apply.js +++ b/src/option/business/project-apply.js @@ -2,7 +2,6 @@ import { auditColumns, businessTypeOptions, createCrudOption, - effectiveTypeOptions, nonNegativeRule, projectApprovalStatusOptions, projectSourceOptions, @@ -12,6 +11,11 @@ import { textRule, } from './common'; +const projectEffectiveTypeOptions = [ + { label: '临时', value: 'temporary' }, + { label: '正式', value: 'formal' }, +]; + const amountRules = label => [ { required: true, message: `请输入${label}`, trigger: 'blur' }, nonNegativeRule(label), @@ -379,7 +383,7 @@ export const option = createCrudOption([ search: true, searchPlaceholder: '请选择', searchOrder: 1, - dicData: effectiveTypeOptions, + dicData: projectEffectiveTypeOptions, value: 'temporary', minWidth: 110, }, diff --git a/src/views/base/port-terminal.vue b/src/views/base/port-terminal.vue index c7cfc99..fb109eb 100644 --- a/src/views/base/port-terminal.vue +++ b/src/views/base/port-terminal.vue @@ -373,7 +373,7 @@ export default { searchOrder: 6, formslot: true, span: 24, - order: 100, + order: 102, dicData: [ { label: '全部', value: '' }, { label: '港口', value: '港口' }, diff --git a/src/views/business/components/business-crud-page.vue b/src/views/business/components/business-crud-page.vue index e7ffd1f..715ac44 100644 --- a/src/views/business/components/business-crud-page.vue +++ b/src/views/business/components/business-crud-page.vue @@ -10125,10 +10125,14 @@ export default { downloadFileByUrl(url, this.attachmentName(row)); }, handleBatchDownload() { - const rows = this.selectedAttachmentRows.length - ? this.selectedAttachmentRows - : this.attachmentRows; - rows.forEach(row => this.downloadAttachment(row)); + const rows = this.isShippingTemplatePage + ? this.attachmentRows + : this.selectedAttachmentRows.length + ? this.selectedAttachmentRows + : this.attachmentRows; + rows.forEach((row, index) => { + window.setTimeout(() => this.downloadAttachment(row), index * 200); + }); }, handleDispatchItemAttachmentChange(list) { const userName = this.userInfo?.realName || this.userInfo?.userName || ''; diff --git a/src/views/vehicle/credit-score-quantification.vue b/src/views/vehicle/credit-score-quantification.vue index dee1899..ef6f308 100644 --- a/src/views/vehicle/credit-score-quantification.vue +++ b/src/views/vehicle/credit-score-quantification.vue @@ -467,6 +467,15 @@ const createTimeRangeMap = { createTimeRange: ['createTimeStart', 'createTimeEnd'], }; +const standardNumberFields = [ + 'scoreRateLower', + 'scoreRateUpper', + 'scoreRateIncrease', + 'creditLimitLower', + 'creditLimitUpper', + 'creditLimitIncrease', +]; + export default { data() { return { @@ -657,14 +666,7 @@ export default { (detail.categories || []).forEach(category => { map[category.categoryCode] = { ...category, - items: (category.items || []).map(item => ({ - ...item, - optionType: this.normalizeOptionType(item.optionType), - options: - item.options && item.options.length - ? item.options.map(option => this.normalizeOption(option)) - : [this.emptyOption()], - })), + items: (category.items || []).map(item => this.normalizeItem(item)), }; }); return { @@ -673,7 +675,7 @@ export default { ...(map[category.categoryCode] || category), categoryName: category.categoryName, })), - standards: detail.standards || [], + standards: (detail.standards || []).map(standard => this.normalizeStandard(standard)), }; }, openConfig(row, readonly = false) { @@ -710,13 +712,16 @@ export default { return value === 'score' || value === 2 || String(value) === 'score' ? 'score' : 'option'; }, normalizeItem(item = {}) { + const normalized = { ...this.emptyItem(), ...item }; + const score = Number(this.normalizePlainDecimal(normalized.score)); return { - ...this.emptyItem(), - ...item, - optionType: this.normalizeOptionType(item.optionType), + ...normalized, + score: Number.isFinite(score) ? score : normalized.score, + baseValue: this.normalizePlainDecimal(normalized.baseValue), + optionType: this.normalizeOptionType(normalized.optionType), options: - item.options && item.options.length - ? item.options.map(option => this.normalizeOption(option)) + normalized.options && normalized.options.length + ? normalized.options.map(option => this.normalizeOption(option)) : [this.emptyOption()], }; }, @@ -724,6 +729,8 @@ export default { const normalized = { ...this.emptyOption(), ...option }; return { ...normalized, + score: this.normalizePlainDecimal(normalized.score), + changeValue: this.normalizePlainDecimal(normalized.changeValue), changeType: normalized.changeType === 'decrease' || normalized.changeType === '每减少' || @@ -738,6 +745,35 @@ export default { : '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) { this.itemForm.optionType = this.normalizeOptionType(value); this.itemForm.options = (this.itemForm.options || []).map(option => @@ -770,6 +806,10 @@ export default { (payload.categories || []).forEach(category => { (category.items || []).forEach(item => { item.score = this.toScoreValue(item.score); + item.baseValue = + this.normalizeOptionType(item.optionType) === 'score' + ? this.normalizePlainDecimal(item.baseValue) + : null; (item.options || []).forEach(option => { option.score = this.toScoreValue(option.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; }, hasDuplicateItemName(itemName, currentIndex = -1) { @@ -844,7 +889,8 @@ export default { const item = JSON.parse(JSON.stringify(this.itemForm)); item.itemName = String(item.itemName || '').trim(); 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 => ({ ...option, optionName: String(option.optionName || '').trim(), @@ -874,7 +920,9 @@ export default { }, openStandard(row, index = -1) { 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; }, hasDuplicateCreditLevel(creditLevel, currentIndex = -1) { @@ -943,14 +991,7 @@ export default { } const standard = JSON.parse(JSON.stringify(this.standardForm)); standard.creditLevel = String(standard.creditLevel || '').trim(); - [ - 'scoreRateLower', - 'scoreRateUpper', - 'scoreRateIncrease', - 'creditLimitLower', - 'creditLimitUpper', - 'creditLimitIncrease', - ].forEach(field => { + standardNumberFields.forEach(field => { standard[field] = Number(standard[field]); }); const nextStandards = JSON.parse(JSON.stringify(this.configForm.standards)); @@ -1130,14 +1171,6 @@ export default { this.$message.warning('发布前至少配置1条信用等级评估标准'); return false; } - const requiredFields = [ - 'scoreRateLower', - 'scoreRateUpper', - 'scoreRateIncrease', - 'creditLimitLower', - 'creditLimitUpper', - 'creditLimitIncrease', - ]; for (const standard of standards) { if (!standard.creditLevel) { this.$message.warning('评估标准中的信用等级不能为空'); @@ -1147,7 +1180,7 @@ export default { this.$message.warning('评估标准中的信用等级只能选择A/B/C/D/E/F'); return false; } - if (requiredFields.some(field => this.isBlankValue(standard[field]))) { + if (standardNumberFields.some(field => this.isBlankValue(standard[field]))) { this.$message.warning(`${standard.creditLevel}信用等级评估标准必填项未填写完整`); return false; }