658 lines
		
	
	
		
			18 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			658 lines
		
	
	
		
			18 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import { Component, OnInit, ViewChild } from '@angular/core';
 | |
| import { FormBuilder, FormControl, FormGroup, NgForm, Validators } from '@angular/forms';
 | |
| import { ActivatedRoute, Router } from '@angular/router';
 | |
| import {
 | |
|   SFArrayWidgetSchema,
 | |
|   SFComponent,
 | |
|   SFNumberWidgetSchema,
 | |
|   SFSchema,
 | |
|   SFSchemaEnum,
 | |
|   SFSelectWidgetSchema,
 | |
|   SFTextareaWidgetSchema,
 | |
|   SFUISchema
 | |
| } from '@delon/form';
 | |
| import { SettingsService, _HttpClient } from '@delon/theme';
 | |
| import { ShipperBaseService } from '@shared';
 | |
| import format from 'date-fns/format';
 | |
| import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal';
 | |
| import { of } from 'rxjs';
 | |
| import { map } from 'rxjs/operators';
 | |
| import { AmapPoiPickerComponent, AmapService } from 'src/app/shared/components/amap';
 | |
| import { SupplyManagementService } from '../../services/supply-management.service';
 | |
| import { PublishGoodsChooseFamifiarComponent } from '../choose-famifiar/choose-famifiar.component';
 | |
| 
 | |
| // import { PublishGoodsChooseFamifiarComponent } from '../choose-famifiar-bulk/choose-famifiar.component';
 | |
| import { PublishAddressListComponent } from '../onecar-publish/address-list/address-list.component';
 | |
| import { PublishSuccessComponent } from '../onecar-publish/publish-success/publish-success.component';
 | |
| // import { PublishSuccessComponent } from '../publish-success/publish-success.component';
 | |
| @Component({
 | |
|   selector: 'app-publish-goods-bulk-publish',
 | |
|   templateUrl: './bulk-release-publish.component.html',
 | |
|   styleUrls: ['./bulk-release-publish.component.less']
 | |
| })
 | |
