告警:类型字段修改

链路:order显示
This commit is contained in:
高云鹏 2024-11-21 15:11:33 +08:00
parent f8e047105d
commit 65338b5ec0
5 changed files with 20 additions and 19 deletions

View File

@ -30,15 +30,18 @@
<script setup lang="ts">
import { ref, reactive, computed, watch, onMounted } from 'vue'
const props = withDefaults(defineProps<{ visible: boolean; type: string; type138: any; type140: any }>(), {
const props = withDefaults(defineProps<{ visible: boolean; type: string; type138: any; type140: any; type199: any }>(), {
visible: false,
type: '138',
type138: [],
type140: [],
type199: [],
})
const showData = computed(() => {
let data = props.type === '138' ? props.type138 : props.type140
console.log(props);
let data = props.type === '138' ? props.type138 : props.type === '140' ? props.type140 : props.type199
return data.slice((pageSetting.current - 1) * pageSetting.pageSize, pageSetting.current * pageSetting.pageSize)
})

View File

@ -40,11 +40,11 @@
<el-table-column prop="eventTimeFormate" :label="AlarmsFieldsEnums['alarmTime']" align="center"> </el-table-column>
<el-table-column prop="deviceCode" :label="AlarmsFieldsEnums['airBlowerNumber']" align="center"> </el-table-column>
<el-table-column prop="eventText" :label="AlarmsFieldsEnums['faultDescription']" align="center"> </el-table-column>
<el-table-column prop="eventType" :label="AlarmsFieldsEnums['alarmType']" align="center">
<el-table-column prop="eventLevel" :label="AlarmsFieldsEnums['alarmType']" align="center">
<template #default="scope">
<div class="tip" v-if="scope.row.eventType===0">提示</div>
<div class="alarm" v-if="scope.row.eventType===1">告警</div>
<div class="fault" v-if="scope.row.eventType===2">故障</div>
<div class="tip" v-if="scope.row.eventType === 0">提示</div>
<div class="alarm" v-if="scope.row.eventType === 1">告警</div>
<div class="fault" v-if="scope.row.eventType === 2">故障</div>
</template>
</el-table-column>
@ -142,11 +142,11 @@ const getFormattedDate = (offset: number) => {
const airBlowerNumberValue = ref('')
const airBlowerList = ref([{ label: '', value: '' }])
//
const alarmTypeValue = ref('')
const alarmTypeValue = ref(2)
const alarmTypes = ref([
{ label: '提示', value: 0 },
{ label: '告警', value: 1 },
{ label: '故障', value: 2 },
{ label: '告警', value: 1 },
{ label: '提示', value: 0 },
])
const searchalarms = (): GetAlarmsTableParam => {
@ -160,7 +160,7 @@ const searchalarms = (): GetAlarmsTableParam => {
deviceCode.push(item.value)
})
}
return {
startTime: new Date(start).getTime() || new Date().setHours(0, 0, 0, 0).valueOf(),
endTime: new Date(end).getTime() || new Date().valueOf(),
@ -345,13 +345,13 @@ $paginationHeight: 32px;
}
.tablePart {
height: 100%;
.tip{
.tip {
border: 1px solid #39baf4;
width: fit-content;
margin: 0 auto;
padding: 5px;
border-radius: 6px;
color: #39baf4;
color: #39baf4;
}
.alarm {
border: 1px solid rgb(228, 161, 18);

View File

@ -23,7 +23,7 @@ export type GetAlarmsTableParam = {
startTime: string | number
endTime: string | number
deviceCode: any
eventLevel?: string | null
eventLevel?: string | number | null
pageNum?: Number
pageSize?: Number
}

View File

@ -182,7 +182,7 @@ let univerAPI: any = null
//#endregion
const init = async () => {
const reqSheetData = await getMappingList()
const sheetData = createSheetData(reqSheetData, 12)
const sheetData = createSheetData(reqSheetData, route.query.protocol as any)
const data = createWookbookData(route.query.protocol as any, route.query.id as string, sheetData)
initExcel(data)
getTreeDataType()
@ -379,7 +379,6 @@ const tipsPos = reactive({
const saveExcelData = () => {
const data = getData()
const val = createUpLoadExcelData(data)
console.log(val)
saveMappingList(val)
}

View File

@ -1075,8 +1075,6 @@ const DEFAULT_WORKBOOK_DATA = {
const createHeaderData = (protocol: string | number) => {
if (!protocol) return {}
const headerData: any = {}
console.log(protocol);
console.log(excelDefaultConfig[protocol]);
Object.keys(excelDefaultConfig[protocol!]).forEach((item) => {
const dynamicData: any = {}
@ -1238,8 +1236,10 @@ export const createUpLoadExcelData = (workbookData: any) => {
}
export const createSheetData = (data: any, protocol: string | number) => {
console.log('createSheetData')
if (!protocol) return {}
const excelCellDataMap: any = {}
const excelCellDataMap: any = {}
const headerData = createHeaderData(protocol)
const resultData: any = {}
Object.keys(headerData).forEach((item) => {
@ -1254,7 +1254,6 @@ export const createSheetData = (data: any, protocol: string | number) => {
const row = index + 1
result[row] = {}
Object.keys(obj).forEach((field) => {
const col = excelCellDataMap[field]
if (col) {
let custom: any