|
@@ -0,0 +1,280 @@
|
|
|
|
|
+<template>
|
|
|
|
|
+ <div class="p-2">
|
|
|
|
|
+ <transition :enter-active-class="proxy?.animate.searchAnimate.enter"
|
|
|
|
|
+ :leave-active-class="proxy?.animate.searchAnimate.leave">
|
|
|
|
|
+ <div v-show="showSearch" class="mb-[10px]" :style="{ marginTop: '10px', height: '60px' }">
|
|
|
|
|
+ <el-card shadow="hover">
|
|
|
|
|
+ <el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
|
|
|
|
+ <el-form-item label="设备名称" prop="name">
|
|
|
|
|
+ <el-input v-model="queryParams.name" placeholder="请输入设备名称" clearable @keyup.enter="handleQuery"/>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="设备SN" prop="serialNumber">
|
|
|
|
|
+ <el-input v-model="queryParams.serialNumber" placeholder="请输入设备SN" clearable @keyup.enter="handleQuery"/>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="MAC" prop="mac">
|
|
|
|
|
+ <el-input v-model="queryParams.mac" placeholder="请输入设备MAC" clearable @keyup.enter="handleQuery"/>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item>
|
|
|
|
|
+ <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
|
|
|
|
+ <el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ </el-card>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </transition>
|
|
|
|
|
+
|
|
|
|
|
+ <el-card shadow="never">
|
|
|
|
|
+ <div class="table-content">
|
|
|
|
|
+ <el-table v-loading="loading" :data="deviceList">
|
|
|
|
|
+ <el-table-column label="" align="left" prop="" width="10"/>
|
|
|
|
|
+ <el-table-column label="设备ID" align="left" prop="id" width="175" v-if="true"/>
|
|
|
|
|
+ <el-table-column label="设备标识" align="left" width="250" prop="identifier"/>
|
|
|
|
|
+ <el-table-column label="设备名称" align="left" prop="name" :show-overflow-tooltip="true"/>
|
|
|
|
|
+ <el-table-column label="设备SN" align="left" prop="serialNumber" :show-overflow-tooltip="true"/>
|
|
|
|
|
+ <el-table-column label="设备MAC" align="left" prop="mac" width="220"/>
|
|
|
|
|
+ <el-table-column label="在线状态" width="150" align="center" prop="onlineStatus">
|
|
|
|
|
+ <template #default="scope">
|
|
|
|
|
+ <dict-tag :options="sys_device_online" :value="scope.row.onlineStatus"/>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="操作" width="150" align="center" class-name="small-padding fixed-width">
|
|
|
|
|
+ <template #default="scope">
|
|
|
|
|
+ <el-tooltip content="开始抓取" placement="top">
|
|
|
|
|
+ <el-button link type="primary" icon="View" @click="handlePlayLine(scope.row)"
|
|
|
|
|
+ v-hasPermi="['device:log:add']">排期预览
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ </el-tooltip>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ </el-table>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
|
|
|
|
|
+ v-model:limit="queryParams.pageSize" @pagination="getList"/>
|
|
|
|
|
+ </el-card>
|
|
|
|
|
+ <!-- 排期列表 -->
|
|
|
|
|
+ <el-dialog :title="dialog.title" v-model="dialog.visible" style="height: 800px" width="1200px" append-to-body>
|
|
|
|
|
+ <div style="width: 100%;text-align: right;">
|
|
|
|
|
+ <el-date-picker v-model="dateRange" :clearable="false" @change="handleDateRangeChange" type="daterange"
|
|
|
|
|
+ range-separator="-" start-placeholder="开始日期"
|
|
|
|
|
+ end-placeholder="结束日期" class="date-picker"/>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div style="height: 600px;margin-top: 10px">
|
|
|
|
|
+ <el-row>
|
|
|
|
|
+ <el-col :span="8" style="margin-top: 10px">
|
|
|
|
|
+ <el-empty v-if="emptyFlag" :description="'暂无排期'"></el-empty>
|
|
|
|
|
+ <el-timeline v-else style="max-width: 700px">
|
|
|
|
|
+ <el-timeline-item
|
|
|
|
|
+ v-for="(activity, index) in timeLineActivity"
|
|
|
|
|
+ :key="index"
|
|
|
|
|
+ :type="activity.type"
|
|
|
|
|
+ :color="activity.color"
|
|
|
|
|
+ :size="activity.size"
|
|
|
|
|
+ :hollow="activity.hollow"
|
|
|
|
|
+ :timestamp="activity.timestamp"
|
|
|
|
|
+ @click="handleTimelineItemClick(activity, index)"
|
|
|
|
|
+ style="cursor: pointer;"
|
|
|
|
|
+ >
|
|
|
|
|
+ {{ activity.content }}
|
|
|
|
|
+ </el-timeline-item>
|
|
|
|
|
+ </el-timeline>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ <el-col :span="16">
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <el-table :data="sourceList" border fit>
|
|
|
|
|
+ <el-table-column label="文件" align="left" prop="originalName" :show-overflow-tooltip="true"/>
|
|
|
|
|
+ <el-table-column label="类型" align="center" prop="type" width="80">
|
|
|
|
|
+ <template #default="scope">
|
|
|
|
|
+ <dict-tag :options="smsb_source_type" :value="scope.row.type"/>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="大小" align="center" prop="size" width="80"/>
|
|
|
|
|
+ <el-table-column label="预览" align="center" prop="screenshot" width="80">
|
|
|
|
|
+ <template #default="scope">
|
|
|
|
|
+ <div v-if="scope.row.type === 1">
|
|
|
|
|
+ <!-- 图片类型 -->
|
|
|
|
|
+ <image-preview :src="scope.row.screenshot" style="width: 40px; height: 40px; cursor: pointer"/>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div v-else-if="scope.row.type === 2">
|
|
|
|
|
+ <!-- 视频类型 -->
|
|
|
|
|
+ <el-icon class="VideoPlay" @click="viewVideo(scope.row.screenshot)" size="40"
|
|
|
|
|
+ style="cursor: pointer">
|
|
|
|
|
+ <VideoPlay/>
|
|
|
|
|
+ </el-icon>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ </el-table>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ </el-row>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-dialog>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 用于展示播放的视频 -->
|
|
|
|
|
+ <el-dialog v-model="videoDialogVisible" v-if="videoDialogVisible" append-to-body title="视频预览">
|
|
|
|
|
+ <VideoPlayer :url="videoUrl"/>
|
|
|
|
|
+ </el-dialog>
|
|
|
|
|
+ </div>
|
|
|
|
|
+</template>
|
|
|
|
|
+
|
|
|
|
|
+<script setup name="Device" lang="ts">
|
|
|
|
|
+import {listDevice} from '@/api/smsb/device/device';
|
|
|
|
|
+import {DeviceQuery, DeviceVO} from '@/api/smsb/device/device_type';
|
|
|
|
|
+import {DeviceLogPushForm} from "@/api/smsb/device/logPush/types";
|
|
|
|
|
+import {TimelineItemProps} from "element-plus";
|
|
|
|
|
+import {getItemPushReview, listDevicePushLine} from "@/api/smsb/source/item_push";
|
|
|
|
|
+import {DevicePushLineVo} from "@/api/smsb/source/item_push_type";
|
|
|
|
|
+import {MinioDataVO} from "@/api/smsb/source/minioData_type";
|
|
|
|
|
+import VideoPlayer from '../../../components/VideoPlayer/index.vue'
|
|
|
|
|
+import {ref} from "vue";
|
|
|
|
|
+
|
|
|
|
|
+const {proxy} = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
|
+const {
|
|
|
|
|
+ sys_device_online, smsb_yes_no, smsb_device_log_status, smsb_source_type
|
|
|
|
|
+} = toRefs<any>(
|
|
|
|
|
+ proxy?.useDict('sys_device_online', 'smsb_yes_no', 'smsb_device_log_status', 'smsb_source_type')
|
|
|
|
|
+);
|
|
|
|
|
+const dateRange = ref<[Date, Date]>([null, null]);
|
|
|
|
|
+const deviceList = ref<DeviceVO[]>([]);
|
|
|
|
|
+const buttonLoading = ref(false);
|
|
|
|
|
+const loading = ref(true);
|
|
|
|
|
+const showSearch = ref(true);
|
|
|
|
|
+const ids = ref<Array<string | number>>([]);
|
|
|
|
|
+const single = ref(true);
|
|
|
|
|
+const multiple = ref(true);
|
|
|
|
|
+const total = ref(0);
|
|
|
|
|
+const sourceList = ref<MinioDataVO[]>([]);
|
|
|
|
|
+const videoDialogVisible = ref(false);
|
|
|
|
|
+const videoUrl = ref('');
|
|
|
|
|
+const queryFormRef = ref<ElFormInstance>();
|
|
|
|
|
+const deviceId = ref<number | string>();
|
|
|
|
|
+const sourceListQuery = ref<DevicePushLineVo>();
|
|
|
|
|
+const emptyFlag = ref(true);
|
|
|
|
|
+
|
|
|
|
|
+const dialog = reactive<DialogOption>({
|
|
|
|
|
+ visible: false,
|
|
|
|
|
+ title: ''
|
|
|
|
|
+});
|
|
|
|
|
+const initFormData: DeviceLogPushForm = {}
|
|
|
|
|
+const data = reactive<PageData<DeviceLogPushForm, DeviceQuery>>({
|
|
|
|
|
+ form: {...initFormData},
|
|
|
|
|
+ queryParams: {
|
|
|
|
|
+ pageNum: 1,
|
|
|
|
|
+ pageSize: 10,
|
|
|
|
|
+ name: undefined,
|
|
|
|
|
+ serialNumber: undefined,
|
|
|
|
|
+ params: {}
|
|
|
|
|
+ },
|
|
|
|
|
+ rules: {}
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
+interface ActivityType extends Partial<TimelineItemProps> {
|
|
|
|
|
+ content: string
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const timeLineActivity = ref<ActivityType[]>([]);
|
|
|
|
|
+
|
|
|
|
|
+const {queryParams, form, rules} = toRefs(data);
|
|
|
|
|
+
|
|
|
|
|
+const viewVideo = (url: string) => {
|
|
|
|
|
+ videoUrl.value = url;
|
|
|
|
|
+ videoDialogVisible.value = true;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+/** 查询设备列表 */
|
|
|
|
|
+const getList = async () => {
|
|
|
|
|
+ loading.value = true;
|
|
|
|
|
+ const res = await listDevice(queryParams.value);
|
|
|
|
|
+ deviceList.value = res.rows;
|
|
|
|
|
+ total.value = res.total;
|
|
|
|
|
+ loading.value = false;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/** 取消按钮 */
|
|
|
|
|
+const cancel = () => {
|
|
|
|
|
+ reset();
|
|
|
|
|
+ dialog.visible = false;
|
|
|
|
|
+ videoDialogVisible.value = false;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// 添加时间线项点击处理函数
|
|
|
|
|
+const handleTimelineItemClick = async (activity: ActivityType, index: number) => {
|
|
|
|
|
+ // 在此处添加您需要的处理逻辑
|
|
|
|
|
+ // 例如:显示详细信息、跳转到相关页面等
|
|
|
|
|
+ const res = await getItemPushReview(activity.pushId);
|
|
|
|
|
+ sourceList.value = res.data.resourceList;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+const handlePlayLine = async (row: DeviceVO) => {
|
|
|
|
|
+ dialog.title = "排期预览";
|
|
|
|
|
+ dialog.visible = true;
|
|
|
|
|
+ const today = new Date();
|
|
|
|
|
+ const startDate = new Date(today);
|
|
|
|
|
+ const endDate = new Date(today);
|
|
|
|
|
+ endDate.setDate(today.getDate() + 30);
|
|
|
|
|
+ dateRange.value = [startDate, endDate];
|
|
|
|
|
+ deviceId.value = row.id;
|
|
|
|
|
+ await getPlayLineData();
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const handleDateRangeChange = () => {
|
|
|
|
|
+ getPlayLineData();
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const getPlayLineData = async () => {
|
|
|
|
|
+ sourceList.value = [];
|
|
|
|
|
+ // 初始化 sourceListQuery 或创建一个新的对象
|
|
|
|
|
+ if (!sourceListQuery.value) {
|
|
|
|
|
+ sourceListQuery.value = {} as DevicePushLineVo;
|
|
|
|
|
+ }
|
|
|
|
|
+ sourceListQuery.value.deviceId = deviceId.value;
|
|
|
|
|
+ sourceListQuery.value.startTime = formatDate(dateRange.value[0]);
|
|
|
|
|
+ sourceListQuery.value.endTime = formatDate(dateRange.value[1]);
|
|
|
|
|
+ const res = await listDevicePushLine(sourceListQuery.value);
|
|
|
|
|
+ timeLineActivity.value = res.data.map((item: DevicePushLineVo) => {
|
|
|
|
|
+ return {
|
|
|
|
|
+ color: item.timeType === 1 ? 'green' : '#eee',
|
|
|
|
|
+ type: item.timeType === 1 ? 'primary' : '',
|
|
|
|
|
+ content: item.itemName,
|
|
|
|
|
+ timestamp: item.timePoint,
|
|
|
|
|
+ size: 'large',
|
|
|
|
|
+ hollow: false,
|
|
|
|
|
+ pushId: item.pushId
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ if (res.data.length > 0) {
|
|
|
|
|
+ emptyFlag.value = false;
|
|
|
|
|
+ const res1 = await getItemPushReview(res.data[0].pushId);
|
|
|
|
|
+ sourceList.value = res1.data.resourceList;
|
|
|
|
|
+ }else {
|
|
|
|
|
+ emptyFlag.value = true;
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+/** 表单重置 */
|
|
|
|
|
+const reset = () => {
|
|
|
|
|
+ form.value = {...initFormData};
|
|
|
|
|
+}
|
|
|
|
|
+const formatDate = (date: Date): string => {
|
|
|
|
|
+ const year = date.getFullYear();
|
|
|
|
|
+ const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
|
|
|
+ const day = String(date.getDate()).padStart(2, '0');
|
|
|
|
|
+ return `${year}-${month}-${day}`;
|
|
|
|
|
+};
|
|
|
|
|
+/** 搜索按钮操作 */
|
|
|
|
|
+const handleQuery = () => {
|
|
|
|
|
+ queryParams.value.pageNum = 1;
|
|
|
|
|
+ getList();
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/** 重置按钮操作 */
|
|
|
|
|
+const resetQuery = () => {
|
|
|
|
|
+ queryFormRef.value?.resetFields();
|
|
|
|
|
+ handleQuery();
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+onMounted(() => {
|
|
|
|
|
+ getList();
|
|
|
|
|
+});
|
|
|
|
|
+</script>
|