From c61dac179428975334bfa93bf05c988acfcb1ee1 Mon Sep 17 00:00:00 2001 From: dailer Date: Mon, 16 Aug 2021 20:21:14 +0800 Subject: [PATCH] =?UTF-8?q?DEC-20237=20fix:=20=E3=80=90=E8=BF=AD=E4=BB=A3?= =?UTF-8?q?=E3=80=91=E3=80=90=E9=A9=B1=E5=8A=A8=E7=AE=A1=E7=90=86=E3=80=91?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E6=9F=90=E4=B8=AA=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E9=A9=B1=E5=8A=A8=E6=96=B0=E5=BB=BA=E6=95=B0=E6=8D=AE=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=EF=BC=8C=E4=B8=8B=E6=8B=89=E6=A1=86=E9=80=89=E4=B8=AD?= =?UTF-8?q?=E5=90=8E=E5=86=8D=E6=AC=A1=E4=B8=8B=E6=8B=89=EF=BC=8C=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E7=9B=B8=E5=90=8C=E9=A9=B1=E5=8A=A8=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E7=9A=84=E7=9A=84=E6=89=80=E6=9C=89=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E9=A9=B1=E5=8A=A8=E9=83=BD=E4=BC=9A=E6=A0=87=E8=93=9D=E9=80=89?= =?UTF-8?q?=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../driverselector/driverselector.model.ts | 15 ++++++++++----- .../components/driverselector/driverselector.ts | 6 +++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/modules/pages/maintain/components/driverselector/driverselector.model.ts b/src/modules/pages/maintain/components/driverselector/driverselector.model.ts index 9b2fc3e..384e4f4 100644 --- a/src/modules/pages/maintain/components/driverselector/driverselector.model.ts +++ b/src/modules/pages/maintain/components/driverselector/driverselector.model.ts @@ -23,7 +23,7 @@ export class DriverSelectorModel extends Model { }, customDriver: { driver: driverSource !== '' ? selectedDriver : '', - text: driverSource !== '' ? `${this.options.driver} (${driverSource})` : '', + value: driverSource !== '' ? `${this.options.driver} (${driverSource})` : '', }, }; }; @@ -32,7 +32,8 @@ export class DriverSelectorModel extends Model { driverClassItems: () => this.model.customDrivers.map(driver => { return { text: `${driver.driverClass} (${driver.name})`, - value: driver.driverClass, + value: `${driver.driverClass} (${driver.name})`, + driverClass: driver.driverClass, }; }), @@ -57,14 +58,18 @@ export class DriverSelectorModel extends Model { this.model.driverSource = ''; }, - changeCustomDriver: driver => { - this.model.customDriver.driver = driver; + changeCustomDriver: value => { + const item = this.model.driverClassItems.find(item => { + return item.value === value; + }); + const driver = item.driverClass; + this.model.customDriver.driver = driver; this.model.customDrivers.some(customDriver => { if (customDriver.driverClass === driver) { this.model.driverSource = customDriver.name; - this.model.customDriver.text = `${driver} (${customDriver.name})`; + this.model.customDriver.value = `${driver} (${customDriver.name})`; return true; } diff --git a/src/modules/pages/maintain/components/driverselector/driverselector.ts b/src/modules/pages/maintain/components/driverselector/driverselector.ts index 0bb502c..896c157 100644 --- a/src/modules/pages/maintain/components/driverselector/driverselector.ts +++ b/src/modules/pages/maintain/components/driverselector/driverselector.ts @@ -37,7 +37,7 @@ export class DriverSelector extends BI.Widget { watch = { driverClassItems: items => { this.customDrivers.populate(items); - this.customDrivers.setValue(this.model.customDriver.driver); + this.customDrivers.setValue(this.model.customDriver.value); }, driverManageEntryVisible: b => { @@ -123,8 +123,8 @@ export class DriverSelector extends BI.Widget { width: 204, watermark: BI.i18nText('Dec-Please_Input'), items: this.model.driverClassItems, - value: this.model.customDriver.driver, - text: () => this.model.customDriver.text || '', + value: this.model.customDriver.value, + text: () => this.model.customDriver.value || '', defaultText: BI.i18nText('Dec-Please_Select'), warningTitle: BI.i18nText('Dec-Dcm-Driver_Driver_File_Lost'), listeners: [