@flexem/fc-gui 3.0.0-alpha.115 → 3.0.0-alpha.116

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -84,7 +84,26 @@ export class ReadableElement extends ConditionalEnableElement {
84
84
  this.updateVariableValue(value.value, value.variableName);
85
85
  }
86
86
  if (value.systemName === '设备状态') {
87
- this.updateVariableValue(value.customStatus, '设备状态');
87
+ let name = value.customStatus;
88
+ const language = window.abp.localization.currentCulture.name;
89
+ if (!name) {
90
+ switch (value.state) {
91
+ case 1:
92
+ name = language === 'zh-Hans' ? '在线' : 'Online';
93
+ break;
94
+ case 3:
95
+ name = language === 'zh-Hans' ? '离线' : 'Offline';
96
+ break;
97
+ case 4:
98
+ name = language === 'zh-Hans' ? '告警' : 'Alarming';
99
+ break;
100
+ case 5:
101
+ name = language === 'zh-Hans' ? '未绑定' : 'Unbound';
102
+ break;
103
+ default:
104
+ }
105
+ }
106
+ this.updateVariableValue(name, '设备状态');
88
107
  }
89
108
  }
90
109
  }
package/gui/gui-view.js CHANGED
@@ -79,50 +79,29 @@ export class GuiView {
79
79
  if (this.requestVirtualDeviceState) {
80
80
  this.requestVirtualDeviceState.unsubscribe();
81
81
  }
82
- if (this.openedVariableNames.length === 1) {
83
- this.normalOpenedVariableNames(['设备状态']);
84
- this.requestVirtualDeviceState =
85
- this.perViewVariableCommunicator.requestVirtualDeviceState().subscribe({
86
- complete: () => { }
87
- });
88
- }
89
- else {
90
- this.openVariableStatesSubscription =
91
- this.perViewVariableCommunicator.subscribeVariableStates(this.openedVariableNames).subscribe((states) => {
92
- this.mainElement.reportVariableStates(states);
93
- const normalVariableNames = [];
94
- each(states, v => {
95
- if (v.state === VariableStateEnum.Normal && normalVariableNames.indexOf(v.variableName) === -1) {
96
- normalVariableNames.push(v.variableName);
97
- }
98
- });
99
- normalVariableNames.push('设备状态');
100
- this.normalOpenedVariableNames(normalVariableNames);
101
- this.requestVirtualDeviceState =
102
- this.perViewVariableCommunicator.requestVirtualDeviceState().subscribe({
103
- complete: () => { }
104
- });
105
- });
106
- }
82
+ this.normalOpenedVariableNames(['设备状态']);
83
+ this.requestVirtualDeviceState =
84
+ this.perViewVariableCommunicator.requestVirtualDeviceState().subscribe({
85
+ complete: () => { }
86
+ });
87
+ this.openedVariableNames = this.openedVariableNames.filter(name => name !== '设备状态');
107
88
  }
108
- else {
109
- if (this.openedVariableNames.length === 0) {
110
- return;
111
- }
112
- this.openVariableStatesSubscription =
113
- this.perViewVariableCommunicator.subscribeVariableStates(this.openedVariableNames).subscribe((states) => {
114
- this.mainElement.reportVariableStates(states);
115
- const normalVariableNames = [];
116
- each(states, v => {
117
- if (v.state === VariableStateEnum.Normal && normalVariableNames.indexOf(v.variableName) === -1) {
118
- normalVariableNames.push(v.variableName);
119
- }
120
- });
121
- if (normalVariableNames.length > 0) {
122
- this.normalOpenedVariableNames(normalVariableNames);
89
+ if (this.openedVariableNames.length === 0) {
90
+ return;
91
+ }
92
+ this.openVariableStatesSubscription =
93
+ this.perViewVariableCommunicator.subscribeVariableStates(this.openedVariableNames).subscribe((states) => {
94
+ this.mainElement.reportVariableStates(states);
95
+ const normalVariableNames = [];
96
+ each(states, v => {
97
+ if (v.state === VariableStateEnum.Normal && normalVariableNames.indexOf(v.variableName) === -1) {
98
+ normalVariableNames.push(v.variableName);
123
99
  }
124
100
  });
125
- }
101
+ if (normalVariableNames.length > 0) {
102
+ this.normalOpenedVariableNames(normalVariableNames);
103
+ }
104
+ });
126
105
  }
127
106
  popView(viewIndex, hostContainerId, el) {
128
107
  return this.context.configStore.viewStore.getViewConfig(viewIndex).pipe(map(view => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "main": "bundles/fc-gui.umd.js",
3
- "version": "3.0.0-alpha.115",
3
+ "version": "3.0.0-alpha.116",
4
4
  "module": "public_api.js",
5
5
  "typings": "public_api.d.ts",
6
6
  "license": "UNLICENSED",