Browse Source

refactor: 修正不规范的写法

master
alan 6 years ago
parent
commit
3c053bb854
  1. 37
      src/shared/service/dialog.service.ts

37
src/shared/service/dialog.service.ts

@ -131,17 +131,16 @@ class Dialog {
} }
public linkFail(text: string, more: string, cb?: Function): string { public linkFail(text: string, more: string, cb?: Function): string {
let dialogPopover = null;
let dialogMore = null; let dialogMore = null;
let showErrMessage = false;
const id = BI.UUID(); const id = BI.UUID();
const that = this;
const body = { const body = {
type: Vertical, type: Vertical,
items: [ items: [
{ {
type: 'bi.center_adapt', type: CenterAdapt,
cls: 'bi-card', cls: 'bi-card',
tgap: 10, vgap: 10,
items: [ items: [
{ {
type: Vertical, type: Vertical,
@ -160,7 +159,6 @@ class Dialog {
}, },
{ {
type: VerticalAdapt, type: VerticalAdapt,
cls: 'buttons',
hgap: 5, hgap: 5,
items: [ items: [
{ {
@ -168,27 +166,24 @@ class Dialog {
text: BI.i18nText('Dec-Dcm_Connection_Detailed_Information'), text: BI.i18nText('Dec-Dcm_Connection_Detailed_Information'),
level: 'ignore', level: 'ignore',
handler() { handler() {
const isHide = !dialogMore.isVisible(); showErrMessage = !showErrMessage;
dialogPopover.element.css({ dialogMore.setVisible(showErrMessage);
height: isHide ? '290' : '220', this.setText(showErrMessage ? BI.i18nText('Dec-Dcm_Connection_Handup_Information') : BI.i18nText('Dec-Dcm_Connection_Detailed_Information'));
});
dialogMore.setVisible(isHide);
this.setText(isHide ? BI.i18nText('Dec-Dcm_Connection_Handup_Information') : BI.i18nText('Dec-Dcm_Connection_Detailed_Information'));
}, },
}, },
{ {
type: Button, type: Button,
text: BI.i18nText('Dec-Dcm_Back'), text: BI.i18nText('Dec-Dcm_Back'),
level: 'ignore', level: 'ignore',
handler() { handler: () => {
that.remove(id); this.remove(id);
}, },
}, },
{ {
type: Button, type: Button,
text: BI.i18nText('Dec-Dcm_Connection_ReConnect'), text: BI.i18nText('Dec-Dcm_Connection_ReConnect'),
handler() { handler: () => {
that.close(id); this.remove(id);
cb ? cb() : null; cb ? cb() : null;
}, },
}, },
@ -202,10 +197,12 @@ class Dialog {
type: Label, type: Label,
cls: 'bi-header-background', cls: 'bi-header-background',
text: more, text: more,
invisible: true, invisible: !showErrMessage,
textAlign: 'left',
height: 73, height: 73,
width: 400, width: 400,
value: false, vgap: 10,
lgap: 5,
ref: _ref => { ref: _ref => {
dialogMore = _ref; dialogMore = _ref;
}, },
@ -219,14 +216,10 @@ class Dialog {
cls: 'bi-z-index-mask', cls: 'bi-z-index-mask',
items: [{ items: [{
el: { el: {
type: 'bi.center_adapt', type: CenterAdapt,
cls: 'bi-card', cls: 'bi-card',
width: 450, width: 450,
height: 220,
items: [body], items: [body],
ref: _ref => {
dialogPopover = _ref;
},
}, },
}], }],
}, },

Loading…
Cancel
Save