--修正活动历史告警的代码规范

This commit is contained in:
lai
2023-10-18 10:21:58 +08:00
parent caa0016626
commit 0845751a76
3 changed files with 55 additions and 59 deletions

View File

@@ -4,7 +4,6 @@ import { toRaw } from 'vue';
import { parseObjLineToHump } from '@/utils/parse-utils';
import { parseDateToStr } from '@/utils/date-utils';
import useUserStore from '@/store/modules/user';
import { ConsoleSqlOutlined } from '@ant-design/icons-vue';
/**
* 查询列表
@@ -16,23 +15,38 @@ export async function listAct(query: Record<string, any>, filterSQl: string) {
let rowsSQL = `select * from alarm where alarm_status='1' ${filterSQl}`;
// 查询
let querySQL = '';
querySQL += query.alarm_code
? ` and alarm_code = '${query.alarm_code}' `
: '';
querySQL += query.alarm_type
? ` and alarm_type = '${query.alarm_type}' `
: '';
querySQL += query.pv_flag ? ` and pv_flag = '${query.pv_flag}' ` : '';
querySQL += query.orig_severity
? ` and orig_severity in('${query.orig_severity}' )`
: '';
querySQL += query.ne_id ? ` and ne_id like '%${query.ne_id}%' ` : '';
querySQL += query.ne_name ? ` and ne_name like '%${query.ne_name}%' ` : '';
querySQL += query.ne_type ? ` and ne_type like '%${query.ne_type}%' ` : '';
querySQL +=
query.beginTime && query.endTime
? ` and event_time BETWEEN '${query.beginTime}' and ' ${query.endTime}'`
: '';
if (query.alarmCode) {
querySQL += ` and alarm_code = '${query.alarmCode}' `;
}
if (query.alarmType) {
querySQL += ` and alarm_type = '${query.alarmType}' `;
}
if (query.pvFlag) {
querySQL += ` and pv_flag = '${query.pvFlag}' `;
}
if (query.origSeverity) {
querySQL += ` and orig_severity in('${query.origSeverity}' )`;
}
if (query.neId) {
querySQL += ` and ne_id like '%${query.neId}%' `;
}
if (query.neName) {
querySQL += ` and ne_name like '%${query.neName}%' `;
}
if (query.neType) {
querySQL += ` and ne_type like '%${query.neType}%' `;
}
if (query.beginTime && query.endTime) {
querySQL += ` and event_time BETWEEN '${query.beginTime}' and ' ${query.endTime}'`;
}
// 分页
const pageNum = (query.pageNum - 1) * query.pageSize;
@@ -239,7 +253,6 @@ export async function exportAll(query: Record<string, any>) {
},
});
if (result.code === RESULT_CODE_SUCCESS) {
let v = result.data.data[0];
const vArr = parseObjLineToHump(v['alarm']);

View File

@@ -1,6 +1,5 @@
<script setup lang="ts">
import { useRoute } from 'vue-router';
import dayjs, { Dayjs } from 'dayjs';
import { reactive, ref, onMounted, toRaw } from 'vue';
import { PageContainer } from '@ant-design-vue/pro-layout';
import { message, Modal } from 'ant-design-vue/lib';
@@ -18,7 +17,6 @@ import {
getPass,
exportAll,
} from '@/api/faultManage/actAlarm';
import useNeInfoStore from '@/store/modules/neinfo';
import useI18n from '@/hooks/useI18n';
import saveAs from 'file-saver';
import { writeSheet } from '@/utils/execl-utils';
@@ -26,7 +24,6 @@ import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import { readLoalXlsx } from '@/utils/execl-utils';
const { t } = useI18n();
const route = useRoute();
type RangeValue = [Dayjs, Dayjs];
/**路由标题 */
let title = ref<string>((route.meta.title as string) ?? '标题');
@@ -36,23 +33,23 @@ let queryRangePicker = ref<[string, string]>(['', '']);
/**查询参数 */
let queryParams = reactive({
/**告警设备类型 */
ne_type: '',
neType: '',
/**告警网元名称 */
ne_name: '',
neName: '',
/**告警网元标识 */
ne_id: '',
neId: '',
/**告警编号 */
alarm_code: '',
alarmCode: '',
/**告警级别 */
orig_severity: '',
origSeverity: '',
beginTime: '',
endTime: '',
/**告警产生时间 */
eventTime: (queryRangePicker.value = ['', '']),
/**虚拟化标识 */
pv_flag: '',
pvFlag: '',
/**告警类型 */
alarm_type: '',
alarmType: '',
/**当前页数 */
pageNum: 1,
/**每页条数 */
@@ -63,21 +60,21 @@ let queryParams = reactive({
function fnQueryReset() {
queryParams = Object.assign(queryParams, {
/**告警设备类型 */
ne_type: '',
neType: '',
/**告警网元名称 */
ne_name: '',
neName: '',
/**告警网元标识 */
ne_id: '',
neId: '',
/**告警编号 */
alarm_code: '',
alarmCode: '',
/**告警级别 */
orig_severity: '',
origSeverity: '',
/**告警产生时间 */
eventTime: (queryRangePicker.value = ['', '']),
/**虚拟化标识 */
pv_flag: '',
pvFlag: '',
/**告警类型 */
alarm_type: '',
alarmType: '',
/**当前页数 */
});
tablePagination.current = 1;
@@ -295,20 +292,6 @@ let alarmTableColumns: ColumnsType = [
},
];
/**告警帮助文档 */
let pronInfo: any = reactive({
告警名称: '',
告警定位信息: '',
告警帮助信息: '',
告警类型: '',
告警级别: '',
告警编号: '',
告警问题原因: '',
清除类型: '',
英文标题: '',
适用网元: '',
});
/**表格分页器参数 */
let tablePagination = reactive({
/**当前页数 */
@@ -774,7 +757,7 @@ onMounted(() => {
name="ne_type"
>
<a-input
v-model:value="queryParams.ne_type"
v-model:value="queryParams.neType"
allow-clear
placeholder="查询告警设备类型"
></a-input>
@@ -786,7 +769,7 @@ onMounted(() => {
name="ne_name"
>
<a-input
v-model:value="queryParams.ne_name"
v-model:value="queryParams.neName"
allow-clear
placeholder="查询告警网元名称"
></a-input>
@@ -798,7 +781,7 @@ onMounted(() => {
name="ne_id"
>
<a-input
v-model:value="queryParams.ne_id"
v-model:value="queryParams.neId"
allow-clear
placeholder="查询告警网元标识"
></a-input>
@@ -827,7 +810,7 @@ onMounted(() => {
name="alarm_code"
>
<a-input
v-model:value="queryParams.alarm_code"
v-model:value="queryParams.alarmCode"
allow-clear
placeholder="查询告警编号"
></a-input>
@@ -839,7 +822,7 @@ onMounted(() => {
name="orig_severity"
>
<a-select
v-model:value="queryParams.orig_severity"
v-model:value="queryParams.origSeverity"
placeholder="Select alarm Type"
show-search
allow-clear
@@ -869,7 +852,7 @@ onMounted(() => {
name="pv_flag"
>
<a-select
v-model:value="queryParams.pv_flag"
v-model:value="queryParams.pvFlag"
placeholder="Select a person"
show-search
:options="actAlarmOption.pvFlag"
@@ -885,7 +868,7 @@ onMounted(() => {
name="alarm_type"
>
<a-select
v-model:value="queryParams.alarm_type"
v-model:value="queryParams.alarmType"
placeholder="Select alarm Type"
show-search
:options="actAlarmOption.alarmType"
@@ -1025,7 +1008,7 @@ onMounted(() => {
>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'origSeverity'">
<a-tag :color="profile.color[record.origSeverity]">{{
<a-tag :color="profile.color[record.origSeverity.toLowerCase()]">{{
record.origSeverity
}}</a-tag>
</template>

View File

@@ -767,7 +767,7 @@ onMounted(() => {
>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'origSeverity'">
<a-tag :color="profile.color[record.origSeverity]">{{
<a-tag :color="profile.color[record.origSeverity.toLowerCase()]">{{
record.origSeverity
}}</a-tag>
</template>