Эх сурвалжийг харах

feat: 修改logo格式&数据表格添加sn字段

HeWang 7 сар өмнө
parent
commit
580e73bd80

+ 1 - 1
index.html

@@ -4,7 +4,7 @@
     <meta charset="UTF-8">
     <link rel="icon" href="/favicon.ico">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    <title>Vite App</title>
+    <title>Pji Desktop</title>
   </head>
   <body>
     <div id="app"></div>

+ 1 - 1
src/views/AlgorithmEvalView.vue

@@ -5,7 +5,7 @@
       <el-header
           style="height: 250px; background-color: rgba(255,0,0,50%); display: flex; flex-direction: column; justify-content: center; align-items: center;">
         <div class="demo-image" style="text-align: center;"> <!-- 注意这里添加了 text-align: center; 但对于块级元素这不是必需的 -->
-          <img src="../assets/pji-logo.jpg" alt="" style="width:506.5px;height: 146px">
+          <img src="../assets/pji-logo.jpg" alt="" style="width:200px;height: 200pxpx">
           <!-- 推荐使用 max-width 保持图片比例 -->
         </div>
       </el-header>

+ 4 - 4
src/views/MapRescanView.vue

@@ -5,14 +5,14 @@
       <el-header
           style="height: 250px; background-color: rgba(255,0,0,50%); display: flex; flex-direction: column; justify-content: center; align-items: center;">
         <div class="demo-image" style="text-align: center;"> <!-- 注意这里添加了 text-align: center; 但对于块级元素这不是必需的 -->
-          <img src="../assets/pji-logo.jpg" alt="" style="width:506.5px;height: 146px">
+          <img src="../assets/pji-logo.jpg" alt="" style="width:200px;height: 200px">
           <!-- 推荐使用 max-width 保持图片比例 -->
         </div>
       </el-header>
       <el-main style="background-color:white;">
         <el-breadcrumb separator="/" style="margin-bottom: 10px;">
           <el-breadcrumb-item :to="{ path: '/' }">主页</el-breadcrumb-item>
-          <el-breadcrumb-item>地图续扫提醒</el-breadcrumb-item>
+          <el-breadcrumb-item>地图重采提醒</el-breadcrumb-item>
         </el-breadcrumb>
         <div class="topbar">
           <el-form style=" background-color: rgba(0,0,0,0%);" :inline="true" :model="queryLine"
@@ -20,7 +20,7 @@
             <el-form-item label="设备名称">
               <el-input v-model="queryLine.equipmentName" placeholder="请输入设备名称" clearable/>
             </el-form-item>
-            <el-form-item label="设备类型">
+            <el-foFrm-item label="设备类型">
               <!--              <el-input v-model="queryLine.equipmentType" placeholder="请输入设备类型" clearable/>-->
               <el-select
                   v-model="queryLine.equipmentType"
@@ -36,7 +36,7 @@
                     :value="item"
                 />
               </el-select>
-            </el-form-item>
+            </el-foFrm-item>
 <!--            <el-form-item label="更新阈值设置" label-width="100">-->
 <!--              <el-input v-model="queryLine.threshold" min="0" max="100" step="1" style="width: 65px">-->
 <!--                <template #suffix>-->

+ 1 - 1
src/views/MapUpdateView.vue

@@ -4,7 +4,7 @@
       <el-header
           style="height: 250px; background-color: rgba(255,0,0,50%); display: flex; flex-direction: column; justify-content: center; align-items: center;">
         <div class="demo-image" style="text-align: center;"> <!-- 注意这里添加了 text-align: center; 但对于块级元素这不是必需的 -->
-          <img src="../assets/pji-logo.jpg" alt="" style="width:506.5px;height: 146px">
+          <img src="../assets/pji-logo.jpg" alt="" style="width:200px;height: 200px">
           <!-- 推荐使用 max-width 保持图片比例 -->
         </div>
       </el-header>

+ 18 - 13
src/views/ReportView.vue

@@ -4,7 +4,7 @@
       <el-header
           style="height: 250px; background-color: rgba(255,0,0,50%); display: flex; flex-direction: column; justify-content: center; align-items: center;">
         <div class="demo-image" style="text-align: center;"> <!-- 注意这里添加了 text-align: center; 但对于块级元素这不是必需的 -->
-          <img src="../assets/pji-logo.jpg" alt="" style="width:506.5px;height: 146px">
+          <img src="../assets/pji-logo.jpg" alt="" style="width:200px;height: 200px">
           <!-- 推荐使用 max-width 保持图片比例 -->
         </div>
       </el-header>
