|
|
@@ -110,7 +110,7 @@
|
|
|
</div>
|
|
|
|
|
|
<!-- 更新时间 -->
|
|
|
- <div class="update-time">更新时间:{{ updateTime }}</div>
|
|
|
+ <div class="update-time">更新时间:{{ updateTime }} </div>
|
|
|
|
|
|
<!-- 卡片视图 -->
|
|
|
<div
|
|
|
@@ -158,10 +158,36 @@
|
|
|
item.alarmLogStatusDTO?.alarmId == 4
|
|
|
}"
|
|
|
>
|
|
|
- <span class="alarm-text">{{
|
|
|
- getAlarmLevelText(item.alarmLogStatusDTO?.alarmId)
|
|
|
- }}</span>
|
|
|
- <i class="el-icon-bell alarm-icon"></i>
|
|
|
+ <span class="alarm-text">
|
|
|
+ <div
|
|
|
+ v-if="
|
|
|
+ item.alarmLogStatusDTO &&
|
|
|
+ item.alarmLogStatusDTO?.deviceData
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <div
|
|
|
+ v-for="(item, index) in JSON.parse(
|
|
|
+ item.alarmLogStatusDTO?.deviceData
|
|
|
+ ).filter((val) =>
|
|
|
+ evalFn(
|
|
|
+ val.value + val.operator + val.thresholdValue
|
|
|
+ )
|
|
|
+ )"
|
|
|
+ :key="index"
|
|
|
+ >
|
|
|
+ 点位:{{ item.attributeName }} 差值:{{
|
|
|
+ parseFloat(
|
|
|
+ (item.value - item.thresholdValue).toFixed(3)
|
|
|
+ )
|
|
|
+ }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </span>
|
|
|
+ <img
|
|
|
+ class="alarm-icon"
|
|
|
+ :src="getAlarmSrc(item.alarmLogStatusDTO?.alarmId)"
|
|
|
+ alt="alarm"
|
|
|
+ />
|
|
|
</div>
|
|
|
<div class="card-header">
|
|
|
<div>{{item.postName|}}</div>
|
|
|
@@ -240,6 +266,7 @@
|
|
|
</ele-split-layout>
|
|
|
</el-card>
|
|
|
</div>
|
|
|
+ <GlobalAudioUnlockButton></GlobalAudioUnlockButton>
|
|
|
</vue-fullscreen>
|
|
|
</template>
|
|
|
|
|
|
@@ -253,9 +280,16 @@
|
|
|
import { businessStatus } from '@/utils/dict/warehouse';
|
|
|
import DeptSelect from '@/components/CommomSelect/dept-selectNew.vue';
|
|
|
import { component } from 'vue-fullscreen';
|
|
|
+ import audioManager from '@/utils/audioManager.js';
|
|
|
+
|
|
|
+ import GlobalAudioUnlockButton from '@/components/GlobalAudioUnlockButton.vue';
|
|
|
export default {
|
|
|
mixins: [dictMixins, tableColumnsMixin],
|
|
|
- components: { DeptSelect, VueFullscreen: component },
|
|
|
+ components: {
|
|
|
+ DeptSelect,
|
|
|
+ VueFullscreen: component,
|
|
|
+ GlobalAudioUnlockButton
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
// 搜索表单
|
|
|
@@ -279,6 +313,7 @@
|
|
|
children: 'children',
|
|
|
label: 'name'
|
|
|
},
|
|
|
+ src: '',
|
|
|
// 分页参数
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
|
@@ -290,7 +325,9 @@
|
|
|
categoryLevelId: '',
|
|
|
rootCategoryLevelId: '',
|
|
|
loadingMore: false,
|
|
|
- loading: false
|
|
|
+ loading: false,
|
|
|
+ audioInstance: null,
|
|
|
+ pollingTimer: null
|
|
|
};
|
|
|
},
|
|
|
computed: {},
|
|
|
@@ -332,6 +369,20 @@
|
|
|
parentIdField: 'parentId'
|
|
|
});
|
|
|
});
|
|
|
+ // 3分钟轮询
|
|
|
+ this.pollingTimer = setInterval(() => {
|
|
|
+ this.pollDeviceData();
|
|
|
+ }, 3 * 60 * 1000);
|
|
|
+ },
|
|
|
+ beforeDestroy() {
|
|
|
+ if (this.pollingTimer) {
|
|
|
+ clearInterval(this.pollingTimer);
|
|
|
+ this.pollingTimer = null;
|
|
|
+ }
|
|
|
+ if (this.audioInstance) {
|
|
|
+ this.audioInstance.pause();
|
|
|
+ this.audioInstance = null;
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
activeTabChange() {
|
|
|
@@ -365,6 +416,13 @@
|
|
|
};
|
|
|
return textMap[level] || '';
|
|
|
},
|
|
|
+ getAlarmSrc(level) {
|
|
|
+ if (level == 1) return require('@/assets/y.gif');
|
|
|
+ if (level == 2) return require('@/assets/g.gif');
|
|
|
+ if (level == 3 || level == 4 || level == 5)
|
|
|
+ return require('@/assets/r.gif');
|
|
|
+ return '';
|
|
|
+ },
|
|
|
loadDeviceData(isLoadMore = false) {
|
|
|
if (this.loadingMore) return;
|
|
|
this.loadingMore = true;
|
|
|
@@ -421,6 +479,7 @@
|
|
|
this.deviceData = list;
|
|
|
}
|
|
|
this.total = res.count;
|
|
|
+ this.playAlarmSound();
|
|
|
console.log(res);
|
|
|
})
|
|
|
.catch(() => {
|
|
|
@@ -478,12 +537,96 @@
|
|
|
};
|
|
|
return textMap[status] || status;
|
|
|
},
|
|
|
+ playAlarmSound() {
|
|
|
+ const data = this.deviceData;
|
|
|
+ const hasHigh = data.some((item) =>
|
|
|
+ [3, 4, 5].includes(item.alarmLogStatusDTO?.alarmId)
|
|
|
+ );
|
|
|
+ const hasMedium = data.some(
|
|
|
+ (item) => item.alarmLogStatusDTO?.alarmId == 2
|
|
|
+ );
|
|
|
+ const hasLow = data.some(
|
|
|
+ (item) => item.alarmLogStatusDTO?.alarmId == 1
|
|
|
+ );
|
|
|
+
|
|
|
+ let src = '';
|
|
|
+ if (hasHigh) {
|
|
|
+ src = require('@/assets/r.mp3');
|
|
|
+ } else if (hasMedium) {
|
|
|
+ src = require('@/assets/g.mp3');
|
|
|
+ } else if (hasLow) {
|
|
|
+ src = require('@/assets/y.mp3');
|
|
|
+ }
|
|
|
+
|
|
|
+ console.log(src, 'src');
|
|
|
+ if (src) {
|
|
|
+ console.log(audioManager,'audioManager')
|
|
|
+ audioManager.play(src, { loop: false });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 3分钟轮询请求
|
|
|
+ pollDeviceData() {
|
|
|
+ const size = this.deviceData.length;
|
|
|
+ if (!size) return;
|
|
|
+ querySubstanceRunningMonitor({
|
|
|
+ pageNum: 1,
|
|
|
+ size: size,
|
|
|
+ categoryLevelId: this.categoryLevelId,
|
|
|
+ rootCategoryLevelId: this.rootCategoryLevelId,
|
|
|
+ areaId: this.areaId,
|
|
|
+ keyWord: this.keyWord,
|
|
|
+ postId: this.postId
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ const list = res.list.map((item) => {
|
|
|
+ let iotList = [];
|
|
|
+ if (item.iotPointDataList) {
|
|
|
+ item.iotPointDataList.forEach((element) => {
|
|
|
+ let data = item.iotModel.properties.find(
|
|
|
+ (iotModel) => iotModel.identifier == element.identifier
|
|
|
+ );
|
|
|
+ if (data) {
|
|
|
+ iotList.push({
|
|
|
+ ...element,
|
|
|
+ dataType: data.dataType
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ item['iotList'] = item.iotDashboardPoint.length
|
|
|
+ ? iotList.filter((iotListItem) =>
|
|
|
+ item.iotDashboardPoint.find(
|
|
|
+ (Point) =>
|
|
|
+ Point.identifier == iotListItem.identifier &&
|
|
|
+ Point.checked1
|
|
|
+ )
|
|
|
+ )
|
|
|
+ : iotList.filter((iotListItem, index) => index < 4);
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ this.deviceData = list;
|
|
|
+ this.total = res.count;
|
|
|
+ this.playAlarmSound();
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ },
|
|
|
|
|
|
// 搜索
|
|
|
handleSearch() {
|
|
|
this.pageNum = 1;
|
|
|
this.loadDeviceData();
|
|
|
},
|
|
|
+ evalFn(val) {
|
|
|
+ return eval(val);
|
|
|
+ },
|
|
|
+ getDeviceData(data) {
|
|
|
+ console.log(data, 'data');
|
|
|
+ if (data) {
|
|
|
+ return JSON.parse(data);
|
|
|
+ } else {
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+ },
|
|
|
// 重置
|
|
|
handleReset() {
|
|
|
this.keyWord = '';
|
|
|
@@ -826,13 +969,13 @@
|
|
|
|
|
|
.alarm-badge {
|
|
|
position: absolute;
|
|
|
- top: 10px;
|
|
|
- right: 10px;
|
|
|
+ top: 15px;
|
|
|
+ right: 130px;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
gap: 4px;
|
|
|
z-index: 2;
|
|
|
- animation: alarm-pulse 1.5s infinite;
|
|
|
+ //animation: alarm-pulse 1.5s infinite;
|
|
|
|
|
|
.alarm-text {
|
|
|
font-size: 12px;
|
|
|
@@ -840,7 +983,8 @@
|
|
|
}
|
|
|
|
|
|
.alarm-icon {
|
|
|
- font-size: 18px;
|
|
|
+ width: 30px;
|
|
|
+ height: 30px;
|
|
|
}
|
|
|
|
|
|
&.alarm-yellow {
|
|
|
@@ -1060,6 +1204,15 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @keyframes alarm-pulse {
|
|
|
+ 0%,
|
|
|
+ 100% {
|
|
|
+ transform: scale(1);
|
|
|
+ }
|
|
|
+ 50% {
|
|
|
+ transform: scale(1.15);
|
|
|
+ }
|
|
|
+ }
|
|
|
@keyframes alarm-pulse {
|
|
|
0%,
|
|
|
100% {
|