⚡ 优化表格工具栏、附件文件名展示与合同金额两位小数
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -525,6 +525,7 @@
|
||||
placeholder="请输入"
|
||||
clearable
|
||||
@input="handleContractAmountInput"
|
||||
@blur="formatContractAmountField"
|
||||
@clear="form.contractAmount = null"
|
||||
/>
|
||||
</el-form-item>
|
||||
@@ -1098,6 +1099,19 @@ const normalizeOptionalAmount = (value, emptyValue = null) => {
|
||||
const number = Number(value);
|
||||
return Number.isFinite(number) && number >= 0 ? Number(number.toFixed(2)) : emptyValue;
|
||||
};
|
||||
const formatContractAmountInput = (value, emptyValue = null) => {
|
||||
if (
|
||||
value === undefined ||
|
||||
value === null ||
|
||||
value === '' ||
|
||||
Number(value) === -1 ||
|
||||
String(value) === '-1'
|
||||
) {
|
||||
return emptyValue;
|
||||
}
|
||||
const number = Number(value);
|
||||
return Number.isFinite(number) && number >= 0 ? number.toFixed(2) : emptyValue;
|
||||
};
|
||||
const normalizeProjectValue = value => {
|
||||
if (value === undefined || value === null || value === '' || String(value) === '-1') return '';
|
||||
return value;
|
||||
@@ -1794,7 +1808,7 @@ export default {
|
||||
copyCount: normalizeOptionalInteger(detail.copyCount, ''),
|
||||
invoiceCycle: normalizeOptionalInteger(detail.invoiceCycle, ''),
|
||||
paymentDays: normalizeOptionalInteger(detail.paymentDays, ''),
|
||||
contractAmount: normalizeOptionalAmount(detail.contractAmount, null),
|
||||
contractAmount: formatContractAmountInput(detail.contractAmount, null),
|
||||
archiveStatus: detail.archiveStatus || '未归档',
|
||||
feeGenerationMode:
|
||||
detail.feeGenerationMode || (Number(detail.billingEnabled) === 0 ? 'manual' : 'system'),
|
||||
@@ -2356,6 +2370,9 @@ export default {
|
||||
parts.length > 1 ? `${parts[0]}.${parts.slice(1).join('').slice(0, 2)}` : parts[0];
|
||||
this.form.contractAmount = normalized === '' ? null : normalized;
|
||||
},
|
||||
formatContractAmountField() {
|
||||
this.form.contractAmount = formatContractAmountInput(this.form.contractAmount, null);
|
||||
},
|
||||
positiveIntegerInput(prop, value) {
|
||||
const normalized = String(value || '').replace(/\D/g, '').replace(/^0+/, '');
|
||||
this.form[prop] = normalized;
|
||||
@@ -2929,13 +2946,8 @@ export default {
|
||||
detailValue(prop) {
|
||||
const value = this.detailRow[prop];
|
||||
if (prop === 'contractAmount') {
|
||||
return value === undefined ||
|
||||
value === null ||
|
||||
value === '' ||
|
||||
Number(value) === -1 ||
|
||||
String(value) === '-1'
|
||||
? '-'
|
||||
: value;
|
||||
const amountText = formatContractAmountInput(value, '');
|
||||
return amountText === '' ? '-' : amountText;
|
||||
}
|
||||
if (
|
||||
prop === 'contractStage' ||
|
||||
@@ -3248,7 +3260,11 @@ export default {
|
||||
|
||||
&__remark {
|
||||
width: 100%;
|
||||
margin-bottom: 0 !important;
|
||||
margin-bottom: 24px !important;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
&__date-range {
|
||||
|
||||
Reference in New Issue
Block a user