车辆对接

This commit is contained in:
wangshiming
2022-01-11 17:08:39 +08:00
parent 0dde51a145
commit 347cb109af
6 changed files with 894 additions and 981 deletions

View File

@ -26,7 +26,6 @@ import { PublishAddressListComponent } from '../onecar-publish/address-list/addr
})
export class SupplyManagementBulkPublishComponent implements OnInit {
validateForm1: FormGroup;
newTempchecked = false; //是否存入新模板
sf1data: any; // 货源单设置回显
sf3data: any; // 货源单设置回显
sf4data: any; // 货源单设置回显
@ -39,24 +38,20 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
totalTime = 0.0; //路程总时间
currentGoodsTypeName: any;
enterpriseProjectIds: any;
id = this.route.snapshot.params.id;
id = this.route.snapshot.params.id; // 传参id
// // 单位
unit1 = '吨';
unit2 = '方';
unit3 = '保价费金额';
startInfo: any = [];
endInfo: any = [];
PageStatus = '';
dataList: any;
constructor(
private http: _HttpClient,
fb: FormBuilder,
private router: Router,
private route: ActivatedRoute,
private modalService: NzModalService,
public service: SupplyManagementService,
private amapService: AmapService,
public shipperSrv: ShipperBaseService,) {
fb: FormBuilder,
private router: Router,
private route: ActivatedRoute,
private modalService: NzModalService,
public service: SupplyManagementService,
private amapService: AmapService,
public shipperSrv: ShipperBaseService,) {
this.validateForm1 = fb.group({
createTime: [null, []],
modifyTime: [null, []],
@ -84,17 +79,12 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
schema4: SFSchema = {};
ui4!: SFUISchema;
@ViewChild('sf7', { static: false }) sf7!: SFComponent;
schema7: SFSchema = {};
ui7!: SFUISchema;
// 初始化
ngOnInit(): void {
if(this.route.snapshot?.queryParams?.sta === '1') {
console.log('修改')
this.PageStatus = '整车修改';
} else if(this.route.snapshot?.queryParams?.sta === '2') {
this.PageStatus = '整车下一单';
} else if(this.route.snapshot?.queryParams?.sta === '3') {
if(this.route.snapshot?.queryParams?.sta === '3') {
this.PageStatus = '大宗修改';
} else if(this.route.snapshot?.queryParams?.sta === '4') {
this.PageStatus = '大宗下一单';
@ -105,9 +95,7 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
this.initSF6();
this.initdata();
}
initSF1() {
this.schema1 = {
properties: {
shipperAppUserId: {
@ -207,28 +195,6 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
}
};
}
// 获取城市列表
getRegionCode(regionCode: any) {
console.log(regionCode);
return this.service
.request(this.service.$api_get_enterprise_project, { id: regionCode })
.pipe(
map(res =>
res.map((item: any) => ({
label: item.projectName,
value: item.id
}))
)
)
.subscribe(res => {
this.sf1.getProperty('/enterpriseProjectId')!.schema.enum = res;
this.sf1.getProperty('/enterpriseProjectId')!.widget.reset(res);
if(this.enterpriseProjectIds) {
this.sf1.setValue('/enterpriseProjectId', this.enterpriseProjectIds);
}
});
}
initSF3() {
this.schema3 = {
properties: {
@ -428,11 +394,6 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
}
};
}
changeValue() {
this.totalFees = Number(this.sf7?.value?.appendFee) + Number(this.sf7?.value?.oilCardPay) + Number(this.sf7?.value?.prePay) + Number(this.sf7?.value?.receiptPay) + Number(this.sf7?.value?.toPay)
console.log(this.totalFees)
}
initSF6() {
this.schema7 = {
properties: {
@ -545,8 +506,29 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
}
};
}
changeValue() {
this.totalFees = Number(this.sf7?.value?.appendFee) + Number(this.sf7?.value?.oilCardPay) + Number(this.sf7?.value?.prePay) + Number(this.sf7?.value?.receiptPay) + Number(this.sf7?.value?.toPay)
}
// 获取城市列表
getRegionCode(regionCode: any) {
return this.service
.request(this.service.$api_get_enterprise_project, { id: regionCode })
.pipe(
map(res =>
res.map((item: any) => ({
label: item.projectName,
value: item.id
}))
)
)
.subscribe(res => {
this.sf1.getProperty('/enterpriseProjectId')!.schema.enum = res;
this.sf1.getProperty('/enterpriseProjectId')!.widget.reset(res);
if(this.enterpriseProjectIds) {
this.sf1.setValue('/enterpriseProjectId', this.enterpriseProjectIds);
}
});
}
addStartInfo(event: any) {
if (this.startInfo.length < 5) {
const controlId = this.startInfo.length;
@ -567,10 +549,8 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
}
}
subStartInfo(event: any, index: number, id?:any) {
console.log(event, index, id)
if(id) {
this.service.request(this.service.$api_delete_Wholedeletebatch, [id]).subscribe((res) => {
console.log(res)
})
}
this.startInfo.splice(index, 1);
@ -578,7 +558,6 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
this.validateForm1.removeControl(`loadName${index}`);
this.validateForm1.removeControl(`loadPhone${index}`);
}
addEndInfo(event: any) {
if (this.addEndInfo.length < 5) {
const controlId = this.endInfo.length;
@ -601,18 +580,14 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
subEndInfo(event: any, index: number, id?:any) {
if(id) {
this.service.request(this.service.$api_delete_Wholedeletebatch, [id]).subscribe((res) => {
console.log(res)
})
}
console.log(event, index, id)
this.endInfo.splice(index, 1);
this.validateForm1.removeControl(`unloadAddress${index}`);
this.validateForm1.removeControl(`unloadName${index}`);
this.validateForm1.removeControl(`unloadPhone${index}`);
}
//指派熟车
//指派熟车
// 指派熟车
chooseFamifiar(item: any) {
const modalRef = this.modalService.create({
nzTitle: '指派熟车',
@ -629,8 +604,8 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
}
});
}
// 打开下单完成页面
openFinishPage(resourceObj: any = null) {
// 打开下单完成页面
openFinishPage(resourceObj: any = null) {
this.modalService.create({
nzTitle: '',
nzContent: PublishSuccessComponent,
@ -638,8 +613,10 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
nzFooter: null,
nzComponentParams: { type: 'bulk' }
});
}
}
// 确认提交
submit(submitType?: string): void {
// 校验规则
Object.keys(this.validateForm1.controls).forEach(key => {
this.validateForm1.controls[key].markAsDirty();
this.validateForm1.controls[key].updateValueAndValidity();
@ -651,7 +628,6 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
if (this.validateForm1.invalid || !this.sf3.valid || !this.sf1.valid|| !this.sf4.valid || !this.sf7.valid) {
return;
}
console.log(this.startInfo)
if(typeof(this.validateForm1.value.modifyTime) !== 'string' ) {
var c = new Date(this.validateForm1.value.modifyTime);
this.validateForm1.value.modifyTime = c.getFullYear() + '-' + (c.getMonth() + 1) + '-' + c.getDate() + ' ' + c.getHours() + ':' + c.getMinutes() + ':' + c.getSeconds()
@ -680,14 +656,12 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
return;
}
}
console.log(params)
if(this.PageStatus === '大宗修改') {
this.requests(this.service.$api_set_bulkModify, params);
} else if(this.PageStatus === '大宗下一单') {
this.requests(this.service.$api_set_saveAnotherBulkOrder, params);
}
}
requests(url: any, params: any) {
this.service.request(url, params).subscribe((res: any) => {
if (res) {
@ -749,7 +723,7 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
});
}
// 打开地图
openMap(type: string, index: number) {
openMap(type: string, index: number) {
const modalRef = this.modalService.create({
nzTitle: '',
nzContent: AmapPoiPickerComponent,
@ -798,12 +772,10 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
this.dataR(res);
})
}
asds(i: any) {
console.log(i)
}
// 初始化信息
dataR (res: any) {
// this.dataList = res;
// 注:区分编辑和下一单 区别是初始化的时候加不加ID
if (res?.shipperAppUserName) {
const List: any = [];
this.service.request(this.service.$api_enterpriceList, { enterpriseName: res?.shipperAppUserName }).subscribe(rs => {
@ -942,9 +914,11 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
remarks: res?.remarks || ''
};
}
// 回退
choose(){
window.history.go(-1);
}
// 选择地址
chooseAddress(index: number, type: string) {
const modalRef = this.modalService.create({
nzTitle: '选择地址',
@ -952,8 +926,6 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
nzWidth: 900,
nzComponentParams: { spuStatus: '1' },
nzOnOk: item => {
console.log(item)
console.log(type)
const data = item.seleteData;
if (JSON.stringify(data) === '{}') return;
switch (type) {