Browse Source

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

* commit 'c7e190e915edddf5bfef6acf3b0336c2703c6266':
  update demo
  DEC-17991 chore: 甘老师插件接口问题反馈--数据连接支持创建时添加connectionname
research/10.0
superman 4 years ago
parent
commit
aa1b6ccf76
  1. 27
      README.md
  2. 12
      src/modules/pages/maintain/forms/components/form.plugin.ts

27
README.md

@ -36,17 +36,19 @@ ConstantName名称为`dec.constant.database.conf.connect.form.${name}.show`,
### 示例 ### 示例
``` ```
const ConstantRedisType = 'dec.constant.database.conf.connect.types'; const DataBaseConfigProvider = 'dec.connection.provider.datebase';
const ConstantRedisShow = 'dec.constant.database.conf.connect.form.Redis.show';
const ConstantRedisEdit = 'dec.constant.database.conf.connect.form.Redis.edit';
BI.DOM.ready(() => {
BI.config(ConstantRedisType, datas => [...datas, {
text: 'Redis',
databaseType: 'Redis',
}]);
const RedisShowName = 'dec.dcm.connection.plugin.redis.show'; const RedisShowName = 'dec.dcm.connection.plugin.redis.show';
const RedisEditName = 'dec.dcm.connection.plugin.redis.edit';
BI.config(DataBaseConfigProvider, function (provider) {
provider.registerDatabaseType({
text: "Redis",
databaseType: "Redis",
edit: "dec.dcm.connection.plugin.demo.edit",
show: "dec.dcm.connection.plugin.demo.show",
});
});
const RedisShow = BI.inherit(BI.Widget, { const RedisShow = BI.inherit(BI.Widget, {
props: { props: {
formData: { formData: {
@ -115,12 +117,8 @@ BI.DOM.ready(() => {
}; };
}, },
}); });
BI.shortcut(RedisShowName, RedisShow); BI.shortcut(RedisShowName, RedisShow);
BI.constant(ConstantRedisShow, RedisShowName);
const RedisEditName = 'dec.dcm.connection.plugin.redis.edit';
const RedisEdit = BI.inherit(BI.Widget, { const RedisEdit = BI.inherit(BI.Widget, {
props: { props: {
formData: { formData: {
@ -212,9 +210,6 @@ BI.DOM.ready(() => {
}; };
}, },
}); });
BI.shortcut(RedisEditName, RedisEdit); BI.shortcut(RedisEditName, RedisEdit);
BI.constant(ConstantRedisEdit, RedisEditName);
});
``` ```

12
src/modules/pages/maintain/forms/components/form.plugin.ts

@ -11,24 +11,28 @@ export class FormPlugin extends BI.Widget {
plugin: any; plugin: any;
render() { render() {
const { connectionType } = this.options.formData; const { connectionType, connectionId, connectionName, connectionData } = this.options.formData;
return { return {
type: getPluginWidgetEdit(connectionType), type: getPluginWidgetEdit(connectionType),
ref: (_ref: any) => { ref: (_ref: any) => {
this.plugin = _ref; this.plugin = _ref;
}, },
value: this.options.formData.connectionData, value: connectionData, // 兼容
connectionData,
connectionId,
connectionType,
connectionName,
}; };
} }
public getSubmitValue(): Connection { public getSubmitValue(): Connection {
const { connectionType, connectionId, connectionName } = this.options.formData; const { connectionType, connectionId } = this.options.formData;
return { return {
connectionId, connectionId,
connectionType, connectionType,
connectionName, connectionName: this.plugin.getName ? this.plugin.getName() : '',
connectionData: this.plugin.getValue(), connectionData: this.plugin.getValue(),
}; };
} }

Loading…
Cancel
Save