Browse Source

refactor: 避免使用页面上的text做判断

qufenxi
alan 6 years ago
parent
commit
c77db613e9
  1. 3
      private/constants.ts
  2. 2
      src/app/app.component.scss
  3. 3
      src/app/link_set/link-set.component.ts
  4. 3
      src/app/link_status/link_status.component.ts
  5. 3
      src/app/title/title.component.ts
  6. 8
      src/app/title/title_item/title_item.component.ts
  7. 6
      src/shared/service/dialog.service.ts

3
private/constants.ts

@ -3,3 +3,6 @@ export const DEFAULT_INFO = 'DESIGNER';
export const ACTION_DELETE = 'ACTION_DELETE'; export const ACTION_DELETE = 'ACTION_DELETE';
export const ACTION_COPY = 'ACTION_COPY'; export const ACTION_COPY = 'ACTION_COPY';
export const ACTION_TEST = 'ACTION_TEST'; export const ACTION_TEST = 'ACTION_TEST';
export const TAB_LINK_SET = 'TAB_LINK_SET';
export const TAB_LINK_POOL = 'TAB_LINK_POOL';

2
src/app/app.component.scss

@ -20,7 +20,7 @@
cursor: pointer; cursor: pointer;
} }
.dec-title-item-selected{ .dec-title-item-selected{
color: '#3685f2'; color: #3685f2;
border-bottom: solid 2px #3685f2; border-bottom: solid 2px #3685f2;
} }
.close-button { .close-button {

3
src/app/link_set/link-set.component.ts

@ -3,6 +3,7 @@ import LeftList from './left/left.component';
import linkSetModel from './link-set.model'; import linkSetModel from './link-set.model';
import Select from './select/select.component'; import Select from './select/select.component';
import Right from './right/right.component'; import Right from './right/right.component';
import {TAB_LINK_SET} from '@private/constants';
const className = 'fr.linkset'; const className = 'fr.linkset';
const Widget: WidgetType = { const Widget: WidgetType = {
_store() { _store() {
@ -10,7 +11,7 @@ const Widget: WidgetType = {
}, },
watch: { watch: {
tab(tab: string) { tab(tab: string) {
this.setVisible(tab === BI.i18nText('Dec-Dcm_Connection_Management')); this.setVisible(tab === TAB_LINK_SET);
}, },
}, },
render() { render() {

3
src/app/link_status/link_status.component.ts

@ -2,6 +2,7 @@ import {WidgetType, Htape, Vtape, Left, Label} from '@ui';
import linkStatusModel from './link_status.model'; import linkStatusModel from './link_status.model';
import LeftList from './left/left.component'; import LeftList from './left/left.component';
import Right from './right/right.component'; import Right from './right/right.component';
import {TAB_LINK_POOL} from '@private/constants';
const className = 'fr.linkstatus'; const className = 'fr.linkstatus';
const Widget: WidgetType = { const Widget: WidgetType = {
@ -10,7 +11,7 @@ const Widget: WidgetType = {
}, },
watch: { watch: {
tab(tab: string) { tab(tab: string) {
this.setVisible(tab === BI.i18nText('Dec-Dcm_Pool_Connection_Management')); this.setVisible(tab === TAB_LINK_POOL);
}, },
}, },
render() { render() {

3
src/app/title/title.component.ts

@ -1,6 +1,7 @@
import {Left, WidgetType, IconButton} from '@ui/index'; import {Left, WidgetType, IconButton} from '@ui/index';
import TitleItem from './title_item/title_item.component'; import TitleItem from './title_item/title_item.component';
import {isDesigner, closeWindow} from '@shared/crud/crud.request'; import {isDesigner, closeWindow} from '@shared/crud/crud.request';
import {TAB_LINK_SET, TAB_LINK_POOL} from '@private/constants';
const className = 'fr.title'; const className = 'fr.title';
const Widget: WidgetType = { const Widget: WidgetType = {
render() { render() {
@ -12,6 +13,7 @@ const Widget: WidgetType = {
type: TitleItem, type: TitleItem,
cls: 'dec-title-item-selected', cls: 'dec-title-item-selected',
text: BI.i18nText('Dec-Dcm_Connection_Management'), text: BI.i18nText('Dec-Dcm_Connection_Management'),
value: TAB_LINK_SET,
ref: _ref => { ref: _ref => {
this.ConnectSet = _ref; this.ConnectSet = _ref;
}, },
@ -22,6 +24,7 @@ const Widget: WidgetType = {
{ {
type: TitleItem, type: TitleItem,
text: BI.i18nText('Dec-Dcm_Pool_Connection_Management'), text: BI.i18nText('Dec-Dcm_Pool_Connection_Management'),
value: TAB_LINK_POOL,
ref: _ref => { ref: _ref => {
this.ConnectPool = _ref; this.ConnectPool = _ref;
}, },

8
src/app/title/title_item/title_item.component.ts

@ -11,8 +11,8 @@ const Widget = BI.inherit(BI.BasicButton, {
}, },
watch: { watch: {
tab(tab: string) { tab(tab: string) {
const {text} = this.options; const {value} = this.options;
this.element.css(getSelectStyle(text, tab)); this.element.css(getSelectStyle(value, tab));
}, },
}, },
render() { render() {
@ -25,8 +25,8 @@ const Widget = BI.inherit(BI.BasicButton, {
}; };
}, },
select() { select() {
const {text} = this.options; const {value} = this.options;
this.store.setTab(text); this.store.setTab(value);
}, },
}); });
BI.shortcut(className, Widget); BI.shortcut(className, Widget);

6
src/shared/service/dialog.service.ts

@ -204,8 +204,7 @@ class Dialog {
}; };
BI.Popovers.create(id, { BI.Popovers.create(id, {
type: 'bi.popover', type: 'bi.popover',
cls: 'popover-notitle', cls: 'popover-notitle bi-custom-show',
extraCls: 'bi-custom-show',
size: 'normal', size: 'normal',
width: 450, width: 450,
height: 220, height: 220,
@ -225,8 +224,7 @@ class Dialog {
const id = BI.UUID(); const id = BI.UUID();
BI.Popovers.create(id, { BI.Popovers.create(id, {
type: 'bi.popover', type: 'bi.popover',
cls: 'popover-notitle', cls: 'popover-notitle bi-custom-show',
extraCls: 'bi-custom-show',
size: 'normal', size: 'normal',
width: 450, width: 450,
height: 220, height: 220,

Loading…
Cancel
Save