import { shortcut } from '@core/core'; import { Connection, ConnectionPlugin } from 'src/modules/crud/crud.typings'; import { getPluginWidgetEdit } from '../../../../app.service'; @shortcut() export class FormPlugin extends BI.Widget { static xtype = 'dec.dcm.maintain_plugin'; props = { formData: {} as Connection, }; plugin: any; render() { const { connectionType, connectionId, connectionName, connectionData } = this.options.formData; return { type: getPluginWidgetEdit(connectionType), ref: (_ref: any) => { this.plugin = _ref; }, value: connectionData, // 兼容 connectionData, connectionId, connectionType, connectionName, }; } public getSubmitValue(): Connection { const { connectionType, connectionId, connectionName, connectionData } = this.options.formData; return { connectionId, connectionType, connectionName: this.plugin.getConnectionName ? this.plugin.getConnectionName() : connectionName, connectionData: BI.extend({}, connectionData, this.plugin.getValue()), }; } }