cuiqian2004
2025-09-19 d8743368ffda9bc0fb2c6818f695a9a6b1079e57
pages/index/index.vue
@@ -42,20 +42,20 @@
               </view>
            </view>
            <image class="vehicle-img " :class="page.link_status ?'':'gray-image'" mode="aspectFit"
               src="/images/image 11.png" alt="图片" />
               src="/images/che.png" alt="图片" />
            <view v-if="page.link_status" class="img-button-group">
               <view type="primary" class="img-text-button" @click="clickToTask(index,page)">
                  <a-button class="img-button" color='primary' disabled>
                     <text class="ico task-list" />
                  </a-button>
                  <text>任务列表</text>
               </view>
               <view type="primary" plain="true" class="img-text-button" @click="clickToMap(index,page)">
                  <a-button class="img-button" color='primary'>
                     <text class="ico map" />
                  </a-button>
                  <text>进入地图</text>
                  <text>场景构建</text>
               </view>
               <view type="primary" class="img-text-button" @click="clickToTask(page)">
                  <a-button class="img-button" color='primary'>
                     <text class="ico task-list" />
                  </a-button>
                  <text>任务记录</text>
               </view>
            </view>
            <view v-else class="unlink-content">
@@ -123,9 +123,12 @@
   import {
      session,
      showToast,
      showModal
      showModal,
      showError,
      showInfo
   } from "@/comm/utils.js"
   import {
      getAllScene,
      mtBattery,
      getAgvState,
      checkIpLinkSuccess,
@@ -279,13 +282,13 @@
               }
            } catch (ex) {
               this.showError(ex)
               showError(ex)
            }
         },
         async loadVehicleBattery() {
            try {
               const list = this.pageList
               if (this.currentPage < list.length && this.currentPage > -1) {
                  const page = list[this.currentPage]
@@ -303,7 +306,7 @@
               this.pageList = [...list]
            } catch (ex) {
               this.showError(ex)
               showError(ex)
            }
         },
@@ -408,7 +411,7 @@
                  }
               }
            } catch (ex) {
               this.showError(ex)
               showError(ex)
            }
         },
         async checkConnectSuccess(ip) {
@@ -459,12 +462,7 @@
            this.inputPopupValue = ""
            this.$refs.refPopupInput.open()
         },
         clickToTask(index, page) {
            showToast("该功能还在开发中")
            // uni.navigateTo({
            //    url: `/pages/task/index?ip=${page.ip}`
            // })
         },
         clickMore() {
            if (this.currentPage < this.pageList.length) {
               this.$refs.refPopupMenu.open("top")
@@ -504,19 +502,48 @@
               }
            })
         },
         async clickToMap(index, page) {
            try {
         clickToMap(index, page) {
            const _this = this
               const _this = this
               // const res = await getAllScene(page.ip) || []
               // const list = res?.sceneList || []
               // if (list.length === 0) {
               //    uni.navigateTo({
               //       url: `/pages/scene/index?ip=${page.ip}`,
               //       events: {
               //          // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
               //          finish: function() {
               //             _this.clickToMap(index, page)
               //          },
               //       }
               //    })
               //    return
               // }
               // getApp().globalData.sceneList = list
               uni.navigateTo({
                  url: `/pages/map/index?ip=${page.ip}`,
                  events: {
                     // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
                     check_connect: function(flag) {
                        page.link_status = flag
                        console.log(flag)
                        _this.checkPageConnected(index)
                     },
                  }
               })
            } catch (ex) {
               showError(ex)
            }
         },
          clickToTask( page) {
            uni.navigateTo({
               url: `/pages/map/index?ip=${page.ip}`,
               events: {
                  // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
                  check_connect: function(flag) {
                     page.link_status = flag
                     _this.checkPageConnected(index)
                  },
               }
               url: `/pages/task/log-list?ip=${page.ip}`
            })
         },
         isValidIP(ip) {
            // IPv4 地址正则表达式
@@ -569,7 +596,7 @@
            } else if (item.text == "删除") {
               const page = this.pageList[this.currentPage]
               showModal(`确定要删除设备“${ page.name}”吗`, "警告").then((res) => {
               showModal(`确定要删除设备“${ page.name}”吗`, "警告", true, "确定", "取消").then((res) => {
                  if (res) {
                     const list = this.pageList
                     const curPage = this.currentPage
@@ -586,14 +613,13 @@
                  }
               })
            } else if (item.text == "备份") {
               const page = this.pageList[this.currentPage]
               uni.navigateTo({
                  url: `/pages/index/backup?ip=${page.ip}`
               })
            }
         },
         showError(ex) {
            let exStr = JSON.stringify(ex)
            if (exStr == "{}")
               exStr = ex
            let tip = typeof ex.msg == "string" ? ex.msg : exStr
            showModal(tip, "错误", false)
         },
         closeMenu() {
            this.$refs.refPopupMenu.close()
@@ -767,10 +793,10 @@
      .vehicle-img {
         margin-top: 20rpx;
         margin-left: calc(50% - 280rpx);
         margin-left: calc(50% - 325rpx);
         display: block;
         width: 560rpx;
         height: 560rpx;
         width: 650rpx;
         height: 692rpx;
      }