fix bug
This commit is contained in:
@@ -157,31 +157,31 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="业务部门" prop="businessDeptId">
|
||||
<el-select
|
||||
<el-tree-select
|
||||
v-model="form.businessDeptId"
|
||||
:data="businessDeptTreeOptions"
|
||||
:props="deptTreeSelectProps"
|
||||
node-key="value"
|
||||
placeholder="请选择业务部门"
|
||||
check-strictly
|
||||
filterable
|
||||
clearable
|
||||
:render-after-expand="false"
|
||||
:disabled="isBasicInfoReadonly"
|
||||
@change="handleBusinessDeptChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in deptOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="承办部门" prop="undertakeDeptId">
|
||||
<el-cascader
|
||||
<el-tree-select
|
||||
v-model="form.undertakeDeptId"
|
||||
style="width: 100%"
|
||||
:data="deptTreeOptions"
|
||||
:props="deptTreeSelectProps"
|
||||
node-key="value"
|
||||
placeholder="请选择承办部门"
|
||||
check-strictly
|
||||
clearable
|
||||
filterable
|
||||
:options="deptTreeOptions"
|
||||
:props="deptCascaderProps"
|
||||
:render-after-expand="false"
|
||||
:disabled="isBasicInfoReadonly"
|
||||
@change="handleUndertakeDeptChange"
|
||||
/>
|
||||
@@ -823,6 +823,15 @@ const emptyForm = () => ({
|
||||
changeReason: '',
|
||||
});
|
||||
|
||||
const optionalSentinelFields = [
|
||||
'projectScale',
|
||||
'estimatedProfit',
|
||||
'fundDemand',
|
||||
'receivableDays',
|
||||
'paymentDays',
|
||||
'cargoQuantity',
|
||||
];
|
||||
|
||||
const changeTypeOptions = [
|
||||
{ label: '项目变更', value: '项目变更' },
|
||||
{ label: '项目备案调整', value: '项目备案调整' },
|
||||
@@ -885,7 +894,7 @@ export default {
|
||||
};
|
||||
const validateDays = (rule, value, callback) => {
|
||||
if (value === '' || value === undefined || value === null) {
|
||||
callback(new Error(`请输入${rule.label}`));
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
const number = Number(value);
|
||||
@@ -961,10 +970,10 @@ export default {
|
||||
},
|
||||
],
|
||||
receivableDays: [
|
||||
{ required: true, label: '应收账款回款期限', validator: validateDays, trigger: 'blur' },
|
||||
{ label: '应收账款回款期限', validator: validateDays, trigger: 'blur' },
|
||||
],
|
||||
paymentDays: [
|
||||
{ required: true, label: '回款账期', validator: validateDays, trigger: 'blur' },
|
||||
{ label: '回款账期', validator: validateDays, trigger: 'blur' },
|
||||
],
|
||||
projectScale: [{ label: '项目规模', validator: validateAmount, trigger: 'blur' }],
|
||||
estimatedProfit: [{ label: '预估利润', validator: validateAmount, trigger: 'blur' }],
|
||||
@@ -997,13 +1006,12 @@ export default {
|
||||
],
|
||||
},
|
||||
deptOptions: [],
|
||||
businessDeptTreeOptions: [],
|
||||
deptTreeOptions: [],
|
||||
deptCascaderProps: {
|
||||
deptTreeSelectProps: {
|
||||
label: 'label',
|
||||
value: 'value',
|
||||
children: 'children',
|
||||
emitPath: false,
|
||||
checkStrictly: true,
|
||||
},
|
||||
cargoTypeOptions: [],
|
||||
selectedCustomerId: [],
|
||||
@@ -1415,13 +1423,12 @@ export default {
|
||||
...row,
|
||||
fundLimit: this.formatAmount(row.fundLimit),
|
||||
receivableLimit: this.formatAmount(row.receivableLimit),
|
||||
...(this.dialogReadonly
|
||||
? {
|
||||
projectScale: this.normalizeReadonlyAmount(row.projectScale),
|
||||
estimatedProfit: this.normalizeReadonlyAmount(row.estimatedProfit),
|
||||
fundDemand: this.normalizeReadonlyAmount(row.fundDemand),
|
||||
}
|
||||
: {}),
|
||||
projectScale: this.normalizeOptionalSentinel(row.projectScale),
|
||||
estimatedProfit: this.normalizeOptionalSentinel(row.estimatedProfit),
|
||||
fundDemand: this.normalizeOptionalSentinel(row.fundDemand),
|
||||
receivableDays: this.normalizeOptionalSentinel(row.receivableDays),
|
||||
paymentDays: this.normalizeOptionalSentinel(row.paymentDays),
|
||||
cargoQuantity: this.normalizeOptionalSentinel(row.cargoQuantity),
|
||||
};
|
||||
const form = {
|
||||
...emptyForm(),
|
||||
@@ -1589,6 +1596,9 @@ export default {
|
||||
...this.form,
|
||||
fundLimit: this.formatAmount(this.form.fundLimit),
|
||||
receivableLimit: this.formatAmount(this.form.receivableLimit),
|
||||
...Object.fromEntries(
|
||||
optionalSentinelFields.map(key => [key, this.normalizeOptionalSentinel(this.form[key], null)])
|
||||
),
|
||||
businessStartDate,
|
||||
businessEndDate,
|
||||
customerJson: JSON.stringify(this.customerRows),
|
||||
@@ -1732,8 +1742,11 @@ export default {
|
||||
.filter(Boolean);
|
||||
},
|
||||
normalizeReadonlyAmount(value) {
|
||||
return this.normalizeOptionalSentinel(value);
|
||||
},
|
||||
normalizeOptionalSentinel(value, emptyValue = '') {
|
||||
return value === null || value === undefined || value === '' || Number(value) === -1
|
||||
? ''
|
||||
? emptyValue
|
||||
: value;
|
||||
},
|
||||
mergeCustomerOptions(options = [], selectedOptions = []) {
|
||||
@@ -1789,9 +1802,13 @@ export default {
|
||||
loadDeptOptions() {
|
||||
getDeptTree().then(res => {
|
||||
const deptTree = res.data.data || [];
|
||||
const businessDeptTree = ['add', 'edit'].includes(this.dialogType)
|
||||
? this.excludeExternalOrganization(deptTree)
|
||||
: deptTree;
|
||||
const undertakeDeptTree =
|
||||
this.dialogType === 'add' ? this.excludeExternalOrganization(deptTree) : deptTree;
|
||||
this.deptOptions = this.flattenDept(deptTree);
|
||||
this.deptOptions = this.flattenDept(businessDeptTree);
|
||||
this.businessDeptTreeOptions = this.toDeptCascaderOptions(businessDeptTree);
|
||||
this.deptTreeOptions = this.toDeptCascaderOptions(undertakeDeptTree);
|
||||
});
|
||||
},
|
||||
@@ -1852,7 +1869,9 @@ export default {
|
||||
getCustomerArchiveList(1, 100, {
|
||||
customerType: type,
|
||||
status: 1,
|
||||
...(type === '客户' ? { approvalStatus: 'approved' } : {}),
|
||||
...(this.dialogType !== 'add' && type === '客户'
|
||||
? { approvalStatus: 'approved' }
|
||||
: {}),
|
||||
})
|
||||
.then(res => {
|
||||
const records = (res.data.data && res.data.data.records) || [];
|
||||
@@ -1934,6 +1953,10 @@ export default {
|
||||
return row;
|
||||
},
|
||||
handleNumberInput(prop, value) {
|
||||
if (optionalSentinelFields.includes(prop) && Number(value) === -1) {
|
||||
this.form[prop] = '';
|
||||
return;
|
||||
}
|
||||
const text = String(value || '').replace(/[^\d.]/g, '');
|
||||
const parts = text.split('.');
|
||||
this.form[prop] =
|
||||
@@ -1948,6 +1971,10 @@ export default {
|
||||
this.form[prop] = this.formatAmount(this.form[prop]);
|
||||
},
|
||||
handleIntegerInput(prop, value) {
|
||||
if (optionalSentinelFields.includes(prop) && Number(value) === -1) {
|
||||
this.form[prop] = '';
|
||||
return;
|
||||
}
|
||||
this.form[prop] = String(value || '').replace(/[^\d]/g, '');
|
||||
},
|
||||
handleAttachmentChange(list) {
|
||||
@@ -2098,6 +2125,7 @@ export default {
|
||||
|
||||
:deep(.el-input),
|
||||
:deep(.el-select),
|
||||
:deep(.el-tree-select),
|
||||
:deep(.el-date-editor) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user