@flexem/fc-gui 3.0.0-alpha.132 → 3.0.0-alpha.134
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.
- package/bundles/@flexem/fc-gui.umd.js +133 -11
- package/bundles/@flexem/fc-gui.umd.js.map +1 -1
- package/bundles/@flexem/fc-gui.umd.min.js +1 -1
- package/bundles/@flexem/fc-gui.umd.min.js.map +1 -1
- package/elements/scroll-alarm/scroll-alarm-element.d.ts +4 -0
- package/elements/scroll-alarm/scroll-alarm-element.js +133 -11
- package/elements/scroll-alarm/scroll-alarm-element.metadata.json +1 -1
- package/package.json +1 -1
|
@@ -42245,8 +42245,8 @@ class scroll_alarm_element_ScrollAlarmElement extends conditional_dynamic_displa
|
|
|
42245
42245
|
this.variableCommunicator = variableCommunicator;
|
|
42246
42246
|
this.autoCycle = (_b = (_a = this.model.generalSetting) === null || _a === void 0 ? void 0 : _a.autoCycle) !== null && _b !== void 0 ? _b : true;
|
|
42247
42247
|
this.maxResultCount = (_d = (_c = this.model.generalSetting) === null || _c === void 0 ? void 0 : _c.pageSize) !== null && _d !== void 0 ? _d : 500;
|
|
42248
|
-
// 检测是否是模拟运行模式(通过检查 alarmsStore
|
|
42249
|
-
this.isSimulateMode = alarmsStore && alarmsStore.
|
|
42248
|
+
// 检测是否是模拟运行模式(通过检查 alarmsStore 的标记属性,不受代码混淆影响)
|
|
42249
|
+
this.isSimulateMode = alarmsStore && alarmsStore.isSimulationStore === true;
|
|
42250
42250
|
if (this.model.filterSetting && this.model.filterSetting.detailsData && this.model.filterSetting.detailsData.length > 0) {
|
|
42251
42251
|
this.alarmNames = this.model.filterSetting.detailsData.map(item => item.name);
|
|
42252
42252
|
// 如果是模拟运行模式,使用静态显示逻辑(类似设计态)
|
|
@@ -42286,12 +42286,8 @@ class scroll_alarm_element_ScrollAlarmElement extends conditional_dynamic_displa
|
|
|
42286
42286
|
this.isWaitingForAlarmRefresh = true;
|
|
42287
42287
|
// 设置节流定时器,1秒后执行
|
|
42288
42288
|
this.alarmRefreshThrottleId = setTimeout(() => {
|
|
42289
|
-
//
|
|
42290
|
-
this.
|
|
42291
|
-
// 如果非自动循环模式,需要重新启动滚动
|
|
42292
|
-
if (!this.autoCycle && !this.isScrolling) {
|
|
42293
|
-
this.initScrolling();
|
|
42294
|
-
}
|
|
42289
|
+
// 收到新告警消息,实时替换当前滚动内容,不影响滚动
|
|
42290
|
+
this.replaceCurrentScrollingContent();
|
|
42295
42291
|
// 重置等待刷新标志
|
|
42296
42292
|
this.isWaitingForAlarmRefresh = false;
|
|
42297
42293
|
}, 1000);
|
|
@@ -42517,7 +42513,7 @@ class scroll_alarm_element_ScrollAlarmElement extends conditional_dynamic_displa
|
|
|
42517
42513
|
const textContainer = document.createElement('div');
|
|
42518
42514
|
textContainer.style.cssText = `
|
|
42519
42515
|
font: ${this.fontString};
|
|
42520
|
-
color: ${this.headerFont.color || '#
|
|
42516
|
+
color: ${this.headerFont.color || '#e33c39'};
|
|
42521
42517
|
white-space: nowrap;
|
|
42522
42518
|
overflow: visible;
|
|
42523
42519
|
`;
|
|
@@ -42592,7 +42588,7 @@ class scroll_alarm_element_ScrollAlarmElement extends conditional_dynamic_displa
|
|
|
42592
42588
|
if (this.displayedItems.length <= 0)
|
|
42593
42589
|
return;
|
|
42594
42590
|
// 每次滚动的距离
|
|
42595
|
-
const scrollStep =
|
|
42591
|
+
const scrollStep = 6; // 减小滚动步长,使滚动更平滑
|
|
42596
42592
|
// 更新位置 - 从右往左滚动
|
|
42597
42593
|
this.currentLeft -= scrollStep;
|
|
42598
42594
|
// 检查是否需要加载下一页(只有在自动循环模式下才需要预加载)
|
|
@@ -42802,7 +42798,7 @@ class scroll_alarm_element_ScrollAlarmElement extends conditional_dynamic_displa
|
|
|
42802
42798
|
const textContainer = document.createElement('div');
|
|
42803
42799
|
textContainer.style.cssText = `
|
|
42804
42800
|
font: ${this.fontString};
|
|
42805
|
-
color: ${this.headerFont.color || '#
|
|
42801
|
+
color: ${this.headerFont.color || '#e33c39'};
|
|
42806
42802
|
white-space: nowrap;
|
|
42807
42803
|
overflow: visible;
|
|
42808
42804
|
`;
|
|
@@ -42873,6 +42869,132 @@ class scroll_alarm_element_ScrollAlarmElement extends conditional_dynamic_displa
|
|
|
42873
42869
|
}
|
|
42874
42870
|
}
|
|
42875
42871
|
}
|
|
42872
|
+
/**
|
|
42873
|
+
* 实时替换当前滚动内容(用于告警数据变化时)
|
|
42874
|
+
*/
|
|
42875
|
+
replaceCurrentScrollingContent() {
|
|
42876
|
+
var _a, _b;
|
|
42877
|
+
// 更新查询时间范围
|
|
42878
|
+
this.updateQueryTimeRange();
|
|
42879
|
+
// 查询所有当前应该显示的数据(查询足够多的数据以确保包含所有新增/删除)
|
|
42880
|
+
const selectedStates = (_a = this.model.generalSetting) === null || _a === void 0 ? void 0 : _a.selectState;
|
|
42881
|
+
const timeSort = (_b = this.model.generalSetting) === null || _b === void 0 ? void 0 : _b.timeSort;
|
|
42882
|
+
// 使用一个较大的值确保能查询到所有数据,避免因新增数据导致查询不全
|
|
42883
|
+
const queryCount = Math.max(this.displayedItems.length || this.maxResultCount, 100);
|
|
42884
|
+
// 确定排序参数
|
|
42885
|
+
let sorting = 'TriggeredTime ASC'; // 默认升序
|
|
42886
|
+
if (timeSort === 0 || timeSort === '0') {
|
|
42887
|
+
sorting = 'TriggeredTime ASC'; // 升序
|
|
42888
|
+
}
|
|
42889
|
+
else if (timeSort === 1 || timeSort === '1') {
|
|
42890
|
+
sorting = 'TriggeredTime DESC'; // 降序
|
|
42891
|
+
}
|
|
42892
|
+
// 兼容处理:如果 selectedStates 为空数组或 undefined,传 undefined(不过滤)
|
|
42893
|
+
const stateFilter = (selectedStates && Array.isArray(selectedStates) && selectedStates.length > 0)
|
|
42894
|
+
? selectedStates
|
|
42895
|
+
: undefined;
|
|
42896
|
+
const input = new _tmp_config["c" /* GetAlarmsArgs */](this.alarmNames, this.startTime, this.endTime, queryCount, 0, // skipCount
|
|
42897
|
+
stateFilter, sorting);
|
|
42898
|
+
this.alarmsStore.getHistoryAlarms(input).subscribe(result => {
|
|
42899
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
42900
|
+
if (!result.error && result.items) {
|
|
42901
|
+
const newItems = result.items;
|
|
42902
|
+
// 如果没有数据,清空显示
|
|
42903
|
+
if (newItems.length === 0) {
|
|
42904
|
+
this.displayedItems = [];
|
|
42905
|
+
this.totalWidth = 0;
|
|
42906
|
+
this.pageWidths = [];
|
|
42907
|
+
this.currentPage = 1;
|
|
42908
|
+
this.hasTriedFirstPage = false;
|
|
42909
|
+
this.hasMoreData = true;
|
|
42910
|
+
// 清空DOM
|
|
42911
|
+
if (this.allAlarmsContainer) {
|
|
42912
|
+
this.allAlarmsContainer.innerHTML = '';
|
|
42913
|
+
const containerWidth = this.model.size.width;
|
|
42914
|
+
this.currentLeft = containerWidth;
|
|
42915
|
+
this.allAlarmsContainer.style.left = `${containerWidth}px`;
|
|
42916
|
+
}
|
|
42917
|
+
return;
|
|
42918
|
+
}
|
|
42919
|
+
// 如果是首次加载或当前没有数据,直接渲染
|
|
42920
|
+
if (this.displayedItems.length === 0) {
|
|
42921
|
+
this.displayedItems = newItems;
|
|
42922
|
+
this.allAlarmsContainer.innerHTML = '';
|
|
42923
|
+
this.totalWidth = 0;
|
|
42924
|
+
this.pageWidths = [];
|
|
42925
|
+
this.renderNewPage(newItems);
|
|
42926
|
+
return;
|
|
42927
|
+
}
|
|
42928
|
+
// 保存当前的滚动位置
|
|
42929
|
+
const currentScrollPosition = this.currentLeft;
|
|
42930
|
+
// 清空所有DOM元素
|
|
42931
|
+
this.allAlarmsContainer.innerHTML = '';
|
|
42932
|
+
// 获取语言设置
|
|
42933
|
+
const language = ((_c = (_b = (_a = window.abp) === null || _a === void 0 ? void 0 : _a.localization) === null || _b === void 0 ? void 0 : _b.currentLanguage) === null || _c === void 0 ? void 0 : _c.name) || 'zh-Hans';
|
|
42934
|
+
const isChinese = language === 'zh-Hans' || language === 'zh';
|
|
42935
|
+
// 重新创建所有新数据的DOM元素
|
|
42936
|
+
for (let i = 0; i < newItems.length; i++) {
|
|
42937
|
+
const alarm = newItems[i];
|
|
42938
|
+
const textContainer = document.createElement('div');
|
|
42939
|
+
textContainer.style.cssText = `
|
|
42940
|
+
font: ${this.fontString};
|
|
42941
|
+
color: ${this.headerFont.color || '#e33c39'};
|
|
42942
|
+
white-space: nowrap;
|
|
42943
|
+
overflow: visible;
|
|
42944
|
+
`;
|
|
42945
|
+
if (this.headerFont.isUnderline) {
|
|
42946
|
+
textContainer.style.textDecoration = 'underline';
|
|
42947
|
+
}
|
|
42948
|
+
const contentParts = [];
|
|
42949
|
+
// 显示触发时间
|
|
42950
|
+
if (((_d = this.model.generalSetting) === null || _d === void 0 ? void 0 : _d.showTriggerTime) && alarm.triggeredTime) {
|
|
42951
|
+
const formattedTime = moment(alarm.triggeredTime).format('YYYY/MM/DD HH:mm:ss');
|
|
42952
|
+
contentParts.push(formattedTime);
|
|
42953
|
+
}
|
|
42954
|
+
// 显示告警等级
|
|
42955
|
+
if (((_e = this.model.generalSetting) === null || _e === void 0 ? void 0 : _e.showAlarmLevel) && alarm.alarmLevel !== undefined) {
|
|
42956
|
+
const levelMap = isChinese ? ['警告', '次要', '主要', '严重'] : ['Warning', 'Minor', 'Major', 'Critical'];
|
|
42957
|
+
const alarmLevel = levelMap[alarm.alarmLevel] || (isChinese ? '警告' : 'Warning');
|
|
42958
|
+
contentParts.push(alarmLevel);
|
|
42959
|
+
}
|
|
42960
|
+
// 显示告警名称
|
|
42961
|
+
if (((_f = this.model.generalSetting) === null || _f === void 0 ? void 0 : _f.showAlarmName) && alarm.name) {
|
|
42962
|
+
contentParts.push(alarm.name);
|
|
42963
|
+
}
|
|
42964
|
+
// 显示告警内容
|
|
42965
|
+
if (((_g = this.model.generalSetting) === null || _g === void 0 ? void 0 : _g.showAlarmContent) && alarm.message) {
|
|
42966
|
+
contentParts.push(alarm.message);
|
|
42967
|
+
}
|
|
42968
|
+
// 显示告警状态
|
|
42969
|
+
if (((_h = this.model.generalSetting) === null || _h === void 0 ? void 0 : _h.showAlarmState) && alarm.state !== undefined) {
|
|
42970
|
+
const stateMap = isChinese ? ['触发/未确认', '触发/已确认', '恢复/未确认', '恢复/已确认'] : ['Triggered/Unconfirmed', 'Triggered/Confirmed', 'Restored/Unconfirmed', 'Restored/Confirmed'];
|
|
42971
|
+
const alarmState = stateMap[alarm.state] || (isChinese ? '触发/未确认' : 'Triggered/Unconfirmed');
|
|
42972
|
+
contentParts.push(alarmState);
|
|
42973
|
+
}
|
|
42974
|
+
textContainer.textContent = contentParts.join(' ');
|
|
42975
|
+
textContainer.setAttribute('data-index', i.toString());
|
|
42976
|
+
this.allAlarmsContainer.appendChild(textContainer);
|
|
42977
|
+
}
|
|
42978
|
+
// 重新计算totalWidth
|
|
42979
|
+
const allChildren = Array.from(this.allAlarmsContainer.children);
|
|
42980
|
+
let newTotalWidth = 0;
|
|
42981
|
+
allChildren.forEach(child => {
|
|
42982
|
+
newTotalWidth += child.offsetWidth + 80;
|
|
42983
|
+
});
|
|
42984
|
+
if (newTotalWidth > 0) {
|
|
42985
|
+
newTotalWidth -= 80; // 移除最后一个gap
|
|
42986
|
+
}
|
|
42987
|
+
// 更新状态
|
|
42988
|
+
this.displayedItems = newItems;
|
|
42989
|
+
this.totalWidth = newTotalWidth;
|
|
42990
|
+
this.pageWidths = [newTotalWidth]; // 重置为单页
|
|
42991
|
+
this.hasMoreData = result.totalCount > newItems.length;
|
|
42992
|
+
// 保持滚动位置不变,继续滚动
|
|
42993
|
+
this.currentLeft = currentScrollPosition;
|
|
42994
|
+
this.allAlarmsContainer.style.left = `${this.currentLeft}px`;
|
|
42995
|
+
}
|
|
42996
|
+
});
|
|
42997
|
+
}
|
|
42876
42998
|
}
|
|
42877
42999
|
|
|
42878
43000
|
// CONCATENATED MODULE: ./.tmp/elements/main-element.ts
|