帆软决策平台数据连接界面库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

102 lines
3.7 KiB

import { shortcut, store } from '@core/core';
import { Button, Label } from '@fui/core';
import { TipFailModel } from './tip_fail.model';
@shortcut()
@store(TipFailModel)
export class TipFail extends BI.Widget {
static xtype = 'dec.dcm.components.test_status.tip_fail';
static EVENT_CLOSE = 'EVENT_CLOSE';
static EVENT_RELOAD = 'EVENT_RELOAD';
static EVENT_DETAIL = 'EVENT_DETAIL';
props = {
tipCls: '',
tipText: '',
retryText: '',
}
model: TipFailModel['model'];
store: TipFailModel['store'];
detailButton: Button;
failText:Label;
watch = {
isCollapse: (isCollapse: boolean) => {
this.detailButton.setText(isCollapse ?
BI.i18nText('Dec-Dcm_Connection_Handup_Information') :
BI.i18nText('Dec-Dcm_Connection_Detailed_Information'));
},
}
populateFail(text:string,isVisible:boolean){
this.failText.setText(text);
this.detailButton.setVisible(isVisible);
}
render() {
const { tipCls, tipText, retryText } = this.options;
return {
type: BI.CenterAdaptLayout.xtype,
items: [
{
type: BI.VerticalLayout.xtype,
items: [
{
type: BI.HorizontalAutoLayout.xtype,
cls: tipCls,
bgap: 20,
items: [{
type: 'bi.icon',
width: 60,
height: 60,
}],
}, {
type: BI.Label.xtype,
_bgap: 10,
text: tipText,
ref:(_ref:Label)=>{
this.failText=_ref;
}
},
{
type: BI.VerticalAdaptLayout.xtype,
hgap: 12,
items: [
{
type: BI.Button.xtype,
text: BI.i18nText('Dec-Dcm_Connection_Detailed_Information'),
clear: true,
ref: (_ref: Button) => {
this.detailButton = _ref;
},
handler: () => {
this.store.setIsCollapse(!this.model.isCollapse);
this.fireEvent(TipFail.EVENT_DETAIL, !this.model.isCollapse);
},
},
{
type: BI.Button.xtype,
light: true,
text: BI.i18nText('Dec-Dcm_Back'),
handler: () => {
this.fireEvent(TipFail.EVENT_CLOSE);
},
},
{
type: BI.Button.xtype,
text: retryText,
handler: () => {
this.store.setIsCollapse(false);
this.fireEvent(TipFail.EVENT_RELOAD);
},
},
],
},
],
},
],
};
}
}