@flexem/fc-gui 3.0.0-alpha.114 → 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.
@@ -21868,11 +21868,13 @@ var variable_communicator = __webpack_require__(262);
21868
21868
 
21869
21869
  // CONCATENATED MODULE: ./.tmp/communication/variable/variable-value.ts
21870
21870
  class VariableValue {
21871
- constructor(variableName, state, value, timeStamp) {
21871
+ constructor(variableName, state, value, timeStamp, systemName, customStatus) {
21872
21872
  this.variableName = variableName;
21873
21873
  this.state = state;
21874
21874
  this.value = value;
21875
21875
  this.timeStamp = timeStamp;
21876
+ this.systemName = systemName;
21877
+ this.customStatus = customStatus;
21876
21878
  }
21877
21879
  }
21878
21880
 
@@ -35094,6 +35096,9 @@ class state_control_element_StateControlElement extends conditional_dynamic_disp
35094
35096
  if (!this.currentRect.length) {
35095
35097
  return;
35096
35098
  }
35099
+ // 元件绑定设备状态时不需要在右上角显示状态
35100
+ if (this.$element[0].dataset.model.includes('设备状态'))
35101
+ return;
35097
35102
  const document = this.$element[0].ownerDocument;
35098
35103
  const imgObj = document.createElementNS('http://www.w3.org/2000/svg', 'image');
35099
35104
  if (imgObj) {
@@ -35312,7 +35317,7 @@ class readable_element_ReadableElement extends conditional_enable_element_Condit
35312
35317
  }
35313
35318
  reportValueChanged(value) {
35314
35319
  Object(lodash["forEach"])(this.elementStates, elementState => {
35315
- if (elementState.variableName === value.variableName) {
35320
+ if (elementState.variableName === value.variableName || elementState.variableName === value.systemName) {
35316
35321
  elementState.state = value.state;
35317
35322
  this.changeStates();
35318
35323
  }
@@ -35322,6 +35327,28 @@ class readable_element_ReadableElement extends conditional_enable_element_Condit
35322
35327
  || value.variableName === this.maxVariableName) {
35323
35328
  this.updateVariableValue(value.value, value.variableName);
35324
35329
  }
35330
+ if (value.systemName === '设备状态') {
35331
+ let name = value.customStatus;
35332
+ const language = window.abp.localization.currentCulture.name;
35333
+ if (!name) {
35334
+ switch (value.state) {
35335
+ case 1:
35336
+ name = language === 'zh-Hans' ? '在线' : 'Online';
35337
+ break;
35338
+ case 3:
35339
+ name = language === 'zh-Hans' ? '离线' : 'Offline';
35340
+ break;
35341
+ case 4:
35342
+ name = language === 'zh-Hans' ? '告警' : 'Alarming';
35343
+ break;
35344
+ case 5:
35345
+ name = language === 'zh-Hans' ? '未绑定' : 'Unbound';
35346
+ break;
35347
+ default:
35348
+ }
35349
+ }
35350
+ this.updateVariableValue(name, '设备状态');
35351
+ }
35325
35352
  }
35326
35353
  }
35327
35354
 
@@ -41588,7 +41615,8 @@ class main_element_MainElement {
41588
41615
  Object(lodash["each"])(values, value => {
41589
41616
  Object(lodash["each"])(this.elements, e => {
41590
41617
  if (e instanceof readable_element_ReadableElement) {
41591
- if (e.readVariableName === value.variableName || e.minVariableName === value.variableName || e.maxVariableName === value.variableName) {
41618
+ if ((value.variableName && (e.readVariableName === value.variableName ||
41619
+ e.minVariableName === value.variableName || e.maxVariableName === value.variableName)) || e.readVariableName === value.systemName) {
41592
41620
  e.reportValueChanged(value);
41593
41621
  }
41594
41622
  }
@@ -41689,6 +41717,9 @@ class per_view_variable_communicator_PerViewVariableCommunicator {
41689
41717
  writeWordByBit(variableName, index, value) {
41690
41718
  return this._rawVariableCommunicator.writeWordByBit(variableName, index, value);
41691
41719
  }
41720
+ requestVirtualDeviceState() {
41721
+ return this._rawVariableCommunicator.requestVirtualDeviceState();
41722
+ }
41692
41723
  subscribeVariableState(variableName) {
41693
41724
  return this.subscribeVariableStates([variableName]).pipe(Object(operators_["map"])(values => values[0]));
41694
41725
  }
@@ -41787,6 +41818,20 @@ class gui_view_GuiView {
41787
41818
  this.openVariableStatesSubscription.unsubscribe();
41788
41819
  }
41789
41820
  this.openedVariableNames = this.mainElement.getVariableNames();
41821
+ if (this.openedVariableNames.indexOf('设备状态') !== -1) {
41822
+ if (this.requestVirtualDeviceState) {
41823
+ this.requestVirtualDeviceState.unsubscribe();
41824
+ }
41825
+ if (this.requestVirtualDeviceState) {
41826
+ this.requestVirtualDeviceState.unsubscribe();
41827
+ }
41828
+ this.normalOpenedVariableNames(['设备状态']);
41829
+ this.requestVirtualDeviceState =
41830
+ this.perViewVariableCommunicator.requestVirtualDeviceState().subscribe({
41831
+ complete: () => { }
41832
+ });
41833
+ this.openedVariableNames = this.openedVariableNames.filter(name => name !== '设备状态');
41834
+ }
41790
41835
  if (this.openedVariableNames.length === 0) {
41791
41836
  return;
41792
41837
  }
@@ -41896,6 +41941,12 @@ class gui_view_GuiView {
41896
41941
  if (this.openVariableStatesSubscription) {
41897
41942
  this.openVariableStatesSubscription.unsubscribe();
41898
41943
  }
41944
+ if (this.requestVirtualDeviceState) {
41945
+ this.requestVirtualDeviceState.unsubscribe();
41946
+ }
41947
+ if (this.virtualDeviceStatesChanged) {
41948
+ this.virtualDeviceStatesChanged.unsubscribe();
41949
+ }
41899
41950
  if (this.openVariablesSubscription) {
41900
41951
  this.openVariablesSubscription.unsubscribe();
41901
41952
  }
@@ -64214,6 +64265,7 @@ class remote_variable_communicator_RemoteVariableCommunicator {
64214
64265
  });
64215
64266
  this.doVariableStatesChanged();
64216
64267
  this.doVariableValuesChanged();
64268
+ this.doVirtualDeviceStatesChanged();
64217
64269
  this.doAlarmChanged();
64218
64270
  }
64219
64271
  doAlarmChanged() {
@@ -64244,6 +64296,25 @@ class remote_variable_communicator_RemoteVariableCommunicator {
64244
64296
  });
64245
64297
  });
64246
64298
  }
64299
+ doVirtualDeviceStatesChanged() {
64300
+ if (this.virtualDeviceStatesChangedSubscription !== undefined) {
64301
+ this.virtualDeviceStatesChangedSubscription.unsubscribe();
64302
+ }
64303
+ this.virtualDeviceStatesChangedSubscription =
64304
+ this.remoteVariableProtocol.virtualDeviceStatesChanged.subscribe((deviceStates) => {
64305
+ Object(lodash["each"])(deviceStates, deviceState => {
64306
+ const variableName = '设备状态';
64307
+ this.variableValueCache.set(variableName, deviceState);
64308
+ const data = Object.assign(Object.assign({}, deviceState), { systemName: '设备状态' });
64309
+ if (this.observers.has(variableName)) {
64310
+ Object(lodash["each"])(this.observers.get(variableName), ob => {
64311
+ // TODO 同一个ob监听多个变量的情况,组合成数组一次推送。
64312
+ ob.next([data]);
64313
+ });
64314
+ }
64315
+ });
64316
+ });
64317
+ }
64247
64318
  doVariableStatesChanged() {
64248
64319
  if (this.variableStatesChangedSubscription !== undefined) {
64249
64320
  this.variableStatesChangedSubscription.unsubscribe();
@@ -64317,6 +64388,9 @@ class remote_variable_communicator_RemoteVariableCommunicator {
64317
64388
  subscribeVariableState(variableName) {
64318
64389
  return this.subscribeVariableStates([variableName]).pipe(Object(operators_["map"])(values => values[0]));
64319
64390
  }
64391
+ requestVirtualDeviceState() {
64392
+ return this.remoteVariableProtocol.requestVirtualDeviceState();
64393
+ }
64320
64394
  openVariables(variableNames, appId = '') {
64321
64395
  return new Observable["a" /* Observable */](observer => {
64322
64396
  let variablesToStart = [];
@@ -64419,6 +64493,7 @@ class remote_variable_communicator_RemoteVariableCommunicator {
64419
64493
  this.connectedSubscription.unsubscribe();
64420
64494
  this.variableStatesChangedSubscription.unsubscribe();
64421
64495
  this.variableValuesChangedSubscription.unsubscribe();
64496
+ this.virtualDeviceStatesChangedSubscription.unsubscribe();
64422
64497
  this.alarmChangedSubscription.unsubscribe();
64423
64498
  if (this.logger && this.logger.isDebugEnabled()) {
64424
64499
  this.logger.debug('[VariableCommunicator] RemoteVariableCommunicator disposed.');