From cf34bd514630a9bc25bb11c80f74ff4bca1e42e8 Mon Sep 17 00:00:00 2001 From: wangshiming Date: Thu, 17 Feb 2022 17:03:31 +0800 Subject: [PATCH] fix bug --- .../bulk-publish/bulk-publish.component.ts | 28 +++++++++++------ .../bulk-release-publish.component.ts | 30 ++++++++++++------- .../onecar-publish.component.ts | 28 +++++++++++------ .../release-publish.component.ts | 28 +++++++++++------ .../services/supply-management.service.ts | 21 ++++++++++++- 5 files changed, 96 insertions(+), 39 deletions(-) diff --git a/src/app/routes/supply-management/components/bulk-publish/bulk-publish.component.ts b/src/app/routes/supply-management/components/bulk-publish/bulk-publish.component.ts index cb3fc20c..eac7d209 100644 --- a/src/app/routes/supply-management/components/bulk-publish/bulk-publish.component.ts +++ b/src/app/routes/supply-management/components/bulk-publish/bulk-publish.component.ts @@ -358,26 +358,36 @@ export class SupplyManagementBulkPublishComponent implements OnInit { type: 'string', title: '车型/车长', ui: { - widget: 'dict-select', - params: { dictKey: 'car:model' }, + widget: 'select', mode: 'multiple', - placeholder: '请选择车型', maxMultipleCount:3, - errors: { required: '请选择车型' } + placeholder: '请选择车型', + errors: { required: '请选择车型' }, + asyncData: () => this.service.getDictOptions({ dictKey: 'car:model' }), + change:(tag:any , org:any)=>{ + if(tag.includes("999")){ + this.sf4.setValue('/carModel',["999"]); + } + } } }, carLength: { type: 'string', title: '', ui: { - widget: 'dict-select', - params: { dictKey: 'car:length' }, + widget: 'select', mode: 'multiple', - placeholder: '请选择车长', maxMultipleCount:3, - errors: { required: '请选择车长' } + placeholder: '请选择车长', + errors: { required: '请选择车长' }, + asyncData: () => this.service.getDictOptions({ dictKey: 'car:length' }), + change:(tag:any , org:any)=>{ + if(tag.includes("999")){ + this.sf4.setValue('/carModel',["999"]); + } + } } - } + }, }, required: ['weight', 'carModel', 'carLength', 'freightPrice', 'rule', 'settlementBasis'] }; 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 dc58592b..dd823ce9 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 @@ -377,29 +377,37 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit { carModel: { type: 'string', title: '车型/车长', - default: [], ui: { - widget: 'dict-select', - params: { dictKey: 'car:model' }, + widget: 'select', mode: 'multiple', - placeholder: '请选择车型', maxMultipleCount:3, - errors: { required: '请选择车型' } + placeholder: '请选择车型', + errors: { required: '请选择车型' }, + asyncData: () => this.service.getDictOptions({ dictKey: 'car:model' }), + change:(tag:any , org:any)=>{ + if(tag.includes("999")){ + this.sf4.setValue('/carModel',["999"]); + } + } } }, carLength: { type: 'string', title: '', - default: [], ui: { - widget: 'dict-select', - params: { dictKey: 'car:length' }, + widget: 'select', mode: 'multiple', - placeholder: '请选择车长', maxMultipleCount:3, - errors: { required: '请选择车长' } + placeholder: '请选择车长', + errors: { required: '请选择车长' }, + asyncData: () => this.service.getDictOptions({ dictKey: 'car:length' }), + change:(tag:any , org:any)=>{ + if(tag.includes("999")){ + this.sf4.setValue('/carModel',["999"]); + } + } } - } + }, }, required: ['weight', 'carModel', 'carLength', 'freightPrice', 'rule', 'settlementBasis'] }; diff --git a/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.ts b/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.ts index 0afb8f55..4033ca1c 100644 --- a/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.ts +++ b/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.ts @@ -331,26 +331,36 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { type: 'string', title: '车型/车长', ui: { - widget: 'dict-select', - params: { dictKey: 'car:model' }, + widget: 'select', mode: 'multiple', - placeholder: '请选择车型', maxMultipleCount:3, - errors: { required: '请选择车型' } + placeholder: '请选择车型', + errors: { required: '请选择车型' }, + asyncData: () => this.service.getDictOptions({ dictKey: 'car:model' }), + change:(tag:any , org:any)=>{ + if(tag.includes("999")){ + this.sf4.setValue('/carModel',["999"]); + } + } } }, carLength: { type: 'string', title: '', ui: { - widget: 'dict-select', - params: { dictKey: 'car:length' }, + widget: 'select', mode: 'multiple', - placeholder: '请选择车长', maxMultipleCount:3, - errors: { required: '请选择车长' } + placeholder: '请选择车长', + errors: { required: '请选择车长' }, + asyncData: () => this.service.getDictOptions({ dictKey: 'car:length' }), + change:(tag:any , org:any)=>{ + if(tag.includes("999")){ + this.sf4.setValue('/carModel',["999"]); + } + } } - } + }, }, required: ['weight', 'carModel', 'carLength'] }; diff --git a/src/app/routes/supply-management/components/release-publish/release-publish.component.ts b/src/app/routes/supply-management/components/release-publish/release-publish.component.ts index 2f1616bf..fcdf8609 100644 --- a/src/app/routes/supply-management/components/release-publish/release-publish.component.ts +++ b/src/app/routes/supply-management/components/release-publish/release-publish.component.ts @@ -347,26 +347,36 @@ export class SupplyManagementReleasePublishComponent implements OnInit { type: 'string', title: '车型/车长', ui: { - widget: 'dict-select', - params: { dictKey: 'car:model' }, + widget: 'select', mode: 'multiple', - placeholder: '请选择车型', maxMultipleCount:3, - errors: { required: '请选择车型' } + placeholder: '请选择车型', + errors: { required: '请选择车型' }, + asyncData: () => this.service.getDictOptions({ dictKey: 'car:model' }), + change:(tag:any , org:any)=>{ + if(tag.includes("999")){ + this.sf4.setValue('/carModel',["999"]); + } + } } }, carLength: { type: 'string', title: '', ui: { - widget: 'dict-select', - params: { dictKey: 'car:length' }, + widget: 'select', mode: 'multiple', - placeholder: '请选择车长', maxMultipleCount:3, - errors: { required: '请选择车长' } + placeholder: '请选择车长', + errors: { required: '请选择车长' }, + asyncData: () => this.service.getDictOptions({ dictKey: 'car:length' }), + change:(tag:any , org:any)=>{ + if(tag.includes("999")){ + this.sf4.setValue('/carModel',["999"]); + } + } } - } + }, }, required: ['weight', 'carModel', 'carLength'] }; 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 03be2ee6..9b1d4ac2 100644 --- a/src/app/routes/supply-management/services/supply-management.service.ts +++ b/src/app/routes/supply-management/services/supply-management.service.ts @@ -4,11 +4,12 @@ * @Author : Shiming * @Date : 2021-12-03 11:10:14 * @LastEditors : Shiming - * @LastEditTime : 2022-02-17 16:44:23 + * @LastEditTime : 2022-02-17 16:58:46 * @FilePath : \\tms-obc-web\\src\\app\\routes\\supply-management\\services\\supply-management.service.ts * Copyright (C) 2022 huzhenhong. All rights reserved. */ import { Injectable, Injector } from '@angular/core'; +import { map } from 'rxjs/operators'; import { BaseService } from 'src/app/shared/services'; @Injectable({ @@ -108,7 +109,25 @@ export class SupplyManagementService extends BaseService { $api_consignBulkQRCode = '/api/sdc/goodsResourceOperate/consignBulkQRCode'; // 获取操作日志列表 public $api_getOperationLogRecordsList = '/api/mdc/pbc/operationLogRecords/getOperationLogRecordsList'; + // 获取数据字典 + $api_getDictValue = `/api/mdc/pbc/dictItems/getDictValue`; + /** + * 获取车型、车长字典数据 + * @returns + */ + getDictOptions(params = {}) { + return this.request(this.$api_getDictValue, params).pipe( + map((res: any) => { + if (!res) { + return []; + } + const obj = []; + obj.push({ label: '不限', value: "999" }) + return [...obj,...res]; + }) + ) + } constructor(public injector: Injector) { super(injector); }