车辆接口更新
This commit is contained in:
@ -4,7 +4,7 @@
|
||||
* @Author : Shiming
|
||||
* @Date : 2021-12-23 13:39:58
|
||||
* @LastEditors : Shiming
|
||||
* @LastEditTime : 2022-01-18 17:20:33
|
||||
* @LastEditTime : 2022-01-20 19:29:05
|
||||
* @FilePath : \\tms-obc-web\\src\\app\\routes\\order-management\\components\\vehicle-detail-change\\vehicle-detail-change.component.ts
|
||||
* Copyright (C) 2022 huzhenhong. All rights reserved.
|
||||
*/
|
||||
@ -13,13 +13,14 @@ import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms'
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { apiConf } from '@conf/api.conf';
|
||||
import { STColumn, STComponent } from '@delon/abc/st';
|
||||
import { SFComponent, SFSchema, SFUISchema, SFUploadWidgetSchema } from '@delon/form';
|
||||
import { SFComponent, SFSchema, SFSelectWidgetSchema, SFUISchema, SFUploadWidgetSchema } from '@delon/form';
|
||||
import { AmapPoiPickerComponent, AmapService, EAEnvironmentService, ShipperBaseService } from '@shared';
|
||||
import { NzCardComponent } from 'ng-zorro-antd/card';
|
||||
import { NzMessageService } from 'ng-zorro-antd/message';
|
||||
import { NzModalService } from 'ng-zorro-antd/modal';
|
||||
import { NzUploadChangeParam, NzUploadFile } from 'ng-zorro-antd/upload';
|
||||
import { Observable, Observer } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { OrderManagementService } from '../../services/order-management.service';
|
||||
function getBase64(file: File): Promise<string | ArrayBuffer | null> {
|
||||
return new Promise((resolve, reject) => {
|
||||
@ -287,7 +288,7 @@ export class OrderManagementVehicleDetailChangeComponent implements OnInit {
|
||||
};
|
||||
}
|
||||
initData() {
|
||||
this.service.request(this.service.$api_set_getWholeOrderDetail, { id: this.id }).subscribe(res => {
|
||||
this.service.request(this.service.$api_get_getWholeBillDetail, { id: this.id }).subscribe(res => {
|
||||
console.log(res);
|
||||
if (res) {
|
||||
this.i = res;
|
||||
@ -303,6 +304,16 @@ export class OrderManagementVehicleDetailChangeComponent implements OnInit {
|
||||
});
|
||||
this.listImagUrls = arr;
|
||||
this.sf4data = res?.goodsInfoList?.[0];
|
||||
this.sf3data = {
|
||||
goodsTypeId: res?.goodsInfoList[0]?.goodsTypeId || '',
|
||||
goodsTypeName: res?.goodsInfoList[0]?.goodsTypeName || '',
|
||||
goodsNameId: res?.goodsInfoList[0]?.goodsNameId || '',
|
||||
goodsName: res?.goodsInfoList[0]?.goodsName || ''
|
||||
};
|
||||
if (this.sf3data.goodsTypeName === '其它') {
|
||||
this.sf3data.goodsName1 = res?.goodsInfoList[0]?.goodsName || '';
|
||||
}
|
||||
this.changeGoodsType(this.sf3data.goodsTypeId, { label: this.sf3data.goodsTypeName, value: this.sf3data.goodsTypeId });
|
||||
// 对装卸货信息进行初始化
|
||||
res?.unLoadingPlaceList.forEach((element: any) => {
|
||||
if (element.type === 1 || element.type === '1') {
|
||||
@ -548,38 +559,71 @@ export class OrderManagementVehicleDetailChangeComponent implements OnInit {
|
||||
initSF3() {
|
||||
this.schema3 = {
|
||||
properties: {
|
||||
// enterpriseInfoId: {
|
||||
// title: '网络货运人',
|
||||
// type: 'string',
|
||||
// ui: {
|
||||
// placeholder: '请选择',
|
||||
// widget: 'select',
|
||||
// asyncData: () => this.shipperservice.getNetworkFreightForwarder(),
|
||||
// visibleIf: {
|
||||
// _$expand: (value: boolean) => value,
|
||||
// },
|
||||
// }
|
||||
// },
|
||||
goodsName: {
|
||||
goodsTypeId: {
|
||||
type: 'string',
|
||||
title: '货物名称',
|
||||
ui: {
|
||||
widget: 'dict-select',
|
||||
params: { dictKey: 'GoodsName' },
|
||||
placeholder: '请选择'
|
||||
}
|
||||
widget: 'select',
|
||||
placeholder: '请选择',
|
||||
errors: { required: '请选择货物类型' },
|
||||
asyncData: () =>
|
||||
this.shipperservice.loadConfigByKey('goods.name.config.type').pipe(
|
||||
map((data: any) => {
|
||||
return data[0].children?.map((m: any) => {
|
||||
return { label: m.name, value: m.id };
|
||||
});
|
||||
})
|
||||
),
|
||||
change: (value: any, data: any) => {
|
||||
this.changeGoodsType(value, data);
|
||||
this.sf3.setValue('/goodsTypeName', data.label);
|
||||
}
|
||||
} as SFSelectWidgetSchema
|
||||
},
|
||||
qita: {
|
||||
goodsTypeName: {
|
||||
type: 'string',
|
||||
title: '',
|
||||
ui: {
|
||||
hidden: true
|
||||
}
|
||||
},
|
||||
goodsNameId: {
|
||||
type: 'string',
|
||||
title: '',
|
||||
ui: {
|
||||
widget: 'select',
|
||||
placeholder: '请选择',
|
||||
errors: { required: '请填写货物名称' },
|
||||
change: (_value: any, data: any) => {
|
||||
this.sf3.setValue('/goodsName', data.label);
|
||||
},
|
||||
visibleIf: {
|
||||
goodsName: value => value === '3'
|
||||
goodsTypeName: (value: any) => value && value !== '其它'
|
||||
}
|
||||
}
|
||||
},
|
||||
goodsName: {
|
||||
type: 'string',
|
||||
title: '',
|
||||
ui: {
|
||||
hidden: true,
|
||||
visibleIf: {
|
||||
goodsTypeName: (value: any) => value && value !== '其它'
|
||||
}
|
||||
}
|
||||
},
|
||||
goodsName1: {
|
||||
type: 'string',
|
||||
title: '',
|
||||
ui: {
|
||||
errors: { required: '请填写货物名称' },
|
||||
visibleIf: {
|
||||
goodsTypeName: (value: any) => value && value === '其它'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
required: ['goodsName']
|
||||
required: ['goodsTypeId', 'goodsName', 'goodsNameId']
|
||||
};
|
||||
this.ui3 = {
|
||||
'*': {
|
||||
@ -594,6 +638,32 @@ export class OrderManagementVehicleDetailChangeComponent implements OnInit {
|
||||
}
|
||||
};
|
||||
}
|
||||
changeGoodsType(value: string, data: any) {
|
||||
if (data.label === '其它') return;
|
||||
const params = {
|
||||
pageIndex: 1,
|
||||
pageSize: 100,
|
||||
configId: value
|
||||
};
|
||||
this.service
|
||||
.request(this.service.$api_get_config_item_page, params)
|
||||
.pipe(
|
||||
map(data => {
|
||||
return data.records?.map((m: any) => {
|
||||
return { label: m.name, value: m.id };
|
||||
});
|
||||
})
|
||||
)
|
||||
.subscribe(res => {
|
||||
if (res) {
|
||||
this.sf3.getProperty('/goodsNameId')!.schema.enum = res;
|
||||
this.sf3.getProperty('/goodsNameId')!.widget?.reset(res);
|
||||
if (this.sf3data.goodsNameId) {
|
||||
this.sf3.setValue('/goodsNameId', this.sf3data.goodsNameId);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
initST() {
|
||||
this.logColumns = [
|
||||
{ title: '款项', index: 'costName' },
|
||||
@ -669,7 +739,7 @@ export class OrderManagementVehicleDetailChangeComponent implements OnInit {
|
||||
placeholder: '请输入'
|
||||
}
|
||||
},
|
||||
loadTime: {
|
||||
loadPlanTime: {
|
||||
type: 'string',
|
||||
title: '发车时间',
|
||||
ui: {
|
||||
@ -677,7 +747,7 @@ export class OrderManagementVehicleDetailChangeComponent implements OnInit {
|
||||
placeholder: '请输入'
|
||||
}
|
||||
},
|
||||
unloadTime: {
|
||||
unloadPlanTime: {
|
||||
type: 'string',
|
||||
title: '到车时间',
|
||||
ui: {
|
||||
@ -686,7 +756,7 @@ export class OrderManagementVehicleDetailChangeComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
},
|
||||
required: ['weight', 'loadTime', 'unloadTime']
|
||||
required: ['weight', 'loadPlanTime', 'unloadPlanTime']
|
||||
};
|
||||
this.ui4 = {
|
||||
'*': {
|
||||
@ -711,10 +781,10 @@ export class OrderManagementVehicleDetailChangeComponent implements OnInit {
|
||||
$drivers: {
|
||||
grid: { span: 12 }
|
||||
},
|
||||
$loadTime: {
|
||||
$loadPlanTime: {
|
||||
grid: { span: 12 }
|
||||
},
|
||||
$unloadTime: {
|
||||
$unloadPlanTime: {
|
||||
grid: { span: 12 }
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user