wenhongquan 10 mēneši atpakaļ
vecāks
revīzija
749bb18985

+ 0 - 1
src/components/Public/table.vue

@@ -51,7 +51,6 @@
 </template>
 
 <script setup lang="ts">
-import { de } from 'element-plus/es/locale';
 
 const { proxy } = getCurrentInstance() as ComponentInternalInstance
 const { energy_type, business_type, tbl_car_type } = toRefs<any>(proxy?.useDict("energy_type", "business_type", "tbl_car_type"));

+ 11 - 5
src/components/Public/videoDiv.vue

@@ -1,9 +1,9 @@
 <template>
     <div>
-        <div class='info' style='display:flex;flex-direction:column;position: relative;' v-if="!isFlv">
+        <div class='info' style='display:flex;flex-direction:column;position: relative; height:29vh' v-if="!isFlv">
             <div v-if="!isOnline" style="color: white;position: absolute;top: 5px;left: 5px;z-index: 100;">{{codeObj}}
                 {{site}}{{codeObj}}</div>
-            <div :id='props.videoId' style='border-radius: 10px;width:100%;' height="200"></div>
+            <div :id='props.videoId' style='border-radius: 10px;width:100%;' :height="vheight"></div>
             <div style="height: 235px;width: 100%;background-color: black;display: flex;flex-direction: row;align-items: center;justify-content: center;"
                 v-if="!isOnline">
                 <div style="color: white;">设备离线</div>
@@ -26,6 +26,8 @@
     import { getCameraPlayerConfig } from '@/api/gpsData';
     import flvjs from "flv.js";
 
+    const vheight = ref(200)
+
     const playerObj = ref(null)
     const { proxy } = getCurrentInstance() as ComponentInternalInstance;
     const codeObj = ref(null)
@@ -39,7 +41,7 @@
         },
         height: {
             type: [Number],
-            default: "200"
+            default: 200
         }
     });
 
