Quellcode durchsuchen

feat

- c1后台设备功耗查看页面
    - 增加 设备状态查看菜单
    - 优化 设备离线行为查看明细,增加最近离线时间
develop
chenJinxu vor 11 Monaten
Ursprung
Commit
320a84fdce
5 geänderte Dateien mit 401 neuen und 48 gelöschten Zeilen
  1. +8
    -1
      README.md
  2. +1
    -1
      src/config/models.js
  3. +5
    -0
      src/views/gps-card-frontend/device-power/index.scss
  4. +32
    -11
      src/views/gps-card-frontend/device-power/index.vue
  5. +355
    -35
      src/views/gps-card-frontend/device-setting/index.vue

+ 8
- 1
README.md Datei anzeigen

@@ -837,4 +837,11 @@ update
`2023.12.5`
update
- 心理监测首页
- 区分 测试和正式环境接口地址
- 区分 测试和正式环境接口地址

## v1.0.106
`2023.12.7`
feat
- c1后台设备功耗查看页面
- 增加 设备状态查看菜单
- 优化 设备离线行为查看明细,增加最近离线时间

+ 1
- 1
src/config/models.js Datei anzeigen

@@ -5,7 +5,7 @@
* @FilePath: \TelpoH5FrontendWeb\src\config\models.js
* @description:
*/
export const VERSION_MODEL = '1.0.105F'; //版本号
export const VERSION_MODEL = '1.0.106F'; //版本号
export const IMAGE_URL = {
production: 'http://zfb.ssjlai.com/web/',
test: 'http://zfb.ssjlai.com/web/',


+ 5
- 0
src/views/gps-card-frontend/device-power/index.scss Datei anzeigen

@@ -51,6 +51,11 @@
max-height: 500px;
overflow: scroll;
}
.last-time {
text-align: left;
font-weight: bold;
padding-left: 1px;
}
.echart {
height: 30%;
padding: 0 5px;


+ 32
- 11
src/views/gps-card-frontend/device-power/index.vue Datei anzeigen

@@ -24,11 +24,12 @@
</div>
<div class="right">
<div class="btn-container">
<van-button :class="['btn', {active: btnActive ===item.index }]" @click="onClickBtn(item.index)" v-for="(item, index) in btnList" :key="index">{{ item.text }}</van-button>
<van-button :class="['btn', {active: btnActive === item.index }]" @click="onClickBtn(item.index)" v-for="(item, index) in btnList" :key="index">{{ item.text }}</van-button>
</div>
</div>
</div>
<div class="details-container" v-if="btnActive === 0 && data.length > 0 || tableData.length > 0 && btnActive === 1">
<p class="last-time" v-show="btnActive === 0 && params.title === 'Offline'">最近一次离线时间:{{ lastTime }}</p>
<Echart :option="chartOption" v-show="btnActive === 0"/>
<Table :columns="titleList" :data="tableData" v-show="btnActive === 1"/>
</div>
@@ -72,18 +73,20 @@ export default {
data: [],
xAxisData: [],
filterData: [],
yAxisObject: {}
yAxisObject: {},
lastTime: '',
params: {}
}
},
created() {
this.loadParams();
},
mounted() {
this.loadParams();
},
methods: {
loadParams() {
let params = this.$route.query;
this.params = {...params};
if(params) {
this.echarts.title = DEVICE_POWER[params.title].title;
this.echarts.type = DEVICE_POWER[params.title].value;
@@ -157,7 +160,8 @@ export default {
} else if (this.echarts.type === 'offline') {
// 设备离线次数
this.titleList = [
{ title: '时间', width: '60%', key: 'time'},
{ title: '时间', width: '40%', key: 'time'},
{ title: '最近离线时间', width: '60%', key: 'lastTime' },
{ title: '离线次数', width: '40%', key: 'value' },
],
this.yAxisObject = {
@@ -168,36 +172,49 @@ export default {
splitNumber : 1,
boundaryGap : [ '5%', '5%' ], */
};
this.data = this.filterData.map(item => {
this.data = this.filterData.sort((date1, date2) => {
// 日期升序排序
return date2.time < date1.time ? 1 : -1
}).map(item => {
return {
/* value: item.value, */
time: item.createTime.slice(0,10),
day: item.createTime.slice(0,10),
type: 'offline'
type: 'offline',
lastTime: item.createTime.replace('T', ' ')
}
}).reduce((accumulator, currentValue) => {
if (accumulator.find(obj => obj.day === currentValue.day)) {
accumulator.find(obj => obj.day === currentValue.day).value++;
} else {
accumulator.push({ day: currentValue.day, time: currentValue.time, value: 1, type: 'offline' });
accumulator.push({ day: currentValue.day, time: currentValue.time, value: 1, type: 'offline', lastTime: currentValue.lastTime });
}
return accumulator;
}, []).sort(function(date1, date2) {
// 日期升序排序
return date2.time < date1.time ? 1 : -1
});
this.tableData = this.filterData.map(item => {
console.log("data", this.data);
console.log(this.data);
this.lastTime = this.data && this.data[this.data.length - 1].lastTime || '';

this.tableData = this.filterData/* .sort((date1, date2) => {
// 日期升序排序
return date2.time > date1.time ? 1 : -1
}). */.map(item => {
return {
/* value: item.value, */
time: item.createTime.slice(0,10),
day: item.createTime.slice(0,10)
day: item.createTime.slice(0,10),
lastTime: item.createTime.replace('T', ' ')
}
}).reduce((accumulator, currentValue) => {
// 筛选遍历数据,获取相同日期的数据,计算出现的次数后重新累加组合到一个新的数组里面
if (accumulator.find(obj => obj.day === currentValue.day)) {
accumulator.find(obj => obj.day === currentValue.day).value++;
} else {
accumulator.push({ day: currentValue.day, time: currentValue.time, value: 1 });
accumulator.push({ day: currentValue.day, time: currentValue.time, value: 1, lastTime: currentValue.lastTime });
}
return accumulator;
}, []).sort(function(date1, date2) {
@@ -244,6 +261,9 @@ export default {
this.chartOption = {
title: {
text: this.echarts.title,
textStyle: {
fontSize: 16
},
},
xAxis: {
type: "category",
@@ -305,6 +325,7 @@ export default {
},
formatter: function(params) {
return `${params[0].marker}${params[0].data.time}</br>
${ params[0].data.type === 'offline' ? '最近离线时间:' + params[0].data.lastTime : ''}</br>
${ params[0].data.type === 'offline' ? '离线次数:' + params[0].data.value + '次' :
params[0].data.type === 'status' ? 'rssi值:' + params[0].data.value :
'电量:' + params[0].data.value}`


+ 355
- 35
src/views/gps-card-frontend/device-setting/index.vue Datei anzeigen

@@ -15,7 +15,7 @@
<customCell :title="child.name" :value="child.value" :click="child.router"/>
</div>
</div>
<div class="power" v-show="active === 10 || active === 11 || active === 12">
<div class="power" v-show="active === 11 || active === 12 || active === 13">
<van-button @click="onClick(active)">点击查看</van-button>
</div>
</template>
@@ -28,6 +28,7 @@
import customCell from '@/components/custom-cell/index';
import { isNotNull} from "@/utils/index";
import APICore from "@/api/core";
import axios from 'axios';
export default {
name:'',
components: { customCell },
@@ -35,16 +36,16 @@ export default {
return {
active: 0,
settingItems: [
{ text: '监护角色', index: 0, data: [],},
{ text: '场景模式', index: 1, data: []},
{ text: '加强省电模式', index: 2, data: []},
{ text: '定位监测', index: 3, data: []},
{ text: '危险区域监测', index: 4, data: [] },
{ text: '健康监测', index: 5, data: []},
{ text: '血压监测', index: 6, data: []},
{ text: '心理监测', index: 7, data: []},
{ text: '佩戴监测', index: 8, data: []},
/* { text: '久坐提醒', index: 9, data: []}, */
{ text: '设备状态', index: 0, data: [],},
{ text: '监护角色', index: 1, data: [],},
{ text: '场景模式', index: 2, data: []},
{ text: '加强省电模式', index: 3, data: []},
{ text: '定位监测', index: 4, data: []},
{ text: '危险区域监测', index: 5, data: [] },
{ text: '健康监测', index: 6, data: []},
{ text: '血压监测', index: 7, data: []},
{ text: '心理监测', index: 8, data: []},
{ text: '佩戴监测', index: 9, data: []},
{ text: '上报周期', index: 10, data: []},
{ text: '电量查看', index: 11, data: []},
{ text: '设备信号强度查看', index: 12, data: []},
@@ -64,7 +65,7 @@ export default {
this.getUrlQueryParams();
},
mounted() {
this.$toast.loading({message: "加载中"});
/* this.$toast.loading({message: "加载中"});
this.getWatchConfig();
this.getIotCtlMode();
this.getLocationConfig();
@@ -76,9 +77,45 @@ export default {
this.getUploadConfig();
this.clientHeight = document.documentElement.clientHeight;
this.active = Number(this.$store.getters.active) || 0;
this.$toast.success({message: "加载完成"});
this.$toast.success({message: "加载完成"}); */
//this.loadRequest();
this.loadRequest();
},
methods: {
// 加载接口
async loadRequest() {
this.$toast.loading({
message: '数据加载中',
duration: 0
});
this.clientHeight = document.documentElement.clientHeight;
this.active = Number(this.$store.getters.active) || 0;
const allPromise = [
this.getDeviceStatus(),
this.getWatchConfig(),
this.getIotCtlMode(),
this.getLocationConfig(),
this.getDrownConfig(),
this.getHealthConfig(),
this.getBloodConfig(),
this.getPsychAbilityConfig(),
this.getNowearConfig(),
this.getUploadConfig(),
];
const promise = Promise.all(allPromise);
try {
const result = await promise;
if(result) {
this.$toast.success({
message: '数据加载完成',
duration: 2000
});
}
} catch(error){
console.log('error', error);
this.$toast.clear();
}
},
// 获取b端接口的token
getAuth() {
let manufactorId = "5bf13062-a41e-4d00-ba14-1101aad12650";
@@ -98,7 +135,7 @@ export default {
},
// 获取设备场景模式参数
getWatchConfig() {
APICore.getWatchConfig({imei: this.imei}).then(res => {
/* APICore.getWatchConfig({imei: this.imei}).then(res => {
let data = res.data.data;
if(data) {
const modeId = data.modeId;
@@ -110,9 +147,34 @@ export default {
} else {
this.settingItems[0].text = `监护角色(无数据)`;
this.settingItems[1].text = `场景模式(无数据)`;
/* this.modeId = 1;
this.roleId = 1; */
}
}) */
return new Promise((resolve, reject) => {
APICore.getWatchConfig({imei: this.imei}).then(res => {
let data = res.data.data;
let roleViewIndex = 1;
let modeViewIndex = 2;
let roleIndex = this.settingItems.findIndex(item => {
return item.index === roleViewIndex
});
let modeIndex = this.settingItems.findIndex(item => {
return item.index === modeViewIndex
});
if(data) {
const modeId = data.modeId;
const roleId = data.roleId;
this.modeId = data.modeId;
this.roleId = data.roleId;
this.settingItems[roleIndex].text = `监护角色(${roleId === 1 ? '学生' : '老人'})`;
this.settingItems[modeIndex].text = `场景模式(${this.getModeById(modeId)})`;
} else {
this.settingItems[roleIndex].text = `监护角色(无数据)`;
this.settingItems[modeIndex].text = `场景模式(无数据)`;
/* this.modeId = 1;
this.roleId = 1; */
};
resolve(true);
})
})
},
// 通过模式id获取场景模式
@@ -131,7 +193,7 @@ export default {
},
// 获取加强省电模式参数配置
getIotCtlMode() {
APICore.getIotCtlMode(this.imei).then(res => {
/* APICore.getIotCtlMode(this.imei).then(res => {
let data = res.data.data;
if(data) {
this.checked = data.mode === 1;
@@ -142,11 +204,30 @@ export default {
} else {
this.settingItems[2].text = this.concatTitle('加强省电模式','关闭', '耗电低');
}
}) */
return new Promise((resolve) => {
APICore.getIotCtlMode(this.imei).then(res => {
let data = res.data.data;
let index = 3;
let findIndex = this.settingItems.findIndex(item => {
return item.index === index
});
if(data) {
this.checked = data.mode === 1;
this.settingItems[findIndex].text = this.concatTitle('加强省电模式', data.mode === 1 ? '打开' : '关闭', data.mode === 1 ? '耗电高' : '耗电低');
this.settingItems[findIndex].data = [
{ name: '开启状态:', value: data.enabled === 1 ? '打开': '关闭' },
];
} else {
this.settingItems[findIndex].text = this.concatTitle('加强省电模式','关闭', '耗电低');
}
});
resolve(true)
})
},
// 获取设备定位参数
getLocationConfig() {
APICore.getLocationConfig({imei: this.imei}).then(res => {
/* APICore.getLocationConfig({imei: this.imei}).then(res => {
let data = res.data.data;
if(data) {
this.settingItems[3].text = this.concatTitle('定位监测', data.enabled === 1 ? '打开': '关闭', data.enabled === 1 ? '耗电高' : '耗电低');
@@ -157,6 +238,25 @@ export default {
} else {
this.settingItems[3].text = this.concatTitle('定位监测','关闭', '耗电低');
}
}); */
return new Promise(resolve => {
APICore.getLocationConfig({imei: this.imei}).then(res => {
let data = res.data.data;
let index = 4;
let findIndex = this.settingItems.findIndex(item => {
return item.index === index
});
if(data) {
this.settingItems[findIndex].text = this.concatTitle('定位监测', data.enabled === 1 ? '打开': '关闭', data.enabled === 1 ? '耗电高' : '耗电低');
this.settingItems[findIndex].data = [
{ name: '开启状态:', value: data.enabled === 1 ? '打开': '关闭' },
{ name: '检测周期:', value: data.sampleinteval + '分钟' },
];
} else {
this.settingItems[findIndex].text = this.concatTitle('定位监测','关闭', '耗电低');
}
});
resolve(true)
})
},
// 获取免告警水域
@@ -174,7 +274,7 @@ export default {
},
// 获取设备危险区域参数
getDrownConfig() {
APICore.getDrownConfig({imei: this.imei}).then(res => {
/* APICore.getDrownConfig({imei: this.imei}).then(res => {
let data = res.data.data;
if(data) {
this.settingItems[4].text = this.concatTitle('危险区域监测', data.config.enabled === 1 ? '打开': '关闭', data.config.enabled === 1 ? '耗电高' : '耗电低');
@@ -193,6 +293,33 @@ export default {
this.settingItems[4].text = this.concatTitle('危险区域监测','关闭', '耗电低');
this.settingItems[4].data = [];
}
}); */
return new Promise(resolve => {
APICore.getDrownConfig({imei: this.imei}).then(res => {
let data = res.data.data;
let index = 5;
let findIndex = this.settingItems.findIndex(item => {
return item.index === index
});
if(data) {
this.settingItems[findIndex].text = this.concatTitle('危险区域监测', data.config.enabled === 1 ? '打开': '关闭', data.config.enabled === 1 ? '耗电高' : '耗电低');
this.settingItems[findIndex].data = [
{ name: '涉水监测:', value: data.config.enabled === 1 ? '打开': '关闭' },
{ name: '检测周期:', value: data.config.intervallvl1 + data.config.intervallvl2 + '分钟' },
{ name: '告警阈值:', value: data.config.warningdistance + '米' },
{ name: '涉水停留告警间隔:', value: (data.config.distancelvl2 / 60) + '分钟' },
{ name: '告警提示持续次数:', value: data.config.warningtimes + '次' },
{ name: '首次告警逗留设置:', value: data.config.delaytimes + '次' },
{ name: '时速免告警(≥):', value: data.config.ignorespeed + '公里' },
{ name: '免告警水域:', value: '查看', router: 'drownWhiteList' },
{ name: '告警方式:', value: `${data.config.vibrateenabled === 1 ? '震动' : '无'} , ${data.config.lcdenabled === 1 ? '亮屏' : '无'} , ${data.config.musicenabled === 1 ? '声音' : '无'}`},
];
} else {
this.settingItems[findIndex].text = this.concatTitle('危险区域监测','关闭', '耗电低');
this.settingItems[findIndex].data = [];
}
});
resolve(true);
})
},

@@ -202,7 +329,7 @@ export default {
},
// 获取设备健康参数
getHealthConfig() {
APICore.getHealthConfig({imei: this.imei}).then(res => {
/* APICore.getHealthConfig({imei: this.imei}).then(res => {
let data = res.data.data;
if(data) {
let healthEnablelist = [
@@ -220,7 +347,6 @@ export default {
{ name: '体温监测:', value: config.temperatureenabled === 1 ? '打开': '关闭' },
{ name: '检测周期:', value: this.formatInteval(config.temperatureinteval) },
{ name: '告警阈值-高温:', value: (config.temperaturemaxvalue / 10) + '度' },
/* { name: '告警阈值-低温:', value: config.temperatureminvalue + '度' }, */
{ name: '告警方式:', value: `${config.temperaturevibrateenabled === 1 ? '震动' : '无'} , ${config.temperaturelcdenabled === 1 ? '亮屏' : '无'}`},

{ name: '心率监测:', value: config.heartrateenabled === 1 ? '打开': '关闭' },
@@ -232,18 +358,62 @@ export default {
{ name: '血氧监测:', value: config.spo2enabled === 1 ? '打开': '关闭' },
{ name: '检测周期:', value: this.formatInteval(config.spo2inteval) },
{ name: '告警阈值-低于:', value: config.spo2minvalue + '%' },
/* { name: '告警阈值-低温:', value: config.temperatureminvalue + '度' }, */
{ name: '告警方式:', value: `${config.spo2vibrateenabled === 1 ? '震动' : '无'} , ${config.spo2lcdenabled === 1 ? '亮屏' : '无'}`},
]
} else {
this.settingItems[5].text = this.concatTitle('健康监测','关闭', '耗电低');
this.settingItems[5].data = [];
}
}); */
return new Promise(resolve => {
APICore.getHealthConfig({imei: this.imei}).then(res => {
let data = res.data.data;
let index = 6;
let findIndex = this.settingItems.findIndex(item => {
return item.index === index
});
if(data) {
let healthEnablelist = [
{ enabled: data.config.heartrateenabled},
{ enabled: data.config.spo2enabled},
{ enabled: data.config.temperatureenabled},
];
let config = data.config;
// 获取健康设置打开的次数
const healthSettingCount = healthEnablelist.reduce((acc, cur) => cur.enabled === 1 ? ++acc : acc, 0);
this.settingItems[findIndex].text = this.concatTitle('健康监测', healthSettingCount >= 3 ? '打开'
: healthSettingCount >= 1 ? '部分'
: '关闭', healthSettingCount > 2 ? '耗电高': healthSettingCount === 2 ? '耗电中': '耗电低');
this.settingItems[findIndex].data = [
{ name: '体温监测:', value: config.temperatureenabled === 1 ? '打开': '关闭' },
{ name: '检测周期:', value: this.formatInteval(config.temperatureinteval) },
{ name: '告警阈值-高温:', value: (config.temperaturemaxvalue / 10) + '度' },
/* { name: '告警阈值-低温:', value: config.temperatureminvalue + '度' }, */
{ name: '告警方式:', value: `${config.temperaturevibrateenabled === 1 ? '震动' : '无'} , ${config.temperaturelcdenabled === 1 ? '亮屏' : '无'}`},

{ name: '心率监测:', value: config.heartrateenabled === 1 ? '打开': '关闭' },
{ name: '检测周期:', value: this.formatInteval(config.heartrateinteval) },
{ name: '告警阈值-上限:', value: config.heartratemaxvalue + '次' },
{ name: '告警阈值-下限:', value: config.heartrateminvalue + '次' },
{ name: '告警方式:', value: `${config.heartratevibrateenabled === 1 ? '震动' : '无'} , ${config.heartratelcdenabled === 1 ? '亮屏' : '无'}`},

{ name: '血氧监测:', value: config.spo2enabled === 1 ? '打开': '关闭' },
{ name: '检测周期:', value: this.formatInteval(config.spo2inteval) },
{ name: '告警阈值-低于:', value: config.spo2minvalue + '%' },
/* { name: '告警阈值-低温:', value: config.temperatureminvalue + '度' }, */
{ name: '告警方式:', value: `${config.spo2vibrateenabled === 1 ? '震动' : '无'} , ${config.spo2lcdenabled === 1 ? '亮屏' : '无'}`},
]
} else {
this.settingItems[findIndex].text = this.concatTitle('健康监测','关闭', '耗电低');
this.settingItems[findIndex].data = [];
}
});
resolve(true);
})
},
// 获取血压监测参数设置
getBloodConfig() {
APICore.getBloodPressConfig({imei: this.imei}).then(res => {
/* APICore.getBloodPressConfig({imei: this.imei}).then(res => {
let data = res.data.data;
if(data) {
this.settingItems[6].text = this.concatTitle('血压监测', data.bloodPressenabled === 1 ? '打开': '关闭', data.bloodPressenabled === 1 ? '耗电高' : '耗电低');
@@ -257,6 +427,28 @@ export default {
this.settingItems[6].text = this.concatTitle('血压监测','关闭', '耗电低');
this.settingItems[6].data = [];
}
}); */
return new Promise(resolve => {
APICore.getBloodPressConfig({imei: this.imei}).then(res => {
let data = res.data.data;
let index = 7;
let findIndex = this.settingItems.findIndex(item => {
return item.index === index
});
if(data) {
this.settingItems[findIndex].text = this.concatTitle('血压监测', data.bloodPressenabled === 1 ? '打开': '关闭', data.bloodPressenabled === 1 ? '耗电高' : '耗电低');
this.settingItems[findIndex].data = [
{ name: '血压监测:', value: data.bloodPressenabled === 1 ? '打开': '关闭' },
{ name: '检测周期:', value: this.formatInteval(data.bloodPressinteval) },
{ name: '告警阈值-收缩压:', value: String(data.systolicmaxvalue)},
{ name: '告警方式:', value: `${data.bloodPressvibrateenabled === 1 ? '震动' : '无'} ,${data.bloodPresslcdenabled === 1 ? '亮屏' : '无'}`},
]
} else {
this.settingItems[findIndex].text = this.concatTitle('血压监测','关闭', '耗电低');
this.settingItems[findIndex].data = [];
}
});
resolve(true);
})
},
// 格式化等级
@@ -280,7 +472,7 @@ export default {
},
// 获取心理监测参数设置
getPsychAbilityConfig() {
APICore.getPsychAbilityConfig({imei: this.imei}).then(res => {
/* APICore.getPsychAbilityConfig({imei: this.imei}).then(res => {
let data = res.data.data;
if (data) {
this.settingItems[7].text = this.concatTitle('心理监测', data.enabled === 1 ? '打开': '关闭', data.enabled === 1 ? '耗电高' : '耗电低');
@@ -298,6 +490,32 @@ export default {
this.settingItems[7].text = this.concatTitle('心理监测', '关闭', '耗电低');
this.settingItems[7].data = [];
}
}); */
return new Promise(resolve => {
APICore.getPsychAbilityConfig({imei: this.imei}).then(res => {
let data = res.data.data;
let index = 8;
let findIndex = this.settingItems.findIndex(item => {
return item.index === index
});
if (data) {
this.settingItems[findIndex].text = this.concatTitle('心理监测', data.enabled === 1 ? '打开': '关闭', data.enabled === 1 ? '耗电高' : '耗电低');
this.settingItems[findIndex].data = [
{ name: '心理监测:', value: data.enabled === 1 ? '打开': '关闭' },
{ name: '设备显示:', value: data.device_display === 1 ? '打开': '关闭' },
{ name: '监测时段:', value: this.formatTimeArea(data.time_area) },
{ name: '提醒设置:', value: data.reminder_setting.enable === 1 ? '打开': '关闭' },
{ name: '抑郁等级:', value: this.formatReminder(data.reminder_setting.setting.depressive) },
{ name: '压力等级:', value: this.formatReminder(data.reminder_setting.setting.pressure) },
{ name: '疲劳等级:', value: this.formatReminder(data.reminder_setting.setting.fatigue) },
{ name: '告警方式:', value: `${data.vibrating_screen === 1 ? '震动' : '无'}, ${data.brightening_screen === 1 ? '亮屏' : '无'}`},
]
} else {
this.settingItems[findIndex].text = this.concatTitle('心理监测', '关闭', '耗电低');
this.settingItems[findIndex].data = [];
}
});
resolve(true);
})
},
// 转换时间格式
@@ -321,7 +539,7 @@ export default {
},
// 获取佩戴监测参数设置
getNowearConfig() {
APICore.getNowearConfig({ imei: this.imei }).then(res => {
/* APICore.getNowearConfig({ imei: this.imei }).then(res => {
let data = res.data.data;
if(data) {
this.dateList = [];
@@ -350,19 +568,118 @@ export default {
this.settingItems[8].text = this.concatTitle('佩戴监测', '关闭', '耗电低');
this.settingItems[8].data = [];
}
}); */
return new Promise(resolve => {
APICore.getNowearConfig({ imei: this.imei }).then(res => {
let data = res.data.data;
let index = 9;
let findIndex = this.settingItems.findIndex(item => {
return item.index === index
});
if(data) {
this.dateList = [];
this.shiftTime(data.timearea1, 0);
this.shiftTime(data.timearea2, 1);
this.shiftTime(data.timearea3, 2);
this.shiftTime(data.timearea4, 3);
this.shiftTime(data.timearea5, 4);
this.shiftTime(data.timearea6, 5);
this.shiftTime(data.timearea7, 6);
this.shiftTime(data.timearea8, 7);
this.shiftTime(data.timearea9, 8);
this.shiftTime(data.timearea10, 9);
this.settingItems[findIndex].text = this.concatTitle('佩戴监测', data.enabled === 1 ? '打开': '关闭', data.enabled === 1 ? '耗电高' : '耗电低');
this.settingItems[findIndex].data = [
{ name: '佩戴监测:', value: data.enabled === 1 ? '打开': '关闭' },
{ name: '检测周期:', value: (data.interval / 60) + '分钟' },
{ name: '检测时段:', value: this.fomatTimeArr(this.dateList)},
{ name: '未佩戴处理方式:', value: data.mode === 1 ? '不处理': '飞行模式' },
{ name: '佩戴提醒:', value: data.warningtimes !== 0 ? '打开' : '关闭' },
{ name: '提醒时间间隔:', value: (data.warninginterval / 60) + '分钟' },
{ name: '提醒次数:', value: data.warningtimes + '次'},
{ name: '告警方式:', value: `${data.vibrateenabled === 1 ? '震动' : '无'} ,${data.lcdenabled === 1 ? '亮屏' : '无'} ,${data.soundenabled === 1 ? '声音' : '无'}`},
]
} else {
this.settingItems[findIndex].text = this.concatTitle('佩戴监测', '关闭', '耗电低');
this.settingItems[findIndex].data = [];
}
});
resolve(true);
})

},
// 获取设备上报参数
getUploadConfig() {
APICore.getUploadConfig({imei: this.imei}).then(res => {
/* APICore.getUploadConfig({imei: this.imei}).then(res => {
const data = res.data.data;
if(data) {
this.settingItems[9].text = `上报周期(${data.uploadinteval}分钟)`;
} else {
this.settingItems[9].text = '上报周期(关闭)';
}
}); */
return new Promise(resolve => {
APICore.getUploadConfig({imei: this.imei}).then(res => {
const data = res.data.data;
let index = 10;
let findIndex = this.settingItems.findIndex(item => {
return item.index === index
});
if(data) {
this.settingItems[findIndex].text = `上报周期(${data.uploadinteval}分钟)`;
} else {
this.settingItems[findIndex].text = '上报周期(关闭)';
}
});
resolve(true);
})
},
// 获取设备状态
getDeviceStatus() {
let reqBody = {
imei: /* '861281060086216' *//* '862838050029479' */this.$store.getters.imei
};
// 线上地址
let baseUrl = process.env.VUE_APP_BASE_API;
let reqUrl = `${baseUrl}/iotservice/queryDeviceDetail`;
//本地调试地址
/* let reqUrl = `/api/id/queryDeviceDetail`; */
return new Promise(resolve => {
axios.post(`${reqUrl}`, reqBody).then(res => {
let data = res.data;
let index = 0;
let findIndex = this.settingItems.findIndex(item => {
return item.index === index
});
if(data.code === 200) {
this.settingItems[findIndex].text = `设备状态(${this.calcDeviceStatus(data.data.data.status)})`;
} else {
this.settingItems[findIndex].text = `设备状态(无数据)`;
}
});
resolve(true);
})
},
// 计算设备状态
calcDeviceStatus(status) {
let result = ''
switch(status) {
case 'ONLINE':
result = '在线';
break;
case 'OFFLINE':
result = '离线';
break;
case 'UNACTIVE':
result = '未激活';
break;
case 'DISABLE':
result = '已禁用';
break;
default: break;
};
return result;
},
// 点击左边树形图
onCkickNav(value) {
this.active = value;
@@ -379,33 +696,36 @@ export default {
});
break; */
case 0:
this.getWatchConfig();
this.getDeviceStatus();
break;
case 1:
this.getWatchConfig();
break;
case 2:
this.getIotCtlMode();
this.getWatchConfig();
break;
case 3:
this.getLocationConfig();
this.getIotCtlMode();
break;
case 4:
this.getDrownConfig();
this.getLocationConfig();
break;
case 5:
this.getHealthConfig();
this.getDrownConfig();
break;
case 6:
this.getBloodConfig();
this.getHealthConfig();
break;
case 7:
this.getPsychAbilityConfig();
this.getBloodConfig();
break;
case 8:
this.getNowearConfig();
this.getPsychAbilityConfig();
break;
case 9:
this.getNowearConfig();
break;
case 10:
this.getUploadConfig();
break;
default: break;
@@ -418,7 +738,7 @@ export default {
this.$router.push({
name: 'devicePower',
query: {
title: `${value === 10 ? 'BatteryLevel' : value === 11 ? 'status': 'Offline'}`
title: `${value === 11 ? 'BatteryLevel' : value === 12 ? 'status': 'Offline'}`
}
})
}


Laden…
Abbrechen
Speichern