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. 9
      src/app/link_set/link-set.component.ts
  4. 11
      src/app/link_status/link_status.component.ts
  5. 7
      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_COPY = 'ACTION_COPY';
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;
}
.dec-title-item-selected{
color: '#3685f2';
color: #3685f2;
border-bottom: solid 2px #3685f2;
}
.close-button {

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

@ -3,14 +3,15 @@ import LeftList from './left/left.component';
import linkSetModel from './link-set.model';
import Select from './select/select.component';
import Right from './right/right.component';
import {TAB_LINK_SET} from '@private/constants';
const className = 'fr.linkset';
const Widget: WidgetType = {
_store() {
return BI.Models.getModel(linkSetModel);
},
watch:{
watch: {
tab(tab: string) {
this.setVisible(tab === BI.i18nText('Dec-Dcm_Connection_Management'));
this.setVisible(tab === TAB_LINK_SET);
},
},
render() {
@ -25,8 +26,8 @@ const Widget: WidgetType = {
{
el: {
type: Left,
cls:'select-group',
items:[
cls: 'select-group',
items: [
{
type: Select,
},

11
src/app/link_status/link_status.component.ts

@ -2,15 +2,16 @@ import {WidgetType, Htape, Vtape, Left, Label} from '@ui';
import linkStatusModel from './link_status.model';
import LeftList from './left/left.component';
import Right from './right/right.component';
import {TAB_LINK_POOL} from '@private/constants';
const className = 'fr.linkstatus';
const Widget: WidgetType = {
_store() {
return BI.Models.getModel(linkStatusModel);
},
watch:{
watch: {
tab(tab: string) {
this.setVisible(tab === BI.i18nText('Dec-Dcm_Pool_Connection_Management'));
this.setVisible(tab === TAB_LINK_POOL);
},
},
render() {
@ -25,11 +26,11 @@ const Widget: WidgetType = {
{
el: {
type: Left,
cls:'select-group',
items:[
cls: 'select-group',
items: [
{
type: Label,
cls:'status-title',
cls: 'status-title',
text: BI.i18nText('Dec-Dcm_Data_Connections'),
},
],

7
src/app/title/title.component.ts

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

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

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

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

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

Loading…
Cancel
Save