Ver Fonte

优化视频销毁

liwei19941102 há 1 ano atrás
pai
commit
10cffb5641

+ 17 - 3
src/components/Map/videoMap.vue

@@ -59,6 +59,11 @@ const getDictsData = (param) => {
     })
 }
 
+const closeVideo = () =>{
+      console.log('关闭摄像头')
+      document.getElementById('video-container').innerHTML= "";
+}
+
 const getGpsDataList = (param) => {
     getGpsData(param).then(res => {
         console.log(res);
@@ -104,14 +109,14 @@ const initMap = () => {
         const infoWindow = new AMap.InfoWindow({
             offset: new AMap.Pixel(16, -45),
             //隐藏原生弹窗边框和关闭按钮
-            isCustom: true,
+            isCustom: false,
             autoMove: true,
             avoid: [20, 20, 20, 20],
             // 点击地图关闭
-            closeWhenClickMap: true,
+            closeWhenClickMap: false,
         });
         allInfoWindow.value = infoWindow
-
+        infoWindow.on('close',closeVideo)
         // console.log(content)
         infoWindow.setContent(content.join(""));
         // infoWindow.open(map, [119.807462, 26.958413]);
@@ -342,6 +347,15 @@ defineExpose({
     bottom: -23px;
 }
 
+.closeDiv{
+    position: absolute;
+    top: 1px;
+    right: 10px;
+    font-size: 20px;
+    z-index: 30;
+    color: red;
+}
+
 /* .amap-marker-label{
     border: 0px solid #00f;
     background-color: transparent;

+ 1 - 1
src/views/car/vehicleService/index.vue

@@ -270,7 +270,7 @@ const submitService = () => {
         carId: carId.value
     };
     var key = serviceJson[activeName.value - 1].dataName
-    addForm.value = fileData.value
+    addForm.value.file = fileData.value
     obj[key] = JSON.stringify(addForm.value);
     addCarService(obj).then(res => {
         if (res.code == 200) {

+ 74 - 68
src/views/car/vehicleService/serviceInfo.vue

@@ -12,7 +12,13 @@
             <el-card body-style="background: rgba(0, 0, 0, 0.05);" v-for="(card,pindex) in serviceList">
                 <el-row style="font-size: 12px;line-height: 20px;">
                     <el-col :span="item.itemSpan" v-for="(item,index) in keyList">
-                       {{ item.label }}:{{ JSON.parse(card[dataName])[item.prop] }} {{ item.unit }}
+                        <div v-if=" item.prop != 'file'">
+                        {{ item.label }}:{{ JSON.parse(card[dataName])[item.prop] }} {{ item.unit }}
+                        </div>
+                        <div v-if="item.prop == 'file' && JSON.parse(card[dataName])[item.prop] !=null" v-for="(image,j) in JSON.parse(card[dataName])[item.prop]">
+                            <!-- {{ image.url }} -->
+                            <img style="height: 4vw;width: 4vw;" :src="image.url" />
+                        </div>
                     </el-col>
                 </el-row>
             </el-card>
@@ -21,85 +27,85 @@
 </template>
 
 <script setup name="CarInfo" lang="ts">
-import { listCarInfo, getCarInfo, delCarInfo, addCarInfo, updateCarInfo } from '@/api/carInfo';
-import { listCarService, getCarService, delCarService, addCarService, updateCarService } from '@/api/carService';
-import { CarInfoVO, CarInfoQuery, CarInfoForm } from '@/api/carInfo/types';
-import tableElm from "@/components/Public/table.vue";
-import { useRoute, useRouter } from "vue-router";
-import {defineEmits} from 'vue'
-import serviceJson from '@/assets/json/carService.json'
+    import { listCarInfo, getCarInfo, delCarInfo, addCarInfo, updateCarInfo } from '@/api/carInfo';
+    import { listCarService, getCarService, delCarService, addCarService, updateCarService } from '@/api/carService';
+    import { CarInfoVO, CarInfoQuery, CarInfoForm } from '@/api/carInfo/types';
+    import tableElm from "@/components/Public/table.vue";
+    import { useRoute, useRouter } from "vue-router";
+    import { defineEmits } from 'vue'
+    import serviceJson from '@/assets/json/carService.json'
 
-const emit = defineEmits(['addInfoObj'])
+    const emit = defineEmits(['addInfoObj'])
 
-const route = useRoute();
-const router = useRouter();
+    const route = useRoute();
+    const router = useRouter();
 
-const energyType = ref(2)
-const businessType = ref(1)
-const carName = ref('');
-const keyList = ref([]);
-const dataName =ref('');
-const serviceList = ref([]);
+    const energyType = ref(2)
+    const businessType = ref(1)
+    const carName = ref('');
+    const keyList = ref([]);
+    const dataName = ref('');
+    const serviceList = ref([]);
 
-const carObj: CarInfoForm = {
-    id: undefined,
-    carNum: undefined,
-    carType: undefined,
-    deviceInfos: undefined,
-    repairInfo: undefined,
-    maintenanceInfo: undefined,
-    insuranceInfo: undefined,
-    inspectionInfo: undefined,
-    trafficAccidentInfo: undefined,
-    violationInfo: undefined,
-    changeInfo: undefined,
-    ext1: undefined,
-    ext2: undefined
-}
-
-const serviceObj =ref({})
+    const carObj: CarInfoForm = {
+        id: undefined,
+        carNum: undefined,
+        carType: undefined,
+        deviceInfos: undefined,
+        repairInfo: undefined,
+        maintenanceInfo: undefined,
+        insuranceInfo: undefined,
+        inspectionInfo: undefined,
+        trafficAccidentInfo: undefined,
+        violationInfo: undefined,
+        changeInfo: undefined,
+        ext1: undefined,
+        ext2: undefined
+    }
 
-const { proxy } = getCurrentInstance() as ComponentInternalInstance;
+    const serviceObj = ref({})
 
-const { energy_type, business_type } = toRefs<any>(proxy?.useDict("energy_type", "business_type"));
+    const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 
-const clickChild = () => {
-	emit('addInfoObj')
-}
+    const { energy_type, business_type } = toRefs < any > (proxy?.useDict("energy_type", "business_type"));
 
-const initData = (data,activeName) => {
-       carName.value = data.carNum
-       console.log(carName.value)
-       businessType.value = JSON.parse(data.ext1).bussinessType;
-       energyType.value = JSON.parse(data.ext1).energyType;
-       console.log(serviceJson[activeName-1])
-       dataName.value = serviceJson[activeName-1].dataName
-       keyList.value = serviceJson[activeName-1].columns
-       console.log(keyList.value)
-       getServiceList(data.id);
-       console.log(energyType.value)
-}
+    const clickChild = () => {
+        emit('addInfoObj')
+    }
 
-const getServiceList = (id) =>{
-    var obj = {
-        carId:id,
-        pageSize:1000
+    const initData = (data, activeName) => {
+        carName.value = data.carNum
+        console.log(carName.value)
+        businessType.value = JSON.parse(data.ext1).bussinessType;
+        energyType.value = JSON.parse(data.ext1).energyType;
+        console.log(serviceJson[activeName - 1])
+        dataName.value = serviceJson[activeName - 1].dataName
+        keyList.value = serviceJson[activeName - 1].columns
+        console.log(keyList.value)
+        getServiceList(data.id);
+        console.log(energyType.value)
     }
-    serviceList.value = [];
-    listCarService(obj).then(res=>{
-        for(var index in res.rows){
-            if(res.rows[index][dataName.value] != null){
-                serviceList.value.push(res.rows[index])
-            }
+
+    const getServiceList = (id) => {
+        var obj = {
+            carId: id,
+            pageSize: 1000
         }
-    })
-}
+        serviceList.value = [];
+        listCarService(obj).then(res => {
+            for (var index in res.rows) {
+                if (res.rows[index][dataName.value] != null) {
+                    serviceList.value.push(res.rows[index])
+                }
+            }
+        })
+    }
 
-defineExpose({
-    initData
-})
+    defineExpose({
+        initData
+    })
 
-onMounted(() => {
+    onMounted(() => {
 
-});
+    });
 </script>

+ 1 - 3
src/views/car/work/schedule.vue

@@ -12,7 +12,7 @@
             </p>
             <div></div>
           </div>
-        </template>aw
+        </template>
       </el-calendar>
       <div>注:</div>
       <div style="display: flex;flex-direction: row;margin-top: 5px;">
@@ -217,10 +217,8 @@ const getScheduleData = () => {
 }
 
 const scheduleStatus = (data) => {
-  console.log(data)
   for (var index in scheduleList.value) {
     var date = moment(new Date(scheduleList.value[index].scheduleDate)).format('YYYY-MM-DD')
-    console.log(data)
     if (data == date) {
       return true
     }

+ 265 - 244
src/views/yunying/video/index.vue

@@ -21,8 +21,9 @@
             <el-option v-for="item in carPathList" :key="item.id" :label="item.name" :value="item.id" />
           </el-select>
           <el-input style="margin-top: 10px;" v-model="filterText" placeholder="输入关键字" />
-          <el-tree-v2 v-if="showTree" style="margin-top: 10px" ref="treeRef" class="filter-tree" :height="gettreeheight()" :data="data"
-            :indent="treeIndent" :props="defaultProps" :filter-method="filterNode" @node-click="treeclick">
+          <el-tree-v2 v-if="showTree" style="margin-top: 10px" ref="treeRef" class="filter-tree"
+            :height="gettreeheight()" :data="data" :indent="treeIndent" :props="defaultProps"
+            :filter-method="filterNode" @node-click="treeclick">
             <template v-slot:default="{ node }">
               <element-tree-line :node="node" :treeData="data" :showLabelLine="false" :indent="treeIndent">
               </element-tree-line>
@@ -152,291 +153,311 @@
 </template>
 
 <script setup name="CarInfo" lang="ts">
-import { TreeNode } from "element-plus";
-import { useRoute, useRouter } from "vue-router";
-import EZUIKit from 'ezuikit-js';
-import { getCameraPlayerConfig } from '@/api/gpsData';
-import { listCarPath, getCarPath, delCarPath, addCarPath, updateCarPath } from '@/api/carPath';
-import { updateData, listData } from "@/api/system/dict/data";
-import imgulock from "@/assets/images/unlock@2x.png";
+  import { TreeNode } from "element-plus";
+  import { useRoute, useRouter } from "vue-router";
+  import EZUIKit from 'ezuikit-js';
+  import { getCameraPlayerConfig } from '@/api/gpsData';
+  import { listCarPath, getCarPath, delCarPath, addCarPath, updateCarPath } from '@/api/carPath';
+  import { updateData, listData } from "@/api/system/dict/data";
+  import imgulock from "@/assets/images/unlock@2x.png";
 
-const { proxy } = getCurrentInstance() as ComponentInternalInstance;
+  const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 
-const sites = ref([]);
+  const sites = ref([]);
 
-const showTree = ref(true)
+  const showTree = ref(true)
 
 
-const formdata = ref({
-  name: "",
-  type: "",
-  code: "",
-  cabinetType: ''
-})
+  const formdata = ref({
+    name: "",
+    type: "",
+    code: "",
+    cabinetType: ''
+  })
 
 
-const route = useRoute();
-const router = useRouter();
+  const route = useRoute();
+  const router = useRouter();
 
-const tableData = ref([]);
-const carPathList = ref([]);
-const line = ref([]);
+  const tableData = ref([]);
+  const carPathList = ref([]);
+  const line = ref([]);
 
-const activeName = ref("camera")
+  const activeName = ref("camera")
 
-const filterText = ref("");
-const treeRef = ref(null);
-const dialogVisible = ref(false);
+  const filterText = ref("");
+  const treeRef = ref(null);
+  const dialogVisible = ref(false);
 
-const gettreeheight = () => {
-  return document.body.clientHeight - 100;
-}
+  const gettreeheight = () => {
+    return document.body.clientHeight - 100;
+  }
 
-const goAdd = () => {
-  dialogVisible.value = true
-  formdata.value = {
-    name: "",
-    type: "",
-    code: ""
+  const goAdd = () => {
+    dialogVisible.value = true
+    formdata.value = {
+      name: "",
+      type: "",
+      code: ""
+    }
   }
-}
-
-const getTypeName = (data) => {
-  var type = data.cabinetType
-  if (type == 1) {
-    return '一主'
-  } else if (type == 2) {
-    return '一主一副'
-  } else {
-    return '一主二副'
+
+  const getTypeName = (data) => {
+    var type = data.cabinetType
+    if (type == 1) {
+      return '一主'
+    } else if (type == 2) {
+      return '一主一副'
+    } else {
+      return '一主二副'
+    }
   }
-}
 
-const initData = async () => {
-  const res = await listCarPath({ pageSize: 1000 });
-  carPathList.value = res.rows;
-}
+  const initData = async () => {
+    const res = await listCarPath({ pageSize: 1000 });
+    carPathList.value = res.rows;
+  }
 
 
-const defaultProps = {
-  children: "children",
-  label: "label",
-  value: 'id',
-};
-const treeIndent = ref(40);
+  const defaultProps = {
+    children: "children",
+    label: "label",
+    value: 'id',
+  };
+  const treeIndent = ref(40);
 
-watch(filterText, (val) => {
-  if (treeRef.value) {
-    treeRef.value.filter(val);
-  }
-});
-
-const savedata = () => {
-  //保存数据
-  var data = {
-    dictCode: currentdata.value.dictCode,
-    dictValue: currentdata.value.dictValue,
-    dictLabel: currentdata.value.dictLabel,
-    dictType: "tbl_sites",
-    remark: JSON.stringify(tableData.value)
-  }
-  updateData(data).then(res => {
-    ElMessage.success("成功!");
-    getSites();
+  watch(filterText, (val) => {
+    if (treeRef.value) {
+      treeRef.value.filter(val);
+    }
+  });
 
-  })
-}
-
-const getLineSites = () => {
-  console.log(line.value)
-  var sitesList = []
-  for (var index in carPathList.value) {
-    if (carPathList.value[index].id == line.value) {
-      sitesList = JSON.parse(carPathList.value[index].stationList)
+  const savedata = () => {
+    //保存数据
+    var data = {
+      dictCode: currentdata.value.dictCode,
+      dictValue: currentdata.value.dictValue,
+      dictLabel: currentdata.value.dictLabel,
+      dictType: "tbl_sites",
+      remark: JSON.stringify(tableData.value)
     }
+    updateData(data).then(res => {
+      ElMessage.success("成功!");
+      getSites();
+
+    })
   }
-  console.log(sitesList)
-  var sites = []
-  for (var i in sitesList) {
-    sites.push({ id: i, label: sitesList[i].data.dictLabel })
-  }
-  console.log(sites)
-  data.value = [{
-    id: 1,
-    label: "站点",
-  },];
-  data.value[0].children = sites
-  console.log(data.value)
-  showTree.value = false;
-  setTimeout(() => {
-    showTree.value = true
-  }, 100);
-
-}
-
-const getSites = () => {
-  listData({ dictType: "tbl_sites" }).then(res2 => {
-    sites.value = res2.rows;
-    var index = 1;
+
+  const getLineSites = () => {
+    console.log(line.value)
+    var sitesList = []
+    for (var index in carPathList.value) {
+      if (carPathList.value[index].id == line.value) {
+        sitesList = JSON.parse(carPathList.value[index].stationList)
+      }
+    }
+    console.log(sitesList)
+    var sites = []
+    for (var i in sitesList) {
+      sites.push({ id: i, label: sitesList[i].data.dictLabel })
+    }
+    console.log(sites)
     data.value = [{
       id: 1,
       label: "站点",
-      children: sites.value.map(i => { return { id: ++index, label: i.dictLabel } }),
     },];
-  });
-}
-
-const deleteDevice = (datac) => {
-  tableData.value = tableData.value.filter(i => i.type != datac.type);
-  var data = {
-    dictCode: currentdata.value.dictCode,
-    dictValue: currentdata.value.dictValue,
-    dictLabel: currentdata.value.dictLabel,
-    dictType: "tbl_sites",
-    remark: JSON.stringify(tableData.value)
+    data.value[0].children = sites
+    console.log(data.value)
+    showTree.value = false;
+    setTimeout(() => {
+      showTree.value = true
+    }, 100);
+
   }
-  updateData(data).then(res => {
-    ElMessage.success("成功!");
-  })
-}
-
-const handleTabClick = () => {
-
-}
-
-const filterNode = (value: string, node: TreeNode) => {
-  if (node.id == 1) return true;
-  console.log(node.label.indexOf(value) != -1)
-  return node.label.indexOf(value) != -1;
-};
-
-const currentdata = ref(null)
-
-const treeclick = (data: TreeNodeData, node: TreeNode) => {
-
-  currentdata.value = sites.value.filter(i => {
-    return i.dictLabel == data.label
-  })[0];
-  tableData.value = [];
-  if (currentdata.value) {
-    tableData.value = JSON.parse(currentdata.value.remark);
-    var cameras = tableData.value.filter(i => i.type == 'camera');
-    if (cameras.length > 0) {
-      var cameracode = cameras[0].code;
-      //存在视频播放视频
-      // getCameraPlayerConfig(cameracode).then(res => {
-      //   console.log(res.data);
-      //   var player = new EZUIKit.EZUIKitPlayer({
-      //     template: "pcLive",
-      //     id: 'video-container', // 视频容器ID
-      //     ...res.data
-      //   })
-      // })
-    }
 
-    var cabinets = tableData.value.filter(i => i.type == 'cabinet');
-    if (cabinets.length > 0) {
-      var cabinetcode = cameras[0].code;
-      SycCabinet(cabinetcode);
-    }
+  const getSites = () => {
+    listData({ dictType: "tbl_sites" }).then(res2 => {
+      sites.value = res2.rows;
+      var index = 1;
+      data.value = [{
+        id: 1,
+        label: "站点",
+        children: sites.value.map(i => { return { id: ++index, label: i.dictLabel } }),
+      },];
+    });
   }
 
-}
+  const deleteDevice = (datac) => {
+    tableData.value = tableData.value.filter(i => i.type != datac.type);
+    var data = {
+      dictCode: currentdata.value.dictCode,
+      dictValue: currentdata.value.dictValue,
+      dictLabel: currentdata.value.dictLabel,
+      dictType: "tbl_sites",
+      remark: JSON.stringify(tableData.value)
+    }
+    updateData(data).then(res => {
+      ElMessage.success("成功!");
+    })
+  }
 
+  const handleTabClick = () => {
 
-const addDevice = () => {
-  dialogVisible.value = false;
-  if (formdata.value.name == "") {
-    ElMessage.warning("设备名称未填写");
-    return;
-  }
-  if (formdata.value.type == "") {
-    ElMessage.warning("设备类型未填写");
-    return;
   }
-  if (formdata.value.code == "") {
-    ElMessage.warning("设备序列号未填写");
-    return;
-  }
-  if (tableData.value.filter(i => i.type == formdata.value.type).length > 0) {
-    ElMessage.warning("存在相同类型的设备");
-    return;
+
+  const filterNode = (value: string, node: TreeNode) => {
+    if (node.id == 1) return true;
+    console.log(node.label.indexOf(value) != -1)
+    return node.label.indexOf(value) != -1;
+  };
+
+  const currentdata = ref(null)
+
+  const isJSON = (str) => {
+    if (typeof str == 'string') {
+      try {
+        var obj = JSON.parse(str);
+        if (typeof obj == 'object' && obj) {
+          return true;
+        } else {
+          return false;
+        }
+
+      } catch (e) {
+        return false;
+      }
+    }
   }
-  tableData.value.push(formdata.value);
-  var data = {
-    dictCode: currentdata.value.dictCode,
-    dictValue: currentdata.value.dictValue,
-    dictLabel: currentdata.value.dictLabel,
-    dictType: "tbl_sites",
-    remark: JSON.stringify(tableData.value)
+
+  const treeclick = (data: TreeNodeData, node: TreeNode) => {
+
+    currentdata.value = sites.value.filter(i => {
+      return i.dictLabel == data.label
+    })[0];
+    tableData.value = [];
+    if (currentdata.value) {
+      if (isJSON(currentdata.value.remark)) {
+        tableData.value = JSON.parse(currentdata.value.remark);
+        var cameras = tableData.value.filter(i => i.type == 'camera');
+        if (cameras.length > 0) {
+          var cameracode = cameras[0].code;
+          //存在视频播放视频
+          // getCameraPlayerConfig(cameracode).then(res => {
+          //   console.log(res.data);
+          //   var player = new EZUIKit.EZUIKitPlayer({
+          //     template: "pcLive",
+          //     id: 'video-container', // 视频容器ID
+          //     ...res.data
+          //   })
+          // })
+        }
+
+        var cabinets = tableData.value.filter(i => i.type == 'cabinet');
+        if (cabinets.length > 0) {
+          var cabinetcode = cameras[0].code;
+          SycCabinet(cabinetcode);
+        }
+      }else{
+        ElMessage.warning("站点设备配置错误");
+      }
+    }
+
   }
-  updateData(data).then(res => {
-    ElMessage.success("成功!");
-  })
 
 
-}
-
-const currentCabinet = ref({
-  total: 40,
-  unused: 10,
-  boxlist: []
-})
-const SycCabinet = (code) => {
-  //TODO 获取格数
-  // var toalnum
-  currentCabinet.value.boxlist = [];
-  for (var i = 0; i < currentCabinet.value.total; i++) {
-    // eslint-disable-next-line @typescript-eslint/ban-ts-comment
-    //@ts-ignore
-    currentCabinet.value.boxlist.push({
-      box_id: 1,
-      box_name: (i + 1) + "",
-      box_status: i % 2
+  const addDevice = () => {
+    dialogVisible.value = false;
+    if (formdata.value.name == "") {
+      ElMessage.warning("设备名称未填写");
+      return;
+    }
+    if (formdata.value.type == "") {
+      ElMessage.warning("设备类型未填写");
+      return;
+    }
+    if (formdata.value.code == "") {
+      ElMessage.warning("设备序列号未填写");
+      return;
+    }
+    if (tableData.value.filter(i => i.type == formdata.value.type).length > 0) {
+      ElMessage.warning("存在相同类型的设备");
+      return;
+    }
+    tableData.value.push(formdata.value);
+    var data = {
+      dictCode: currentdata.value.dictCode,
+      dictValue: currentdata.value.dictValue,
+      dictLabel: currentdata.value.dictLabel,
+      dictType: "tbl_sites",
+      remark: JSON.stringify(tableData.value)
+    }
+    updateData(data).then(res => {
+      ElMessage.success("成功!");
+    })
+
+
+  }
+
+  const currentCabinet = ref({
+    total: 40,
+    unused: 10,
+    boxlist: []
+  })
+  const SycCabinet = (code) => {
+    //TODO 获取格数
+    // var toalnum
+    currentCabinet.value.boxlist = [];
+    for (var i = 0; i < currentCabinet.value.total; i++) {
+      // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+      //@ts-ignore
+      currentCabinet.value.boxlist.push({
+        box_id: 1,
+        box_name: (i + 1) + "",
+        box_status: i % 2
+      }
+      )
     }
-    )
   }
-}
-const openbox = (code) => {
-  setTimeout(() => {
-    ElMessage.success("指令已发送!");
-  }, 1000);
-}
-
-
-const data = computed(() => {
-
-  var index = 1;
-
-  return [{
-    id: 1,
-    label: "站点",
-    children: sites.value.map(i => { return { id: ++index, label: i.dictLabel } }),
-  },]
-});
-onMounted(() => {
-  if (treeRef.value) {
+  const openbox = (code) => {
     setTimeout(() => {
-      treeRef.value.expandNode(treeRef.value.getNode(1))
-    }, 100);
-    getSites();
-    initData();
-    // treeRef.value.expandNode(treeRef.value.getNode(1))
+      ElMessage.success("指令已发送!");
+    }, 1000);
   }
-});
+
+
+  const data = computed(() => {
+
+    var index = 1;
+
+    return [{
+      id: 1,
+      label: "站点",
+      children: sites.value.map(i => { return { id: ++index, label: i.dictLabel } }),
+    },]
+  });
+  onMounted(() => {
+    if (treeRef.value) {
+      setTimeout(() => {
+        treeRef.value.expandNode(treeRef.value.getNode(1))
+      }, 100);
+      getSites();
+      initData();
+      // treeRef.value.expandNode(treeRef.value.getNode(1))
+    }
+  });
 
 
 
 </script>
 
 <style lang="scss" scoped>
-.card-header {
-  display: flex;
-  flex-direction: row;
-  justify-content: space-between;
-}
-
-.boxunused {
-  background: #3333332d;
-}
-</style>
+  .card-header {
+    display: flex;
+    flex-direction: row;
+    justify-content: space-between;
+  }
+
+  .boxunused {
+    background: #3333332d;
+  }
+</style>