From 91530b56c80fee3f17ac89ee2f9630e2b57ad6f9 Mon Sep 17 00:00:00 2001 From: DongZeLiang <2746733890@qq.com> Date: Tue, 11 Jun 2024 21:17:21 +0800 Subject: [PATCH] =?UTF-8?q?feat():=20=E4=B8=80=E9=94=AE=E4=B8=8A=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/vehicle/instance.js | 55 ----- src/api/vehicle/unified.js | 56 +++++ src/views/unified/index.vue | 148 ++++++++++++- src/views/vehicle/index.vue | 426 ++++++++++++++---------------------- 4 files changed, 365 insertions(+), 320 deletions(-) create mode 100644 src/api/vehicle/unified.js diff --git a/src/api/vehicle/instance.js b/src/api/vehicle/instance.js index a57566d..bc0d226 100644 --- a/src/api/vehicle/instance.js +++ b/src/api/vehicle/instance.js @@ -85,58 +85,3 @@ export function instanceGear(vin, gear) { data: { 'vin': vin, 'gear': gear } }) } - -/** - * 一键上线 - */ -export function unifiedOnline() { - return request({ - url: `/vehicle/instance/unified/online`, - method: 'post' - }) -} -/** - * 一键离线 - */ -export function unifiedOffline() { - return request({ - url: `/vehicle/instance/unified/offline`, - method: 'post' - }) -} -/** - * 一键上报 - */ -export function unifiedSend() { - return request({ - url: `/vehicle/instance/unified/send`, - method: 'post' - }) -} -/** - * 一键重置路径 - */ -export function unifiedPosition() { - return request({ - url: `/vehicle/instance/unified/position`, - method: 'post' - }) -} -/** - * 一键取消上报 - */ -export function unifiedStop() { - return request({ - url: `/vehicle/instance/unified/stop`, - method: 'post' - }) -} -/** - * 一键执行任务状态 - */ -export function unifiedStatus() { - return request({ - url: `/vehicle/instance/unified/status`, - method: 'GET' - }) -} diff --git a/src/api/vehicle/unified.js b/src/api/vehicle/unified.js new file mode 100644 index 0000000..4a106a3 --- /dev/null +++ b/src/api/vehicle/unified.js @@ -0,0 +1,56 @@ +import request from '@/utils/request' + +/** + * 一键上线 + */ +export function unifiedOnline() { + return request({ + url: `/vehicle/unified/online`, + method: 'post' + }) +} +/** + * 一键离线 + */ +export function unifiedOffline() { + return request({ + url: `/vehicle/unified/offline`, + method: 'post' + }) +} +/** + * 一键上报 + */ +export function unifiedSend() { + return request({ + url: `/vehicle/unified/send`, + method: 'post' + }) +} +/** + * 一键重置路径 + */ +export function unifiedPosition() { + return request({ + url: `/vehicle/unified/position`, + method: 'post' + }) +} +/** + * 一键取消上报 + */ +export function unifiedStop() { + return request({ + url: `/vehicle/unified/stop`, + method: 'post' + }) +} +/** + * 一键执行任务状态 + */ +export function unifiedStatus() { + return request({ + url: `/vehicle/unified/status`, + method: 'GET' + }) +} diff --git a/src/views/unified/index.vue b/src/views/unified/index.vue index bf95ad0..881232e 100644 --- a/src/views/unified/index.vue +++ b/src/views/unified/index.vue @@ -1,18 +1,158 @@ - 统一调配 + + + 一键上线 + 一键离线 + 一键上报 + 一键重置路径 + 一键取消上报 + + + + + + + {{unifiedInfo.taskName}} + + + 任务描述:{{unifiedInfo.taskName}} + 任务总数:{{unifiedInfo.taskExecutionSum}} + 成功总数:{{unifiedInfo.taskSuccessSum}} + 失败总数:{{unifiedInfo.taskErrorSum}} + + diff --git a/src/views/vehicle/index.vue b/src/views/vehicle/index.vue index 61511cf..309ac75 100644 --- a/src/views/vehicle/index.vue +++ b/src/views/vehicle/index.vue @@ -3,27 +3,7 @@ 添加车辆 - 生成车辆 - 一键上线 - 一键离线 - 一键上报 - 一键重置路径 - 一键取消上报 - - - 任务描述:{{unifiedInfo.taskName}} - 任务总数:{{unifiedInfo.taskExecutionSum}} - 成功总数:{{unifiedInfo.taskSuccessSum}} - 失败总数:{{unifiedInfo.taskErrorSum}} - - 有任务在执行 - + 生成车辆 @@ -31,41 +11,51 @@ - + - - + - + :total="vehiclePage.total" + @size-change="pageSizeChange" + @current-change="pageChange" + /> - + {{ vehicle.vin }} - 删除 + 删除 | - {{checkVin === vehicle.vin ? "已选择" : "选择"}} + {{ checkVin === vehicle.vin ? "已选择" : "选择" }} | 上线 @@ -76,35 +66,35 @@ - 路线 + 路线 - + - {{vehicle.positionLength}} + {{ vehicle.positionLength }} - 档位 - - - + 档位 + + + - 报文上报 - - - - + 报文上报 + + + + - 总里程 - {{vehicle.mileage}}/KM + 总里程 + {{ vehicle.mileage }}/KM - + 联系地址 江苏省苏州市吴中区吴中大道 1188 号 @@ -117,94 +107,93 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 正常 异常 - 正常 异常 - 正常 异常 - 正常 异常 - 正常 异常 - 正常 异常 - 正常 异常 - - - - - 正常 异常 - 正常 异常 - 正常 异常 - 正常 异常 - 正常 异常 - - - - - 正常 异常 - 正常 异常 - 正常 异常 - 正常 异常 - 正常 异常 - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 正常 异常 + 正常 异常 + 正常 异常 + 正常 异常 + 正常 异常 + 正常 异常 + 正常 异常 + + + + + 正常 异常 + 正常 异常 + 正常 异常 + 正常 异常 + 正常 异常 + + + + + 正常 异常 + 正常 异常 + 正常 异常 + 正常 异常 + 正常 异常 + + + + + - - + @@ -212,17 +201,18 @@ title="添加车辆" :visible.sync="addVehicleDrawer" direction="ltr" - size="50%"> + size="50%" + > 一行一个VIN,多VIN进行换行 - + 添加车辆 - 取消 + 取消 @@ -231,13 +221,19 @@ + width="30%" + > - + @@ -258,9 +254,9 @@ import { instanceClientInit, instanceData, instanceGear, instanceList, - instanceMsg, unifiedOffline, unifiedOnline, unifiedPosition, unifiedSend, unifiedStatus, unifiedStop + instanceMsg } from '@/api/vehicle/instance' -import {positionList} from "@/api/vehicle/position"; +import { positionList } from '@/api/vehicle/position' import { create, gen, remove } from '@/api/vehicle/vehicle' export default { @@ -300,114 +296,22 @@ export default { // 生成车辆表单 genForm: { number: 0 - }, - // 任务进度 - unifiedInfo: { - unifiedStatus: false, - taskName: null, - taskExecutionSum: null, - taskStartTime: null, - taskSuccessSum: null, - taskErrorSum: null - }, - unifiedInfoInterval: null, - // 进度条颜色 - customColors: [ - { color: '#f56c6c', percentage: 20 }, - { color: '#e6a23c', percentage: 40 }, - { color: '#1989fa', percentage: 60 }, - { color: '#6f7ad3', percentage: 80 }, - { color: '#5cb87a', percentage: 100 } - ] + } } }, created() { - this.contentHeight = window.innerHeight - 60; - this.initInstanceList(); - this.initPositionList(); - this.intervalVehicleDataContinued = setInterval(this.vehicleDataContinued, 1000); + this.contentHeight = window.innerHeight - 60 + this.initInstanceList() + this.initPositionList() }, methods: { - /** - * 获取状态 - */ - vehicleUnifiedStatus() { - unifiedStatus().then(response => { - this.unifiedInfo = response.data; - if (!this.unifiedInfo.unifiedStatus){ - clearInterval(this.unifiedInfoInterval); - } - }) - }, - /** - * 一键上线 - */ - vehicleUnifiedOnline(){ - unifiedOnline().then(response => { - this.$notify({ - title: '操作提示', - message: response.msg, - type: response.code === 200 ? 'success' : 'error' - }) - this.unifiedInfoInterval = setInterval(this.vehicleUnifiedStatus, 100) - }) - }, - /** - * 一键离线 - */ - vehicleUnifiedOffline(){ - unifiedOffline().then(response => { - // 一键离线清空车辆选择 - this.checkVin = null; - this.$notify({ - title: '操作提示', - message: response.msg, - type: response.code === 200 ? 'success' : 'error' - }) - }) - }, - /** - * 一键上报 - */ - vehicleUnifiedSend(){ - unifiedSend().then(response => { - this.$notify({ - title: '操作提示', - message: response.msg, - type: response.code === 200 ? 'success' : 'error' - }) - }) - }, - /** - * 一键上报 - */ - vehicleUnifiedPosition(){ - unifiedPosition().then(response => { - this.$notify({ - title: '操作提示', - message: response.msg, - type: response.code === 200 ? 'success' : 'error' - }) - }) - }, - /** - * 一键取消上报 - */ - vehicleUnifiedStop(){ - unifiedStop().then(response => { - this.$notify({ - title: '操作提示', - message: response.msg, - type: response.code === 200 ? 'success' : 'error' - }) - }) - }, + /** * 选择每页数量 * @param val */ pageSizeChange(val) { - this.queryParams.pageSize = val; + this.queryParams.pageSize = val this.getInstanceList() }, /** @@ -415,15 +319,15 @@ export default { * @param val */ pageChange(val) { - this.queryParams.page = val; + this.queryParams.page = val this.getInstanceList() }, /** * 车辆生成 */ - vehicleGen(){ + vehicleGen() { gen(this.genForm.number).then(response => { - this.genVehicleDialog = false; + this.genVehicleDialog = false this.$notify({ title: '操作提示', message: response.msg, @@ -434,9 +338,9 @@ export default { /** * 车辆添加 */ - vehicleCreate(){ + vehicleCreate() { create(this.addForm).then(response => { - this.addVehicleDrawer = false; + this.addVehicleDrawer = false this.$notify({ title: '操作提示', message: response.msg, @@ -447,7 +351,7 @@ export default { /** * 车辆删除 */ - vehicleRemove(vin){ + vehicleRemove(vin) { remove(vin).then(response => { this.getInstanceList() this.$notify({ @@ -461,8 +365,8 @@ export default { /** * 获取车辆数据 */ - vehicleDataContinued(){ - if (this.checkVin != null){ + vehicleDataContinued() { + if (this.checkVin != null) { instanceData(this.checkVin).then(response => { this.vehicleData = response.data }) @@ -488,7 +392,7 @@ export default { */ checkGear(vehicle) { instanceGear(vehicle.vin, vehicle.gear).then(response => { - this.getInstanceList(); + this.getInstanceList() this.$notify({ title: '操作提示', message: response.msg, @@ -502,7 +406,7 @@ export default { */ checkMsg(vehicle) { instanceMsg(vehicle.vin, vehicle.msgCode).then(response => { - this.getInstanceList(); + this.getInstanceList() this.$notify({ title: '操作提示', message: response.msg, @@ -516,7 +420,7 @@ export default { */ checkPositionCode(vehicle) { instanceCheckPosition(vehicle.vin, vehicle.positionCode).then(response => { - this.getInstanceList(); + this.getInstanceList() this.$notify({ title: '操作提示', message: response.msg, @@ -527,26 +431,26 @@ export default { /** * 初始化路径 */ - initPositionList(){ + initPositionList() { positionList().then(response => { - this.positionCodeList = response.data; + this.positionCodeList = response.data }) }, /** * 初始化车辆列表 */ - initInstanceList(){ + initInstanceList() { // 优先执行一次数据获取 this.getInstanceList() // 再次执行为定时器执行 - this.intervalInstanceList = setInterval(this.getInstanceList, 3000); + this.intervalInstanceList = setInterval(this.getInstanceList, 3000) }, /** * 获取车辆列表 */ getInstanceList() { instanceList(this.queryParams).then(response => { - this.vehiclePage = response.data; + this.vehiclePage = response.data }) }, @@ -554,9 +458,9 @@ export default { * 初始化车机 * @param vin */ - clientInit(vin){ + clientInit(vin) { instanceClientInit(vin).then(response => { - this.getInstanceList(); + this.getInstanceList() this.$notify({ title: '操作提示', message: response.msg, @@ -568,11 +472,11 @@ export default { * 关闭车机 * @param vin */ - clientClose(vin){ + clientClose(vin) { instanceClientClose(vin).then(response => { - this.getInstanceList(); + this.getInstanceList() // 如果下线的是本车则关闭实时车况查看 - if (vin === this.checkVin){ + if (vin === this.checkVin) { this.checkVin = null } this.$notify({