Browse Source

fix: 显示多个驱动器

master
alan 6 years ago
parent
commit
ff7f9e1a60
  1. 1
      README.md
  2. 6
      src/app/link_set/right/right_edit/right.edit.component.ts
  3. 6
      src/app/link_set/right/right_edit/right.edit.mysql.component.ts
  4. 20
      src/app/link_set/right/right_edit/right.edit.service.ts
  5. 2
      src/app/link_set/select/select.service.ts
  6. 1
      src/ui/type.ts

1
README.md

@ -1,5 +1,6 @@
# database-connection 数据连接设置页面
![start](https://img.shields.io/badge/start-2019%2F04%2F26-blue.svg) ![finui](https://img.shields.io/badge/lib-FinUi-blue.svg)
## 开始
下载代码

6
src/app/link_set/right/right_edit/right.edit.component.ts

@ -4,6 +4,7 @@ import charset from './right.edit.constant';
import Model from '../../link-set.model';
import FormItem from '@shared/components/form.item.component';
import Title from '@shared/components/title.component';
import {getDrivers} from './right.edit.service';
const className = 'fr.component.right.edit';
const Widget: WidgetType = {
_store() {
@ -53,10 +54,7 @@ const Widget: WidgetType = {
cls: 'bi-border',
width: 300,
text: linkSelected.driver,
items: [{
text: linkSelected.driver,
value: linkSelected.driver,
}],
items: getDrivers(linkSelected),
listeners: [{
eventName: BI.TextValueCombo.EVENT_CHANGE,
action() {

6
src/app/link_set/right/right_edit/right.edit.mysql.component.ts

@ -4,6 +4,7 @@ import charset from './right.edit.constant';
import Model from '../../link-set.model';
import FormItem from '@shared/components/form.item.component';
import Title from '@shared/components/title.component';
import {getDrivers} from './right.edit.service';
const className = 'fr.component.right.edit.mysql';
const Widget: WidgetType = {
_store() {
@ -45,10 +46,7 @@ const Widget: WidgetType = {
cls: 'bi-border',
width: 300,
text: linkSelected.driver,
items: [{
text: linkSelected.driver,
value: linkSelected.driver,
}],
items: getDrivers(linkSelected),
listeners: [{
eventName: BI.TextValueCombo.EVENT_CHANGE,
action() {

20
src/app/link_set/right/right_edit/right.edit.service.ts

@ -0,0 +1,20 @@
import {LinkType} from '@ui/type';
export function getDrivers(linkSelected: LinkType): {text: string; value: string}[] {
const drivers: {text: string; value: string}[] = [];
if (linkSelected.drivers.length > 0) {
linkSelected.drivers.forEach(item => {
drivers.push({
text: item,
value: item,
});
});
} else {
drivers.push({
text: linkSelected.driver,
value: linkSelected.driver,
});
}
return drivers;
}

2
src/app/link_set/select/select.service.ts

@ -65,12 +65,14 @@ export const databaseTyle = [
text:'MySQL',
databaseType: 'mysql',
driver: 'com.mysql.jdbc.Driver',
drivers:['com.mysql.jdbc.Driver', 'org.gjt.mm.mysql.Driver'],
url: 'jdbc:mysql://localhost/dbname',
},
{
text:'其他',
databaseType: 'other',
driver: 'org.h2.Driver',
drivers:['org.h2.Driver', 'com.fr.third.org.hsqldb.jdbcDriver', 'org.sqlite.JDBC'],
url: 'jdbc:h2://${ENV_HOME}/../databaseName',
},
{

1
src/ui/type.ts

@ -3,6 +3,7 @@ export interface LinkType{
database?: string;
connectionName?: string;
driver?: string;
drivers?: string[];
url?: string;
user?: string;
password?: string;

Loading…
Cancel
Save