소스 검색

虚拟硬件

qinzhipeng_v 5 년 전
부모
커밋
a040f275d2

+ 7 - 7
src/api/HMvehicle.js

@@ -1,10 +1,10 @@
 import request from '@/utils/request'
-import { HMvehicleUrl } from '@/apiConfig/api'
+import { vehicleUrl_stable } from '@/apiConfig/api'
 
 // 创建设备/激活设备
 export function createHmVirtualDevice(data) {
   return request({
-    url: HMvehicleUrl + '/virtual-devices/ebike/createDevice',
+    url: vehicleUrl_stable + '/virtual-devices/ebike/createDevice',
     method: 'post',
     data
   })
@@ -13,7 +13,7 @@ export function createHmVirtualDevice(data) {
 // 激活设备
 export function activeHmVirtualDevice(params) {
   return request({
-    url: HMvehicleUrl + '/virtual-devices/ebike/activeDevice',
+    url: vehicleUrl_stable + '/virtual-devices/ebike/activeDevice',
     method: 'get',
     params
   })
@@ -22,7 +22,7 @@ export function activeHmVirtualDevice(params) {
 // 查询设备信息
 export function queryDeviceInfo(data) {
   return request({
-    url: HMvehicleUrl + '/virtual-devices/ebike/queryDeviceInfo',
+    url: vehicleUrl_stable + '/virtual-devices/ebike/queryDeviceInfo',
     method: 'post',
     data
   })
@@ -31,7 +31,7 @@ export function queryDeviceInfo(data) {
 // 删除设备
 export function delHmVirtualDevice(params) {
   return request({
-    url: HMvehicleUrl + '/virtual-devices/ebike/delDevice',
+    url: vehicleUrl_stable + '/virtual-devices/ebike/delDevice',
     method: 'get',
     params
   })
@@ -40,7 +40,7 @@ export function delHmVirtualDevice(params) {
 // 下线设备
 export function offHmvirtualDevice(params) {
   return request({
-    url: HMvehicleUrl + '/virtual-devices/ebike/offDevice',
+    url: vehicleUrl_stable + '/virtual-devices/ebike/offDevice',
     method: 'get',
     params
   })
@@ -49,7 +49,7 @@ export function offHmvirtualDevice(params) {
 // 更新锁状态
 export function updateLockStatus(params) {
   return request({
-    url: HMvehicleUrl + '/virtual-devices/ebike/updateLockStatus',
+    url: vehicleUrl_stable + '/virtual-devices/ebike/updateLockStatus',
     method: 'get',
     params
   })

+ 56 - 0
src/api/HMvehicle_online.js

@@ -0,0 +1,56 @@
+import request from '@/utils/request'
+import { vehicleUrl_online } from '@/apiConfig/api'
+
+// 创建设备/激活设备
+export function createHmVirtualDevice2(data) {
+  return request({
+    url: vehicleUrl_online + '/virtual-devices/ebike/createDevice',
+    method: 'post',
+    data
+  })
+}
+
+// 激活设备
+export function activeHmVirtualDevice2(params) {
+  return request({
+    url: vehicleUrl_online + '/virtual-devices/ebike/activeDevice',
+    method: 'get',
+    params
+  })
+}
+
+// 查询设备信息
+export function queryDeviceInfo2(data) {
+  return request({
+    url: vehicleUrl_online + '/virtual-devices/ebike/queryDeviceInfo',
+    method: 'post',
+    data
+  })
+}
+
+// 删除设备
+export function delHmVirtualDevice2(params) {
+  return request({
+    url: vehicleUrl_online + '/virtual-devices/ebike/delDevice',
+    method: 'get',
+    params
+  })
+}
+
+// 下线设备
+export function offHmvirtualDevice2(params) {
+  return request({
+    url: vehicleUrl_online + '/virtual-devices/ebike/offDevice',
+    method: 'get',
+    params
+  })
+}
+
+// 更新锁状态
+export function updateLockStatus2(params) {
+  return request({
+    url: vehicleUrl_online + '/virtual-devices/ebike/updateLockStatus',
+    method: 'get',
+    params
+  })
+}

+ 56 - 0
src/api/HMvehicle_preonline.js

@@ -0,0 +1,56 @@
+import request from '@/utils/request'
+import { vehicleUrl_preonline } from '@/apiConfig/api'
+
+// 创建设备/激活设备
+export function createHmVirtualDevice1(data) {
+  return request({
+    url: vehicleUrl_preonline + '/virtual-devices/ebike/createDevice',
+    method: 'post',
+    data
+  })
+}
+
+// 激活设备
+export function activeHmVirtualDevice1(params) {
+  return request({
+    url: vehicleUrl_preonline + '/virtual-devices/ebike/activeDevice',
+    method: 'get',
+    params
+  })
+}
+
+// 查询设备信息
+export function queryDeviceInfo1(data) {
+  return request({
+    url: vehicleUrl_preonline + '/virtual-devices/ebike/queryDeviceInfo',
+    method: 'post',
+    data
+  })
+}
+
+// 删除设备
+export function delHmVirtualDevice1(params) {
+  return request({
+    url: vehicleUrl_preonline + '/virtual-devices/ebike/delDevice',
+    method: 'get',
+    params
+  })
+}
+
+// 下线设备
+export function offHmvirtualDevice1(params) {
+  return request({
+    url: vehicleUrl_preonline + '/virtual-devices/ebike/offDevice',
+    method: 'get',
+    params
+  })
+}
+
+// 更新锁状态
+export function updateLockStatus1(params) {
+  return request({
+    url: vehicleUrl_preonline + '/virtual-devices/ebike/updateLockStatus',
+    method: 'get',
+    params
+  })
+}

+ 12 - 12
src/api/htVehicle.js

@@ -1,11 +1,11 @@
 import request from '@/utils/request'
-import { mockUrl } from '@/apiConfig/virtualDevices'
+import { vehicleUrl_stable } from '@/apiConfig/api'
 // ================================== Rule ======================================
 
 // 获取锁类型、锁供应商类型
 export function queryLockCreateInfo() {
   return request({
-    url: mockUrl + '/htw/queryLockCreateInfo',
+    url: vehicleUrl_stable + '/virtual-devices/htw/queryLockCreateInfo',
     method: 'get'
   })
 }
@@ -22,7 +22,7 @@ export function queryLockCreateInfo() {
 // 获取车类型、车辆供应商类型
 export function queryVehicleCreateInfo(data) {
   return request({
-    url: mockUrl + '/htw/queryVehicleCreateInfo?lockModel=' + data,
+    url: vehicleUrl_stable + '/virtual-devices/htw/queryVehicleCreateInfo?lockModel=' + data,
     method: 'get',
     data
   })
@@ -31,7 +31,7 @@ export function queryVehicleCreateInfo(data) {
 // 新建设备
 export function createDevice(data) {
   return request({
-    url: mockUrl + '/htw/createDevice',
+    url: vehicleUrl_stable + '/virtual-devices/htw/createDevice',
     method: 'post',
     data
   })
@@ -40,7 +40,7 @@ export function createDevice(data) {
 // 删除设备
 export function deleteDevice(data) {
   return request({
-    url: mockUrl + `/htw/deleteDevice?vehicleId=` + data,
+    url: vehicleUrl_stable + `/virtual-devices/htw/deleteDevice?vehicleId=` + data,
     method: 'get',
     data
   })
@@ -49,7 +49,7 @@ export function deleteDevice(data) {
 // 设备上线开关
 export function deviceOnline(data) {
   return request({
-    url: mockUrl + '/htw/deviceOnline?lockNo=' + data,
+    url: vehicleUrl_stable + '/virtual-devices/htw/deviceOnline?lockNo=' + data,
     method: 'get',
     data
   })
@@ -58,7 +58,7 @@ export function deviceOnline(data) {
 // 设备下线开关
 export function deviceOffline(data) {
   return request({
-    url: mockUrl + '/htw/deviceOffline?ecuId=' + data,
+    url: vehicleUrl_stable + '/virtual-devices/htw/deviceOffline?ecuId=' + data,
     method: 'get',
     data
   })
@@ -67,7 +67,7 @@ export function deviceOffline(data) {
 // 设备开锁
 export function unlockVehicle(data) {
   return request({
-    url: mockUrl + '/htw/device/opt/unlockVehicle?lockNo=' + data,
+    url: vehicleUrl_stable + '/virtual-devices/htw/device/opt/unlockVehicle?lockNo=' + data,
     method: 'get',
     data
   })
@@ -76,7 +76,7 @@ export function unlockVehicle(data) {
 // 设备关锁
 export function lockVehicle(data) {
   return request({
-    url: mockUrl + '/htw/lockVehicle?lockNo=' + data,
+    url: vehicleUrl_stable + '/virtual-devices/htw/lockVehicle?lockNo=' + data,
     method: 'get',
     data
   })
@@ -85,7 +85,7 @@ export function lockVehicle(data) {
 // 编辑
 export function updateLockAttr(data) {
   return request({
-    url: mockUrl + '/htw/updateLockAttr',
+    url: vehicleUrl_stable + '/virtual-devices/htw/updateLockAttr',
     method: 'post',
     data
   })
@@ -94,7 +94,7 @@ export function updateLockAttr(data) {
 // 查询用户设备详情(首页刚进来)
 export function getDevices(data) {
   return request({
-    url: mockUrl + '/htw/getDevices',
+    url: vehicleUrl_stable + '/virtual-devices/htw/getDevices',
     method: 'post',
     data
   })
@@ -103,7 +103,7 @@ export function getDevices(data) {
 // 查询设备属性
 export function getLockAttrInfo(data) {
   return request({
-    url: mockUrl + '/htw/user/device/getLockAttrInfo',
+    url: vehicleUrl_stable + '/virtual-devices/htw/user/device/getLockAttrInfo',
     method: 'post',
     data
   })

+ 110 - 0
src/api/htVehicle_online.js

@@ -0,0 +1,110 @@
+import request from '@/utils/request'
+import { vehicleUrl_online } from '@/apiConfig/api'
+// ================================== Rule ======================================
+
+// 获取锁类型、锁供应商类型
+export function queryLockCreateInfo2() {
+  return request({
+    url: vehicleUrl_online + '/virtual-devices/htw/queryLockCreateInfo',
+    method: 'get'
+  })
+}
+
+// 查看详情
+// export function queryVehicleCreateInfo(params) {
+//   return request({
+//     url: mockUrl + `/htw/device/queryVehicleCreateInfo?lockModel=` + params,
+//     method: 'get',
+//     params
+//   })
+// }
+
+// 获取车类型、车辆供应商类型
+export function queryVehicleCreateInfo2(data) {
+  return request({
+    url: vehicleUrl_online + '/virtual-devices/htw/queryVehicleCreateInfo?lockModel=' + data,
+    method: 'get',
+    data
+  })
+}
+
+// 新建设备
+export function createDevice2(data) {
+  return request({
+    url: vehicleUrl_online + '/virtual-devices/htw/createDevice',
+    method: 'post',
+    data
+  })
+}
+
+// 删除设备
+export function deleteDevice2(data) {
+  return request({
+    url: vehicleUrl_online + `/virtual-devices/htw/deleteDevice?vehicleId=` + data,
+    method: 'get',
+    data
+  })
+}
+
+// 设备上线开关
+export function deviceOnline2(data) {
+  return request({
+    url: vehicleUrl_online + '/virtual-devices/htw/deviceOnline?lockNo=' + data,
+    method: 'get',
+    data
+  })
+}
+
+// 设备下线开关
+export function deviceOffline2(data) {
+  return request({
+    url: vehicleUrl_online + '/virtual-devices/htw/deviceOffline?ecuId=' + data,
+    method: 'get',
+    data
+  })
+}
+
+// 设备开锁
+export function unlockVehicle2(data) {
+  return request({
+    url: vehicleUrl_online + '/virtual-devices/htw/device/opt/unlockVehicle?lockNo=' + data,
+    method: 'get',
+    data
+  })
+}
+
+// 设备关锁
+export function lockVehicle2(data) {
+  return request({
+    url: vehicleUrl_online + '/virtual-devices/htw/lockVehicle?lockNo=' + data,
+    method: 'get',
+    data
+  })
+}
+
+// 编辑
+export function updateLockAttr2(data) {
+  return request({
+    url: vehicleUrl_online + '/virtual-devices/htw/updateLockAttr',
+    method: 'post',
+    data
+  })
+}
+
+// 查询用户设备详情(首页刚进来)
+export function getDevices2(data) {
+  return request({
+    url: vehicleUrl_online + '/virtual-devices/htw/getDevices',
+    method: 'post',
+    data
+  })
+}
+
+// 查询设备属性
+export function getLockAttrInfo2(data) {
+  return request({
+    url: vehicleUrl_online + '/virtual-devices/htw/user/device/getLockAttrInfo',
+    method: 'post',
+    data
+  })
+}

+ 110 - 0
src/api/htVehicle_preonline.js

@@ -0,0 +1,110 @@
+import request from '@/utils/request'
+import { vehicleUrl_preonline } from '@/apiConfig/api'
+// ================================== Rule ======================================
+
+// 获取锁类型、锁供应商类型
+export function queryLockCreateInfo1() {
+  return request({
+    url: vehicleUrl_preonline + '/virtual-devices/htw/queryLockCreateInfo',
+    method: 'get'
+  })
+}
+
+// 查看详情
+// export function queryVehicleCreateInfo(params) {
+//   return request({
+//     url: mockUrl + `/htw/device/queryVehicleCreateInfo?lockModel=` + params,
+//     method: 'get',
+//     params
+//   })
+// }
+
+// 获取车类型、车辆供应商类型
+export function queryVehicleCreateInfo1(data) {
+  return request({
+    url: vehicleUrl_preonline + '/virtual-devices/htw/queryVehicleCreateInfo?lockModel=' + data,
+    method: 'get',
+    data
+  })
+}
+
+// 新建设备
+export function createDevice1(data) {
+  return request({
+    url: vehicleUrl_preonline + '/virtual-devices/htw/createDevice',
+    method: 'post',
+    data
+  })
+}
+
+// 删除设备
+export function deleteDevice1(data) {
+  return request({
+    url: vehicleUrl_preonline + `/virtual-devices/htw/deleteDevice?vehicleId=` + data,
+    method: 'get',
+    data
+  })
+}
+
+// 设备上线开关
+export function deviceOnline1(data) {
+  return request({
+    url: vehicleUrl_preonline + '/virtual-devices/htw/deviceOnline?lockNo=' + data,
+    method: 'get',
+    data
+  })
+}
+
+// 设备下线开关
+export function deviceOffline1(data) {
+  return request({
+    url: vehicleUrl_preonline + '/virtual-devices/htw/deviceOffline?ecuId=' + data,
+    method: 'get',
+    data
+  })
+}
+
+// 设备开锁
+export function unlockVehicle1(data) {
+  return request({
+    url: vehicleUrl_preonline + '/virtual-devices/htw/device/opt/unlockVehicle?lockNo=' + data,
+    method: 'get',
+    data
+  })
+}
+
+// 设备关锁
+export function lockVehicle1(data) {
+  return request({
+    url: vehicleUrl_preonline + '/virtual-devices/htw/lockVehicle?lockNo=' + data,
+    method: 'get',
+    data
+  })
+}
+
+// 编辑
+export function updateLockAttr1(data) {
+  return request({
+    url: vehicleUrl_preonline + '/virtual-devices/htw/updateLockAttr',
+    method: 'post',
+    data
+  })
+}
+
+// 查询用户设备详情(首页刚进来)
+export function getDevices1(data) {
+  return request({
+    url: vehicleUrl_preonline + '/virtual-devices/htw/getDevices',
+    method: 'post',
+    data
+  })
+}
+
+// 查询设备属性
+export function getLockAttrInfo1(data) {
+  return request({
+    url: vehicleUrl_preonline + '/virtual-devices/htw/user/device/getLockAttrInfo',
+    method: 'post',
+    data
+  })
+}

+ 0 - 2
src/api/httprule.js

@@ -1,8 +1,6 @@
 import request from '@/utils/request'
 import { mockUrl } from '@/apiConfig/mock'
 // ================================== Rule ======================================
-// const mockUrl = 'http://mock.Intra.xiaojukeji.com'
-// const mockUrl = 'http://10.179.88.110:8089'
 
 export function fetchRuleById(data) {
   return request({

+ 8 - 1
src/apiConfig/api.js

@@ -6,8 +6,15 @@ export const mockUrl = 'http://10.179.24.123:8980' // 线上
 
 export const qualityUrl = 'http://10.179.181.103:8898' // 质量度量
 
+//虚拟硬件线下环境
+export const vehicleUrl_stable = 'http://10.179.181.103:9999' // 虚拟硬件 zhihui
+  //虚拟硬件预发环境
+export const vehicleUrl_preonline = 'http://10.179.53.173:9999' // 虚拟硬件 zhihui
+  //虚拟硬件线上环境
+export const vehicleUrl_online = 'http://10.179.91.236:9999' // 虚拟硬件 zhihui
+
 // export const HMvehicleUrl = 'http://10.96.113.197:9999' // 电单车 线下
-export const HMvehicleUrl = 'http://10.179.181.103:9999' // 电单车 线上
+// export const HMvehicleUrl = 'http://10.179.181.103:9999' // 电单车 线上
 
 // -----------------------------------------2.0-----------------------------------------------
 

+ 1 - 1
src/views/Platform/presentation/Templates/TestReport.vue

@@ -217,7 +217,7 @@ export default {
         var targetDom = document.getElementById('resumeId')
         var copyDom = targetDom.cloneNode(true)
         document.querySelector('body').appendChild(copyDom)
-        html2canvas(copyDom, { useCORS: true }).then(canvas => {
+        html2canvas(targetDom, { useCORS: true }).then(canvas => {
           var imgData = canvas.toDataURL('image/png')
           var sendImgData = imgData.substring(imgData.indexOf(',') + 1)
           var postData = { 'reportId': ele.id, 'imgStr': sendImgData, 'url': window.location.href, 'emailUser': e.name, 'copyTo': e.names }

+ 1 - 1
src/views/Platform/presentation/testPresentation.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="eleStyle">
     <div class="header_sty">
-      <el-tabs v-model="activeName" style="margin: 2%; min-height: 80vh; font-size: 14px;" @tab-click="handleClick">
+      <el-tabs v-model="activeName" style="margin: 2%; min-height: 84vh; font-size: 14px;" @tab-click="handleClick">
         <el-tab-pane label="日报报告" name="first">
           <div style="margin: 30px 0;">搜索
             <el-input v-model="state" size="medium" filterable placeholder="搜索" style="width:20%;margin: 0 10px;" @change="getList(state)" />

+ 275 - 15
src/views/virtualDevices/HMvehicle.vue

@@ -2,6 +2,11 @@
   <div style="width: 100%;">
     <div class="set-background">
       <div class="block">
+        <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
+          <el-tab-pane label="线下环境" name="stable" />
+          <el-tab-pane label="预发环境" name="preOnline" />
+          <el-tab-pane label="线上环境" name="online" />
+        </el-tabs>
         <el-form :model="queryCode">
           <div class="set-between">
             <el-input v-model="queryCode.vehicleId" size="medium" placeholder="车辆ID" clearable style="width:13%;margin-right: 15px;" />
@@ -23,9 +28,9 @@
             </el-select>
           </div>
           <div class="set-between">
-            <el-button type="primary" size="medium" @click="dataQuery(queryCode)">搜索</el-button>
-            <el-button type="primary" size="medium" @click="createdCode()">新增</el-button>
-            <el-button type="primary" size="medium" @click="oneKeyCreate()">一键创建</el-button>
+            <el-button type="primary" size="medium" @click="queryDataByEvn(queryCode)">搜索</el-button>
+            <el-button v-if="isStable" type="primary" size="medium" @click="createdCode()">新增</el-button>
+            <!-- <el-button type="primary" size="medium" @click="oneKeyCreate()">一键创建</el-button> -->
           </div>
         </el-form>
         <div class="set-locate">
@@ -51,6 +56,11 @@
               label="ECUID"
               align="center"
             />
+            <el-table-column label="二维码" align="center" min-width="40px" class-name="small-padding fixed-width">
+              <template slot-scope="{row}">
+                <a href="javascript:void(0)" style="color:#20a0ff" @click="checkUrl(row)">查看</a>
+              </template>
+            </el-table-column>
             <el-table-column
               prop="vehicleVersion"
               label="车辆类型"
@@ -96,16 +106,16 @@
             <el-table-column
               label="操作"
               align="center"
-              width="350"
+              width="200"
             >
               <template slot-scope="scope">
                 <div class="specail-lock">
-                  <div :class="{ 'el-icon-lock': scope.row.lockStatus === 0 ,'el-icon-unlock': scope.row.lockStatus === 1}" @click="updateLock(scope.row.ecuId, scope.row.lockStatus, scope.row.isActive)" />
+                  <div :class="{ 'el-icon-lock': scope.row.lockStatus === 0 ,'el-icon-unlock': scope.row.lockStatus === 1}" @click="updateLockByEvn(scope.row.ecuId, scope.row.lockStatus, scope.row.isActive)" />
                   <div>
-                    <el-button size="mini" :type="scope.row.isActive === 1 ? 'info' : 'success'" plain @click="activateOrOffHmvirtual(scope.row, scope.row.isActive)">{{ scope.row.isActive === 1 ? '下线' : '激活' }}</el-button>
+                    <el-button size="mini" :type="scope.row.isActive === 1 ? 'info' : 'success'" plain @click="activateOrOffHmvirtualByEvn(scope.row, scope.row.isActive)">{{ scope.row.isActive === 1 ? '下线' : '激活' }}</el-button>
                     <!-- <el-button size="mini" type="info" plain @click="offHmvirtual(scope.row.ecuId)">下线</el-button> -->
-                    <el-button size="mini" type="danger" @click="dialogBug(scope.row.ecuId)">删除</el-button>
-                    <el-button size="mini" type="primary">....</el-button>
+                    <el-button v-if="isStableDel" size="mini" type="danger" @click="dialogBug(scope.row.ecuId)">删除</el-button>
+                    <!-- <el-button size="mini" type="primary">....</el-button> -->
                     <el-dialog
                       :visible.sync="dialogVisible"
                       width="30%"
@@ -121,6 +131,14 @@
               </template>
             </el-table-column>
           </el-table>
+
+          <el-dialog v-if="date2" :title="textMap[dialogStatus]" :visible.sync="dialogForUrl" width="400px" :center="true" :destroy-on-close="true" @close="dle_Data">
+            <div ref="qrcodeContainer" class="qrcode" style="margin-left:13%;margin-top:-3%" />
+            <div style="font-size:16px;margin-left:32%;margin-top:5%;height:25px">
+              车辆ID:{{ urlData.vehicleId }}
+            </div>
+
+          </el-dialog>
           <el-dialog
             title="设备详情"
             :visible.sync="dialogVisibleDetail"
@@ -184,7 +202,9 @@
 <script>
 import { cityJson } from '@/views/virtualDevices/city'
 import { createHmVirtualDevice, queryDeviceInfo, delHmVirtualDevice, offHmvirtualDevice, updateLockStatus, activeHmVirtualDevice } from '@/api/HMvehicle'
-
+import { queryDeviceInfo1, offHmvirtualDevice1, updateLockStatus1, activeHmVirtualDevice1 } from '@/api/HMvehicle_preonline'
+import { queryDeviceInfo2, offHmvirtualDevice2, updateLockStatus2, activeHmVirtualDevice2 } from '@/api/HMvehicle_online'
+import QRCode from 'qrcodejs2'
 export default {
   filters: {
     toLockStatus(e) {
@@ -202,7 +222,16 @@ export default {
   data() {
     return {
       dialogVisibleDetail: false,
+      date2: false,
+      dialogForUrl: false,
       tableData: [],
+      textMap: {
+        // update: '编辑',
+        // create: '新增',
+        // details: '设备详情',
+        url: '查看二维码'
+      },
+      urlData: '',
       vehicleSelect: [
         {
           code: 0,
@@ -272,7 +301,10 @@ export default {
       pauseId: '',
       city: cityJson,
       value: '',
+      isStable: true,
+      isStableDel: true,
       dialogVisible: false,
+      activeName: 'stable',
       lockOptions: [
         {
           name: '未开启',
@@ -302,6 +334,7 @@ export default {
     document.getElementsByClassName('app-main')[0].style.cssText = 'overflow:auto'
   },
   methods: {
+    // 列表页-stable
     _queryDeviceInfo() {
       const params = { page: this.curIndex, pageSize: this.pageSize }
       queryDeviceInfo(params).then(res => {
@@ -310,6 +343,35 @@ export default {
         this.loading = false
       })
     },
+    // 列表页-pre
+    _queryDeviceInfo1() {
+      const params = { page: this.curIndex, pageSize: this.pageSize }
+      queryDeviceInfo1(params).then(res => {
+        res.code === 200 ? this.tableData = res.data.ebikeInfos : this.$message.error(res.msg)
+        this.total = res.data.total
+        this.loading = false
+      })
+    },
+    // 列表页-online
+    _queryDeviceInfo2() {
+      const params = { page: this.curIndex, pageSize: this.pageSize }
+      queryDeviceInfo2(params).then(res => {
+        res.code === 200 ? this.tableData = res.data.ebikeInfos : this.$message.error(res.msg)
+        this.total = res.data.total
+        this.loading = false
+      })
+    },
+    // 根据环境搜索
+    queryDataByEvn(ele) {
+      if (this.activeName === 'preOnline') {
+        return this.dataQuery1(ele)
+      } else if (this.activeName === 'online') {
+        return this.dataQuery2(ele)
+      } else {
+        return this.dataQuery(ele)
+      }
+    },
+    // 搜索-stable
     dataQuery(queryCode) {
       queryCode.page = 1
       this.curIndex = 1
@@ -324,6 +386,37 @@ export default {
         this.total = res.data.total
       })
     },
+    // 搜索-pre
+    dataQuery1(queryCode) {
+      queryCode.page = 1
+      this.curIndex = 1
+      queryCode.pageSize = this.pageSize
+      for (const key in queryCode) { // 接口不接受空值的处理
+        if (queryCode[key] === '') {
+          delete queryCode[key]
+        }
+      }
+      queryDeviceInfo1(queryCode).then(res => {
+        res.code === 200 ? this.tableData = res.data.ebikeInfos : this.$message.error(res.msg)
+        this.total = res.data.total
+      })
+    },
+    // 搜索-online
+    dataQuery2(queryCode) {
+      queryCode.page = 1
+      this.curIndex = 1
+      queryCode.pageSize = this.pageSize
+      for (const key in queryCode) { // 接口不接受空值的处理
+        if (queryCode[key] === '') {
+          delete queryCode[key]
+        }
+      }
+      queryDeviceInfo2(queryCode).then(res => {
+        res.code === 200 ? this.tableData = res.data.ebikeInfos : this.$message.error(res.msg)
+        this.total = res.data.total
+      })
+    },
+
     dataIndexChoose(queryCode) {
       queryCode.page = this.curIndex
       queryCode.pageSize = this.pageSize
@@ -357,6 +450,28 @@ export default {
         }
       })
     },
+    // 查看二维码
+    checkUrl(ele) {
+      this.date2 = true
+      this.dialogForUrl = true
+      this.dialogStatus = 'url'
+      this.urlData = ele
+      this.$nextTick(() => {
+        new QRCode(this.$refs.qrcodeContainer, {
+          text: this.urlData.qrCode,
+          with: 100,
+          height: 250,
+          colorDark: '#000000',
+          colorLight: '#ffffff',
+          correctLevel: QRCode.CorrectLevel.H
+        })
+        console.log(this.urlData.qrCode)
+      })
+    },
+
+    dle_Data() {
+      this.date2 = false
+    },
     createdCode() {
       this.$router.push({ name: '新增电单车', params: { formData: this.form }, query: { id: this.form.id }})
     },
@@ -364,6 +479,17 @@ export default {
       this.curIndex = curIndex
       this.dataIndexChoose(this.queryCode)
     },
+    // 根据环境来调开关锁
+    updateLockByEvn(ecuId, lockStatus, judge) {
+      if (this.activeName === 'preOnline') {
+        return this.updateLock1(ecuId, lockStatus, judge)
+      } else if (this.activeName === 'online') {
+        return this.updateLock2(ecuId, lockStatus, judge)
+      } else {
+        return this.updateLock(ecuId, lockStatus, judge)
+      }
+    },
+    // 开关锁-stable
     updateLock(ecuId, lockStatus, judge) {
       if (judge !== 1) {
         this.$message({
@@ -385,6 +511,62 @@ export default {
         }
       })
     },
+
+    // 开关锁-pre
+    updateLock1(ecuId, lockStatus, judge) {
+      if (judge !== 1) {
+        this.$message({
+          message: '请先激活设备',
+          type: 'warning'
+        })
+        return
+      }
+      const params = { ecuId: ecuId, lockStatus: (lockStatus + 1) % 2 }
+      updateLockStatus1(params).then(res => {
+        this._queryDeviceInfo1()
+        if (res.code === 200) {
+          this.$message({
+            message: `${lockStatus === 1 ? '关锁' : '开锁'}成功`,
+            type: 'success'
+          })
+        } else {
+          this.$message.error(res.msg)
+        }
+      })
+    },
+    // 开关锁-online
+    updateLock2(ecuId, lockStatus, judge) {
+      if (judge !== 1) {
+        this.$message({
+          message: '请先激活设备',
+          type: 'warning'
+        })
+        return
+      }
+      const params = { ecuId: ecuId, lockStatus: (lockStatus + 1) % 2 }
+      updateLockStatus2(params).then(res => {
+        this._queryDeviceInfo2()
+        if (res.code === 200) {
+          this.$message({
+            message: `${lockStatus === 1 ? '关锁' : '开锁'}成功`,
+            type: 'success'
+          })
+        } else {
+          this.$message.error(res.msg)
+        }
+      })
+    },
+    // 根据环境来激活设备
+    activateOrOffHmvirtualByEvn(scope, activatStatus) {
+      if (this.activeName === 'preOnline') {
+        return this.activateOrOffHmvirtual1(scope, activatStatus)
+      } else if (this.activeName === 'online') {
+        return this.activateOrOffHmvirtual2(scope, activatStatus)
+      } else {
+        return this.activateOrOffHmvirtual(scope, activatStatus)
+      }
+    },
+    // 激活设备-stable
     activateOrOffHmvirtual(scope, activatStatus) {
       const params = { ecuId: scope.ecuId }
       if (activatStatus === 1) {
@@ -416,6 +598,71 @@ export default {
         })
       }
     },
+    // 激活设备-pre
+    activateOrOffHmvirtual1(scope, activatStatus) {
+      const params = { ecuId: scope.ecuId }
+      if (activatStatus === 1) {
+        offHmvirtualDevice1(params).then(res => {
+          if (res.code === 200) {
+            this._queryDeviceInfo1()
+            this.$message({
+              message: `车辆ID ${scope.vehicleId} 下线成功`,
+              type: 'success'
+            })
+          } else {
+            this.$message.error(res.msg)
+          }
+        })
+      } else {
+        activeHmVirtualDevice1(params).then(res => {
+          if (res.code === 200) {
+            this.loading = true
+            setTimeout(() => {
+              this._queryDeviceInfo1()
+              this.$message({
+                message: `车辆ID ${scope.vehicleId} 激活成功`,
+                type: 'success'
+              })
+            }, 1000)
+          } else {
+            this.$message.error(res.msg)
+          }
+        })
+      }
+    },
+    // 激活设备-online
+    activateOrOffHmvirtual2(scope, activatStatus) {
+      const params = { ecuId: scope.ecuId }
+      if (activatStatus === 1) {
+        offHmvirtualDevice2(params).then(res => {
+          if (res.code === 200) {
+            this._queryDeviceInfo2()
+            this.$message({
+              message: `车辆ID ${scope.vehicleId} 下线成功`,
+              type: 'success'
+            })
+          } else {
+            this.$message.error(res.msg)
+          }
+        })
+      } else {
+        activeHmVirtualDevice2(params).then(res => {
+          if (res.code === 200) {
+            this.loading = true
+            setTimeout(() => {
+              this._queryDeviceInfo2()
+              this.$message({
+                message: `车辆ID ${scope.vehicleId} 激活成功`,
+                type: 'success'
+              })
+            }, 1000)
+          } else {
+            this.$message.error(res.msg)
+          }
+        })
+      }
+    },
+
     // id Bug
     dialogBug(e) {
       this.dialogVisible = true
@@ -435,13 +682,26 @@ export default {
         }
       })
       this.dialogVisible = false
+    },
+    // 切换tab环境获取列表
+    handleClick(tab, event) {
+      this.activeName === tab
+      this.queryCode = {}
+      console.log(this.activeName)
+      if (this.activeName === 'preOnline') {
+        this.isStable = false
+        this.isStableDel = false
+        return this._queryDeviceInfo1()
+      } else if (this.activeName === 'online') {
+        this.isStable = false
+        this.isStableDel = false
+        return this._queryDeviceInfo2()
+      } else {
+        this.isStable = true
+        this.isStableDel = true
+        return this._queryDeviceInfo()
+      }
     }
-    // successFun(successText) {
-    //   this.$notify({ title: 'Success', message: `${successText} Successfully`, type: 'success', duration: 2000 })
-    // },
-    // errorFun(errorText) {
-    //   this.$notify({ title: 'Failed', message: errorText, type: 'error', duration: 2000 })
-    // }
   }
 }
 </script>

+ 22 - 37
src/views/virtualDevices/HMvehicleCreate.vue

@@ -1,31 +1,14 @@
 <template>
   <div class="set-background">
     <el-form ref="form" :model="form" hide-required-asterisk :rules="serviceDataRules">
+
       <div class="block">
-        <el-form-item label="Eculd" prop="ecuId" :label-width="formLabelWidth">
-          <el-input v-model="form.ecuId" style="width: 35%;" autocomplete="off" placeholder="硬件中控ID" />
-          <div class="tip"><p>13位数字 , 示例 : ECA0419070800454</p></div>
-        </el-form-item>
-        <el-form-item label="BatteryId" prop="batteryId" :label-width="formLabelWidth">
-          <el-input v-model="form.batteryId" style="width: 35%;" autocomplete="off" placeholder="电池ID" />
-          <div class="tip"><p>13位数字 , 示例 : BAA3218101509005</p></div>
-        </el-form-item>
-        <el-form-item label="VehicleId" prop="vehicleId" :label-width="formLabelWidth">
-          <el-input v-model="form.vehicleId" style="width: 35%;" autocomplete="off" placeholder="车辆ID" />
-          <div class="tip"><p>8位数字 , 示例 : 92264605</p></div>
-        </el-form-item>
-        <el-form-item label="Imei" prop="imei" :label-width="formLabelWidth">
-          <el-input v-model="form.imei" style="width: 35%;" autocomplete="off" placeholder="终端IMEI码" />
-          <div class="tip"><p>15位数字 , 示例 : 967047046635466</p></div>
-        </el-form-item>
-        <el-form-item label="Imsi" prop="imsi" :label-width="formLabelWidth">
-          <el-input v-model="form.imsi" style="width: 35%;" autocomplete="off" placeholder="终端IMSI码" />
-          <div class="tip"><p>15位数字 , 示例 : 960046550508466</p></div>
-        </el-form-item>
-      </div>
-      <div class="block">
+        <div style="color:red;font-weight:bold">
+          新增的电单车需要等待10min以上电量上报后才能正常使用,建议先使用已经存在的设备数据
+        </div>
+        <div style="margin-top:2%" />
         <el-form-item label="City" prop="cityName" :label-width="formLabelWidth">
-          <el-select v-model="form.cityName" style="width: 35%;" filterable clearable placeholder="请选择城市">
+          <el-select v-model="form.cityName" style="width: 35%" filterable clearable placeholder="请选择城市(选填)">
             <el-option
               v-for="item in city"
               :key="item.CityID"
@@ -33,32 +16,33 @@
               :value="item.name"
             />
           </el-select>
+          <div class="tip"><p>默认 : 杭州市, 若填写城市, 下面经纬度必填</p></div>
         </el-form-item>
         <el-form-item label="Lat" prop="lat" :label-width="formLabelWidth">
-          <el-input v-model="form.lat" style="width: 35%;" autocomplete="off" placeholder="纬度" />
-          <div class="tip"><p>保留15位小数 , 示例 : 30.290707717493753</p></div>
+          <el-input v-model="form.lat" style="width: 35%;" autocomplete="off" placeholder="纬度(选填)" />
+          <div class="tip"><p>默认 : 西溪谷纬度 30.290707717493753, 保留15位小数 </p></div>
         </el-form-item>
         <el-form-item label="Lng" prop="lng" :label-width="formLabelWidth">
-          <el-input v-model="form.lng" style="width: 35%;" autocomplete="off" placeholder="经度" />
-          <div class="tip"><p>保留15位小数 , 示例 : 120.07451533496764</p></div>
+          <el-input v-model="form.lng" style="width: 35%;" autocomplete="off" placeholder="经度(选填)" />
+          <div class="tip"><p>默认 : 西溪谷经度 120.07451533496764, 保留15位小数  </p></div>
         </el-form-item>
       </div>
       <div class="block">
-        <el-form-item label="VehicleVersion" :label-width="formLabelWidth">
-          <el-input v-model="form.vehicleVersion" style="width: 35%;" autocomplete="off" placeholder="整车版本" />
-          <div class="tip"><p>H1、H2等等,默认给H1</p></div>
-        </el-form-item>
+        <!-- <el-form-item label="VehicleVersion" :label-width="formLabelWidth">
+          <el-input v-model="form.vehicleVersion" style="width: 35%;" autocomplete="off" placeholder="整车版本(选填)" />
+          <div class="tip"><p>默认 : H1, H1、H2等等</p></div>
+        </el-form-item> -->
         <el-form-item label="VehicleStatus" :label-width="formLabelWidth">
-          <el-input v-model="form.vehicleStatus" style="width: 35%;" autocomplete="off" placeholder="车辆状态" />
-          <div class="tip"><p>默认给0,0-正常;1-故障;2-高危不可用;10-低危;11-高危可用</p></div>
+          <el-input v-model="form.vehicleStatus" style="width: 35%;" autocomplete="off" placeholder="车辆状态(选填)" />
+          <div class="tip"><p>默认 : 0, 0-正常;1-故障;2-高危不可用;10-低危;11-高危可用</p></div>
         </el-form-item>
         <el-form-item label="OperationStatus" :label-width="formLabelWidth">
-          <el-input v-model="form.operationStatus" style="width: 35%;" autocomplete="off" placeholder="运营状态" />
+          <el-input v-model="form.operationStatus" style="width: 35%;" autocomplete="off" placeholder="运营状态(选填)" />
           <el-tooltip effect="dark" content="默认给100,100:运营中; 200:待运营-出厂; 201:待运营-库存; 202:待运营-移库; 301:停运-调度中; 304:停运-没收; 306:停运-已返厂; 307:停运-在库; 400:退出运营-报废" placement="top">
-            <div class="tip"><p>默认给100,100:运营中; 200:待运营-出厂; 201:待运营-库存 ...</p></div>
+            <div class="tip"><p>默认 : 100, 100:运营中; 200:待运营-出厂; 201:待运营-库存 ...</p></div>
           </el-tooltip>
         </el-form-item>
-        <el-form-item class="submit">
+        <el-form-item class="submit" style="margin-top:10%">
           <el-button size="mini" type="primary" @click="createFormData(form)">确 认</el-button>
           <el-button size="mini" type="danger" @click="$router.go(-1)">取 消</el-button>
         </el-form-item>
@@ -191,7 +175,8 @@ export default {
     background-color #F2F3F6
     display flex
     justify-content center
-    min-width 700px
+    min-width 800px
+    min-height calc(100vh - 50px)
   .set-background >>> .el-form
     width 100%
     overflow auto

+ 291 - 18
src/views/virtualDevices/HTvehicle.vue

@@ -1,6 +1,11 @@
 <template>
   <div class="set-background">
     <div class="block">
+      <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
+        <el-tab-pane label="线下环境" name="stable" />
+        <el-tab-pane label="预发环境" name="preOnline" />
+        <el-tab-pane label="线上环境" name="online" />
+      </el-tabs>
       <el-form :model="listQuery">
         <div class="set-head">
           <el-input v-model="listQuery.vehicleId" size="medium" clearable placeholder="车辆ID" style="width:15%;" />
@@ -17,8 +22,8 @@
           </el-select>
         </div>
         <div class="set-between">
-          <el-button type="primary" size="medium" plain @click="getDevicesList(listQuery)">搜索</el-button>
-          <el-button type="primary" size="medium" plain @click="dialogFormVisible = true, createdCode()">新增</el-button>
+          <el-button type="primary" size="medium" plain @click="queryDataByEvn(listQuery)">搜索</el-button>
+          <el-button v-if="isStable" type="primary" size="medium" plain @click="dialogFormVisible = true, createdCode()">新增</el-button>
         </div>
       </el-form>
       <div class="set-locate">
@@ -60,15 +65,15 @@
           </el-table-column>
           <el-table-column label="关锁" align="center" min-width="60px" class-name="small-padding fixed-width">
             <template slot-scope="{row}">
-              <i v-if="row.lockStatus === 1 || row.lockStatus === 4" style="font-size: 20px;" class="el-icon-lock" @click="handleLockStatus(row, 0)" />
+              <i v-if="row.lockStatus === 1 || row.lockStatus === 4" style="font-size: 20px;" class="el-icon-lock" @click="unLockByEvn(row, 0)" />
             </template>
           </el-table-column>
-          <el-table-column label="操作" align="center" min-width="270px" class-name="small-padding fixed-width">
+          <el-table-column label="操作" align="center" min-width="250px" class-name="small-padding fixed-width">
             <template slot-scope="{row}">
-              <el-button v-if="row.isOnline === 0 || row.isOnline === 2 || row.isOnline === 3" plain size="mini" type="success" @click="handleDeviceStatus(row, 1)">激活</el-button>
-              <el-button v-if="row.isOnline==1" plain size="mini" type="info" @click="handleDeviceStatus(row, 0)">下线</el-button>
+              <el-button v-if="row.isOnline === 0 || row.isOnline === 2 || row.isOnline === 3" plain size="mini" type="success" @click="activateOrOffvirtualByEvn(row, 1)">激活</el-button>
+              <el-button v-if="row.isOnline==1" plain size="mini" type="info" @click="activateOrOffvirtualByEvn(row, 0)">下线</el-button>
               <el-button type="primary" plain size="mini" @click="handleUpdate(row)">编辑</el-button>
-              <el-button type="danger" size="mini" @click="deleteCodeData(row)">删除</el-button>
+              <el-button v-if="isStableDel" type="danger" size="mini" @click="deleteCodeData(row)">删除</el-button>
               <!-- <el-button v-if="row.lockStatus===1 || row.lockStatus ===4" size="mini" type="info" @click="handleLockStatus(row, 0)">关锁</el-button> -->
 
               <!-- el-icon-lock -->
@@ -81,8 +86,12 @@
     <!-- 查看二维码 -->
     <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogForUrl" width="400px" :center="true" :destroy-on-close="true" @close="closeDialog">
       <div v-if="data_close" ref="qrcodeContainer" class="qrcode" style="margin-left:13%;margin-top:-3%" />
-      <div style="font-size:16px;margin-left:32%;margin-top:5%;height:25px">
-        车辆ID:{{ urlData.vehicleId }}
+      <div style="font-size:16px;margin-left:32%;margin-top:5%;height:0px">
+        车辆ID: {{ urlData.vehicleId }}
+      </div>
+      <div style="font-size:16px;margin-left:20%;margin-top:3%;height:30px">
+        <br>
+        (手动输码请输)锁ID: {{ urlData.lockNo }}
       </div>
 
     </el-dialog>
@@ -224,7 +233,7 @@
       <br><br><br>
       <div slot="footer" class="dialog-footer">
         <el-button @click="dialogUpdateVisible = false">取消</el-button>
-        <el-button v-if="showSubmitBtn" type="primary" @click="updateData(serviceData)">确定</el-button>
+        <el-button v-if="showSubmitBtn" type="primary" @click="updateDataByEvn(serviceData)">确定</el-button>
       </div>
     </el-dialog>
 
@@ -233,6 +242,8 @@
 
 <script>
 import { queryLockCreateInfo, queryVehicleCreateInfo, createDevice, deleteDevice, deviceOnline, deviceOffline, unlockVehicle, lockVehicle, updateLockAttr, getDevices } from '@/api/htVehicle'
+import { deviceOnline1, deviceOffline1, unlockVehicle1, lockVehicle1, updateLockAttr1, getDevices1 } from '@/api/htVehicle_preonline'
+import { deviceOnline2, deviceOffline2, unlockVehicle2, lockVehicle2, updateLockAttr2, getDevices2 } from '@/api/htVehicle_online'
 import waves from '@/directive/waves' // waves directive
 import { parseTime } from '@/utils'
 import QRCode from 'qrcodejs2'
@@ -280,8 +291,9 @@ export default {
         url: '查看二维码'
       },
       urlData: '',
+      activeName: 'stable',
       statusMaps: new Map([[0, '离线'], [1, '连接成功'], [2, '连接失败'], [3, '连接中']]),
-      lockStatusMaps: new Map([[1, '已开锁'], [0, '已关锁'], [2, '开锁失败'], [3, '关锁成功'], [4, '关锁失败']]),
+      lockStatusMaps: new Map([[1, '已开锁'], [0, '已关锁'], [2, '开锁失败'], [3, '关锁成功'], [4, '关锁失败'], [5, '关锁中']]),
       statusOperateMaps: new Map([[1, '在线'], [0, '离线']]),
       options: [{ value: 1, label: '在线' }, { value: 0, label: '离线' }],
       bizType: [{ value: 1, label: '电单车' }, { value: 2, label: '单车' }],
@@ -291,6 +303,8 @@ export default {
       lockSupplierList: [],
       bikeModelList: [],
       bikeSupplierList: [],
+      isStable: true,
+      isStableDel: true,
       listQuery: {
         // lockModel: '',
         // isOnline: '',
@@ -364,6 +378,25 @@ export default {
     closeDialog() {
       this.data_close = false // 清空数据
     },
+    // 切换tab
+    handleClick(tab, event) {
+      this.activeName === tab
+      this.listQuery = {}
+      console.log(this.activeName)
+      if (this.activeName === 'preOnline') {
+        this.isStable = false
+        this.isStableDel = false
+        return this.getMyDevicesList1()
+      } else if (this.activeName === 'online') {
+        this.isStable = false
+        this.isStableDel = false
+        return this.getMyDevicesList2()
+      } else {
+        this.isStable = true
+        this.isStableDel = true
+        return this.getMyDevicesList()
+      }
+    },
 
     // 查看设备详情
     deviceDetails(vel) {
@@ -405,7 +438,7 @@ export default {
       })
     },
 
-    // 搜索
+    // 搜索-stable
     getDevicesList(vel) {
       this.listQuery = vel
       this.listQuery.pageSize = this.pageSize
@@ -416,7 +449,39 @@ export default {
         this.total = response.data.total
       })
     },
-    // 进首页
+    // 根据环境来搜索
+    queryDataByEvn(ele) {
+      if (this.activeName === 'preOnline') {
+        return this.getDevicesList1(ele)
+      } else if (this.activeName === 'online') {
+        return this.getDevicesList2(ele)
+      } else {
+        return this.getDevicesList(ele)
+      }
+    },
+    // 搜索-pre
+    getDevicesList1(vel) {
+      this.listQuery = vel
+      this.listQuery.pageSize = this.pageSize
+      this.listQuery.page = this.page
+
+      getDevices1(this.listQuery).then(response => {
+        this.list = response.data.bikeDeviceInfos
+        this.total = response.data.total
+      })
+    },
+    // 搜索-online
+    getDevicesList2(vel) {
+      this.listQuery = vel
+      this.listQuery.pageSize = this.pageSize
+      this.listQuery.page = this.page
+
+      getDevices2(this.listQuery).then(response => {
+        this.list = response.data.bikeDeviceInfos
+        this.total = response.data.total
+      })
+    },
+    // 进首页-stable
     getMyDevicesList() {
       this.listQuery.pageSize = this.pageSize
       this.listQuery.page = this.page
@@ -429,6 +494,42 @@ export default {
         console.log(this.list)
       })
     },
+    // 进首页-pre
+    getMyDevicesList1() {
+      this.listQuery.pageSize = this.pageSize
+      this.listQuery.page = this.page
+      getDevices1(this.listQuery).then(response => {
+        // this.list = response.data.bikeDeviceInfos.map(value => value.bikeDeviceAttrInfo)
+        this.list = response.data.bikeDeviceInfos
+        this.serviceData = response.data.bikeDeviceInfos
+        this.detailData = response.data.bikeDeviceInfos
+        this.total = response.data.total
+        console.log(this.list)
+      })
+    },
+    // 进首页-online
+    getMyDevicesList2() {
+      this.listQuery.pageSize = this.pageSize
+      this.listQuery.page = this.page
+      getDevices2(this.listQuery).then(response => {
+        // this.list = response.data.bikeDeviceInfos.map(value => value.bikeDeviceAttrInfo)
+        this.list = response.data.bikeDeviceInfos
+        this.serviceData = response.data.bikeDeviceInfos
+        this.detailData = response.data.bikeDeviceInfos
+        this.total = response.data.total
+        console.log(this.list)
+      })
+    },
+    // 根据环境来编辑
+    updateDataByEvn(ele) {
+      if (this.activeName === 'preOnline') {
+        return this.updateData1(ele)
+      } else if (this.activeName === 'online') {
+        return this.updateData2(ele)
+      } else {
+        return this.updateData(ele)
+      }
+    },
     // 编辑
     handleUpdate(vel) {
       console.log(vel)
@@ -437,6 +538,7 @@ export default {
       this.dialogUpdateVisible = true
       this.$refs.serviceDataForms.resetFields()
     },
+    // 编辑-stable
     updateData(vel) {
       this.bizData = {
         deviceId: vel.deviceId,
@@ -454,6 +556,42 @@ export default {
         }
       })
     },
+    // 编辑-pre
+    updateData1(vel) {
+      this.bizData = {
+        deviceId: vel.deviceId,
+        lockBatteryLevel: vel.lockBatteryLevel,
+        deviceLat: vel.deviceLat,
+        deviceLng: vel.deviceLng
+      }
+      updateLockAttr1(this.bizData).then(response => {
+        if (response.code === 200) {
+          this.getMyDevicesList1()
+          this.dialogUpdateVisible = false
+          this.$notify({ title: 'Success', message: response.msg, type: 'success', duration: 3000 })
+        } else {
+          this.$notify({ title: 'Failed', message: response.msg, type: 'error', duration: 3000 })
+        }
+      })
+    },
+    // 编辑-online
+    updateData2(vel) {
+      this.bizData = {
+        deviceId: vel.deviceId,
+        lockBatteryLevel: vel.lockBatteryLevel,
+        deviceLat: vel.deviceLat,
+        deviceLng: vel.deviceLng
+      }
+      updateLockAttr2(this.bizData).then(response => {
+        if (response.code === 200) {
+          this.getMyDevicesList2()
+          this.dialogUpdateVisible = false
+          this.$notify({ title: 'Success', message: response.msg, type: 'success', duration: 3000 })
+        } else {
+          this.$notify({ title: 'Failed', message: response.msg, type: 'error', duration: 3000 })
+        }
+      })
+    },
     // 删除设备
     explain() {
       if (this.showexplain === false) {
@@ -488,8 +626,18 @@ export default {
         }
       })
     },
+    // 根据环境上下线
+    activateOrOffvirtualByEvn(row, status) {
+      if (this.activeName === 'preOnline') {
+        return this.handleDeviceStatus1(row, status)
+      } else if (this.activeName === 'online') {
+        return this.handleDeviceStatus2(row, status)
+      } else {
+        return this.handleDeviceStatus(row, status)
+      }
+    },
 
-    // 设备上线、下线调用
+    // 设备上线、下线调用-stable
     handleDeviceStatus(row, isOnline) {
       if (isOnline === 1) {
         deviceOnline(row.lockNo).then(response => {
@@ -515,8 +663,69 @@ export default {
         })
       }
     },
-
-    // 点击锁开启,关闭时调用
+    // 设备上线、下线调用-pre
+    handleDeviceStatus1(row, isOnline) {
+      if (isOnline === 1) {
+        deviceOnline1(row.lockNo).then(response => {
+          console.log('关锁' + response)
+          if (response.code === 200) {
+            row.isOnline = isOnline
+            this.$message({ message: '锁ID:' + row.lockNo.toString() + ' ' + this.statusOperateMaps.get(isOnline) + '成功!', type: 'success' })
+          } else {
+            this.$message({ message: '锁ID:' + row.lockNo.toString() + ' ' + this.statusOperateMaps.get(isOnline) + '失败!' + '原因:' + response.msg.toString(), type: 'danger' })
+          }
+        })
+      }
+      if (isOnline === 0) {
+        deviceOffline1(row.deviceId).then(response => {
+          console.log('关锁' + response)
+          if (response.code === 200) {
+            row.isOnline = isOnline
+            this.$message({ message: '锁ID:' + row.lockNo.toString() + ' ' + this.statusOperateMaps.get(isOnline) + '成功!', type: 'success' })
+          } else {
+            this.$message({ message: '锁ID:' + row.lockNo.toString() + ' ' + this.statusOperateMaps.get(isOnline) + '失败!' + '原因:' + response.msg.toString(), type: 'danger' })
+            console.log(response)
+          }
+        })
+      }
+    },
+    // 设备上线、下线调用-online
+    handleDeviceStatus2(row, isOnline) {
+      if (isOnline === 1) {
+        deviceOnline2(row.lockNo).then(response => {
+          console.log('关锁' + response)
+          if (response.code === 200) {
+            row.isOnline = isOnline
+            this.$message({ message: '锁ID:' + row.lockNo.toString() + ' ' + this.statusOperateMaps.get(isOnline) + '成功!', type: 'success' })
+          } else {
+            this.$message({ message: '锁ID:' + row.lockNo.toString() + ' ' + this.statusOperateMaps.get(isOnline) + '失败!' + '原因:' + response.msg.toString(), type: 'danger' })
+          }
+        })
+      }
+      if (isOnline === 0) {
+        deviceOffline2(row.deviceId).then(response => {
+          console.log('关锁' + response)
+          if (response.code === 200) {
+            row.isOnline = isOnline
+            this.$message({ message: '锁ID:' + row.lockNo.toString() + ' ' + this.statusOperateMaps.get(isOnline) + '成功!', type: 'success' })
+          } else {
+            this.$message({ message: '锁ID:' + row.lockNo.toString() + ' ' + this.statusOperateMaps.get(isOnline) + '失败!' + '原因:' + response.msg.toString(), type: 'danger' })
+            console.log(response)
+          }
+        })
+      }
+    },
+    // 根据环境来关锁
+    unLockByEvn(row, status) {
+      if (this.activeName === 'preOnline') {
+        return this.handleLockStatus1(row, status)
+      } else if (this.activeName === 'online') {
+        return this.handleLockStatus2(row, status)
+      } else {
+        return this.handleLockStatus(row, status)
+      }
+    },
+    // 点击锁开启,关闭时调用-stable
     handleLockStatus(row, lockStatus) {
       if (lockStatus === 1) {
         unlockVehicle(row.lockNo).then(response => {
@@ -548,6 +757,70 @@ export default {
         })
       }
     },
+    // 关锁-pre
+    handleLockStatus1(row, lockStatus) {
+      if (lockStatus === 1) {
+        unlockVehicle1(row.lockNo).then(response => {
+          if (response.code === 200) {
+            row.lockStatus = lockStatus
+            this.$message({ message: '锁ID:' + row.lockNo.toString() + ' ' + this.lockStatusMaps.get(lockStatus) + '成功!', type: 'success' })
+          } else {
+            this.$message({ message: '锁ID:' + row.lockNo.toString() + ' ' + this.lockStatusMaps.get(lockStatus) + '失败!' + '原因:' + response.msg.toString(), type: 'danger' })
+          }
+        })
+      }
+      if (lockStatus === 0) {
+        lockVehicle1(row.lockNo).then(response => {
+          this.loading = true
+          if (response.code === 200) {
+            setTimeout(() => {
+              this.getMyDevicesList1().then(
+                response => {
+                  this.list = response.data.bikeDeviceInfos
+                }
+              )
+            }, 1000)
+            row.lockStatus = lockStatus
+            this.loading = false
+            this.$message({ message: '锁ID:' + row.lockNo.toString() + ' ' + this.lockStatusMaps.get(lockStatus) + '成功!', type: 'success' })
+          } else {
+            this.$message({ message: '锁ID:' + row.lockNo.toString() + ' ' + this.lockStatusMaps.get(lockStatus) + '失败!' + '原因:' + response.msg.toString(), type: 'danger' })
+          }
+        })
+      }
+    },
+    // 关锁-online
+    handleLockStatus2(row, lockStatus) {
+      if (lockStatus === 1) {
+        unlockVehicle2(row.lockNo).then(response => {
+          if (response.code === 200) {
+            row.lockStatus = lockStatus
+            this.$message({ message: '锁ID:' + row.lockNo.toString() + ' ' + this.lockStatusMaps.get(lockStatus) + '成功!', type: 'success' })
+          } else {
+            this.$message({ message: '锁ID:' + row.lockNo.toString() + ' ' + this.lockStatusMaps.get(lockStatus) + '失败!' + '原因:' + response.msg.toString(), type: 'danger' })
+          }
+        })
+      }
+      if (lockStatus === 0) {
+        lockVehicle2(row.lockNo).then(response => {
+          this.loading = true
+          if (response.code === 200) {
+            setTimeout(() => {
+              this.getMyDevicesList2().then(
+                response => {
+                  this.list = response.data.bikeDeviceInfos
+                }
+              )
+            }, 1000)
+            row.lockStatus = lockStatus
+            this.loading = false
+            this.$message({ message: '锁ID:' + row.lockNo.toString() + ' ' + this.lockStatusMaps.get(lockStatus) + '成功!', type: 'success' })
+          } else {
+            this.$message({ message: '锁ID:' + row.lockNo.toString() + ' ' + this.lockStatusMaps.get(lockStatus) + '失败!' + '原因:' + response.msg.toString(), type: 'danger' })
+          }
+        })
+      }
+    },
 
     // 新建点击提交时调用
     createData(ele) {
@@ -619,8 +892,8 @@ export default {
       background-color rgba(255,255,255,1)
       box-shadow 0px 0px 11px 0px rgba(238,240,245,1)
       border-radius 7px
-      width 98%
-      margin 10px 0
+      width 93%
+      margin 25px 0
       padding 20px
       min-height calc(100vh - 100px)
     .block >>> th