@@ -48,6 +50,10 @@
     const isOnline = ref(false);
 
     const initVideo = (code, siteList) => {
+
+      vheight.value = window.innerHeight *0.29
+
+
         console.log(code)
         if (code.indexOf("flv") > -1) {
             isFlv.value = true
@@ -72,7 +78,7 @@
                 console.log(res)
                 if (res.code == 200) {
                     var player = new EZUIKit.EZUIKitPlayer({
-                        height: props.height,
+                        height: vheight.value,
                         template: "pcLive",
                         id: props.videoId, // 视频容器ID
                         ...res.data
@@ -138,4 +144,4 @@
     #video-container {
         height: 200px
     }
-</style>
+</style>

+ 87 - 55
src/views/car/vehicleService/index.vue

@@ -1,55 +1,87 @@
 <template>
-    <div style="display: flex;flex-direction: row;" class="custom-calendar">
-        <el-card shadow="never" style="width: 60%;">
-            <tableElm :columns="columns" :showButton="true" @childToParent='childrenClick' ref="table"></tableElm>
-
-            <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
-                v-model:limit="queryParams.pageSize" @pagination="getList" />
-        </el-card>
-        <el-card shadow="never" style="width: 38%;margin-left: 1%;">
-            <div>
-                <el-tabs type="card" class="demo-tabs" active-name="4" v-model="activeName">
-                    <el-tab-pane label="行驶" name="1">
-                        <!-- <carWork></carWork> -->
-                        <oilUse @addInfoObj="openDialog" @updateInfoObj="updateDialog" ref="service1Obj"></oilUse>
-                    </el-tab-pane>
-                    <el-tab-pane label="加油" name="2">
-                        <oilUse @addInfoObj="openDialog" @updateInfoObj="updateDialog"  ref="service2Obj"></oilUse>
-                        <!-- <schedule></schedule> -->
-                    </el-tab-pane>
-                    <el-tab-pane label="维修" name="3">
-                        <oilUse @addInfoObj="openDialog" @updateInfoObj="updateDialog"  ref="service3Obj"></oilUse>
-                    </el-tab-pane>
-
-                </el-tabs>
-            </div>
-        </el-card>
-
-        <el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
-            <el-form ref="" :model="form" label-width="120px">
-                <el-form-item v-for="(item, index) in formList" :label="item.label" prop="carNum">
-                    <el-input v-if="item.type == 'input'" v-model="addForm[item.prop]"
-                        :placeholder="item.placeholder" />
-                    <el-date-picker v-if="item.type == 'date'" value-format="YYYY-MM-DD HH:mm:ss"
-                        v-model="addForm[item.prop]" type="date" :placeholder="item.placeholder" />
-                    <el-upload v-if="item.type == 'image'" v-model:file-list="fileList" :headers="headers"
-                        :action="uploadImgUrl" list-type="picture-card" :on-remove="handleRemove"
-                        :on-success="handleUploadSuccess">
-                        <el-icon>
-                            <Plus />
-                        </el-icon>
-                    </el-upload>
-                </el-form-item>
+  <div style="display: flex;flex-direction: row;" class="custom-calendar">
+    <el-card shadow="never" style="width: 60%;">
+      <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
+        <div class="search" v-show="showSearch" style="display: flex;flex-direction: row;">
+          <div style="width: 85%;">
+            <el-form :model="queryParams" ref="queryFormRef" :inline="true" label-width="68px">
+              <el-form-item label="车辆" prop="carNum">
+                <el-input v-model="queryParams.carNum" placeholder="请输入车牌号" clearable style="width: 160px" @keyup.enter="handleQuery" />
+              </el-form-item>
+              <!-- <el-form-item label="身份证" prop="carNum">
+                            <el-input v-model="queryParams.carNum" placeholder="请输入车牌号" clearable style="width: 160px"
+                                @keyup.enter="handleQuery" />
+                        </el-form-item> -->
+              <!-- <el-form-item label="时间" prop="carNum">
+                            <el-date-picker v-model="value2" type="datetimerange" :shortcuts="shortcuts"
+                                range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" />
+                        </el-form-item> -->
             </el-form>
-
-            <template #footer>
-                <div class="dialog-footer">
-                    <el-button type="primary" @click="submitService">确 定</el-button>
-                    <el-button @click="dialog.visible = false">取 消</el-button>
-                </div>
-            </template>
-        </el-dialog>
-    </div>
+          </div>
+          <div style="width: 15%;">
+            <el-form-item>
+              <el-button type="primary" @click="handleQuery">查询</el-button>
+            </el-form-item>
+          </div>
+        </div>
+      </transition>
+      <tableElm :columns="columns" :showButton="true" @childToParent="childrenClick" ref="table"></tableElm>
+
+      <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
+    </el-card>
+    <el-card shadow="never" style="width: 38%;margin-left: 1%;">
+      <div>
+        <el-tabs type="card" class="demo-tabs" active-name="4" v-model="activeName">
+          <el-tab-pane label="行驶" name="1">
+            <!-- <carWork></carWork> -->
+            <oilUse @addInfoObj="openDialog" @updateInfoObj="updateDialog" ref="service1Obj"></oilUse>
+          </el-tab-pane>
+          <el-tab-pane label="加油" name="2">
+            <oilUse @addInfoObj="openDialog" @updateInfoObj="updateDialog" ref="service2Obj"></oilUse>
+            <!-- <schedule></schedule> -->
+          </el-tab-pane>
+          <el-tab-pane label="维修" name="3">
+            <oilUse @addInfoObj="openDialog" @updateInfoObj="updateDialog" ref="service3Obj"></oilUse>
+          </el-tab-pane>
+        </el-tabs>
+      </div>
+    </el-card>
+
+    <el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
+      <el-form ref="" :model="form" label-width="120px">
+        <el-form-item v-for="(item, index) in formList" :label="item.label" prop="carNum">
+          <el-input v-if="item.type == 'input'" v-model="addForm[item.prop]" :placeholder="item.placeholder" />
+          <el-date-picker
+            v-if="item.type == 'date'"
+            value-format="YYYY-MM-DD HH:mm:ss"
+            v-model="addForm[item.prop]"
+            type="date"
+            :placeholder="item.placeholder"
+          />
+          <el-upload
+            v-if="item.type == 'image'"
+            v-model:file-list="fileList"
+            :headers="headers"
+            :action="uploadImgUrl"
+            list-type="picture-card"
+            :on-remove="handleRemove"
+            :on-success="handleUploadSuccess"
+          >
+            <el-icon>
+              <Plus />
+            </el-icon>
+          </el-upload>
+        </el-form-item>
+      </el-form>
+
+      <template #footer>
+        <div class="dialog-footer">
+          <el-button type="primary" @click="submitService">确 定</el-button>
+          <el-button @click="dialog.visible = false">取 消</el-button>
+        </div>
+      </template>
+    </el-dialog>
+  </div>
 </template>
 
 <script setup name="CarInfo" lang="ts">
@@ -67,7 +99,7 @@
     const router = useRouter();
 
     const baseUrl = import.meta.env.VITE_APP_BASE_API;
-    const uploadImgUrl = ref(baseUrl + "/resource/oss/upload");
+const uploadImgUrl = ref(baseUrl + "/resource/oss/upload");
 
     const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 
@@ -410,8 +442,8 @@
 </script>
 
 <style lang="scss" scoped>
-    ::v-deep .el-calendar-table .el-calendar-day {
-        height: 40px;
+::v-deep .el-calendar-table .el-calendar-day {
+    height: 40px;
 
-    }
-</style>
+}
+</style>

+ 2 - 2
src/views/car/work/carWork.vue

@@ -24,8 +24,8 @@
         </div>
         <div style="width: 15%;">
           <el-form-item>
-            <el-button type="primary" @click="goadd">新增</el-button>
-            <el-button type="primary" @click="resetQuery">查询</el-button>
+            <el-button type="primary" @click="resetQuery" icon="search">查询</el-button>
+            <el-button type="primary" @click="goadd" icon="plus">新增</el-button>
           </el-form-item>
         </div>
       </div>

+ 420 - 420
src/views/yunying/kdg/index.vue

@@ -401,498 +401,498 @@
 </template>
 
 <script setup name="CarInfo" lang="ts">
-  import { listCountry, getCountry, delCountry, addCountry, updateCountry } from '@/api/country';
-  import { TreeNode } from "element-plus";
-  import { useRoute, useRouter } from "vue-router";
-  import EZUIKit from 'ezuikit-js';
-  import { ElMessage, ElMessageBox } from 'element-plus'
-  import { getCameraPlayerConfig, cabinetboxstatic } 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 { getBoxInfo, getLock, openall } from "@/api/data"
-  import videoDiv from "@/components/Public/videoDiv.vue"
+import { listCountry, getCountry, delCountry, addCountry, updateCountry } from '@/api/country';
+import { TreeNode } from "element-plus";
+import { useRoute, useRouter } from "vue-router";
+import EZUIKit from 'ezuikit-js';
+import { ElMessage, ElMessageBox } from 'element-plus'
+import { getCameraPlayerConfig, cabinetboxstatic } 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 { getBoxInfo, getLock, openall } from "@/api/data"
+import videoDiv from "@/components/Public/videoDiv.vue"
 
-  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 type = ref([])
+const type = ref([])
 
-  const boxData = ref([])
-  const boxCode = ref(null)
-  const showKdg = ref(false)
+const boxData = ref([])
+const boxCode = ref(null)
+const showKdg = ref(false)
 
-  const videoData = ref(null)
+const videoData = ref(null)
 
-  const showVideo = ref(false)
+const showVideo = ref(false)
 
 
-  const formdata = ref({
-    name: "",
-    type: "",
-    code: ""
-  })
+const formdata = ref({
+  name: "",
+  type: "",
+  code: ""
+})
 
 
-  const route = useRoute();
-  const router = useRouter();
+const route = useRoute();
+const router = useRouter();
 
-  const tableData = ref([]);
-  const carPathList = ref([]);
-  const line = ref([]);
-  const cabinetData = ref([]);
+const tableData = ref([]);
+const carPathList = ref([]);
+const line = ref([]);
+const cabinetData = ref([]);
 
-  const activeName = ref("camera")
+const activeName = ref("camera")
 
-  const countryList = ref([])
+const countryList = ref([])
 
-  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 - 300;
-  }
+const gettreeheight = () => {
+  return document.body.clientHeight - 300;
+}
 
-  const goAdd = () => {
-    dialogVisible.value = true
-    formdata.value = {
-      name: "",
-      type: "",
-      code: ""
-    }
+const goAdd = () => {
+  dialogVisible.value = true
+  formdata.value = {
+    name: "",
+    type: "",
+    code: ""
   }
+}
 
-  const openBox = (value, lockCode) => {
+const openBox = (value, lockCode) => {
 
-    ElMessageBox.confirm(
-      '是否打开' + value + "号柜",
-      '提示',
-      {
-        confirmButtonText: '是',
-        cancelButtonText: '否',
-        type: 'warning',
-      }
-    )
-      .then(() => {
-        getLock(boxCode.value, lockCode).then(res => {
-          console.log(res.code)
-          ElMessage.success(value + "号柜远程开启成功");
-        })
-        // ElMessage({
-        //   type: 'success',
-        //   message: 'Delete completed',
-        // })
-      })
-      .catch(() => {
-        // ElMessage({
-        //   type: 'info',
-        //   message: 'Delete canceled',
-        // })
+  ElMessageBox.confirm(
+    '是否打开' + value + "号柜",
+    '提示',
+    {
+      confirmButtonText: '是',
+      cancelButtonText: '否',
+      type: 'warning',
+    }
+  )
+    .then(() => {
+      getLock(boxCode.value, lockCode).then(res => {
+        //console.log(res.code)
+        ElMessage.success(value + "号柜远程开启成功");
       })
+      // ElMessage({
+      //   type: 'success',
+      //   message: 'Delete completed',
+      // })
+    })
+    .catch(() => {
+      // ElMessage({
+      //   type: 'info',
+      //   message: 'Delete canceled',
+      // })
+    })
 
-  }
+}
 
-  const clickCabinet = (value, lockCode) => {
-    if (videoData.value.length > 0) {
-      showVideo.value = true;
-      setTimeout(() => {
-        proxy.$refs.videoPlayer.initVideo(videoData.value[0].code)
-      }, 100);
-    }
-    for (var index in boxData.value) {
-      if (boxData.value[index].box_name == value) {
-        //  console.log(boxData.value[index].box_lock_address)
-        openBox(value, boxData.value[index].box_lock_address);
-      }
+const clickCabinet = (value, lockCode) => {
+  if (videoData.value.length > 0) {
+    showVideo.value = true;
+    setTimeout(() => {
+      proxy.$refs.videoPlayer.initVideo(videoData.value[0].code)
+    }, 100);
+  }
+  for (var index in boxData.value) {
+    if (boxData.value[index].box_name == value) {
+      //  //console.log(boxData.value[index].box_lock_address)
+      openBox(value, boxData.value[index].box_lock_address);
     }
-    ElMessage.success(value + "号柜远程开启成功");
   }
+  ElMessage.success(value + "号柜远程开启成功");
+}
 
-  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 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();
 
-  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 })
+  })
+}
+
+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(sites)
-    data.value = [{
-      id: 1,
-      label: "站点",
-    },];
-    data.value[0].children = sites
-    console.log(data.value)
-    showTree.value = false;
-    setTimeout(() => {
-      showTree.value = true
-    }, 100);
-
   }
-
-  const getBoxUsed = (obj) => {
-    console.log(obj)
-    var data = sites.value.filter(i => {
-      return i.dictLabel == obj.label
-    })[0];
-    console.log(data)
-    if (data) {
-      var remark = JSON.parse((data.remark == '' ? "[]" : data.remark) ?? "[]")
-      if (remark) {
-        var cabinets = remark.filter(i => i.type == 'cabinet');
-        // return cabinetData.value[cabinets+"_box"].used
-        if (cabinets.length > 0) {
-          var code = cabinets[0].code
-          console.log(code + "_box")
-          console.log(cabinetData.value[code + "_box"])
-          return  cabinetData.value[code + "_box"].used
-        }
+  // //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 getBoxUsed = (obj) => {
+  // //console.log(obj)
+  var data = sites.value.filter(i => {
+    return i.dictLabel == obj.label
+  })[0];
+  // //console.log(data)
+  if (data) {
+    var remark = JSON.parse((data.remark == '' ? "[]" : data.remark) ?? "[]")
+    if (remark) {
+      var cabinets = remark.filter(i => i.type == 'cabinet');
+      // return cabinetData.value[cabinets+"_box"].used
+      if (cabinets.length > 0 && cabinetData.value[cabinets[0].code + "_box"]) {
+        var code = cabinets[0].code
+        // //console.log(code + "_box")
+        // //console.log(cabinetData.value[code + "_box"])
+        return  cabinetData.value[code + "_box"].used
       }
     }
-
   }
 
+}
 
-  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 } }),
-      },];
-      getCountry();
-    });
-  }
+const getSites = () => {
+  listData({ dictType: "tbl_sites" }).then(res2 => {
+    sites.value = res2.rows.filter(i =>  i.remark&&(JSON.parse(i.remark??"[]").filter(q =>q["type"]=="cabinet"&& q["code"]!="").length>0 ));
 
-  const openAllBox = () => {
-    let code = boxCode.value
-    ElMessageBox.confirm(
-      '是否打开所有柜子',
-      '提示',
-      {
-        confirmButtonText: '是',
-        cancelButtonText: '否',
-        type: 'warning',
-      }
-    )
-      .then(() => {
-        openall(code).then(res => {
-          if (res.code == 0) {
-            ElMessage.success("打开所有柜子成功");
-          }
-        })
-        // ElMessage({
-        //   type: 'success',
-        //   message: 'Delete completed',
-        // })
-      })
-      .catch(() => {
-        // ElMessage({
-        //   type: 'info',
-        //   message: 'Delete canceled',
-        // })
-      })
-  }
-
-  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)
+    var index = 1;
+    data.value = [{
+      id: 1,
+      label: "站点",
+      children: sites.value.map(i => { return { id: ++index, label: i.dictLabel } }),
+    },];
+    getCountry();
+  });
+}
+
+const openAllBox = () => {
+  let code = boxCode.value
+  ElMessageBox.confirm(
+    '是否打开所有柜子',
+    '提示',
+    {
+      confirmButtonText: '是',
+      cancelButtonText: '否',
+      type: 'warning',
     }
-    updateData(data).then(res => {
-      ElMessage.success("成功!");
+  )
+    .then(() => {
+      openall(code).then(res => {
+        if (res.code == 0) {
+          ElMessage.success("打开所有柜子成功");
+        }
+      })
+      // ElMessage({
+      //   type: 'success',
+      //   message: 'Delete completed',
+      // })
     })
+    .catch(() => {
+      // ElMessage({
+      //   type: 'info',
+      //   message: 'Delete canceled',
+      // })
+    })
+}
+
+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)
   }
