diff --git a/src/api/vehicle/instance.js b/src/api/vehicle/instance.js index bc0d226..40285ad 100644 --- a/src/api/vehicle/instance.js +++ b/src/api/vehicle/instance.js @@ -85,3 +85,49 @@ 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' + }) +} diff --git a/src/main.js b/src/main.js index 20cb072..4b4d38d 100644 --- a/src/main.js +++ b/src/main.js @@ -4,7 +4,7 @@ import 'normalize.css/normalize.css' // A modern alternative to CSS resets import ElementUI from 'element-ui' import 'element-ui/lib/theme-chalk/index.css' -import locale from 'element-ui/lib/locale/lang/en' // lang i18n +import locale from 'element-ui/lib/locale/lang/zh-CN' // lang i18n import '@/styles/index.scss' // global css diff --git a/src/views/vehicle/index.vue b/src/views/vehicle/index.vue index 5fa8e84..ef96233 100644 --- a/src/views/vehicle/index.vue +++ b/src/views/vehicle/index.vue @@ -2,27 +2,45 @@
- -
- 添加车辆 - 生成车辆 -
+ + + + 添加车辆 + 生成车辆 + 一键上线 + 一键离线 + 一键上报 + 一键重置路径 + 一键取消上报 + + + + + + + + + + + + + + + -
+
- - - - - - - - - - +
@@ -221,8 +239,8 @@ import { instanceClientInit, instanceData, instanceGear, instanceList, - instanceMsg -} from "@/api/vehicle/instance"; + instanceMsg, unifiedOffline, unifiedOnline, unifiedPosition, unifiedSend, unifiedStop +} from '@/api/vehicle/instance' import {positionList} from "@/api/vehicle/position"; import { create, gen } from '@/api/vehicle/vehicle' @@ -235,9 +253,14 @@ export default { // 路径列表 positionCodeList: [], // 车辆列表 - vehicleList: [], + vehiclePage: { + rows: [], + total: 0 + }, // 查询 queryParams: { + page: 1, + pageSize: 10, vin: null, online: true }, @@ -268,6 +291,82 @@ export default { this.intervalVehicleDataContinued = setInterval(this.vehicleDataContinued, 1000); }, methods: { + /** + * 一键上线 + */ + vehicleUnifiedOnline(){ + unifiedOnline().then(response => { + this.$notify({ + title: '操作提示', + message: response.msg, + type: response.code === 200 ? 'success' : 'error' + }) + }) + }, + /** + * 一键离线 + */ + vehicleUnifiedOffline(){ + unifiedOffline().then(response => { + 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.getInstanceList() + }, + /** + * 选择页数 + * @param val + */ + pageChange(val) { + this.queryParams.page = val; + this.getInstanceList() + }, /** * 车辆生成 */ @@ -311,7 +410,6 @@ export default { * @param statusKey 状态Key */ statusChange(statusKey) { - debugger editStatus(this.checkVin, statusKey, this.vehicleData[statusKey]).then(response => { this.$notify({ title: '操作提示', @@ -384,7 +482,7 @@ export default { */ getInstanceList() { instanceList(this.queryParams).then(response => { - this.vehicleList = response.data; + this.vehiclePage = response.data; }) },