Browse Source

Merge pull request #2755 in DEC/decision-webui-dcm from feature/10.0 to research/10.0

* commit '574cd006fd14ac46589003d8784c3ec8430115a0':
  DEC-19760 feat: 【BI配合】驱动管理
  DEC-20237 fix: 【迭代】【驱动管理】使用某个自定义驱动新建数据连接,下拉框选中后再次下拉,使用相同驱动文件的的所有自定义驱动都会标蓝选中
  DEC-20235 fix: 【迭代】【驱动管理】新建数据连接选择自定义驱动,点击添加驱动再退出,所有没有选择驱动类的自定义驱动标蓝显示
  DEC-20201 fix: 【迭代】【驱动管理】切换为自定义驱动,已经填好的数据库信息不会保存
  DEC-19760 feat: 【BI配合】驱动管理,war包部署不支持提醒
research/10.0
superman 3 years ago
parent
commit
db0d772f78
  1. 8
      src/modules/pages/connection/connection.ts
  2. 19
      src/modules/pages/maintain/components/driverselector/driverselector.model.ts
  3. 81
      src/modules/pages/maintain/components/driverselector/driverselector.ts

8
src/modules/pages/connection/connection.ts

@ -81,6 +81,14 @@ export class Connection extends BI.Widget {
type: 'dec.connection.driver.entry',
invisible: !BI.Services.getService('dec.service.global').isAdmin(),
from: '.dec-dcm',
listeners: [
{
eventName: 'EVENT_CLOSE',
action: () => {
this.reset();
},
},
],
},
],
},

19
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,
};
}),
@ -45,7 +46,9 @@ export class DriverSelectorModel extends Model {
initDriverClassList: cb => {
api.getSimpleDriverList().then(res => {
this.model.customDrivers = res.data;
this.model.customDrivers = res.data.filter(driver => {
return BI.isKey(driver.driverClass);
});
cb();
});
},
@ -55,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;
}

81
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 => {
@ -76,12 +76,15 @@ export class DriverSelector extends BI.Widget {
if (value === 'default') {
this.defaultDrivers.setVisible(true);
this.customDrivers.setVisible(false);
this.fireEvent('EVENT_CHANGE');
return;
}
this.defaultDrivers.setVisible(false);
this.customDrivers.setVisible(true);
if (BI.isKey(this.customDrivers.getValue()[0])) {
this.fireEvent('EVENT_CHANGE');
}
},
},
],
@ -120,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: [
@ -136,71 +139,29 @@ export class DriverSelector extends BI.Widget {
},
}, {
el: {
type: BI.Button.xtype,
type: 'dec.connection.driver.entry',
ref: (_ref: Button) => {
this.driverManageEntry = _ref;
},
level: 'ignore',
text: BI.i18nText('Dec-Dcm_Create_New_Driver'),
invisible: !this.model.driverManageEntryVisible,
handler: () => {
this.createDriverManagerLayer();
el: {
type: BI.Button.xtype,
level: 'ignore',
text: BI.i18nText('Dec-Dcm_Create_New_Driver'),
},
},
},
],
};
}
private createDriverManagerLayer() {
const name = BI.UUID();
BI.Layers.create(name, '.dec-dcm', {
render: {
type: 'bi.vtape',
cls: 'bi-background',
items: [
{
type: 'bi.vertical_adapt',
cls: 'bi-card',
items: [
from: '.dec-dcm',
invisible: !this.model.driverManageEntryVisible,
listeners: [
{
el: {
type: 'bi.icon_text_item',
text: BI.i18nText('Dec-Connection_Driver_Management_Exit'),
cls: 'back-font bi-high-light',
height: 24,
logic: {
dynamic: true,
},
handler: () => {
this.store.initDriverClassList(() => BI.Layers.remove(name));
},
eventName: 'EVENT_CLOSE',
action: () => {
this.store.initDriverClassList(BI.emptyFn);
},
hgap: 10,
},
],
height: 40,
}, {
el: {
type: 'dec.connection.driver',
listeners: [
{
eventName: 'EVENT_CLOSE',
action() {
BI.Layers.remove(name);
},
},
],
},
hgap: 10,
vgap: 10,
},
],
},
});
BI.Layers.show(name);
},
],
};
}
validation(): boolean {

Loading…
Cancel
Save