@@ -53,8 +53,8 @@
           </el-form>
           <el-button type="primary" @click="updateMap">地图更新</el-button>
           <el-button type="primary" @click="goToUpdateStat">地图更新统计</el-button>
-          <el-button type="primary" @click="getThreshold">地图续扫提醒阈值</el-button>
-          <el-button type="primary" @click="goToMapRescan">地图续扫提醒</el-button>
+          <el-button type="primary" @click="getThreshold">地图重采提醒阈值</el-button>
+          <el-button type="primary" @click="goToMapRescan">地图重采提醒</el-button>
 <!--          <el-button type="primary" @click="goToMapUpdate">地图更新</el-button>-->
 
           <el-dialog
@@ -77,13 +77,13 @@
 
           <el-dialog
               v-model="mapDialogVisible"
-              title="地图续扫提醒"
+              title="地图重采提醒"
               width="400"
               :before-close="handleMapClose"
               :close-on-click-modal="false"
           >
             <el-form :model="mapRescanForm">
-              <el-form-item label="请输入地图续扫提醒阈值" label-width="170">
+              <el-form-item label="请输入地图重采提醒阈值" label-width="170">
 <!--                <el-input v-model="mapRescanForm.value">-->
 <!--                  <template #suffix>-->
 <!--                    <i slot="suffix" style="color: #181818">%</i>-->
@@ -209,6 +209,7 @@
           <el-table-column prop="dataName" label="数据名称"/>
           <el-table-column prop="dataSize" label="数据容量" :formatter="dataSizeFormatter"/>
           <el-table-column prop="equipmentName" label="设备名称"/>
+          <el-table-column prop="equipmentNo" label="设备sn码" :formatter="equipmentNoFormatter"/>
           <el-table-column prop="equipmentTypeName" label="设备类型"/>
           <el-table-column prop="triggerName" label="触发器名称"/>
           <el-table-column prop="triggerTypeName" label="触发器类型"/>
@@ -292,12 +293,12 @@ const setThreshold = async () =>{
     // console.log(response.data)
 
     if (!response.data.status) {
-      ElMessage.error("更新地图续扫阈值失败")
+      ElMessage.error("更新地图重采阈值失败")
       return
     }
     mapDialogVisible.value = false
   } catch (error) {
-    ElMessage.error("更新地图续扫阈值失败")
+    ElMessage.error("更新地图重采阈值失败")
     console.log("Error updating the threshold:", error)
   }
 }
@@ -310,13 +311,13 @@ const getThreshold = async () => {
     // console.log(response.data)
 
     if (!response.data.status) {
-      ElMessage.error("获取地图续扫阈值失败")
+      ElMessage.error("获取地图重采阈值失败")
       return
     }
     mapRescanForm.value = +response.data.data
     mapDialogVisible.value = true
   } catch (error) {
-    ElMessage.error("获取地图续扫阈值失败")
+    ElMessage.error("获取地图重采阈值失败")
     console.log("Error querying the threshold:", error)
   }
 }
@@ -495,6 +496,10 @@ const dataSizeFormatter = (row, column, cellValue, index) => {
   return cellValue; // 如果cellValue为null或undefined,则返回原值或你想要的默认值
 }
 
