车辆接口更新
This commit is contained in:
@ -25,12 +25,16 @@ export class UpdateFreightComponent implements OnInit {
|
||||
|
||||
@Input()
|
||||
data: any;
|
||||
freightTypeOptions: any;
|
||||
|
||||
calculateSub!: Subscription;
|
||||
constructor(private service: OrderManagementService, private modal: NzModalRef) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.schema = this.initSF(this.data);
|
||||
this.service.getDictByKey('freight:type').subscribe(res => {
|
||||
this.freightTypeOptions = res;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -39,134 +43,122 @@ export class UpdateFreightComponent implements OnInit {
|
||||
private initSF(data: any): SFSchema {
|
||||
return {
|
||||
properties: {
|
||||
dto: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
freightPrice: {
|
||||
type: 'number',
|
||||
title: '运费单价',
|
||||
minimum: 0,
|
||||
maximum: 99999,
|
||||
ui: {
|
||||
addOnAfter: data.freightTypeLabel,
|
||||
placeholder: '请输入',
|
||||
grid: {
|
||||
span: 12
|
||||
},
|
||||
change: (val: any) => this.changeNumVal()
|
||||
} as SFStringWidgetSchema,
|
||||
default: data.freightPrice
|
||||
},
|
||||
rule: {
|
||||
title: '',
|
||||
type: 'string',
|
||||
default: data.rule,
|
||||
enum: [
|
||||
{ label: '保留小数', value: '1' },
|
||||
{ label: '抹除小数', value: '2' },
|
||||
{ label: '抹除个数', value: '3' }
|
||||
],
|
||||
ui: {
|
||||
widget: 'select',
|
||||
spanLabelFixed: 10,
|
||||
grid: {
|
||||
span: 10
|
||||
}
|
||||
} as SFSelectWidgetSchema
|
||||
},
|
||||
settlementBasis: {
|
||||
title: '结算依据',
|
||||
type: 'string',
|
||||
default: data.settlementBasis,
|
||||
enum: [
|
||||
{ label: '以收货为准', value: '1' },
|
||||
{ label: '以发货为准', value: '2' }
|
||||
],
|
||||
ui: {
|
||||
widget: 'select',
|
||||
grid: {
|
||||
span: 12
|
||||
}
|
||||
} as SFSelectWidgetSchema
|
||||
},
|
||||
blank1: {
|
||||
title: '',
|
||||
type: 'string',
|
||||
ui: { widget: 'text', grid: { span: 12 }, class: 'input-back' },
|
||||
default: ' '
|
||||
},
|
||||
freightType: {
|
||||
title: '',
|
||||
type: 'string',
|
||||
ui: { hidden: true },
|
||||
default: data.freightType
|
||||
},
|
||||
acceptWeight: {
|
||||
type: 'number',
|
||||
title: '装货重量',
|
||||
default: data.acceptWeight,
|
||||
minimum: 0,
|
||||
maximum: 99999,
|
||||
ui: {
|
||||
unit: '吨',
|
||||
placeholder: '请输入',
|
||||
grid: {
|
||||
span: 12
|
||||
},
|
||||
hideStep: true,
|
||||
change: (val: any) => this.changeNumVal()
|
||||
} as SFNumberWidgetSchema
|
||||
},
|
||||
acceptVolume: {
|
||||
type: 'number',
|
||||
title: '装货体积',
|
||||
default: data.acceptVolume,
|
||||
minimum: 0,
|
||||
maximum: 99999,
|
||||
ui: {
|
||||
unit: '吨',
|
||||
placeholder: '请输入',
|
||||
grid: {
|
||||
span: 12
|
||||
},
|
||||
hideStep: true,
|
||||
change: (val: any) => this.changeNumVal()
|
||||
} as SFNumberWidgetSchema
|
||||
},
|
||||
settlementWeight: {
|
||||
type: 'number',
|
||||
title: '卸货重量',
|
||||
default: data.settlementWeight,
|
||||
minimum: 0,
|
||||
maximum: 99999,
|
||||
ui: {
|
||||
unit: '吨',
|
||||
placeholder: '请输入',
|
||||
grid: {
|
||||
span: 12
|
||||
},
|
||||
hideStep: true,
|
||||
change: (val: any) => this.changeNumVal()
|
||||
} as SFNumberWidgetSchema
|
||||
},
|
||||
settlementVolume: {
|
||||
type: 'number',
|
||||
title: '卸货体积',
|
||||
default: data.settlementVolume,
|
||||
minimum: 0,
|
||||
maximum: 99999,
|
||||
ui: {
|
||||
unit: '吨',
|
||||
placeholder: '请输入',
|
||||
grid: {
|
||||
span: 12
|
||||
},
|
||||
hideStep: true,
|
||||
change: (val: any) => this.changeNumVal()
|
||||
} as SFNumberWidgetSchema
|
||||
freightPrice: {
|
||||
type: 'number',
|
||||
title: '运费单价',
|
||||
ui: {
|
||||
placeholder: '请输入',
|
||||
widget: 'custom',
|
||||
grid: { span: 12 },
|
||||
change: (val: any) => this.changeNumVal()
|
||||
} as SFStringWidgetSchema,
|
||||
default: data.freightPrice
|
||||
},
|
||||
rule: {
|
||||
title: '',
|
||||
type: 'string',
|
||||
default: data.rule,
|
||||
enum: [
|
||||
{ label: '保留小数', value: '1' },
|
||||
{ label: '抹除小数', value: '2' },
|
||||
{ label: '抹除个数', value: '3' }
|
||||
],
|
||||
ui: {
|
||||
widget: 'select',
|
||||
spanLabelFixed: 10,
|
||||
grid: {
|
||||
span: 10
|
||||
}
|
||||
},
|
||||
required: ['freightPrice', 'settlementBasis']
|
||||
} as SFSelectWidgetSchema
|
||||
},
|
||||
settlementBasis: {
|
||||
title: '结算依据',
|
||||
type: 'string',
|
||||
default: data.settlementBasis,
|
||||
ui: {
|
||||
widget: 'dict-select',
|
||||
params: { dictKey: 'goodresource:settlement:type' },
|
||||
containsAllLabel: false,
|
||||
placeholder: '结算依据',
|
||||
errors: { required: '请选择结算依据' },
|
||||
grid: {span: 12}
|
||||
} as SFSelectWidgetSchema
|
||||
},
|
||||
blank1: {
|
||||
title: '',
|
||||
type: 'string',
|
||||
ui: { widget: 'text', grid: { span: 12 }, class: 'input-back' },
|
||||
default: ' '
|
||||
},
|
||||
freightType: {
|
||||
title: '',
|
||||
type: 'string',
|
||||
ui: { hidden: true },
|
||||
default: data.freightType
|
||||
},
|
||||
acceptWeight: {
|
||||
type: 'number',
|
||||
title: '装货重量',
|
||||
default: data.loadWeight || 0,
|
||||
minimum: 0,
|
||||
maximum: 99999,
|
||||
ui: {
|
||||
unit: '吨',
|
||||
placeholder: '请输入',
|
||||
grid: {
|
||||
span: 12
|
||||
},
|
||||
hideStep: true,
|
||||
change: (val: any) => this.changeNumVal()
|
||||
} as SFNumberWidgetSchema
|
||||
},
|
||||
acceptVolume: {
|
||||
type: 'number',
|
||||
title: '装货体积',
|
||||
default: data.loadVolume || 0,
|
||||
minimum: 0,
|
||||
maximum: 99999,
|
||||
ui: {
|
||||
unit: '方',
|
||||
placeholder: '请输入',
|
||||
grid: {
|
||||
span: 12
|
||||
},
|
||||
hideStep: true,
|
||||
change: (val: any) => this.changeNumVal()
|
||||
} as SFNumberWidgetSchema
|
||||
},
|
||||
settlementWeight: {
|
||||
type: 'number',
|
||||
title: '卸货重量',
|
||||
default: data.settlementWeight || 0,
|
||||
minimum: 0,
|
||||
maximum: 99999,
|
||||
ui: {
|
||||
unit: '吨',
|
||||
placeholder: '请输入',
|
||||
grid: {
|
||||
span: 12
|
||||
},
|
||||
hideStep: true,
|
||||
change: (val: any) => this.changeNumVal()
|
||||
} as SFNumberWidgetSchema
|
||||
},
|
||||
settlementVolume: {
|
||||
type: 'number',
|
||||
title: '卸货体积',
|
||||
default: data.settlementVolume || 0,
|
||||
minimum: 0,
|
||||
maximum: 99999,
|
||||
ui: {
|
||||
unit: '方',
|
||||
placeholder: '请输入',
|
||||
grid: {
|
||||
span: 12
|
||||
},
|
||||
hideStep: true,
|
||||
change: (val: any) => this.changeNumVal()
|
||||
} as SFNumberWidgetSchema
|
||||
},
|
||||
changeCause: {
|
||||
title: '审核备注',
|
||||
@ -182,8 +174,9 @@ export class UpdateFreightComponent implements OnInit {
|
||||
maxRows: 5
|
||||
}
|
||||
} as SFTextWidgetSchema
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
required: ['freightPrice', 'settlementBasis']
|
||||
};
|
||||
}
|
||||
|
||||
@ -191,9 +184,10 @@ export class UpdateFreightComponent implements OnInit {
|
||||
if (this.calculateSub) {
|
||||
this.calculateSub.unsubscribe();
|
||||
}
|
||||
const params = { billId: this.data.billId, changeCause: this.sf.value.changeCause, dto: {...this.sf.value} }
|
||||
this.calculateSub = this.service
|
||||
.request(this.service.$api_calculate_cost, { billId: this.data.billId, ...this.sf.value, changeCause: '' })
|
||||
.subscribe(res => {
|
||||
.request(this.service.$api_calculate_cost, params)
|
||||
.subscribe((res: any) => {
|
||||
if (res) {
|
||||
Object.assign(this.data, {
|
||||
totalFreight: res.totalFreight,
|
||||
@ -205,14 +199,14 @@ export class UpdateFreightComponent implements OnInit {
|
||||
}
|
||||
|
||||
save(value: any): void {
|
||||
console.log(this.sf.value)
|
||||
if (!this.sf.valid) {
|
||||
this.sf.validator({ emitError: true });
|
||||
return;
|
||||
}
|
||||
this.service.request(this.service.$api_change_bulk, { billId: this.data.billId, ...this.sf.value }).subscribe(res => {
|
||||
const params = { billId: this.data.billId, changeCause: this.sf.value.changeCause, dto: {...this.sf.value} }
|
||||
this.service.request(this.service.$api_change_bulk,params).subscribe((res: any) => {
|
||||
if (res) {
|
||||
this.service.msgSrv.success('变更运费成功');
|
||||
this.service.msgSrv.success('变更运费成功!');
|
||||
this.modal.destroy(true);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user