浏览代码

视频融合相关页面生成及调整

wukai 2 周之前
父节点
当前提交
a906dcdde3
共有 6 个文件被更改,包括 708 次插入10 次删除
  1. 52 0
      src/api/biz/db.js
  2. 44 0
      src/api/biz/dc.js
  3. 13 1
      src/router/index.js
  4. 362 0
      src/views/biz/db/index.vue
  5. 228 0
      src/views/biz/dc/index.vue
  6. 9 9
      src/views/biz/sensorConfig/index.vue

+ 52 - 0
src/api/biz/db.js

@@ -0,0 +1,52 @@
+import request from '@/utils/request'
+
+// 查询视频融合配置列表
+export function listDb(query) {
+    return request({
+        url: '/biz/db/list',
+        method: 'get',
+        params: query
+    })
+}
+
+// 查询视频融合配置详细
+export function getDb(autoId) {
+    return request({
+        url: '/biz/db/' + autoId,
+        method: 'get'
+    })
+}
+
+// 新增视频融合配置
+export function addDb(data) {
+    return request({
+        url: '/biz/db',
+        method: 'post',
+        data: data
+    })
+}
+
+// 修改视频融合配置
+export function updateDb(data) {
+    return request({
+        url: '/biz/db',
+        method: 'put',
+        data: data
+    })
+}
+
+// 删除视频融合配置
+export function delDb(autoId) {
+    return request({
+        url: '/biz/db/' + autoId,
+        method: 'delete'
+    })
+}
+
+// 同步视频信息
+export function sync(autoId) {
+    return request({
+        url: '/biz/db/sync/' + autoId,
+        method: 'get'
+    })
+}

+ 44 - 0
src/api/biz/dc.js

@@ -0,0 +1,44 @@
+import request from '@/utils/request'
+
+// 查询视频通道列表
+export function listDc(query) {
+    return request({
+        url: '/biz/dc/list',
+        method: 'get',
+        params: query
+    })
+}
+
+// 查询视频通道详细
+export function getDc(channelId) {
+    return request({
+        url: '/biz/dc/' + channelId,
+        method: 'get'
+    })
+}
+
+// 新增视频通道
+export function addDc(data) {
+    return request({
+        url: '/biz/dc',
+        method: 'post',
+        data: data
+    })
+}
+
+// 修改视频通道
+export function updateDc(data) {
+    return request({
+        url: '/biz/dc',
+        method: 'put',
+        data: data
+    })
+}
+
+// 删除视频通道
+export function delDc(channelId) {
+    return request({
+        url: '/biz/dc/' + channelId,
+        method: 'delete'
+    })
+}

+ 13 - 1
src/router/index.js