| export class SupplyManagementBulkReleasePublishComponent implements OnInit {
 | |
|   @ViewChild('ngForm')
 | |
|   ngForm!: NgForm;
 | |
| 
 | |
|   sf1data: any; // 货源单设置回显
 | |
|   sf3data: any; // 货源单设置回显
 | |
|   sf4data: any; // 货源单设置回显
 | |
|   sf5data: any; // 货源单设置回显
 | |
|   sf6data: any; // 货源单设置回显
 | |
|   sf7data: any; // 货源单设置回显
 | |
|   creatTime: any; // 货源单设置回显
 | |
|   modifyTime: any; // 货源单设置回显
 | |
|   totalFees: any; // 总数信息
 | |
|   id = '';
 | |
|   type = 'add';
 | |
|   // // 单位
 | |
|   unit1 = '吨';
 | |
|   unit2 = '方';
 | |
|   unit3 = '保价费金额';
 | |
|   startInfo: any[] = [];
 | |
|   endInfo: any[] = [];
 | |
| 
 | |
|   totalDistance = 0.0; //总里程
 | |
|   totalTime = 0.0; //路程总时间
 | |
| 
 | |
|   currentGoodsTypeName: any;
 | |
| 
 | |
|   freightTypeOptions: any;
 | |
|   ruleOptions: any;
 | |
|   constructor(
 | |
|     private http: _HttpClient,
 | |
|     private modalService: NzModalService,
 | |
|     private settingSrv: SettingsService,
 | |
|     private service: SupplyManagementService,
 | |
|     private router: Router,
 | |
|     private route: ActivatedRoute,
 | |
|     private amapService: AmapService,
 | |
|     public shipperSrv: ShipperBaseService
 | |
|   ) {}
 | |
| 
 | |
|   @ViewChild('sf1', { static: false }) sf1!: SFComponent;
 | |
|   schema1: SFSchema = {};
 | |
|   ui1!: SFUISchema;
 | |
| 
 | |
|   @ViewChild('sf3', { static: false }) sf3!: SFComponent;
 | |
|   schema3: SFSchema = {};
 | |
|   ui3!: SFUISchema;
 | |
| 
 | |
|   @ViewChild('sf4', { static: false }) sf4!: SFComponent;
 | |
|   schema4: SFSchema = {};
 | |
|   ui4!: SFUISchema;
 | |
| 
 | |
|   @ViewChild('sf6', { static: false }) sf6!: SFComponent;
 | |
|   schema6: SFSchema = {};
 | |
|   ui6!: SFUISchema;
 | |
| 
 | |
|   ngOnInit(): void {
 | |
|     this.initSF1();
 | |
|     this.initSF3();
 | |
|     this.initSF4();
 | |
|     this.initSF6();
 | |
|     this.startInfo = [
 | |
|       {
 | |
|         detailedAddress: '',
 | |
|         appUserName: '',
 | |
|         contractTelephone: '',
 | |
|         latitude: '',
 | |
|         longitude: '',
 | |
|         province: '',
 | |
|         city: '',
 | |
|         area: '',
 | |
|         type: '1'
 | |
|       }
 | |
|     ];
 | |
|     this.endInfo = [
 | |
|       {
 | |
|         detailedAddress: '',
 | |
|         appUserName: '',
 | |
|         contractTelephone: '',
 | |
|         latitude: '',
 | |
|         longitude: '',
 | |
|         province: '',
 | |
|         city: '',
 | |
|         area: '',
 | |
|         type: '2'
 | |
|       }
 | |
|     ];
 | |
|   }
 | |
| 
 | |
|   initSF1() {
 | |
|     this.schema1 = {
 | |
|       properties: {
 | |
|         shipperAppUserId: {
 | |
|           title: '货主',
 | |
|           type: 'string',
 | |
|           maxLength: 30,
 | |
|           ui: {
 | |
|             widget: 'select',
 | |
|             serverSearch: true,
 | |
|             searchDebounceTime: 300,
 | |
|             searchLoadingText: '搜索中...',
 | |
|             onSearch: (q: any) => {
 | |
|               if (!!q) {
 | |
|                 return this.service
 | |
|                   .request(this.service.$api_enterpriceList, { enterpriseName: q })
 | |
|                   .pipe(map((res: any[]) => (res as any[]).map(i => ({ label: i.enterpriseName, value: i.id } as SFSchemaEnum))))
 | |
|                   .toPromise();
 | |
|               } else {
 | |
|                 return of([]);
 | |
|               }
 | |
|             },
 | |
|             change: (q: any) => {
 | |
|               this.getRegionCode(q);
 | |
|             }
 | |
|           } as SFSelectWidgetSchema
 | |
|         },
 | |
|         enterpriseProjectId: {
 | |
|           type: 'string',
 | |
|           title: '项目',
 | |
|           ui: {
 | |
|             widget: 'select',
 | |
|             placeholder: '请选择',
 | |
|             allowClear: true
 | |
|           } as SFSelectWidgetSchema
 | |
|         },
 | |
|         // enterpriseInfoName: {
 | |
|         //   type: 'string',
 | |
|         //   title: '网络货运人',
 | |
|         //   ui: {
 | |
|         //     widget: 'custom'
 | |
|         //   },
 | |
|         //   default: '天津市怡亚通XXXX有限公司'
 | |
|         // },
 | |
|         enterpriseInfoName: {
 | |
|           type: 'string',
 | |
|           title: '网络货运人',
 | |
|           ui: {
 | |
|             widget: 'select',
 | |
|             placeholder: '请选择',
 | |
|             allowClear: true,
 | |
|             asyncData: () => this.shipperSrv.getNetworkFreightForwarder()
 | |
|           }
 | |
|         },
 | |
|         deadlineTime: {
 | |
|           title: '截至日期',
 | |
|           type: 'string',
 | |
|           format: 'date-time',
 | |
|           ui: {
 | |
|             placeholder: '请输入',
 | |
|             format: 'yyyy-MM-dd HH:mm:ss'
 | |
|           }
 | |
|         },
 | |
|         dispatchId: {
 | |
|           type: 'string',
 | |
|           title: '调度员',
 | |
|           ui: {
 | |
|             widget: 'select',
 | |
|             placeholder: '请选择',
 | |
|             allowClear: true,
 | |
|             optionalHelp: '选择调度员,司机直接联系调度员 ; 不选择,司机直接联系您',
 | |
|             asyncData: () => this.shipperSrv.getStaffList2()
 | |
|           } as SFSelectWidgetSchema
 | |
|         }
 | |
|       },
 | |
|       required: ['deadlineTime']
 | |
|     };
 | |
|     this.ui1 = {
 | |
|       '*': {
 | |
|         spanLabelFixed: 90,
 | |
|         grid: { span: 12 }
 | |
|       },
 | |
|       $enterpriseInfoName: {
 | |
|         grid: { span: 24 }
 | |
|       }
 | |
|     };
 | |
|   }
 | |
| 
 | |
|   initSF3() {
 | |
|     this.schema3 = {
 | |
|       properties: {
 | |
|         goodsTypeId: {
 | |
|           type: 'string',
 | |
|           title: '货物名称',
 | |
|           ui: {
 | |
|             widget: 'select',
 | |
|             placeholder: '请选择',
 | |
|             errors: { required: '请选择货物类型' },
 | |
|             asyncData: () =>
 | |
|               this.shipperSrv.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, data: any) => {
 | |
|               this.changeGoodsType(value, data);
 | |
|               this.sf3.setValue('/goodsTypeName', data.label);
 | |
|             }
 | |
|           } as SFSelectWidgetSchema
 | |
|         },
 | |
|         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: {
 | |
|               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: ['goodsTypeId', 'goodsName', 'goodsNameId']
 | |
|     };
 | |
|     this.ui3 = {
 | |
|       '*': {
 | |
|         spanLabelFixed: 90,
 | |
|         grid: { span: 12 }
 | |
|       }
 | |
|     };
 | |
|   }
 | |
|   initSF4() {
 | |
|     this.schema4 = {
 | |
|       properties: {
 | |
|         freightPrice: {
 | |
|           type: 'string',
 | |
|           title: '运费单价',
 | |
|           ui: {
 | |
|             errors: { required: '请选择运费单价' },
 | |
|             widget: 'custom',
 | |
|             placeholder: '请输入'
 | |
|           }
 | |
|         },
 | |
|         freightType: {
 | |
|           type: 'string',
 | |
|           title: '',
 | |
|           ui: {
 | |
|             hidden: true
 | |
|           },
 | |
|           default: '1'
 | |
|         },
 | |
| 
 | |
|         rule: {
 | |
|           type: 'string',
 | |
|           title: '',
 | |
|           ui: {
 | |
|             widget: 'custom',
 | |
|             errors: { required: '请选择运费取整规则' }
 | |
|           }
 | |
|         },
 | |
|         settlementBasis: {
 | |
|           type: 'string',
 | |
|           title: '',
 | |
|           ui: {
 | |
|             widget: 'dict-select',
 | |
|             params: { dictKey: 'goodresource:settlement:type' },
 | |
|             placeholder: '结算依据',
 | |
|             errors: { required: '请选择结算依据' }
 | |
|           } as SFSelectWidgetSchema
 | |
|         },
 | |
|         weight: {
 | |
|           type: 'string',
 | |
|           title: '货物数量',
 | |
|           ui: {
 | |
|             widget: 'custom',
 | |
|             placeholder: '请输入',
 | |
|             errors: { required: '请填写总重量' }
 | |
|           }
 | |
|         },
 | |
|         volume: {
 | |
|           type: 'string',
 | |
|           title: '',
 | |
|           ui: {
 | |
|             widget: 'custom',
 | |
|             placeholder: '请输入'
 | |
|           }
 | |
|         },
 | |
|         number: {
 | |
|           type: 'string',
 | |
|           title: '',
 | |
|           ui: {
 | |
|             widget: 'custom',
 | |
|             placeholder: '请输入'
 | |
|           }
 | |
|         },
 | |
|         maxWeight: {
 | |
|           type: 'string',
 | |
|           title: '车型/车长',
 | |
|           default: [],
 | |
|           ui: {
 | |
|             widget: 'dict-select',
 | |
|             params: { dictKey: 'car:model' },
 | |
|             mode: 'multiple',
 | |
|             placeholder: '请选择车型',
 | |
|             errors: { required: '请选择车型' }
 | |
|           }
 | |
|         },
 | |
|         maxCube: {
 | |
|           type: 'string',
 | |
|           title: '',
 | |
|           default: [],
 | |
|           ui: {
 | |
|             widget: 'dict-select',
 | |
|             params: { dictKey: 'car:length' },
 | |
|             mode: 'multiple',
 | |
|             placeholder: '请选择车长',
 | |
|             errors: { required: '请选择车长' }
 | |
|           }
 | |
|         }
 | |
|       },
 | |
|       required: ['weight', 'maxWeight', 'maxCube', 'freightPrice', 'rule', 'settlementBasis']
 | |
|     };
 | |
|     this.ui4 = {
 | |
|       '*': {
 | |
|         spanLabelFixed: 90,
 | |
|         grid: { span: 24 }
 | |
|       },
 | |
|       $freightPrice: {
 | |
|         grid: { span: 8 }
 | |
|       },
 | |
|       $rule: {
 | |
|         grid: { span: 8 }
 | |
|       },
 | |
|       $settlementBasis: {
 | |
|         grid: { span: 8 }
 | |
|       },
 | |
|       $weight: {
 | |
|         grid: { span: 8 }
 | |
|       },
 | |
|       $volume: {
 | |
|         grid: { span: 8 }
 | |
|       },
 | |
|       $number: {
 | |
|         grid: { span: 8 }
 | |
|       },
 | |
|       $maxWeight: {
 | |
|         grid: { span: 12 }
 | |
|       },
 | |
|       $maxCube: {
 | |
|         grid: { span: 12 }
 | |
|       }
 | |
|     };
 | |
|   }
 | |
| 
 | |
|   initSF6() {
 | |
|     this.schema6 = {
 | |
|       properties: {
 | |
|         paymentDays: {
 | |
|           type: 'string',
 | |
|           title: '到货后',
 | |
|           ui: {
 | |
|             widget: 'custom',
 | |
|             placeholder: '请输入',
 | |
|             errors: { required: '请输入付款承诺天数' }
 | |
|           }
 | |
|         },
 | |
|         remarks: {
 | |
|           type: 'string',
 | |
|           title: '备注',
 | |
|           maxLength: 200,
 | |
|           ui: {
 | |
|             widget: 'textarea',
 | |
|             placeholder: '请输入',
 | |
|             autosize: { minRows: 3, maxRows: 3 }
 | |
|           } as SFTextareaWidgetSchema
 | |
|         }
 | |
|       },
 | |
|       required: ['paymentDays']
 | |
|     };
 | |
|     this.ui6 = {
 | |
|       '*': {
 | |
|         spanLabelFixed: 90,
 | |
|         grid: { span: 24 }
 | |
|       }
 | |
|     };
 | |
|   }
 | |
| 
 | |
|   //指派熟车
 | |
|   chooseFamifiar(item: any) {
 | |
|     const modalRef = this.modalService.create({
 | |
|       nzTitle: '指派熟车',
 | |
|       nzContent: PublishGoodsChooseFamifiarComponent,
 | |
|       nzComponentParams: {
 | |
|         submitParams: item,
 | |
|         submitUrl: this.service.$api_save_bulk_assign
 | |
|       },
 | |
|       nzWidth: 1300
 | |
|     });
 | |
|     modalRef.afterClose.subscribe(result => {
 | |
|       if (result) {
 | |
|         this.openFinishPage(result);
 | |
|       }
 | |
|     });
 | |
|   }
 | |
|   // 打开下单完成页面
 | |
|   openFinishPage(resourceObj: any = null) {
 | |
|     this.modalService.create({
 | |
|       nzTitle: '',
 | |
|       nzContent: PublishSuccessComponent,
 | |
|       nzWidth: 900,
 | |
|       nzFooter: null,
 | |
|       nzComponentParams: { type: 'bulk' }
 | |
|     });
 | |
|   }
 | |
|   submit(submitType: string): void {
 | |
|     Object.keys(this.ngForm.form.controls).forEach(key => {
 | |
|       this.ngForm.form.controls[key].markAsDirty();
 | |
|       this.ngForm.form.controls[key].updateValueAndValidity();
 | |
|     });
 | |
|     this.sf1.validator({ emitError: true });
 | |
|     this.sf3.validator({ emitError: true });
 | |
|     this.sf4.validator({ emitError: true });
 | |
|     this.sf6.validator({ emitError: true });
 | |
|     if (this.ngForm.form.invalid || !this.sf1.valid || !this.sf3.valid || !this.sf4.valid || !this.sf6.valid) {
 | |
|       return;
 | |
|     }
 | |
| 
 | |
|     // //装卸货信息
 | |
|     const LoadingList = this.startInfo.concat(this.endInfo);
 | |
|     // 货物信息
 | |
|     const sf3Values = { ...this.sf3.value };
 | |
|     if (sf3Values.goodsTypeName === '其它') {
 | |
|       sf3Values.goodsName = sf3Values.goodsName1;
 | |
|       delete sf3Values.goodsName1;
 | |
|     }
 | |
|     const goodsInfoList = [
 | |
|       {
 | |
|         ...sf3Values,
 | |
|         ...this.sf4.value,
 | |
|         maxWeight: this.sf4.value.maxWeight.join(','),
 | |
|         maxCube: this.sf4.value.maxCube.join(',')
 | |
|       }
 | |
|     ];
 | |
|     const params = {
 | |
|       id: '',
 | |
|       ...this.sf1.value,
 | |
|       unLoadingPlaceDTOList: LoadingList,
 | |
|       goodsInfoDTOList: goodsInfoList,
 | |
|       ...this.sf6.value
 | |
|     };
 | |
| 
 | |
|     let reqUrl = this.service.$api_consignBulk;
 | |
|     if (submitType === 'assign') {
 | |
|       console.log('params', params);
 | |
|       this.chooseFamifiar(params);
 | |
|     } else {
 | |
|       this.service.request(reqUrl, params).subscribe(res => {
 | |
|         if (res) {
 | |
|           this.modalService.create({
 | |
|             nzTitle: '',
 | |
|             nzContent: PublishSuccessComponent,
 | |
|             nzWidth: 900,
 | |
|             nzFooter: null,
 | |
|             nzComponentParams: { type: 'bulk' }
 | |
|           });
 | |
|         }
 | |
|       });
 | |
|     }
 | |
|   }
 | |
|   // 获取城市列表
 | |
|   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);
 | |
|       });
 | |