-
-  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];
-    // console.log(currentdata.value)
-    tableData.value = JSON.parse((currentdata.value.remark == '' ? "[]" : currentdata.value.remark) ?? "[]")
-    if (currentdata.value) {
-      var cabinets = tableData.value.filter(i => i.type == 'cabinet');
-      videoData.value = tableData.value.filter(i => i.type == 'camera');
-      console.log(videoData.value)
+  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];
+  // //console.log(currentdata.value)
+  tableData.value = JSON.parse((currentdata.value.remark == '' ? "[]" : currentdata.value.remark) ?? "[]")
+  if (currentdata.value) {
+    var cabinets = tableData.value.filter(i => i.type == 'cabinet');
+    videoData.value = tableData.value.filter(i => i.type == 'camera');
+    //console.log(videoData.value)
+    if (cabinets.length > 0) {
+      boxCode.value = cabinets[0].code
+      getBoxInfoData(cabinets[0].code)
       if (cabinets.length > 0) {
-        boxCode.value = cabinets[0].code
-        getBoxInfoData(cabinets[0].code)
-        if (cabinets.length > 0) {
-          type.value = cabinets[0].cabinetType
-        } else {
-          type.value = 4
-        }
+        type.value = cabinets[0].cabinetType
+      } else {
+        type.value = 4
       }
-      // console.log(cabinets)
-
     }
+    // //console.log(cabinets)
 
   }
 
