|
|
|
import {WidgetType, Left, Label, Button} from '@ui/index';
|
|
|
|
import RightTitleModel from '../../link-set.model';
|
|
|
|
import {LinkType} from '@ui/type';
|
|
|
|
import {saveConnection} from '../../link-set.service';
|
|
|
|
const className = 'fr.component.right.title';
|
|
|
|
const Widget: WidgetType = {
|
|
|
|
_store() {
|
|
|
|
return BI.Models.getModel(RightTitleModel);
|
|
|
|
},
|
|
|
|
render() {
|
|
|
|
const linkSelected: LinkType = this.model.linkSelected;
|
|
|
|
const that = this;
|
|
|
|
const {isEdit} = this.options;
|
|
|
|
|
|
|
|
return {
|
|
|
|
type: Left,
|
|
|
|
height: 40,
|
|
|
|
cls: 'right-title',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
type: Label,
|
|
|
|
cls: 'right-title-text',
|
|
|
|
text: `数据连接(${linkSelected.text ? linkSelected.text : '默认'})`,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: Button,
|
|
|
|
cls:'right-title-button',
|
|
|
|
invisible: isEdit,
|
|
|
|
text: '编辑',
|
|
|
|
handler() {
|
|
|
|
that.store.setEdit(true);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: Button,
|
|
|
|
cls:'right-title-button',
|
|
|
|
invisible: !isEdit,
|
|
|
|
text: '保存',
|
|
|
|
handler() {
|
|
|
|
saveConnection(that.model.linkUpdate).then(() => {
|
|
|
|
that.store.setEdit(false);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: Button,
|
|
|
|
cls:'right-title-button',
|
|
|
|
invisible: !isEdit,
|
|
|
|
level: 'ignore',
|
|
|
|
text: '取消',
|
|
|
|
handler() {
|
|
|
|
that.store.setCancel();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
],
|
|
|
|
};
|
|
|
|
},
|
|
|
|
};
|
|
|
|
BI.shortcut(className, BI.inherit(BI.Widget, Widget));
|
|
|
|
export default className;
|