Forráskód Böngészése

只差电单车后台创建问题

panxiandiao_i 5 éve
szülő
commit
2dfceaf7d3

+ 3 - 3
src/api/HMvehicle.js

@@ -2,11 +2,11 @@ import request from '@/utils/request'
 import { HMvehicleUrl } from '@/apiConfig/api'
 
 // 创建设备/激活设备
-export function createHmVirtualDevice(params) {
+export function createHmVirtualDevice(data) {
   return request({
     url: HMvehicleUrl + '/virtual-devices/hm/createDevice',
-    method: 'get',
-    params
+    method: 'post',
+    data
   })
 }
 

+ 1 - 1
src/api/qualityCenter.js

@@ -49,7 +49,7 @@ export function getOnlineProblem(params) {
 // 线上缺陷
 export function getOnlineVitium(params) {
   return request({
-    url: qualityUrl + '/api/off-line-defects/data-all-count',
+    url: qualityUrl + '/api/off-line-defects/data-count',
     method: 'get',
     params
   })

+ 1 - 1
src/apiConfig/api.js

@@ -6,4 +6,4 @@ export const mockUrl = 'http://10.179.24.176:8980' // 线下
 
 export const qualityUrl = 'http://10.179.209.19:8898' // 质量度量
 
-export const HMvehicleUrl = 'http://172.23.161.208:9999' // 电单车
+export const HMvehicleUrl = 'http://172.23.161.143:9999' // 电单车

+ 9 - 7
src/views/Platform/bugManage/bugCreate.vue

@@ -256,7 +256,7 @@ export default {
         this.clientTypeEnumList = res.data.clientTypeEnumList
         this.serviceTypeEnumList = res.data.serviceTypeEnumList
       })
-      await taskListCreate({ statusList: [6, 7] }).then(res => { // 获取任务数据 (后期用this.taskStatus)
+      await taskListCreate({ statusList: [5, 6, 7, 8, 9, 10] }).then(res => { // 获取任务数据 (后期用this.taskStatus)
         this.taskIdStr = res.data
       })
       if (this.$route.query.id) {
@@ -284,7 +284,7 @@ export default {
         if (res.code === 200) {
           this.bizOptions = res.data
         } else {
-          this.errorFun()
+          this.errorFun('业务线数据获取失败')
         }
       })
     },
@@ -332,17 +332,19 @@ export default {
           this.userData = { id: '', ename: this.userInformation, name: this.userNames }
           this.objData = { bugBaseInfo: form, user: this.userData }
           bugCreate(this.objData).then(res => {
-            res.code === 200 ? this.successFun() : this.errorFun()
+            res.code === 200 ? this.successFun('create') : this.errorFun('create Failed')
             this.$router.go(-1)
           })
+        } else {
+          this.errorFun('还有未填写的信息')
         }
       })
     },
-    successFun() {
-      this.$notify({ title: 'Success', message: 'Created Successfully', type: 'success', duration: 2000 })
+    successFun(successText) {
+      this.$notify({ title: 'Success', message: `${successText} Successfully`, type: 'success', duration: 2000 })
     },
-    errorFun() {
-      this.$notify({ title: 'Failed', message: 'Created Failed', type: 'error', duration: 2000 })
+    errorFun(errorText) {
+      this.$notify({ title: 'Failed', message: `${errorText}`, type: 'error', duration: 2000 })
     }
   }
 }

+ 1 - 1
src/views/Platform/bugManage/bugUpdate.vue

