init
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"van-popup": "@vant/weapp/popup/index"
|
||||
},
|
||||
"navigationBarTitleText": "车辆详情"
|
||||
}
|
||||
@@ -0,0 +1,231 @@
|
||||
/* pages/vehicleMonitoring/realtime/realtime.wxss */
|
||||
.container {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
position: relative;
|
||||
|
||||
#map-container {
|
||||
width: 100%;
|
||||
// height: 100%;
|
||||
height: 30%;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.h100 {
|
||||
height: 100% !important;
|
||||
}
|
||||
|
||||
.btn {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
background: #FFFFFF;
|
||||
box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.2);
|
||||
border-radius: 4px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: absolute;
|
||||
justify-content: center;
|
||||
right: 8px;
|
||||
z-index: 10;
|
||||
|
||||
image {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
.reload {
|
||||
top: 8px;
|
||||
}
|
||||
|
||||
.navigation {
|
||||
top: 42px;
|
||||
}
|
||||
|
||||
.inf-container {
|
||||
width: 100%;
|
||||
height: 70vh;
|
||||
padding: 0 8px;
|
||||
box-sizing: border-box;
|
||||
background: #FFFFFF;
|
||||
box-shadow: 0px 0px 16px 0px rgba(0, 0, 0, 0.1);
|
||||
border-radius: 24px 24px 8px 8px;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
overflow: hidden;
|
||||
|
||||
.top {
|
||||
width: 100%;
|
||||
height: 18px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
.line {
|
||||
width: 48px;
|
||||
height: 4px;
|
||||
background: #CBCACA;
|
||||
border-radius: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.base-inf {
|
||||
padding: 0 10px 6px;
|
||||
|
||||
.row {
|
||||
margin-bottom: 4px;
|
||||
font-size: 14px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
.number-plate {
|
||||
color: #333333;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.code {
|
||||
color: #888888;
|
||||
}
|
||||
|
||||
.project-name {
|
||||
color: #2E3A4F;
|
||||
}
|
||||
|
||||
.car-type {
|
||||
height: 20px;
|
||||
padding: 0 8px;
|
||||
box-sizing: border-box;
|
||||
border-radius: 2px;
|
||||
border: 1px solid #3977F7;
|
||||
color: #4381FC;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.detail-inf {
|
||||
height: calc(100% - 74px);
|
||||
border-top: 1px solid #DFDFDF;
|
||||
display: flex;
|
||||
|
||||
.sidebar {
|
||||
width: 82px;
|
||||
height: 100%;
|
||||
background: #EFF1F4;
|
||||
|
||||
.item {
|
||||
width: 82px;
|
||||
height: 40px;
|
||||
box-shadow: inset 0px -1px 0px 0px #DFDFDF;
|
||||
font-size: 14px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.select {
|
||||
background: #FFFFFF;
|
||||
border-left: 4px solid #3977F7;
|
||||
box-sizing: border-box;
|
||||
color: #4381FC;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
width: calc(100% - 80px);
|
||||
padding: 0 6px;
|
||||
box-sizing: border-box;
|
||||
overflow-y: auto;
|
||||
|
||||
.row {
|
||||
padding: 0 6px;
|
||||
min-height: 28px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
white-space: nowrap;
|
||||
|
||||
.label {
|
||||
color: #8A90A4;
|
||||
}
|
||||
|
||||
.val {
|
||||
color: #2E3A4F;
|
||||
font-size: 14px;
|
||||
white-space: pre-wrap;
|
||||
text-align: right;
|
||||
word-break: break-all;
|
||||
}
|
||||
.width74{
|
||||
width: 74%;
|
||||
}
|
||||
|
||||
.val-r {
|
||||
color: #EA4955;
|
||||
}
|
||||
|
||||
.online,
|
||||
.offline,
|
||||
.errline {
|
||||
height: 22px;
|
||||
line-height: 22px;
|
||||
padding: 0 8px;
|
||||
border: 1px solid;
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.online {
|
||||
background: #F6FFED;
|
||||
border-color: #D9F7BE;
|
||||
color: #52C41A;
|
||||
}
|
||||
|
||||
.offline {
|
||||
background: rgba(0, 0, 0, 0.04);
|
||||
border-color: rgba(0, 0, 0, 0.15);
|
||||
color: rgba(0, 0, 0, 0.45);
|
||||
}
|
||||
|
||||
.errline {
|
||||
background: #FFF1F0;
|
||||
border: 1px solid #FFA39E;
|
||||
color: #FF4D4F;
|
||||
}
|
||||
|
||||
.fileList {
|
||||
width: 80%;
|
||||
|
||||
.file {
|
||||
text-align: right;
|
||||
|
||||
.label {
|
||||
padding: 4px 0;
|
||||
// width: 80%;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
color: #409EFF;
|
||||
word-wrap: break-word;
|
||||
word-break: break-all;
|
||||
white-space: pre-line;
|
||||
}
|
||||
|
||||
.check {
|
||||
font-size: 14px;
|
||||
color: #409EFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.row:nth-child(2n) {
|
||||
background: #F5F7FA;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,845 @@
|
||||
// pages/vehicleMonitoring/realtime/realtime.ts
|
||||
import { getAction } from '../../../api/base';
|
||||
|
||||
var QQMapWX = require('../../../utils/qqmap-wx-jssdk.min.js');
|
||||
// 实例化API核心类
|
||||
var qqmapsdk = new QQMapWX({
|
||||
key: 'KDEBZ-EV5KH-XN5DU-WYZGD-SN3YK-WZBZI'
|
||||
});
|
||||
Page({
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
mapCenter: {
|
||||
longitude: '104.06439',
|
||||
latitude: '30.57812'
|
||||
},
|
||||
mapObj: null as any,
|
||||
carMarkers: [],
|
||||
setting: {
|
||||
scale: 10
|
||||
},
|
||||
show: true,
|
||||
tabs: [
|
||||
{
|
||||
tabName: '实时状态'
|
||||
},
|
||||
{
|
||||
tabName: '整车数据'
|
||||
},
|
||||
{
|
||||
tabName: '报警数据'
|
||||
},
|
||||
{
|
||||
tabName: '电机'
|
||||
}
|
||||
] as any,
|
||||
activeIndex: 0,
|
||||
infObj: {} as any,
|
||||
address: '',
|
||||
tmpOptions: {
|
||||
gpsTime: {
|
||||
key: 'gpsTime',
|
||||
value: '-',
|
||||
label: '定位时间'
|
||||
},
|
||||
totalMileage: {
|
||||
key: 'totalMileage',
|
||||
value: '-',
|
||||
label: '里程'
|
||||
},
|
||||
acc_dictText: {
|
||||
key: 'acc_dictText',
|
||||
value: '-',
|
||||
label: '点火状态'
|
||||
},
|
||||
isOnline: {
|
||||
key: 'isOnline',
|
||||
value: '-',
|
||||
label: '在线状态'
|
||||
},
|
||||
// {
|
||||
// key: '',
|
||||
// value: '-',
|
||||
// label: 'GPS定位'
|
||||
// },
|
||||
chargeStatus_dictText: {
|
||||
key: 'chargeStatus_dictText',
|
||||
value: '-',
|
||||
label: '充电状态'
|
||||
},
|
||||
alert: {
|
||||
key: 'alert',
|
||||
value: '-',
|
||||
label: '告警'
|
||||
},
|
||||
// stateOfCharge:{
|
||||
// key: 'stateOfCharge',
|
||||
// value: '-',
|
||||
// label: '剩余电量'
|
||||
// },
|
||||
maxRpm: {
|
||||
key: 'maxRpm',
|
||||
value: '-',
|
||||
label: '转速'
|
||||
},
|
||||
speed: {
|
||||
key: 'speed',
|
||||
value: '-',
|
||||
label: '速度'
|
||||
},
|
||||
stateOfCharge: {
|
||||
key: 'stateOfCharge',
|
||||
value: '-',
|
||||
label: 'SOC'
|
||||
}
|
||||
} as any,
|
||||
tmpOptions1: {
|
||||
status: {
|
||||
key: 'status',
|
||||
value: '-',
|
||||
label: '车辆状态'
|
||||
},
|
||||
speed: {
|
||||
key: 'speed',
|
||||
value: '-',
|
||||
label: '速度'
|
||||
},
|
||||
totalCurrent: {
|
||||
key: 'totalCurrent',
|
||||
value: '-',
|
||||
label: '总电流'
|
||||
},
|
||||
gearPosition: {
|
||||
key: 'gearPosition',
|
||||
value: '-',
|
||||
label: '档位'
|
||||
},
|
||||
// chargeStatus_dictText:{
|
||||
// key: 'chargeStatus_dictText',
|
||||
// value: '-',
|
||||
// label: '制动踏板状态'
|
||||
// },
|
||||
chargeStatus: {
|
||||
key: 'chargeStatus',
|
||||
value: '-',
|
||||
label: '充电状态'
|
||||
},
|
||||
totalMileage: {
|
||||
key: 'totalMileage',
|
||||
value: '-',
|
||||
label: '累计里程'
|
||||
},
|
||||
stateOfCharge: {
|
||||
key: 'stateOfCharge',
|
||||
value: '-',
|
||||
label: 'SOC值'
|
||||
},
|
||||
insulationResistance: {
|
||||
key: 'insulationResistance',
|
||||
value: '-',
|
||||
label: '绝缘电阻'
|
||||
},
|
||||
// maxRpm:{
|
||||
// key: 'maxRpm',
|
||||
// value: '-',
|
||||
// label: '驱动力状态'
|
||||
// },
|
||||
operatingMode: {
|
||||
key: 'operatingMode',
|
||||
value: '-',
|
||||
label: '运行模式'
|
||||
},
|
||||
totalVoltage: {
|
||||
key: 'totalVoltage',
|
||||
value: '-',
|
||||
label: '总电压'
|
||||
},
|
||||
dcDcStatus: {
|
||||
key: 'dcDcStatus',
|
||||
value: '-',
|
||||
label: 'DC-DC状态'
|
||||
}
|
||||
} as any,
|
||||
tmpOptions2: {
|
||||
maxAlarmLevel: {
|
||||
key: 'maxAlarmLevel',
|
||||
value: '-',
|
||||
label: '最高报警等级'
|
||||
},
|
||||
batteryHighTemperatureAlarm: {
|
||||
key: 'batteryHighTemperatureAlarm',
|
||||
value: '-',
|
||||
label: '电池高温报警'
|
||||
},
|
||||
underVoltageAlarm: {
|
||||
key: 'underVoltageAlarm',
|
||||
value: '-',
|
||||
label: '车载储能装欠压报警'
|
||||
},
|
||||
overVoltageSingleBatteryAlarm: {
|
||||
key: 'overVoltageSingleBatteryAlarm',
|
||||
value: '-',
|
||||
label: '单体电池过压报警'
|
||||
},
|
||||
highSocAlarm: {
|
||||
key: 'highSocAlarm',
|
||||
value: '-',
|
||||
label: 'SOC过高报警'
|
||||
},
|
||||
mismatchedEnergyStorageAlarm: {
|
||||
key: 'mismatchedEnergyStorageAlarm',
|
||||
value: '-',
|
||||
label: '可充电储能不匹配报警'
|
||||
},
|
||||
dcDcTemperatureAlarm: {
|
||||
key: 'dcDcTemperatureAlarm',
|
||||
value: '-',
|
||||
label: 'DC-DC温度报警'
|
||||
},
|
||||
overChargeAlarm: {
|
||||
key: 'overChargeAlarm',
|
||||
value: '-',
|
||||
label: '车载储能装置过充报警'
|
||||
},
|
||||
insulationAlarm: {
|
||||
key: 'insulationAlarm',
|
||||
value: '-',
|
||||
label: '绝缘报警'
|
||||
},
|
||||
brakeSystemAlarm: {
|
||||
key: 'brakeSystemAlarm',
|
||||
value: '-',
|
||||
label: '制动系统报警'
|
||||
},
|
||||
motorControllerTemperatureAlarm: {
|
||||
key: 'motorControllerTemperatureAlarm',
|
||||
value: '-',
|
||||
label: '驱动电机控制器温度报警'
|
||||
},
|
||||
driveMotorTemperatureAlarm: {
|
||||
key: 'driveMotorTemperatureAlarm',
|
||||
value: '-',
|
||||
label: '驱动电机温度报警'
|
||||
},
|
||||
energyStorageFaultCount: {
|
||||
key: 'energyStorageFaultCount',
|
||||
value: '-',
|
||||
label: '可充电储能装置故障总数'
|
||||
},
|
||||
dcDcStatusAlarm: {
|
||||
key: 'dcDcStatusAlarm',
|
||||
value: '-',
|
||||
label: 'DC-DC状态报警'
|
||||
},
|
||||
driveMotorFaultCount: {
|
||||
key: 'driveMotorFaultCount',
|
||||
value: '-',
|
||||
label: '驱动电机故障总数:'
|
||||
},
|
||||
engineFaultCount: {
|
||||
key: 'engineFaultCount',
|
||||
value: '-',
|
||||
label: '发动电机故障总数:'
|
||||
},
|
||||
temperatureDifferenceAlarm: {
|
||||
key: 'temperatureDifferenceAlarm',
|
||||
value: '-',
|
||||
label: '温度差异报警'
|
||||
},
|
||||
overVoltageAlarm: {
|
||||
key: 'overVoltageAlarm',
|
||||
value: '-',
|
||||
label: '车载储能装置过压报警'
|
||||
},
|
||||
lowSocAlarm: {
|
||||
key: 'lowSocAlarm',
|
||||
value: '-',
|
||||
label: 'SOC过低报警'
|
||||
},
|
||||
underVoltageSingleBatteryAlarm: {
|
||||
key: 'underVoltageSingleBatteryAlarm',
|
||||
value: '-',
|
||||
label: '单体电池欠压报警'
|
||||
},
|
||||
socJumpAlarm: {
|
||||
key: 'socJumpAlarm',
|
||||
value: '-',
|
||||
label: 'SOC跳变报警'
|
||||
},
|
||||
batteryInconsistencyAlarm: {
|
||||
key: 'batteryInconsistencyAlarm',
|
||||
value: '-',
|
||||
label: '电池单体一致性差报警'
|
||||
},
|
||||
highVoltageInterlockStatusAlarm: {
|
||||
key: 'highVoltageInterlockStatusAlarm',
|
||||
value: '-',
|
||||
label: '高压互锁状态报警'
|
||||
}
|
||||
} as any,
|
||||
tmpOptions3: {
|
||||
temperature: {
|
||||
key: 'temperature',
|
||||
value: '-',
|
||||
label: '电机温度'
|
||||
},
|
||||
controllerTemperature: {
|
||||
key: 'controllerTemperature',
|
||||
value: '-',
|
||||
label: '电机控制器温度'
|
||||
}
|
||||
} as any,
|
||||
tmpOptions4: {
|
||||
number: {
|
||||
key: 'number',
|
||||
value: '-',
|
||||
label: '序号'
|
||||
},
|
||||
status: {
|
||||
key: 'status',
|
||||
value: '-',
|
||||
label: '状态'
|
||||
},
|
||||
controllerTemperature: {
|
||||
key: 'controllerTemperature',
|
||||
value: '-',
|
||||
label: '控制器温度'
|
||||
},
|
||||
temperature: {
|
||||
key: 'temperature',
|
||||
value: '-',
|
||||
label: '温度'
|
||||
},
|
||||
torque: {
|
||||
key: 'torque',
|
||||
value: '-',
|
||||
label: '转矩'
|
||||
},
|
||||
inputVoltage: {
|
||||
key: 'inputVoltage',
|
||||
value: '-',
|
||||
label: '控制器输入电压'
|
||||
},
|
||||
dcBusCurrent: {
|
||||
key: 'dcBusCurrent',
|
||||
value: '-',
|
||||
label: '直流母线电流'
|
||||
}
|
||||
} as any,
|
||||
tmpOptions5: {
|
||||
compulsoryCompanyId_dictText: {
|
||||
key: 'compulsoryCompanyId_dictText',
|
||||
value: '-',
|
||||
label: '保险公司'
|
||||
},
|
||||
compulsoryStartTime: {
|
||||
key: 'compulsoryStartTime',
|
||||
value: '-',
|
||||
label: '起保日期'
|
||||
},
|
||||
compulsoryValidTime: {
|
||||
key: 'compulsoryValidTime',
|
||||
value: '-',
|
||||
label: '有效日期'
|
||||
},
|
||||
compulsoryInsuranceNo: {
|
||||
key: 'compulsoryInsuranceNo',
|
||||
value: '-',
|
||||
label: '交强险(保单号)'
|
||||
},
|
||||
compulsoryUrl: {
|
||||
key: 'compulsoryUrl',
|
||||
value: '-',
|
||||
label: '交强险'
|
||||
},
|
||||
commercialInsuranceNo: {
|
||||
key: 'commercialInsuranceNo',
|
||||
value: '-',
|
||||
label: '商业险(保单号)'
|
||||
},
|
||||
commercialUrl: {
|
||||
key: 'commercialUrl',
|
||||
value: '-',
|
||||
label: '商业险'
|
||||
}
|
||||
} as any
|
||||
},
|
||||
|
||||
init() {
|
||||
this.data.mapObj = wx.createMapContext('map-container');
|
||||
},
|
||||
showPopup() {
|
||||
this.setData({ show: true });
|
||||
this.init();
|
||||
},
|
||||
|
||||
onClose() {
|
||||
this.setData({ show: false });
|
||||
this.init();
|
||||
},
|
||||
changeTab(e: any) {
|
||||
console.log(e.currentTarget.dataset);
|
||||
this.setData({
|
||||
activeIndex: e.currentTarget.dataset.index
|
||||
});
|
||||
},
|
||||
reloadData() {
|
||||
this.getRealInfo();
|
||||
},
|
||||
// 导航
|
||||
navigate() {
|
||||
let mapCenter = this.data.mapCenter;
|
||||
this.data.mapObj.openMapApp({
|
||||
longitude: mapCenter.longitude,
|
||||
latitude: mapCenter.latitude,
|
||||
destination: this.data.address,
|
||||
fail: () => {
|
||||
wx.showToast({
|
||||
title: '获取定位失败,请开启定位服务',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
getAddress(position: any) {
|
||||
var _this = this;
|
||||
qqmapsdk.reverseGeocoder({
|
||||
location: position,
|
||||
success: function (res: any) {
|
||||
//成功后的回调
|
||||
console.log(res.result.address);
|
||||
// var res = res.result;
|
||||
_this.setData({
|
||||
address: res.result.address
|
||||
});
|
||||
_this.setMarker();
|
||||
}
|
||||
});
|
||||
},
|
||||
getRealInfo() {
|
||||
let parms = {
|
||||
plateNumber: wx.getStorageSync('selectCar').plateNumber
|
||||
};
|
||||
getAction('api/monitor/vehicle/realInfo', parms).then((res: any) => {
|
||||
if (res.code == 200) {
|
||||
console.log(res);
|
||||
this.getAddress({
|
||||
latitude: res.result.gdLat,
|
||||
longitude: res.result.gdLon
|
||||
});
|
||||
let tmpOptions = this.data.tmpOptions;
|
||||
let tmpOptions1 = this.data.tmpOptions1;
|
||||
for (let key in tmpOptions) {
|
||||
if (key != 'alert') {
|
||||
if (!res.result[key]) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
tmpOptions[key].value = res.result[key] ? res.result[key] : '-';
|
||||
tmpOptions[key].type = 'val';
|
||||
if (key == 'acc_dictText') {
|
||||
tmpOptions[key].type = 'online';
|
||||
tmpOptions[key].value = res.result.isOnline ? '点火' : '熄火';
|
||||
}
|
||||
if (key == 'isOnline') {
|
||||
tmpOptions[key].type = 'online';
|
||||
tmpOptions[key].value = res.result.isOnline ? '在线' : '离线';
|
||||
}
|
||||
|
||||
if (key == 'alert') {
|
||||
// "faultAlarm": 1, //故障报警 0-正常 1-异常
|
||||
// "fenceAlarm": 1, //围栏告警 0-正常 1-异常
|
||||
// "speedingAlarm": 1, //超速告警 0-正常 1-异常
|
||||
// "safetyAlarm": 1, //主动安全告警-0-正常 1-异常
|
||||
tmpOptions[key].type = 'errline';
|
||||
if (res.result.faultAlarm) {
|
||||
tmpOptions[key].value = res.result.faultAlarm ? '故障' : '';
|
||||
} else if (res.result.fenceAlarm) {
|
||||
tmpOptions[key].value = res.result.fenceAlarm ? '围栏' : '';
|
||||
} else if (res.result.speedingAlarm) {
|
||||
tmpOptions[key].value = res.result.speedingAlarm ? '超速' : '';
|
||||
} else if (res.result.safetyAlarm) {
|
||||
tmpOptions[key].value = res.result.safetyAlarm ? '主动安全' : '';
|
||||
} else {
|
||||
tmpOptions[key].type = 'offline';
|
||||
tmpOptions[key].value = '无告警';
|
||||
}
|
||||
}
|
||||
if (key == 'totalMileage') {
|
||||
tmpOptions[key].value += 'km';
|
||||
}
|
||||
if (key == 'maxRpm') {
|
||||
tmpOptions[key].value += 'r/min';
|
||||
}
|
||||
if (key == 'speed') {
|
||||
tmpOptions[key].value += 'km/h';
|
||||
}
|
||||
if (key == 'stateOfCharge') {
|
||||
tmpOptions[key].value += '%';
|
||||
}
|
||||
}
|
||||
|
||||
for (let key in tmpOptions1) {
|
||||
if (!res.result.vehicleJSONObject) {
|
||||
break;
|
||||
}
|
||||
if (!res.result.vehicleJSONObject[key]) {
|
||||
continue;
|
||||
}
|
||||
tmpOptions1[key].value = res.result.vehicleJSONObject[key]
|
||||
? res.result.vehicleJSONObject[key]
|
||||
: '-';
|
||||
|
||||
if (key == 'status') {
|
||||
// 1: '启动',
|
||||
// 2: '熄火',
|
||||
// 3: '其他',
|
||||
// '-99': '无效',
|
||||
// '-100': '异常'
|
||||
switch (res.result[key]) {
|
||||
case 1:
|
||||
tmpOptions1[key].value = '启动';
|
||||
break;
|
||||
case 2:
|
||||
tmpOptions1[key].value = '熄火';
|
||||
break;
|
||||
case 3:
|
||||
tmpOptions1[key].value = '其他';
|
||||
break;
|
||||
case -99:
|
||||
tmpOptions1[key].value = '无效';
|
||||
break;
|
||||
case -100:
|
||||
tmpOptions1[key].value = '异常';
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (key == 'chargeStatus') {
|
||||
// 1-停车充电、2-行驶充电、3-未充电 4-充电完成、-99-无效、-100-异常
|
||||
switch (res.result[key]) {
|
||||
case 1:
|
||||
tmpOptions1[key].value = '停车充电';
|
||||
break;
|
||||
case 2:
|
||||
tmpOptions1[key].value = '行驶充电';
|
||||
break;
|
||||
case 3:
|
||||
tmpOptions1[key].value = '未充电';
|
||||
break;
|
||||
case 4:
|
||||
tmpOptions1[key].value = '充电完成';
|
||||
break;
|
||||
case -99:
|
||||
tmpOptions1[key].value = '无效';
|
||||
break;
|
||||
case -100:
|
||||
tmpOptions1[key].value = '异常';
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (key == 'operatingMode') {
|
||||
// 运行模式 1-纯电 2-混动 3-燃油 -99-无效、-100-异常
|
||||
switch (res.result[key]) {
|
||||
case 1:
|
||||
tmpOptions1[key].value = '纯电';
|
||||
break;
|
||||
case 2:
|
||||
tmpOptions1[key].value = '混动';
|
||||
break;
|
||||
case 3:
|
||||
tmpOptions1[key].value = '燃油';
|
||||
break;
|
||||
case -99:
|
||||
tmpOptions1[key].value = '无效';
|
||||
break;
|
||||
case -100:
|
||||
tmpOptions1[key].value = '异常';
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (key == 'gearPosition') {
|
||||
tmpOptions1[key].value = res.result[key] ? res.result[key] : '-';
|
||||
}
|
||||
if (key == 'speed') {
|
||||
tmpOptions1[key].value += 'km/h';
|
||||
}
|
||||
if (key == 'stateOfCharge') {
|
||||
tmpOptions1[key].value += '%';
|
||||
}
|
||||
if (key == 'totalVoltage') {
|
||||
tmpOptions1[key].value += 'V';
|
||||
}
|
||||
if (key == 'totalCurrent') {
|
||||
tmpOptions1[key].value =
|
||||
Math.floor(tmpOptions1[key].value * 100) / 100;
|
||||
tmpOptions1[key].value += 'A';
|
||||
}
|
||||
if (key == 'insulationResistance') {
|
||||
tmpOptions1[key].value += 'kn';
|
||||
}
|
||||
if (key == 'dcDcStatus') {
|
||||
tmpOptions1[key].value =
|
||||
tmpOptions1[key].value == 1 ? '工作' : '断开';
|
||||
}
|
||||
if (key == 'totalMileage') {
|
||||
tmpOptions1[key].value =
|
||||
Math.floor(tmpOptions1[key].value * 100) / 100;
|
||||
}
|
||||
}
|
||||
let tmpOptions2 = this.data.tmpOptions2;
|
||||
for (let key in tmpOptions2) {
|
||||
if (!res.result.alarmDataJSONObject) {
|
||||
break;
|
||||
}
|
||||
if (
|
||||
res.result.alarmDataJSONObject[key] == undefined ||
|
||||
res.result.alarmDataJSONObject[key] == null
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
tmpOptions2[key].value = res.result.alarmDataJSONObject[key]
|
||||
? '报警'
|
||||
: '正常';
|
||||
|
||||
if (res.result.alarmDataJSONObject[key] == 1) {
|
||||
tmpOptions2[key].type = 'val-r';
|
||||
}
|
||||
|
||||
if (key == 'maxAlarmLevel') {
|
||||
tmpOptions2[key].value =
|
||||
res.result.alarmDataJSONObject[key] + '级别';
|
||||
tmpOptions2[key].type = '';
|
||||
}
|
||||
if (key == 'energyStorageFaultCount') {
|
||||
tmpOptions2[key].value = res.result.alarmDataJSONObject[key]
|
||||
? res.result.alarmDataJSONObject[key]
|
||||
: '0';
|
||||
tmpOptions2[key].type = '';
|
||||
}
|
||||
if (key == 'engineFaultCount') {
|
||||
tmpOptions2[key].value = res.result.alarmDataJSONObject[key]
|
||||
? res.result.alarmDataJSONObject[key]
|
||||
: '0';
|
||||
tmpOptions2[key].type = '';
|
||||
}
|
||||
if (key == 'driveMotorFaultCount') {
|
||||
tmpOptions2[key].value = res.result.alarmDataJSONObject[key]
|
||||
? res.result.alarmDataJSONObject[key]
|
||||
: '0';
|
||||
tmpOptions2[key].type = '';
|
||||
}
|
||||
}
|
||||
|
||||
let tmpOptions3 = this.data.tmpOptions3;
|
||||
for (let key in tmpOptions3) {
|
||||
if (!res.result.electricMotorJSONArray) {
|
||||
break;
|
||||
}
|
||||
console.log(key, res.result.electricMotorJSONArray[0]);
|
||||
tmpOptions3[key].value = res.result.electricMotorJSONArray[0][key]
|
||||
? res.result.electricMotorJSONArray[0][key]
|
||||
: '-';
|
||||
|
||||
tmpOptions3[key].value += '℃';
|
||||
}
|
||||
let tabs = this.data.tabs;
|
||||
if (res.result.electricMotorJSONArray) {
|
||||
res.result.electricMotorJSONArray.map((x: any) => {
|
||||
let tmpOptions4 = this.data.tmpOptions4;
|
||||
for (let key in tmpOptions4) {
|
||||
tmpOptions4[key].value = x[key] ? x[key] : '-';
|
||||
if (key == 'controllerTemperature' || key == 'temperature') {
|
||||
tmpOptions4[key].value += '℃';
|
||||
}
|
||||
if (key == 'inputVoltage') {
|
||||
tmpOptions4[key].value += 'V';
|
||||
}
|
||||
if (key == 'dcBusCurrent') {
|
||||
if (tmpOptions4[key].value.indexOf('A') == -1) {
|
||||
tmpOptions4[key].value += 'A';
|
||||
}
|
||||
}
|
||||
if (key == 'rpm') {
|
||||
tmpOptions4[key].value += 'r/min';
|
||||
}
|
||||
if (key == 'dcBusCurrent') {
|
||||
tmpOptions4[key].value += 'A';
|
||||
}
|
||||
}
|
||||
tabs.push({
|
||||
tabName: '驱动电机' + x.number,
|
||||
options: tmpOptions4
|
||||
});
|
||||
});
|
||||
}
|
||||
tabs.push({
|
||||
tabName: '保险信息'
|
||||
});
|
||||
let tmpOptions5 = this.data.tmpOptions5;
|
||||
for (let key in tmpOptions5) {
|
||||
if (key == 'compulsoryUrl' || key == 'commercialUrl') {
|
||||
if (res.result.insuranceInfo[key]) {
|
||||
let list = res.result.insuranceInfo[key].split(',');
|
||||
tmpOptions5[key].value = list.map((item: string) => {
|
||||
return {
|
||||
label: item.split('/')[item.split('/').length - 1],
|
||||
url: item
|
||||
};
|
||||
});
|
||||
} else tmpOptions5[key].value = res.result.insuranceInfo[key];
|
||||
} else tmpOptions5[key].value = res.result.insuranceInfo[key];
|
||||
}
|
||||
console.log(tabs);
|
||||
this.setData({
|
||||
tabs: tabs,
|
||||
infObj: res.result,
|
||||
tmpOptions: tmpOptions,
|
||||
tmpOptions1: tmpOptions1,
|
||||
tmpOptions2: tmpOptions2,
|
||||
tmpOptions3: tmpOptions3,
|
||||
tmpOptions5: tmpOptions5,
|
||||
mapCenter: {
|
||||
latitude: res.result.gdLat,
|
||||
longitude: res.result.gdLon
|
||||
},
|
||||
setting: { scale: 10 }
|
||||
});
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: res.message,
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
setMarker() {
|
||||
let tmp = [] as any;
|
||||
let imgUrl = '../../../images/car_select.png';
|
||||
tmp.push({
|
||||
id: 0,
|
||||
latitude: this.data.infObj.gdLat,
|
||||
longitude: this.data.infObj.gdLon,
|
||||
iconPath: imgUrl,
|
||||
anchor: {
|
||||
// 经纬度在标注图标的锚点,
|
||||
x: 0.5,
|
||||
y: 1
|
||||
},
|
||||
width: 48,
|
||||
height: 55,
|
||||
label: {
|
||||
content: this.data.address,
|
||||
color: '#FFFFFF',
|
||||
display: 'ALWAYS',
|
||||
fontSize: 13,
|
||||
borderRadius: 4,
|
||||
bgColor: '#2C6AF3',
|
||||
textAlign: 'center',
|
||||
anchorY: 20,
|
||||
padding: 8
|
||||
}
|
||||
});
|
||||
console.log(tmp);
|
||||
this.setData({
|
||||
carMarkers: tmp
|
||||
});
|
||||
},
|
||||
|
||||
// 查看文件
|
||||
checkFile(event: any) {
|
||||
let url = event.currentTarget.dataset.url;
|
||||
let type = url.split('.')[url.split('.').length - 1];
|
||||
if (type == 'jpg' || type == 'jpeg' || type == 'png') {
|
||||
wx.previewImage({
|
||||
current: url, // 当前显示图片的http链接
|
||||
urls: [url] // 需要预览的图片http链接列表
|
||||
});
|
||||
} else {
|
||||
wx.showLoading({
|
||||
title: '数据加载中'
|
||||
});
|
||||
wx.downloadFile({
|
||||
// 示例 url,并非真实存在
|
||||
url: url,
|
||||
success: function (res) {
|
||||
const filePath = res.tempFilePath;
|
||||
wx.openDocument({
|
||||
filePath: filePath,
|
||||
showMenu: true,
|
||||
success: function (res) {
|
||||
wx.hideLoading();
|
||||
},
|
||||
fail: function () {
|
||||
wx.hideLoading();
|
||||
}
|
||||
});
|
||||
},
|
||||
fail: function () {
|
||||
wx.hideLoading();
|
||||
}
|
||||
});
|
||||
}
|
||||
console.log(url);
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad() {
|
||||
this.setData({
|
||||
tabs: [
|
||||
{
|
||||
tabName: '实时状态'
|
||||
},
|
||||
{
|
||||
tabName: '整车数据'
|
||||
},
|
||||
{
|
||||
tabName: '报警数据'
|
||||
},
|
||||
{
|
||||
tabName: '电机'
|
||||
}
|
||||
]
|
||||
});
|
||||
this.getRealInfo();
|
||||
this.init();
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {}
|
||||
});
|
||||
@@ -0,0 +1,74 @@
|
||||
<!--pages/vehicleMonitoring/realtime/realtime.wxml-->
|
||||
<view class="container">
|
||||
<map id="map-container" class="{{show ? '' : 'h100'}}" longitude="{{mapCenter.longitude}}" latitude="{{mapCenter.latitude}}" markers="{{carMarkers}}" include-points="{{carMarkers}}" scale="{{setting.scale}}" setting="{{setting}}" name="" bindmarkertap="showPopup">
|
||||
</map>
|
||||
<view class="reload btn" catch:tap="reloadData">
|
||||
<image src="../../../images/icon_reload.png" mode="" />
|
||||
</view>
|
||||
<view class="navigation btn" catch:tap="navigate">
|
||||
<image src="../../../images/icon_navigation.png" mode="" />
|
||||
</view>
|
||||
|
||||
<van-popup show="{{ show }}" round custom-style="box-shadow: 0px 0px 16px 0px rgba(0,0,0,0.1);" overlay-style="display: none;" position="bottom" custom-style="height: 70%;" bind:close="onClose">
|
||||
<view class="inf-container">
|
||||
<view class="top" catch:tap="onClose" capture-catch:touchmove="">
|
||||
<view class="line"></view>
|
||||
</view>
|
||||
<view class="base-inf">
|
||||
<view class="row">
|
||||
<view class="number-plate">{{infObj.plateNumber}}</view>
|
||||
<view class="code">{{infObj.vinCode}}</view>
|
||||
</view>
|
||||
<view class="row">
|
||||
<view class="project-name">{{infObj.projectId_dictText}}</view>
|
||||
<view class="car-type">
|
||||
{{infObj.vehicleType_dictText ? infObj.vehicleType_dictText : '车辆型号未知'}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="detail-inf">
|
||||
<view class="sidebar">
|
||||
<view class="item {{ activeIndex == index ? 'select' : '' }}" wx:for="{{ tabs }}" wx:key="index" data-index="{{index}}" data-inf="{{item}}" catch:tap="changeTab">
|
||||
{{item.tabName}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="content">
|
||||
<view class="row" wx:if="{{activeIndex == 0}}" wx:for="{{ tmpOptions }}" wx:key="index" data-index="{{index}}">
|
||||
<view class="label">{{item.label}}</view>
|
||||
<view class="val {{item.type == 'val' ? '' : item.type}}">{{item.value}}</view>
|
||||
</view>
|
||||
<view class="row" wx:if="{{activeIndex == 1}}" wx:for="{{ tmpOptions1 }}" wx:key="index" data-index="{{index}}">
|
||||
<view class="label">{{item.label}}</view>
|
||||
<view class="val {{item.type == 'val' ? '' : item.type}}">{{item.value}}</view>
|
||||
</view>
|
||||
<view class="row" wx:if="{{activeIndex == 2}}" wx:for="{{ tmpOptions2 }}" wx:key="index" data-index="{{index}}">
|
||||
<view class="label">{{item.label}}</view>
|
||||
<view class="val {{item.type == 'val' ? '' : item.type}}">{{item.value}}</view>
|
||||
</view>
|
||||
<view class="row" wx:if="{{activeIndex == 3}}" wx:for="{{ tmpOptions3 }}" wx:key="index" data-index="{{index}}">
|
||||
<view class="label">{{item.label}}</view>
|
||||
<view class="val {{item.type == 'val' ? '' : item.type}}">{{item.value}}</view>
|
||||
</view>
|
||||
<view class="row" wx:if="{{activeIndex > 3 && activeIndex < tabs.length - 1}}" wx:for="{{ tabs[activeIndex].options }}" wx:key="index" data-index="{{index}}">
|
||||
<view class="label">{{item.label}}</view>
|
||||
<view class="val {{item.type == 'val' ? '' : item.type}}">{{item.value}}</view>
|
||||
</view>
|
||||
<!-- 保险信息 -->
|
||||
<view class="row" wx:if="{{activeIndex == tabs.length - 1}}" wx:for="{{ tmpOptions5 }}" wx:key="index" data-index="{{index}}">
|
||||
<view class="label">{{item.label}}</view>
|
||||
<view class="val width74" wx:if="{{item.key != 'compulsoryUrl' && item.key != 'commercialUrl'}}">{{item.value || '-'}}</view>
|
||||
<view wx:else class="fileList">
|
||||
<block wx:if="{{item.value}}">
|
||||
<view wx:for="{{ item.value }}" wx:for-item='file' class="file">
|
||||
<view class="val label" catch:tap="checkFile" data-url="{{file.url}}">{{file.label}}</view>
|
||||
<!-- <view class="check" catch:tap="checkFile" data-url="{{file.url}}">查看</view> -->
|
||||
</view>
|
||||
</block>
|
||||
<view wx:else style="text-align: right;">-</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</van-popup>
|
||||
</view>
|
||||
Reference in New Issue
Block a user