|
@@ -7,18 +7,18 @@
|
|
|
<el-form :model="queryCode">
|
|
|
<div class="set-between">
|
|
|
<div class="special-input">
|
|
|
- <el-input v-model="queryCode.creator" placeholder="车辆ID" clearable />
|
|
|
- <el-input v-model="queryCode.creator" placeholder="ECUID" clearable />
|
|
|
- <el-input v-model="queryCode.creator" placeholder="车辆类型" clearable />
|
|
|
+ <el-input v-model="queryCode.vehicleId" placeholder="车辆ID" clearable />
|
|
|
+ <el-input v-model="queryCode.ecuId" placeholder="ECUID" clearable />
|
|
|
+ <el-input v-model="queryCode.vehicleVersion" placeholder="车辆类型" clearable />
|
|
|
</div>
|
|
|
<div class="special-input-chose">
|
|
|
- <el-select v-model="queryCode.bizId" placeholder="锁状态">
|
|
|
- <el-option v-for="item in bizOptions" :key="item.id" :label="item.name" :value="item.id" />
|
|
|
+ <el-select v-model="queryCode.lockStatus" placeholder="锁状态" clearable>
|
|
|
+ <el-option v-for="item in lockOptions" :key="item.lockStatus" :label="item.name" :value="item.lockStatus" />
|
|
|
</el-select>
|
|
|
- <el-select v-model="queryCode.bizId" placeholder="链接状态">
|
|
|
- <el-option v-for="item in bizOptions" :key="item.id" :label="item.name" :value="item.id" />
|
|
|
+ <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="form.name" filterable placeholder="城市">
|
|
|
+ <el-select v-model="queryCode.name" filterable placeholder="城市" clearable>
|
|
|
<el-option
|
|
|
v-for="item in city"
|
|
|
:key="item.CityID"
|
|
@@ -47,18 +47,19 @@
|
|
|
width="50"
|
|
|
/>
|
|
|
<el-table-column
|
|
|
- prop="date"
|
|
|
+ prop="vehicleId"
|
|
|
label="车辆ID"
|
|
|
align="center"
|
|
|
+ width="95"
|
|
|
/>
|
|
|
<el-table-column
|
|
|
- prop="gitProject"
|
|
|
+ prop="vehicleVersion"
|
|
|
label="车辆类型"
|
|
|
align="center"
|
|
|
width="70"
|
|
|
/>
|
|
|
<el-table-column
|
|
|
- prop="handler"
|
|
|
+ prop="ecuId"
|
|
|
label="ECUID"
|
|
|
align="center"
|
|
|
/>
|
|
@@ -69,48 +70,48 @@
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
<el-tag
|
|
|
- :type="scope.row.tag === '王小虎' ? 'success' : 'danger'"
|
|
|
+ :type="scope.row.lockStatus === 1 ? 'success' : 'danger'"
|
|
|
disable-transitions
|
|
|
- >{{ scope.row.name }}</el-tag>
|
|
|
+ >{{ scope.row.lockStatus | toLockStatus }}</el-tag>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- prop="isGoPre"
|
|
|
label="链接状态"
|
|
|
align="center"
|
|
|
width="80"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
<el-tag
|
|
|
- :type="scope.row.tag === '王小虎' ? 'success' : 'danger'"
|
|
|
+ :type="scope.row.isActive === 1 ? 'success' : 'danger'"
|
|
|
disable-transitions
|
|
|
- >{{ scope.row.name }}</el-tag>
|
|
|
+ >{{ scope.row.isActive | toActiveStatus }}</el-tag>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- prop="onlineDate"
|
|
|
label="激活时间"
|
|
|
align="center"
|
|
|
- />
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">{{ scope.row.gmtActive | toData }}</template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column
|
|
|
label="操作"
|
|
|
align="center"
|
|
|
width="300"
|
|
|
>
|
|
|
- <template>
|
|
|
+ <template slot-scope="scope">
|
|
|
<div class="specail-lock">
|
|
|
- <div class="el-icon-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)" />
|
|
|
<div>
|
|
|
- <el-button size="mini" type="success" plain>激活</el-button>
|
|
|
- <el-button size="mini" type="info" plain>下线</el-button>
|
|
|
- <el-button size="mini" type="danger">删除</el-button>
|
|
|
+ <el-button size="mini" type="success" plain @click="activate(scope.row.ecuId, scope.row.vehicleId, scope.row.batteryId, scope.row.imsi, scope.row.imei, scope.row.vehicleVersion, scope.row.cityName)">激活</el-button>
|
|
|
+ <el-button size="mini" type="info" plain @click="offHmvirtual(scope.row.ecuId)">下线</el-button>
|
|
|
+ <el-button size="mini" type="danger" @click="delHmVirtual(scope.row.ecuId)">删除</el-button>
|
|
|
<el-button size="mini" type="primary">...</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
- <el-pagination background style="margin-top:30px;" align="center" :current-page="curIndex" :page-size="pageSize" layout="prev, pager, next" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
|
|
|
+ <el-pagination background style="margin-top:30px;" align="center" :current-page="curIndex" :page-size="pageSize" layout="prev, pager, next" :total="total" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -120,27 +121,52 @@
|
|
|
|
|
|
<script>
|
|
|
import { cityJson } from '@/views/virtualDevices/city'
|
|
|
-import { createHmVirtualDevice, queryDeviceInfo, delHmVirtualDevice, offHmvirtualDevice } from '@/api/HMvehicle'
|
|
|
+import { createHmVirtualDevice, queryDeviceInfo, delHmVirtualDevice, offHmvirtualDevice, updateLockStatus } from '@/api/HMvehicle'
|
|
|
|
|
|
export default {
|
|
|
+ filters: {
|
|
|
+ toLockStatus(e) {
|
|
|
+ return e === 0 ? '未开启' : '已开启'
|
|
|
+ },
|
|
|
+ toActiveStatus(e) {
|
|
|
+ return e === 0 ? '未激活' : '已激活'
|
|
|
+ },
|
|
|
+ toData(time) {
|
|
|
+ const standard = new Date(time)
|
|
|
+ const result = standard.getFullYear() + '-' + (standard.getMonth() + 1) + '-' + standard.getDate() + ' ' + standard.getHours() + ':' + standard.getMinutes() + ':' + standard.getSeconds()
|
|
|
+ return result
|
|
|
+ }
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
- tableData: [{
|
|
|
- id: '1',
|
|
|
- date: '2016-05',
|
|
|
- name: '王小虎'
|
|
|
- }, {
|
|
|
- id: '2',
|
|
|
- date: '2016-05',
|
|
|
- name: '王小虎'
|
|
|
- }],
|
|
|
+ tableData: [],
|
|
|
form: {},
|
|
|
- bizOptions: [],
|
|
|
queryCode: {},
|
|
|
curIndex: 1,
|
|
|
pageSize: 20,
|
|
|
+ total: 0,
|
|
|
city: cityJson,
|
|
|
- value: ''
|
|
|
+ value: '',
|
|
|
+ lockOptions: [
|
|
|
+ {
|
|
|
+ name: '未开启',
|
|
|
+ lockStatus: 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '已开启',
|
|
|
+ lockStatus: 1
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ linkOptions: [
|
|
|
+ {
|
|
|
+ name: '未激活',
|
|
|
+ isActive: 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '已激活',
|
|
|
+ isActive: 1
|
|
|
+ }
|
|
|
+ ]
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
@@ -152,6 +178,9 @@ export default {
|
|
|
methods: {
|
|
|
_queryDeviceInfo() {
|
|
|
const params = { page: this.curIndex, pageSize: this.pageSize }
|
|
|
+ queryDeviceInfo(params).then(res => {
|
|
|
+ res.success === 1 ? this.tableData = res.data : this.errorFun('initialization')
|
|
|
+ })
|
|
|
},
|
|
|
initWindow() {
|
|
|
if (!document.getElementById('window-judge')) {
|
|
@@ -161,6 +190,12 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
dataQuery(queryCode) {
|
|
|
+ queryCode.page = this.curIndex
|
|
|
+ queryCode.pageSize = this.pageSize
|
|
|
+ queryDeviceInfo(queryCode).then(res => {
|
|
|
+ res.success === 1 ? this.tableData = res.data : this.errorFun()
|
|
|
+ console.log(this.tableData)
|
|
|
+ })
|
|
|
},
|
|
|
createdCode() {
|
|
|
this.$router.push({ name: '新增电单车', params: { formData: this.form }, query: { id: this.form.id }})
|
|
@@ -170,6 +205,58 @@ export default {
|
|
|
},
|
|
|
handleCurrentChange(curIndex) {
|
|
|
this.curIndex = curIndex
|
|
|
+ },
|
|
|
+ updateLock(ecuId, lockStatus) {
|
|
|
+ const params = { ecuId: ecuId, lockStatus: (lockStatus + 1) % 2 }
|
|
|
+ updateLockStatus(params).then(res => {
|
|
|
+ if (res.success === 1) {
|
|
|
+ this.successFun('update')
|
|
|
+ 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 }
|
|
|
+ createHmVirtualDevice(params).then(res => {
|
|
|
+ if (res.success === 1) {
|
|
|
+ this.successFun('activate')
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this._queryDeviceInfo()
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.errorFun('activate')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ offHmvirtual(ecuId) {
|
|
|
+ const params = { ecuId: ecuId }
|
|
|
+ offHmvirtualDevice(params).then(res => {
|
|
|
+ if (res.success === 1) {
|
|
|
+ this.successFun('offLine')
|
|
|
+ this._queryDeviceInfo()
|
|
|
+ } else {
|
|
|
+ this.errorFun('offLine')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ delHmVirtual(ecuId) {
|
|
|
+ const params = { ecuId: ecuId }
|
|
|
+ delHmVirtualDevice(params).then(res => {
|
|
|
+ if (res.success === 1) {
|
|
|
+ this.successFun('delete')
|
|
|
+ this._queryDeviceInfo()
|
|
|
+ } else {
|
|
|
+ this.errorFun('delete')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ successFun(successText) {
|
|
|
+ this.$notify({ title: 'Success', message: `${successText} Successfully`, type: 'success', duration: 2000 })
|
|
|
+ },
|
|
|
+ errorFun(errorText) {
|
|
|
+ this.$notify({ title: 'Failed', message: `${errorText} Failed`, type: 'error', duration: 2000 })
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -201,17 +288,17 @@ export default {
|
|
|
.block >>> .el-form-item__content
|
|
|
margin-left 0 !important
|
|
|
.block >>> th
|
|
|
- background-color #F0F7FF !important
|
|
|
+ background-color #F0F2F4 !important
|
|
|
.set-between
|
|
|
display flex
|
|
|
.set-between >>> .el-button
|
|
|
height 40px
|
|
|
.set-locate
|
|
|
- margin-top 20px
|
|
|
+ margin-top 40px
|
|
|
.specail-lock
|
|
|
display flex
|
|
|
justify-content center
|
|
|
- .el-icon-lock
|
|
|
+ .el-icon-lock , .el-icon-unlock
|
|
|
font-size 20px
|
|
|
margin 4px 7px 0 0
|
|
|
</style>
|