@@ -271,7 +271,7 @@ export default {
     },
     // 获取任务数据
     taskIdGet() {
-      taskListCreate({ statusList: [6, 7] }).then(res => {
+      taskListCreate({ statusList: [5, 6, 7, 8, 9, 10] }).then(res => {
         this.taskIdStr = res.data
       })
     },

+ 41 - 22
src/views/quality/qualityMeasurement.vue

@@ -1,11 +1,10 @@
 
 <template>
-  <!-- <el-container v-loading.fullscreen.lock="loadingOnlineProcess" element-loading-background="rgba(0, 0, 0, 0.7)" element-loading-text="拼命加载中" class="set-background"> -->
-  <el-container class="set-background">
+  <el-container v-loading.fullscreen.lock="loadingOnlineProcess" element-loading-background="rgba(0, 0, 0, 0.7)" element-loading-text="拼命加载中" class="set-background">
     <el-header class="header">
       <el-menu :default-active="activeIndex" active-text-color="#409EFF" mode="horizontal" @select="handleSelect">
         <el-menu-item index="0">业务线数据</el-menu-item>
-        <el-menu-item index="2">部门数据</el-menu-item>
+        <el-menu-item index="3">部门数据</el-menu-item>
       </el-menu>
       <el-date-picker
         v-model="timeInterval"
@@ -14,6 +13,7 @@
         start-placeholder="开始日期"
         end-placeholder="结束日期"
         value-format="timestamp"
+        @change="dataSearch"
       />
     </el-header>
     <el-container style="height:calc(100vh - 140px);">
@@ -38,14 +38,14 @@
             style="width:50%;"
             align="center"
           >
-            <template slot-scope="scope"><a href="javascript:void(0)" style="color:#20a0ff" @click="toReportView(0)">{{ scope.row.totalOnlineNum }}</a></template>
+            <template slot-scope="scope"><a href="javascript:void(0)" style="color:#20a0ff" @click="toReportView('0')">{{ scope.row.totalOnlineNum }}</a></template>
           </el-table-column>
           <el-table-column
             label="免提测上线数"
             style="width:50%;"
             align="center"
           >
-            <template slot-scope="scope"><a href="javascript:void(0)" style="color:#20a0ff" @click="toReportView(1)">{{ scope.row.noTestNum }}</a></template>
+            <template slot-scope="scope"><a href="javascript:void(0)" style="color:#20a0ff" @click="toReportView('1')">{{ scope.row.noTestNum }}</a></template>
           </el-table-column>
         </el-table>
         <el-table
@@ -65,7 +65,7 @@
               style="width:20%;"
               align="center"
             >
-              <template slot-scope="scope"><a href="javascript:void(0)" style="color:#20a0ff" @click="toReportView(2)">{{ scope.row.rollbackNum }}</a></template>
+              <template slot-scope="scope"><a href="javascript:void(0)" style="color:#20a0ff" @click="toReportView('2')">{{ scope.row.rollbackNum }}</a></template>
             </el-table-column>
             <el-table-column
               prop="name"
@@ -78,21 +78,21 @@
               style="width:20%;"
               align="center"
             >
-              <template slot-scope="scope"><a href="javascript:void(0)" style="color:#20a0ff" @click="toReportView(3)">{{ scope.row.preRollbackNum }}</a></template>
+              <template slot-scope="scope"><a href="javascript:void(0)" style="color:#20a0ff" @click="toReportView('3')">{{ scope.row.preRollbackNum }}</a></template>
             </el-table-column>
             <el-table-column
               label="小流量回滚数"
               style="width:20%;"
               align="center"
             >
-              <template slot-scope="scope"><a href="javascript:void(0)" style="color:#20a0ff" @click="toReportView(4)">{{ scope.row.preLess5Min }}</a></template>
+              <template slot-scope="scope"><a href="javascript:void(0)" style="color:#20a0ff" @click="toReportView('4')">{{ scope.row.preLess5Min }}</a></template>
             </el-table-column>
             <el-table-column
               label="全量回滚数"
               style="width:20%;"
               align="center"
             >
-              <template slot-scope="scope"><a href="javascript:void(0)" style="color:#20a0ff" @click="toReportView(5)">{{ scope.row.allRollbackNum }}</a></template>
+              <template slot-scope="scope"><a href="javascript:void(0)" style="color:#20a0ff" @click="toReportView('5')">{{ scope.row.allRollbackNum }}</a></template>
             </el-table-column>
           </el-table-column>
         </el-table>
@@ -299,10 +299,11 @@
           size="mini"
         >
           <el-table-column
-            prop="totalBugNum"
             label="提报bug数"
             align="center"
-          />
+          >
+            <template slot-scope="scope"><a href="javascript:void(0)" style="color:#20a0ff" @click="toDefectView()">{{ scope.row.totalBugNum }}</a></template>
+          </el-table-column>
           <el-table-column
             label="缺陷分级"
             align="center"
@@ -423,11 +424,11 @@ export default {
       loadingOnlineProcess: true,
       activeIndex: '0',
       activeIndexSecondary: '3',
-      timeInterval: '',
+      // timeInterval: '',
       pauseTreeNode: {},
       pauseKey: '',
-      dealWithBusinessDate: []
-      // timeInterval: [new Date().getTime() - 15 * 24 * 60 * 60 * 1000, new Date().getTime()]
+      dealWithBusinessDate: [],
+      timeInterval: [new Date().getTime() - 365 * 24 * 60 * 60 * 1000, new Date().getTime()]
     }
   },
   created() {
@@ -462,9 +463,18 @@ export default {
       await getDepartment().then(res => {
         this.dealWithBusinessDate = res.code === 0 ? res.data : ''
         this.pauseTreeNode = this.dealWithBusinessDate[0] ? this.dealWithBusinessDate[0] : ''
-        this.pauseKey = 2
+        this.pauseKey = 3
       })
-      this.allCountAndProlemGet()
+      this.deleteAfter()
+    },
+    deleteAfter() {
+      const pretermitSearch = { id: this.pauseTreeNode.id, type: this.pauseKey, startTime: this.timeInterval[0], endTime: this.timeInterval[1] }
+      axios.all([getOnlineAllCount(pretermitSearch), getOnlineProblem({ id: this.pauseTreeNode.id })]).then(axios.spread((resAllCount, resProblem) => {
+        this.onlineProcess = resAllCount.code === 0 ? resAllCount.data : ''
+        this.problemData = resProblem.code === 0 ? resProblem.data : ''
+        // Object.assign(this.onlineProcess, this.toPercent([this.onlineProcess.allRollbackPercent, this.onlineProcess.preLess5MinPercent, this.onlineProcess.preRollbackPercent, this.onlineProcess.rollbackPercent, this.onlineProcess.noTestPercent]))
+        this.loadingOnlineProcess = false
+      }))
     },
     allCountAndProlemGet() {
       const pretermitSearch = { id: this.pauseTreeNode.id, type: this.pauseKey, startTime: this.timeInterval[0], endTime: this.timeInterval[1] }
@@ -476,11 +486,18 @@ export default {
         this.loadingOnlineProcess = false
       }))
     },
