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

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 { parseObjLineToHump } from '@/utils/parse-utils';
import { parseDateToStr } from '@/utils/date-utils'; import { parseDateToStr } from '@/utils/date-utils';
import useUserStore from '@/store/modules/user'; 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 rowsSQL = `select * from alarm where alarm_status='1' ${filterSQl}`;
// 查询 // 查询
let querySQL = ''; let querySQL = '';
querySQL += query.alarm_code
? ` and alarm_code = '${query.alarm_code}' ` if (query.alarmCode) {
: ''; querySQL += ` and alarm_code = '${query.alarmCode}' `;
querySQL += query.alarm_type }
? ` and alarm_type = '${query.alarm_type}' `
: ''; if (query.alarmType) {
querySQL += query.pv_flag ? ` and pv_flag = '${query.pv_flag}' ` : ''; querySQL += ` and alarm_type = '${query.alarmType}' `;
querySQL += query.orig_severity }
? ` and orig_severity in('${query.orig_severity}' )`
: ''; if (query.pvFlag) {
querySQL += query.ne_id ? ` and ne_id like '%${query.ne_id}%' ` : ''; querySQL += ` and pv_flag = '${query.pvFlag}' `;
querySQL += query.ne_name ? ` and ne_name like '%${query.ne_name}%' ` : ''; }
querySQL += query.ne_type ? ` and ne_type like '%${query.ne_type}%' ` : '';
querySQL += if (query.origSeverity) {
query.beginTime && query.endTime querySQL += ` and orig_severity in('${query.origSeverity}' )`;
? ` and event_time BETWEEN '${query.beginTime}' and ' ${query.endTime}'` }
: '';
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; 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) { if (result.code === RESULT_CODE_SUCCESS) {
let v = result.data.data[0]; let v = result.data.data[0];
const vArr = parseObjLineToHump(v['alarm']); const vArr = parseObjLineToHump(v['alarm']);

View File

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

View File

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