@@ -77,7 +77,7 @@ export const constantRoutes = [
     children: [
       {
         path: '/camer',
-        component: () => import('@/views/camer/index'),
+        component: () => import('@/views/biz/db/index'),
         name: 'camer',
         meta: { title: '设备', png: 'ico_camer.png', affix: true }
       }
@@ -124,6 +124,18 @@ export const constantRoutes = [
     ]
   },
   {
+    path: '/device/channel',
+    redirect: '/',
+    hidden: true,
+    children: [
+      {
+        path: '/device/channel',
+        component: () => import('@/views/biz/dc/index'),
+        name: '通道列表',
+      }
+    ]
+  },
+  {
     path: '',
     component: Layout,
     redirect: '/alarm',

+ 362 - 0
src/views/biz/db/index.vue

@@ -0,0 +1,362 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="仓库名称" prop="houseName">
+        <el-input
+            v-model="queryParams.houseName"
+            placeholder="请输入仓库名称"
+            clearable
+            @keyup.enter="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="设备名称" prop="deviceName">
+        <el-input
+            v-model="queryParams.deviceName"
+            placeholder="请输入设备名称"
+            clearable
+            @keyup.enter="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="设备编码" prop="deviceCode">
+        <el-input
+            v-model="queryParams.deviceCode"
+            placeholder="请输入设备编码"
+            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-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+            type="primary"
+            plain
+            icon="Plus"
+            @click="handleAdd"
+        >新增
+        </el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+            type="success"
+            plain
+            icon="Edit"
+            :disabled="single"
+            @click="handleUpdate"
+        >修改
+        </el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+            type="danger"
+            plain
+            icon="Delete"
+            :disabled="multiple"
+            @click="handleDelete"
+        >删除
+        </el-button>
+      </el-col>
+      <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" :data="dbList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center"/>
+      <el-table-column label="仓库名称" align="center" prop="houseName"/>
+      <el-table-column label="设备编码" align="center" prop="deviceCode"/>
+      <el-table-column label="设备名称" align="center" prop="deviceName"/>
+      <el-table-column label="厂商" align="center" prop="manufacturer"/>
+      <el-table-column label="型号" align="center" prop="model"/>
+      <el-table-column label="状态" align="center" prop="status"/>
+      <el-table-column label="注册时间" align="center" prop="createTime" width="180">
+        <template #default="scope">
+          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template #default="scope">
+          <el-button link type="primary" icon="VideoPlay" @click="handleSync(scope.row)">同步设备</el-button>
+          <el-button link type="primary" icon="VideoCamera" @click="handleChannel(scope.row)">通道详情</el-button>
+          <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button>
+          <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+        v-show="total>0"
+        :total="total"
+        v-model:page="queryParams.pageNum"
+        v-model:limit="queryParams.pageSize"
+        @pagination="getList"
+    />
+
+    <!-- 添加或修改视频融合配置对话框 -->
+    <el-dialog :title="title" v-model="open" width="500px" append-to-body>
+      <el-form ref="dbRef" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="仓库名称" prop="houseName">
+          <el-select v-model="form.houseName" placeholder="请选择仓库名称" clearable filterable
+                     @change="handleHouseChange">
+            <el-option
+                v-for="item in houseConfigList"
+                :key="item.houseName"
+                :label="item.houseName"
+                :value="item.houseId"
+            >
+            </el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="设备编码" prop="deviceCode">
+          <el-input v-model="form.deviceCode" placeholder="请输入设备编码"/>
+        </el-form-item>
+        <!--        <el-form-item label="设备名称" prop="deviceName">-->
+        <!--          <el-input v-model="form.deviceName" placeholder="请输入设备名称"/>-->
+        <!--        </el-form-item>-->
+        <!--        <el-form-item label="厂商" prop="manufacturer">-->
+        <!--          <el-input v-model="form.manufacturer" placeholder="请输入厂商"/>-->
+        <!--        </el-form-item>-->
+        <!--        <el-form-item label="型号" prop="model">-->
+        <!--          <el-input v-model="form.model" placeholder="请输入型号"/>-->
+        <!--        </el-form-item>-->
+      </el-form>
+      <template #footer>
+        <div class="dialog-footer">
+          <el-button type="primary" @click="submitForm">确 定</el-button>
+          <el-button @click="cancel">取 消</el-button>
+        </div>
+      </template>
+    </el-dialog>
+
+    <!-- 仓库配置详情对话框 -->
+    <el-dialog :title="dialogTitle" v-model="houseConfigOpen" width="80%" append-to-body>
+      <iframe :src="dialogUrl" width="100%" height="600" frameborder="0"></iframe>
+    </el-dialog>
+  </div>
+</template>
+
+<script setup name="Db">
+import {addDb, delDb, getDb, listDb, updateDb} from "@/api/biz/db";
+import {listHouseConfig} from "@/api/biz/houseConfig";
+import {sync} from "../../../api/biz/db.js";
+
+const {proxy} = getCurrentInstance();
+
+const dbList = ref([]);
+const open = ref(false);
+const loading = ref(true);
+const showSearch = ref(true);
+const ids = ref([]);
+const single = ref(true);
+const multiple = ref(true);
+const total = ref(0);
+const title = ref("");
+const houseConfigList = ref(undefined);
+const data = reactive({
+  form: {},
+  queryParams: {
+    pageNum: 1,
+    pageSize: 10,
+    houseId: null,
+    houseName: null,
+    houseCode: null,
+    deviceName: null,
+    deviceCode: null,
+    manufacturer: null,
+    model: null,
+    status: null,
+    createTime: null,
+    updateBy: null,
+  },
+  rules: {
+    houseName: [
+      {required: true, message: "仓库名称不能为空", trigger: "blur"}
+    ],
+    deviceCode: [
+      {required: true, message: "设备编码不能为空", trigger: "blur"}
+    ],
+  },
+  dialogUrl: "",
+  dialogTitle: "",
+  houseConfigOpen: false,
+});
+
+const {queryParams, form, rules, dialogUrl, dialogTitle, houseConfigOpen} = toRefs(data);
+
+/** 查询仓库配置列表 */
+function getHouseList() {
+  listHouseConfig().then(response => {
+    houseConfigList.value = response.rows;
+  });
+}
+
+function handleHouseChange(value) {
+  if (value) {
+    // 查找选中的部门信息
+    const selectedDept = findDeptById(houseConfigList.value, value);
+    console.log(selectedDept)
+    if (selectedDept) {
+      form.value.houseId = selectedDept.houseId;
+      form.value.houseName = selectedDept.houseName;
+      form.value.houseCode = selectedDept.houseCode;
+    }
+
+  } else {
+    form.value.houseId = '';
+  }
+}
+
+/** 根据ID查找部门信息 */
+function findDeptById(deptList, id) {
+  if (!deptList || !id) return null;
+
+  for (let i = 0; i < deptList.length; i++) {
+    const dept = deptList[i];
+    if (dept.houseId === id) {
+      return dept;
+    }
+    if (dept.children && dept.children.length) {
+      const found = findDeptById(dept.children, id);
+      if (found) return found;
+    }
+  }
+  return null;
+}
+
+/** 查询视频融合配置列表 */
+function getList() {
+  loading.value = true;
+  listDb(queryParams.value).then(response => {
+    dbList.value = response.rows;
+    total.value = response.total;
+    loading.value = false;
+  });
+}
+
+// 取消按钮
+function cancel() {
+  open.value = false;
+  reset();
+}
+
+// 表单重置
+function reset() {
+  form.value = {
+    autoId: null,
+    houseId: null,
+    houseName: null,
+    houseCode: null,
+    deviceName: null,
+    deviceCode: null,
+    manufacturer: null,
+    model: null,
+    status: null,
+    createBy: null,
+    createTime: null,
+    updateBy: null,
+    updateTime: null,
+    remark: null
+  };
+  proxy.resetForm("dbRef");
+}
+
+/** 搜索按钮操作 */
+function handleQuery() {
+  queryParams.value.pageNum = 1;
+  getList();
+}
+
+/** 重置按钮操作 */
+function resetQuery() {
+  proxy.resetForm("queryRef");
+  handleQuery();
+}
+
+// 多选框选中数据
+function handleSelectionChange(selection) {
+  ids.value = selection.map(item => item.autoId);
+  single.value = selection.length != 1;
+  multiple.value = !selection.length;
+}
+
+/** 新增按钮操作 */
+function handleAdd() {
+  reset();
+  open.value = true;
+  title.value = "添加视频融合配置";
+}
+
+/** 修改按钮操作 */
+function handleUpdate(row) {
+  reset();
+  const _autoId = row.autoId || ids.value
+  getDb(_autoId).then(response => {
+    form.value = response.data;
+    open.value = true;
+    title.value = "修改视频融合配置";
+  });
+}
+
+/** 修改按钮操作 */
+function handleSync(row) {
+  const _autoId = row.autoId || ids.value
+  sync(_autoId).then(response => {
+    proxy.$modal.msgSuccess("同步成功");
+    getList();
+  });
+}
+
+/** 通道详情 */
+function handleChannel(row) {
+  // 使用dialog方式打开仓库配置页面
+  dialogUrl.value = "/device/channel?deviceCode=" + row.deviceCode;
+  dialogTitle.value = "通道详情";
+  houseConfigOpen.value = true;
+}
+
+/** 提交按钮 */
+function submitForm() {
+  proxy.$refs["dbRef"].validate(valid => {
+    if (valid) {
+      if (form.value.autoId != null) {
+        updateDb(form.value).then(response => {
+          proxy.$modal.msgSuccess("修改成功");
+          open.value = false;
+          getList();
+        });
+      } else {
+        addDb(form.value).then(response => {
+          proxy.$modal.msgSuccess("新增成功");
+          open.value = false;
+          getList();
+        });
+      }
+    }
+  });
+}
+
+/** 删除按钮操作 */
+function handleDelete(row) {
+  const _autoIds = row.autoId || ids.value;
+  proxy.$modal.confirm('是否确认删除视频融合配置编号为"' + _autoIds + '"的数据项?').then(function () {
+    return delDb(_autoIds);
+  }).then(() => {
+    getList();
+    proxy.$modal.msgSuccess("删除成功");
+  }).catch(() => {
+  });
+}
+
+/** 导出按钮操作 */
+function handleExport() {
+  proxy.download('biz/db/export', {
+    ...queryParams.value
+  }, `db_${new Date().getTime()}.xlsx`)
+}
+
+getHouseList();
+getList();
+</script>

+ 228 - 0
src/views/biz/dc/index.vue

@@ -0,0 +1,228 @@
+<template>
+  <div class="app-container">
+    <el-table v-loading="loading" :data="dcList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="通道ID" align="center" prop="channelId" />
+      <el-table-column label="通道名称" align="center" prop="channelName" />
+<!--      <el-table-column label="仓库名称" align="center" prop="houseName" />-->
+<!--      <el-table-column label="仓库编码" align="center" prop="houseCode" />-->
+<!--      <el-table-column label="主通道" align="center" key="updateBy">-->
+<!--        <template #default="scope">-->
+<!--          <el-switch-->
+<!--              v-model="scope.row.updateBy"-->
+<!--              active-value="0"-->
+<!--              inactive-value="1"-->
+<!--              @change="handleStatusChange(scope.row)"-->
+<!--          ></el-switch>-->
+<!--        </template>-->
+<!--      </el-table-column>-->
+<!--      <el-table-column label="设备名称" align="center" prop="deviceName" />-->
+<!--      <el-table-column label="设备编号" align="center" prop="deviceCode" />-->
+      <el-table-column label="厂商" align="center" prop="manufacturer" />
+      <el-table-column label="型号" align="center" prop="model" />
+      <el-table-column label="状态" align="center" prop="status" />
+<!--      <el-table-column label="创建人" align="center" prop="createBy" />-->
+<!--      <el-table-column label="创建时间" align="center" prop="createTime" width="180">-->
+<!--        <template #default="scope">-->
+<!--          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>-->
+<!--        </template>-->
+<!--      </el-table-column>-->
+<!--      <el-table-column label="更新人" align="center" prop="updateBy" />-->
+<!--      <el-table-column label="更新时间" align="center" prop="updateTime" width="180">-->
+<!--        <template #default="scope">-->
+<!--          <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>-->
+<!--        </template>-->
+<!--      </el-table-column>-->
+<!--      <el-table-column label="备注" align="center" prop="remark" />-->
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template #default="scope">
+          <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)">播放视频</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      v-model:page="queryParams.pageNum"
+      v-model:limit="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+  </div>
+</template>
+
+<script setup name="Dc">
+import { listDc, getDc, delDc, addDc, updateDc } from "@/api/biz/dc";
+import { useRoute } from "vue-router";
+
+const { proxy } = getCurrentInstance();
+
+const route = useRoute();
+const dcList = ref([]);
+const open = ref(false);
+const loading = ref(true);
+const showSearch = ref(true);
+const ids = ref([]);
+const single = ref(true);
+const multiple = ref(true);
+const total = ref(0);
+const title = ref("");
+
+const data = reactive({
+  form: {},
+  queryParams: {
+    pageNum: 1,
+    pageSize: 10,
+    channelName: null,
+    houseName: null,
+    houseCode: null,
+    deviceName: null,
+    deviceCode: null,
+    manufacturer: null,
+    model: null,
+    status: null,
+    createBy: null,
+    createTime: null,
+    updateBy: null,
+    updateTime: null,
+    remark: null
+  },
+  rules: {
+  }
+});
+
+const { queryParams, form, rules } = toRefs(data);
+/** 用户状态修改  */
+function handleStatusChange(row) {
+  let text = row.status === "0" ? "启用" : "停用";
+  proxy.$modal.confirm('确认要将' + row.channelName + '设为主通道吗?').then(function () {
+    // return changeUserStatus(row.userId, row.status);
+  }).then(() => {
+    proxy.$modal.msgSuccess(text + "成功");
+  }).catch(function () {
+    row.status = row.status === "0" ? "1" : "0";
+  });
+};
+/** 查询视频通道列表 */
+function getList() {
+  if (route.query.deviceCode) {
+    queryParams.value.deviceCode = route.query.deviceCode;
+    // proxy.$modal.msgSuccess("已接收到设备编号: " + route.query.deviceCode);
+    // 如果需要根据deviceId进行特殊处理,可以在这里添加逻辑
+  }
+  loading.value = true;
+  listDc(queryParams.value).then(response => {
+    dcList.value = response.rows;
+    total.value = response.total;
+    loading.value = false;
+  });
+}
+
+// 取消按钮
+function cancel() {
+  open.value = false;
+  reset();
+}
+
+// 表单重置
+function reset() {
+  form.value = {
+    channelId: null,
+    channelName: null,
+    houseName: null,
+    houseCode: null,
+    deviceName: null,
+    deviceCode: null,
+    manufacturer: null,
+    model: null,
+    status: null,
+    createBy: null,
+    createTime: null,
+    updateBy: null,
+    updateTime: null,
+    remark: null
+  };
+  proxy.resetForm("dcRef");
+}
+
+/** 搜索按钮操作 */
+function handleQuery() {
+  queryParams.value.pageNum = 1;
+  getList();
+}
+
+/** 重置按钮操作 */
+function resetQuery() {
+  proxy.resetForm("queryRef");
+  handleQuery();
+}
+
+// 多选框选中数据
+function handleSelectionChange(selection) {
+  ids.value = selection.map(item => item.channelId);
+  single.value = selection.length != 1;
+  multiple.value = !selection.length;
+}
+
+/** 新增按钮操作 */
+function handleAdd() {
+  reset();
+  open.value = true;
+  title.value = "添加视频通道";
+}
+
+/** 修改按钮操作 */
+function handleUpdate(row) {
+  const url = `http://47.108.159.150:8080/flv/${row.deviceCode}/${row.channelId}`;
+  alert(url);
+  // reset();
+  // const _channelId = row.channelId || ids.value
+  // getDc(_channelId).then(response => {
+  //   form.value = response.data;
+  //   open.value = true;
+  //   title.value = "修改视频通道";
+  // });
+}
+
+/** 提交按钮 */
+function submitForm() {
+  proxy.$refs["dcRef"].validate(valid => {
+    if (valid) {
+      if (form.value.channelId != null) {
+        updateDc(form.value).then(response => {
+          proxy.$modal.msgSuccess("修改成功");
+          open.value = false;
+          getList();
+        });
+      } else {
+        addDc(form.value).then(response => {
+          proxy.$modal.msgSuccess("新增成功");
+          open.value = false;
+          getList();
+        });
+      }
+    }
+  });
+}
+
+/** 删除按钮操作 */
+function handleDelete(row) {
+  const _channelIds = row.channelId || ids.value;
+  proxy.$modal.confirm('是否确认删除视频通道编号为"' + _channelIds + '"的数据项?').then(function() {
+    return delDc(_channelIds);
+  }).then(() => {
+    getList();
+    proxy.$modal.msgSuccess("删除成功");
+  }).catch(() => {});
+}
+
+/** 导出按钮操作 */
+function handleExport() {
+  proxy.download('biz/dc/export', {
+    ...queryParams.value
+  }, `dc_${new Date().getTime()}.xlsx`)
+}
+
+getList();
+</script>

+ 9 - 9
src/views/biz/sensorConfig/index.vue

@@ -119,15 +119,15 @@
       <el-form ref="sensorConfigRef" :model="form" :rules="rules" label-width="120px">
         <el-form-item label="仓库名称" prop="houseName">
           <el-select v-model="form.houseName" placeholder="请选择仓库名称" clearable filterable
-                     @change="handleHouseChange">
-            <el-option
-                v-for="item in houseConfigList"
-                :key="item.houseName"
-                :label="item.houseName"
-                :value="item.houseId"
-            >
-            </el-option>
-          </el-select>
+                                  @change="handleHouseChange">
+          <el-option
+              v-for="item in houseConfigList"
+              :key="item.houseName"
+              :label="item.houseName"
+              :value="item.houseId"
+          >
+          </el-option>
+        </el-select>
         </el-form-item>
         <el-form-item label="网关名称" prop="sensorName">
           <el-input v-model="form.sensorName" placeholder="请输入传感器网关名称"/>