like há 6 meses atrás
pai
commit
00a9963959

+ 48 - 26
snowy-admin-web/src/views/motoring/report/initData.js

@@ -6,53 +6,75 @@ export const initColumns = [
 		width: 50
 	},
 	{
-		title: '通知标题',
-		dataIndex: 'title',
+		title: '告警来源',
+		dataIndex: 'source',
 		align: 'center',
-		ellipsis: true
+		ellipsis: true,
+		resizable: true
 	},
+	// {
+	// 	title: '通知类型',
+	// 	dataIndex: 'type',
+	// 	align: 'center',
+	// 	customRender({ value }) {
+	// 		return value == '1' ? '系统' : '预警'
+	// 	}
+	// },
 	{
-		title: '通知类型',
-		dataIndex: 'type',
+		title: '告警优先级',
+		dataIndex: 'priority',
 		align: 'center',
-		customRender({ value }) {
-			return value == '1' ? '系统' : '预警'
-		}
+		ellipsis: true,
+		resizable: true
 	},
 	{
-		title: '通知内容',
-		dataIndex: 'content',
+		title: '告警类型',
+		dataIndex: 'alarmType',
 		align: 'center',
-		ellipsis: true
+		ellipsis: true,
+		resizable: true
 	},
 	{
-		title: '监控目标',
-		dataIndex: 'targetName',
+		title: '告警内容',
+		dataIndex: 'message',
 		align: 'center',
-		ellipsis: true
+		ellipsis: true,
+		resizable: true,
+		width: 200
 	},
 	{
-		title: '传感器路数',
-		dataIndex: 'sensorRoute',
+		title: '告警值',
+		dataIndex: 'value',
 		align: 'center',
-		ellipsis: true
+		ellipsis: true,
+		resizable: true
 	},
 	{
-		title: '创建人',
-		dataIndex: 'createUserName',
+		title: '告警接收人',
+		dataIndex: 'alarmUsers',
 		align: 'center',
-		ellipsis: true
+		ellipsis: true,
+		resizable: true
 	},
 	{
-		title: '创建时间',
-		dataIndex: 'createTime',
+		title: '创建',
+		dataIndex: 'createUserName',
 		align: 'center',
-		ellipsis: true
+		ellipsis: true,
+		resizable: true
 	},
 	{
-		title: '操作',
-		dataIndex: 'options',
+		title: '告警时间',
+		dataIndex: 'alarmTime',
 		align: 'center',
-		ellipsis: true
+		ellipsis: true,
+		resizable: true
 	}
+	// {
+	// 	title: '操作',
+	// 	dataIndex: 'options',
+	// 	align: 'center',
+	// 	ellipsis: true,
+	// 	resizable: true
+	// }
 ]

+ 17 - 27
snowy-admin-web/src/views/motoring/report/list.vue

@@ -8,6 +8,7 @@
 			:row-selection="options.rowSelection"
 			:loading="loading"
 			bordered
+			@resizeColumn="handleResizeColumn"
 		>
 			<template #operator>
 				<!-- 搜索区域 -->
@@ -40,28 +41,6 @@
 										<a-input v-model:value="searchFormState.searchKey" placeholder="请输入关键字" allowClear />
 									</a-form-item>
 								</a-col>
-								<!-- <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
-									<a-form-item label="排序字段" name="sortField">
-										<a-input
-											v-model:value="searchFormState.sortField"
-											placeholder="请输入排序字段(驼峰名称。如:userName)"
-											allowClear
-										/>
-									</a-form-item>
-								</a-col>
-								<a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
-									<a-form-item label="排序方式" name="sortOrder">
-										<a-select
-											v-model:value="searchFormState.sortOrder"
-											placeholder="请选择排序方式"
-											style="width: 100%"
-											allowClear
-										>
-											<a-select-option value="ASCEND">升序</a-select-option>
-											<a-select-option value="DESCEND">降序</a-select-option>
-										</a-select>
-									</a-form-item>
-								</a-col> -->
 							</a-form>
 						</a-row>
 					</div>
@@ -79,7 +58,7 @@
 						</a-button>
 					</div>
 
-					<div class="btn-right">
+					<!-- <div class="btn-right">
 						<a-button class="xn-mg08" @click="handle">
 							<template #icon><logout-outlined /></template>处理
 						</a-button>
@@ -92,13 +71,22 @@
 						<a-button>
 							<template #icon><download-outlined /></template>导出
 						</a-button>
-					</div>
+					</div> -->
 				</div>
 			</template>
 
 			<template #bodyCell="{ column, record, index }">
 				<!-- 序号 -->
 				<template v-if="column.dataIndex === 'index'">{{ index + 1 }} </template>
+				<template v-if="column.dataIndex === 'alarmUsers'">
+					<span v-for="(e, i) in record.alarmUsers" :key="i">{{ e.userName + ',' }} </span></template
+				>
+				<template v-if="column.dataIndex === 'priority'">
+					<a-tag :color="record.priority == '高' ? '#f56c6c' : record.priority == '低' ? '#67c23a' : '#fd0303'">{{
+						record.priority
+					}}</a-tag>
+				</template>
+
 				<template v-if="column.dataIndex === 'options'">
 					<a-button type="link" size="small" @click="handlerEdit(record)">编辑</a-button>
 					<a-popconfirm title="确定要删除吗?" @confirm="handlerDel(record)">
@@ -116,12 +104,9 @@
 <script setup>
 	import { message } from 'ant-design-vue'
 	import { debounce, cloneDeep } from 'lodash-es'
-
 	import Form from './components/form.vue'
 	import DetailModal from './components/DetailModal.vue'
-
 	import { getPage, deleteMonitornotice } from '@/api/coldchain/monitornotice'
-
 	import { initColumns } from './initData'
 
 	const loading = ref(false)
@@ -141,6 +126,11 @@
 		}
 	}
 
+	// 可伸缩列
+	const handleResizeColumn = (w, col) => {
+		col.width = w
+	}
+
 	const columns = ref(initColumns)
 
 	const tableData = ref([]) // 用来存储表格数据