+const equipmentNoFormatter = (row, column, cellValue, index) => {
+  return removePerfix(cellValue, "pjibot-");
+}
+
 const isPropertySame= (array, propertyName) => {
   if (array.length <= 1) {
     return true; // 空数组或但个元素视为所有值相同
@@ -540,8 +545,8 @@ const getLatestTime = (reocrds) => {
 // 地图更新
 const updateMap = async () => {
   // 检查选择的记录数量
-  if (multipleSelection.value.length == 0) {
-    ElMessage.error("请选择记录!")
+  if (multipleSelection.value.length < 3) {
+    ElMessage.error("请至少选择三条属于同一设备的记录!")
     return
   }
 
@@ -635,7 +640,7 @@ const updateMap = async () => {
     loadingInstance.close()
     // 更新步骤条状态
     update_active.value = 1
-    console.log("Starting update map...")
+    console.log("Updating map...")
     // 执行脚本 - 生成world,启动gazebo
     window.electronAPI.updateMap(containerName, filePath);
     // 开启loading
@@ -743,7 +748,7 @@ const checkDeviceMapStatus = async (sceneId, deviceNo, deviceName, deviceType, r
 
     return response.data
   } catch (error) {
-    console.log("Error checking the device map's onsistency:", error)
+    console.log("Error checking the device map's status:", error)
   }
 }
 

+ 1 - 1
src/views/TestRecordView.vue

@@ -5,7 +5,7 @@
       <el-header
           style="height: 250px; background-color: rgba(255,0,0,50%); display: flex; flex-direction: column; justify-content: center; align-items: center;">
         <div class="demo-image" style="text-align: center;"> <!-- 注意这里添加了 text-align: center; 但对于块级元素这不是必需的 -->
-          <img src="../assets/pji-logo.jpg" alt="" style="width:506.5px;height: 146px">
+          <img src="../assets/pji-logo.jpg" alt="" style="width:200px;height: 200px">
           <!-- 推荐使用 max-width 保持图片比例 -->
         </div>
       </el-header>

+ 48 - 1
src/views/UpdateStatView.vue

@@ -4,7 +4,7 @@
       <el-header
           style="height: 250px; background-color: rgba(255,0,0,50%); display: flex; flex-direction: column; justify-content: center; align-items: center;">
         <div class="demo-image" style="text-align: center;"> <!-- 注意这里添加了 text-align: center; 但对于块级元素这不是必需的 -->
-          <img src="../assets/pji-logo.jpg" alt="" style="width:506.5px;height: 146px">
+          <img src="../assets/pji-logo.jpg" alt="" style="width:200px;height: 200px">
           <!-- 推荐使用 max-width 保持图片比例 -->
         </div>
       </el-header>
@@ -63,6 +63,7 @@
                   fixed ref="multipleTableRef" :cell-style="{ textAlign: 'center'}" :header-cell-style="{ textAlign: 'center'}">
           <el-table-column type="selection" width="55"/>
           <el-table-column prop="device_name" label="设备名称"/>
+          <el-table-column prop="device_sn" label="设备sn码"/>
           <el-table-column prop="device_type" label="设备类型"/>
           <el-table-column prop="map_id" label="地图id"/>
           <el-table-column prop="update_time" label="地图更新时间" :formatter="formatDate"/>
@@ -136,6 +137,28 @@ const onSubmit = () => {
 const uploadMap = async (row) => {
   let id = row.id
   console.log("id", id)
+  const deviceNo = row.device_sn
+  const mapId = row.map_id
+  const updateTime = row.update_time
+  // 更新设备地图记录
+  let response = await updateDeviceMap()
+  console.log("response", response)
+  if(!response.status) {
+    ElMessage.error("数据更新失败,请重试!")
+    return
+  }
+
+  // 检查地图状态(是否可以更新)
+  response = await checkDeviceMapStatus(deviceNo, mapId, updateTime)
+
+  if (!response.status) {
+    if (response.code != "") {
+      ElMessage.error(response.msg)
+    } else {
+      ElMessage.error("地图状态查询失败")
+    }
+    return
+  }
   try {
     // 开启loading
     let loadingInstance = ElLoading.service({fullscreen: false, target:'.el-table', text: '地图上传中...'})
@@ -183,6 +206,7 @@ const formatDate =  (row) => {
 }
 
 const formatStatus =  (row) => {
+  if (row.update_flag == -1) return "已失效";
   if (row.update_flag == 0) return "未上传";
   if (row.update_flag == 1) return "已上传,未部署";
   if (row.update_flag == 2) return "已部署";
@@ -201,6 +225,29 @@ const closeImgViewer = () => {
   showImageViewer.value = false;
 }
 
+const updateDeviceMap = async () => {
+  try {
+    const response =  await axios.get('/local/map/update/deviceMap/record')
+    console.log(response.data)
+
+    return response.data
+  } catch (error) {
+    console.log("Error updating the device-map:", error)
+  }
+}
+
+const checkDeviceMapStatus = async (deviceNo, mapId, updateTime) => {
+  try {
+    const response =  await axios.get('/local/map/check/updateMap/status?deviceNo=' + deviceNo +
+        '&mapId=' + mapId + '&updateTime=' + updateTime)
+    console.log(response.data)
+
+    return response.data
+  } catch (error) {
+    console.log("Error checking the update map's status:", error)
+  }
+}
+
 async function page() {
   // axios.get('http://1.202.169.139:8081/open/scene/list?equipmentType=YI_DAO_JI_QI_REN&page=' + currentPage.value + '&size=' + pageSize.value,
   //     {

+ 2 - 2
vite.config.ts

@@ -12,8 +12,8 @@ export default defineConfig({
         rewrite: (path)  => path.replace(/^\/local/,''),
       },
       '/pji': {
-        target:'http://36.110.106.156:11121', // 外网地址
-        // target:'http://10.14.86.147:9081', // 内网地址
+        // target:'http://36.110.106.156:11121', // 外网地址
+        target:'http://10.14.86.147:9081', // 内网地址
         changeOrigin: true,
         rewrite: (path)  => path.replace(/^\/pji/,''),
       },