Browse Source

优化软件盘

master
LiLongLong 2 months ago
parent
commit
453e822770
  1. 3
      components.d.ts
  2. 129
      src/components/AlarmLight.vue
  3. 7
      src/components/dialogs/AlarmDetailByType.vue
  4. 3
      src/components/dialogs/AlarmModal.vue
  5. 67
      src/components/dialogs/AlarmRecordModal.vue
  6. 1
      src/pages/Index/Index.vue
  7. 43
      src/pages/Index/Regular/Running.vue

3
components.d.ts

@ -10,6 +10,7 @@ declare module 'vue' {
AlarmDetailByType: typeof import('./src/components/dialogs/AlarmDetailByType.vue')['default']
AlarmLight: typeof import('./src/components/AlarmLight.vue')['default']
AlarmModal: typeof import('./src/components/dialogs/AlarmModal.vue')['default']
AlarmRecordModal: typeof import('./src/components/dialogs/AlarmRecordModal.vue')['default']
Confirm: typeof import('./src/components/Confirm.vue')['default']
ConfirmModal: typeof import('./src/components/ConfirmModal.vue')['default']
DialogModal: typeof import('./src/components/dialogs/DialogModal.vue')['default']
@ -17,8 +18,6 @@ declare module 'vue' {
ElBadge: typeof import('element-plus/es')['ElBadge']
ElButton: typeof import('element-plus/es')['ElButton']
ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
ElCheckboxButton: typeof import('element-plus/es')['ElCheckboxButton']
ElCheckboxGroup: typeof import('element-plus/es')['ElCheckboxGroup']
ElCol: typeof import('element-plus/es')['ElCol']
ElDialog: typeof import('element-plus/es')['ElDialog']
ElDropdown: typeof import('element-plus/es')['ElDropdown']

129
src/components/AlarmLight.vue

@ -1,129 +0,0 @@
<template>
<div class="alarm-light-container" @click="onShowAlarmDetail">
<div
class="alarm-light"
:style="{ '--light-color': getColor }"
:class="{ 'pulse-animation': isActive }"
>
<span class="light-text">{{ text }}</span>
</div>
<el-dialog v-model="detailVisible" width="700" style="z-index: 999">
<AlarmDetailByType :currEventReport="alarmItem"/>
</el-dialog>
</div>
</template>
<script setup lang="ts">
import { defineProps, computed, ref } from 'vue';
import AlarmDetailByType from './dialogs/AlarmDetailByType.vue'
const detailVisible = ref(false)
const props = defineProps({
color: {
type: String,
default: 'red',
validator: (val: string) =>
['red', 'green', 'yellow', 'blue', 'custom'].includes(val) ||
val.startsWith('#')
},
customColor: {
type: String,
default: '#ff0000'
},
text: {
type: String,
default: 'ALERT'
},
//
cycleDuration: {
type: Number,
default: 2
},
//
active: {
type: Boolean,
default: true
},
alarmItem: {
type: Object,
default: () => {}
}
});
const getColor = computed(() => {
const colorMap: Record<string, string> = {
'red': '#ff0000',
'green': '#00cc00',
'yellow': '#ffff00',
'blue': '#0066ff',
'custom': props.customColor
};
return colorMap[props.color] || props.color;
});
const isActive = computed(() => props.active);
const onShowAlarmDetail = () => {
detailVisible.value = true;
console.log('alarm ==11= ', props.alarmItem)
}
</script>
<style scoped>
.alarm-light-container {
display: inline-block;
position: relative;
}
.alarm-light {
width: 7rem;
height: 7rem;
border-radius: 50%;
border: 2px solid rgba(255, 255, 255, 0.5);
position: relative;
overflow: hidden;
z-index: 1;
/* 基础样式 */
background-color: var(--light-color);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}
.light-text {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 14px;
color: white;
font-weight: bold;
text-shadow: 0 0 3px rgba(0, 0, 0, 0.8);
z-index: 2;
}
/* 从弱到强的脉动动画 */
.pulse-animation {
animation: pulse 2s infinite ease-in-out;
animation-duration: calc(var(--cycle-duration, 2) * 1s);
}
@keyframes pulse {
0%, 100% {
box-shadow:
0 0 5px var(--light-color),
0 0 8px var(--light-color),
0 0 10px var(--light-color);
opacity: 0.6;
transform: scale(0.95);
}
50% {
box-shadow:
0 0 10px var(--light-color),
0 0 15px var(--light-color),
0 0 18px var(--light-color),
0 0 20px var(--light-color);
opacity: 1;
transform: scale(1);
}
}
</style>

7
src/components/dialogs/AlarmDetailByType.vue

@ -53,10 +53,11 @@ import { useDeviceStore } from '@/store';
import type { WarningState } from '@/websocket/socket';
const deviceStore = useDeviceStore()
const currEventReport = ref<WarningState>(deviceStore.alarmItem)
const currEventReport = ref<WarningState>()
watchEffect(() => {
console.log('deviceStore.alarmItem--', deviceStore.alarmItem)
currEventReport.value = deviceStore.alarmItem
if(deviceStore.alarmItem){
currEventReport.value = deviceStore.alarmItem
}
})
</script>

3
src/components/dialogs/AlarmModal.vue

@ -60,7 +60,8 @@ const clearAlarm = (alarm: WarningState,index: number) => {
watchEffect(() => {
alarmList.value = [...deviceStore.alarmList]
console.log('deviceStore.alarmList--', deviceStore.alarmList)
alarmList.value = deviceStore.alarmList
})
</script>

67
src/components/dialogs/AlarmRecordModal.vue

@ -0,0 +1,67 @@
<template>
<div >
<!-- 左边报警列表 -->
<div v-if="alarmList && alarmList.length">
<el-table
ref="tableRef"
:data="alarmList"
show-overflow-tooltip
header-cell-class-name="table-header"
row-class-name="table-row">
<el-table-column type="index" label="序号" width="50"></el-table-column>
<el-table-column prop="keyName" label="名称" width="170">
<template #default="scope">
{{ scope.row.flagType === 'NormalFlag' ? scope.row.notTriggeredDisName : scope.row.triggeredStateName}}
</template>
</el-table-column>
<el-table-column prop="flagType" label="类型" width="170">
<template #default="scope">
{{ scope.row.flagType === 'NormalFlag' ? '正常' : scope.row.flagType === 'WarningFlag' ? '警告' : '异常'}}
</template>
</el-table-column>
</el-table>
</div>
</div>
</template>
<script lang="ts" setup>
import { useDeviceStore } from '@/store'
import type { WarningState } from '@/websocket/socket'
import { ref, watchEffect } from 'vue'
const deviceStore = useDeviceStore()
const alarmList = ref<WarningState[]>([])
watchEffect(() => {
alarmList.value = deviceStore.alarmList
})
</script>
<style scoped>
.alarm-container {
min-height: 20vh;
text-align: start;
}
.alarm-item {
height: 17vh;
cursor: pointer;
border-radius: 10px;
}
.alarm-item-title{
font-weight: bold
}
.alarm-name {
flex: 1;
}
.alarm-type {
margin: 0 10px;
padding: 2px 6px;
border-radius: 4px;
color: #fff;
}
.clear-alarm-btn{
margin-top: 10px;
height: 4rem;
font-size: 20px;
width:7rem;
}
</style>

1
src/pages/Index/Index.vue

@ -809,7 +809,6 @@ const handlePreReactionPosStateState = (data: PreReactionPosGroupStateMessage['d
const getProjectList = async () => {
const res = await getProjectInfo()
console.log('res-getProjectInfo--', res)
if (res.success) {
settingTubeStore.setSupportedProjects(res.data)
}

43
src/pages/Index/Regular/Running.vue

@ -25,6 +25,11 @@
</span>
</span>
</div>
<!-- <div class="alarm-history" @click="onShowAlarmRecordModal">
<span class="alarm-history-alarm-info"> 状态记录 </span>
<span class="alarm-history-alarm-info-value">
</span>
</div> -->
<!-- 光学模组 -->
<div class="scan-main">
<span class="scan-text">
@ -180,6 +185,9 @@
<el-dialog v-model="alarmVisible" title="状态列表" width="50vh">
<AlarmModal />
</el-dialog>
<el-dialog v-model="alarmRecordVisible" title="状态历史记录" width="50vh">
<AlarmRecordModal />
</el-dialog>
</div>
<!-- 弹窗提示 -->
<!-- <teleport to="body">
@ -216,6 +224,7 @@ import {
type WarningState,
} from '@/websocket/socket'
import AlarmModal from '@/components/dialogs/AlarmModal.vue'
import AlarmRecordModal from '@/components/dialogs/AlarmRecordModal.vue'
const consumablesStore = useConsumablesStore()
const runningStore = useRunningStore()
@ -226,14 +235,13 @@ const router = useRouter()
const alarmList = ref<WarningState[]>(deviceStore.alarmList)
const alarmVisible = ref(false)
const hasAlarm = ref(false)
const alarmRecordVisible = ref(false)
watchEffect(() => {
alarmList.value = deviceStore.alarmList
deviceStore.alarmList.forEach((item) => {
if(item.state){
hasAlarm.value = true
}
})
if(deviceStore.alarmFlagState){
hasAlarm.value = deviceStore.alarmFlagState.hasWarningTriggerFlag || deviceStore.alarmFlagState.hasErrorTriggerFlag
}
})
onMounted(()=>{
@ -309,6 +317,10 @@ watch(
const onShowAlarmModal = () => {
alarmVisible.value = true
}
const onShowAlarmRecordModal = () => {
alarmRecordVisible.value = true
}
</script>
<style lang="less" scoped>
#running-container {
@ -617,6 +629,27 @@ const onShowAlarmModal = () => {
}
}
.alarm-history{
position: fixed;
top: 20rem;
left: 0.575rem;
padding: 10px;
background-color:#36b5d6;/**#ffe2d1*/
border-radius: 5px;
.alarm-history-alarm-info {
color: #ffffff;/**#fd985f */
font-size: 18px;
display: block;
}
.alarm-history-alarm-info-value {
display: block;
background-color: #71d088;/**#fd985f */
color: white;
}
}
.scan-main {
position: fixed;
top: 55rem;

Loading…
Cancel
Save