From d003166b31e4dbdb279c91d65ae3d39c3ce33f75 Mon Sep 17 00:00:00 2001 From: wangshiming Date: Thu, 6 Jan 2022 16:51:48 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=A6=E8=BE=86=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../addmodal/addmodal.component.html | 8 + .../components/addmodal/addmodal.component.ts | 4 +- .../assigned-car-bulk.component.html | 59 ++++ .../assigned-car-bulk.component.spec.ts | 24 ++ .../assigned-car-bulk.component.ts | 292 ++++++++++++++++++ .../bulk-release-publish.component.html | 4 +- .../bulk-release-publish.component.ts | 57 ++-- .../components/bulk/bulk.component.ts | 23 +- .../choose-famifiar.component.html | 109 ++++--- .../choose-famifiar.component.ts | 174 ++++++----- .../services/supply-management.service.ts | 7 +- .../supply-management.module.ts | 6 +- 12 files changed, 601 insertions(+), 166 deletions(-) create mode 100644 src/app/routes/supply-management/components/assigned-car-bulk/assigned-car-bulk.component.html create mode 100644 src/app/routes/supply-management/components/assigned-car-bulk/assigned-car-bulk.component.spec.ts create mode 100644 src/app/routes/supply-management/components/assigned-car-bulk/assigned-car-bulk.component.ts diff --git a/src/app/routes/supply-management/components/addmodal/addmodal.component.html b/src/app/routes/supply-management/components/addmodal/addmodal.component.html index 72932074..7df283e1 100644 --- a/src/app/routes/supply-management/components/addmodal/addmodal.component.html +++ b/src/app/routes/supply-management/components/addmodal/addmodal.component.html @@ -1,3 +1,11 @@ + diff --git a/src/app/routes/supply-management/components/addmodal/addmodal.component.ts b/src/app/routes/supply-management/components/addmodal/addmodal.component.ts index 06101f7b..383b9f50 100644 --- a/src/app/routes/supply-management/components/addmodal/addmodal.component.ts +++ b/src/app/routes/supply-management/components/addmodal/addmodal.component.ts @@ -122,7 +122,7 @@ export class CarAddmodalComponent implements OnInit { } initData(flag?: any) { if (this.sf?.value.mobile) { - this.service.request(this.service.$api_getCarCaptainByMobile, { mobile: this.sf?.value.mobile }).subscribe(res => { + this.service.request(this.service.$api_getCarCaptainByMobile, { mobile: this.sf?.value.mobile }).subscribe((res: any) => { this.flag = flag if (res.userId) { this.tableData = [res]; @@ -151,7 +151,7 @@ export class CarAddmodalComponent implements OnInit { appUserId: item.appUserId ? item.appUserId : '', mobile: item.mobile } - this.service.request(this.service.$api_enterpriseVehicleSave, params).subscribe(res => { + this.service.request(this.service.$api_enterpriseVehicleSave, params).subscribe((res: any) => { if (res) { this.service.msgSrv.success('添加成功') this.modal.close(true) diff --git a/src/app/routes/supply-management/components/assigned-car-bulk/assigned-car-bulk.component.html b/src/app/routes/supply-management/components/assigned-car-bulk/assigned-car-bulk.component.html new file mode 100644 index 00000000..f059e56f --- /dev/null +++ b/src/app/routes/supply-management/components/assigned-car-bulk/assigned-car-bulk.component.html @@ -0,0 +1,59 @@ + + +
+
+
+
+ +
+
+ + +
+
+
+
+
+
+ + + + + + + + + + + + +
+
+ +
已选择{{ st2Data.length }}位司机
+ + + {{ item.carNo ? item.carNo:'不限' }} + + + {{ item.captainName }} {{ item.captainPhone }}   + 设置 + + +
+
+
+ + +
diff --git a/src/app/routes/supply-management/components/assigned-car-bulk/assigned-car-bulk.component.spec.ts b/src/app/routes/supply-management/components/assigned-car-bulk/assigned-car-bulk.component.spec.ts new file mode 100644 index 00000000..cdb182f8 --- /dev/null +++ b/src/app/routes/supply-management/components/assigned-car-bulk/assigned-car-bulk.component.spec.ts @@ -0,0 +1,24 @@ +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; +import { SupplyManagementBulkAssignedCarComponent } from './assigned-car-bulk.component'; + +describe('SupplyManagementBulkAssignedCarComponent', () => { + let component: SupplyManagementBulkAssignedCarComponent; + let fixture: ComponentFixture; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [SupplyManagementBulkAssignedCarComponent] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(SupplyManagementBulkAssignedCarComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/routes/supply-management/components/assigned-car-bulk/assigned-car-bulk.component.ts b/src/app/routes/supply-management/components/assigned-car-bulk/assigned-car-bulk.component.ts new file mode 100644 index 00000000..19d3e353 --- /dev/null +++ b/src/app/routes/supply-management/components/assigned-car-bulk/assigned-car-bulk.component.ts @@ -0,0 +1,292 @@ +import { Component, Input, OnInit, ViewChild } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { STChange, STColumn, STColumnBadge, STComponent, STData } from '@delon/abc/st'; +import { SFComponent, SFSchema, SFUISchema } from '@delon/form'; +import { ModalHelper } from '@delon/theme'; +import { isTemplateRef } from 'ng-zorro-antd/core/util'; +import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal'; +import { SupplyManagementService } from '../../services/supply-management.service'; +import { SupplyManagementAddDriversComponent } from '../add-drivers/add-drivers.component'; +import { PublishchooseFamifiarAddComponent } from '../choose-famifiar/add/add.component'; + +const BADGE: STColumnBadge = { + 1: { text: '空闲', color: 'success' }, + 2: { text: '未实名', color: 'error' }, + 3: { text: '在途', color: 'warning' }, +}; + +@Component({ + selector: 'app-supply-management-assigned-car', + templateUrl: './assigned-car-bulk.component.html', +}) +export class SupplyManagementBulkAssignedCarComponent implements OnInit { + schema: SFSchema = {}; + columns!: STColumn[]; + i: any; + ui!: SFUISchema; + sfExpand = false; + @ViewChild('st', { static: false }) + st!: STComponent; + @ViewChild('sf', { static: false }) + sf!: SFComponent; + + @ViewChild('st2', { static: false }) + st2!: STComponent; + columns2!: STColumn[]; + st2Data: STData[] = []; + + @Input() + submitUrl = ''; + + @Input() + submitParams = {}; + hasSelectedDrivers = []; + + constructor( + private modal: NzModalRef, + public router: Router, + public ar: ActivatedRoute, + public service: SupplyManagementService, + private modalService: NzModalService, + private modalHelper: ModalHelper, + ) { } + + /** + * 查询参数 + */ + get reqParams() { + return { + ...this.sf?.value, + isManage: 0 + }; + } + + ngOnInit() { + this.initSF(); + this.initST(); + this.initST2(); + this.getHasAssignedCar(this.i?.id); + } + + initSF() { + this.schema = { + properties: { + nameOrPhone: { + type: 'string', + title: '', + ui: { + placeholder: '请输入司机姓名/手机号' + } + }, + carNo: { + type: 'string', + title: '', + ui: { + placeholder: '请输入车牌号' + } + } + } + }; + this.ui = { + '*': { + spanLabelFixed: 10, + grid: { span: 12, gutter: 4, } + } + }; + } + + initST() { + this.columns = [ + { + title: '司机姓名', + index: 'name' + }, + { + title: '手机号', + index: 'telephone' + }, + + { + title: '指定车辆', + width: 130, + render: 'userCarLicenseDesensitizationVOList' + }, + { + title: '状态', + className: 'text-center', + index: 'certificationStatus', + type: 'badge', + badge: { + '-1': { text: '未提交', color: 'default' }, + 0: { text: '待审核', color: 'processing' }, + 1: { text: '已认证', color: 'success' }, + 2: { text: '未认证', color: 'error' } + } + }, + { + title: '操作', + className: 'text-center', + buttons: [ + { + text: '选择', + iif: item => !item.checked, + click: (_record, _modal, _instance) => this.choose(_record), + iifBehavior: 'disabled' + } + ] + } + ]; + } + + initST2() { + this.columns2 = [ + { + title: '司机姓名', + index: 'name', + className: 'text-center', + width: '80px' + }, + { + title: '手机号', + index: 'telephone', + className: 'text-center', + width: '100px' + }, + { + title: '车队长', + render: 'captain', + className: 'text-center', + width: '200px' + }, + { + title: '指定车辆', + render: 'carNo', + className: 'text-center', + width: '100px' + }, + { + title: '操作', + className: 'text-center', + width: '80px', + buttons: [ + { + text: '移除', + click: (_record, _modal, _instance) => this.remove(_record, _modal, _instance) + } + ] + } + ]; + } + + // 选择 + choose(record: STData) { + this.st2Data = [...this.st2Data, ...[record]]; + this.st.setRow(record, { checked: true }); + } + + // 移除 + remove(record: STData, value1: any, comp: any) { + const index = this.st?.list.findIndex((obj: any) => obj.appUserId === record.appUserId); + if (index >= 0) { + comp!.removeRow(record); + this.st2Data = this.st2Data.filter(item => item.appUserId !== record.appUserId); + this.st.setRow(index, { checked: false }); + } + } + + //添加司机 + add() { + this.modalService.create({ + nzTitle: '添加司机', + nzContent: PublishchooseFamifiarAddComponent + }); + } + + //设置车队长 + setCaptain(record: STData) { + + this.modalHelper.create(SupplyManagementAddDriversComponent, { dirvierInfo: record }, { + size: 900, + modalOptions: { nzMaskClosable: false, nzTitle: '设置' } + } + ).subscribe((res) => { + if (res) { + this.st2Data = this.st2Data.map(_item => { + if (_item?.userId === record?.userId) { + _item.captainName = res?.name; + _item.captainPhone = res?.mobile; + _item.captainAppUserId = res?.appUserId; + } + return _item; + }) + } + }); + } + + /** + * 重置表单 + */ + resetSF() { + this.sf.reset(); + this.sfExpand = false; + this.st.load(1); + } + + expandToggle() { + this.sfExpand = !this.sfExpand; + this.sf?.setValue('/_expand', this.sfExpand); + } + + // 熟车请求数据处理 + resProcess(data: STData[]): STData[] { + return data.map((i, index) => { + const defaultCart = i.userCarLicenseDesensitizationVOList.find((cart: any) => cart.isDefault); + return { ...i, default: defaultCart || '' }; + }); + } + + cancel() { + this.modal.close(); + } + + submit() { + if (this.st2Data?.length <= 0) { + this.service.msgSrv.warning('请选择熟车'); + return; + } + const data = this.st2Data.map(item => ({ driverId: item.appUserId, carId: item.default?.carId || null, carCaptainId: item.captainAppUserId })); + this.service.request(this.service.$api_save_assign_bulk, { id: this.i?.id, carDriverIds: data }).subscribe(res => { + if (res) { + this.service.msgSrv.success('指派成功'); + this.modal.destroy(true); + } + }); + } + + changeSt(e: STChange) { + if (e?.type === 'loaded' && this.st2Data.length > 0) { + // 页面加载完成时勾选 + (e?.loaded || []).forEach((r, index) => { + this.st2Data.forEach((x) => { + if (x.appUserId === r.appUserId) { + this.st.setRow(index, { checked: true }); + } + }); + }); + } + } + carChange(event: any, item: STData) { + // this.st.setRow(item, { carName: event }); + } + + getHasAssignedCar(id: any) { + this.service.request(this.service.$api_get_has_assigned_car_list, { id }).subscribe(res => { + if (res) { + this.hasSelectedDrivers = res; + this.st2Data = [...res]; + this.st.reload(); + } + }) + } + +} diff --git a/src/app/routes/supply-management/components/bulk-release-publish/bulk-release-publish.component.html b/src/app/routes/supply-management/components/bulk-release-publish/bulk-release-publish.component.html index 91d46074..98b887bb 100644 --- a/src/app/routes/supply-management/components/bulk-release-publish/bulk-release-publish.component.html +++ b/src/app/routes/supply-management/components/bulk-release-publish/bulk-release-publish.component.html @@ -237,8 +237,10 @@
- + + +
diff --git a/src/app/routes/supply-management/components/bulk-release-publish/bulk-release-publish.component.ts b/src/app/routes/supply-management/components/bulk-release-publish/bulk-release-publish.component.ts index 289c50ae..a06c8751 100644 --- a/src/app/routes/supply-management/components/bulk-release-publish/bulk-release-publish.component.ts +++ b/src/app/routes/supply-management/components/bulk-release-publish/bulk-release-publish.component.ts @@ -457,28 +457,43 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit { //指派熟车 chooseFamifiar(item: any) { - // this.modalService.create({ - // nzTitle: '指派熟车', - // nzContent: PublishGoodsChooseFamifiarComponent, - // nzComponentParams: { - // submitParams: item, - // submitUrl: this.service.$api_save_bulk_assign - // }, - // nzWidth: 1300 - // }); - } - submit(submitType: string): void { - Object.keys(this.validateForm1.controls).forEach(key => { - this.validateForm1.controls[key].markAsDirty(); - this.validateForm1.controls[key].updateValueAndValidity(); + const modalRef = this.modalService.create({ + nzTitle: '指派熟车', + nzContent: PublishGoodsChooseFamifiarComponent, + nzComponentParams: { + submitParams: item, + submitUrl: this.service.$api_save_bulk_assign + }, + nzWidth: 1300, }); - this.sf1.validator({ emitError: true }); - this.sf3.validator({ emitError: true }); - this.sf4.validator({ emitError: true }); - this.sf6.validator({ emitError: true }); - if (this.validateForm1.invalid || !this.sf1.valid || !this.sf3.valid || !this.sf4.valid || !this.sf6.valid) { - return; + 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.validateForm1.controls).forEach(key => { + // this.validateForm1.controls[key].markAsDirty(); + // this.validateForm1.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.validateForm1.invalid || !this.sf1.valid || !this.sf3.valid || !this.sf4.valid || !this.sf6.valid) { + // return; + // } // //装卸货信息 const LoadingList = this.startInfo.concat(this.endInfo); @@ -646,7 +661,7 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit { if (res) { this.sf3.getProperty('/goodsNameId')!.schema.enum = res; this.sf3.getProperty('/goodsNameId')!.widget.reset(res); - if(this.sf3data.goodsNameId){ + if(this.sf3data?.goodsNameId){ this.sf3.setValue('/goodsNameId',this.sf3data.goodsNameId); } } else { diff --git a/src/app/routes/supply-management/components/bulk/bulk.component.ts b/src/app/routes/supply-management/components/bulk/bulk.component.ts index 378fc3dd..556cc401 100644 --- a/src/app/routes/supply-management/components/bulk/bulk.component.ts +++ b/src/app/routes/supply-management/components/bulk/bulk.component.ts @@ -8,6 +8,7 @@ import { NzModalService } from 'ng-zorro-antd/modal'; import { of } from 'rxjs'; import { map } from 'rxjs/operators'; import { SupplyManagementService } from '../../services/supply-management.service'; +import { SupplyManagementBulkAssignedCarComponent } from '../assigned-car-bulk/assigned-car-bulk.component'; import { SupplyManagementQrcodePageComponent } from '../qrcode-page/qrcode-page.component'; import { SupplyManagementUpdatePriceComponent } from '../update-price/update-price.component'; @@ -298,7 +299,7 @@ export class SupplyManagementBulkComponent implements OnInit { }, { text: '重新指派', - click: (_record) => this.delOne(_record), + click: (_record) => this.assignedCar(_record), iif: item => item.auditStatus == 2, }, ], @@ -310,6 +311,26 @@ export class SupplyManagementBulkComponent implements OnInit { // .createStatic(FormEditComponent, { i: { id: 0 } }) // .subscribe(() => this.st.reload()); } + /** + * 重新指派 + */ + assignedCar(item: any) { + const modalRef = this.modal.create({ + nzTitle: '指派熟车', + nzWidth: '1500px', + nzContent: SupplyManagementBulkAssignedCarComponent, + nzComponentParams: { + i: item + }, + nzFooter: null, + + }); + modalRef.afterClose.subscribe((result) => { + if (result) { + this.st.reload(); + } + }); + } /** * 查询字段个数 */ diff --git a/src/app/routes/supply-management/components/choose-famifiar/choose-famifiar.component.html b/src/app/routes/supply-management/components/choose-famifiar/choose-famifiar.component.html index 096d5200..4622fbc6 100644 --- a/src/app/routes/supply-management/components/choose-famifiar/choose-famifiar.component.html +++ b/src/app/routes/supply-management/components/choose-famifiar/choose-famifiar.component.html @@ -1,65 +1,62 @@ - + +
-
-
-
- -
-
- - -
+
+
+
+ +
+
+ +
+
-
- - - - - - - - - -
-
- - - - {{ item.name3 }} {{ item.name4 }}  - 设置 - - -
+
+ + + + + + + + + + +
+
+ +
已选择{{ st2Data.length }}位司机
+ + + {{ item.captainName }} {{ item.captainPhone }}   + 设置 + + +
- - + +
diff --git a/src/app/routes/supply-management/components/choose-famifiar/choose-famifiar.component.ts b/src/app/routes/supply-management/components/choose-famifiar/choose-famifiar.component.ts index 5005bff4..ea05cf33 100644 --- a/src/app/routes/supply-management/components/choose-famifiar/choose-famifiar.component.ts +++ b/src/app/routes/supply-management/components/choose-famifiar/choose-famifiar.component.ts @@ -1,13 +1,15 @@ -import { Component, OnInit, ViewChild } from '@angular/core'; +import { Component, Input, OnInit, ViewChild } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { STChange, STColumn, STComponent, STData, STRequestOptions } from '@delon/abc/st'; import { SFComponent, SFSchema, SFSelectWidgetSchema, SFUISchema } from '@delon/form'; +import { ModalHelper } from '@delon/theme'; import { processSingleSort } from '@shared'; import { NzDrawerRef, NzDrawerService } from 'ng-zorro-antd/drawer'; -import { NzModalService } from 'ng-zorro-antd/modal'; -import { map } from 'rxjs/operators'; +import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal'; +import { SupplyManagementAddDriversComponent } from 'src/app/routes/supply-management/components/add-drivers/add-drivers.component'; import { SupplyManagementService } from '../../services/supply-management.service'; +import { CarAddmodalComponent } from '../addmodal/addmodal.component'; import { PublishchooseFamifiarAddComponent } from './add/add.component'; import { PublishchooseFamifiarSetCaptainComponent } from './set-captain/set-captain.component'; @@ -18,6 +20,7 @@ import { PublishchooseFamifiarSetCaptainComponent } from './set-captain/set-capt export class PublishGoodsChooseFamifiarComponent implements OnInit { schema: SFSchema = {}; columns!: STColumn[]; + i: any; ui!: SFUISchema; sfExpand = false; @ViewChild('st', { static: false }) @@ -30,45 +33,22 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit { columns2!: STColumn[]; st2Data: STData[] = []; + @Input() + submitUrl = ''; + + @Input() + submitParams = {}; + constructor( - private modal: NzModalService, + private modal: NzModalRef, public router: Router, public ar: ActivatedRoute, private drawerService: NzDrawerService, public service: SupplyManagementService, - private modalService: NzModalService + private modalService: NzModalService, + private modalHelper: ModalHelper ) {} - dataInfo: STData[] = [ - { - id: '1', - name1: '1111', - name2: '2222', - name3: '3333', - name4: '4444', - name5: '5555', - name6: '6666', - name7: '7777', - name8: '8888', - name9: '9999', - name10: '1010', - name11: '1012', - name12: '1013' - }, - { - id: '2', - name1: '9999', - name2: '8888', - name3: '7777', - name4: '6666', - name5: '5555', - name6: '4444', - name7: '3333', - name8: '2222', - name9: '1111' - } - ]; - /** * 查询参数 */ @@ -78,10 +58,6 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit { isManage: 0 }; } - - get selectedRows() { - return this.st?.list.filter(item => item.checked) || []; - } ngOnInit() { this.initSF(); this.initST(); @@ -118,21 +94,28 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit { this.columns = [ { title: '司机姓名', - index: 'name1' + index: 'name' }, { title: '手机号', - index: 'name2' + index: 'telephone' }, { title: '指定车辆', - index: 'name3', - render: 'name3', - width: '180px' + width: 130, + render: 'userCarLicenseDesensitizationVOList' }, { title: '状态', - index: 'name4' + className: 'text-center', + index: 'certificationStatus', + type: 'badge', + badge: { + '-1': { text: '未提交', color: 'default' }, + 0: { text: '待审核', color: 'processing' }, + 1: { text: '已认证', color: 'success' }, + 2: { text: '未认证', color: 'error' } + } }, { title: '操作', @@ -140,8 +123,9 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit { buttons: [ { text: '选择', - iif: item => item.showChoose !== 'false', - click: (_record, _modal, _instance) => this.choose(_record) + iif: item => item.showChoose != false, + click: (_record, _modal, _instance) => this.choose(_record), + iifBehavior: 'disabled' } ] } @@ -152,21 +136,22 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit { this.columns2 = [ { title: '司机姓名', - index: 'name1' + index: 'name' }, { title: '手机号', - index: 'name2' + index: 'telephone', + width: '120px' }, { title: '车队长', - index: 'name3', - render: 'name3', - width: '180px' + render: 'captain', + width: '200px' }, { title: '指定车辆', - index: 'name4' + index: 'carNo', + width: '130px' }, { title: '操作', @@ -183,36 +168,42 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit { // 选择 choose(record: STData) { - this.st2Data.push({ ...record }); - this.st2.load(); - this.st.setRow(record, { showChoose: 'false' }); + this.st2Data = [...this.st2Data, ...[record]]; + this.st.setRow(record, { showChoose: false }); } // 移除 - remove(record: STData, value1: any, value2: any) { - this.st.setRow(record, { showChoose: 'true' }); - let index = (this.st2Data || []).findIndex(obj => obj.id === record.id); - this.st2Data.splice(index, 1); - this.st2.load(); - - const stData = this.st.data; - let index2 = (stData as any).findIndex((obj: any) => obj.id === record.id); - this.st.setRow(index2, { showChoose: 'true' }); + remove(record: STData, value1: any, comp: any) { + const index = this.st?.list.findIndex((obj: any) => obj.appUserId === record.appUserId); + if (index >= 0) { + comp!.removeRow(record); + this.st2Data = this.st2Data.filter(item => item.appUserId !== record.appUserId); + this.st.setRow(index, { showChoose: true }); + } } //添加司机 add() { - this.modalService.create({ - nzTitle: '添加司机', - nzContent: PublishchooseFamifiarAddComponent + this.modalHelper.create(CarAddmodalComponent, {}, { size: 900, modalOptions: { nzMaskClosable: false } }).subscribe(res => { + if (res) this.st.reload(); }); } //设置车队长 - setCaptain(record: STData) { - this.modalService.create({ - nzTitle: '设置车队长', - nzContent: PublishchooseFamifiarSetCaptainComponent - }); + setCaptain(record: STData, index: any) { + this.modalHelper + .create( + SupplyManagementAddDriversComponent, + { dirvierInfo: record }, + { + size: 900, + modalOptions: { nzMaskClosable: false, nzTitle: '设置' } + } + ) + .subscribe(res => { + if (res) { + this.st2.setRow(index, { captainName: res.name, captainPhone: res.mobile, captainAppUserId: res.appUserId }); + } + }); } /** @@ -229,16 +220,35 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit { this.sf?.setValue('/_expand', this.sfExpand); } - // 排序 - reqProcess(requestOptions: STRequestOptions): STRequestOptions { - return processSingleSort(requestOptions); + // 熟车请求数据处理 + reqProcess(data: STData[]): STData[] { + return data.map((i, index) => { + const defaultCart = i.userCarLicenseDesensitizationVOList.find((cart: any) => cart.isDefault); + return { ...i, default: defaultCart || '' }; + }); } - cancel() {} - - ok() {} - - carChange(event: any, item: STData) { - this.st.setRow(item, { name3: event }); + cancel() { + this.modal.destroy(); } + + ok() { + if (this.st2._data?.length <= 0) { + this.service.msgSrv.warning('请选择熟车'); + return; + } + const data = this.st2._data.map(item => ({ + driverId: item.appUserId, + carId: item.default?.carId || null, + carCaptainId: item.captainAppUserId + })); + this.service.request(this.submitUrl, { ...this.submitParams, carDriverIds: data }).subscribe((rs: any) => { + if (rs) { + this.service.msgSrv.success('指派成功'); + this.modal.destroy(true); + } + }); + } + + carChange(event: any, item: STData) {} } diff --git a/src/app/routes/supply-management/services/supply-management.service.ts b/src/app/routes/supply-management/services/supply-management.service.ts index c71e6fb9..47703cdd 100644 --- a/src/app/routes/supply-management/services/supply-management.service.ts +++ b/src/app/routes/supply-management/services/supply-management.service.ts @@ -1,7 +1,7 @@ /* * @Author: your name * @Date: 2021-12-03 11:10:14 - * @LastEditTime: 2022-01-06 15:32:50 + * @LastEditTime: 2022-01-06 16:38:52 * @LastEditors: Please set LastEditors * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @FilePath: \tms-obc-web\src\app\routes\supply-management\services\supply-management.service.ts @@ -80,6 +80,11 @@ export class SupplyManagementService extends BaseService { $api_deletebatch = `/api/mdc/cuc/enterpriseVehicle/deletebatch`; // 熟车详情 $api_getMyDriverUserDetail = `/api/mdc/cuc/enterpriseVehicle/getMyDriverUserDetail`; + + // 获取指派熟车列表 + $api_getList_card = '/api/mdc/cuc/enterpriseVehicle/getPracticeCarList'; + + // 根据地区code查询列表 $api_getRegionByCode = '/api/mdc/pbc/region/getRegionByCode'; // 识别身份证 diff --git a/src/app/routes/supply-management/supply-management.module.ts b/src/app/routes/supply-management/supply-management.module.ts index ea6c57b9..d4f6d322 100644 --- a/src/app/routes/supply-management/supply-management.module.ts +++ b/src/app/routes/supply-management/supply-management.module.ts @@ -1,7 +1,7 @@ /* * @Author: your name * @Date: 2021-12-03 11:10:14 - * @LastEditTime: 2022-01-06 15:01:57 + * @LastEditTime: 2022-01-06 16:19:21 * @LastEditors: Please set LastEditors * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @FilePath: \tms-obc-web\src\app\routes\supply-management\supply-management.module.ts @@ -32,6 +32,7 @@ import { SupplyManagementBulkDetailComponent } from './components/bulk-detail/bu import { SupplyManagementReleasePublishComponent } from './components/release-publish/release-publish.component'; import { SupplyManagementBulkReleasePublishComponent } from './components/bulk-release-publish/bulk-release-publish.component'; import { TranAgreementComponent } from './components/tran-agreement/tran-agreement.component'; +import { SupplyManagementBulkAssignedCarComponent } from './components/assigned-car-bulk/assigned-car-bulk.component'; const COMPONENTS: Type[] = [ @@ -57,7 +58,8 @@ const COMPONENTS: Type[] = [ SupplyManagementBulkDetailComponent, SupplyManagementReleasePublishComponent, SupplyManagementBulkReleasePublishComponent, - TranAgreementComponent + TranAgreementComponent, + SupplyManagementBulkAssignedCarComponent ];