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: [