Browse Source

DEC-20237 fix: 【迭代】【驱动管理】使用某个自定义驱动新建数据连接,下拉框选中后再次下拉,使用相同驱动文件的的所有自定义驱动都会标蓝选中

feature/10.0
dailer 3 years ago
parent
commit
c61dac1794
  1. 15
      src/modules/pages/maintain/components/driverselector/driverselector.model.ts
  2. 6
      src/modules/pages/maintain/components/driverselector/driverselector.ts

15
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;
}

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

Loading…
Cancel
Save