+    dataSearch() {
+      if (this.pauseKey === 0) {
+        this._initBusinessTreeAndBeginInfo()
+      } else if (this.pauseKey === 3) {
+        this.initDepartmentTree()
+      }
+    },
     handleSelect(key) {
       if (key === '0') {
         this.pauseKey = key
         this._initBusinessTreeAndBeginInfo()
-      } else if (key === '2') {
+      } else if (key === '3') {
         this.pauseKey = key
         this.initDepartmentTree()
       } else {
@@ -490,17 +507,19 @@ export default {
     toReportView(e) {
       this.$router.push({ name: '上线过程', query: { id: this.pauseTreeNode.id, type: this.pauseKey, dataType: e, startTime: this.timeInterval[0], endTime: this.timeInterval[1] }})
     },
+    toDefectView() {
+      this.$router.push({ name: '上线过程', query: { id: this.pauseTreeNode.id, type: this.pauseKey, startTime: this.timeInterval[0], endTime: this.timeInterval[1] }})
+    },
     handleSelectSecondary(key) {
       console.log(key)
     },
     handleNodeClick(data) {
       this.loadingOnlineProcess = true
       this.pauseTreeNode = data
-      if (!this.pauseTreeNode.child) {
-        this.pauseKey = 1
-      }
-      if (this.pauseTreeNode.modules) {
-        this.pauseKey = 0
+      this.pauseKey = data.type
+      if (this.pauseKey === 3) {
+        this.deleteAfter()
+        return
       }
       this.allCountAndProlemGet()
     },

+ 11 - 4
src/views/quality/qualityProcess.vue

@@ -115,8 +115,9 @@ export default {
       tableData: [],
       input: '',
       curIndex: 1,
-      pageSize: 5,
-      total: 0
+      pageSize: 10,
+      total: 0,
+      processSerach: {}
     }
   },
   created() {
@@ -124,8 +125,14 @@ export default {
   },
   methods: {
     _initProcess() {
-      const processSerach = { id: this.$route.query.id, type: this.$route.query.type, dataType: this.$route.query.dataType, page: this.curIndex, perPage: this.pageSize }
-      getOnlineInfo(processSerach).then(res => {
+      if (!this.$route.query.dataType) {
+        console.log(this.$route.query.dataType)
+        this.processSerach = { id: this.$route.query.id, type: this.$route.query.type, page: this.curIndex, perPage: this.pageSize, startTime: this.$route.query.startTime, endTime: this.$route.query.endTime }
+      } else {
+        console.log(this.$route.query.dataType)
+        this.processSerach = { id: this.$route.query.id, type: this.$route.query.type, dataType: this.$route.query.dataType, page: this.curIndex, perPage: this.pageSize, startTime: this.$route.query.startTime, endTime: this.$route.query.endTime }
+      }
+      getOnlineInfo(this.processSerach).then(res => {
         this.tableData = res.data.data
         this.total = res.data.total
       })

+ 58 - 8
src/views/virtualDevices/HMvehicle.vue

@@ -18,7 +18,7 @@
                 <el-select v-model="queryCode.isActive" placeholder="链接状态" clearable>
                   <el-option v-for="item in linkOptions" :key="item.isActive" :label="item.name" :value="item.isActive" />
                 </el-select>
-                <el-select v-model="queryCode.name" filterable placeholder="城市" clearable>
+                <el-select v-model="queryCode.cityName" filterable placeholder="城市" clearable>
                   <el-option
                     v-for="item in city"
                     :key="item.CityID"
@@ -35,6 +35,7 @@
           </el-form>
           <div class="set-locate">
             <el-table
+              v-loading="loading"
               :data="tableData"
               border
               style="width: 100%"
@@ -140,6 +141,7 @@ export default {
   data() {
     return {
       tableData: [],
+      loading: true,
       form: {},
       queryCode: {},
       curIndex: 1,
@@ -147,6 +149,50 @@ export default {
       total: 0,
       city: cityJson,
       value: '',
+      hmVehicleBaseInfo: {
+        'batteryVoltage': 36511,
+        'controllerTemperature': 25,
+        'holzerVelocity': 2,
+        'rechargeNum': 1,
+        'ridingCurrent': 10,
+        'rscap': 26511,
+        'rsoc': 27,
+        'singleMileage': 10,
+        'soh': 0,
+        'totalMileage': 66,
+        'vehicleStatus': {
+          'vAccStatus': 1,
+          'vBatteryLockStatus': 1,
+          'vBluetoothConnectionStatus': 1,
+          'vBorrowOrReturnStatus': 1,
+          'vExternalBatteryExistStatus': 0,
+          'vHandlerStatus': 1,
+          'vMotorLockStatus': 0,
+          'vMovingStatus': 0,
+          'vRearWheelLockStatus': 0,
+          'vRidingStatus': 0,
+          'vSleepStatus': 0
+        }
+      },
+      hmVehicleBaseStationInfo: {
+        'cellId': 37299,
+        'lac': 8448,
+        'mcc': 1120,
+        'mnc': 0
+      },
+      hmVehicleGpsInfo: {
+        'azimuth': 4,
+        'gpsSignalInfo': {
+          'backupBattery': 9,
+          'gpsLocationStatus': 1,
+          'gpsSatelliteNum': 9,
+          'gpsSignalStrength': 9
+        },
+        'gpsSpeed': 0,
+        'high': 1.2,
+        'lat': 31.85659153128749,
+        'lng': 117.26081489617174
+      },
       lockOptions: [
         {
           name: '未开启',
@@ -180,6 +226,7 @@ export default {
       const params = { page: this.curIndex, pageSize: this.pageSize }
       queryDeviceInfo(params).then(res => {
         res.success === 1 ? this.tableData = res.data : this.errorFun('initialization')
+        this.loading = false
       })
     },
     initWindow() {
@@ -192,9 +239,13 @@ export default {
     dataQuery(queryCode) {
       queryCode.page = this.curIndex
       queryCode.pageSize = this.pageSize
+      for (const key in queryCode) { // 接口不接受空值的处理
+        if (!queryCode[key]) {
+          delete queryCode[key]
+        }
+      }
       queryDeviceInfo(queryCode).then(res => {
         res.success === 1 ? this.tableData = res.data : this.errorFun()
-        console.log(this.tableData)
       })
     },
     createdCode() {
@@ -209,22 +260,21 @@ export default {
     updateLock(ecuId, lockStatus) {
       const params = { ecuId: ecuId, lockStatus: (lockStatus + 1) % 2 }
       updateLockStatus(params).then(res => {
+        this._queryDeviceInfo()
         if (res.success === 1) {
           this.successFun('update')
-          this._queryDeviceInfo()
+          // this._queryDeviceInfo()
         } else {
           this.errorFun('update')
         }
       })
     },
     activate(ecuId, vehicleId, batteryId, imsi, imei, vehicleVersion, cityName) {
-      const params = { ecuId: ecuId, vehicleId: vehicleId, batteryId: batteryId, imsi: imsi, imei: imei, vehicleVersion: vehicleVersion, cityName: cityName }
+      const params = { ecuId: ecuId, vehicleId: vehicleId, batteryId: batteryId, imsi: imsi, imei: imei, vehicleVersion: vehicleVersion, cityName: cityName, hmVehicleBaseInfo: this.hmVehicleBaseInfo, hmVehicleBaseStationInfo: this.hmVehicleBaseStationInfo, hmVehicleGpsInfo: this.hmVehicleGpsInfo }
       createHmVirtualDevice(params).then(res => {
         if (res.success === 1) {
           this.successFun('activate')
-          this.$nextTick(() => {
-            this._queryDeviceInfo()
-          })
+          this._queryDeviceInfo()
         } else {
           this.errorFun('activate')
         }
@@ -267,7 +317,7 @@ export default {
     background-color #F2F3F6
     display flex
     justify-content center
-    min-width 700px
+    min-width 1000px
     .block
       background-color rgba(255,255,255,1)
       box-shadow 0px 0px 11px 0px rgba(238,240,245,1)

+ 49 - 2
src/views/virtualDevices/HMvehicleCreate.vue

@@ -50,11 +50,55 @@ export default {
       formLabelWidth: '120px',
       city: cityJson,
       value: '',
+      hmVehicleBaseInfo: {
+        'batteryVoltage': 36511,
+        'controllerTemperature': 25,
+        'holzerVelocity': 2,
+        'rechargeNum': 1,
+        'ridingCurrent': 10,
+        'rscap': 26511,
+        'rsoc': 27,
+        'singleMileage': 10,
+        'soh': 0,
+        'totalMileage': 66,
+        'vehicleStatus': {
+          'vAccStatus': 1,
+          'vBatteryLockStatus': 1,
+          'vBluetoothConnectionStatus': 1,
+          'vBorrowOrReturnStatus': 1,
+          'vExternalBatteryExistStatus': 0,
+          'vHandlerStatus': 1,
+          'vMotorLockStatus': 0,
+          'vMovingStatus': 0,
+          'vRearWheelLockStatus': 0,
+          'vRidingStatus': 0,
+          'vSleepStatus': 0
+        }
+      },
+      hmVehicleBaseStationInfo: {
+        'cellId': 37299,
+        'lac': 8448,
+        'mcc': 1120,
+        'mnc': 0
+      },
+      hmVehicleGpsInfo: {
+        'azimuth': 4,
+        'gpsSignalInfo': {
+          'backupBattery': 9,
+          'gpsLocationStatus': 1,
+          'gpsSatelliteNum': 9,
+          'gpsSignalStrength': 9
+        },
+        'gpsSpeed': 0,
+        'high': 1.2,
+        'lat': 31.85659153128749,
+        'lng': 117.26081489617174
+      },
       serviceDataRules: {
-        imei: [{ required: true, message: '终端IMEI码不能为空', trigger: 'change' }],
+        imei: [{ required: true, message: '终端IMEI码必须为十五位', trigger: 'change' }],
         ecuId: [{ required: true, message: '硬件中控ID不能为空', trigger: 'change' }],
         vehicleId: [{ required: true, message: '车辆ID不能为空', trigger: 'change' }],
-        imsi: [{ required: true, message: '终端IMSI码不能为空', trigger: 'change' }],
+        imsi: [{ required: true, message: '终端IMSI码必须为十五位', trigger: 'change' }],
         batteryId: [{ required: true, message: '电池ID不能为空', trigger: 'change' }],
         vehicleVersion: [{ required: true, message: '整车版本不能为空', trigger: 'change' }],
         cityName: [{ required: true, message: '城市名称不能为空', trigger: 'change' }]
@@ -66,6 +110,9 @@ export default {
     createFormData(form) {
       this.$refs.form.validate((valid) => {
         if (valid) {
+          form.hmVehicleBaseInfo = this.hmVehicleBaseInfo
+          form.hmVehicleBaseStationInfo = this.hmVehicleBaseStationInfo
+          form.hmVehicleGpsInfo = this.hmVehicleGpsInfo
           createHmVirtualDevice(form).then(res => {
             if (res.success === 1) {
               this.successFun('create')