-  const getBoxInfoData = (code) => {
-    showKdg.value = false
-    getBoxInfo(code).then(res => {
-      boxData.value = res.data.list
-      showKdg.value = true
-      console.log(boxData.value)
-    })
-  }
-
-  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.value,
-      dictLabel: currentdata.value.label,
-      dictType: "tbl_sites",
-      remark: JSON.stringify(tableData.value)
-    }
-    updateData(data).then(res => {
-      ElMessage.success("成功!");
-    })
+}
 
+const getBoxInfoData = (code) => {
+  showKdg.value = false
+  getBoxInfo(code).then(res => {
+    boxData.value = res.data.list
+    showKdg.value = true
+    //console.log(boxData.value)
+  })
+}
 
+const addDevice = () => {
+  dialogVisible.value = false;
+  if (formdata.value.name == "") {
+    ElMessage.warning("设备名称未填写");
+    return;
   }
-
-  const currentCabinet = ref({
-    total: 40,
-    unused: 10,
-    boxlist: []
+  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.value,
+    dictLabel: currentdata.value.label,
+    dictType: "tbl_sites",
+    remark: JSON.stringify(tableData.value)
+  }
+  updateData(data).then(res => {
+    ElMessage.success("成功!");
   })
-  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 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 formatIndex = (value) => {
-    if (value < 10) {
-      return '0' + value
-    } else {
-      return value
-    }
+}
+// const openbox = (code) => {
+//   setTimeout(() => {
+//     ElMessage.success("指令已发送!");
+//   }, 1000);
+// }
+
+const formatIndex = (value) => {
+  if (value < 10) {
+    return '0' + value
+  } else {
+    return value
   }
+}
 
-  const getStatus = (index) => {
-    console.log(boxData.value.length)
-    if (index - 1 < boxData.value.length) {
-      if (boxData.value[index - 1].box_use_status == 0) {
-        return '空闲中'
-      } else {
-        return '使用中'
-      }
+const getStatus = (index) => {
+  //console.log(boxData.value.length)
+  if (index - 1 < boxData.value.length) {
+    if (boxData.value[index - 1].box_use_status == 0) {
+      return '空闲中'
     } else {
-      return '暂无'
+      return '使用中'
     }
-
+  } else {
+    return '暂无'
   }
 
-  const getCountrySites = () => {
-    for (var i in countryList.value) {
-      if (line.value == countryList.value[i].id) {
-        console.log(countryList.value[i].sites)
-        var siteList = countryList.value[i].sites.split(",")
-        var siteObjList = [];
-        for (var j in sites.value) {
-          if (siteList.indexOf(sites.value[j].dictCode) > -1) {
-            siteObjList.push(sites.value[j])
-          }
+}
+
+const getCountrySites = () => {
+  for (var i in countryList.value) {
+    if (line.value == countryList.value[i].id) {
+      //console.log(countryList.value[i].sites)
+      var siteList = countryList.value[i].sites.split(",")
+      var siteObjList = [];
+      for (var j in sites.value) {
+        if (siteList.indexOf(sites.value[j].dictCode) > -1) {
+          siteObjList.push(sites.value[j])
         }
-        updateSites(siteObjList)
       }
+      updateSites(siteObjList)
     }
   }
+}
 
-  const getCountry = () => {
-    listCountry({ pageSize: 10000 }).then(res => {
-      console.log(res)
-      countryList.value = res.rows
-    })
-  }
+const getCountry = () => {
+  listCountry({ pageSize: 10000 }).then(res => {
+    //console.log(res)
+    countryList.value = res.rows
+  })
+}
 
-  const updateSites = (sitesList) => {
-    console.log(sitesList)
-    var sites = []
-    for (var i in sitesList) {
+const updateSites = (sitesList) => {
+  //console.log(sitesList)
+  var sites = []
+  for (var i in sitesList) {
 
-      sites.push({ id: i, label: sitesList[i].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 getCabinetData = () => {
-    cabinetboxstatic().then(res => {
-      cabinetData.value = res;
-      getSites();
-    })
+    sites.push({ id: i, label: sitesList[i].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 getCabinetData = () => {
+  cabinetboxstatic().then(res => {
+    cabinetData.value = res;
+    getSites();
+  })
+}
 
-  const data = computed(() => {
+const data = computed(() => {
 
-    var index = 1;
+  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();
-      getCabinetData();
-      // initData();
-      // getCountry();
-      // treeRef.value.expandNode(treeRef.value.getNode(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();
+    getCabinetData();
+    // initData();
+    // getCountry();
+    // 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;
-  }
-
-  .indexDiv {
-    background-color: white;
-    width: 20px;
-    height: 10px;
-    color: #000;
-    font-weight: 600;
-    position: absolute;
-    right: 2px;
-    bottom: 1px;
-    z-index: 1000;
-    font-size: 10px;
-    text-align: center;
-  }
-
-  .indexDivLeft {
-    background-color: white;
-    width: 40px;
-    height: 10px;
-    color: #000;
-    font-weight: 600;
-    position: absolute;
-    left: 2px;
-    bottom: 1px;
-    z-index: 1000;
-    font-size: 10px;
-    text-align: center;
-  }
-</style>
+.card-header {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+}
+
+.boxunused {
+  background: #3333332d;
+}
+
+.indexDiv {
+  background-color: white;
+  width: 20px;
+  height: 10px;
+  color: #000;
+  font-weight: 600;
+  position: absolute;
+  right: 2px;
+  bottom: 1px;
+  z-index: 1000;
+  font-size: 10px;
+  text-align: center;
+}
+
+.indexDivLeft {
+  background-color: white;
+  width: 40px;
+  height: 10px;
+  color: #000;
+  font-weight: 600;
+  position: absolute;
+  left: 2px;
+  bottom: 1px;
+  z-index: 1000;
+  font-size: 10px;
+  text-align: center;
+}
+</style>

+ 13 - 3
src/views/yunying/sties/index.vue

@@ -397,16 +397,26 @@ watch(filterText, (val) => {
 
 const savedata = () => {
   //保存数据
-  var data = {
+  var data1 = {
     dictCode: currentdata.value.dictCode,
     dictValue: currentdata.value.dictValue,
     dictLabel: currentdata.value.dictLabel,
     dictType: "tbl_sites",
     remark: JSON.stringify(tableData.value),
   };
-  updateData(data).then((res) => {
+
+  updateData(data1).then((res) => {
     ElMessage.success("成功!");
-    //window.location.reload();
+    // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+    //@ts-ignore
+    sites.value.forEach((i) => {
+      if( i.dictLabel == data1.dictLabel){
+        i.dictCode = data1.dictCode;
+        i.dictValue = data1.dictValue;
+        i.remark = data1.remark;
+      }
+    })[0];
+
   });
 };
 

+ 380 - 380
src/views/yunying/videoKdg/index.vue

@@ -88,450 +88,450 @@
 </template>
 
 <script setup name="CarInfo" lang="ts">
-    import { listCountry, getCountry, delCountry, addCountry, updateCountry } from '@/api/country';
-    import { TreeNode } from "element-plus";
-    import { useRoute, useRouter } from "vue-router";
-    import EZUIKit from 'ezuikit-js';
-    import { ElMessage, ElMessageBox } from 'element-plus'
-    import { getCameraPlayerConfig } from '@/api/gpsData';
-    import { updateData, listData } from "@/api/system/dict/data";
-    import imgulock from "@/assets/images/unlock@2x.png";
-    import videoDiv from "@/components/Public/videoDiv.vue"
+import { listCountry, getCountry, delCountry, addCountry, updateCountry } from '@/api/country';
+import { TreeNode } from "element-plus";
+import { useRoute, useRouter } from "vue-router";
+import EZUIKit from 'ezuikit-js';
+import { ElMessage, ElMessageBox } from 'element-plus'
+import { getCameraPlayerConfig } from '@/api/gpsData';
+import { updateData, listData } from "@/api/system/dict/data";
+import imgulock from "@/assets/images/unlock@2x.png";
+import videoDiv from "@/components/Public/videoDiv.vue"
 
 
-    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 showVideo = ref(true)
+const showVideo = ref(true)
 
-    const type = ref([])
+const type = ref([])
 
-    const total = ref(0);
-    const CurrentPage = ref(1)
+const total = ref(0);
+const CurrentPage = ref(1)
 
-    const videoCount = ref(9)
+const videoCount = ref(9)
 
-    const boxData = ref([])
-    const boxCode = ref(null)
-    const showKdg = ref(false)
-    const siteListArry = ref([])
+const boxData = ref([])
+const boxCode = ref(null)
+const showKdg = ref(false)
+const siteListArry = ref([])
 
 
-    const formdata = ref({
-        name: "",
-        type: "",
-        code: ""
-    })
+const formdata = ref({
+    name: "",
+    type: "",
+    code: ""
+})
 
 
-    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 countryList = ref([])
+const countryList = ref([])
 
-    const deviceData = ref([])
+const deviceData = ref([])
 
-    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 - 300;
-    }
+const gettreeheight = () => {
+    return document.body.clientHeight - 300;
+}
 
-    const goAdd = () => {
-        dialogVisible.value = true
-        formdata.value = {
-            name: "",
-            type: "",
-            code: ""
-        }
+const goAdd = () => {
+    dialogVisible.value = true
+    formdata.value = {
+        name: "",
+        type: "",
+        code: ""
     }
+}
 
 
-    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);
+watch(filterText, (val) => {
+    if (treeRef.value) {
+        treeRef.value.filter(val);
+    }
+});
+
+const pageChange = (val) => {
+    showVideo.value = false
+    CurrentPage.value = val
+    var pageData = val - 1
+    const deviceList = deviceData.value
+    var videoList = []
+    if (deviceList.length > val * 9) {
+        videoCount.value = 9
+        for (var index = 0; index < 9; index++) {
+            videoList.push(deviceList[pageData * 9 + index])
         }
-    });
-
-    const pageChange = (val) => {
-        showVideo.value = false
-        CurrentPage.value = val
-        var pageData = val - 1
-        const deviceList = deviceData.value
-        var videoList = []
-        if (deviceList.length > val * 9) {
-            videoCount.value = 9
-            for (var index = 0; index < 9; index++) {
-                videoList.push(deviceList[pageData * 9 + index])
-            }
-        } else {
-            videoCount.value = deviceList.length - pageData * 9
-            for (var index = 0; index < deviceList.length - pageData * 9; index++) {
-                videoList.push(deviceList[pageData * 9 + index])
-            }
+    } else {
+        videoCount.value = deviceList.length - pageData * 9
+        for (var index = 0; index < deviceList.length - pageData * 9; index++) {
+            videoList.push(deviceList[pageData * 9 + index])
         }
-        setTimeout(() => {
-            initVideos(videoList)
-        }, 100);
-    }
-
-    const getSites = () => {
-        listData({ dictType: "tbl_sites" }).then(res2 => {
-            sites.value = res2.rows;
-            getCountry();
-        });
-    }
-
-    const handleTabClick = () => {
-
     }
-
-    const filterNode = (value: string, node: TreeNode) => {
-        if (node.id == 1) return true;
-        return node.label.indexOf(value) != -1;
-    };
-
-    const currentdata = ref(null)
-
-    const videoInit = (data, node) => {
-        console.log(data)
-        var siteList = data.data.sites.split(",")
-        console.log(siteList)
-        var deviceList = [];
-        siteListArry.value = [];
-        console.log(sites.value)
-        for (var i in sites.value) {
-            if (siteList.indexOf(sites.value[i].dictCode) > -1) {
-                if (isJSON(sites.value[i].remark)) {
-                    var deviceJson = JSON.parse(sites.value[i].remark)
-                    for (var j in deviceJson) {
-                        if (deviceJson[j].type == "camera") {
-                            var obj = {
-                                name: sites.value[i].dictLabel,
-                                code: deviceJson[j].code
-                            }
-                            siteListArry.value.push(obj)
-                            console.log(deviceJson[j].code)
-                            deviceList.push(deviceJson[j].code);
+    setTimeout(() => {
+        initVideos(videoList)
+    }, 100);
+}
+
+const getSites = () => {
+    listData({ dictType: "tbl_sites" }).then(res2 => {
+        sites.value = res2.rows;
+        getCountry();
+    });
+}
+
+const handleTabClick = () => {
+
+}
+
+const filterNode = (value: string, node: TreeNode) => {
+    if (node.id == 1) return true;
+    return node.label.indexOf(value) != -1;
+};
+
+const currentdata = ref(null)
+
+const videoInit = (data, node) => {
+    console.log(data)
+    var siteList = data.data.sites.split(",")
+    console.log(siteList)
+    var deviceList = [];
+    siteListArry.value = [];
+    console.log(sites.value)
+    for (var i in sites.value) {
+        if (siteList.indexOf(sites.value[i].dictCode) > -1) {
+            if (isJSON(sites.value[i].remark)) {
+                var deviceJson = JSON.parse(sites.value[i].remark)
+                for (var j in deviceJson) {
+                    if (deviceJson[j].type == "camera") {
+                        var obj = {
+                            name: sites.value[i].dictLabel,
+                            code: deviceJson[j].code
                         }
+                        siteListArry.value.push(obj)
+                        console.log(deviceJson[j].code)
+                        deviceList.push(deviceJson[j].code);
                     }
                 }
             }
         }
-        deviceData.value = deviceList
+    }
+    deviceData.value = deviceList
+    console.log(deviceList)
+    total.value = deviceList.length
+    CurrentPage.value = 1
+    const videoList = []
+    if (deviceList.length > 9) {
         console.log(deviceList)
-        total.value = deviceList.length
-        CurrentPage.value = 1
-        const videoList = []
-        if (deviceList.length > 9) {
-            console.log(deviceList)
-            for (var index = 0; index < 9; index++) {
-                videoCount.value = 9
-                videoList.push(deviceList[index])
-            }
-        } else {
-            for (var index in deviceList) {
-                videoCount.value = deviceList.length;
-                videoList.push(deviceList[index])
-            }
+        for (var index = 0; index < 9; index++) {
+            videoCount.value = 9
+            videoList.push(deviceList[index])
+        }
+    } else {
+        for (var index in deviceList) {
+            videoCount.value = deviceList.length;
+            videoList.push(deviceList[index])
         }
-        setTimeout(() => {
-            initVideos(videoList)
-        }, 100);
     }
-
-    const treeclick = (data: TreeNodeData, node: TreeNode) => {
+    setTimeout(() => {
+        initVideos(videoList)
+    }, 100);
+}
+
+const treeclick = (data: TreeNodeData, node: TreeNode) => {
+    console.log(data)
+    videoCount.value = 0
+    setTimeout(() => {
         console.log(data)
-        videoCount.value = 0
-        setTimeout(() => {
-            console.log(data)
-            videoInit(data, node)
-        }, 1000);
-    }
-
-    const initVideos = (videoList, sites) => {
-        showVideo.value = true
-        setTimeout(() => {
-            for (var index in videoList) {
-                initVideoDiv(index, videoList[index])
-                // setTimeout(() => {
-                //     initVideoDiv(index, videoList[index])
-                // }, 1000);
-            }
-        }, 100);
-    }
-
-    const initVideoDiv = (index, code) => {
-        if (index == 0) {
-            // console.log(code)
-            proxy.$refs.video1.initVideo(code, siteListArry.value)
-        } else if (index == 1) {
-            // console.log(code)
-            proxy.$refs.video2.initVideo(code, siteListArry.value)
-            // console.log(code)
-        } else if (index == 2) {
-            // console.log(code)
-            proxy.$refs.video3.initVideo(code, siteListArry.value)
-        } else if (index == 3) {
-            // console.log(code)
-            proxy.$refs.video4.initVideo(code, siteListArry.value)
-        } else if (index == 4) {
-            proxy.$refs.video5.initVideo(code, siteListArry.value)
-        } else if (index == 5) {
-            proxy.$refs.video6.initVideo(code, siteListArry.value)
-        } else if (index == 6) {
-            proxy.$refs.video7.initVideo(code, siteListArry.value)
-        } else if (index == 7) {
-            proxy.$refs.video8.initVideo(code, siteListArry.value)
-        } else if (index == 8) {
-            proxy.$refs.video9.initVideo(code, siteListArry.value)
+        videoInit(data, node)
+    }, 1000);
+}
+
+const initVideos = (videoList, sites) => {
+    showVideo.value = true
+    setTimeout(() => {
+        for (var index in videoList) {
+            initVideoDiv(index, videoList[index])
+            // setTimeout(() => {
+            //     initVideoDiv(index, videoList[index])
+            // }, 1000);
         }
+    }, 100);
+}
+
+const initVideoDiv = (index, code) => {
+    if (index == 0) {
+        // console.log(code)
+        proxy.$refs.video1.initVideo(code, siteListArry.value)
+    } else if (index == 1) {
+        // console.log(code)
+        proxy.$refs.video2.initVideo(code, siteListArry.value)
+        // console.log(code)
+    } else if (index == 2) {
+        // console.log(code)
+        proxy.$refs.video3.initVideo(code, siteListArry.value)
+    } else if (index == 3) {
+        // console.log(code)
+        proxy.$refs.video4.initVideo(code, siteListArry.value)
+    } else if (index == 4) {
+        proxy.$refs.video5.initVideo(code, siteListArry.value)
+    } else if (index == 5) {
+        proxy.$refs.video6.initVideo(code, siteListArry.value)
+    } else if (index == 6) {
+        proxy.$refs.video7.initVideo(code, siteListArry.value)
+    } else if (index == 7) {
+        proxy.$refs.video8.initVideo(code, siteListArry.value)
+    } else if (index == 8) {
+        proxy.$refs.video9.initVideo(code, siteListArry.value)
     }
-
-    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) {
+}
+
+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;
         }
     }
+}
+
+const getBoxInfoData = (code) => {
+    showKdg.value = false
+    getBoxInfo(code).then(res => {
+        boxData.value = res.data.list
+        showKdg.value = true
+        console.log(boxData.value)
+    })
+}
 
-    const getBoxInfoData = (code) => {
-        showKdg.value = false
-        getBoxInfo(code).then(res => {
-            boxData.value = res.data.list
-            showKdg.value = true
-            console.log(boxData.value)
-        })
+const addDevice = () => {
+    dialogVisible.value = false;
+    if (formdata.value.name == "") {
+        ElMessage.warning("设备名称未填写");
+        return;
     }
-
-    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.value,
-            dictLabel: currentdata.value.label,
-            dictType: "tbl_sites",
-            remark: JSON.stringify(tableData.value)
-        }
-        updateData(data).then(res => {
-            ElMessage.success("成功!");
-        })
-
-
+    if (formdata.value.type == "") {
+        ElMessage.warning("设备类型未填写");
+        return;
     }
-
-    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
-            }
-            )
-        }
+    if (formdata.value.code == "") {
+        ElMessage.warning("设备序列号未填写");
+        return;
     }
-    // const openbox = (code) => {
-    //   setTimeout(() => {
-    //     ElMessage.success("指令已发送!");
-    //   }, 1000);
-    // }
+    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.value,
+        dictLabel: currentdata.value.label,
+        dictType: "tbl_sites",
+        remark: JSON.stringify(tableData.value)
+    }
+    updateData(data).then(res => {
+        ElMessage.success("成功!");
+    })
 
-    const formatIndex = (value) => {
-        if (value < 10) {
-            return '0' + value
-        } else {
-            return value
+
+}
+
+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 formatIndex = (value) => {
+    if (value < 10) {
+        return '0' + value
+    } else {
+        return value
     }
+}
 
-    const getStatus = (index) => {
-        console.log(boxData.value.length)
-        if (index - 1 < boxData.value.length) {
-            if (boxData.value[index - 1].box_use_status == 0) {
-                return '空闲中'
-            } else {
-                return '使用中'
-            }
+const getStatus = (index) => {
+    console.log(boxData.value.length)
+    if (index - 1 < boxData.value.length) {
+        if (boxData.value[index - 1].box_use_status == 0) {
+            return '空闲中'
         } else {
-            return '暂无'
+            return '使用中'
         }
-
+    } else {
+        return '暂无'
     }
 
-    const getCountrySites = () => {
-        for (var i in countryList.value) {
-            if (line.value == countryList.value[i].id) {
-                console.log(countryList.value[i].sites)
-                var siteList = countryList.value[i].sites.split(",")
-                var siteObjList = [];
-                for (var j in sites.value) {
-                    if (siteList.indexOf(sites.value[j].dictCode) > -1) {
-                        siteObjList.push(sites.value[j])
-                    }
+}
+
+const getCountrySites = () => {
+    for (var i in countryList.value) {
+        if (line.value == countryList.value[i].id) {
+            console.log(countryList.value[i].sites)
+            var siteList = countryList.value[i].sites.split(",")
+            var siteObjList = [];
+            for (var j in sites.value) {
+                if (siteList.indexOf(sites.value[j].dictCode) > -1) {
+                    siteObjList.push(sites.value[j])
                 }
-                updateSites(siteObjList)
             }
+            updateSites(siteObjList)
         }
     }
+}
 
-    const getCountry = () => {
-        listCountry({ pageSize: 10000 }).then(res => {
-            countryList.value = res.rows
-            treeclick(data.value[0].children[0], null)
-        })
-    }
+const getCountry = () => {
+    listCountry({ pageSize: 10000 }).then(res => {
+        countryList.value = res.rows
+        treeclick(data.value[0].children[0], null)
+    })
+}
 
-    const updateSites = (sitesList) => {
-        var sites = []
-        for (var i in sitesList) {
+const updateSites = (sitesList) => {
+    var sites = []
+    for (var i in sitesList) {
 
-            sites.push({ id: i, label: sitesList[i].dictLabel })
-        }
-        console.log(sites)
-        data.value = [{
-            id: 1,
-            label: "站点",
-        },];
-        data.value[0].children = sites
-        console.log(data.value)
-        showTree.value = false;
-        console.log(data.value[0].children[0])
+        sites.push({ id: i, label: sitesList[i].dictLabel })
+    }
+    console.log(sites)
+    data.value = [{
+        id: 1,
+        label: "站点",
+    },];
+    data.value[0].children = sites
+    console.log(data.value)
+    showTree.value = false;
+    console.log(data.value[0].children[0])
+    setTimeout(() => {
+        showTree.value = true
+    }, 100);
+}
+
+const data = computed(() => {
+
+    var index = 1;
+
+    return [{
+        id: 1,
+        label: "乡镇",
+        children: countryList.value.map(i => { return { id: ++index, label: i.name, data: i } }),
+    },]
+});
+
+const initData = async () => {
+    if (treeRef.value) {
         setTimeout(() => {
-            showTree.value = true
+            treeRef.value.expandNode(treeRef.value.getNode(1))
         }, 100);
+        await getSites();
+        // initData();
+        // treeRef.value.expandNode(treeRef.value.getNode(1))
     }
-
-    const data = computed(() => {
-
-        var index = 1;
-
-        return [{
-            id: 1,
-            label: "乡镇",
-            children: countryList.value.map(i => { return { id: ++index, label: i.name, data: i } }),
-        },]
-    });
-
-    const initData = async () => {
-        if (treeRef.value) {
-            setTimeout(() => {
-                treeRef.value.expandNode(treeRef.value.getNode(1))
-            }, 100);
-            await getSites();
-            // initData();
-            // treeRef.value.expandNode(treeRef.value.getNode(1))
-        }
-    }
-
-    onMounted(() => {
-        initData();
-        // if (treeRef.value) {
-        //     setTimeout(() => {
-        //         treeRef.value.expandNode(treeRef.value.getNode(1))
-        //     }, 100);
-        //     getSites();
-        //     // initData();
-        //     getCountry();
-        //     // treeRef.value.expandNode(treeRef.value.getNode(1))
-        // }
-    });
+}
+
+onMounted(() => {
+    initData();
+    // if (treeRef.value) {
+    //     setTimeout(() => {
+    //         treeRef.value.expandNode(treeRef.value.getNode(1))
+    //     }, 100);
+    //     getSites();
+    //     // initData();
+    //     getCountry();
+    //     // 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;
-    }
-
-    .indexDiv {
-        background-color: white;
-        width: 20px;
-        height: 10px;
-        color: #000;
-        font-weight: 600;
-        position: absolute;
-        right: 2px;
-        bottom: 1px;
-        z-index: 1000;
-        font-size: 10px;
-        text-align: center;
-    }
-
-    .indexDivLeft {
-        background-color: white;
-        width: 40px;
-        height: 10px;
-        color: #000;
-        font-weight: 600;
-        position: absolute;
-        left: 2px;
-        bottom: 1px;
-        z-index: 1000;
-        font-size: 10px;
-        text-align: center;
-    }
-
-    .videoClass{
-        height:29vh;
-        background-color:#000
-    }
-</style>
+.card-header {
+    display: flex;
+    flex-direction: row;
+    justify-content: space-between;
+}
+
+.boxunused {
+    background: #3333332d;
+}
+
+.indexDiv {
+    background-color: white;
+    width: 20px;
+    height: 10px;
+    color: #000;
+    font-weight: 600;
+    position: absolute;
+    right: 2px;
+    bottom: 1px;
+    z-index: 1000;
+    font-size: 10px;
+    text-align: center;
+}
+
+.indexDivLeft {
+    background-color: white;
+    width: 40px;
+    height: 10px;
+    color: #000;
+    font-weight: 600;
+    position: absolute;
+    left: 2px;
+    bottom: 1px;
+    z-index: 1000;
+    font-size: 10px;
+    text-align: center;
+}
+
+.videoClass{
+    height:29vh;
+    background-color:#000
+}
+</style>

+ 2 - 2
vite.config.ts

@@ -26,8 +26,8 @@ export default defineConfig(({ mode, command }: ConfigEnv): UserConfig => {
       open: true,
       proxy: {
         [env.VITE_APP_BASE_API]: {
-          // target: 'http://localhost:8080',
-          target: 'https://khy.xiaole.vip/api',
+          target: 'http://localhost:8080',
+          // target: 'https://khy.xiaole.vip/api',
           changeOrigin: true,
           ws: true,
           rewrite: (path) => path.replace(new RegExp('^' + env.VITE_APP_BASE_API), '')