|   }
 | |
|   // 打开地图
 | |
|   openMap(type: string, index: number) {
 | |
|     const modalRef = this.modalService.create({
 | |
|       nzTitle: '',
 | |
|       nzContent: AmapPoiPickerComponent,
 | |
|       nzWidth: 900,
 | |
|       nzOnOk: item => {
 | |
|         const poi = item.poi;
 | |
|         const locList = poi.pois;
 | |
|         switch (type) {
 | |
|           case 'start':
 | |
|             this.startInfo[index].detailedAddress = poi.formattedAddress;
 | |
|             this.startInfo[index].longitude = locList[0];
 | |
|             this.startInfo[index].latitude = locList[1];
 | |
|             this.startInfo[index].province = poi.addressComponent.province;
 | |
|             this.startInfo[index].city = poi.addressComponent.city;
 | |
|             this.startInfo[index].area = poi.addressComponent.district;
 | |
|             break;
 | |
|           case 'end':
 | |
|             this.endInfo[index].detailedAddress = poi.formattedAddress;
 | |
|             this.endInfo[index].longitude = locList[0];
 | |
|             this.endInfo[index].latitude = locList[1];
 | |
|             this.endInfo[index].province = poi.addressComponent.province;
 | |
|             this.endInfo[index].city = poi.addressComponent.city;
 | |
|             this.endInfo[index].area = poi.addressComponent.district;
 | |
|             break;
 | |
|           default:
 | |
|             break;
 | |
|         }
 | |
|         if (this.startInfo[0]?.area && this.endInfo[0]?.area) {
 | |
|           this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe(res => {
 | |
|             this.totalDistance = res.distance;
 | |
|             this.totalTime = res.time;
 | |
|           });
 | |
|         }
 | |
|       }
 | |
|     });
 | |
|   }
 | |
