Merge branch 'master' of git.code.tencent.com:xian-ncc-da/xian-ncc-da-client

This commit is contained in:
Yuan 2023-08-18 13:12:53 +08:00
commit a0eb49b73b
12 changed files with 195 additions and 34 deletions

View File

@ -1,5 +1,6 @@
import { api } from 'src/boot/axios';
import { PageDto, PageQueryDto } from './ApiCommon';
import { AlarmInfo } from './DecisionInfo';
const alertUriBase = '/api/alert/mock';
@ -34,3 +35,23 @@ export async function alarmInfoListQuery(
});
return response.data;
}
/**
*
* @param recordId id
* * @param tipId id
*/
export function recordConfirmAlarmInfoByTipType(
id: number,
tipType: string
): Promise<AlarmInfo<Item>> {
return api.get(`/api/alertRecord/confirm/${id}/${tipType}`);
}
/**
*
* @param recordId id
*/
export function recordFailAlarmInfoById(id: number) {
return api.get(`/api/alertRecord/fail/${id}`);
}

View File

@ -48,6 +48,14 @@ export function queryAlarmInfoById(id: number): Promise<AlarmInfo<Item>> {
return api.get(`${DraftUriBase}/id/${id}`);
}
/**
*
* @param type 稿type
*/
export function queryAlarmInfoByType(type: string): Promise<AlarmInfo<Item>> {
return api.get(`${DraftUriBase}/type/${type}`);
}
/**
*
* @param params

View File

@ -24,7 +24,10 @@
</div>
<div class="right">
<div class="text">设备{{ alarmInfo.alertObject }}</div>
<div class="text">类型{{ alarmInfo.alertType }}</div>
<div class="text" v-if="!showFaultType">
类型{{ alarmInfo.alertType }}
</div>
<div class="text" v-else>类型{{ faultType }}</div>
</div>
</div>
</q-card>
@ -33,7 +36,7 @@
<q-card class="box-card">
<div class="head">选择故障类型</div>
<q-separator />
<div class="detail">
<q-form class="detail" ref="myForm" @submit="submitChooseType">
<q-select
style="width: 200px"
dense
@ -41,17 +44,18 @@
v-model="faultType"
:options="faultTypeOptions"
label="故障类型"
:rules="[(val) => val.length > 0 || '请选择故障类型!']"
/>
<q-card-actions align="left">
<q-btn
color="primary"
class="q-mr-md"
label="确认"
@click="submitChooseType"
type="submit"
/>
<q-btn color="primary" label="误报" @click="falsePositives" />
</q-card-actions>
</div>
</q-form>
</q-card>
</div>
<div class="decision-message" v-else>
@ -79,9 +83,13 @@
import DraggableDialog from '../common/DraggableDialog.vue';
import { useLineNetStore, AlarmInfo } from 'src/stores/line-net-store';
import { onMounted, ref } from 'vue';
import { QForm, useQuasar } from 'quasar';
import { saveAlertTypeData, showAlertTypeData } from './alarmInfoEnum';
import {
recordConfirmAlarmInfoByTipType,
recordFailAlarmInfoById,
} from 'src/api/AlertMock';
import { queryAlarmInfoById } from 'src/api/DecisionInfo';
import { useQuasar } from 'quasar';
import { showAlertTypeData } from './alarmInfoEnum';
const props = defineProps({
alarmMeaasge: {
@ -94,11 +102,8 @@ const dialogWidth = window.screen.width * 0.5;
const lineNetStore = useLineNetStore();
const showConfirmMmessage = ref(true);
const faultType = ref('');
const faultTypeOptions = [
{ label: '道岔均失表', value: 'SWITCH_All_LOST' },
{ label: '道岔定位失表', value: 'SWITCH_DW_LOST' },
{ label: '道岔反位失表', value: 'SWITCH_FW_LOST' },
];
let faultTypeOptions = [];
const showFaultType = ref(false);
const mapColor = new Map([
['I', 'rgb(250,61,46)'],
@ -126,17 +131,38 @@ onMounted(() => {
messageUse = lineNetStore.alarmInfo[0] as AlarmInfo;
} else {
messageUse = props.alarmMeaasge as AlarmInfo;
if (messageUse.alarmStatus == 1 || messageUse.alarmStatus == 0) {
showConfirmMmessage.value = false;
searchById();
}
}
updata();
switch (alarmInfo.value.alertType) {
case '道岔失表':
faultTypeOptions = ['道岔均失表', '道岔定位失表', '道岔反位失表'];
break;
default:
faultTypeOptions = [alarmInfo.value.alertType];
faultType.value = alarmInfo.value.alertType;
break;
}
});
const myForm = ref<QForm | null>(null);
function submitChooseType() {
showConfirmMmessage.value = false;
search();
myForm.value?.validate().then(async (res) => {
if (res) {
showConfirmMmessage.value = false;
showFaultType.value = true;
searchByTipType();
}
});
}
function falsePositives() {
showDialog.value = false;
recordFailAlarmInfoById(+messageUse.id);
lineNetStore.treatedAlarm(messageUse);
}
function updata() {
@ -152,7 +178,25 @@ function updata() {
alarmInfo.value.lineId = messageUse.line_id;
}
async function search() {
async function searchByTipType() {
try {
const type = (saveAlertTypeData as never)[faultType.value];
const response = await recordConfirmAlarmInfoByTipType(
+messageUse.id,
type
);
drivingInfo.value = JSON.parse(response.data.drivingInfo);
submissionInfo.value = JSON.parse(response.data.submissionInfo);
lineNetStore.treatedAlarm(messageUse);
} catch (err) {
$q.notify({
type: 'negative',
message: '没有此类故障的辅助决策信息',
});
}
}
async function searchById() {
try {
const id = messageUse.alert_tip_id;
const response = await queryAlarmInfoById(id);
@ -194,7 +238,7 @@ async function search() {
.confirm-message {
margin: 10px 0;
.box-card {
height: 150px;
height: 180px;
padding: 0 5px;
.head {
padding: 5px 5px;

View File

@ -10,6 +10,12 @@ export enum showAlertTypeData {
'道岔均失表',
'道岔定位失表',
'道岔反位失表',
'红光带',
'橙光带',
'计轴红光带',
'计轴大面积红光带',
'计轴橙光带',
'计轴大面积橙光带',
I = 'I类信息',
II = 'II类信息',
III = 'III类信息',
@ -25,9 +31,14 @@ export enum showAlertTypeData {
HJM_LSQ = '胡家庙联锁区',
BCT_LSQ = '北池头联锁区',
BSQ_LSQ = '保税区联锁区',
SWITCH_LOST = '道岔失表',
SWITCH_All_LOST = '道岔均失表',
SWITCH_DW_LOST = '道岔定位失表',
SWITCH_FW_LOST = '道岔反位失表',
AXLE_LED_RED = '计轴红光带',
AXLE_LED_RED_MOST = '计轴大面积红光带',
AXLE_LED_ORANGE = '计轴橙光带',
AXLE_LED_ORANGE_MOST = '计轴大面积橙光带',
}
export enum saveAlertTypeData {
@ -42,7 +53,12 @@ export enum saveAlertTypeData {
= 'HJM_LSQ',
= 'BCT_LSQ',
= 'BSQ_LSQ',
= 'SWITCH_LOST',
= 'SWITCH_All_LOST',
= 'SWITCH_DW_LOST',
= 'SWITCH_FW_LOST',
= 'AXLE_LED_RED',
= 'AXLE_LED_RED_MOST',
= 'AXLE_LED_ORANGE',
= 'AXLE_LED_ORANGE_MOST',
}

View File

@ -70,6 +70,12 @@ onMounted(() => {
});
});
enum showAlertStateData {
'误报',
'已处理',
undefined = '未处理',
}
const columnDefs: QTableColumn[] = [
{
name: 'id',
@ -116,6 +122,16 @@ const columnDefs: QTableColumn[] = [
},
align: 'center',
},
{
name: 'level',
label: '处理状态',
field: (row) => {
if (row.level) {
return (showAlertStateData as never)[row.alarmStatus + ''];
}
},
align: 'center',
},
{ name: 'operations', label: '操作', field: 'operations', align: 'center' },
];
@ -168,6 +184,7 @@ function openAlarmDialog(row: any) {
row.alert_type = row.alertType;
row.line_id = row.lineId;
row.alert_object = row.alertObject;
row.alert_tip_id = row.alertTipId;
dialogInstance.value = $q.dialog({
component: alarmInfoDialog,
componentProps: {

View File

@ -1,7 +1,7 @@
<template>
<div>
<audio ref="audio">
<source src="../../assets/red.mp3" type="audio/mpeg" />
<source :src="audioSrc" type="audio/mpeg" />
</audio>
</div>
</template>
@ -11,9 +11,14 @@ import { watch, onUnmounted, ref, onMounted } from 'vue';
import { useLineNetStore } from 'src/stores/line-net-store';
import { useQuasar } from 'quasar';
import alarmInfoDialog from 'src/components/alarm/alarmInfoDialog.vue';
import { showAlertTypeData } from './alarmInfoEnum';
import lost from '/alarmMusic/lost.mp3';
import red from '/alarmMusic/red.mp3';
import buzzer from '/alarmMusic/buzzer.mp3';
const lineNetStore = useLineNetStore();
const audio = ref();
const audioSrc = ref('');
const $q = useQuasar();
const dialogInstance = ref();
const playAble = ref(false);
@ -27,16 +32,31 @@ const watchInteract = () => {
watch(
() => lineNetStore.alarmInfo,
(val) => {
if (val.length && audio.value.paused && val[0].level == 'I') {
playAlarmMusic();
if (val.length && val[0].level == 'I') {
playAlarmMusic(val[0].alert_type);
alarm();
}
},
{ deep: true }
);
function playAlarmMusic() {
if (playAble.value) {
const redOption = ['计轴红光带', '计轴大面积红光带'];
function playAlarmMusic(type: number) {
if (playAble.value && audio.value.paused) {
const alarmType = (showAlertTypeData as never)[type + ''];
switch (true) {
case alarmType == '道岔失表':
audioSrc.value = lost;
break;
case redOption.includes(alarmType):
audioSrc.value = red;
break;
default:
audioSrc.value = buzzer;
break;
}
audio.value.src = audioSrc.value;
audio.value.play();
}
}

View File

@ -19,7 +19,11 @@
label="报警列表"
@click="alarmListQuery"
class="q-mr-sm"
/>
>
<q-badge v-if="lineNetStore.untreatedNum" color="red" floating>{{
badgeNum
}}</q-badge>
</q-btn>
<q-btn
v-show="route.path.includes('monitor')"
@ -116,7 +120,7 @@
</template>
<script setup lang="ts">
import { ref, reactive } from 'vue';
import { ref, reactive, computed } from 'vue';
import SysMenu from 'src/components/SysMenu.vue';
import { useRouter, useRoute } from 'vue-router';
import { Dialog, useQuasar } from 'quasar';
@ -124,6 +128,17 @@ import { clearJwtToken } from 'src/configs/TokenManage';
import { mockAlertSet } from 'src/api/AlertMock';
import alarmInfoList from 'src/components/alarm/alarmInfoList.vue';
import commonAlarm from 'src/components/alarm/commonAlarm.vue';
import { useLineNetStore } from 'src/stores/line-net-store';
import { saveAlertTypeData } from 'src/components/alarm/alarmInfoEnum';
const lineNetStore = useLineNetStore();
const badgeNum = computed(() => {
let n = lineNetStore.untreatedNum + '';
if (lineNetStore.untreatedNum > 99) {
n = '99+';
}
return n;
});
const leftDrawerOpen = ref(false);
const router = useRouter();
@ -172,21 +187,19 @@ const alertSetShow = ref(false);
const alertType = ref('');
const lineId = ref();
const optionsAlertType = [
'蓝显',
'列车延误2分钟',
'列车延误10分钟',
'蓝显',
'站台门无关闭且锁紧信号',
'整侧站台门无关闭锁紧信号',
'整侧站台门无法打开',
'整侧站台门无法关闭',
'道岔失表',
'计轴红光带',
'计轴大面积红光带',
'计轴橙光带',
'计轴大面积橙光带',
];
enum saveAlertTypeData {
列车延误2分钟 = 'TRAIN_DELAY_2',
列车延误10分钟 = 'TRAIN_DELAY_10',
蓝显 = 'BLUE_DISPLAY',
站台门无关闭且锁紧信号 = 'PLATFORM_DOOR_WITHOUT_LOCKED_SIGNAL',
整侧站台门无法打开 = 'PLATFORM_DOOR_CANNOT_OPEN',
整侧站台门无法关闭 = 'PLATFORM_DOOR_CANNOT_CLOSE',
}
async function alarmMockSet() {
try {
const type = (saveAlertTypeData as never)[alertType.value];
@ -204,6 +217,11 @@ async function alarmMockSet() {
//
const alarmListDialogInstance = ref();
function alarmListQuery() {
alarmListDialogInstance.value = $q.dialog({ component: alarmInfoList });
if (alarmListDialogInstance.value) return;
alarmListDialogInstance.value = $q
.dialog({ component: alarmInfoList })
.onCancel(() => {
alarmListDialogInstance.value = null;
});
}
</script>

View File

@ -271,6 +271,10 @@ const optionsAlertType = [
'道岔均失表',
'道岔定位失表',
'道岔反位失表',
'计轴红光带',
'计轴大面积红光带',
'计轴橙光带',
'计轴大面积橙光带',
];
const optionsTimeType = ['CLOCK_7_9', 'CLOCK_7_9_AND_19_21', '无'];
const locationType = ref('');

View File

@ -14,14 +14,19 @@ export interface AlarmInfo {
alert_object: string;
alert_type: number;
locator_device_id: string;
alarmStatus?: number;
}
export const useLineNetStore = defineStore('lineNet', {
state: () => ({
selectedGraphics: null as JlGraphic[] | null,
lineNetName: null as string | null,
alarmInfo: [] as AlarmInfo[], //报警信息
untreatedMap: new Map(), // 未处理的报警
}),
getters: {
untreatedNum: (state) => {
return state.untreatedMap.size;
},
selectedGraphicType: (state) => {
if (state.selectedGraphics) {
if (state.selectedGraphics.length === 1) {
@ -64,8 +69,16 @@ export const useLineNetStore = defineStore('lineNet', {
setLineNetName(name: string | null) {
this.lineNetName = name;
},
setAlarmInfo(data: []) {
setAlarmInfo(data: AlarmInfo[]) {
this.alarmInfo = data;
data.forEach((item) => {
this.untreatedMap.set(item.id, item);
});
},
treatedAlarm(data: AlarmInfo) {
if (this.untreatedMap.has(data.id)) {
this.untreatedMap.delete(data.id);
}
},
},
});