| 
 | |
|   chooseAddress(index: number, type: string) {
 | |
|     const modalRef = this.modalService.create({
 | |
|       nzTitle: '选择地址',
 | |
|       nzContent: PublishAddressListComponent,
 | |
|       nzWidth: 900,
 | |
|       nzComponentParams: { spuStatus: '1' },
 | |
|       nzOnOk: item => {
 | |
|         const data = item.seleteData;
 | |
|         if (JSON.stringify(data) === '{}') return;
 | |
|         switch (type) {
 | |
|           case 'start':
 | |
|             this.startInfo[index] = {
 | |
|               detailedAddress: data.detailedAddress,
 | |
|               appUserName: data.contactName,
 | |
|               contractTelephone: data.contactTelephone,
 | |
|               latitude: data.contactTelephone,
 | |
|               longitude: data.latitude,
 | |
|               province: data.province,
 | |
|               city: data.city,
 | |
|               area: data.area,
 | |
|               type: '1'
 | |
|             };
 | |
|             break;
 | |
|           case 'end':
 | |
|             this.endInfo[index] = {
 | |
|               detailedAddress: data.detailedAddress,
 | |
|               appUserName: data.contactName,
 | |
|               contractTelephone: data.contactTelephone,
 | |
|               latitude: data.contactTelephone,
 | |
|               longitude: data.latitude,
 | |
|               province: data.province,
 | |
|               city: data.city,
 | |
|               area: data.area,
 | |
|               type: '2'
 | |
|             };
 | |
|             break;
 | |
|           default:
 | |
|             break;
 | |
|         }
 | |
|       }
 | |
|     });
 | |
|   }
 | |
|   goBack() {
 | |
|     window.history.go(-1);
 | |
|   }
 | |
|   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);
 | |
|           }
 | |
|         } else {
 | |
|           this.service.msgSrv.error(res.msg);
 | |
|         }
 | |
|       });
 | |
|   }
 | |
|   choose() {
 | |
|     window.history.go(-1);
 | |
|   }
 | |
| }
 |