|
|
@@ -1,3998 +1,4389 @@
|
|
|
import * as echarts from '../../ec-canvas/echarts';
|
|
|
-let chart000;
|
|
|
-let chart00;
|
|
|
+
|
|
|
let chart0;
|
|
|
let chart;
|
|
|
-let chart1;
|
|
|
let chart2;
|
|
|
let chart3;
|
|
|
let chart4;
|
|
|
let chart5;
|
|
|
let chart6;
|
|
|
-let chart7;
|
|
|
-let chart8;
|
|
|
let chart81;
|
|
|
let chart9;
|
|
|
let chart10;
|
|
|
let chart11;
|
|
|
-// pages/data/data.js
|
|
|
-function addZero(str) {
|
|
|
- if (String(str).length == 1) {
|
|
|
- return "0" + String(str);
|
|
|
- } else {
|
|
|
- return String(str);
|
|
|
- }
|
|
|
-}
|
|
|
+// 渐变圆环
|
|
|
+let chartCircularProgressBar;//圈圈
|
|
|
+let chartOutOfBed;//离床
|
|
|
+let chartBodyMovementsLine;//体动
|
|
|
+let chartCardiacSystemLine;//心脏系统
|
|
|
+let chartRespiratoryLine;//平均呼吸率
|
|
|
+let chartSnoringLine;//打鼾
|
|
|
+let chartApneaLine;//呼吸暂停
|
|
|
+let chartTimeWaterfall;//深浅睡眠
|
|
|
|
|
|
-function flushChart000() {
|
|
|
- var option = {
|
|
|
- series: [
|
|
|
- {
|
|
|
- type: 'pie',
|
|
|
- radius: ['60%', '70%'], // 外环半径和内环半径,控制圆环宽度
|
|
|
- data: [
|
|
|
- { value: 0, name: '暂无', itemStyle: {color: '#eaeaea'} }, // 进度数据
|
|
|
- { value: 100, name: '暂无', itemStyle: {color: '#eaeaea'} } // 剩余数据,用于形成完整的圆环
|
|
|
- ],
|
|
|
- label: {
|
|
|
- show: true,
|
|
|
- position: 'center',
|
|
|
- // formatter: function (params) {
|
|
|
- // // 这里假设进度数据在第一个数据项中
|
|
|
- // if (params.dataIndex === 0) {
|
|
|
- // // return `第一行文字\n${params.percent.toFixed(2)}% 第二行文字`;
|
|
|
- // return '<text class="text-line text-line-1">'+rscore_desc+'</text>'+'\n '+
|
|
|
- // '<text class="text-line text-line-2">'+rscore_value+'</text>';
|
|
|
- // }
|
|
|
- // return ''; // 其他数据项不显示标签
|
|
|
- // },
|
|
|
- rich: {
|
|
|
- // ... 如果需要设置富文本样式,可以在这里定义
|
|
|
- },
|
|
|
- textStyle: { // 设置标签文本样式
|
|
|
- fontSize: 16, // 根据需要调整字体大小
|
|
|
- color: '#333', // 根据需要调整字体颜色
|
|
|
- // ... 其他样式设置
|
|
|
- },
|
|
|
- alignTo: 'labelLine', // 文本水平居中到标签线
|
|
|
- align: 'center' // 文本垂直居中对齐到标签线
|
|
|
- },
|
|
|
-
|
|
|
- label: {
|
|
|
- show: true,
|
|
|
- position: 'center',
|
|
|
- // formatter: function (params) {
|
|
|
- // // 假设 params.percent 是进度百分比
|
|
|
- // return `{normal|`+rscore_desc+`}\n\n{bold|`+rscore_value+`}`;
|
|
|
- // },
|
|
|
- rich: {
|
|
|
- bold: {
|
|
|
- fontWeight: 'bold', // 加粗
|
|
|
- fontSize: 18, // 字体大小,根据需要调整
|
|
|
- color: '#333' // 字体颜色,根据需要调整
|
|
|
- // 其他样式配置...
|
|
|
- },
|
|
|
- normal: {
|
|
|
- fontWeight: 'normal', // 普通字体
|
|
|
- fontSize: 14, // 字体大小,根据需要调整
|
|
|
- color: '#666' // 字体颜色,根据需要调整
|
|
|
- // 其他样式配置...
|
|
|
- }
|
|
|
- // 可以继续定义其他样式...
|
|
|
- },
|
|
|
- // 其他 label 配置...
|
|
|
- }
|
|
|
- // ... 其他配置项
|
|
|
- }
|
|
|
- ]
|
|
|
- };
|
|
|
- chart000.setOption(option, true);
|
|
|
-}
|
|
|
+// 圈圈
|
|
|
+function setChartCircularProgressBarOption(chart, data = {}) {
|
|
|
+ var option = {
|
|
|
+ series: [
|
|
|
+ {
|
|
|
+ type: 'gauge',
|
|
|
+ startAngle: -270,
|
|
|
+ endAngle: 90,
|
|
|
+ legendHoverLink: true,
|
|
|
+ min: 0,
|
|
|
+ max: 100,
|
|
|
+ itemStyle: {
|
|
|
+ color: '#58D9F9',
|
|
|
+ shadowColor: 'rgba(0,138,255,0.45)',
|
|
|
+ shadowBlur: 5,
|
|
|
+ shadowOffsetX: 1,
|
|
|
+ shadowOffsetY: 1
|
|
|
+ },
|
|
|
+ progress: {
|
|
|
+ show: true,
|
|
|
+ roundCap: true,
|
|
|
+ width: 10,
|
|
|
+ itemStyle: {
|
|
|
+ // 进度条样式
|
|
|
+ color: {
|
|
|
+ // 自定义渐变色
|
|
|
+ type: 'linear',
|
|
|
+ x: 0.75,
|
|
|
+ y: 0.75,
|
|
|
+ x2: 0,
|
|
|
+ y2: 0.75,
|
|
|
+ colorStops: [
|
|
|
+ {
|
|
|
+ offset: 0,
|
|
|
+ color: '#8D25FF' // 0% 处的颜色
|
|
|
+ },
|
|
|
|
|
|
-function flushChart00(rscore_desc,rscore_value,that) {
|
|
|
- var option = {
|
|
|
- backgroundColor: 'white',
|
|
|
- series: [
|
|
|
- {
|
|
|
- type: 'pie',
|
|
|
- radius: ['60%', '70%'], // 外环半径和内环半径,控制圆环宽度
|
|
|
- data: [
|
|
|
- // { value: rscore_value?rscore_value:0, name: '进度', itemStyle: {color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{offset: 0, color: '#874bff'}, {offset: 0.6, color: '#a87cff'},{offset: 0.9, color: '#f19cff'},{offset: 1, color: '#ff55ff'}])} }, // 进度数据
|
|
|
- { value: rscore_value?rscore_value:0, name: '进度', itemStyle: {color: '#874bff'} },
|
|
|
- { value: 100-(rscore_value?rscore_value:0), name: '剩余', itemStyle: {color: '#eaeaea'} } // 剩余数据,用于形成完整的圆环
|
|
|
- ],
|
|
|
- label: {
|
|
|
- show: true,
|
|
|
- position: 'center',
|
|
|
- formatter: function (params) {
|
|
|
- // 这里假设进度数据在第一个数据项中
|
|
|
- if (params.dataIndex === 0) {
|
|
|
- // return `第一行文字\n${params.percent.toFixed(2)}% 第二行文字`;
|
|
|
- return '<text class="text-line text-line-1">'+rscore_desc+'</text>'+'\n '+
|
|
|
- '<text class="text-line text-line-2">'+rscore_value+'</text>';
|
|
|
+ {
|
|
|
+ offset: 0.5,
|
|
|
+ color: '#A631FF' // 100% 处的颜色
|
|
|
+ },
|
|
|
+ {
|
|
|
+ offset: 1,
|
|
|
+ color: '#FF8FF0' // 100% 处的颜色
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ global: false // 缺省为 false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ pointer: {
|
|
|
+ show: false,
|
|
|
+ },
|
|
|
+ axisLine: {
|
|
|
+ roundCap: true,
|
|
|
+ lineStyle: {
|
|
|
+ width: 10,
|
|
|
+ }
|
|
|
+ },
|
|
|
+ axisTick: {
|
|
|
+ show: false // 是否显示分隔线
|
|
|
+ },
|
|
|
+ splitLine: {
|
|
|
+ show: false // 是否显示分隔线
|
|
|
+ },
|
|
|
+ axisLabel: {
|
|
|
+ show: false,
|
|
|
+ },
|
|
|
+ title: {
|
|
|
+ color: '#6C6970',
|
|
|
+ offsetCenter: [0, '-36%'],
|
|
|
+ lineHeight: 15,
|
|
|
+ fontSize: 15,
|
|
|
+ },
|
|
|
+ detail: {
|
|
|
+ backgroundColor: '#fff',
|
|
|
+ width: '60%',
|
|
|
+ lineHeight: 40,
|
|
|
+ height: 40,
|
|
|
+ color: '#333333',
|
|
|
+ offsetCenter: [0, "24%"],
|
|
|
+ valueAnimation: true,
|
|
|
+ formatter: function (value) {
|
|
|
+ return '{value|' + value.toFixed(0) + '}';
|
|
|
+ },
|
|
|
+ rich: {
|
|
|
+ value: {
|
|
|
+ fontSize: 30,
|
|
|
+ fontWeight: 'bolder',
|
|
|
+ color: '#333333'
|
|
|
+ },
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data: [
|
|
|
+ {
|
|
|
+ name: data?.rscore_desc || '无',
|
|
|
+ value: data?.rscore_value || 0
|
|
|
}
|
|
|
- return ''; // 其他数据项不显示标签
|
|
|
- },
|
|
|
- rich: {
|
|
|
- // ... 如果需要设置富文本样式,可以在这里定义
|
|
|
- },
|
|
|
- textStyle: { // 设置标签文本样式
|
|
|
- fontSize: 16, // 根据需要调整字体大小
|
|
|
- color: '#333', // 根据需要调整字体颜色
|
|
|
- // ... 其他样式设置
|
|
|
- },
|
|
|
- alignTo: 'labelLine', // 文本水平居中到标签线
|
|
|
- align: 'center' // 文本垂直居中对齐到标签线
|
|
|
- },
|
|
|
-
|
|
|
- label: {
|
|
|
- show: true,
|
|
|
- position: 'center',
|
|
|
- formatter: function (params) {
|
|
|
- // 假设 params.percent 是进度百分比
|
|
|
- return `{normal|`+rscore_desc+`}\n\n{bold|`+rscore_value+`}`;
|
|
|
- },
|
|
|
- rich: {
|
|
|
- bold: {
|
|
|
- fontWeight: 'bold', // 加粗
|
|
|
- fontSize: 18, // 字体大小,根据需要调整
|
|
|
- color: '#333' // 字体颜色,根据需要调整
|
|
|
- // 其他样式配置...
|
|
|
- },
|
|
|
- normal: {
|
|
|
- fontWeight: 'normal', // 普通字体
|
|
|
- fontSize: 14, // 字体大小,根据需要调整
|
|
|
- color: '#666' // 字体颜色,根据需要调整
|
|
|
- // 其他样式配置...
|
|
|
- }
|
|
|
- // 可以继续定义其他样式...
|
|
|
- },
|
|
|
- // 其他 label 配置...
|
|
|
- }
|
|
|
- // ... 其他配置项
|
|
|
- }
|
|
|
- ]
|
|
|
- };
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ };
|
|
|
+
|
|
|
+ chart.setOption(option, true);
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+function initChartHumidifier(canvas, width, height, dpr) {
|
|
|
+ // this.selectComponent('#mychart-dom-bar00').init((canvas, width, height, dpr) => {
|
|
|
+ // 获取组件的 canvas、width、height 后的回调函数
|
|
|
+ // 在这里初始化图表
|
|
|
+ const chart = echarts.init(canvas, null, {
|
|
|
+ width: width,
|
|
|
+ height: height,
|
|
|
+ devicePixelRatio: dpr // new
|
|
|
+ });
|
|
|
+ canvas.setChart(chart);
|
|
|
+ setChartCircularProgressBarOption(chart);
|
|
|
+
|
|
|
+ // 将图表实例绑定到 this 上,可以在其他成员函数(如 dispose)中访问
|
|
|
+ chartCircularProgressBar = chart;
|
|
|
+
|
|
|
+ // 注意这里一定要返回 chart 实例,否则会影响事件处理等
|
|
|
+ return chart;
|
|
|
+ // });
|
|
|
+};
|
|
|
+
|
|
|
+function updateChartCircularProgressBarOption(rscore_desc, rscore_value, that) {
|
|
|
+ if (chartCircularProgressBar) {
|
|
|
+ setChartCircularProgressBarOption(chartCircularProgressBar, { rscore_desc, rscore_value });
|
|
|
that.setData({
|
|
|
- flushChart00Flag:true
|
|
|
+ flushChart00Flag: true
|
|
|
});
|
|
|
- console.log('that.data.flushChart00Flag='+that.data.flushChart00Flag);
|
|
|
- chart00.setOption(option, true);
|
|
|
-}
|
|
|
+ } else {
|
|
|
+ that.selectComponent('#mychart-dom-CircularProgressBar').init((canvas, width, height, dpr) => {
|
|
|
+ const chart = echarts.init(canvas, null, {
|
|
|
+ width: width,
|
|
|
+ height: height,
|
|
|
+ devicePixelRatio: dpr // new
|
|
|
+ });
|
|
|
+ canvas.setChart(chart);
|
|
|
+ setChartCircularProgressBarOption(chart, { rscore_desc, rscore_value });
|
|
|
|
|
|
-function flushChart0(data) {
|
|
|
- var option = {
|
|
|
- series: [
|
|
|
- {
|
|
|
- name: '进度',
|
|
|
- type: 'pie',
|
|
|
- radius: ['50%', '70%'],
|
|
|
- avoidLabelOverlap: false,
|
|
|
- label: {
|
|
|
- show: true,
|
|
|
- position: 'center'
|
|
|
- },
|
|
|
- emphasis: {
|
|
|
- label: {
|
|
|
- show: true,
|
|
|
- fontSize: '30',
|
|
|
- fontWeight: 'bold'
|
|
|
- }
|
|
|
- },
|
|
|
- labelLine: {
|
|
|
- show: false
|
|
|
- },
|
|
|
- data: data
|
|
|
- }
|
|
|
- ]
|
|
|
- };
|
|
|
- chart0.setOption(option, true);
|
|
|
-}
|
|
|
+ // 将图表实例绑定到 this 上,可以在其他成员函数(如 dispose)中访问
|
|
|
+ chartCircularProgressBar = chart;
|
|
|
|
|
|
-function flushChart(data) {
|
|
|
- var option = {
|
|
|
- backgroundColor: '#0c1041',
|
|
|
- // title: {
|
|
|
- // text: '当天睡眠时间曲线图',
|
|
|
- // left: 'center',
|
|
|
- // color: '#ffffff',
|
|
|
- // backgroundColor: '#ff0000'
|
|
|
- // },
|
|
|
- color: ["#62c4d9"],
|
|
|
- legend: {
|
|
|
- data: ['睡眠时间'],
|
|
|
- top: 20,
|
|
|
- left: 'right',
|
|
|
- backgroundColor: '#0c1041',
|
|
|
- textStyle:{
|
|
|
- color:'#fff',
|
|
|
- }
|
|
|
- },
|
|
|
- grid: {
|
|
|
- containLabel: true
|
|
|
- },
|
|
|
- tooltip: {
|
|
|
- show: true,
|
|
|
- trigger: 'axis'
|
|
|
- },
|
|
|
- xAxis: {
|
|
|
- type: 'category',
|
|
|
- boundaryGap: false,
|
|
|
- axisLine:{
|
|
|
- lineStyle:{
|
|
|
- color: '#fff',
|
|
|
- width:1,//这里是为了突出显示加上的
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- yAxis: {
|
|
|
- name: "时长" ,
|
|
|
- x: 'center',
|
|
|
- type: 'value',
|
|
|
- axisLine:{
|
|
|
- lineStyle:{
|
|
|
- color: '#fff',
|
|
|
- width:1,//这里是为了突出显示加上的
|
|
|
- }
|
|
|
- // splitLine: {
|
|
|
- // lineStyle: {
|
|
|
- // type: 'dashed'
|
|
|
- // }
|
|
|
- }
|
|
|
- // show: false
|
|
|
- },
|
|
|
- series: [{
|
|
|
- name: '睡眠时间',
|
|
|
- type: 'line',
|
|
|
- smooth: true,
|
|
|
- data: data,
|
|
|
- color: '#62c4d9'
|
|
|
- }]
|
|
|
- };
|
|
|
- chart.setOption(option, true);
|
|
|
+ // 注意这里一定要返回 chart 实例,否则会影响事件处理等
|
|
|
+ return chart;
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
+//离床
|
|
|
+
|
|
|
+function initChartOutOfBed(canvas, width, height, dpr) {
|
|
|
+ // this.selectComponent('#mychart-dom-bar00').init((canvas, width, height, dpr) => {
|
|
|
+ // 获取组件的 canvas、width、height 后的回调函数
|
|
|
+ // 在这里初始化图表
|
|
|
+ const chart = echarts.init(canvas, null, {
|
|
|
+ width: width,
|
|
|
+ height: height,
|
|
|
+ devicePixelRatio: dpr // new
|
|
|
+ });
|
|
|
+ canvas.setChart(chart);
|
|
|
+ setChartOutOfBedOption(chart);
|
|
|
+
|
|
|
+ // 将图表实例绑定到 this 上,可以在其他成员函数(如 dispose)中访问
|
|
|
+ chartOutOfBed = chart;
|
|
|
+
|
|
|
+ // 注意这里一定要返回 chart 实例,否则会影响事件处理等
|
|
|
+ return chart;
|
|
|
+ // });
|
|
|
+};
|
|
|
+
|
|
|
|
|
|
-function flushChart1(data1,data2) {
|
|
|
- var option = {
|
|
|
- // title: {
|
|
|
- // text: '睡眠心率监测',
|
|
|
- // left: 'center',
|
|
|
- // textStyle: {
|
|
|
- // color: '#ffffff', // 字体颜色
|
|
|
- // fontStyle: 'normal', // 字体风格
|
|
|
- // // fontWeight: 'bold', // 字体粗细
|
|
|
- // fontFamily: 'sans-serif', // 字体族
|
|
|
- // fontSize: 18 // 字体大小
|
|
|
- // },
|
|
|
- // backgroundColor: '#57f7ff'
|
|
|
- // },
|
|
|
- tooltip: {},
|
|
|
- xAxis: {
|
|
|
- axisLabel: {
|
|
|
- color: '#000' // 设置 x 轴标签颜色为白色
|
|
|
- },
|
|
|
- splitLine: {
|
|
|
+
|
|
|
+function setChartOutOfBedOption(chart, data1 = [], data2 = [],) {
|
|
|
+ var option = option = {
|
|
|
+ tooltip: {
|
|
|
+ show: true,
|
|
|
+ trigger: 'axis',
|
|
|
+ formatter: function (param) {
|
|
|
+ return `${param[0] && param[0].value == 1 ? '在床' : '离床'}`
|
|
|
+ }
|
|
|
+ },
|
|
|
+ dataZoom: [
|
|
|
+ { // 第一个 dataZoom 组件
|
|
|
+ type: 'inside',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ grid: {
|
|
|
+ top: '10rpx',
|
|
|
+ left: 0,
|
|
|
+ right: '20rpx',
|
|
|
+ bottom: 0,
|
|
|
+ containLabel: true
|
|
|
+ },
|
|
|
+ xAxis: {
|
|
|
+ type: 'category',
|
|
|
+ axisLabel: {
|
|
|
+ color: '#6C6970',// 设置 x 轴标签颜色为白色
|
|
|
+ fontSize: 10
|
|
|
+ },
|
|
|
+ boundaryGap: false,
|
|
|
+ splitLine: {
|
|
|
show: false, // 是否显示刻度线
|
|
|
- },
|
|
|
- axisTick: {
|
|
|
- // 不显示Y轴刻度线
|
|
|
- show: false
|
|
|
- },
|
|
|
- axisLine: {
|
|
|
- // 不显示X轴轴线
|
|
|
- show: false
|
|
|
- },
|
|
|
- data: data1?data1:[]
|
|
|
- },
|
|
|
- yAxis: {
|
|
|
- // Y 轴配置
|
|
|
- type: 'value',
|
|
|
- // 设置 Y 轴名称
|
|
|
- name: '单位:次',
|
|
|
- // 设置 Y 轴名称的位置
|
|
|
- nameLocation: 'end', // 可以是 'start'、'middle' 或 'end'
|
|
|
- axisLine: {
|
|
|
- // 不显示Y轴轴线
|
|
|
- show: false,
|
|
|
- },
|
|
|
- axisTick: {
|
|
|
- // 不显示Y轴刻度线
|
|
|
- show: false
|
|
|
- },
|
|
|
- axisLabel: {
|
|
|
- color: '#000',
|
|
|
- },
|
|
|
- splitLine: {
|
|
|
- show: false ,// 不显示纵坐标轴的刻度线
|
|
|
- lineStyle: {
|
|
|
- color: 'rgba(255, 0, 255, 0.8)', // 灰色并调整透明度
|
|
|
- width: 1, // 刻度线宽度
|
|
|
- type: 'solid' // 刻度线类型,默认为实线
|
|
|
- }
|
|
|
- },
|
|
|
- },
|
|
|
- series: [{
|
|
|
- type: 'line',
|
|
|
- data: data2?data2:[],
|
|
|
- // lineStyle: {
|
|
|
- // color: 'rgba(255, 85, 127, 0.1)' // 奶白色,80% 透明度
|
|
|
- // },
|
|
|
- showSymbol: false, // 是否显示标记图形
|
|
|
- smooth: true, // 使折线平滑
|
|
|
- markPoint: {
|
|
|
- symbol: 'circle', // 标记的符号为圆圈
|
|
|
- symbolSize: 10, // 标记的大小
|
|
|
- itemStyle: {
|
|
|
- color: 'rgba(255, 0, 255, 0.8)',
|
|
|
- // borderColor: 'blue',
|
|
|
- borderWidth: 1, // 设置边框宽度
|
|
|
- fill: 'none' // 设置填充颜色为无,即空心
|
|
|
- },
|
|
|
- data: [
|
|
|
- // 假设 data[0] 和 data[data.length - 1] 分别是开始和结束的数据点
|
|
|
- {coord: [data1?data1[0]:'', data2?data2[0]:''], name: '开始'},
|
|
|
- {coord: [data1?data1[data1.length-1]:'', data2?data2[data2.length-1]:''], name: '结束'}
|
|
|
- // 如果要添加拐角处的标记,需要手动计算并添加
|
|
|
- ]
|
|
|
- },
|
|
|
- areaStyle: { // 折线下方的区域样式
|
|
|
- color: new echarts.graphic.LinearGradient(
|
|
|
- 0, 0, 0, 1, // 渐变方向
|
|
|
- [ // 渐变颜色
|
|
|
- {offset: 0, color: 'rgba(255, 0, 255, 0.8)'}, // 使用之前定义的渐变
|
|
|
- {offset: 0.9, color: 'rgba(255, 255, 255, 1)'} // 可选,结束颜色
|
|
|
- ]
|
|
|
- ),
|
|
|
- opacity: 0.3 // 区域的不透明度,可以根据需要调整
|
|
|
- },
|
|
|
- }]
|
|
|
- };
|
|
|
- chart1.setOption(option, true);
|
|
|
-}
|
|
|
|
|
|
+ },
|
|
|
+ axisTick: {
|
|
|
+ // 不显示Y轴刻度线
|
|
|
+ show: false
|
|
|
+ },
|
|
|
+ data: data1,
|
|
|
+ axisLine: {
|
|
|
+ // 不显示X轴轴线
|
|
|
+ show: false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ yAxis: {
|
|
|
+ // Y 轴配置
|
|
|
+ type: 'value',
|
|
|
+ show: false
|
|
|
+ },
|
|
|
+ series: [{
|
|
|
+ type: 'line',
|
|
|
+ name: '睡眠状态',
|
|
|
+ smooth: true,
|
|
|
+ lineStyle: {
|
|
|
+ width: 2,
|
|
|
+ color: '#54C68B'
|
|
|
+ },
|
|
|
+ showSymbol: false,
|
|
|
+ areaStyle: {
|
|
|
+ opacity: 0.8,
|
|
|
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
+ {
|
|
|
+ offset: 0,
|
|
|
+ color: '#B8EBD0'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ offset: 1,
|
|
|
+ color: 'rgba(255, 255, 255, 0)'
|
|
|
+ }
|
|
|
+ ])
|
|
|
+ },
|
|
|
+ data: data2,
|
|
|
+ }]
|
|
|
+ };
|
|
|
|
|
|
-function flushChart2(data) {
|
|
|
- var option = {
|
|
|
- // title: {
|
|
|
- // text: '睡眠状态监测',
|
|
|
- // left: 'center',
|
|
|
- // textStyle: {
|
|
|
- // color: '#ffffff', // 字体颜色
|
|
|
- // fontStyle: 'normal', // 字体风格
|
|
|
- // // fontWeight: 'bold', // 字体粗细
|
|
|
- // fontFamily: 'sans-serif', // 字体族
|
|
|
- // fontSize: 18 // 字体大小
|
|
|
- // },
|
|
|
- // backgroundColor: '#57f7ff'
|
|
|
- // },
|
|
|
- tooltip: {
|
|
|
- trigger: 'item'
|
|
|
- },
|
|
|
- legend: {
|
|
|
- orient: 'vertical',
|
|
|
- left: 'left',
|
|
|
- },
|
|
|
- series: [{
|
|
|
- type: 'pie',
|
|
|
- radius: '55%',
|
|
|
- data: data?data:[]
|
|
|
- }],
|
|
|
- graphic: [{
|
|
|
- type: 'text',
|
|
|
- left: '2%', // 文本水平位置,这里设置为居中,你可以根据需要调整
|
|
|
- top: '84%', // 文本垂直位置,这里设置为距离顶部 10% 的位置,作为左下方的文本
|
|
|
- style: {
|
|
|
- text: '时长(分钟)分析', // 文本内容
|
|
|
- textFill: '#333', // 文本颜色
|
|
|
- textFontSize: 14, // 文本字体大小
|
|
|
- textAlign: 'left', // 文本水平对齐方式
|
|
|
- verticalAlign: 'middle' // 文本垂直对齐方式
|
|
|
- }
|
|
|
- }],
|
|
|
- };
|
|
|
- chart2.setOption(option, true);
|
|
|
+ chart.setOption(option, true);
|
|
|
}
|
|
|
|
|
|
-function flushChart3(data1,data2) {
|
|
|
- var option = {
|
|
|
- // title: {
|
|
|
- // text: '睡眠呼吸监测',
|
|
|
- // left: 'center',
|
|
|
- // textStyle: {
|
|
|
- // color: '#ffffff', // 字体颜色
|
|
|
- // fontStyle: 'normal', // 字体风格
|
|
|
- // // fontWeight: 'bold', // 字体粗细
|
|
|
- // fontFamily: 'sans-serif', // 字体族
|
|
|
- // fontSize: 18 // 字体大小
|
|
|
- // },
|
|
|
- // backgroundColor: '#57f7ff'
|
|
|
- // },
|
|
|
- tooltip: {},
|
|
|
- xAxis: {
|
|
|
- data: data1?data1:[]
|
|
|
- },
|
|
|
- yAxis: {
|
|
|
- // Y 轴配置
|
|
|
- type: 'value',
|
|
|
- // 设置 Y 轴名称
|
|
|
- name: '单位:次',
|
|
|
- // 设置 Y 轴名称的位置
|
|
|
- nameLocation: 'end', // 可以是 'start'、'middle' 或 'end'
|
|
|
- },
|
|
|
- series: [{
|
|
|
- type: 'line',
|
|
|
- data: data2?data2:[]
|
|
|
- }]
|
|
|
- };
|
|
|
- chart3.setOption(option, true);
|
|
|
+
|
|
|
+function updateOutOfBed(data1, data2, startSleepTime, endSleepTime, that) {
|
|
|
+ if (chartOutOfBed) {
|
|
|
+ setChartOutOfBedOption(chartOutOfBed, data1, data2);
|
|
|
+ } else {
|
|
|
+ that.selectComponent('#chartOutOfBed-dom').init((canvas, width, height, dpr) => {
|
|
|
+ const chart = echarts.init(canvas, null, {
|
|
|
+ width: width,
|
|
|
+ height: height,
|
|
|
+ devicePixelRatio: dpr // new
|
|
|
+ });
|
|
|
+ canvas.setChart(chart);
|
|
|
+ setChartOutOfBedOption(chart, data1, data2);
|
|
|
+
|
|
|
+ // 将图表实例绑定到 this 上,可以在其他成员函数(如 dispose)中访问
|
|
|
+ chartOutOfBed = chart;
|
|
|
+
|
|
|
+ // 注意这里一定要返回 chart 实例,否则会影响事件处理等
|
|
|
+ return chart;
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
-function flushChart4(data) {
|
|
|
- var option = {
|
|
|
- // title: {
|
|
|
- // text: '睡眠与清醒时间',
|
|
|
- // left: 'center',
|
|
|
- // textStyle: {
|
|
|
- // color: '#ffffff', // 字体颜色
|
|
|
- // fontStyle: 'normal', // 字体风格
|
|
|
- // // fontWeight: 'bold', // 字体粗细
|
|
|
- // fontFamily: 'sans-serif', // 字体族
|
|
|
- // fontSize: 18 // 字体大小
|
|
|
- // },
|
|
|
- // backgroundColor: '#57f7ff'
|
|
|
- // },
|
|
|
- tooltip: {},
|
|
|
- series: [{
|
|
|
- type: 'gauge',
|
|
|
- // 设置刻度盘的最大值
|
|
|
- max: 24,
|
|
|
- // 设置刻度盘的最小值
|
|
|
- min: 0,
|
|
|
- pointer: {
|
|
|
- width: 5,
|
|
|
- // 可以调整第二个指针的样式以区分
|
|
|
- itemStyle: {
|
|
|
- color: '#FF0000'
|
|
|
- }
|
|
|
+
|
|
|
+//体动
|
|
|
+
|
|
|
+function initChartBodyMovementsLine(canvas, width, height, dpr) {
|
|
|
+ // 在这里初始化图表
|
|
|
+ const chart = echarts.init(canvas, null, {
|
|
|
+ width: width,
|
|
|
+ height: height,
|
|
|
+ devicePixelRatio: dpr // new
|
|
|
+ });
|
|
|
+ canvas.setChart(chart);
|
|
|
+ setBodyMovementsOption(chart);
|
|
|
+
|
|
|
+ // 将图表实例绑定到 this 上,可以在其他成员函数(如 dispose)中访问
|
|
|
+ chartBodyMovementsLine = chart;
|
|
|
+
|
|
|
+ // 注意这里一定要返回 chart 实例,否则会影响事件处理等
|
|
|
+ return chart;
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
+function setBodyMovementsOption(chart, data1 = [], data2 = [],) {
|
|
|
+ var option = option = {
|
|
|
+ tooltip: {
|
|
|
+ show: true,
|
|
|
+ trigger: 'axis',
|
|
|
+ formatter: function (param) {
|
|
|
+ return `${param[0] && param[0].value == 1 ? '体动' : '否'}`
|
|
|
+ }
|
|
|
},
|
|
|
- // 刻度盘轴
|
|
|
- axisLine: {
|
|
|
- textStyle: {
|
|
|
- fontSize: 14
|
|
|
+ dataZoom: [
|
|
|
+ { // 第一个 dataZoom 组件
|
|
|
+ type: 'inside',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ grid: {
|
|
|
+ top: '10rpx',
|
|
|
+ left: 0,
|
|
|
+ right: '20rpx',
|
|
|
+ bottom: 0,
|
|
|
+ containLabel: true
|
|
|
},
|
|
|
- lineStyle: {
|
|
|
- width: 30,
|
|
|
- color: [[0.2, '#80FF80'], [0.8, '#FF8080'], [1, '#8080FF']] // 刻度盘颜色分区
|
|
|
+ xAxis: {
|
|
|
+ type: 'category',
|
|
|
+ axisLabel: {
|
|
|
+ color: '#6C6970',// 设置 x 轴标签颜色为白色
|
|
|
+ fontSize: 10
|
|
|
+ },
|
|
|
+ boundaryGap: false,
|
|
|
+ splitLine: {
|
|
|
+ show: false, // 是否显示刻度线
|
|
|
+
|
|
|
+ },
|
|
|
+ axisTick: {
|
|
|
+ // 不显示Y轴刻度线
|
|
|
+ show: false
|
|
|
+ },
|
|
|
+ data: data1,
|
|
|
+ axisLine: {
|
|
|
+ // 不显示X轴轴线
|
|
|
+ show: false
|
|
|
+ }
|
|
|
},
|
|
|
- rich: {
|
|
|
- // 为第一个刻度盘设置刻度颜色
|
|
|
- '0%': {
|
|
|
- color: '#FF0000'
|
|
|
- },
|
|
|
- '50%': {
|
|
|
- color: '#00FF00'
|
|
|
- },
|
|
|
- '100%': {
|
|
|
- color: '#0000FF'
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- detail: {formatter: '{value} 小时'},
|
|
|
- data: data?data:{}
|
|
|
- }
|
|
|
- // ,{
|
|
|
- // type: 'gauge',
|
|
|
- // // 设置刻度盘的最大值
|
|
|
- // max: 24,
|
|
|
- // // 设置刻度盘的最小值
|
|
|
- // min: 0,
|
|
|
- // // 刻度盘轴
|
|
|
- // axisLine: {
|
|
|
- // textStyle: {
|
|
|
- // fontSize: 14
|
|
|
- // },
|
|
|
- // lineStyle: {
|
|
|
- // width: 30,
|
|
|
- // color: [[0.2, '#80FF80'], [0.8, '#FF8080'], [1, '#8080FF']] // 刻度盘颜色分区
|
|
|
- // },
|
|
|
- // rich: {
|
|
|
- // // 为第二个刻度盘设置刻度颜色
|
|
|
- // '0%': {
|
|
|
- // color: '#FFFF00'
|
|
|
- // },
|
|
|
- // '50%': {
|
|
|
- // color: '#00FFFF'
|
|
|
- // },
|
|
|
- // '100%': {
|
|
|
- // color: '#FF00FF'
|
|
|
- // }
|
|
|
- // }
|
|
|
- // },
|
|
|
- // detail: {formatter: '{value} 小时'},
|
|
|
- // data: data2?data2:{}
|
|
|
- // },
|
|
|
- ]
|
|
|
+ yAxis: {
|
|
|
+ // Y 轴配置
|
|
|
+ type: 'value',
|
|
|
+ show: false
|
|
|
+ },
|
|
|
+ series: [{
|
|
|
+ name: '睡眠状态',
|
|
|
+ type: 'line',
|
|
|
+ smooth: true,
|
|
|
+ lineStyle: {
|
|
|
+ width: 2,
|
|
|
+ color: '#5582FF'
|
|
|
+ },
|
|
|
+ showSymbol: false,
|
|
|
+ areaStyle: {
|
|
|
+ opacity: 0.8,
|
|
|
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
+ {
|
|
|
+ offset: 0,
|
|
|
+ color: 'rgba(85, 130, 255, 0.5)'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ offset: 1,
|
|
|
+ color: 'rgba(149, 177, 255, 0.3)'
|
|
|
+ }
|
|
|
+ ])
|
|
|
+ },
|
|
|
+ data: data2,
|
|
|
+ }]
|
|
|
};
|
|
|
- chart4.setOption(option, true);
|
|
|
-}
|
|
|
|
|
|
-function flushChart5(data1,data2,that) {
|
|
|
- var option = {
|
|
|
- // title: {
|
|
|
- // text: '睡眠状态监测',
|
|
|
- // left: 'center',
|
|
|
- // textStyle: {
|
|
|
- // color: '#ffffff', // 字体颜色
|
|
|
- // fontStyle: 'normal', // 字体风格
|
|
|
- // // fontWeight: 'bold', // 字体粗细
|
|
|
- // fontFamily: 'sans-serif', // 字体族
|
|
|
- // fontSize: 18 // 字体大小
|
|
|
- // },
|
|
|
- // backgroundColor: '#57f7ff'
|
|
|
- // },
|
|
|
- tooltip: {},
|
|
|
- xAxis: {
|
|
|
- data: data1?data1:[]
|
|
|
- },
|
|
|
- yAxis: {
|
|
|
- // Y 轴配置
|
|
|
- type: 'value',
|
|
|
- // 设置 Y 轴名称
|
|
|
- name: '单位:次',
|
|
|
- // 设置 Y 轴名称的位置
|
|
|
- nameLocation: 'end', // 可以是 'start'、'middle' 或 'end'
|
|
|
- axisLabel: {
|
|
|
- formatter: function (value) {
|
|
|
- return that.sleepStateChange(value);
|
|
|
- }
|
|
|
- },
|
|
|
- },
|
|
|
- series: [{
|
|
|
- type: 'line',
|
|
|
- data: data2?data2:[]
|
|
|
- }]
|
|
|
- };
|
|
|
- chart5.setOption(option, true);
|
|
|
+ chart.setOption(option, true);
|
|
|
}
|
|
|
|
|
|
-function flushChart6(data1,data2,startSleepTime,endSleepTime,that) {
|
|
|
- var option = {
|
|
|
- backgroundColor: '#000000', // 设置背景色
|
|
|
- tooltip: {},
|
|
|
- xAxis: {
|
|
|
- data: data1?data1:[]
|
|
|
- },
|
|
|
- yAxis: {
|
|
|
- // Y 轴配置
|
|
|
- type: 'value',
|
|
|
- // 设置 Y 轴名称
|
|
|
- name: '睡眠状态',
|
|
|
- // 设置 Y 轴名称的位置
|
|
|
- nameLocation: 'end', // 可以是 'start'、'middle' 或 'end'
|
|
|
- axisLabel: {
|
|
|
- formatter: function (value) {
|
|
|
- return that.sleepStateChange(value);
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- series: [{
|
|
|
- type: 'line',
|
|
|
- data: data2?data2:[],
|
|
|
- lineStyle: { // 系列级个性化折线样式
|
|
|
- width: 10,
|
|
|
- type: 'solid',
|
|
|
- color: new echarts.graphic.LinearGradient(0, 0.4, 0.7, 1, [{
|
|
|
- offset: 0,
|
|
|
- color: '#ffb71b'
|
|
|
- } , {
|
|
|
- offset: 0.4,
|
|
|
- color: '#b75cee'
|
|
|
- }, {
|
|
|
- offset: 0.7,
|
|
|
- color: '#66acfc'
|
|
|
- }, {
|
|
|
- offset: 1,
|
|
|
- color: '#3843fa'
|
|
|
- }]),//线条渐变色
|
|
|
- },
|
|
|
- }
|
|
|
- // {
|
|
|
- // name: '分类2',
|
|
|
- // type: 'line',
|
|
|
- // data: data2,
|
|
|
- // lineStyle: { // 系列级个性化折线样式
|
|
|
- // width: 4,
|
|
|
- // type: 'solid',
|
|
|
- // color: new echarts.graphic.LinearGradient(0, 0.4, 0.7, 1, [{
|
|
|
- // offset: 0,
|
|
|
- // color: '#ffb71b'
|
|
|
- // } , {
|
|
|
- // offset: 0.4,
|
|
|
- // color: '#b75cee'
|
|
|
- // }, {
|
|
|
- // offset: 0.7,
|
|
|
- // color: '#66acfc'
|
|
|
- // }, {
|
|
|
- // offset: 1,
|
|
|
- // color: '#3843fa'
|
|
|
- // }]),//线条渐变色
|
|
|
- // },
|
|
|
- // },
|
|
|
- ],
|
|
|
- graphic: [{
|
|
|
- type: 'text',
|
|
|
- left: '5%', // 文本水平位置,这里设置为居中,你可以根据需要调整
|
|
|
- top: '90%', // 文本垂直位置,这里设置为距离顶部 10% 的位置,作为左下方的文本
|
|
|
- style: {
|
|
|
- text: '入睡时间:'+startSleepTime?startSleepTime:'', // 文本内容
|
|
|
- textFill: '#333', // 文本颜色
|
|
|
- textFontSize: 14, // 文本字体大小
|
|
|
- textAlign: 'left', // 文本水平对齐方式
|
|
|
- verticalAlign: 'middle' // 文本垂直对齐方式
|
|
|
- }
|
|
|
- }, {
|
|
|
- type: 'text',
|
|
|
- right: '5%', // 文本水平位置,这里设置为距离右侧 10% 的位置,作为右下方的文本
|
|
|
- top: '90%', // 文本垂直位置,这里设置为距离底部 10% 的位置
|
|
|
- style: {
|
|
|
- text: '醒来时间:'+endSleepTime?endSleepTime:'', // 文本内容
|
|
|
- textFill: '#333', // 文本颜色
|
|
|
- textFontSize: 14, // 文本字体大小
|
|
|
- textAlign: 'right', // 文本水平对齐方式
|
|
|
- verticalAlign: 'middle' // 文本垂直对齐方式
|
|
|
- }
|
|
|
- }],
|
|
|
- };
|
|
|
-
|
|
|
- // var list0 = [];
|
|
|
- // var list10 = [];
|
|
|
- // var list20 = [];
|
|
|
- // var list30 = [];
|
|
|
- // if(data2){
|
|
|
- // for (let i = 0; i < data2.length; i++) {
|
|
|
- // if (data2[i] == '0') {
|
|
|
- // list0.push(data2[i]);
|
|
|
- // }else if (data2[i] == '10') {
|
|
|
- // list10.push(data2[i]);
|
|
|
- // }else if (data2[i] == '20') {
|
|
|
- // list20.push(data2[i]);
|
|
|
- // }else if (data2[i] == '30') {
|
|
|
- // list30.push(data2[i]);
|
|
|
- // }else{
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // var option = {
|
|
|
- // xAxis: {
|
|
|
- // type: 'category',
|
|
|
- // data: data1
|
|
|
- // },
|
|
|
- // yAxis: {
|
|
|
- // type: 'value',
|
|
|
- // axisLabel: {
|
|
|
- // show: true,
|
|
|
- // position: 'buttom' // 分类标签显示在顶部,相当于曲线下方位置
|
|
|
- // }
|
|
|
- // },
|
|
|
- // series: [
|
|
|
- // {
|
|
|
- // name: '清醒',
|
|
|
- // type: 'line',
|
|
|
- // data: list0,
|
|
|
- // itemStyle: {
|
|
|
- // areaColor: new echarts.graphic.LinearGradient(
|
|
|
- // 0, 0, 0, 1,
|
|
|
- // [{ offset: 0, color: 'rgba(255, 0, 0, 0.3)' }, { offset: 1, color: 'rgba(255, 0, 0, 0)' }]
|
|
|
- // )
|
|
|
- // },
|
|
|
- // smooth: true,
|
|
|
- // lineStyle: {
|
|
|
- // color: 'red' // 线条颜色
|
|
|
- // }
|
|
|
- // },
|
|
|
- // {
|
|
|
- // name: '浅睡',
|
|
|
- // type: 'line',
|
|
|
- // data: list10,
|
|
|
- // itemStyle: {
|
|
|
- // areaColor: new echarts.graphic.LinearGradient(
|
|
|
- // 0, 0, 0, 1,
|
|
|
- // [{ offset: 0, color: 'rgba(0, 255, 0, 0.3)' }, { offset: 1, color: 'rgba(0, 255, 0, 0)' }]
|
|
|
- // )
|
|
|
- // },
|
|
|
- // smooth: true,
|
|
|
- // lineStyle: {
|
|
|
- // color: 'green' // 线条颜色
|
|
|
- // }
|
|
|
- // },
|
|
|
- // {
|
|
|
- // name: '中睡',
|
|
|
- // type: 'line',
|
|
|
- // data: list20,
|
|
|
- // itemStyle: {
|
|
|
- // areaColor: new echarts.graphic.LinearGradient(
|
|
|
- // 0, 0, 0, 1,
|
|
|
- // [{ offset: 0, color: 'rgba(0, 255, 0, 0.3)' }, { offset: 1, color: 'rgba(0, 255, 0, 0)' }]
|
|
|
- // )
|
|
|
- // },
|
|
|
- // smooth: true,
|
|
|
- // lineStyle: {
|
|
|
- // color: 'green' // 线条颜色
|
|
|
- // }
|
|
|
- // } ,
|
|
|
- // {
|
|
|
- // name: '深睡',
|
|
|
- // type: 'line',
|
|
|
- // data: list30,
|
|
|
- // itemStyle: {
|
|
|
- // areaColor: new echarts.graphic.LinearGradient(
|
|
|
- // 0, 0, 0, 1,
|
|
|
- // [{ offset: 0, color: 'rgba(0, 255, 0, 0.3)' }, { offset: 1, color: 'rgba(0, 255, 0, 0)' }]
|
|
|
- // )
|
|
|
- // },
|
|
|
- // smooth: true,
|
|
|
- // lineStyle: {
|
|
|
- // color: 'green' // 线条颜色
|
|
|
- // }
|
|
|
- // }
|
|
|
- // // 如果有更多分类,继续添加...
|
|
|
- // ],
|
|
|
- // tooltip: {
|
|
|
- // trigger: 'axis',
|
|
|
- // axisPointer: {
|
|
|
- // type: 'cross',
|
|
|
- // label: {
|
|
|
- // backgroundColor: '#6a7985'
|
|
|
- // }
|
|
|
- // }
|
|
|
- // },
|
|
|
- // graphic: [{
|
|
|
- // type: 'text',
|
|
|
- // left: '5%', // 文本水平位置,这里设置为居中,你可以根据需要调整
|
|
|
- // top: '90%', // 文本垂直位置,这里设置为距离顶部 10% 的位置,作为左下方的文本
|
|
|
- // style: {
|
|
|
- // text: '入睡时间:'+startSleepTime, // 文本内容
|
|
|
- // textFill: '#333', // 文本颜色
|
|
|
- // textFontSize: 14, // 文本字体大小
|
|
|
- // textAlign: 'left', // 文本水平对齐方式
|
|
|
- // verticalAlign: 'middle' // 文本垂直对齐方式
|
|
|
- // }
|
|
|
- // }, {
|
|
|
- // type: 'text',
|
|
|
- // right: '5%', // 文本水平位置,这里设置为距离右侧 10% 的位置,作为右下方的文本
|
|
|
- // top: '90%', // 文本垂直位置,这里设置为距离底部 10% 的位置
|
|
|
- // style: {
|
|
|
- // text: '醒来时间:'+endSleepTime, // 文本内容
|
|
|
- // textFill: '#333', // 文本颜色
|
|
|
- // textFontSize: 14, // 文本字体大小
|
|
|
- // textAlign: 'right', // 文本水平对齐方式
|
|
|
- // verticalAlign: 'middle' // 文本垂直对齐方式
|
|
|
- // }
|
|
|
- // }],
|
|
|
- // };
|
|
|
-
|
|
|
- chart6.setOption(option, true);
|
|
|
+function updateBodyMovements(data1, data2, startSleepTime, endSleepTime, that) {
|
|
|
+ if (chartBodyMovementsLine) {
|
|
|
+ setBodyMovementsOption(chartBodyMovementsLine, data1, data2);
|
|
|
+ } else {
|
|
|
+ that.selectComponent('#chartBodyMovementsLine-dom').init((canvas, width, height, dpr) => {
|
|
|
+ const chart = echarts.init(canvas, null, {
|
|
|
+ width: width,
|
|
|
+ height: height,
|
|
|
+ devicePixelRatio: dpr // new
|
|
|
+ });
|
|
|
+ canvas.setChart(chart);
|
|
|
+ setBodyMovementsOption(chart, data1, data2);
|
|
|
+
|
|
|
+ // 将图表实例绑定到 this 上,可以在其他成员函数(如 dispose)中访问
|
|
|
+ chartBodyMovementsLine = chart;
|
|
|
+
|
|
|
+ // 注意这里一定要返回 chart 实例,否则会影响事件处理等
|
|
|
+ return chart;
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
-function flushChart7(data1,data2,startSleepTime,endSleepTime,that) {
|
|
|
- data1 = (!data1 || data1.length === 0)?['']:data1;
|
|
|
- data2 = (!data2 || data2.length === 0)?['']:data2;
|
|
|
- var option = {
|
|
|
- // backgroundColor: rgba(168, 115, 182, 0.5), // 设置背景色
|
|
|
- tooltip: {},
|
|
|
- xAxis: {
|
|
|
- axisLabel: {
|
|
|
- color: '#a5a5a5' ,// 设置 x 轴标签颜色为白色
|
|
|
- fontSize: 12,
|
|
|
- // interval: 0, // 设置为0表示全部显示,设置为非零值表示间隔显示
|
|
|
- // rotate: 45, // 旋转45度
|
|
|
- },
|
|
|
- splitLine: {
|
|
|
- show: false, // 是否显示刻度线
|
|
|
-
|
|
|
- },
|
|
|
- axisTick: {
|
|
|
- // 不显示Y轴刻度线
|
|
|
- show: false
|
|
|
- },
|
|
|
- data: data1,
|
|
|
- axisLine: {
|
|
|
- // 不显示X轴轴线
|
|
|
- show: false
|
|
|
- }
|
|
|
- },
|
|
|
- yAxis: {
|
|
|
- // Y 轴配置
|
|
|
- type: 'value',
|
|
|
- // inverse: true,// 设置 Y 轴逆序
|
|
|
- // 设置 Y 轴名称
|
|
|
- name: '离床次数',
|
|
|
- // 设置 Y 轴名称的位置
|
|
|
- nameLocation: 'end', // 可以是 'start'、'middle' 或 'end'
|
|
|
- axisLine: {
|
|
|
- // 不显示Y轴轴线
|
|
|
- show: false,
|
|
|
- },
|
|
|
- axisLabel: {
|
|
|
- color: '#000',
|
|
|
+
|
|
|
+//心脏系统
|
|
|
+
|
|
|
+function initChartCardiacSystemLine(canvas, width, height, dpr) {
|
|
|
+ // 在这里初始化图表
|
|
|
+ const chart = echarts.init(canvas, null, {
|
|
|
+ width: width,
|
|
|
+ height: height,
|
|
|
+ devicePixelRatio: dpr // new
|
|
|
+ });
|
|
|
+ canvas.setChart(chart);
|
|
|
+ setCardiacSystemOption(chart);
|
|
|
+
|
|
|
+ // 将图表实例绑定到 this 上,可以在其他成员函数(如 dispose)中访问
|
|
|
+ chartCardiacSystemLine = chart;
|
|
|
+
|
|
|
+ // 注意这里一定要返回 chart 实例,否则会影响事件处理等
|
|
|
+ return chart;
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
+function setCardiacSystemOption(chart, data1 = [], data2 = [],) {
|
|
|
+ var option = option = {
|
|
|
+ tooltip: {
|
|
|
show: true,
|
|
|
- fontSize: 12,
|
|
|
- formatter: function (value) {
|
|
|
- if(value == 0){
|
|
|
- return '离床';
|
|
|
- }else if(value == 1){
|
|
|
- return '在床';
|
|
|
- }else{
|
|
|
- return '';
|
|
|
- }
|
|
|
+ trigger: 'axis',
|
|
|
+ formatter: function (param) {
|
|
|
+ return `${(param[0].value || 0) + '次'}`
|
|
|
}
|
|
|
},
|
|
|
- axisTick: {
|
|
|
- // 不显示Y轴刻度线
|
|
|
- show: false
|
|
|
- },
|
|
|
- splitLine: {
|
|
|
- show: false ,// 不显示纵坐标轴的刻度线
|
|
|
- lineStyle: {
|
|
|
- color: 'rgba(222, 222, 222, 0.1)', // 灰色并调整透明度
|
|
|
- width: 1, // 刻度线宽度
|
|
|
- type: 'solid' // 刻度线类型,默认为实线
|
|
|
- }
|
|
|
- },
|
|
|
- },
|
|
|
- series: [{
|
|
|
- type: 'line',
|
|
|
- data: data2,
|
|
|
- smooth: true, // 使折线平滑
|
|
|
- markPoint: {
|
|
|
- symbol: 'circle', // 标记的符号为圆圈
|
|
|
- symbolSize: 10, // 标记的大小
|
|
|
- itemStyle: {
|
|
|
- color: 'rgba(85, 255, 127, 0.8)',
|
|
|
- // borderColor: 'blue',
|
|
|
- borderWidth: 1, // 设置边框宽度
|
|
|
- fill: 'none' // 设置填充颜色为无,即空心
|
|
|
- },
|
|
|
- data: [
|
|
|
- // 假设 data[0] 和 data[data.length - 1] 分别是开始和结束的数据点
|
|
|
- {coord: [data1?data1[0]:'', data2?data2[0]:''], name: '开始'},
|
|
|
- {coord: [data1?data1[data1.length-1]:'', data2?data2[data2.length-1]:''], name: '结束'}
|
|
|
- // 如果要添加拐角处的标记,需要手动计算并添加
|
|
|
- ]
|
|
|
- },
|
|
|
- areaStyle: { // 折线下方的区域样式
|
|
|
- color: new echarts.graphic.LinearGradient(
|
|
|
- 0, 0, 0, 1, // 渐变方向
|
|
|
- [ // 渐变颜色
|
|
|
- {offset: 0, color: 'rgba(85, 255, 127, 0.8)'}, // 使用之前定义的渐变
|
|
|
- {offset: 0.9, color: 'rgba(255, 255, 255, 1)'} // 可选,结束颜色
|
|
|
- ]
|
|
|
- ),
|
|
|
- opacity: 0.3 // 区域的不透明度,可以根据需要调整
|
|
|
- },
|
|
|
- lineStyle: {
|
|
|
- color: 'rgba(85, 255, 127, 0.8)' // 奶白色,80% 透明度
|
|
|
- },
|
|
|
- showSymbol: false // 是否显示标记图形
|
|
|
+ dataZoom: [
|
|
|
+ { // 第一个 dataZoom 组件
|
|
|
+ type: 'inside',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ grid: {
|
|
|
+ top: '20rpx',
|
|
|
+ left: '20rpx',
|
|
|
+ right: '20rpx',
|
|
|
+ bottom: '10rpx',
|
|
|
+ containLabel: true
|
|
|
+ },
|
|
|
+ xAxis: {
|
|
|
+ type: 'category',
|
|
|
+ axisLabel: {
|
|
|
+ color: '#6C6970',// 设置 x 轴标签颜色为白色
|
|
|
+ fontSize: 10
|
|
|
+ },
|
|
|
+ boundaryGap: false,
|
|
|
+ splitLine: {
|
|
|
+ show: false, // 是否显示刻度线
|
|
|
+
|
|
|
+ },
|
|
|
+ axisTick: {
|
|
|
+ // 不显示Y轴刻度线
|
|
|
+ show: false
|
|
|
+ },
|
|
|
+ data: data1,
|
|
|
+ axisLine: {
|
|
|
+ // 不显示X轴轴线
|
|
|
+ show: false
|
|
|
}
|
|
|
- ],
|
|
|
- // graphic: {
|
|
|
- // type: 'rect',
|
|
|
- // left: 'center', // 相对于容器左侧的距离
|
|
|
- // top: 'bottom', // 相对于容器上侧的距离
|
|
|
- // width: 'auto', // 宽度自适应
|
|
|
- // height: '10', // 设置你想要的渐变高度
|
|
|
- // shape: {
|
|
|
- // // 可以通过 shape 来调整矩形的形状以适应你的需求
|
|
|
- // },
|
|
|
- // style: {
|
|
|
- // fill: {
|
|
|
- // type: 'linear',
|
|
|
- // x: 0,
|
|
|
- // y: 0,
|
|
|
- // x2: 0,
|
|
|
- // y2: 1,
|
|
|
- // colorStops: [{
|
|
|
- // offset: 0, color: 'rgba(0,0,0,0)' // 开始颜色,透明
|
|
|
- // }, {
|
|
|
- // offset: 1, color: 'rgba(255,0,0,0.3)' // 结束颜色,半透明红色
|
|
|
- // }],
|
|
|
- // global: false // 缺省为 false
|
|
|
- // },
|
|
|
- // // 其他样式配置
|
|
|
- // },
|
|
|
- // z: -1 // 设置层级,确保在折线图下方
|
|
|
- // }
|
|
|
- // graphic: [{
|
|
|
- // type: 'text',
|
|
|
- // left: '5%', // 文本水平位置,这里设置为居中,你可以根据需要调整
|
|
|
- // top: '90%', // 文本垂直位置,这里设置为距离顶部 10% 的位置,作为左下方的文本
|
|
|
- // style: {
|
|
|
- // text: '入睡时间:'+startSleepTime?startSleepTime:'', // 文本内容
|
|
|
- // textFill: '#333', // 文本颜色
|
|
|
- // textFontSize: 14, // 文本字体大小
|
|
|
- // textAlign: 'left', // 文本水平对齐方式
|
|
|
- // verticalAlign: 'middle' // 文本垂直对齐方式
|
|
|
- // }
|
|
|
- // }, {
|
|
|
- // type: 'text',
|
|
|
- // right: '5%', // 文本水平位置,这里设置为距离右侧 10% 的位置,作为右下方的文本
|
|
|
- // top: '90%', // 文本垂直位置,这里设置为距离底部 10% 的位置
|
|
|
- // style: {
|
|
|
- // text: '醒来时间:'+endSleepTime?endSleepTime:'', // 文本内容
|
|
|
- // textFill: '#333', // 文本颜色
|
|
|
- // textFontSize: 14, // 文本字体大小
|
|
|
- // textAlign: 'right', // 文本水平对齐方式
|
|
|
- // verticalAlign: 'middle' // 文本垂直对齐方式
|
|
|
- // }
|
|
|
- // }],
|
|
|
- };
|
|
|
-
|
|
|
- chart7.setOption(option, true);
|
|
|
+ },
|
|
|
+ yAxis: {
|
|
|
+ type: 'value',
|
|
|
+ max: 100,
|
|
|
+ min: 0,
|
|
|
+ show: true,
|
|
|
+ offset: 10,
|
|
|
+ splitLine: {
|
|
|
+ show: false
|
|
|
+ },
|
|
|
+ axisLabel: {
|
|
|
+ hideOverlap: true,
|
|
|
+ fontSize: 10,
|
|
|
+ }
|
|
|
+ },
|
|
|
+ series: [{
|
|
|
+ type: 'line',
|
|
|
+ smooth: true,
|
|
|
+ lineStyle: {
|
|
|
+ width: 2,
|
|
|
+ color: '#F47893'
|
|
|
+ },
|
|
|
+ showSymbol: false,
|
|
|
+ areaStyle: {
|
|
|
+ opacity: 0.8,
|
|
|
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
+ {
|
|
|
+ offset: 0,
|
|
|
+ color: 'rgba(244, 120, 147, 0.5)'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ offset: 1,
|
|
|
+ color: 'rgba(250, 140, 164, 0.3)'
|
|
|
+ }
|
|
|
+ ])
|
|
|
+ },
|
|
|
+ data: data2,
|
|
|
+ }]
|
|
|
+ };
|
|
|
+
|
|
|
+ chart.setOption(option, true);
|
|
|
}
|
|
|
|
|
|
-function flushChart8(data1,data2,startSleepTime,endSleepTime,that) {
|
|
|
- var option = {
|
|
|
- // backgroundColor: rgba(168, 115, 182, 0.5), // 设置背景色
|
|
|
- tooltip: {},
|
|
|
- xAxis: {
|
|
|
- axisLabel: {
|
|
|
- color: '#000' // 设置 x 轴标签颜色为白色
|
|
|
- },
|
|
|
- splitLine: {
|
|
|
- show: false, // 是否显示刻度线
|
|
|
- },
|
|
|
- axisTick: {
|
|
|
- // 不显示Y轴刻度线
|
|
|
- show: false
|
|
|
- },
|
|
|
- axisLine: {
|
|
|
- // 不显示X轴轴线
|
|
|
- show: false
|
|
|
- },
|
|
|
- data: data1?data1:[]
|
|
|
- },
|
|
|
- yAxis: {
|
|
|
- // Y 轴配置
|
|
|
- type: 'value',
|
|
|
- // 设置 Y 轴名称
|
|
|
- name: '睡眠状态',
|
|
|
- // 设置 Y 轴名称的位置
|
|
|
- nameLocation: 'end', // 可以是 'start'、'middle' 或 'end'
|
|
|
- axisLine: {
|
|
|
- // 不显示Y轴轴线
|
|
|
- show: false,
|
|
|
- },
|
|
|
- axisTick: {
|
|
|
- // 不显示Y轴刻度线
|
|
|
- show: false
|
|
|
- },
|
|
|
- axisLabel: {
|
|
|
- color: '#000',
|
|
|
- formatter: function (value) {
|
|
|
- return that.sleepRmove_arrChange(value);
|
|
|
- }
|
|
|
- },
|
|
|
- splitLine: {
|
|
|
- show: false ,// 不显示纵坐标轴的刻度线
|
|
|
- lineStyle: {
|
|
|
- color: 'rgba(222, 222, 222, 0.1)', // 灰色并调整透明度
|
|
|
- width: 1, // 刻度线宽度
|
|
|
- type: 'solid' // 刻度线类型,默认为实线
|
|
|
- }
|
|
|
- },
|
|
|
- },
|
|
|
- series: [{
|
|
|
- type: 'line',
|
|
|
- data: data2?data2:[],
|
|
|
- lineStyle: {
|
|
|
- color: 'rgba(255, 255, 255, 0.8)' // 奶白色,80% 透明度
|
|
|
- },
|
|
|
- showSymbol: false, // 是否显示标记图形
|
|
|
- smooth: true, // 使折线平滑
|
|
|
- markPoint: {
|
|
|
- symbol: 'circle', // 标记的符号为圆圈
|
|
|
- symbolSize: 10, // 标记的大小
|
|
|
- itemStyle: {
|
|
|
- color: 'rgba(0, 170, 255, 0.8)',
|
|
|
- // borderColor: 'blue',
|
|
|
- borderWidth: 1, // 设置边框宽度
|
|
|
- fill: 'none' // 设置填充颜色为无,即空心
|
|
|
- },
|
|
|
- data: [
|
|
|
- // 假设 data[0] 和 data[data.length - 1] 分别是开始和结束的数据点
|
|
|
- {coord: [data1?data1[0]:'', data2?data2[0]:''], name: '开始'},
|
|
|
- {coord: [data1?data1[data1.length-1]:'', data2?data2[data2.length-1]:''], name: '结束'}
|
|
|
- // 如果要添加拐角处的标记,需要手动计算并添加
|
|
|
- ]
|
|
|
- },
|
|
|
- areaStyle: { // 折线下方的区域样式
|
|
|
- color: new echarts.graphic.LinearGradient(
|
|
|
- 0, 0, 0, 1, // 渐变方向
|
|
|
- [ // 渐变颜色
|
|
|
- {offset: 0, color: 'rgba(0, 170, 255, 0.8)'}, // 使用之前定义的渐变
|
|
|
- {offset: 0.9, color: 'rgba(255, 255, 255, 1)'} // 可选,结束颜色
|
|
|
- ]
|
|
|
- ),
|
|
|
- opacity: 0.3 // 区域的不透明度,可以根据需要调整
|
|
|
- },
|
|
|
- },
|
|
|
-
|
|
|
- ],
|
|
|
- // graphic: [{
|
|
|
- // type: 'text',
|
|
|
- // left: '5%', // 文本水平位置,这里设置为居中,你可以根据需要调整
|
|
|
- // top: '90%', // 文本垂直位置,这里设置为距离顶部 10% 的位置,作为左下方的文本
|
|
|
- // style: {
|
|
|
- // text: '入睡时间:'+startSleepTime?startSleepTime:'', // 文本内容
|
|
|
- // textFill: '#333', // 文本颜色
|
|
|
- // textFontSize: 14, // 文本字体大小
|
|
|
- // textAlign: 'left', // 文本水平对齐方式
|
|
|
- // verticalAlign: 'middle' // 文本垂直对齐方式
|
|
|
- // }
|
|
|
- // }, {
|
|
|
- // type: 'text',
|
|
|
- // right: '5%', // 文本水平位置,这里设置为距离右侧 10% 的位置,作为右下方的文本
|
|
|
- // top: '90%', // 文本垂直位置,这里设置为距离底部 10% 的位置
|
|
|
- // style: {
|
|
|
- // text: '醒来时间:'+endSleepTime?endSleepTime:'', // 文本内容
|
|
|
- // textFill: '#333', // 文本颜色
|
|
|
- // textFontSize: 14, // 文本字体大小
|
|
|
- // textAlign: 'right', // 文本水平对齐方式
|
|
|
- // verticalAlign: 'middle' // 文本垂直对齐方式
|
|
|
- // }
|
|
|
- // }],
|
|
|
- };
|
|
|
-
|
|
|
- chart8.setOption(option, true);
|
|
|
+function updateCardiacSystem(data1, data2, that) {
|
|
|
+ if (chartCardiacSystemLine) {
|
|
|
+ setCardiacSystemOption(chartCardiacSystemLine, data1, data2);
|
|
|
+ } else {
|
|
|
+ that.selectComponent('#chartCardiacSystemLine-dom').init((canvas, width, height, dpr) => {
|
|
|
+ const chart = echarts.init(canvas, null, {
|
|
|
+ width: width,
|
|
|
+ height: height,
|
|
|
+ devicePixelRatio: dpr // new
|
|
|
+ });
|
|
|
+ canvas.setChart(chart);
|
|
|
+ setCardiacSystemOption(chart, data1, data2);
|
|
|
+
|
|
|
+ // 将图表实例绑定到 this 上,可以在其他成员函数(如 dispose)中访问
|
|
|
+ chartBodyMovementsLine = chart;
|
|
|
+
|
|
|
+ // 注意这里一定要返回 chart 实例,否则会影响事件处理等
|
|
|
+ return chart;
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
-function flushChart81(data1,data2,startSleepTime,endSleepTime,that) {
|
|
|
- var option = {
|
|
|
- // backgroundColor: rgba(168, 115, 182, 0.5), // 设置背景色
|
|
|
- tooltip: {},
|
|
|
- xAxis: {
|
|
|
- axisLabel: {
|
|
|
- color: '#000' // 设置 x 轴标签颜色为白色
|
|
|
- },
|
|
|
- splitLine: {
|
|
|
+//平均呼吸率
|
|
|
+
|
|
|
+function initChartRespiratoryLine(canvas, width, height, dpr) {
|
|
|
+ // 在这里初始化图表
|
|
|
+ const chart = echarts.init(canvas, null, {
|
|
|
+ width: width,
|
|
|
+ height: height,
|
|
|
+ devicePixelRatio: dpr // new
|
|
|
+ });
|
|
|
+ canvas.setChart(chart);
|
|
|
+ setRespiratoryOption(chart);
|
|
|
+
|
|
|
+ // 将图表实例绑定到 this 上,可以在其他成员函数(如 dispose)中访问
|
|
|
+ chartRespiratoryLine = chart;
|
|
|
+
|
|
|
+ // 注意这里一定要返回 chart 实例,否则会影响事件处理等
|
|
|
+ return chart;
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
+function setRespiratoryOption(chart, data1 = [], data2 = [],) {
|
|
|
+ var option = option = {
|
|
|
+ tooltip: {
|
|
|
+ show: true,
|
|
|
+ trigger: 'axis',
|
|
|
+ formatter: function (param) {
|
|
|
+ return `${(param[0].value || 0) + '次'}`
|
|
|
+ }
|
|
|
+ },
|
|
|
+ dataZoom: [
|
|
|
+ { // 第一个 dataZoom 组件
|
|
|
+ type: 'inside',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ grid: {
|
|
|
+ top: '20rpx',
|
|
|
+ left: '20rpx',
|
|
|
+ right: '20rpx',
|
|
|
+ bottom: '10rpx',
|
|
|
+ containLabel: true
|
|
|
+ },
|
|
|
+ xAxis: {
|
|
|
+ type: 'category',
|
|
|
+ axisLabel: {
|
|
|
+ color: '#6C6970',// 设置 x 轴标签颜色为白色
|
|
|
+ fontSize: 10
|
|
|
+ },
|
|
|
+ boundaryGap: false,
|
|
|
+ splitLine: {
|
|
|
show: false, // 是否显示刻度线
|
|
|
- },
|
|
|
- axisTick: {
|
|
|
- // 不显示Y轴刻度线
|
|
|
- show: false
|
|
|
- },
|
|
|
- axisLine: {
|
|
|
- // 不显示X轴轴线
|
|
|
- show: false
|
|
|
- },
|
|
|
- data: data1?data1:[]
|
|
|
- },
|
|
|
- yAxis: {
|
|
|
- // Y 轴配置
|
|
|
- type: 'value',
|
|
|
- // 设置 Y 轴名称
|
|
|
- name: '呼吸平均值',
|
|
|
- // 设置 Y 轴名称的位置
|
|
|
- nameLocation: 'end', // 可以是 'start'、'middle' 或 'end'
|
|
|
- axisLine: {
|
|
|
- // 不显示Y轴轴线
|
|
|
- show: false,
|
|
|
- },
|
|
|
- axisTick: {
|
|
|
- // 不显示Y轴刻度线
|
|
|
- show: false
|
|
|
- },
|
|
|
- axisLabel: {
|
|
|
- color: '#000',
|
|
|
- // formatter: function (value) {
|
|
|
- // return that.sleepRmove_arrChange(value);
|
|
|
- // }
|
|
|
- },
|
|
|
- splitLine: {
|
|
|
- show: false ,// 不显示纵坐标轴的刻度线
|
|
|
- lineStyle: {
|
|
|
- color: 'rgba(222, 222, 222, 0.1)', // 灰色并调整透明度
|
|
|
- width: 1, // 刻度线宽度
|
|
|
- type: 'solid' // 刻度线类型,默认为实线
|
|
|
- }
|
|
|
- },
|
|
|
- },
|
|
|
- series: [{
|
|
|
- type: 'line',
|
|
|
- data: data2?data2:[],
|
|
|
- lineStyle: {
|
|
|
- color: 'rgba(0, 182, 182, 0.8)' // 奶白色,80% 透明度
|
|
|
- },
|
|
|
- showSymbol: false ,// 是否显示标记图形
|
|
|
- smooth: true, // 使折线平滑
|
|
|
- markPoint: {
|
|
|
- symbol: 'circle', // 标记的符号为圆圈
|
|
|
- symbolSize: 10, // 标记的大小
|
|
|
- itemStyle: {
|
|
|
- color: 'rgba(0, 182, 182, 0.8)',
|
|
|
- // borderColor: 'blue',
|
|
|
- borderWidth: 1, // 设置边框宽度
|
|
|
- fill: 'none' // 设置填充颜色为无,即空心
|
|
|
- },
|
|
|
- data: [
|
|
|
- // 假设 data[0] 和 data[data.length - 1] 分别是开始和结束的数据点
|
|
|
- {coord: [data1?data1[0]:'', data2?data2[0]:''], name: '开始'},
|
|
|
- {coord: [data1?data1[data1.length-1]:'', data2?data2[data2.length-1]:''], name: '结束'}
|
|
|
- // 如果要添加拐角处的标记,需要手动计算并添加
|
|
|
- ]
|
|
|
+
|
|
|
+ },
|
|
|
+ axisTick: {
|
|
|
+ // 不显示Y轴刻度线
|
|
|
+ show: false
|
|
|
+ },
|
|
|
+ data: data1,
|
|
|
+ axisLine: {
|
|
|
+ // 不显示X轴轴线
|
|
|
+ show: false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ yAxis: {
|
|
|
+ type: 'value',
|
|
|
+ max: 24,
|
|
|
+ min: 0,
|
|
|
+ show: true,
|
|
|
+ offset: 10,
|
|
|
+ splitLine: {
|
|
|
+ show: false
|
|
|
+ },
|
|
|
+ axisLabel: {
|
|
|
+ hideOverlap: true,
|
|
|
+ fontSize: 10,
|
|
|
+ }
|
|
|
+ },
|
|
|
+ series: [{
|
|
|
+ type: 'line',
|
|
|
+ smooth: true,
|
|
|
+ lineStyle: {
|
|
|
+ width: 2,
|
|
|
+ color: '#06A9AD'
|
|
|
+ },
|
|
|
+ showSymbol: false,
|
|
|
+ areaStyle: {
|
|
|
+ opacity: 0.8,
|
|
|
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
+ {
|
|
|
+ offset: 0,
|
|
|
+ color: 'rgba(186, 246, 231, 1)'
|
|
|
},
|
|
|
- areaStyle: { // 折线下方的区域样式
|
|
|
- color: new echarts.graphic.LinearGradient(
|
|
|
- 0, 0, 0, 1, // 渐变方向
|
|
|
- [ // 渐变颜色
|
|
|
- {offset: 0, color: 'rgba(0, 182, 182, 0.8)'}, // 使用之前定义的渐变
|
|
|
- {offset: 0.9, color: 'rgba(255, 255, 255, 1)'} // 可选,结束颜色
|
|
|
- ]
|
|
|
- ),
|
|
|
- opacity: 0.3 // 区域的不透明度,可以根据需要调整
|
|
|
- },
|
|
|
- }
|
|
|
- ],
|
|
|
- // graphic: [{
|
|
|
- // type: 'text',
|
|
|
- // left: '5%', // 文本水平位置,这里设置为居中,你可以根据需要调整
|
|
|
- // top: '90%', // 文本垂直位置,这里设置为距离顶部 10% 的位置,作为左下方的文本
|
|
|
- // style: {
|
|
|
- // text: '入睡时间:'+startSleepTime?startSleepTime:'', // 文本内容
|
|
|
- // textFill: '#333', // 文本颜色
|
|
|
- // textFontSize: 14, // 文本字体大小
|
|
|
- // textAlign: 'left', // 文本水平对齐方式
|
|
|
- // verticalAlign: 'middle' // 文本垂直对齐方式
|
|
|
- // }
|
|
|
- // }, {
|
|
|
- // type: 'text',
|
|
|
- // right: '5%', // 文本水平位置,这里设置为距离右侧 10% 的位置,作为右下方的文本
|
|
|
- // top: '90%', // 文本垂直位置,这里设置为距离底部 10% 的位置
|
|
|
- // style: {
|
|
|
- // text: '醒来时间:'+endSleepTime?endSleepTime:'', // 文本内容
|
|
|
- // textFill: '#333', // 文本颜色
|
|
|
- // textFontSize: 14, // 文本字体大小
|
|
|
- // textAlign: 'right', // 文本水平对齐方式
|
|
|
- // verticalAlign: 'middle' // 文本垂直对齐方式
|
|
|
- // }
|
|
|
- // }],
|
|
|
- };
|
|
|
-
|
|
|
- chart81.setOption(option, true);
|
|
|
+ {
|
|
|
+ offset: 1,
|
|
|
+ color: 'rgba(255, 255, 255, 0)'
|
|
|
+ }
|
|
|
+ ])
|
|
|
+ },
|
|
|
+ data: data2,
|
|
|
+ }]
|
|
|
+ };
|
|
|
+
|
|
|
+ chart.setOption(option, true);
|
|
|
}
|
|
|
|
|
|
-function flushChart9(data1,data2,startSleepTime,endSleepTime,that) {
|
|
|
- var option = {
|
|
|
- // backgroundColor: rgba(168, 115, 182, 0.5), // 设置背景色
|
|
|
- tooltip: {},
|
|
|
- xAxis: {
|
|
|
- axisLabel: {
|
|
|
- color: '#000' // 设置 x 轴标签颜色为白色
|
|
|
- },
|
|
|
- splitLine: {
|
|
|
- show: false, // 是否显示刻度线
|
|
|
- },
|
|
|
- axisTick: {
|
|
|
- // 不显示Y轴刻度线
|
|
|
- show: false
|
|
|
- },
|
|
|
- axisLine: {
|
|
|
- // 不显示X轴轴线
|
|
|
- show: false
|
|
|
- },
|
|
|
- data: data1?data1:[]
|
|
|
- },
|
|
|
- yAxis: {
|
|
|
- // Y 轴配置
|
|
|
- type: 'value',
|
|
|
- // 设置 Y 轴名称
|
|
|
- name: '睡眠状态',
|
|
|
- // 设置 Y 轴名称的位置
|
|
|
- nameLocation: 'end', // 可以是 'start'、'middle' 或 'end'
|
|
|
- axisLine: {
|
|
|
- // 不显示Y轴轴线
|
|
|
- show: false,
|
|
|
- },
|
|
|
- axisTick: {
|
|
|
- // 不显示Y轴刻度线
|
|
|
- show: false
|
|
|
- },
|
|
|
- axisLabel: {
|
|
|
- color: '#000',
|
|
|
- formatter: function (value) {
|
|
|
- return that.sleepRsnoring_arrChange(value);
|
|
|
- }
|
|
|
- },
|
|
|
- splitLine: {
|
|
|
- show: false ,// 不显示纵坐标轴的刻度线
|
|
|
- lineStyle: {
|
|
|
- color: 'rgba(222, 222, 222, 0.1)', // 灰色并调整透明度
|
|
|
- width: 1, // 刻度线宽度
|
|
|
- type: 'solid' // 刻度线类型,默认为实线
|
|
|
- }
|
|
|
- },
|
|
|
- },
|
|
|
- series: [{
|
|
|
- type: 'line',
|
|
|
- data: data2?data2:[],
|
|
|
- lineStyle: {
|
|
|
- color: 'rgba(255, 170, 127, 0.8)' // 奶白色,80% 透明度
|
|
|
- },
|
|
|
- showSymbol: false ,// 是否显示标记图形
|
|
|
- smooth: true, // 使折线平滑
|
|
|
- markPoint: {
|
|
|
- symbol: 'circle', // 标记的符号为圆圈
|
|
|
- symbolSize: 10, // 标记的大小
|
|
|
- itemStyle: {
|
|
|
- color: 'rgba(255, 170, 127, 0.8)',
|
|
|
- // borderColor: 'blue',
|
|
|
- borderWidth: 1, // 设置边框宽度
|
|
|
- fill: 'none' // 设置填充颜色为无,即空心
|
|
|
- },
|
|
|
- data: [
|
|
|
- // 假设 data[0] 和 data[data.length - 1] 分别是开始和结束的数据点
|
|
|
- {coord: [data1?data1[0]:'', data2?data2[0]:''], name: '开始'},
|
|
|
- {coord: [data1?data1[data1.length-1]:'', data2?data2[data2.length-1]:''], name: '结束'}
|
|
|
- // 如果要添加拐角处的标记,需要手动计算并添加
|
|
|
- ]
|
|
|
- },
|
|
|
- areaStyle: { // 折线下方的区域样式
|
|
|
- color: new echarts.graphic.LinearGradient(
|
|
|
- 0, 0, 0, 1, // 渐变方向
|
|
|
- [ // 渐变颜色
|
|
|
- {offset: 0, color: 'rgba(255, 170, 127, 0.8)'}, // 使用之前定义的渐变
|
|
|
- {offset: 0.9, color: 'rgba(255, 255, 255, 1)'} // 可选,结束颜色
|
|
|
- ]
|
|
|
- ),
|
|
|
- opacity: 0.3 // 区域的不透明度,可以根据需要调整
|
|
|
- },
|
|
|
- }
|
|
|
- ],
|
|
|
- // graphic: [{
|
|
|
- // type: 'text',
|
|
|
- // left: '5%', // 文本水平位置,这里设置为居中,你可以根据需要调整
|
|
|
- // top: '90%', // 文本垂直位置,这里设置为距离顶部 10% 的位置,作为左下方的文本
|
|
|
- // style: {
|
|
|
- // text: '入睡时间:'+startSleepTime?startSleepTime:'', // 文本内容
|
|
|
- // textFill: '#333', // 文本颜色
|
|
|
- // textFontSize: 14, // 文本字体大小
|
|
|
- // textAlign: 'left', // 文本水平对齐方式
|
|
|
- // verticalAlign: 'middle' // 文本垂直对齐方式
|
|
|
- // }
|
|
|
- // }, {
|
|
|
- // type: 'text',
|
|
|
- // right: '5%', // 文本水平位置,这里设置为距离右侧 10% 的位置,作为右下方的文本
|
|
|
- // top: '90%', // 文本垂直位置,这里设置为距离底部 10% 的位置
|
|
|
- // style: {
|
|
|
- // text: '醒来时间:'+endSleepTime?endSleepTime:'', // 文本内容
|
|
|
- // textFill: '#333', // 文本颜色
|
|
|
- // textFontSize: 14, // 文本字体大小
|
|
|
- // textAlign: 'right', // 文本水平对齐方式
|
|
|
- // verticalAlign: 'middle' // 文本垂直对齐方式
|
|
|
- // }
|
|
|
- // }],
|
|
|
- };
|
|
|
-
|
|
|
- chart9.setOption(option, true);
|
|
|
+function updateRespiratory(data1, data2, startSleepTime, endSleepTime, that) {
|
|
|
+ if (chartRespiratoryLine) {
|
|
|
+ setRespiratoryOption(chartRespiratoryLine, data1, data2);
|
|
|
+ } else {
|
|
|
+ that.selectComponent('#chartRespiratoryLine-dom').init((canvas, width, height, dpr) => {
|
|
|
+ const chart = echarts.init(canvas, null, {
|
|
|
+ width: width,
|
|
|
+ height: height,
|
|
|
+ devicePixelRatio: dpr // new
|
|
|
+ });
|
|
|
+ canvas.setChart(chart);
|
|
|
+ setRespiratoryOption(chart, data1, data2);
|
|
|
+
|
|
|
+ // 将图表实例绑定到 this 上,可以在其他成员函数(如 dispose)中访问
|
|
|
+ chartRespiratoryLine = chart;
|
|
|
+
|
|
|
+ // 注意这里一定要返回 chart 实例,否则会影响事件处理等
|
|
|
+ return chart;
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
-function flushChart10(data1,data2,startSleepTime,endSleepTime,that) {
|
|
|
- var option = {
|
|
|
- // backgroundColor: rgba(168, 115, 182, 0.5), // 设置背景色
|
|
|
- tooltip: {},
|
|
|
- xAxis: {
|
|
|
- axisLabel: {
|
|
|
- color: '#000' // 设置 x 轴标签颜色为白色
|
|
|
- },
|
|
|
- splitLine: {
|
|
|
+//打鼾
|
|
|
+
|
|
|
+function initSnoringLine(canvas, width, height, dpr) {
|
|
|
+ // 在这里初始化图表
|
|
|
+ const chart = echarts.init(canvas, null, {
|
|
|
+ width: width,
|
|
|
+ height: height,
|
|
|
+ devicePixelRatio: dpr // new
|
|
|
+ });
|
|
|
+ canvas.setChart(chart);
|
|
|
+ setSnoringOption(chart);
|
|
|
+
|
|
|
+ // 将图表实例绑定到 this 上,可以在其他成员函数(如 dispose)中访问
|
|
|
+ chartSnoringLine = chart;
|
|
|
+
|
|
|
+ // 注意这里一定要返回 chart 实例,否则会影响事件处理等
|
|
|
+ return chart;
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
+function setSnoringOption(chart, data1 = [], data2 = [],) {
|
|
|
+ var option = option = {
|
|
|
+ tooltip: {
|
|
|
+ show: true,
|
|
|
+ trigger: 'axis',
|
|
|
+ formatter: function (param) {
|
|
|
+ return `${param[0] && param[0].value == 1 ? '打鼾' : '否'}`
|
|
|
+ }
|
|
|
+ },
|
|
|
+ dataZoom: [
|
|
|
+ { // 第一个 dataZoom 组件
|
|
|
+ type: 'inside',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ grid: {
|
|
|
+ top: '10rpx',
|
|
|
+ left: 0,
|
|
|
+ right: '20rpx',
|
|
|
+ bottom: 0,
|
|
|
+ containLabel: true
|
|
|
+ },
|
|
|
+ xAxis: {
|
|
|
+ type: 'category',
|
|
|
+ axisLabel: {
|
|
|
+ color: '#6C6970',// 设置 x 轴标签颜色为白色
|
|
|
+ fontSize: 10
|
|
|
+ },
|
|
|
+ boundaryGap: false,
|
|
|
+ splitLine: {
|
|
|
show: false, // 是否显示刻度线
|
|
|
- },
|
|
|
- axisTick: {
|
|
|
- // 不显示Y轴刻度线
|
|
|
- show: false
|
|
|
- },
|
|
|
- axisLine: {
|
|
|
- // 不显示X轴轴线
|
|
|
- show: false
|
|
|
- },
|
|
|
- data: data1?data1:[]
|
|
|
- },
|
|
|
- yAxis: {
|
|
|
- // Y 轴配置
|
|
|
- type: 'value',
|
|
|
- // 设置 Y 轴名称
|
|
|
- name: '睡眠状态',
|
|
|
- // 设置 Y 轴名称的位置
|
|
|
- nameLocation: 'end', // 可以是 'start'、'middle' 或 'end'
|
|
|
- axisLine: {
|
|
|
- // 不显示Y轴轴线
|
|
|
+
|
|
|
+ },
|
|
|
+ axisTick: {
|
|
|
+ // 不显示Y轴刻度线
|
|
|
+ show: false
|
|
|
+ },
|
|
|
+ data: data1,
|
|
|
+ axisLine: {
|
|
|
+ // 不显示X轴轴线
|
|
|
+ show: false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ yAxis: {
|
|
|
+ type: 'value',
|
|
|
+ max: 24,
|
|
|
+ min: 0,
|
|
|
show: false,
|
|
|
- },
|
|
|
- axisTick: {
|
|
|
- // 不显示Y轴刻度线
|
|
|
- show: false
|
|
|
- },
|
|
|
- axisLabel: {
|
|
|
- color: '#000',
|
|
|
- formatter: function (value) {
|
|
|
- return that.sleepRhxstop_arrChange(value);
|
|
|
- }
|
|
|
- },
|
|
|
- splitLine: {
|
|
|
- show: false ,// 不显示纵坐标轴的刻度线
|
|
|
- lineStyle: {
|
|
|
- color: 'rgba(222, 222, 222, 0.1)', // 灰色并调整透明度
|
|
|
- width: 1, // 刻度线宽度
|
|
|
- type: 'solid' // 刻度线类型,默认为实线
|
|
|
- }
|
|
|
- },
|
|
|
- },
|
|
|
- series: [{
|
|
|
- type: 'line',
|
|
|
- data: data2?data2:[],
|
|
|
- lineStyle: {
|
|
|
- color: 'rgba(0, 85, 255, 0.8)' // 奶白色,80% 透明度
|
|
|
- },
|
|
|
- showSymbol: false ,// 是否显示标记图形
|
|
|
- smooth: true, // 使折线平滑
|
|
|
- markPoint: {
|
|
|
- symbol: 'circle', // 标记的符号为圆圈
|
|
|
- symbolSize: 10, // 标记的大小
|
|
|
- itemStyle: {
|
|
|
- color: 'rgba(0, 85, 255, 0.8)',
|
|
|
- // borderColor: 'blue',
|
|
|
- borderWidth: 1, // 设置边框宽度
|
|
|
- fill: 'none' // 设置填充颜色为无,即空心
|
|
|
- },
|
|
|
- data: [
|
|
|
- // 假设 data[0] 和 data[data.length - 1] 分别是开始和结束的数据点
|
|
|
- {coord: [data1?data1[0]:'', data2?data2[0]:''], name: '开始'},
|
|
|
- {coord: [data1?data1[data1.length-1]:'', data2?data2[data2.length-1]:''], name: '结束'}
|
|
|
- // 如果要添加拐角处的标记,需要手动计算并添加
|
|
|
- ]
|
|
|
+ },
|
|
|
+ series: [{
|
|
|
+ type: 'line',
|
|
|
+ smooth: true,
|
|
|
+ lineStyle: {
|
|
|
+ width: 2,
|
|
|
+ color: '#EE8B52'
|
|
|
+ },
|
|
|
+ showSymbol: false,
|
|
|
+ areaStyle: {
|
|
|
+ opacity: 0.8,
|
|
|
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
+ {
|
|
|
+ offset: 0,
|
|
|
+ color: 'rgba(249, 211, 189, 1)'
|
|
|
},
|
|
|
- areaStyle: { // 折线下方的区域样式
|
|
|
- color: new echarts.graphic.LinearGradient(
|
|
|
- 0, 0, 0, 1, // 渐变方向
|
|
|
- [ // 渐变颜色
|
|
|
- {offset: 0, color: 'rgba(0, 85, 255, 0.8)'}, // 使用之前定义的渐变
|
|
|
- {offset: 0.9, color: 'rgba(255, 255, 255, 1)'} // 可选,结束颜色
|
|
|
- ]
|
|
|
- ),
|
|
|
- opacity: 0.3 // 区域的不透明度,可以根据需要调整
|
|
|
- },
|
|
|
- }
|
|
|
- ],
|
|
|
- // graphic: [{
|
|
|
- // type: 'text',
|
|
|
- // left: '5%', // 文本水平位置,这里设置为居中,你可以根据需要调整
|
|
|
- // top: '90%', // 文本垂直位置,这里设置为距离顶部 10% 的位置,作为左下方的文本
|
|
|
- // style: {
|
|
|
- // text: '入睡时间:'+startSleepTime?startSleepTime:'', // 文本内容
|
|
|
- // textFill: '#333', // 文本颜色
|
|
|
- // textFontSize: 14, // 文本字体大小
|
|
|
- // textAlign: 'left', // 文本水平对齐方式
|
|
|
- // verticalAlign: 'middle' // 文本垂直对齐方式
|
|
|
- // }
|
|
|
- // }, {
|
|
|
- // type: 'text',
|
|
|
- // right: '5%', // 文本水平位置,这里设置为距离右侧 10% 的位置,作为右下方的文本
|
|
|
- // top: '90%', // 文本垂直位置,这里设置为距离底部 10% 的位置
|
|
|
- // style: {
|
|
|
- // text: '醒来时间:'+endSleepTime?endSleepTime:'', // 文本内容
|
|
|
- // textFill: '#333', // 文本颜色
|
|
|
- // textFontSize: 14, // 文本字体大小
|
|
|
- // textAlign: 'right', // 文本水平对齐方式
|
|
|
- // verticalAlign: 'middle' // 文本垂直对齐方式
|
|
|
- // }
|
|
|
- // }],
|
|
|
- };
|
|
|
-
|
|
|
- chart10.setOption(option, true);
|
|
|
-}
|
|
|
+ {
|
|
|
+ offset: 1,
|
|
|
+ color: 'rgba(255, 255, 255, 0)'
|
|
|
+ }
|
|
|
+ ])
|
|
|
+ },
|
|
|
+ data: data2,
|
|
|
+ }]
|
|
|
+ };
|
|
|
|
|
|
-function flushChart11(data1,data2,that) {
|
|
|
- // data2 = data2?data2.map(value => {
|
|
|
- // return value+10;
|
|
|
- // }):[];
|
|
|
- let adjustedData = data2?data2.map(value => {
|
|
|
- return 10;
|
|
|
- }):[];
|
|
|
- // var option = {
|
|
|
- // // title: {
|
|
|
- // // text: '睡眠呼吸监测',
|
|
|
- // // left: 'center',
|
|
|
- // // textStyle: {
|
|
|
- // // color: '#ffffff', // 字体颜色
|
|
|
- // // fontStyle: 'normal', // 字体风格
|
|
|
- // // // fontWeight: 'bold', // 字体粗细
|
|
|
- // // fontFamily: 'sans-serif', // 字体族
|
|
|
- // // fontSize: 18 // 字体大小
|
|
|
- // // },
|
|
|
- // // backgroundColor: '#57f7ff'
|
|
|
- // // },
|
|
|
- // // grid: {
|
|
|
- // // top: '10%',
|
|
|
- // // height: '30%',
|
|
|
- // // },
|
|
|
- // tooltip: {},
|
|
|
- // xAxis: {
|
|
|
- // type: 'category',
|
|
|
- // axisLabel: {
|
|
|
- // color: 'rgba(0, 0, 0, 0.8)' // 设置 x 轴标签颜色为白色
|
|
|
- // },
|
|
|
- // axisTick: {
|
|
|
- // // 不显示Y轴刻度线
|
|
|
- // show: false
|
|
|
- // },
|
|
|
- // axisLine: {
|
|
|
- // // 不显示X轴轴线
|
|
|
- // show: false
|
|
|
- // },
|
|
|
- // splitLine: {
|
|
|
- // show: false, // 是否显示刻度线
|
|
|
- // },
|
|
|
- // data: data1?data1:[]
|
|
|
- // },
|
|
|
- // yAxis: {
|
|
|
- // // Y 轴配置
|
|
|
- // type: 'value',
|
|
|
- // // 设置 Y 轴名称
|
|
|
- // name: '睡眠状态',
|
|
|
- // // 设置 Y 轴名称的位置
|
|
|
- // nameLocation: 'end', // 可以是 'start'、'middle' 或 'end'
|
|
|
- // axisLine: {
|
|
|
- // // 不显示Y轴轴线
|
|
|
- // show: false,
|
|
|
- // },
|
|
|
- // axisTick: {
|
|
|
- // // 不显示Y轴刻度线
|
|
|
- // show: false
|
|
|
- // },
|
|
|
- // axisLabel: {
|
|
|
- // color: '#000',
|
|
|
- // formatter: function (value) {
|
|
|
- // return that.sleepStateChange(value);
|
|
|
- // }
|
|
|
- // },
|
|
|
- // splitLine: {
|
|
|
- // show: false ,// 不显示纵坐标轴的刻度线
|
|
|
- // lineStyle: {
|
|
|
- // color: 'rgba(0, 170, 255, 0.9)', // 灰色并调整透明度
|
|
|
- // width: 1, // 刻度线宽度
|
|
|
- // type: 'solid' // 刻度线类型,默认为实线
|
|
|
- // }
|
|
|
- // },
|
|
|
- // },
|
|
|
- // series: [{
|
|
|
- // type: 'bar',
|
|
|
- // data: data2?data2:[],
|
|
|
- // // barCategoryGap: '50%', // 类别间柱形距离
|
|
|
- // // label: {
|
|
|
- // // show: true,
|
|
|
- // // position: 'top',
|
|
|
- // // formatter: '{b}: {c}'
|
|
|
- // // },
|
|
|
- // stack: 'stackGroup',
|
|
|
- // itemStyle: {
|
|
|
- // color: 'rgba(0,0,0,0)' // 透明颜色
|
|
|
- // },
|
|
|
- // // itemStyle: {
|
|
|
- // // color: function(params) {
|
|
|
- // // // 根据数据或其他条件返回颜色值
|
|
|
- // // // 这里只是简单地返回了一个颜色数组中的颜色
|
|
|
- // // // var colorList = ['#c23531','#2f4554','#61a0a8','#d48265','#91c7ae','#749f83','#ca8622','#bda29a','#6e7074','#546570','#c4ccd3'];
|
|
|
- // // if(params.value == '0'){
|
|
|
- // // return '#e2e2e2'
|
|
|
- // // }else if(params.value == '10'){
|
|
|
- // // return '#8cc4ff'
|
|
|
- // // }else if(params.value == '20'){
|
|
|
- // // return '#a6b2ff'
|
|
|
- // // }else if(params.value == '30'){
|
|
|
- // // return '#9b79ff'
|
|
|
- // // }else{
|
|
|
- // // return '';
|
|
|
- // // }
|
|
|
- // // // return colorList[params.dataIndex % colorList.length];
|
|
|
- // // }
|
|
|
- // // }
|
|
|
- // }]
|
|
|
- // };
|
|
|
-
|
|
|
- var option = {
|
|
|
- xAxis: {
|
|
|
- type: 'category',
|
|
|
- data: data1?data1:[]
|
|
|
- },
|
|
|
- yAxis: {
|
|
|
- type: 'value',
|
|
|
- min: 0, // 确保 Y 轴从 0 开始
|
|
|
- // max 可以根据需要设置,但通常不需要为了固定柱子高度而设置
|
|
|
- axisLabel: {
|
|
|
- color: '#000',
|
|
|
- formatter: function (value) {
|
|
|
- return that.sleepStateChange(value);
|
|
|
- }
|
|
|
- },
|
|
|
- },
|
|
|
- series: [
|
|
|
- // 透明柱子,占满整个柱子空间
|
|
|
- {
|
|
|
- data: data2?data2:[],
|
|
|
- type: 'bar',
|
|
|
- stack: 'stackGroup',
|
|
|
- itemStyle: {
|
|
|
- color: 'rgba(0,0,0,0)' // 透明颜色
|
|
|
- },
|
|
|
- barGap: '-100%', // 设置柱子间距为负值,让柱子紧挨在一起
|
|
|
- barMaxWidth: '30px' // 根据需要调整柱子宽度
|
|
|
- },
|
|
|
- // 有色柱子,只显示上半部分(固定高度)
|
|
|
- {
|
|
|
- data: adjustedData, // 固定高度数据
|
|
|
- type: 'bar',
|
|
|
- stack: 'stackGroup', // 与透明系列使用相同的叠加组名
|
|
|
- itemStyle: {
|
|
|
- color: function(params) {
|
|
|
- console.log('params='+JSON.stringify(params))
|
|
|
- if(data2 && data2[params.dataIndex] == 0){
|
|
|
- return '#e2e2e2'
|
|
|
- }else if(data2 && data2[params.dataIndex] == 10){
|
|
|
- return '#d8c6ff'
|
|
|
- }else if(data2 && data2[params.dataIndex] == 20){
|
|
|
- return '#c6b3ff'
|
|
|
- }else if(data2 && data2[params.dataIndex] == 30){
|
|
|
- return '#b090ff'
|
|
|
- }else{
|
|
|
- return '';
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- barGap: '-100%', // 保持与透明系列相同的柱子间距
|
|
|
- barMaxWidth: '30px' // 保持与透明系列相同的宽度
|
|
|
- }
|
|
|
- ]
|
|
|
- };
|
|
|
- chart11.setOption(option, true);
|
|
|
+ chart.setOption(option, true);
|
|
|
}
|
|
|
|
|
|
-var homeApi = "https://haold.aidsleep.cn";
|
|
|
-var homeApi_http = "http://haold.aidsleep.cn";
|
|
|
-var homeApi_http_port = "8123";
|
|
|
-var homeApi_https = "https://haold.aidsleep.cn";
|
|
|
-const aipushApi = "https://aipush.aidsleep.cn";
|
|
|
-const token_15 = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJiN2JlOGE0MDExZjY0NjA2OGUxYjJiZTE4M2Y2NzU0NSIsImlhdCI6MTcxMTYxNDY2NCwiZXhwIjoyMDI2OTc0NjY0fQ.XJ73cXAoEsouTgvgpNVobq9oKdwlJr88TiAFLYlaahE";
|
|
|
-var token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJlZGVjOWI3YWQ0MTQ0ZTIxYWQ1NTE1Nzc5NTkzNjBjNiIsImlhdCI6MTcxMjEzNTM2MywiZXhwIjoyMDI3NDk1MzYzfQ.IfrvdiaVuhCKsdy69JvUYhJ64bnhMT8MI1hN8R38whc";
|
|
|
-const token_push = "b74fd5754c5ef24cf600c39194abdaeb";
|
|
|
+function updateSnoring(data1, data2, startSleepTime, endSleepTime, that) {
|
|
|
+ if (chartSnoringLine) {
|
|
|
+ setSnoringOption(chartSnoringLine, data1, data2);
|
|
|
+ } else {
|
|
|
+ that.selectComponent('#chartSnoringLine-dom').init((canvas, width, height, dpr) => {
|
|
|
+ const chart = echarts.init(canvas, null, {
|
|
|
+ width: width,
|
|
|
+ height: height,
|
|
|
+ devicePixelRatio: dpr // new
|
|
|
+ });
|
|
|
+ canvas.setChart(chart);
|
|
|
+ setSnoringOption(chart, data1, data2);
|
|
|
+
|
|
|
+ // 将图表实例绑定到 this 上,可以在其他成员函数(如 dispose)中访问
|
|
|
+ chartSnoringLine = chart;
|
|
|
+
|
|
|
+ // 注意这里一定要返回 chart 实例,否则会影响事件处理等
|
|
|
+ return chart;
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//呼吸暂停
|
|
|
+
|
|
|
+function initApneaLine(canvas, width, height, dpr) {
|
|
|
+ // 在这里初始化图表
|
|
|
+ const chart = echarts.init(canvas, null, {
|
|
|
+ width: width,
|
|
|
+ height: height,
|
|
|
+ devicePixelRatio: dpr // new
|
|
|
+ });
|
|
|
+ canvas.setChart(chart);
|
|
|
+ setApneaOption(chart);
|
|
|
+
|
|
|
+ // 将图表实例绑定到 this 上,可以在其他成员函数(如 dispose)中访问
|
|
|
+ chartApneaLine = chart;
|
|
|
+
|
|
|
+ // 注意这里一定要返回 chart 实例,否则会影响事件处理等
|
|
|
+ return chart;
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
+function setApneaOption(chart, data1 = [], data2 = [],) {
|
|
|
+ var option = option = {
|
|
|
+ tooltip: {
|
|
|
+ show: true,
|
|
|
+ trigger: 'axis',
|
|
|
+ formatter: function (param) {
|
|
|
+ return `${param[0] && param[0].value == 1 ? '停止' : '否'}`
|
|
|
+ }
|
|
|
+ },
|
|
|
+ dataZoom: [
|
|
|
+ { // 第一个 dataZoom 组件
|
|
|
+ type: 'inside',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ grid: {
|
|
|
+ top: '10rpx',
|
|
|
+ left: 0,
|
|
|
+ right: '20rpx',
|
|
|
+ bottom: 0,
|
|
|
+ containLabel: true
|
|
|
+ },
|
|
|
+ xAxis: {
|
|
|
+ type: 'category',
|
|
|
+ axisLabel: {
|
|
|
+ color: '#6C6970',// 设置 x 轴标签颜色为白色
|
|
|
+ fontSize: 10
|
|
|
+ },
|
|
|
+ boundaryGap: false,
|
|
|
+ splitLine: {
|
|
|
+ show: false, // 是否显示刻度线
|
|
|
+
|
|
|
+ },
|
|
|
+ axisTick: {
|
|
|
+ // 不显示Y轴刻度线
|
|
|
+ show: false
|
|
|
+ },
|
|
|
+ data: data1,
|
|
|
+ axisLine: {
|
|
|
+ // 不显示X轴轴线
|
|
|
+ show: false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ yAxis: {
|
|
|
+ type: 'value',
|
|
|
+ max: 24,
|
|
|
+ min: 0,
|
|
|
+ show: false,
|
|
|
+ },
|
|
|
+ series: [{
|
|
|
+ type: 'line',
|
|
|
+ smooth: true,
|
|
|
+ lineStyle: {
|
|
|
+ width: 2,
|
|
|
+ color: '#6086EF'
|
|
|
+ },
|
|
|
+ showSymbol: false,
|
|
|
+ areaStyle: {
|
|
|
+ opacity: 0.8,
|
|
|
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
+ {
|
|
|
+ offset: 0,
|
|
|
+ color: 'rgba(96, 134, 239, 1)'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ offset: 1,
|
|
|
+ color: 'rgba(255, 255, 255, 0)'
|
|
|
+ }
|
|
|
+ ])
|
|
|
+ },
|
|
|
+ data: data2,
|
|
|
+ }]
|
|
|
+ };
|
|
|
+
|
|
|
+ chart.setOption(option, true);
|
|
|
+}
|
|
|
+
|
|
|
+function updateApnea(data1, data2, startSleepTime, endSleepTime, that) {
|
|
|
+ if (chartApneaLine) {
|
|
|
+ setApneaOption(chartApneaLine, data1, data2);
|
|
|
+ } else {
|
|
|
+ that.selectComponent('#chartApneaLine-dom').init((canvas, width, height, dpr) => {
|
|
|
+ const chart = echarts.init(canvas, null, {
|
|
|
+ width: width,
|
|
|
+ height: height,
|
|
|
+ devicePixelRatio: dpr // new
|
|
|
+ });
|
|
|
+ canvas.setChart(chart);
|
|
|
+ setApneaOption(chart, data1, data2);
|
|
|
+
|
|
|
+ // 将图表实例绑定到 this 上,可以在其他成员函数(如 dispose)中访问
|
|
|
+ chartApneaLine = chart;
|
|
|
+
|
|
|
+ // 注意这里一定要返回 chart 实例,否则会影响事件处理等
|
|
|
+ return chart;
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+//深浅睡眠
|
|
|
+
|
|
|
+function initChartTimeWaterfall(canvas, width, height, dpr) {
|
|
|
+ // 在这里初始化图表
|
|
|
+ const chart = echarts.init(canvas, null, {
|
|
|
+ width: width,
|
|
|
+ height: height,
|
|
|
+ devicePixelRatio: dpr // new
|
|
|
+ });
|
|
|
+ canvas.setChart(chart);
|
|
|
+ setTimeWaterfallOption(chart);
|
|
|
+
|
|
|
+ // 将图表实例绑定到 this 上,可以在其他成员函数(如 dispose)中访问
|
|
|
+ chartTimeWaterfall = chart;
|
|
|
+
|
|
|
+ // 注意这里一定要返回 chart 实例,否则会影响事件处理等
|
|
|
+ return chart;
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
+function setTimeWaterfallOption(chart, data1 = [], data2 = []) {
|
|
|
+ var option = option = {
|
|
|
+ tooltip: {
|
|
|
+ show: true,
|
|
|
+ trigger: 'axis',
|
|
|
+ formatter: function (param) {
|
|
|
+ return `${param[0].value }`
|
|
|
+ }
|
|
|
+ },
|
|
|
+ dataZoom: [
|
|
|
+ { // 第一个 dataZoom 组件
|
|
|
+ type: 'inside',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ grid: {
|
|
|
+ top: '10rpx',
|
|
|
+ left: '10rpx',
|
|
|
+ right: '40rpx',
|
|
|
+ bottom: 0,
|
|
|
+ containLabel: true
|
|
|
+ },
|
|
|
+ xAxis: {
|
|
|
+ type: 'category',
|
|
|
+ data: data1,//字符串单位数组
|
|
|
+ axisLabel: {
|
|
|
+ color: '#6C6970',// 设置 x 轴标签颜色为白色
|
|
|
+ fontSize: 12,
|
|
|
+ interval:0,
|
|
|
+ fontWeight: 'bolder',
|
|
|
+ rich: {
|
|
|
+ units: {//单位就富文本了
|
|
|
+ fontSize: 10,
|
|
|
+ fontWeight: 400,
|
|
|
+ color: '#6C6970'
|
|
|
+ },
|
|
|
+ }
|
|
|
+ },
|
|
|
+ boundaryGap: false,
|
|
|
+ splitLine: {
|
|
|
+ show: false, // 是否显示刻度线
|
|
|
+
|
|
|
+ },
|
|
|
+ axisTick: {
|
|
|
+ // 不显示刻度线
|
|
|
+ show: false
|
|
|
+ },
|
|
|
+ axisLine: {
|
|
|
+ // 不显示轴线
|
|
|
+ show: false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ yAxis: {
|
|
|
+ type: 'value',
|
|
|
+ min: 0,
|
|
|
+ show: false,
|
|
|
+ },
|
|
|
+ series: [{
|
|
|
+ barWidth:46,
|
|
|
+ itemStyle: {
|
|
|
+ color: function (params) {
|
|
|
+ // 假设我们有一个颜色数组
|
|
|
+ var colorList = ['#FDEFA6', '#F1E9FE', '#D8C8FE', '#AB81FF']
|
|
|
+ // 根据数据索引选择颜色
|
|
|
+ return colorList[params.dataIndex % colorList.length];
|
|
|
+ },
|
|
|
+ borderRadius: [2]
|
|
|
+ },
|
|
|
+ type: 'bar',
|
|
|
+ stack: 'a',
|
|
|
+ data: data2,//分钟数数组
|
|
|
+ }]
|
|
|
+ };
|
|
|
+
|
|
|
+ chart.setOption(option, true);
|
|
|
+}
|
|
|
+
|
|
|
+function updateTimeWaterfall(data1, data2, that) {
|
|
|
+ console.log("data1========>", data1);
|
|
|
+ if (chartTimeWaterfall) {
|
|
|
+ setTimeWaterfallOption(chartTimeWaterfall, data1, data2);
|
|
|
+ } else {
|
|
|
+ that.selectComponent('#chartTimeWaterfall-dom').init((canvas, width, height, dpr) => {
|
|
|
+ const chart = echarts.init(canvas, null, {
|
|
|
+ width: width,
|
|
|
+ height: height,
|
|
|
+ devicePixelRatio: dpr // new
|
|
|
+ });
|
|
|
+ canvas.setChart(chart);
|
|
|
+ setTimeWaterfallOption(chart, data1, data2);
|
|
|
+
|
|
|
+ // 将图表实例绑定到 this 上,可以在其他成员函数(如 dispose)中访问
|
|
|
+ chartTimeWaterfall = chart;
|
|
|
+
|
|
|
+ // 注意这里一定要返回 chart 实例,否则会影响事件处理等
|
|
|
+ return chart;
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// subpages/data/data.js
|
|
|
+function addZero(str) {
|
|
|
+ if (String(str).length == 1) {
|
|
|
+ return "0" + String(str);
|
|
|
+ } else {
|
|
|
+ return String(str);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+function flushChart0(data) {
|
|
|
+ var option = {
|
|
|
+ series: [
|
|
|
+ {
|
|
|
+ name: '进度',
|
|
|
+ type: 'pie',
|
|
|
+ radius: ['50%', '70%'],
|
|
|
+ avoidLabelOverlap: false,
|
|
|
+ label: {
|
|
|
+ show: true,
|
|
|
+ position: 'center'
|
|
|
+ },
|
|
|
+ emphasis: {
|
|
|
+ label: {
|
|
|
+ show: true,
|
|
|
+ fontSize: '30',
|
|
|
+ fontWeight: 'bold'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ labelLine: {
|
|
|
+ show: false
|
|
|
+ },
|
|
|
+ data: data
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ };
|
|
|
+ chart0.setOption(option, true);
|
|
|
+}
|
|
|
+
|
|
|
+function flushChart(data) {
|
|
|
+ var option = {
|
|
|
+ backgroundColor: '#0c1041',
|
|
|
+ // title: {
|
|
|
+ // text: '当天睡眠时间曲线图',
|
|
|
+ // left: 'center',
|
|
|
+ // color: '#ffffff',
|
|
|
+ // backgroundColor: '#ff0000'
|
|
|
+ // },
|
|
|
+ color: ["#62c4d9"],
|
|
|
+ legend: {
|
|
|
+ data: ['睡眠时间'],
|
|
|
+ top: 20,
|
|
|
+ left: 'right',
|
|
|
+ backgroundColor: '#0c1041',
|
|
|
+ textStyle: {
|
|
|
+ color: '#fff',
|
|
|
+ }
|
|
|
+ },
|
|
|
+ grid: {
|
|
|
+ containLabel: true
|
|
|
+ },
|
|
|
+ tooltip: {
|
|
|
+ show: true,
|
|
|
+ trigger: 'axis'
|
|
|
+ },
|
|
|
+ xAxis: {
|
|
|
+ type: 'category',
|
|
|
+ boundaryGap: false,
|
|
|
+ axisLine: {
|
|
|
+ lineStyle: {
|
|
|
+ color: '#fff',
|
|
|
+ width: 1,//这里是为了突出显示加上的
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ yAxis: {
|
|
|
+ name: "时长",
|
|
|
+ x: 'center',
|
|
|
+ type: 'value',
|
|
|
+ axisLine: {
|
|
|
+ lineStyle: {
|
|
|
+ color: '#fff',
|
|
|
+ width: 1,//这里是为了突出显示加上的
|
|
|
+ }
|
|
|
+ // splitLine: {
|
|
|
+ // lineStyle: {
|
|
|
+ // type: 'dashed'
|
|
|
+ // }
|
|
|
+ }
|
|
|
+ // show: false
|
|
|
+ },
|
|
|
+ series: [{
|
|
|
+ name: '睡眠时间',
|
|
|
+ type: 'line',
|
|
|
+ smooth: true,
|
|
|
+ data: data,
|
|
|
+ color: '#62c4d9'
|
|
|
+ }]
|
|
|
+ };
|
|
|
+ chart.setOption(option, true);
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+function flushChart2(data) {
|
|
|
+ var option = {
|
|
|
+ // title: {
|
|
|
+ // text: '睡眠状态监测',
|
|
|
+ // left: 'center',
|
|
|
+ // textStyle: {
|
|
|
+ // color: '#ffffff', // 字体颜色
|
|
|
+ // fontStyle: 'normal', // 字体风格
|
|
|
+ // // fontWeight: 'bold', // 字体粗细
|
|
|
+ // fontFamily: 'sans-serif', // 字体族
|
|
|
+ // fontSize: 18 // 字体大小
|
|
|
+ // },
|
|
|
+ // backgroundColor: '#57f7ff'
|
|
|
+ // },
|
|
|
+ tooltip: {
|
|
|
+ trigger: 'item'
|
|
|
+ },
|
|
|
+ legend: {
|
|
|
+ orient: 'vertical',
|
|
|
+ left: 'left',
|
|
|
+ },
|
|
|
+ series: [{
|
|
|
+ type: 'pie',
|
|
|
+ radius: '55%',
|
|
|
+ data: data ? data : []
|
|
|
+ }],
|
|
|
+ graphic: [{
|
|
|
+ type: 'text',
|
|
|
+ left: '2%', // 文本水平位置,这里设置为居中,你可以根据需要调整
|
|
|
+ top: '84%', // 文本垂直位置,这里设置为距离顶部 10% 的位置,作为左下方的文本
|
|
|
+ style: {
|
|
|
+ text: '时长(分钟)分析', // 文本内容
|
|
|
+ textFill: '#333', // 文本颜色
|
|
|
+ textFontSize: 14, // 文本字体大小
|
|
|
+ textAlign: 'left', // 文本水平对齐方式
|
|
|
+ verticalAlign: 'middle' // 文本垂直对齐方式
|
|
|
+ }
|
|
|
+ }],
|
|
|
+ };
|
|
|
+ chart2.setOption(option, true);
|
|
|
+}
|
|
|
+
|
|
|
+function flushChart3(data1, data2) {
|
|
|
+ var option = {
|
|
|
+ // title: {
|
|
|
+ // text: '睡眠呼吸监测',
|
|
|
+ // left: 'center',
|
|
|
+ // textStyle: {
|
|
|
+ // color: '#ffffff', // 字体颜色
|
|
|
+ // fontStyle: 'normal', // 字体风格
|
|
|
+ // // fontWeight: 'bold', // 字体粗细
|
|
|
+ // fontFamily: 'sans-serif', // 字体族
|
|
|
+ // fontSize: 18 // 字体大小
|
|
|
+ // },
|
|
|
+ // backgroundColor: '#57f7ff'
|
|
|
+ // },
|
|
|
+ tooltip: {},
|
|
|
+ xAxis: {
|
|
|
+ data: data1 ? data1 : []
|
|
|
+ },
|
|
|
+ yAxis: {
|
|
|
+ // Y 轴配置
|
|
|
+ type: 'value',
|
|
|
+ // 设置 Y 轴名称
|
|
|
+ name: '单位:次',
|
|
|
+ // 设置 Y 轴名称的位置
|
|
|
+ nameLocation: 'end', // 可以是 'start'、'middle' 或 'end'
|
|
|
+ },
|
|
|
+ series: [{
|
|
|
+ type: 'line',
|
|
|
+ data: data2 ? data2 : []
|
|
|
+ }]
|
|
|
+ };
|
|
|
+ chart3.setOption(option, true);
|
|
|
+}
|
|
|
+
|
|
|
+function flushChart4(data) {
|
|
|
+ var option = {
|
|
|
+ // title: {
|
|
|
+ // text: '睡眠与清醒时间',
|
|
|
+ // left: 'center',
|
|
|
+ // textStyle: {
|
|
|
+ // color: '#ffffff', // 字体颜色
|
|
|
+ // fontStyle: 'normal', // 字体风格
|
|
|
+ // // fontWeight: 'bold', // 字体粗细
|
|
|
+ // fontFamily: 'sans-serif', // 字体族
|
|
|
+ // fontSize: 18 // 字体大小
|
|
|
+ // },
|
|
|
+ // backgroundColor: '#57f7ff'
|
|
|
+ // },
|
|
|
+ tooltip: {},
|
|
|
+ series: [{
|
|
|
+ type: 'gauge',
|
|
|
+ // 设置刻度盘的最大值
|
|
|
+ max: 24,
|
|
|
+ // 设置刻度盘的最小值
|
|
|
+ min: 0,
|
|
|
+ pointer: {
|
|
|
+ width: 5,
|
|
|
+ // 可以调整第二个指针的样式以区分
|
|
|
+ itemStyle: {
|
|
|
+ color: '#FF0000'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 刻度盘轴
|
|
|
+ axisLine: {
|
|
|
+ textStyle: {
|
|
|
+ fontSize: 14
|
|
|
+ },
|
|
|
+ lineStyle: {
|
|
|
+ width: 30,
|
|
|
+ color: [[0.2, '#80FF80'], [0.8, '#FF8080'], [1, '#8080FF']] // 刻度盘颜色分区
|
|
|
+ },
|
|
|
+ rich: {
|
|
|
+ // 为第一个刻度盘设置刻度颜色
|
|
|
+ '0%': {
|
|
|
+ color: '#FF0000'
|
|
|
+ },
|
|
|
+ '50%': {
|
|
|
+ color: '#00FF00'
|
|
|
+ },
|
|
|
+ '100%': {
|
|
|
+ color: '#0000FF'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ detail: { formatter: '{value} 小时' },
|
|
|
+ data: data ? data : {}
|
|
|
+ }
|
|
|
+ // ,{
|
|
|
+ // type: 'gauge',
|
|
|
+ // // 设置刻度盘的最大值
|
|
|
+ // max: 24,
|
|
|
+ // // 设置刻度盘的最小值
|
|
|
+ // min: 0,
|
|
|
+ // // 刻度盘轴
|
|
|
+ // axisLine: {
|
|
|
+ // textStyle: {
|
|
|
+ // fontSize: 14
|
|
|
+ // },
|
|
|
+ // lineStyle: {
|
|
|
+ // width: 30,
|
|
|
+ // color: [[0.2, '#80FF80'], [0.8, '#FF8080'], [1, '#8080FF']] // 刻度盘颜色分区
|
|
|
+ // },
|
|
|
+ // rich: {
|
|
|
+ // // 为第二个刻度盘设置刻度颜色
|
|
|
+ // '0%': {
|
|
|
+ // color: '#FFFF00'
|
|
|
+ // },
|
|
|
+ // '50%': {
|
|
|
+ // color: '#00FFFF'
|
|
|
+ // },
|
|
|
+ // '100%': {
|
|
|
+ // color: '#FF00FF'
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // detail: {formatter: '{value} 小时'},
|
|
|
+ // data: data2?data2:{}
|
|
|
+ // },
|
|
|
+ ]
|
|
|
+ };
|
|
|
+ chart4.setOption(option, true);
|
|
|
+}
|
|
|
+
|
|
|
+function flushChart5(data1, data2, that) {
|
|
|
+ var option = {
|
|
|
+ // title: {
|
|
|
+ // text: '睡眠状态监测',
|
|
|
+ // left: 'center',
|
|
|
+ // textStyle: {
|
|
|
+ // color: '#ffffff', // 字体颜色
|
|
|
+ // fontStyle: 'normal', // 字体风格
|
|
|
+ // // fontWeight: 'bold', // 字体粗细
|
|
|
+ // fontFamily: 'sans-serif', // 字体族
|
|
|
+ // fontSize: 18 // 字体大小
|
|
|
+ // },
|
|
|
+ // backgroundColor: '#57f7ff'
|
|
|
+ // },
|
|
|
+ tooltip: {},
|
|
|
+ xAxis: {
|
|
|
+ data: data1 ? data1 : []
|
|
|
+ },
|
|
|
+ yAxis: {
|
|
|
+ // Y 轴配置
|
|
|
+ type: 'value',
|
|
|
+ // 设置 Y 轴名称
|
|
|
+ name: '单位:次',
|
|
|
+ // 设置 Y 轴名称的位置
|
|
|
+ nameLocation: 'end', // 可以是 'start'、'middle' 或 'end'
|
|
|
+ axisLabel: {
|
|
|
+ formatter: function (value) {
|
|
|
+ return that.sleepStateChange(value);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ series: [{
|
|
|
+ type: 'line',
|
|
|
+ data: data2 ? data2 : []
|
|
|
+ }]
|
|
|
+ };
|
|
|
+ chart5.setOption(option, true);
|
|
|
+}
|
|
|
+
|
|
|
+function flushChart6(data1, data2, startSleepTime, endSleepTime, that) {
|
|
|
+ var option = {
|
|
|
+ backgroundColor: '#000000', // 设置背景色
|
|
|
+ tooltip: {},
|
|
|
+ xAxis: {
|
|
|
+ data: data1 ? data1 : []
|
|
|
+ },
|
|
|
+ yAxis: {
|
|
|
+ // Y 轴配置
|
|
|
+ type: 'value',
|
|
|
+ // 设置 Y 轴名称
|
|
|
+ name: '睡眠状态',
|
|
|
+ // 设置 Y 轴名称的位置
|
|
|
+ nameLocation: 'end', // 可以是 'start'、'middle' 或 'end'
|
|
|
+ axisLabel: {
|
|
|
+ formatter: function (value) {
|
|
|
+ return that.sleepStateChange(value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ series: [{
|
|
|
+ type: 'line',
|
|
|
+ data: data2 ? data2 : [],
|
|
|
+ lineStyle: { // 系列级个性化折线样式
|
|
|
+ width: 10,
|
|
|
+ type: 'solid',
|
|
|
+ color: new echarts.graphic.LinearGradient(0, 0.4, 0.7, 1, [{
|
|
|
+ offset: 0,
|
|
|
+ color: '#ffb71b'
|
|
|
+ }, {
|
|
|
+ offset: 0.4,
|
|
|
+ color: '#b75cee'
|
|
|
+ }, {
|
|
|
+ offset: 0.7,
|
|
|
+ color: '#66acfc'
|
|
|
+ }, {
|
|
|
+ offset: 1,
|
|
|
+ color: '#3843fa'
|
|
|
+ }]),//线条渐变色
|
|
|
+ },
|
|
|
+ }
|
|
|
+ // {
|
|
|
+ // name: '分类2',
|
|
|
+ // type: 'line',
|
|
|
+ // data: data2,
|
|
|
+ // lineStyle: { // 系列级个性化折线样式
|
|
|
+ // width: 4,
|
|
|
+ // type: 'solid',
|
|
|
+ // color: new echarts.graphic.LinearGradient(0, 0.4, 0.7, 1, [{
|
|
|
+ // offset: 0,
|
|
|
+ // color: '#ffb71b'
|
|
|
+ // } , {
|
|
|
+ // offset: 0.4,
|
|
|
+ // color: '#b75cee'
|
|
|
+ // }, {
|
|
|
+ // offset: 0.7,
|
|
|
+ // color: '#66acfc'
|
|
|
+ // }, {
|
|
|
+ // offset: 1,
|
|
|
+ // color: '#3843fa'
|
|
|
+ // }]),//线条渐变色
|
|
|
+ // },
|
|
|
+ // },
|
|
|
+ ],
|
|
|
+ graphic: [{
|
|
|
+ type: 'text',
|
|
|
+ left: '5%', // 文本水平位置,这里设置为居中,你可以根据需要调整
|
|
|
+ top: '90%', // 文本垂直位置,这里设置为距离顶部 10% 的位置,作为左下方的文本
|
|
|
+ style: {
|
|
|
+ text: '入睡时间:' + startSleepTime ? startSleepTime : '', // 文本内容
|
|
|
+ textFill: '#333', // 文本颜色
|
|
|
+ textFontSize: 14, // 文本字体大小
|
|
|
+ textAlign: 'left', // 文本水平对齐方式
|
|
|
+ verticalAlign: 'middle' // 文本垂直对齐方式
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ type: 'text',
|
|
|
+ right: '5%', // 文本水平位置,这里设置为距离右侧 10% 的位置,作为右下方的文本
|
|
|
+ top: '90%', // 文本垂直位置,这里设置为距离底部 10% 的位置
|
|
|
+ style: {
|
|
|
+ text: '醒来时间:' + endSleepTime ? endSleepTime : '', // 文本内容
|
|
|
+ textFill: '#333', // 文本颜色
|
|
|
+ textFontSize: 14, // 文本字体大小
|
|
|
+ textAlign: 'right', // 文本水平对齐方式
|
|
|
+ verticalAlign: 'middle' // 文本垂直对齐方式
|
|
|
+ }
|
|
|
+ }],
|
|
|
+ };
|
|
|
+
|
|
|
+ // var list0 = [];
|
|
|
+ // var list10 = [];
|
|
|
+ // var list20 = [];
|
|
|
+ // var list30 = [];
|
|
|
+ // if(data2){
|
|
|
+ // for (let i = 0; i < data2.length; i++) {
|
|
|
+ // if (data2[i] == '0') {
|
|
|
+ // list0.push(data2[i]);
|
|
|
+ // }else if (data2[i] == '10') {
|
|
|
+ // list10.push(data2[i]);
|
|
|
+ // }else if (data2[i] == '20') {
|
|
|
+ // list20.push(data2[i]);
|
|
|
+ // }else if (data2[i] == '30') {
|
|
|
+ // list30.push(data2[i]);
|
|
|
+ // }else{
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // var option = {
|
|
|
+ // xAxis: {
|
|
|
+ // type: 'category',
|
|
|
+ // data: data1
|
|
|
+ // },
|
|
|
+ // yAxis: {
|
|
|
+ // type: 'value',
|
|
|
+ // axisLabel: {
|
|
|
+ // show: true,
|
|
|
+ // position: 'buttom' // 分类标签显示在顶部,相当于曲线下方位置
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // series: [
|
|
|
+ // {
|
|
|
+ // name: '清醒',
|
|
|
+ // type: 'line',
|
|
|
+ // data: list0,
|
|
|
+ // itemStyle: {
|
|
|
+ // areaColor: new echarts.graphic.LinearGradient(
|
|
|
+ // 0, 0, 0, 1,
|
|
|
+ // [{ offset: 0, color: 'rgba(255, 0, 0, 0.3)' }, { offset: 1, color: 'rgba(255, 0, 0, 0)' }]
|
|
|
+ // )
|
|
|
+ // },
|
|
|
+ // smooth: true,
|
|
|
+ // lineStyle: {
|
|
|
+ // color: 'red' // 线条颜色
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // name: '浅睡',
|
|
|
+ // type: 'line',
|
|
|
+ // data: list10,
|
|
|
+ // itemStyle: {
|
|
|
+ // areaColor: new echarts.graphic.LinearGradient(
|
|
|
+ // 0, 0, 0, 1,
|
|
|
+ // [{ offset: 0, color: 'rgba(0, 255, 0, 0.3)' }, { offset: 1, color: 'rgba(0, 255, 0, 0)' }]
|
|
|
+ // )
|
|
|
+ // },
|
|
|
+ // smooth: true,
|
|
|
+ // lineStyle: {
|
|
|
+ // color: 'green' // 线条颜色
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // name: '中睡',
|
|
|
+ // type: 'line',
|
|
|
+ // data: list20,
|
|
|
+ // itemStyle: {
|
|
|
+ // areaColor: new echarts.graphic.LinearGradient(
|
|
|
+ // 0, 0, 0, 1,
|
|
|
+ // [{ offset: 0, color: 'rgba(0, 255, 0, 0.3)' }, { offset: 1, color: 'rgba(0, 255, 0, 0)' }]
|
|
|
+ // )
|
|
|
+ // },
|
|
|
+ // smooth: true,
|
|
|
+ // lineStyle: {
|
|
|
+ // color: 'green' // 线条颜色
|
|
|
+ // }
|
|
|
+ // } ,
|
|
|
+ // {
|
|
|
+ // name: '深睡',
|
|
|
+ // type: 'line',
|
|
|
+ // data: list30,
|
|
|
+ // itemStyle: {
|
|
|
+ // areaColor: new echarts.graphic.LinearGradient(
|
|
|
+ // 0, 0, 0, 1,
|
|
|
+ // [{ offset: 0, color: 'rgba(0, 255, 0, 0.3)' }, { offset: 1, color: 'rgba(0, 255, 0, 0)' }]
|
|
|
+ // )
|
|
|
+ // },
|
|
|
+ // smooth: true,
|
|
|
+ // lineStyle: {
|
|
|
+ // color: 'green' // 线条颜色
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // // 如果有更多分类,继续添加...
|
|
|
+ // ],
|
|
|
+ // tooltip: {
|
|
|
+ // trigger: 'axis',
|
|
|
+ // axisPointer: {
|
|
|
+ // type: 'cross',
|
|
|
+ // label: {
|
|
|
+ // backgroundColor: '#6a7985'
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // graphic: [{
|
|
|
+ // type: 'text',
|
|
|
+ // left: '5%', // 文本水平位置,这里设置为居中,你可以根据需要调整
|
|
|
+ // top: '90%', // 文本垂直位置,这里设置为距离顶部 10% 的位置,作为左下方的文本
|
|
|
+ // style: {
|
|
|
+ // text: '入睡时间:'+startSleepTime, // 文本内容
|
|
|
+ // textFill: '#333', // 文本颜色
|
|
|
+ // textFontSize: 14, // 文本字体大小
|
|
|
+ // textAlign: 'left', // 文本水平对齐方式
|
|
|
+ // verticalAlign: 'middle' // 文本垂直对齐方式
|
|
|
+ // }
|
|
|
+ // }, {
|
|
|
+ // type: 'text',
|
|
|
+ // right: '5%', // 文本水平位置,这里设置为距离右侧 10% 的位置,作为右下方的文本
|
|
|
+ // top: '90%', // 文本垂直位置,这里设置为距离底部 10% 的位置
|
|
|
+ // style: {
|
|
|
+ // text: '醒来时间:'+endSleepTime, // 文本内容
|
|
|
+ // textFill: '#333', // 文本颜色
|
|
|
+ // textFontSize: 14, // 文本字体大小
|
|
|
+ // textAlign: 'right', // 文本水平对齐方式
|
|
|
+ // verticalAlign: 'middle' // 文本垂直对齐方式
|
|
|
+ // }
|
|
|
+ // }],
|
|
|
+ // };
|
|
|
+
|
|
|
+ chart6.setOption(option, true);
|
|
|
+}
|
|
|
+
|
|
|
+function flushChart9(data1, data2, startSleepTime, endSleepTime, that) {
|
|
|
+ var option = {
|
|
|
+ // backgroundColor: rgba(168, 115, 182, 0.5), // 设置背景色
|
|
|
+ tooltip: {},
|
|
|
+ xAxis: {
|
|
|
+ axisLabel: {
|
|
|
+ color: '#000' // 设置 x 轴标签颜色为白色
|
|
|
+ },
|
|
|
+ splitLine: {
|
|
|
+ show: false, // 是否显示刻度线
|
|
|
+ },
|
|
|
+ axisTick: {
|
|
|
+ // 不显示Y轴刻度线
|
|
|
+ show: false
|
|
|
+ },
|
|
|
+ axisLine: {
|
|
|
+ // 不显示X轴轴线
|
|
|
+ show: false
|
|
|
+ },
|
|
|
+ data: data1 ? data1 : []
|
|
|
+ },
|
|
|
+ yAxis: {
|
|
|
+ // Y 轴配置
|
|
|
+ type: 'value',
|
|
|
+ // 设置 Y 轴名称
|
|
|
+ name: '睡眠状态',
|
|
|
+ // 设置 Y 轴名称的位置
|
|
|
+ nameLocation: 'end', // 可以是 'start'、'middle' 或 'end'
|
|
|
+ axisLine: {
|
|
|
+ // 不显示Y轴轴线
|
|
|
+ show: false,
|
|
|
+ },
|
|
|
+ axisTick: {
|
|
|
+ // 不显示Y轴刻度线
|
|
|
+ show: false
|
|
|
+ },
|
|
|
+ axisLabel: {
|
|
|
+ color: '#000',
|
|
|
+ formatter: function (value) {
|
|
|
+ return that.sleepRsnoring_arrChange(value);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ splitLine: {
|
|
|
+ show: false,// 不显示纵坐标轴的刻度线
|
|
|
+ lineStyle: {
|
|
|
+ color: 'rgba(222, 222, 222, 0.1)', // 灰色并调整透明度
|
|
|
+ width: 1, // 刻度线宽度
|
|
|
+ type: 'solid' // 刻度线类型,默认为实线
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ series: [{
|
|
|
+ type: 'line',
|
|
|
+ data: data2 ? data2 : [],
|
|
|
+ lineStyle: {
|
|
|
+ color: 'rgba(255, 170, 127, 0.8)' // 奶白色,80% 透明度
|
|
|
+ },
|
|
|
+ showSymbol: false,// 是否显示标记图形
|
|
|
+ smooth: true, // 使折线平滑
|
|
|
+ markPoint: {
|
|
|
+ symbol: 'circle', // 标记的符号为圆圈
|
|
|
+ symbolSize: 10, // 标记的大小
|
|
|
+ itemStyle: {
|
|
|
+ color: 'rgba(255, 170, 127, 0.8)',
|
|
|
+ // borderColor: 'blue',
|
|
|
+ borderWidth: 1, // 设置边框宽度
|
|
|
+ fill: 'none' // 设置填充颜色为无,即空心
|
|
|
+ },
|
|
|
+ data: [
|
|
|
+ // 假设 data[0] 和 data[data.length - 1] 分别是开始和结束的数据点
|
|
|
+ { coord: [data1 ? data1[0] : '', data2 ? data2[0] : ''], name: '开始' },
|
|
|
+ { coord: [data1 ? data1[data1.length - 1] : '', data2 ? data2[data2.length - 1] : ''], name: '结束' }
|
|
|
+ // 如果要添加拐角处的标记,需要手动计算并添加
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ areaStyle: { // 折线下方的区域样式
|
|
|
+ color: new echarts.graphic.LinearGradient(
|
|
|
+ 0, 0, 0, 1, // 渐变方向
|
|
|
+ [ // 渐变颜色
|
|
|
+ { offset: 0, color: 'rgba(255, 170, 127, 0.8)' }, // 使用之前定义的渐变
|
|
|
+ { offset: 0.9, color: 'rgba(255, 255, 255, 1)' } // 可选,结束颜色
|
|
|
+ ]
|
|
|
+ ),
|
|
|
+ opacity: 0.3 // 区域的不透明度,可以根据需要调整
|
|
|
+ },
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ // graphic: [{
|
|
|
+ // type: 'text',
|
|
|
+ // left: '5%', // 文本水平位置,这里设置为居中,你可以根据需要调整
|
|
|
+ // top: '90%', // 文本垂直位置,这里设置为距离顶部 10% 的位置,作为左下方的文本
|
|
|
+ // style: {
|
|
|
+ // text: '入睡时间:'+startSleepTime?startSleepTime:'', // 文本内容
|
|
|
+ // textFill: '#333', // 文本颜色
|
|
|
+ // textFontSize: 14, // 文本字体大小
|
|
|
+ // textAlign: 'left', // 文本水平对齐方式
|
|
|
+ // verticalAlign: 'middle' // 文本垂直对齐方式
|
|
|
+ // }
|
|
|
+ // }, {
|
|
|
+ // type: 'text',
|
|
|
+ // right: '5%', // 文本水平位置,这里设置为距离右侧 10% 的位置,作为右下方的文本
|
|
|
+ // top: '90%', // 文本垂直位置,这里设置为距离底部 10% 的位置
|
|
|
+ // style: {
|
|
|
+ // text: '醒来时间:'+endSleepTime?endSleepTime:'', // 文本内容
|
|
|
+ // textFill: '#333', // 文本颜色
|
|
|
+ // textFontSize: 14, // 文本字体大小
|
|
|
+ // textAlign: 'right', // 文本水平对齐方式
|
|
|
+ // verticalAlign: 'middle' // 文本垂直对齐方式
|
|
|
+ // }
|
|
|
+ // }],
|
|
|
+ };
|
|
|
+
|
|
|
+ chart9.setOption(option, true);
|
|
|
+}
|
|
|
+
|
|
|
+function flushChart10(data1, data2, startSleepTime, endSleepTime, that) {
|
|
|
+ var option = {
|
|
|
+ // backgroundColor: rgba(168, 115, 182, 0.5), // 设置背景色
|
|
|
+ tooltip: {},
|
|
|
+ xAxis: {
|
|
|
+ axisLabel: {
|
|
|
+ color: '#000' // 设置 x 轴标签颜色为白色
|
|
|
+ },
|
|
|
+ splitLine: {
|
|
|
+ show: false, // 是否显示刻度线
|
|
|
+ },
|
|
|
+ axisTick: {
|
|
|
+ // 不显示Y轴刻度线
|
|
|
+ show: false
|
|
|
+ },
|
|
|
+ axisLine: {
|
|
|
+ // 不显示X轴轴线
|
|
|
+ show: false
|
|
|
+ },
|
|
|
+ data: data1 ? data1 : []
|
|
|
+ },
|
|
|
+ yAxis: {
|
|
|
+ // Y 轴配置
|
|
|
+ type: 'value',
|
|
|
+ // 设置 Y 轴名称
|
|
|
+ name: '睡眠状态',
|
|
|
+ // 设置 Y 轴名称的位置
|
|
|
+ nameLocation: 'end', // 可以是 'start'、'middle' 或 'end'
|
|
|
+ axisLine: {
|
|
|
+ // 不显示Y轴轴线
|
|
|
+ show: false,
|
|
|
+ },
|
|
|
+ axisTick: {
|
|
|
+ // 不显示Y轴刻度线
|
|
|
+ show: false
|
|
|
+ },
|
|
|
+ axisLabel: {
|
|
|
+ color: '#000',
|
|
|
+ formatter: function (value) {
|
|
|
+ return that.sleepRhxstop_arrChange(value);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ splitLine: {
|
|
|
+ show: false,// 不显示纵坐标轴的刻度线
|
|
|
+ lineStyle: {
|
|
|
+ color: 'rgba(222, 222, 222, 0.1)', // 灰色并调整透明度
|
|
|
+ width: 1, // 刻度线宽度
|
|
|
+ type: 'solid' // 刻度线类型,默认为实线
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ series: [{
|
|
|
+ type: 'line',
|
|
|
+ data: data2 ? data2 : [],
|
|
|
+ lineStyle: {
|
|
|
+ color: 'rgba(0, 85, 255, 0.8)' // 奶白色,80% 透明度
|
|
|
+ },
|
|
|
+ showSymbol: false,// 是否显示标记图形
|
|
|
+ smooth: true, // 使折线平滑
|
|
|
+ markPoint: {
|
|
|
+ symbol: 'circle', // 标记的符号为圆圈
|
|
|
+ symbolSize: 10, // 标记的大小
|
|
|
+ itemStyle: {
|
|
|
+ color: 'rgba(0, 85, 255, 0.8)',
|
|
|
+ // borderColor: 'blue',
|
|
|
+ borderWidth: 1, // 设置边框宽度
|
|
|
+ fill: 'none' // 设置填充颜色为无,即空心
|
|
|
+ },
|
|
|
+ data: [
|
|
|
+ // 假设 data[0] 和 data[data.length - 1] 分别是开始和结束的数据点
|
|
|
+ { coord: [data1 ? data1[0] : '', data2 ? data2[0] : ''], name: '开始' },
|
|
|
+ { coord: [data1 ? data1[data1.length - 1] : '', data2 ? data2[data2.length - 1] : ''], name: '结束' }
|
|
|
+ // 如果要添加拐角处的标记,需要手动计算并添加
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ areaStyle: { // 折线下方的区域样式
|
|
|
+ color: new echarts.graphic.LinearGradient(
|
|
|
+ 0, 0, 0, 1, // 渐变方向
|
|
|
+ [ // 渐变颜色
|
|
|
+ { offset: 0, color: 'rgba(0, 85, 255, 0.8)' }, // 使用之前定义的渐变
|
|
|
+ { offset: 0.9, color: 'rgba(255, 255, 255, 1)' } // 可选,结束颜色
|
|
|
+ ]
|
|
|
+ ),
|
|
|
+ opacity: 0.3 // 区域的不透明度,可以根据需要调整
|
|
|
+ },
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ // graphic: [{
|
|
|
+ // type: 'text',
|
|
|
+ // left: '5%', // 文本水平位置,这里设置为居中,你可以根据需要调整
|
|
|
+ // top: '90%', // 文本垂直位置,这里设置为距离顶部 10% 的位置,作为左下方的文本
|
|
|
+ // style: {
|
|
|
+ // text: '入睡时间:'+startSleepTime?startSleepTime:'', // 文本内容
|
|
|
+ // textFill: '#333', // 文本颜色
|
|
|
+ // textFontSize: 14, // 文本字体大小
|
|
|
+ // textAlign: 'left', // 文本水平对齐方式
|
|
|
+ // verticalAlign: 'middle' // 文本垂直对齐方式
|
|
|
+ // }
|
|
|
+ // }, {
|
|
|
+ // type: 'text',
|
|
|
+ // right: '5%', // 文本水平位置,这里设置为距离右侧 10% 的位置,作为右下方的文本
|
|
|
+ // top: '90%', // 文本垂直位置,这里设置为距离底部 10% 的位置
|
|
|
+ // style: {
|
|
|
+ // text: '醒来时间:'+endSleepTime?endSleepTime:'', // 文本内容
|
|
|
+ // textFill: '#333', // 文本颜色
|
|
|
+ // textFontSize: 14, // 文本字体大小
|
|
|
+ // textAlign: 'right', // 文本水平对齐方式
|
|
|
+ // verticalAlign: 'middle' // 文本垂直对齐方式
|
|
|
+ // }
|
|
|
+ // }],
|
|
|
+ };
|
|
|
+
|
|
|
+ chart10.setOption(option, true);
|
|
|
+}
|
|
|
+
|
|
|
+function flushChart11(data1, data2, that) {
|
|
|
+ // data2 = data2?data2.map(value => {
|
|
|
+ // return value+10;
|
|
|
+ // }):[];
|
|
|
+ let adjustedData = data2 ? data2.map(value => {
|
|
|
+ return 10;
|
|
|
+ }) : [];
|
|
|
+ // var option = {
|
|
|
+ // // title: {
|
|
|
+ // // text: '睡眠呼吸监测',
|
|
|
+ // // left: 'center',
|
|
|
+ // // textStyle: {
|
|
|
+ // // color: '#ffffff', // 字体颜色
|
|
|
+ // // fontStyle: 'normal', // 字体风格
|
|
|
+ // // // fontWeight: 'bold', // 字体粗细
|
|
|
+ // // fontFamily: 'sans-serif', // 字体族
|
|
|
+ // // fontSize: 18 // 字体大小
|
|
|
+ // // },
|
|
|
+ // // backgroundColor: '#57f7ff'
|
|
|
+ // // },
|
|
|
+ // // grid: {
|
|
|
+ // // top: '10%',
|
|
|
+ // // height: '30%',
|
|
|
+ // // },
|
|
|
+ // tooltip: {},
|
|
|
+ // xAxis: {
|
|
|
+ // type: 'category',
|
|
|
+ // axisLabel: {
|
|
|
+ // color: 'rgba(0, 0, 0, 0.8)' // 设置 x 轴标签颜色为白色
|
|
|
+ // },
|
|
|
+ // axisTick: {
|
|
|
+ // // 不显示Y轴刻度线
|
|
|
+ // show: false
|
|
|
+ // },
|
|
|
+ // axisLine: {
|
|
|
+ // // 不显示X轴轴线
|
|
|
+ // show: false
|
|
|
+ // },
|
|
|
+ // splitLine: {
|
|
|
+ // show: false, // 是否显示刻度线
|
|
|
+ // },
|
|
|
+ // data: data1?data1:[]
|
|
|
+ // },
|
|
|
+ // yAxis: {
|
|
|
+ // // Y 轴配置
|
|
|
+ // type: 'value',
|
|
|
+ // // 设置 Y 轴名称
|
|
|
+ // name: '睡眠状态',
|
|
|
+ // // 设置 Y 轴名称的位置
|
|
|
+ // nameLocation: 'end', // 可以是 'start'、'middle' 或 'end'
|
|
|
+ // axisLine: {
|
|
|
+ // // 不显示Y轴轴线
|
|
|
+ // show: false,
|
|
|
+ // },
|
|
|
+ // axisTick: {
|
|
|
+ // // 不显示Y轴刻度线
|
|
|
+ // show: false
|
|
|
+ // },
|
|
|
+ // axisLabel: {
|
|
|
+ // color: '#000',
|
|
|
+ // formatter: function (value) {
|
|
|
+ // return that.sleepStateChange(value);
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // splitLine: {
|
|
|
+ // show: false ,// 不显示纵坐标轴的刻度线
|
|
|
+ // lineStyle: {
|
|
|
+ // color: 'rgba(0, 170, 255, 0.9)', // 灰色并调整透明度
|
|
|
+ // width: 1, // 刻度线宽度
|
|
|
+ // type: 'solid' // 刻度线类型,默认为实线
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // },
|
|
|
+ // series: [{
|
|
|
+ // type: 'bar',
|
|
|
+ // data: data2?data2:[],
|
|
|
+ // // barCategoryGap: '50%', // 类别间柱形距离
|
|
|
+ // // label: {
|
|
|
+ // // show: true,
|
|
|
+ // // position: 'top',
|
|
|
+ // // formatter: '{b}: {c}'
|
|
|
+ // // },
|
|
|
+ // stack: 'stackGroup',
|
|
|
+ // itemStyle: {
|
|
|
+ // color: 'rgba(0,0,0,0)' // 透明颜色
|
|
|
+ // },
|
|
|
+ // // itemStyle: {
|
|
|
+ // // color: function(params) {
|
|
|
+ // // // 根据数据或其他条件返回颜色值
|
|
|
+ // // // 这里只是简单地返回了一个颜色数组中的颜色
|
|
|
+ // // // var colorList = ['#c23531','#2f4554','#61a0a8','#d48265','#91c7ae','#749f83','#ca8622','#bda29a','#6e7074','#546570','#c4ccd3'];
|
|
|
+ // // if(params.value == '0'){
|
|
|
+ // // return '#e2e2e2'
|
|
|
+ // // }else if(params.value == '10'){
|
|
|
+ // // return '#8cc4ff'
|
|
|
+ // // }else if(params.value == '20'){
|
|
|
+ // // return '#a6b2ff'
|
|
|
+ // // }else if(params.value == '30'){
|
|
|
+ // // return '#9b79ff'
|
|
|
+ // // }else{
|
|
|
+ // // return '';
|
|
|
+ // // }
|
|
|
+ // // // return colorList[params.dataIndex % colorList.length];
|
|
|
+ // // }
|
|
|
+ // // }
|
|
|
+ // }]
|
|
|
+ // };
|
|
|
+
|
|
|
+ var option = {
|
|
|
+ xAxis: {
|
|
|
+ type: 'category',
|
|
|
+ data: data1 ? data1 : []
|
|
|
+ },
|
|
|
+ yAxis: {
|
|
|
+ type: 'value',
|
|
|
+ min: 0, // 确保 Y 轴从 0 开始
|
|
|
+ // max 可以根据需要设置,但通常不需要为了固定柱子高度而设置
|
|
|
+ axisLabel: {
|
|
|
+ color: '#000',
|
|
|
+ formatter: function (value) {
|
|
|
+ return that.sleepStateChange(value);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ series: [
|
|
|
+ // 透明柱子,占满整个柱子空间
|
|
|
+ {
|
|
|
+ data: data2 ? data2 : [],
|
|
|
+ type: 'bar',
|
|
|
+ stack: 'stackGroup',
|
|
|
+ itemStyle: {
|
|
|
+ color: 'rgba(0,0,0,0)' // 透明颜色
|
|
|
+ },
|
|
|
+ barGap: '-100%', // 设置柱子间距为负值,让柱子紧挨在一起
|
|
|
+ barMaxWidth: '30px' // 根据需要调整柱子宽度
|
|
|
+ },
|
|
|
+ // 有色柱子,只显示上半部分(固定高度)
|
|
|
+ {
|
|
|
+ data: adjustedData, // 固定高度数据
|
|
|
+ type: 'bar',
|
|
|
+ stack: 'stackGroup', // 与透明系列使用相同的叠加组名
|
|
|
+ itemStyle: {
|
|
|
+ color: function (params) {
|
|
|
+ console.log('params=' + JSON.stringify(params))
|
|
|
+ if (data2 && data2[params.dataIndex] == 0) {
|
|
|
+ return '#e2e2e2'
|
|
|
+ } else if (data2 && data2[params.dataIndex] == 10) {
|
|
|
+ return '#d8c6ff'
|
|
|
+ } else if (data2 && data2[params.dataIndex] == 20) {
|
|
|
+ return '#c6b3ff'
|
|
|
+ } else if (data2 && data2[params.dataIndex] == 30) {
|
|
|
+ return '#b090ff'
|
|
|
+ } else {
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ barGap: '-100%', // 保持与透明系列相同的柱子间距
|
|
|
+ barMaxWidth: '30px' // 保持与透明系列相同的宽度
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ };
|
|
|
+ chart11.setOption(option, true);
|
|
|
+}
|
|
|
+
|
|
|
+var homeApi = "https://haold.aidsleep.cn";
|
|
|
+var homeApi_http = "http://haold.aidsleep.cn";
|
|
|
+var homeApi_http_port = "8123";
|
|
|
+var homeApi_https = "https://haold.aidsleep.cn";
|
|
|
+const aipushApi = "https://aipush.aidsleep.cn";
|
|
|
+const token_15 = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJiN2JlOGE0MDExZjY0NjA2OGUxYjJiZTE4M2Y2NzU0NSIsImlhdCI6MTcxMTYxNDY2NCwiZXhwIjoyMDI2OTc0NjY0fQ.XJ73cXAoEsouTgvgpNVobq9oKdwlJr88TiAFLYlaahE";
|
|
|
+var token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJlZGVjOWI3YWQ0MTQ0ZTIxYWQ1NTE1Nzc5NTkzNjBjNiIsImlhdCI6MTcxMjEzNTM2MywiZXhwIjoyMDI3NDk1MzYzfQ.IfrvdiaVuhCKsdy69JvUYhJ64bnhMT8MI1hN8R38whc";
|
|
|
+const token_push = "b74fd5754c5ef24cf600c39194abdaeb";
|
|
|
|
|
|
Page({
|
|
|
|
|
|
- /**
|
|
|
- * 页面的初始数据
|
|
|
- */
|
|
|
- data: {
|
|
|
- header: false,
|
|
|
- nowDate: [{ //日历的初始化数据
|
|
|
- month: 'current',
|
|
|
- day: new Date().getDate(),
|
|
|
- color: '#ffd700',
|
|
|
- background: 'white'
|
|
|
- }],
|
|
|
- total1: 0,
|
|
|
- total2: 0,
|
|
|
- total3: 0,
|
|
|
- temArr: [],
|
|
|
- humArr: [],
|
|
|
- clickDate: "",
|
|
|
- status: "",
|
|
|
-
|
|
|
- isShow: false,
|
|
|
-
|
|
|
- year: addZero(new Date().getFullYear()),
|
|
|
- month: addZero(new Date().getMonth()),
|
|
|
- date: addZero(new Date().getDate()),
|
|
|
- hours: addZero(new Date().getHours()),
|
|
|
-
|
|
|
- moke_data: {
|
|
|
- "20240414": [
|
|
|
- {
|
|
|
- sleepAllTime: 902,
|
|
|
- sleepFeedback: "很好"
|
|
|
- },
|
|
|
- {
|
|
|
- sleepAllTime: 222,
|
|
|
- sleepFeedback: "疲惫"
|
|
|
- }
|
|
|
- ],
|
|
|
- "20240415": [
|
|
|
- {
|
|
|
- sleepAllTime: 902,
|
|
|
- sleepFeedback: "很好"
|
|
|
- },
|
|
|
- {
|
|
|
- sleepAllTime: 222,
|
|
|
- sleepFeedback: "疲惫"
|
|
|
- },
|
|
|
- {
|
|
|
- sleepAllTime: 902,
|
|
|
- sleepFeedback: "很好"
|
|
|
- },
|
|
|
- {
|
|
|
- sleepAllTime: 222,
|
|
|
- sleepFeedback: "疲惫"
|
|
|
- },
|
|
|
- {
|
|
|
- sleepAllTime: 902,
|
|
|
- sleepFeedback: "很好"
|
|
|
- }
|
|
|
- ]
|
|
|
- },
|
|
|
- rdt_arr: [],
|
|
|
- rrh_arr: [],
|
|
|
- rhx_arr: [],
|
|
|
- rsnoring_arr: [],
|
|
|
- routbed_arr: [],
|
|
|
- rmove_arr: [],
|
|
|
- rhxstop_arr: [],
|
|
|
- rsleep_arr: [],
|
|
|
-
|
|
|
- rdt_arrNew:[],//睡眠时间轴数据集合
|
|
|
- rrh_arrNew:[],//睡眠心率数据集合
|
|
|
- rhx_arrNew:[],//睡眠呼吸数据集合
|
|
|
- rmove_arrNew:[],//体动状态数据集合,0-否,1-体动状态
|
|
|
- rsleep_arrNew:[],//睡眠状态数据集合,0-清醒,10-浅睡,20-中睡,30-深睡
|
|
|
- rsleep_arr_all_New:[],//睡眠状态数据集合,0-清醒,10-浅睡,20-中睡,30-深睡
|
|
|
- durationData:[], //睡眠时长
|
|
|
- sleep_duration:[], //睡眠和清醒对比
|
|
|
-
|
|
|
- rdeep_duration: 0,
|
|
|
- rlight_duration: 0,
|
|
|
- rin_duration: 0,
|
|
|
- rawake_duration: 0,
|
|
|
-
|
|
|
- rrs_duration: 0,//入睡时长
|
|
|
- routbed_count_value: 0,//离床次数
|
|
|
- rsleep_eff_value: '',//睡眠效率
|
|
|
-
|
|
|
- rdeep_durationFormat: '',
|
|
|
- rlight_durationFormat: '',
|
|
|
- rin_durationFormat: '',
|
|
|
- rawake_durationFormat: '',
|
|
|
-
|
|
|
- ravg_hx_value: 0,
|
|
|
- ravg_hx_desc: '',
|
|
|
- ravg_rh_value: 0,
|
|
|
- ravg_rh_desc: '',
|
|
|
- rscore_value: 0,
|
|
|
- rscore_desc: '',
|
|
|
-
|
|
|
- sleep_efficiency: '',//睡眠效率
|
|
|
-
|
|
|
- zdTime: ["00:00","01:00","02:00","03:00","04:00","05:00",
|
|
|
- ,"06:00","07:00","08:00","09:00","10:00","11:00"
|
|
|
- ,"12:00","13:00","14:00","15:00","16:00","17:00"
|
|
|
- ,"18:00","19:00","20:00","21:00","22:00","23:00"],
|
|
|
- zdPoint: [],
|
|
|
- percentage: 75, // 初始百分比值
|
|
|
-
|
|
|
- canvasWidth: 0,
|
|
|
- canvasHeight: 0,
|
|
|
-
|
|
|
- rsn: '',
|
|
|
- rdate: '',
|
|
|
- rtotal_duration: 0,
|
|
|
- rinbed_duration: 0,
|
|
|
- rgobed_time: 0,
|
|
|
- routbed_time: 0,
|
|
|
- rgobed_routbed: 0,
|
|
|
- sleepHourSub: 0,
|
|
|
- routbed_count_value: 0,
|
|
|
- isButtonClicked: false, // 用来控制按钮是否被点击的标记
|
|
|
- home_room: [
|
|
|
- 'company_laboratory',
|
|
|
- '2802',
|
|
|
- ],
|
|
|
- isButtonPressed: false, // 用来标记按钮是否被按下
|
|
|
- reportDate: '',
|
|
|
- currentDate: '',
|
|
|
- currentTime: '',
|
|
|
- rmove_arrFrequency: 0,//体动次数
|
|
|
- routbed_arrFrequency: 0,//离床次数
|
|
|
- rsnoring_arrFrequency: 0,//打鼾次数
|
|
|
- rhxstop_arrFrequency: 0,//呼吸暂停次数
|
|
|
- sleep_durationCountA: 0,//睡眠时间
|
|
|
- sns: [],
|
|
|
- tvEntityIds: [],
|
|
|
- ifOneMoreTV: false,//数据推送是否有多于一台电视
|
|
|
- selectedValue: '', // 用于存储选中的值
|
|
|
- tvEntityIdsValue: '', // 用于存储选中的值
|
|
|
- selectedIndex: 0, // 默认选中第一个选项
|
|
|
- tvEntityIdsIndex: 0, // 默认选中第一个选项
|
|
|
- hotelcode: '',//酒店编码
|
|
|
- roomcode: '',//房间编码
|
|
|
-
|
|
|
- rdeep_duration_efficiency: '',//深睡比例
|
|
|
- rlight_duration_efficiency: '',//浅睡比例
|
|
|
- rin_duration_efficiency: '',//中睡比例
|
|
|
- isLoading: false,
|
|
|
-
|
|
|
- ec7: '',
|
|
|
- width7: '',
|
|
|
- height7: '',
|
|
|
-
|
|
|
- ec8: '',
|
|
|
- width8: '',
|
|
|
- height8: '',
|
|
|
-
|
|
|
- ec1: '',
|
|
|
- width1: '',
|
|
|
- height1: '',
|
|
|
-
|
|
|
- ec81: '',
|
|
|
- width81: '',
|
|
|
- height81: '',
|
|
|
-
|
|
|
- ec9: '',
|
|
|
- width9: '',
|
|
|
- height9: '',
|
|
|
-
|
|
|
- ec10: '',
|
|
|
- width10: '',
|
|
|
- height10: '',
|
|
|
-
|
|
|
- ec11: '',
|
|
|
- width11: '',
|
|
|
- height11: '',
|
|
|
- flushChart00Flag:false,
|
|
|
- arrayFourth: [ [], []],//多级选择数组
|
|
|
- valueFourth: [0, 0],//多级选择结果index
|
|
|
- sourceFourth: [
|
|
|
- {
|
|
|
- id: 1,
|
|
|
- text: '2024-05-24',
|
|
|
- children: [{
|
|
|
- id: 1,
|
|
|
- text: '01:01~01:20',
|
|
|
- reportId: '11111',
|
|
|
- }, {
|
|
|
- id: 2,
|
|
|
- text: '03:05~04:20',
|
|
|
- reportId: '22222',
|
|
|
- }, {
|
|
|
- id: 3,
|
|
|
- text: '05:21~07:20',
|
|
|
- reportId: '33333',
|
|
|
- }]
|
|
|
- },
|
|
|
- {
|
|
|
- id: 2,
|
|
|
- text: '2024-05-23',
|
|
|
- children: [{
|
|
|
- id: 3,
|
|
|
- text: '00:01~03:20',
|
|
|
- reportId: '454545',
|
|
|
- }, {
|
|
|
- id: 4,
|
|
|
- text: '00:03~06:20',
|
|
|
- reportId: '66666',
|
|
|
- }]
|
|
|
- },
|
|
|
- ],//后台读取的所及数据源
|
|
|
- reportId: '',
|
|
|
- hotelname: '',
|
|
|
- roomname: '',
|
|
|
- pushReportId: '',//推送用:reportId
|
|
|
- },
|
|
|
- //点击确定选择结果时,保存结果
|
|
|
- bindMultiPickerChange: function (e) {
|
|
|
- var result = e.detail.value;
|
|
|
- var data = this.data.sourceFourth;
|
|
|
- console.info('result='+result);
|
|
|
- console.info('result[0]='+result[0]);
|
|
|
- console.info('data[result[0]].text='+data[Number(result[0])].text);
|
|
|
- console.info('data[result[0]].children[result[1]].text='+data[Number(result[0])].children[Number(result[1])].text);
|
|
|
- this.setData({
|
|
|
- reportDate: data[Number(result[0])].text,
|
|
|
- rgobed_routbed: data[Number(result[0])].children[Number(result[1])].text,
|
|
|
- reportId: data[Number(result[0])].children[Number(result[1])].reportId,
|
|
|
- });
|
|
|
- this.onPickerDateTimeChange(this.data.reportId);
|
|
|
- },
|
|
|
- //选择列变更时,处理下级数组变更
|
|
|
- bindMultiPickerColumnChange: function (e) {
|
|
|
- var column = e.detail.column;
|
|
|
- var index = e.detail.value;
|
|
|
- var array = this.data.arrayFourth;
|
|
|
-
|
|
|
- if (column == 0) {
|
|
|
- array[1] = array[column][index].children;
|
|
|
- this.setData({
|
|
|
- arrayFourth: array
|
|
|
- });
|
|
|
- } else if (column == 1) {
|
|
|
- //最后一列不处理
|
|
|
- }
|
|
|
- },
|
|
|
- drawCircle: function() {
|
|
|
- // 创建 canvas 上下文
|
|
|
- const ctx = wx.createCanvasContext('myCanvas');
|
|
|
-
|
|
|
- // 设置圆环的颜色和样式
|
|
|
- ctx.setStrokeStyle('green'); // 圆环的颜色
|
|
|
- ctx.setLineWidth(20); // 圆环的宽度
|
|
|
-
|
|
|
- // 绘制外圆
|
|
|
- ctx.beginPath();
|
|
|
- ctx.arc(80, 80, 50, 0, 2 * Math.PI); // 圆心 (100, 100),半径 100
|
|
|
- ctx.stroke(); // 绘制外圆
|
|
|
-
|
|
|
- // 绘制内圆(与外圆同圆心,但半径小20rpx,即80rpx)
|
|
|
- ctx.beginPath();
|
|
|
- ctx.arc(80, 80, 50, 0, 2 * Math.PI);
|
|
|
- ctx.setFillStyle('white'); // 设置内圆的填充颜色为白色(或者透明,取决于你希望的效果)
|
|
|
- ctx.fill(); // 填充内圆,这样圆环内部就是白色或透明的了
|
|
|
-
|
|
|
- // 结束绘制并更新 canvas
|
|
|
- ctx.draw();
|
|
|
- },
|
|
|
- startInterval: function () {
|
|
|
- // 使用 setInterval 创建定时任务,每8秒执行一次 this.myMethod 方法
|
|
|
- var that = this;
|
|
|
- this.intervalId = setInterval(() => {
|
|
|
- console.log(Date.now());
|
|
|
- }, 6000);
|
|
|
- },
|
|
|
- clearInterval: function () {
|
|
|
- // 清除定时任务
|
|
|
- if (this.intervalId) {
|
|
|
- clearInterval(this.intervalId);
|
|
|
- this.intervalId = null;
|
|
|
- }
|
|
|
- },
|
|
|
- tvEntityIdsChange: function(e) {
|
|
|
- var that = this;
|
|
|
- console.log('this.data.tvEntityIds_tv='+JSON.stringify(this.data.tvEntityIds))
|
|
|
- var selectedOption = this.data.tvEntityIds[e.detail.value];
|
|
|
- console.log('selectedOption_tv='+JSON.stringify(selectedOption))
|
|
|
- if(!this.data.tvEntityIds || !selectedOption){
|
|
|
- wx.showToast({
|
|
|
- title: '请选择需要推送的电视',
|
|
|
- icon: 'none'
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- this.setData({
|
|
|
- tvEntityIdsIndex: e.detail.value,
|
|
|
- tvEntityIdsValue: selectedOption.friendly_name1,
|
|
|
- });
|
|
|
- this.telScreeProjection(selectedOption.entity_id);
|
|
|
+ /**
|
|
|
+ * 页面的初始数据
|
|
|
+ */
|
|
|
+ data: {
|
|
|
+ ecCircularProgressBar: {
|
|
|
+ // lazyLoad: true, // 懒加载
|
|
|
+ onInit: initChartHumidifier
|
|
|
+ },
|
|
|
+ ecOutOfBed: {
|
|
|
+ // lazyLoad: true, // 懒加载
|
|
|
+ onInit: initChartOutOfBed
|
|
|
+ },
|
|
|
+ ecBodyMovements: {
|
|
|
+ // lazyLoad: true, // 懒加载
|
|
|
+ onInit: initChartBodyMovementsLine
|
|
|
+ },
|
|
|
+ ecCardiacSystemLine: {
|
|
|
+ // lazyLoad: true, // 懒加载
|
|
|
+ onInit: initChartCardiacSystemLine
|
|
|
+ },
|
|
|
+ ecChartRespiratoryLine: {
|
|
|
+ // lazyLoad: true, // 懒加载
|
|
|
+ onInit: initChartRespiratoryLine
|
|
|
+ },
|
|
|
+ ecSnoringLine: {
|
|
|
+ // lazyLoad: true, // 懒加载
|
|
|
+ onInit: initSnoringLine
|
|
|
+ },
|
|
|
+ ecApneaLine: {
|
|
|
+ // lazyLoad: true, // 懒加载
|
|
|
+ onInit: initApneaLine
|
|
|
+ },
|
|
|
+ ecTimeWaterfall: {
|
|
|
+ // lazyLoad: true, // 懒加载
|
|
|
+ onInit: initChartTimeWaterfall
|
|
|
+ },
|
|
|
+ header: false,
|
|
|
+ nowDate: [{ //日历的初始化数据
|
|
|
+ month: 'current',
|
|
|
+ day: new Date().getDate(),
|
|
|
+ color: '#ffd700',
|
|
|
+ background: 'white'
|
|
|
+ }],
|
|
|
+ total1: 0,
|
|
|
+ total2: 0,
|
|
|
+ total3: 0,
|
|
|
+ temArr: [],
|
|
|
+ humArr: [],
|
|
|
+ clickDate: "",
|
|
|
+ status: "",
|
|
|
+
|
|
|
+ isShow: false,
|
|
|
+
|
|
|
+ year: addZero(new Date().getFullYear()),
|
|
|
+ month: addZero(new Date().getMonth()),
|
|
|
+ date: addZero(new Date().getDate()),
|
|
|
+ hours: addZero(new Date().getHours()),
|
|
|
+
|
|
|
+ moke_data: {
|
|
|
+ "20240414": [
|
|
|
+ {
|
|
|
+ sleepAllTime: 902,
|
|
|
+ sleepFeedback: "很好"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ sleepAllTime: 222,
|
|
|
+ sleepFeedback: "疲惫"
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "20240415": [
|
|
|
+ {
|
|
|
+ sleepAllTime: 902,
|
|
|
+ sleepFeedback: "很好"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ sleepAllTime: 222,
|
|
|
+ sleepFeedback: "疲惫"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ sleepAllTime: 902,
|
|
|
+ sleepFeedback: "很好"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ sleepAllTime: 222,
|
|
|
+ sleepFeedback: "疲惫"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ sleepAllTime: 902,
|
|
|
+ sleepFeedback: "很好"
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ rdt_arr: [],
|
|
|
+ rrh_arr: [],
|
|
|
+ rhx_arr: [],
|
|
|
+ rsnoring_arr: [],
|
|
|
+ routbed_arr: [],
|
|
|
+ rmove_arr: [],
|
|
|
+ rhxstop_arr: [],
|
|
|
+ rsleep_arr: [],
|
|
|
+
|
|
|
+ rdt_arrNew: [],//睡眠时间轴数据集合
|
|
|
+ rrh_arrNew: [],//睡眠心率数据集合
|
|
|
+ rhx_arrNew: [],//睡眠呼吸数据集合
|
|
|
+ rmove_arrNew: [],//体动状态数据集合,0-否,1-体动状态
|
|
|
+ rsleep_arrNew: [],//睡眠状态数据集合,0-清醒,10-浅睡,20-中睡,30-深睡
|
|
|
+ rsleep_arr_all_New: [],//睡眠状态数据集合,0-清醒,10-浅睡,20-中睡,30-深睡
|
|
|
+ durationData: [], //睡眠时长
|
|
|
+ sleep_duration: [], //睡眠和清醒对比
|
|
|
+ rdeep_durationFormatA:{},
|
|
|
+ rdeep_duration: 0,
|
|
|
+ rlight_duration: 0,
|
|
|
+ rin_duration: 0,
|
|
|
+ rawake_duration: 0,
|
|
|
+
|
|
|
+ rrs_duration: 0,//入睡时长
|
|
|
+ routbed_count_value: 0,//离床次数
|
|
|
+ rsleep_eff_value: '',//睡眠效率
|
|
|
+
|
|
|
+ rdeep_durationFormat: '',
|
|
|
+ rlight_durationFormat: '',
|
|
|
+ rin_durationFormat: '',
|
|
|
+ rawake_durationFormat: '',
|
|
|
+
|
|
|
+ ravg_hx_value: 0,
|
|
|
+ ravg_hx_desc: '',
|
|
|
+ ravg_rh_value: 0,
|
|
|
+ ravg_rh_desc: '',
|
|
|
+ rscore_value: 0,
|
|
|
+ rscore_desc: '',
|
|
|
+
|
|
|
+ sleep_efficiency: '',//睡眠效率
|
|
|
+
|
|
|
+ zdTime: ["00:00", "01:00", "02:00", "03:00", "04:00", "05:00",
|
|
|
+ , "06:00", "07:00", "08:00", "09:00", "10:00", "11:00"
|
|
|
+ , "12:00", "13:00", "14:00", "15:00", "16:00", "17:00"
|
|
|
+ , "18:00", "19:00", "20:00", "21:00", "22:00", "23:00"],
|
|
|
+ zdPoint: [],
|
|
|
+ percentage: 75, // 初始百分比值
|
|
|
+
|
|
|
+ canvasWidth: 0,
|
|
|
+ canvasHeight: 0,
|
|
|
+
|
|
|
+ rsn: '',
|
|
|
+ rdate: '',
|
|
|
+ rtotal_duration: 0,
|
|
|
+ rinbed_duration: 0,
|
|
|
+ rgobed_time: 0,
|
|
|
+ routbed_time: 0,
|
|
|
+ rgobed_routbed: 0,
|
|
|
+ sleepHourSub: 0,
|
|
|
+ routbed_count_value: 0,
|
|
|
+ isButtonClicked: false, // 用来控制按钮是否被点击的标记
|
|
|
+ home_room: [
|
|
|
+ 'company_laboratory',
|
|
|
+ '2802',
|
|
|
+ ],
|
|
|
+ isButtonPressed: false, // 用来标记按钮是否被按下
|
|
|
+ reportDate: '',
|
|
|
+ currentDate: '',
|
|
|
+ currentTime: '',
|
|
|
+ rmove_arrFrequency: 0,//体动次数
|
|
|
+ routbed_arrFrequency: 0,//离床次数
|
|
|
+ rsnoring_arrFrequency: 0,//打鼾次数
|
|
|
+ rhxstop_arrFrequency: 0,//呼吸暂停次数
|
|
|
+ sleep_durationCountA: 0,//睡眠时间
|
|
|
+ sns: [],
|
|
|
+ tvEntityIds: [],
|
|
|
+ ifOneMoreTV: false,//数据推送是否有多于一台电视
|
|
|
+ selectedValue: '', // 用于存储选中的值
|
|
|
+ tvEntityIdsValue: '', // 用于存储选中的值
|
|
|
+ selectedIndex: 0, // 默认选中第一个选项
|
|
|
+ tvEntityIdsIndex: 0, // 默认选中第一个选项
|
|
|
+ hotelcode: '',//酒店编码
|
|
|
+ roomcode: '',//房间编码
|
|
|
+
|
|
|
+ rdeep_duration_efficiency: '',//深睡比例
|
|
|
+ rlight_duration_efficiency: '',//浅睡比例
|
|
|
+ rin_duration_efficiency: '',//中睡比例
|
|
|
+ isLoading: false,
|
|
|
+
|
|
|
+ ec7: '',
|
|
|
+ width7: '',
|
|
|
+ height7: '',
|
|
|
+
|
|
|
+ ec8: '',
|
|
|
+ width8: '',
|
|
|
+ height8: '',
|
|
|
+
|
|
|
+ ec1: '',
|
|
|
+ width1: '',
|
|
|
+ height1: '',
|
|
|
+
|
|
|
+ ec81: '',
|
|
|
+ width81: '',
|
|
|
+ height81: '',
|
|
|
+
|
|
|
+ ec9: '',
|
|
|
+ width9: '',
|
|
|
+ height9: '',
|
|
|
+
|
|
|
+ ec10: '',
|
|
|
+ width10: '',
|
|
|
+ height10: '',
|
|
|
+
|
|
|
+ ec11: '',
|
|
|
+ width11: '',
|
|
|
+ height11: '',
|
|
|
+ flushChart00Flag: false,
|
|
|
+ arrayFourth: [[], []],//多级选择数组
|
|
|
+ valueFourth: [0, 0],//多级选择结果index
|
|
|
+ sourceFourth: [
|
|
|
+ {
|
|
|
+ id: 1,
|
|
|
+ text: '2024-05-24',
|
|
|
+ children: [{
|
|
|
+ id: 1,
|
|
|
+ text: '01:01~01:20',
|
|
|
+ reportId: '11111',
|
|
|
+ }, {
|
|
|
+ id: 2,
|
|
|
+ text: '03:05~04:20',
|
|
|
+ reportId: '22222',
|
|
|
+ }, {
|
|
|
+ id: 3,
|
|
|
+ text: '05:21~07:20',
|
|
|
+ reportId: '33333',
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 2,
|
|
|
+ text: '2024-05-23',
|
|
|
+ children: [{
|
|
|
+ id: 3,
|
|
|
+ text: '00:01~03:20',
|
|
|
+ reportId: '454545',
|
|
|
+ }, {
|
|
|
+ id: 4,
|
|
|
+ text: '00:03~06:20',
|
|
|
+ reportId: '66666',
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ ],//后台读取的所及数据源
|
|
|
+ reportId: '',
|
|
|
+ hotelname: '',
|
|
|
+ roomname: '',
|
|
|
+ pushReportId: '',//推送用:reportId
|
|
|
+ },
|
|
|
+ toWarmReminder(e) {
|
|
|
+ const tabName = e.currentTarget.dataset.index || 1;
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/subpages/warmReminder/warmReminder?id=' + tabName
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //点击确定选择结果时,保存结果
|
|
|
+ bindMultiPickerChange: function (e) {
|
|
|
+ var result = e.detail.value;
|
|
|
+ var data = this.data.sourceFourth;
|
|
|
+ console.info('result=' + result);
|
|
|
+ console.info('result[0]=' + result[0]);
|
|
|
+ console.info('data[result[0]].text=' + data[Number(result[0])].text);
|
|
|
+ console.info('data[result[0]].children[result[1]].text=' + data[Number(result[0])].children[Number(result[1])].text);
|
|
|
+ this.setData({
|
|
|
+ reportDate: data[Number(result[0])].text,
|
|
|
+ rgobed_routbed: data[Number(result[0])].children[Number(result[1])].text,
|
|
|
+ reportId: data[Number(result[0])].children[Number(result[1])].reportId,
|
|
|
+ });
|
|
|
+ this.onPickerDateTimeChange(this.data.reportId);
|
|
|
+ },
|
|
|
+ //选择列变更时,处理下级数组变更
|
|
|
+ bindMultiPickerColumnChange: function (e) {
|
|
|
+ var column = e.detail.column;
|
|
|
+ var index = e.detail.value;
|
|
|
+ var array = this.data.arrayFourth;
|
|
|
+
|
|
|
+ if (column == 0) {
|
|
|
+ array[1] = array[column][index].children;
|
|
|
+ this.setData({
|
|
|
+ arrayFourth: array
|
|
|
+ });
|
|
|
+ } else if (column == 1) {
|
|
|
+ //最后一列不处理
|
|
|
+ }
|
|
|
+ },
|
|
|
+ drawCircle: function () {
|
|
|
+ // 创建 canvas 上下文
|
|
|
+ const ctx = wx.createCanvasContext('myCanvas');
|
|
|
+
|
|
|
+ // 设置圆环的颜色和样式
|
|
|
+ ctx.setStrokeStyle('green'); // 圆环的颜色
|
|
|
+ ctx.setLineWidth(20); // 圆环的宽度
|
|
|
+
|
|
|
+ // 绘制外圆
|
|
|
+ ctx.beginPath();
|
|
|
+ ctx.arc(80, 80, 50, 0, 2 * Math.PI); // 圆心 (100, 100),半径 100
|
|
|
+ ctx.stroke(); // 绘制外圆
|
|
|
+
|
|
|
+ // 绘制内圆(与外圆同圆心,但半径小20rpx,即80rpx)
|
|
|
+ ctx.beginPath();
|
|
|
+ ctx.arc(80, 80, 50, 0, 2 * Math.PI);
|
|
|
+ ctx.setFillStyle('white'); // 设置内圆的填充颜色为白色(或者透明,取决于你希望的效果)
|
|
|
+ ctx.fill(); // 填充内圆,这样圆环内部就是白色或透明的了
|
|
|
+
|
|
|
+ // 结束绘制并更新 canvas
|
|
|
+ ctx.draw();
|
|
|
+ },
|
|
|
+ startInterval: function () {
|
|
|
+ // 使用 setInterval 创建定时任务,每8秒执行一次 this.myMethod 方法
|
|
|
+ var that = this;
|
|
|
+ this.intervalId = setInterval(() => {
|
|
|
+ console.log(Date.now());
|
|
|
+ }, 6000);
|
|
|
+ },
|
|
|
+ clearInterval: function () {
|
|
|
+ // 清除定时任务
|
|
|
+ if (this.intervalId) {
|
|
|
+ clearInterval(this.intervalId);
|
|
|
+ this.intervalId = null;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ tvEntityIdsChange: function (e) {
|
|
|
+ var that = this;
|
|
|
+ console.log('this.data.tvEntityIds_tv=' + JSON.stringify(this.data.tvEntityIds))
|
|
|
+ var selectedOption = this.data.tvEntityIds[e.detail.value];
|
|
|
+ console.log('selectedOption_tv=' + JSON.stringify(selectedOption))
|
|
|
+ if (!this.data.tvEntityIds || !selectedOption) {
|
|
|
+ wx.showToast({
|
|
|
+ title: '请选择需要推送的电视',
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ tvEntityIdsIndex: e.detail.value,
|
|
|
+ tvEntityIdsValue: selectedOption.friendly_name1,
|
|
|
+ });
|
|
|
+ this.telScreeProjection(selectedOption.entity_id);
|
|
|
+ },
|
|
|
+ tvEntityIdChange: function (e) {
|
|
|
+ this.telScreeProjection();
|
|
|
+ },
|
|
|
+ onPickerChange: function (e) {
|
|
|
+ var that = this;
|
|
|
+ var selectedOption = this.data.sns[e.detail.value];
|
|
|
+ this.setData({
|
|
|
+ selectedIndex: e.detail.value,
|
|
|
+ selectedValue: selectedOption.pos,
|
|
|
+ rsn: selectedOption.sn,
|
|
|
+ });
|
|
|
+ console.log("e.detail.value=" + e.detail.value);
|
|
|
+ console.log("selectedOption=" + JSON.stringify(selectedOption));
|
|
|
+ this.getData(selectedOption.sn, this.data.hotelcode, this.data.roomcode, null);
|
|
|
+
|
|
|
+ // this.selectComponent('#mychart-dom-bar00').init((canvas, width, height) => {
|
|
|
+ that.initChartCircle()
|
|
|
+ that.initOutOfBed()
|
|
|
+ that.initBodyMovements()
|
|
|
+ that.initCardiacSystem()
|
|
|
+ that.initChartRespiratory()
|
|
|
+ that.initChartSnoring()
|
|
|
+ that.initChartApnea()
|
|
|
+ that.initTimeWaterfall()
|
|
|
+ // });
|
|
|
+ // this.selectComponent('#mychart-dom-bar7').init((canvas, width, height) => {
|
|
|
+ // that.initChart7(canvas, width, height, null)
|
|
|
+ // });
|
|
|
+ // this.selectComponent('#mychart-dom-bar8').init((canvas, width, height) => {
|
|
|
+ // that.initChart8(canvas, width, height, null)
|
|
|
+ // });
|
|
|
+ // this.selectComponent('#mychart-dom-bar1').init((canvas, width, height) => {
|
|
|
+ // that.initChart1(canvas, width, height, null)
|
|
|
+ // });
|
|
|
+ // this.selectComponent('#mychart-dom-bar81').init((canvas, width, height) => {
|
|
|
+ // that.initChart81(canvas, width, height, null)
|
|
|
+ // });
|
|
|
+ // this.selectComponent('#mychart-dom-bar9').init((canvas, width, height) => {
|
|
|
+ // that.initChart9(canvas, width, height, null)
|
|
|
+ // });
|
|
|
+ // this.selectComponent('#mychart-dom-bar10').init((canvas, width, height) => {
|
|
|
+ // that.initChart10(canvas, width, height, null)
|
|
|
+ // });
|
|
|
+ // this.selectComponent('#mychart-dom-bar11').init((canvas, width, height) => {
|
|
|
+ // that.initChart11(canvas, width, height, null)
|
|
|
+ // });
|
|
|
+ },
|
|
|
+ onPickerDateTimeChange: function (reportId) {
|
|
|
+ var that = this;
|
|
|
+ // var selectedOption = this.data.sns[e.detail.value];
|
|
|
+ // this.setData({
|
|
|
+ // selectedIndex: e.detail.value,
|
|
|
+ // selectedValue: selectedOption.pos,
|
|
|
+ // rsn: selectedOption.sn,
|
|
|
+ // });
|
|
|
+ // console.log("e.detail.value="+e.detail.value);
|
|
|
+ // console.log("selectedOption="+JSON.stringify(selectedOption));
|
|
|
+ this.getData(that.data.sn, this.data.hotelcode, this.data.roomcode, reportId);
|
|
|
+ // this.selectComponent('#mychart-dom-bar00').init((canvas, width, height) => {
|
|
|
+ that.initChartCircle(reportId)
|
|
|
+ // });
|
|
|
+ // this.selectComponent('#mychart-dom-bar7').init((canvas, width, height) => {
|
|
|
+ that.initOutOfBed(reportId)
|
|
|
+ that.initBodyMovements(reportId)
|
|
|
+ that.initCardiacSystem(reportId)
|
|
|
+ that.initChartRespiratory(reportId)
|
|
|
+ that.initChartSnoring(reportId)
|
|
|
+ that.initChartApnea(reportId)
|
|
|
+ that.initTimeWaterfall(reportId)
|
|
|
+ // });
|
|
|
+ // this.selectComponent('#mychart-dom-bar8').init((canvas, width, height) => {
|
|
|
+ // that.initChart8(canvas, width, height, reportId)
|
|
|
+ // });
|
|
|
+ // this.selectComponent('#mychart-dom-bar1').init((canvas, width, height) => {
|
|
|
+ // that.initChart1(canvas, width, height, reportId)
|
|
|
+ // });
|
|
|
+ // this.selectComponent('#mychart-dom-bar81').init((canvas, width, height) => {
|
|
|
+ // that.initChart81(canvas, width, height, reportId)
|
|
|
+ // });
|
|
|
+ // this.selectComponent('#mychart-dom-bar9').init((canvas, width, height) => {
|
|
|
+ // that.initChart9(canvas, width, height, reportId)
|
|
|
+ // });
|
|
|
+ // this.selectComponent('#mychart-dom-bar10').init((canvas, width, height) => {
|
|
|
+ // that.initChart10(canvas, width, height, reportId)
|
|
|
+ // });
|
|
|
+ // this.selectComponent('#mychart-dom-bar11').init((canvas, width, height) => {
|
|
|
+ // that.initChart11(canvas, width, height, reportId)
|
|
|
+ // });
|
|
|
+ },
|
|
|
+ onButtonTap: function () {
|
|
|
+ // 切换按钮的样式类
|
|
|
+ this.setData({
|
|
|
+ isButtonPressed: !this.data.isButtonPressed
|
|
|
+ });
|
|
|
+ },
|
|
|
+ dayClick(event) { //日历点击选择日期
|
|
|
+ var that = this;
|
|
|
+ var clickDate = String(event.detail.year) + addZero(event.detail.month) + addZero(event.detail.day)
|
|
|
+ // that.getTargetData(clickDate)
|
|
|
+ console.log("change date", that.data.target_sleep_list)
|
|
|
+ flushChart(that.data.target_sleep_list)
|
|
|
+
|
|
|
+ that.setData({
|
|
|
+ nowDate: [{
|
|
|
+ month: 'current',
|
|
|
+ day: event.detail.day,
|
|
|
+ color: 'white',
|
|
|
+ background: '#82d5f8'
|
|
|
+ }, {
|
|
|
+ month: 'current',
|
|
|
+ day: new Date().getDate(),
|
|
|
+ color: '#ffd700',
|
|
|
+ background: 'white'
|
|
|
+ }],
|
|
|
+ clickDate: clickDate,
|
|
|
+ ec: {
|
|
|
+ onInit: that.construct_sleep_plot
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ getTargetData(date) {
|
|
|
+ var that = this;
|
|
|
+ var sleep_data = wx.getStorageSync("sleep_data")
|
|
|
+ console.log("find date is", date)
|
|
|
+ if (sleep_data || that.data.moke_data) {
|
|
|
+ if (date == "20240414" || date == "20240415") {
|
|
|
+ var parse_sleep_data = that.data.moke_data[date]
|
|
|
+ } else {
|
|
|
+ var parse_sleep_data = JSON.parse(sleep_data)[date]
|
|
|
+ }
|
|
|
+ var sleep_cnt = 0
|
|
|
+ if (parse_sleep_data) {
|
|
|
+ sleep_cnt = parse_sleep_data.length;
|
|
|
+ }
|
|
|
+ var sleep_time = 0.0;
|
|
|
+ var sleep_desc = "";
|
|
|
+ var sleep_tj_map = {
|
|
|
+ '早醒': 0,
|
|
|
+ '疲惫': 0,
|
|
|
+ '多梦': 0,
|
|
|
+ '很好': 0
|
|
|
+ };
|
|
|
+ var slepp_sugg = "";
|
|
|
+ var target_sleep_list = [];
|
|
|
+ for (var i in parse_sleep_data) {
|
|
|
+ var fix_sleep_tm = (parse_sleep_data[i].sleepAllTime / 60).toFixed(1);
|
|
|
+ sleep_time += parseFloat(fix_sleep_tm);
|
|
|
+ sleep_tj_map[parse_sleep_data[i].sleepFeedback] += 1
|
|
|
+ target_sleep_list.push(parseFloat(fix_sleep_tm))
|
|
|
+ }
|
|
|
+
|
|
|
+ for (var j in sleep_tj_map) {
|
|
|
+ if (sleep_tj_map[j] > 0) {
|
|
|
+ sleep_desc += j + String(sleep_tj_map[j]) + " 次."
|
|
|
+ }
|
|
|
+ }
|
|
|
+ switch (sleep_cnt) {
|
|
|
+ case 5:
|
|
|
+ slepp_sugg = "继续保持睡前良好状态";
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ slepp_sugg = "学会释放工作压力";
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ slepp_sugg = "睡前一小时不要进行有氧运动";
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ slepp_sugg = "睡前尽量不要摄入高热量餐饮";
|
|
|
+ break;
|
|
|
+ case 0:
|
|
|
+ slepp_sugg = "还未产生睡眠报告";
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ slepp_sugg = "做一些助眠工作";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ that.setData({
|
|
|
+ data_dispaly: true,
|
|
|
+ sleep_cnt: sleep_cnt,
|
|
|
+ sleep_time: sleep_time.toFixed(1),
|
|
|
+ sleep_desc: sleep_desc,
|
|
|
+ slepp_sugg: slepp_sugg,
|
|
|
+ target_sleep_list: target_sleep_list,
|
|
|
+ ec0: { onInit: target_sleep_list },
|
|
|
+ ec: { onInit: target_sleep_list },
|
|
|
+ ec1: { onInit: target_sleep_list },
|
|
|
+ ec2: { onInit: target_sleep_list },
|
|
|
+ ec3: { onInit: target_sleep_list },
|
|
|
+ ec4: { onInit: target_sleep_list },
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ initChartCircle(reportId) {
|
|
|
+ var that = this;
|
|
|
+ wx.request({
|
|
|
+ url: `${aipushApi}` + '/getsn',
|
|
|
+ data: {
|
|
|
+ // "hotelcode":that.data.hotelcode?that.data.hotelcode:"club",
|
|
|
+ // "roomcode":that.data.hotelcode?that.data.roomcode:"nuange",
|
|
|
+ "hotelcode": that.data.hotelcode ? that.data.hotelcode : "club",
|
|
|
+ "roomcode": that.data.roomcode ? that.data.roomcode : "nuange",
|
|
|
+ "token": token_push
|
|
|
+ },
|
|
|
+ method: 'POST',
|
|
|
+ success(res) {
|
|
|
+ try {
|
|
|
+ if (res && res.data && res.data[0]) {
|
|
|
+ that.setData({
|
|
|
+ roomname: res.data[0].rn
|
|
|
+ });
|
|
|
+ console.log("res.data=sn=" + JSON.stringify(res.data));
|
|
|
+ wx.request({
|
|
|
+ url: `${aipushApi}` + '/getsingle',
|
|
|
+ data: {
|
|
|
+ "sn": that.data.rsn ? that.data.rsn : res.data[0].sn,
|
|
|
+ "rpids": reportId,
|
|
|
+ "token": token_push
|
|
|
+ },
|
|
|
+ method: 'POST',
|
|
|
+ success(ress) {
|
|
|
+ if (ress && ress.data) {
|
|
|
+ // console.log('ress.data-getsingle='+JSON.stringify(ress.data.results));
|
|
|
+ try {
|
|
|
+ let rscore_descTemp = [];
|
|
|
+ if (ress.data.results.rscore_desc) {
|
|
|
+ rscore_descTemp = ress.data.results.rscore_desc;
|
|
|
+ }
|
|
|
+ let rscore_valueTemp = [];
|
|
|
+ if (ress.data.results.rscore_value) {
|
|
|
+ rscore_valueTemp = ress.data.results.rscore_value;
|
|
|
+ }
|
|
|
+ that.setData({
|
|
|
+ rscore_desc: rscore_descTemp,
|
|
|
+ rscore_value: rscore_valueTemp,
|
|
|
+ });
|
|
|
+ updateChartCircularProgressBarOption(rscore_descTemp, rscore_valueTemp, that);
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+ // console.log("that.data.rdt_arrNew1,that.data.rrh_arrNew1="+that.data.rdt_arrNew+","+that.data.rrh_arrNew);
|
|
|
+ // console.log("");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ })
|
|
|
+ },
|
|
|
+ initChart(canvas, width, height) {
|
|
|
+ var that = this;
|
|
|
+ chart = echarts.init(canvas, null, {
|
|
|
+ width: width,
|
|
|
+ height: height
|
|
|
+ });
|
|
|
+ console.log("plot in ......")
|
|
|
+ canvas.setChart(chart);
|
|
|
+ flushChart(that.data.target_sleep_list)
|
|
|
+ },
|
|
|
+// 心脏 系统
|
|
|
+ initCardiacSystem(reportId) {
|
|
|
+ var that = this;
|
|
|
+ wx.request({
|
|
|
+ url: `${aipushApi}` + '/getsn',
|
|
|
+ data: {
|
|
|
+ // "hotelcode":that.data.hotelcode?that.data.hotelcode:"club",
|
|
|
+ // "roomcode":that.data.hotelcode?that.data.roomcode:"nuange",
|
|
|
+ "hotelcode": that.data.hotelcode ? that.data.hotelcode : "club",
|
|
|
+ "roomcode": that.data.roomcode ? that.data.roomcode : "nuange",
|
|
|
+ "token": token_push
|
|
|
+ },
|
|
|
+ method: 'POST',
|
|
|
+ success(res) {
|
|
|
+ try {
|
|
|
+ if (res && res.data && res.data[0]) {
|
|
|
+ that.setData({
|
|
|
+ roomname: res.data[0].rn
|
|
|
+ });
|
|
|
+ console.log("res.data=sn=" + JSON.stringify(res.data));
|
|
|
+ wx.request({
|
|
|
+ url: `${aipushApi}` + '/getsingle',
|
|
|
+ data: {
|
|
|
+ "sn": that.data.rsn ? that.data.rsn : res.data[0].sn,
|
|
|
+ "token": token_push,
|
|
|
+ "rpids": reportId
|
|
|
+ },
|
|
|
+ method: 'POST',
|
|
|
+ success(ress) {
|
|
|
+ if (ress && ress.data) {
|
|
|
+ // console.log('ress.data-getsingle='+JSON.stringify(ress.data.results));
|
|
|
+ try {
|
|
|
+ let rdt_arrTemp = [];
|
|
|
+ if (ress.data.results.rrh_arr) {
|
|
|
+ rdt_arrTemp = that.splitN(ress.data.results.rdt_arr.split(","), 100);
|
|
|
+ }
|
|
|
+ if (ress.data.results.rdate) {
|
|
|
+ that.setData({
|
|
|
+ reportDate: ress.data.results.rdate
|
|
|
+ });
|
|
|
+ }
|
|
|
+ let rrh_arrTemp = [];
|
|
|
+ if (ress.data.results.rrh_arr) {
|
|
|
+ rrh_arrTemp = that.splitN(ress.data.results.rrh_arr.split(","), 100);
|
|
|
+ }
|
|
|
+ that.setData({
|
|
|
+ rdt_arrNew: rdt_arrTemp,
|
|
|
+ rrh_arrNew: rrh_arrTemp,
|
|
|
+ });
|
|
|
+ console.log("that.data.rdt_arrNew,that.data.rrh_arrNew=" + that.data.rdt_arrNew + "," + that.data.rrh_arrNew);
|
|
|
+ updateCardiacSystem(that.data.rdt_arrNew, that.data.rrh_arrNew, that);
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+ // console.log("that.data.rdt_arrNew1,that.data.rrh_arrNew1="+that.data.rdt_arrNew+","+that.data.rrh_arrNew);
|
|
|
+ // console.log("");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ })
|
|
|
+ },
|
|
|
+ initChart2(canvas, width, height) {
|
|
|
+ var that = this;
|
|
|
+ wx.request({
|
|
|
+ url: `${aipushApi}` + '/getsn',
|
|
|
+ data: {
|
|
|
+ "hotelcode": that.data.hotelcode ? that.data.hotelcode : "club",
|
|
|
+ "roomcode": that.data.roomcode ? that.data.roomcode : "nuange",
|
|
|
+ "token": token_push
|
|
|
+ },
|
|
|
+ method: 'POST',
|
|
|
+ success(res) {
|
|
|
+ try {
|
|
|
+ if (res && res.data && res.data[0]) {
|
|
|
+ that.setData({
|
|
|
+ roomname: res.data[0].rn
|
|
|
+ });
|
|
|
+ wx.request({
|
|
|
+ url: `${aipushApi}` + '/getsingle',
|
|
|
+ data: {
|
|
|
+ "sn": res.data[0].sn,
|
|
|
+ "token": token_push
|
|
|
+ },
|
|
|
+ method: 'POST',
|
|
|
+ success(ress) {
|
|
|
+ if (ress && ress.data) {
|
|
|
+ // console.log('ress.data-getsingle='+JSON.stringify(ress.data.results));
|
|
|
+ try {
|
|
|
+ let durationDataTemp = [];
|
|
|
+ let obj = {};
|
|
|
+ obj.name = '深睡';
|
|
|
+ obj.value = ress.data.results.rdeep_duration;
|
|
|
+ durationDataTemp.push(obj);
|
|
|
+ obj = {};
|
|
|
+ obj.name = '中睡';
|
|
|
+ obj.value = ress.data.results.rin_duration;
|
|
|
+ durationDataTemp.push(obj);
|
|
|
+ obj = {};
|
|
|
+ obj.name = '浅睡';
|
|
|
+ obj.value = ress.data.results.rlight_duration;
|
|
|
+ durationDataTemp.push(obj);
|
|
|
+ obj = {};
|
|
|
+ obj.name = '清醒';
|
|
|
+ obj.value = ress.data.results.rawake_duration;
|
|
|
+ durationDataTemp.push(obj);
|
|
|
+ console.log("durationDataTemp=" + JSON.stringify(durationDataTemp));
|
|
|
+ that.setData({
|
|
|
+ durationData: durationDataTemp,
|
|
|
+ });
|
|
|
+ chart2 = echarts.init(canvas, null, {
|
|
|
+ width: width,
|
|
|
+ height: height
|
|
|
+ });
|
|
|
+ // console.log("plot in ......")
|
|
|
+ canvas.setChart(chart2);
|
|
|
+ flushChart2(that.data.durationData)
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+ // console.log("that.data.rdt_arrNew1,that.data.rrh_arrNew1="+that.data.rdt_arrNew+","+that.data.rrh_arrNew);
|
|
|
+ // console.log("");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ })
|
|
|
+ },
|
|
|
+ initChart3(canvas, width, height) {
|
|
|
+ var that = this;
|
|
|
+ wx.request({
|
|
|
+ url: `${aipushApi}` + '/getsn',
|
|
|
+ data: {
|
|
|
+ "hotelcode": that.data.hotelcode ? that.data.hotelcode : "club",
|
|
|
+ "roomcode": that.data.roomcode ? that.data.roomcode : "nuange",
|
|
|
+ "token": token_push
|
|
|
+ },
|
|
|
+ method: 'POST',
|
|
|
+ success(res) {
|
|
|
+ try {
|
|
|
+ if (res && res.data && res.data[0]) {
|
|
|
+ that.setData({
|
|
|
+ roomname: res.data[0].rn
|
|
|
+ });
|
|
|
+ wx.request({
|
|
|
+ url: `${aipushApi}` + '/getsingle',
|
|
|
+ data: {
|
|
|
+ "sn": res.data[0].sn,
|
|
|
+ "token": token_push
|
|
|
+ },
|
|
|
+ method: 'POST',
|
|
|
+ success(ress) {
|
|
|
+ if (ress && ress.data) {
|
|
|
+ // console.log('ress.data-getsingle='+JSON.stringify(ress.data.results));
|
|
|
+ try {
|
|
|
+ let rdt_arrTemp = [];
|
|
|
+ if (ress.data.results.rrh_arr) {
|
|
|
+ rdt_arrTemp = that.splitN(ress.data.results.rdt_arr.split(","), 100);
|
|
|
+ }
|
|
|
+ let rhx_arrTemp = [];
|
|
|
+ if (ress.data.results.rhx_arr) {
|
|
|
+ rhx_arrTemp = that.splitN(ress.data.results.rhx_arr.split(","), 100);
|
|
|
+ }
|
|
|
+ that.setData({
|
|
|
+ rdt_arrNew: rdt_arrTemp,
|
|
|
+ rhx_arrNew: rhx_arrTemp,
|
|
|
+ });
|
|
|
+ chart3 = echarts.init(canvas, null, {
|
|
|
+ width: width,
|
|
|
+ height: height
|
|
|
+ });
|
|
|
+ console.log("plot in ......")
|
|
|
+ canvas.setChart(chart3);
|
|
|
+ flushChart3(that.data.rdt_arrNew, that.data.rhx_arrNew)
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+ // console.log("that.data.rdt_arrNew1,that.data.rrh_arrNew1="+that.data.rdt_arrNew+","+that.data.rrh_arrNew);
|
|
|
+ // console.log("");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ })
|
|
|
+ },
|
|
|
+ initTimeWaterfall(reportId) {
|
|
|
+ var that = this;
|
|
|
+ wx.request({
|
|
|
+ url: `${aipushApi}` + '/getsn',
|
|
|
+ data: {
|
|
|
+ "hotelcode": that.data.hotelcode ? that.data.hotelcode : "club",
|
|
|
+ "roomcode": that.data.roomcode ? that.data.roomcode : "nuange",
|
|
|
+ "token": token_push
|
|
|
+ },
|
|
|
+ method: 'POST',
|
|
|
+ success(res) {
|
|
|
+ try {
|
|
|
+ if (res && res.data && res.data[0]) {
|
|
|
+ that.setData({
|
|
|
+ roomname: res.data[0].rn
|
|
|
+ });
|
|
|
+ wx.request({
|
|
|
+ url: `${aipushApi}` + '/getsingle',
|
|
|
+ data: {
|
|
|
+ "sn": that.data.rsn ? that.data.rsn : res.data[0].sn,
|
|
|
+ "token": token_push,
|
|
|
+ "rpids": reportId
|
|
|
+ },
|
|
|
+ method: 'POST',
|
|
|
+ success(ress) {
|
|
|
+ if (ress && ress.data) {
|
|
|
+ try {
|
|
|
+ let rdt_arrTemp = [];
|
|
|
+ if (ress.data.results.rrh_arr) {
|
|
|
+ rdt_arrTemp = that.splitN(ress.data.results.rdt_arr.split(","), 100);
|
|
|
+ }
|
|
|
+ // console.log('深浅睡眠11111=======' + JSON.stringify(rdt_arrTemp));
|
|
|
+ let rsleep_arr_Temp = [];
|
|
|
+ if (ress.data.results.rsleep_arr) {
|
|
|
+ rsleep_arr_Temp = that.splitN(ress.data.results.rsleep_arr.split(","), 100);
|
|
|
+ }
|
|
|
+ // console.log('深浅睡眠11111=======' + JSON.stringify(rsleep_arr_Temp));
|
|
|
+ that.setData({
|
|
|
+ rdt_arrNew: rdt_arrTemp,
|
|
|
+ rsleep_arr: rsleep_arr_Temp,
|
|
|
+ rdeep_duration: ress.data.results.rdeep_duration,
|
|
|
+ rlight_duration: ress.data.results.rlight_duration,
|
|
|
+ rin_duration: ress.data.results.rin_duration,
|
|
|
+ rawake_duration: ress.data.results.rawake_duration,
|
|
|
+ rdeep_durationFormat: that.convertTimeToHoursAndMinutes(ress.data.results.rdeep_duration, 1),
|
|
|
+ rlight_durationFormat: that.convertTimeToHoursAndMinutes(ress.data.results.rlight_duration, 1),
|
|
|
+ rin_durationFormat: that.convertTimeToHoursAndMinutes(ress.data.results.rin_duration, 1),
|
|
|
+ rawake_durationFormat: that.convertTimeToHoursAndMinutes(ress.data.results.rawake_duration, 1),
|
|
|
+ });
|
|
|
+
|
|
|
+ console.log('ress.data.results.rdeep_duration=' + ress.data.results.rdeep_duration);
|
|
|
+ console.log('ress.data.results.rlight_duration=' + ress.data.results.rlight_duration);
|
|
|
+ console.log('ress.data.results.rin_duration=' + ress.data.results.rin_duration);
|
|
|
+ console.log('ress.data.results.rawake_duration=' + ress.data.results.rawake_duration);
|
|
|
+
|
|
|
+
|
|
|
+ updateTimeWaterfall([that.convertTimeToHoursAndMinutes(ress.data.results.rawake_duration, 2),
|
|
|
+ that.convertTimeToHoursAndMinutes(ress.data.results.rin_duration, 2),
|
|
|
+ that.convertTimeToHoursAndMinutes(ress.data.results.rlight_duration, 2),
|
|
|
+ that.convertTimeToHoursAndMinutes(ress.data.results.rdeep_duration, 2)],
|
|
|
+ [ ress.data.results.rawake_duration || 0,
|
|
|
+ ress.data.results.rin_duration || 0,
|
|
|
+ ress.data.results.rlight_duration || 0,
|
|
|
+ ress.data.results.rdeep_duration || 0,
|
|
|
+ ], that)
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+ console.log("that.data.rsleep_arr=" + that.data.rsleep_arr);
|
|
|
+ console.log("");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ })
|
|
|
+ },
|
|
|
+ initChart4(canvas, width, height) {
|
|
|
+ var that = this;
|
|
|
+ wx.request({
|
|
|
+ url: `${aipushApi}` + '/getsn',
|
|
|
+ data: {
|
|
|
+ "hotelcode": that.data.hotelcode ? that.data.hotelcode : "club",
|
|
|
+ "roomcode": that.data.roomcode ? that.data.roomcode : "nuange",
|
|
|
+ "token": token_push
|
|
|
+ },
|
|
|
+ method: 'POST',
|
|
|
+ success(res) {
|
|
|
+ try {
|
|
|
+ if (res && res.data && res.data[0]) {
|
|
|
+ that.setData({
|
|
|
+ roomname: res.data[0].rn
|
|
|
+ });
|
|
|
+ wx.request({
|
|
|
+ url: `${aipushApi}` + '/getsingle',
|
|
|
+ data: {
|
|
|
+ "sn": res.data[0].sn,
|
|
|
+ "token": token_push
|
|
|
+ },
|
|
|
+ method: 'POST',
|
|
|
+ success(ress) {
|
|
|
+ if (ress && ress.data) {
|
|
|
+ // console.log('ress.data-getsingle='+JSON.stringify(ress.data.results));
|
|
|
+ try {
|
|
|
+ let sleep_durationCount = 0;
|
|
|
+ if (ress.data.results.rdeep_duration) {
|
|
|
+ sleep_durationCount += parseFloat(ress.data.results.rdeep_duration)
|
|
|
+ }
|
|
|
+ if (ress.data.results.rlight_duration) {
|
|
|
+ sleep_durationCount += parseFloat(ress.data.results.rlight_duration)
|
|
|
+ }
|
|
|
+ if (ress.data.results.rin_duration) {
|
|
|
+ sleep_durationCount += parseFloat(ress.data.results.rin_duration)
|
|
|
+ }
|
|
|
+ let sleep_durationTemp = [];
|
|
|
+ // let data1 = [];
|
|
|
+ let obj1 = {};
|
|
|
+ obj1.name = '睡眠时间';
|
|
|
+ obj1.value = Math.ceil(sleep_durationCount / 60);
|
|
|
+ sleep_durationTemp.push(obj1);
|
|
|
+ // data1.push(obj1);
|
|
|
+ // let data2 = [];
|
|
|
+ obj1 = {};
|
|
|
+ obj1.name = '清醒时间';
|
|
|
+ obj1.value = Math.ceil(parseFloat(ress.data.results.rawake_duration) / 60);
|
|
|
+ sleep_durationTemp.push(obj1);
|
|
|
+ // data2.push(obj1);
|
|
|
+ that.setData({
|
|
|
+ sleep_duration: sleep_durationTemp,
|
|
|
+ });
|
|
|
+ chart4 = echarts.init(canvas, null, {
|
|
|
+ width: width,
|
|
|
+ height: height
|
|
|
+ });
|
|
|
+ console.log("plot in ......")
|
|
|
+ canvas.setChart(chart4);
|
|
|
+ // console.log("that.data.sleep_duration="+JSON.stringify(that.data.sleep_duration))
|
|
|
+ flushChart4(that.data.sleep_duration)
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+ console.log("");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ })
|
|
|
+ },
|
|
|
+ initChart5(canvas, width, height) {
|
|
|
+ var that = this;
|
|
|
+ wx.request({
|
|
|
+ url: `${aipushApi}` + '/getsn',
|
|
|
+ data: {
|
|
|
+ "hotelcode": that.data.hotelcode ? that.data.hotelcode : "club",
|
|
|
+ "roomcode": that.data.roomcode ? that.data.roomcode : "nuange",
|
|
|
+ "token": token_push
|
|
|
+ },
|
|
|
+ method: 'POST',
|
|
|
+ success(res) {
|
|
|
+ if (res && res.data && res.data[0]) {
|
|
|
+ that.setData({
|
|
|
+ roomname: res.data[0].rn
|
|
|
+ });
|
|
|
+ try {
|
|
|
+ wx.request({
|
|
|
+ url: `${aipushApi}` + '/getsingle',
|
|
|
+ data: {
|
|
|
+ "sn": res.data[0].sn,
|
|
|
+ "token": token_push
|
|
|
+ },
|
|
|
+ method: 'POST',
|
|
|
+ success(ress) {
|
|
|
+ if (ress && ress.data) {
|
|
|
+ // console.log('ress.data-getsingle='+JSON.stringify(ress.data.results));
|
|
|
+ try {
|
|
|
+ let rdt_arrTemp = [];
|
|
|
+ if (ress.data.results.rrh_arr) {
|
|
|
+ rdt_arrTemp = that.splitN(ress.data.results.rdt_arr.split(","), 100);
|
|
|
+ }
|
|
|
+ let rsleep_arrTemp = [];
|
|
|
+ if (ress.data.results.rsleep_arr) {
|
|
|
+ rsleep_arrTemp = that.splitN(ress.data.results.rsleep_arr.split(","), 100);
|
|
|
+ }
|
|
|
+ that.setData({
|
|
|
+ rdt_arrNew: rdt_arrTemp,
|
|
|
+ rsleep_arrNew: rsleep_arrTemp,
|
|
|
+
|
|
|
+ });
|
|
|
+ chart5 = echarts.init(canvas, null, {
|
|
|
+ width: width,
|
|
|
+ height: height
|
|
|
+ });
|
|
|
+ console.log("plot in ......")
|
|
|
+ canvas.setChart(chart5);
|
|
|
+ flushChart5(that.data.rdt_arrNew, that.data.rsleep_arrNew, that)
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+ console.log("that.data.rdt_arrNew1,that.data.rrh_arrNew1=" + that.data.rdt_arrNew + "," + that.data.rrh_arrNew);
|
|
|
+ console.log("");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ })
|
|
|
+ },
|
|
|
+ initChart6(canvas, width, height) {
|
|
|
+ var that = this;
|
|
|
+ wx.request({
|
|
|
+ url: `${aipushApi}` + '/getsn',
|
|
|
+ data: {
|
|
|
+ "hotelcode": that.data.hotelcode ? that.data.hotelcode : "club",
|
|
|
+ "roomcode": that.data.roomcode ? that.data.roomcode : "nuange",
|
|
|
+ "token": token_push
|
|
|
+ },
|
|
|
+ method: 'POST',
|
|
|
+ success(res) {
|
|
|
+ try {
|
|
|
+ if (res && res.data && res.data[0]) {
|
|
|
+ that.setData({
|
|
|
+ roomname: res.data[0].rn
|
|
|
+ });
|
|
|
+ wx.request({
|
|
|
+ url: `${aipushApi}` + '/getsingle',
|
|
|
+ data: {
|
|
|
+ "sn": res.data[0].sn,
|
|
|
+ "token": token_push
|
|
|
+ },
|
|
|
+ method: 'POST',
|
|
|
+ success(ress) {
|
|
|
+ if (ress && ress.data) {
|
|
|
+ // console.log('ress.data-getsingle='+JSON.stringify(ress.data.results));
|
|
|
+ try {
|
|
|
+ var rsleep_arr_all_Temp = [];
|
|
|
+ if (ress.data.results.rsleep_arr) {
|
|
|
+ rsleep_arr_all_Temp = ress.data.results.rsleep_arr.split(",");
|
|
|
+ }
|
|
|
+
|
|
|
+ that.setData({
|
|
|
+ rdt_arr: that.splitN(ress.data.results.rdt_arr ? ress.data.results.rdt_arr.split(',') : [], 100),
|
|
|
+ rsleep_arr_all: that.splitN(rsleep_arr_all_Temp, 100),
|
|
|
+ rgobed_time: ress.data.results.rgobed_time,
|
|
|
+ routbed_time: ress.data.results.routbed_time,
|
|
|
+ rgobed_routbed: ress.data.results.rgobed_time + '~' + ress.data.results.routbed_time,
|
|
|
+ });
|
|
|
+ chart6 = echarts.init(canvas, null, {
|
|
|
+ width: width,
|
|
|
+ height: height
|
|
|
+ });
|
|
|
+ console.log("plot in ......")
|
|
|
+ canvas.setChart(chart6);
|
|
|
+ // var list = that.getRsleep_arr(ress.data.results.rsleep_arr?ress.data.results.rsleep_arr.split(","):[])
|
|
|
+ flushChart6(that.data.rdt_arr, that.data.rsleep_arr_all, that.data.rgobed_time, that.data.routbed_time, that)
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+ console.log("that.data.rdt_arrNew1,that.data.rrh_arrNew1=" + that.data.rdt_arrNew + "," + that.data.rrh_arrNew);
|
|
|
+ console.log("");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ })
|
|
|
+ },
|
|
|
+ initOutOfBed(reportId) {//离床次数
|
|
|
+ var that = this;
|
|
|
+ wx.request({
|
|
|
+ url: `${aipushApi}` + '/getsn',
|
|
|
+ data: {
|
|
|
+ "hotelcode": that.data.hotelcode ? that.data.hotelcode : "club",
|
|
|
+ "roomcode": that.data.roomcode ? that.data.roomcode : "nuange",
|
|
|
+ "token": token_push
|
|
|
+ },
|
|
|
+ method: 'POST',
|
|
|
+ success(res) {
|
|
|
+ try {
|
|
|
+ if (res && res.data && res.data[0]) {
|
|
|
+ that.setData({
|
|
|
+ roomname: res.data[0].rn
|
|
|
+ });
|
|
|
+ wx.request({
|
|
|
+ url: `${aipushApi}` + '/getsingle',
|
|
|
+ data: {
|
|
|
+ "sn": that.data.rsn ? that.data.rsn : res.data[0].sn,
|
|
|
+ "token": token_push,
|
|
|
+ "rpids": reportId || that.data.reportId
|
|
|
+ },
|
|
|
+ method: 'POST',
|
|
|
+ success(ress) {
|
|
|
+ if (ress && ress.data) {
|
|
|
+ // console.log('ress.data-getsingle='+JSON.stringify(ress.data.results));
|
|
|
+ try {
|
|
|
+ var routbed_arr_Temp = [];
|
|
|
+ if (ress.data.results.routbed_arr) {
|
|
|
+ routbed_arr_Temp = ress.data.results.routbed_arr.split(",");
|
|
|
+ }
|
|
|
+
|
|
|
+ that.setData({
|
|
|
+ // rdt_arr: that.splitN(ress.data.results.rdt_arr?ress.data.results.rdt_arr.split(','):[],100),
|
|
|
+ // routbed_arr: that.splitN(routbed_arr_Temp,100),
|
|
|
+ rdt_arr: ress.data.results.rdt_arr ? ress.data.results.rdt_arr.split(',') : [],
|
|
|
+ routbed_arr: routbed_arr_Temp,
|
|
|
+ rgobed_time: ress.data.results.rgobed_time,
|
|
|
+ routbed_time: ress.data.results.routbed_time,
|
|
|
+ rgobed_routbed: ress.data.results.rgobed_time + '~' + ress.data.results.routbed_time,
|
|
|
+ });
|
|
|
+ updateOutOfBed(that.data.rdt_arr, that.data.routbed_arr, that.data.rgobed_time, that.data.routbed_time, that)
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+ console.log("that.data.routbed_arr=" + that.data.routbed_arr);
|
|
|
+ console.log("");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ })
|
|
|
},
|
|
|
- tvEntityIdChange: function(e) {
|
|
|
- this.telScreeProjection();
|
|
|
+ initBodyMovements(reportId) {//体动次数
|
|
|
+ var that = this;
|
|
|
+ wx.request({
|
|
|
+ url: `${aipushApi}` + '/getsn',
|
|
|
+ data: {
|
|
|
+ "hotelcode": that.data.hotelcode ? that.data.hotelcode : "club",
|
|
|
+ "roomcode": that.data.roomcode ? that.data.roomcode : "nuange",
|
|
|
+ "token": token_push
|
|
|
+ },
|
|
|
+ method: 'POST',
|
|
|
+ success(res) {
|
|
|
+ try {
|
|
|
+ if (res && res.data && res.data[0]) {
|
|
|
+ that.setData({
|
|
|
+ roomname: res.data[0].rn
|
|
|
+ });
|
|
|
+ wx.request({
|
|
|
+ url: `${aipushApi}` + '/getsingle',
|
|
|
+ data: {
|
|
|
+ "sn": that.data.rsn ? that.data.rsn : res.data[0].sn,
|
|
|
+ "token": token_push,
|
|
|
+ "rpids": reportId || that.data.reportId
|
|
|
+ },
|
|
|
+ method: 'POST',
|
|
|
+ success(ress) {
|
|
|
+ if (ress && ress.data) {
|
|
|
+ // console.log('ress.data-getsingle='+JSON.stringify(ress.data.results));
|
|
|
+ try {
|
|
|
+ var rmove_arr_Temp = [];
|
|
|
+ if (ress.data.results.rmove_arr) {
|
|
|
+ rmove_arr_Temp = ress.data.results.rmove_arr.split(",");
|
|
|
+ }
|
|
|
+
|
|
|
+ that.setData({
|
|
|
+ rdt_arr: that.splitN(ress.data.results.rdt_arr ? ress.data.results.rdt_arr.split(',') : [], 100),
|
|
|
+ rmove_arr: that.splitN(rmove_arr_Temp, 100),
|
|
|
+ rgobed_time: ress.data.results.rgobed_time,
|
|
|
+ routbed_time: ress.data.results.routbed_time,
|
|
|
+ rgobed_routbed: ress.data.results.rgobed_time + '~' + ress.data.results.routbed_time,
|
|
|
+ });
|
|
|
+ updateBodyMovements(that.data.rdt_arr, that.data.rmove_arr, that.data.rgobed_time, that.data.routbed_time, that)
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+ console.log("c8_that.data.rmove_arr=" + that.data.rmove_arr);
|
|
|
+ console.log("");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ })
|
|
|
},
|
|
|
- onPickerChange: function(e) {
|
|
|
- var that = this;
|
|
|
- var selectedOption = this.data.sns[e.detail.value];
|
|
|
- this.setData({
|
|
|
- selectedIndex: e.detail.value,
|
|
|
- selectedValue: selectedOption.pos,
|
|
|
- rsn: selectedOption.sn,
|
|
|
- });
|
|
|
- console.log("e.detail.value="+e.detail.value);
|
|
|
- console.log("selectedOption="+JSON.stringify(selectedOption));
|
|
|
- this.getData(selectedOption.sn,this.data.hotelcode,this.data.roomcode,null);
|
|
|
-
|
|
|
- //-----
|
|
|
-
|
|
|
- //-----
|
|
|
-
|
|
|
- this.selectComponent('#mychart-dom-bar00').init((canvas, width, height) => {
|
|
|
- that.initChart00(canvas, width, height,null)
|
|
|
- });
|
|
|
- this.selectComponent('#mychart-dom-bar7').init((canvas, width, height) => {
|
|
|
- that.initChart7(canvas, width, height,null)
|
|
|
- });
|
|
|
- this.selectComponent('#mychart-dom-bar8').init((canvas, width, height) => {
|
|
|
- that.initChart8(canvas, width, height,null)
|
|
|
- });
|
|
|
- this.selectComponent('#mychart-dom-bar1').init((canvas, width, height) => {
|
|
|
- that.initChart1(canvas, width, height,null)
|
|
|
- });
|
|
|
- this.selectComponent('#mychart-dom-bar81').init((canvas, width, height) => {
|
|
|
- that.initChart81(canvas, width, height,null)
|
|
|
- });
|
|
|
- this.selectComponent('#mychart-dom-bar9').init((canvas, width, height) => {
|
|
|
- that.initChart9(canvas, width, height,null)
|
|
|
- });
|
|
|
- this.selectComponent('#mychart-dom-bar10').init((canvas, width, height) => {
|
|
|
- that.initChart10(canvas, width, height,null)
|
|
|
- });
|
|
|
- this.selectComponent('#mychart-dom-bar11').init((canvas, width, height) => {
|
|
|
- that.initChart11(canvas, width, height,null)
|
|
|
- });
|
|
|
- },
|
|
|
- onPickerDateTimeChange: function(reportId) {
|
|
|
- var that = this;
|
|
|
- // var selectedOption = this.data.sns[e.detail.value];
|
|
|
- // this.setData({
|
|
|
- // selectedIndex: e.detail.value,
|
|
|
- // selectedValue: selectedOption.pos,
|
|
|
- // rsn: selectedOption.sn,
|
|
|
- // });
|
|
|
- // console.log("e.detail.value="+e.detail.value);
|
|
|
- // console.log("selectedOption="+JSON.stringify(selectedOption));
|
|
|
- this.getData(that.data.sn,this.data.hotelcode,this.data.roomcode,reportId);
|
|
|
- this.selectComponent('#mychart-dom-bar00').init((canvas, width, height) => {
|
|
|
- that.initChart00(canvas, width, height,reportId)
|
|
|
- });
|
|
|
- this.selectComponent('#mychart-dom-bar7').init((canvas, width, height) => {
|
|
|
- that.initChart7(canvas, width, height,reportId)
|
|
|
- });
|
|
|
- this.selectComponent('#mychart-dom-bar8').init((canvas, width, height) => {
|
|
|
- that.initChart8(canvas, width, height,reportId)
|
|
|
- });
|
|
|
- this.selectComponent('#mychart-dom-bar1').init((canvas, width, height) => {
|
|
|
- that.initChart1(canvas, width, height,reportId)
|
|
|
- });
|
|
|
- this.selectComponent('#mychart-dom-bar81').init((canvas, width, height) => {
|
|
|
- that.initChart81(canvas, width, height,reportId)
|
|
|
- });
|
|
|
- this.selectComponent('#mychart-dom-bar9').init((canvas, width, height) => {
|
|
|
- that.initChart9(canvas, width, height,reportId)
|
|
|
- });
|
|
|
- this.selectComponent('#mychart-dom-bar10').init((canvas, width, height) => {
|
|
|
- that.initChart10(canvas, width, height,reportId)
|
|
|
- });
|
|
|
- this.selectComponent('#mychart-dom-bar11').init((canvas, width, height) => {
|
|
|
- that.initChart11(canvas, width, height,reportId)
|
|
|
- });
|
|
|
- },
|
|
|
- onButtonTap: function() {
|
|
|
- // 切换按钮的样式类
|
|
|
- this.setData({
|
|
|
- isButtonPressed: !this.data.isButtonPressed
|
|
|
- });
|
|
|
- },
|
|
|
- dayClick(event) { //日历点击选择日期
|
|
|
- var that = this;
|
|
|
- var clickDate = String(event.detail.year) + addZero(event.detail.month) + addZero(event.detail.day)
|
|
|
- // that.getTargetData(clickDate)
|
|
|
- console.log("change date", that.data.target_sleep_list)
|
|
|
- flushChart(that.data.target_sleep_list)
|
|
|
-
|
|
|
- that.setData({
|
|
|
- nowDate: [{
|
|
|
- month: 'current',
|
|
|
- day: event.detail.day,
|
|
|
- color: 'white',
|
|
|
- background: '#82d5f8'
|
|
|
- }, {
|
|
|
- month: 'current',
|
|
|
- day: new Date().getDate(),
|
|
|
- color: '#ffd700',
|
|
|
- background: 'white'
|
|
|
- }],
|
|
|
- clickDate: clickDate,
|
|
|
- ec: {
|
|
|
- onInit: that.construct_sleep_plot
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
-
|
|
|
- getTargetData(date) {
|
|
|
- var that = this;
|
|
|
- var sleep_data = wx.getStorageSync("sleep_data")
|
|
|
- console.log("find date is", date)
|
|
|
- if (sleep_data || that.data.moke_data){
|
|
|
- if (date == "20240414" || date == "20240415"){
|
|
|
- var parse_sleep_data = that.data.moke_data[date]
|
|
|
- }else{
|
|
|
- var parse_sleep_data = JSON.parse(sleep_data)[date]
|
|
|
- }
|
|
|
- var sleep_cnt = 0
|
|
|
- if (parse_sleep_data){
|
|
|
- sleep_cnt = parse_sleep_data.length;
|
|
|
- }
|
|
|
- var sleep_time = 0.0;
|
|
|
- var sleep_desc = "";
|
|
|
- var sleep_tj_map = {
|
|
|
- '早醒': 0,
|
|
|
- '疲惫': 0,
|
|
|
- '多梦': 0,
|
|
|
- '很好': 0
|
|
|
- };
|
|
|
- var slepp_sugg = "";
|
|
|
- var target_sleep_list = [];
|
|
|
- for (var i in parse_sleep_data){
|
|
|
- var fix_sleep_tm = (parse_sleep_data[i].sleepAllTime / 60).toFixed(1);
|
|
|
- sleep_time += parseFloat(fix_sleep_tm);
|
|
|
- sleep_tj_map[parse_sleep_data[i].sleepFeedback] += 1
|
|
|
- target_sleep_list.push(parseFloat(fix_sleep_tm))
|
|
|
- }
|
|
|
-
|
|
|
- for(var j in sleep_tj_map){
|
|
|
- if (sleep_tj_map[j] > 0){
|
|
|
- sleep_desc += j + String(sleep_tj_map[j]) + " 次."
|
|
|
- }
|
|
|
- }
|
|
|
- switch (sleep_cnt) {
|
|
|
- case 5:
|
|
|
- slepp_sugg = "继续保持睡前良好状态";
|
|
|
- break;
|
|
|
- case 1:
|
|
|
- slepp_sugg = "学会释放工作压力";
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- slepp_sugg = "睡前一小时不要进行有氧运动";
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- slepp_sugg = "睡前尽量不要摄入高热量餐饮";
|
|
|
- break;
|
|
|
- case 0:
|
|
|
- slepp_sugg = "还未产生睡眠报告";
|
|
|
- break;
|
|
|
- case 4:
|
|
|
- slepp_sugg = "做一些助眠工作";
|
|
|
- break;
|
|
|
- }
|
|
|
- that.setData({
|
|
|
- data_dispaly: true,
|
|
|
- sleep_cnt: sleep_cnt,
|
|
|
- sleep_time: sleep_time.toFixed(1),
|
|
|
- sleep_desc: sleep_desc,
|
|
|
- slepp_sugg: slepp_sugg,
|
|
|
- target_sleep_list: target_sleep_list,
|
|
|
- ec0: {onInit: target_sleep_list},
|
|
|
- ec: {onInit: target_sleep_list},
|
|
|
- ec1: {onInit: target_sleep_list},
|
|
|
- ec2: {onInit: target_sleep_list},
|
|
|
- ec3: {onInit: target_sleep_list},
|
|
|
- ec4: {onInit: target_sleep_list},
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
-initChart000(canvas, width, height){
|
|
|
- var that = this;
|
|
|
- chart000 = echarts.init(canvas, null, {
|
|
|
- width: width,
|
|
|
- height: height
|
|
|
- });
|
|
|
- console.log("plot in ......")
|
|
|
- canvas.setChart(chart000);
|
|
|
- flushChart000();
|
|
|
- },
|
|
|
-
|
|
|
-initChart00(canvas, width, height,reportId){
|
|
|
+ initChartRespiratory(reportId) {//平均呼吸率
|
|
|
var that = this;
|
|
|
wx.request({
|
|
|
- url: `${aipushApi}`+'/getsn',
|
|
|
- data: {
|
|
|
- // "hotelcode":that.data.hotelcode?that.data.hotelcode:"club",
|
|
|
- // "roomcode":that.data.hotelcode?that.data.roomcode:"nuange",
|
|
|
- "hotelcode":that.data.hotelcode?that.data.hotelcode:"club",
|
|
|
- "roomcode":that.data.roomcode?that.data.roomcode:"nuange",
|
|
|
- "token":token_push},
|
|
|
- method: 'POST',
|
|
|
- success(res) {
|
|
|
- try {
|
|
|
- if(res && res.data && res.data[0]){
|
|
|
- that.setData({
|
|
|
- roomname: res.data[0].rn
|
|
|
- });
|
|
|
- console.log("res.data=sn="+JSON.stringify(res.data));
|
|
|
+ url: `${aipushApi}` + '/getsn',
|
|
|
+ data: {
|
|
|
+ "hotelcode": that.data.hotelcode ? that.data.hotelcode : "club",
|
|
|
+ "roomcode": that.data.roomcode ? that.data.roomcode : "nuange",
|
|
|
+ "token": token_push
|
|
|
+ },
|
|
|
+ method: 'POST',
|
|
|
+ success(res) {
|
|
|
+ try {
|
|
|
+ if (res && res.data && res.data[0]) {
|
|
|
+ that.setData({
|
|
|
+ roomname: res.data[0].rn
|
|
|
+ });
|
|
|
wx.request({
|
|
|
- url: `${aipushApi}`+'/getsingle',
|
|
|
- data: {
|
|
|
- "sn":that.data.rsn?that.data.rsn:res.data[0].sn,
|
|
|
- "rpids":reportId,
|
|
|
- "token":token_push},
|
|
|
- method: 'POST',
|
|
|
- success(ress) {
|
|
|
- if(ress && ress.data){
|
|
|
- // console.log('ress.data-getsingle='+JSON.stringify(ress.data.results));
|
|
|
- try {
|
|
|
- let rscore_descTemp = [];
|
|
|
- if(ress.data.results.rscore_desc){
|
|
|
- rscore_descTemp = ress.data.results.rscore_desc;
|
|
|
+ url: `${aipushApi}` + '/getsingle',
|
|
|
+ data: {
|
|
|
+ "sn": that.data.rsn ? that.data.rsn : res.data[0].sn,
|
|
|
+ "token": token_push,
|
|
|
+ "rpids": reportId
|
|
|
+ },
|
|
|
+ method: 'POST',
|
|
|
+ success(ress) {
|
|
|
+ if (ress && ress.data) {
|
|
|
+ // console.log('ress.data-getsingle='+JSON.stringify(ress.data.results));
|
|
|
+ try {
|
|
|
+ var rhx_arr_Temp = [];
|
|
|
+ if (ress.data.results.rhx_arr) {
|
|
|
+ rhx_arr_Temp = ress.data.results.rhx_arr.split(",");
|
|
|
+ }
|
|
|
+
|
|
|
+ that.setData({
|
|
|
+ rdt_arr: that.splitN(ress.data.results.rdt_arr ? ress.data.results.rdt_arr.split(',') : [], 100),
|
|
|
+ rhx_arr: that.splitN(rhx_arr_Temp, 100),
|
|
|
+ rgobed_time: ress.data.results.rgobed_time,
|
|
|
+ routbed_time: ress.data.results.routbed_time,
|
|
|
+ rgobed_routbed: ress.data.results.rgobed_time + '~' + ress.data.results.routbed_time,
|
|
|
+ });
|
|
|
+ updateRespiratory(that.data.rdt_arr, that.data.rhx_arr, that.data.rgobed_time, that.data.routbed_time, that)
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
}
|
|
|
- let rscore_valueTemp = [];
|
|
|
- if(ress.data.results.rscore_value){
|
|
|
- rscore_valueTemp = ress.data.results.rscore_value;
|
|
|
+ console.log("c81_that.data.ravg_hx_value=" + that.data.ravg_hx_value);
|
|
|
+ console.log("");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ })
|
|
|
+ },
|
|
|
+ initChartSnoring(reportId) {//打鼾
|
|
|
+ var that = this;
|
|
|
+ wx.request({
|
|
|
+ url: `${aipushApi}` + '/getsn',
|
|
|
+ data: {
|
|
|
+ "hotelcode": that.data.hotelcode ? that.data.hotelcode : "club",
|
|
|
+ "roomcode": that.data.roomcode ? that.data.roomcode : "nuange",
|
|
|
+ "token": token_push
|
|
|
+ },
|
|
|
+ method: 'POST',
|
|
|
+ success(res) {
|
|
|
+ try {
|
|
|
+ if (res && res.data && res.data[0]) {
|
|
|
+ that.setData({
|
|
|
+ roomname: res.data[0].rn
|
|
|
+ });
|
|
|
+ wx.request({
|
|
|
+ url: `${aipushApi}` + '/getsingle',
|
|
|
+ data: {
|
|
|
+ "sn": that.data.rsn ? that.data.rsn : res.data[0].sn,
|
|
|
+ "token": token_push,
|
|
|
+ "rpids": reportId
|
|
|
+ },
|
|
|
+ method: 'POST',
|
|
|
+ success(ress) {
|
|
|
+ if (ress && ress.data) {
|
|
|
+ // console.log('ress.data-getsingle='+JSON.stringify(ress.data.results));
|
|
|
+ try {
|
|
|
+ var rsnoring_arr_Temp = [];
|
|
|
+ if (ress.data.results.rsnoring_arr) {
|
|
|
+ rsnoring_arr_Temp = ress.data.results.rsnoring_arr.split(",");
|
|
|
+ }
|
|
|
+
|
|
|
+ that.setData({
|
|
|
+ rdt_arr: that.splitN(ress.data.results.rdt_arr ? ress.data.results.rdt_arr.split(',') : [], 100),
|
|
|
+ rsnoring_arr: that.splitN(rsnoring_arr_Temp, 100),
|
|
|
+ rgobed_time: ress.data.results.rgobed_time,
|
|
|
+ routbed_time: ress.data.results.routbed_time,
|
|
|
+ rgobed_routbed: ress.data.results.rgobed_time + '~' + ress.data.results.routbed_time,
|
|
|
+ });
|
|
|
+ updateSnoring(that.data.rdt_arr, that.data.rsnoring_arr, that.data.rgobed_time, that.data.routbed_time, that)
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
}
|
|
|
- that.setData({
|
|
|
- rscore_desc:rscore_descTemp,
|
|
|
- rscore_value:rscore_valueTemp,
|
|
|
- });
|
|
|
- chart00 = echarts.init(canvas, null, {
|
|
|
- width: width,
|
|
|
- height: height
|
|
|
- });
|
|
|
- console.log("plot in ......")
|
|
|
- canvas.setChart(chart00);
|
|
|
- flushChart00(rscore_descTemp,rscore_valueTemp,that);
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
+ console.log("c8_that.data.rmove_arr=" + that.data.rmove_arr);
|
|
|
+ console.log("");
|
|
|
}
|
|
|
- // console.log("that.data.rdt_arrNew1,that.data.rrh_arrNew1="+that.data.rdt_arrNew+","+that.data.rrh_arrNew);
|
|
|
- // console.log("");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- });
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ })
|
|
|
+ },
|
|
|
+ initChartApnea(reportId) {//呼吸暂停
|
|
|
+ var that = this;
|
|
|
+ wx.request({
|
|
|
+ url: `${aipushApi}` + '/getsn',
|
|
|
+ data: {
|
|
|
+ "hotelcode": that.data.hotelcode ? that.data.hotelcode : "club",
|
|
|
+ "roomcode": that.data.roomcode ? that.data.roomcode : "nuange",
|
|
|
+ "token": token_push
|
|
|
+ },
|
|
|
+ method: 'POST',
|
|
|
+ success(res) {
|
|
|
+ try {
|
|
|
+ if (res && res.data && res.data[0]) {
|
|
|
+ that.setData({
|
|
|
+ roomname: res.data[0].rn
|
|
|
+ });
|
|
|
+ wx.request({
|
|
|
+ url: `${aipushApi}` + '/getsingle',
|
|
|
+ data: {
|
|
|
+ "sn": that.data.rsn ? that.data.rsn : res.data[0].sn,
|
|
|
+ "token": token_push,
|
|
|
+ "rpids": reportId
|
|
|
+ },
|
|
|
+ method: 'POST',
|
|
|
+ success(ress) {
|
|
|
+ if (ress && ress.data) {
|
|
|
+ // console.log('ress.data-getsingle='+JSON.stringify(ress.data.results));
|
|
|
+ try {
|
|
|
+ var rhxstop_arr_Temp = [];
|
|
|
+ if (ress.data.results.rhxstop_arr) {
|
|
|
+ rhxstop_arr_Temp = ress.data.results.rhxstop_arr.split(",");
|
|
|
+ }
|
|
|
+
|
|
|
+ that.setData({
|
|
|
+ rdt_arr: that.splitN(ress.data.results.rdt_arr ? ress.data.results.rdt_arr.split(',') : [], 100),
|
|
|
+ rhxstop_arr: that.splitN(rhxstop_arr_Temp, 100),
|
|
|
+ rgobed_time: ress.data.results.rgobed_time,
|
|
|
+ routbed_time: ress.data.results.routbed_time,
|
|
|
+ rgobed_routbed: ress.data.results.rgobed_time + '~' + ress.data.results.routbed_time,
|
|
|
+ });
|
|
|
+ updateApnea(that.data.rdt_arr, that.data.rhxstop_arr, that.data.rgobed_time, that.data.routbed_time, that)
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+ console.log("c8_that.data.rhxstop_arr=" + that.data.rhxstop_arr);
|
|
|
+ console.log("");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
}
|
|
|
-
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getRsleep_arr(list) {
|
|
|
+ if (list) {
|
|
|
+ console.log("getRsleep_arr_list1==" + JSON.stringify(list));
|
|
|
+ for (let i = 0; i < list.length; i++) {
|
|
|
+ if (list[i] == '0') {
|
|
|
+ list[i] = '清醒';
|
|
|
+ } else if (list[i] == '10') {
|
|
|
+ list[i] = '浅睡';
|
|
|
+ } else if (list[i] == '20') {
|
|
|
+ list[i] = '中睡';
|
|
|
+ } else if (list[i] == '30') {
|
|
|
+ list[i] = '深睡';
|
|
|
+ } else {
|
|
|
+ list[i] = '其他';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log("getRsleep_arr_list2==" + JSON.stringify(list));
|
|
|
+ },
|
|
|
+ getFrequency(list) {//获取
|
|
|
+ if (list) {
|
|
|
+ console.log("getRsleep_arr_list1==" + JSON.stringify(list));
|
|
|
+ for (let i = 0; i < list.length; i++) {
|
|
|
+ if (list[i] == '0') {
|
|
|
+ list[i] = '清醒';
|
|
|
+ } else if (list[i] == '10') {
|
|
|
+ list[i] = '浅睡';
|
|
|
+ } else if (list[i] == '20') {
|
|
|
+ list[i] = '中睡';
|
|
|
+ } else if (list[i] == '30') {
|
|
|
+ list[i] = '深睡';
|
|
|
+ } else {
|
|
|
+ list[i] = '其他';
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- },
|
|
|
+ }
|
|
|
+ console.log("getRsleep_arr_list2==" + JSON.stringify(list));
|
|
|
+ },
|
|
|
+ initChart12(canvas, width, height) {//体动次数
|
|
|
+ var that = this;
|
|
|
+ wx.request({
|
|
|
+ url: `${aipushApi}` + '/getsn',
|
|
|
+ data: {
|
|
|
+ "hotelcode": that.data.hotelcode ? that.data.hotelcode : "club",
|
|
|
+ "roomcode": that.data.roomcode ? that.data.roomcode : "nuange",
|
|
|
+ "token": token_push
|
|
|
+ },
|
|
|
+ method: 'POST',
|
|
|
+ success(res) {
|
|
|
+ try {
|
|
|
+ if (res && res.data && res.data[0]) {
|
|
|
+ that.setData({
|
|
|
+ roomname: res.data[0].rn
|
|
|
+ });
|
|
|
+ wx.request({
|
|
|
+ url: `${aipushApi}` + '/getsingle',
|
|
|
+ data: {
|
|
|
+ "sn": res.data[0].sn,
|
|
|
+ "token": token_push
|
|
|
+ },
|
|
|
+ method: 'POST',
|
|
|
+ success(ress) {
|
|
|
+ if (ress && ress.data) {
|
|
|
+ // console.log('ress.data-getsingle='+JSON.stringify(ress.data.results));
|
|
|
+ try {
|
|
|
+ var rsnoring_arr_Temp = [];
|
|
|
+ if (ress.data.results.rsnoring_arr) {
|
|
|
+ rsnoring_arr_Temp = ress.data.results.rsnoring_arr.split(",");
|
|
|
+ }
|
|
|
+
|
|
|
+ that.setData({
|
|
|
+ rdt_arr: that.splitN(ress.data.results.rdt_arr ? ress.data.results.rdt_arr.split(',') : [], 100),
|
|
|
+ rsnoring_arr: that.splitN(rsnoring_arr_Temp, 100),
|
|
|
+ rgobed_time: ress.data.results.rgobed_time,
|
|
|
+ routbed_time: ress.data.results.routbed_time,
|
|
|
+ rgobed_routbed: ress.data.results.rgobed_time + '~' + ress.data.results.routbed_time,
|
|
|
+ });
|
|
|
+ chart9 = echarts.init(canvas, null, {
|
|
|
+ width: width,
|
|
|
+ height: height
|
|
|
+ });
|
|
|
+ console.log("plot in ......")
|
|
|
+ canvas.setChart(chart9);
|
|
|
+ // var list = that.getRsleep_arr(ress.data.results.rsleep_arr?ress.data.results.rsleep_arr.split(","):[])
|
|
|
+ flushChart9(that.data.rdt_arr, that.data.rsnoring_arr, that.data.rgobed_time, that.data.routbed_time, that)
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+ console.log("c8_that.data.rmove_arr=" + that.data.rmove_arr);
|
|
|
+ console.log("");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
})
|
|
|
- },
|
|
|
- initChart0(canvas, width, height){
|
|
|
+ },
|
|
|
+ sleepStateChange(data) {
|
|
|
+ console.log("change-data==" + data)
|
|
|
+ switch (data) {
|
|
|
+ case 0:
|
|
|
+ return '清醒';
|
|
|
+ case 10:
|
|
|
+ return '浅睡';
|
|
|
+ case 20:
|
|
|
+ return '中睡';
|
|
|
+ case 30:
|
|
|
+ return '深睡';
|
|
|
+ default:
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ sleepRoutbed_arrChange(data) {
|
|
|
+ console.log("change-data==" + data)
|
|
|
+ switch (data) {
|
|
|
+ case 0:
|
|
|
+ return '离床';
|
|
|
+ case 1:
|
|
|
+ return '在床';
|
|
|
+ default:
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ sleepRmove_arrChange(data) {
|
|
|
+ console.log("change-data==" + data)
|
|
|
+ switch (data) {
|
|
|
+ case 0:
|
|
|
+ return '否';
|
|
|
+ case 1:
|
|
|
+ return '体动';
|
|
|
+ default:
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ sleepRsnoring_arrChange(data) {
|
|
|
+ console.log("change-data==" + data)
|
|
|
+ switch (data) {
|
|
|
+ case 0:
|
|
|
+ return '否';
|
|
|
+ case 1:
|
|
|
+ return '打鼾';
|
|
|
+ default:
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ sleepRhxstop_arrChange(data) {
|
|
|
+ console.log("change-data==" + data)
|
|
|
+ switch (data) {
|
|
|
+ case 0:
|
|
|
+ return '否';
|
|
|
+ case 1:
|
|
|
+ return '停止';
|
|
|
+ default:
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ splitN(originalArray, n) {
|
|
|
+ if (!originalArray) return [];
|
|
|
+ // 计算每份的大小
|
|
|
+ let chunkSize = Math.ceil(originalArray.length / n);
|
|
|
+
|
|
|
+ // 分割数组并获取每份的最后一个元素
|
|
|
+ let lastElements = [];
|
|
|
+ for (let i = 0; i < originalArray.length; i += chunkSize) {
|
|
|
+ let chunk = originalArray.slice(i, i + chunkSize);
|
|
|
+ lastElements.push(chunk[chunk.length - 1]);
|
|
|
+ }
|
|
|
+ // 输出每份的最后一个元素
|
|
|
+ console.log('lastElements=' + lastElements);
|
|
|
+ return lastElements;
|
|
|
+ },
|
|
|
+ takePortionDateData(rdt_arrArray, originalArray, n) {
|
|
|
+ if (!rdt_arrArray || !originalArray) return [];
|
|
|
+ var portionDateData = [];
|
|
|
+ var portionData = [];
|
|
|
+ for (let i = 0; i < originalArray.length; i++) {
|
|
|
+ if (originalArray[i] == n) {
|
|
|
+ portionDateData.push(rdt_arrArray[i]);
|
|
|
+ portionData.push(originalArray[i]);
|
|
|
+ } else {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log('portionDateData=' + JSON.stringify(portionDateData));
|
|
|
+ return portionDateData;
|
|
|
+ },
|
|
|
+ takePortionData(originalArray, n) {
|
|
|
+ if (!originalArray) return [];
|
|
|
+ var portionData = [];
|
|
|
+ for (let i = 0; i < originalArray.length; i++) {
|
|
|
+ if (originalArray[i] == n) {
|
|
|
+ portionData.push(originalArray[i])
|
|
|
+ } else {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log('portionData=' + JSON.stringify(portionData));
|
|
|
+ return portionData;
|
|
|
+ },
|
|
|
+ getFrequency(list, o) {//获取次数
|
|
|
+ if (!list) return 0;
|
|
|
+ let frequency = 0;
|
|
|
+ for (let i = 0; i < list.length; i++) {
|
|
|
+ if (list[i] == o) frequency++;
|
|
|
+ }
|
|
|
+ console.log('frequency=' + frequency);
|
|
|
+ return frequency;
|
|
|
+ },
|
|
|
+ getTimeDiffInHours: function (startTimeStr, endTimeStr) {
|
|
|
+ // 假设两个时间都是同一天的,这里我们使用当前日期作为基准
|
|
|
+ if (!startTimeStr || !endTimeStr) return null;
|
|
|
+ const now = new Date();
|
|
|
+ const startDate = new Date(now.getFullYear(), now.getMonth(), now.getDate(), ...startTimeStr.split(':').map(Number));
|
|
|
+ const endDate = new Date(now.getFullYear(), now.getMonth(), now.getDate(), ...endTimeStr.split(':').map(Number));
|
|
|
+
|
|
|
+ // 处理跨天的情况
|
|
|
+ if (endDate < startDate) {
|
|
|
+ endDate.setDate(endDate.getDate() + 1); // 将结束时间设置为第二天的同一时间
|
|
|
+ }
|
|
|
+
|
|
|
+ // 计算时间差(毫秒)
|
|
|
+ const diffInMs = endDate - startDate;
|
|
|
+
|
|
|
+ // 转换为小时
|
|
|
+ const diffInHours = diffInMs / (1000 * 60 * 60);
|
|
|
+
|
|
|
+ return diffInHours;
|
|
|
+ },
|
|
|
+ drawProgressCircle: function () {
|
|
|
+ const ctx = wx.createCanvasContext('progressCircleCanvas');
|
|
|
+ // 假设屏幕的宽度为 windowWidth px
|
|
|
+ const windowWidth = wx.getSystemInfoSync().windowWidth;
|
|
|
+
|
|
|
+ // 假设你有一个以 rpx 为单位的值
|
|
|
+ const valueInRpx = 300;
|
|
|
+
|
|
|
+ // 计算对应的 px 值
|
|
|
+ const valueInPx = (valueInRpx / 750) * windowWidth;
|
|
|
+
|
|
|
+ const radius = 60; // 圆的半径
|
|
|
+ const centerX = valueInPx; // 圆心的x坐标
|
|
|
+ const centerY = valueInPx / 2; // 圆心的y坐标
|
|
|
+ const strokeWidth = 10; // 进度条的宽度
|
|
|
+ const percentage = this.data.percentage; // 进度百分比
|
|
|
+
|
|
|
+ // 绘制外圆
|
|
|
+ ctx.beginPath();
|
|
|
+ ctx.arc(centerX, centerY, radius, 0, 2 * Math.PI);
|
|
|
+ ctx.setStrokeStyle('#46ff81'); // 外圆颜色
|
|
|
+ ctx.setLineWidth(strokeWidth * 2); // 外圆线宽
|
|
|
+ ctx.stroke();
|
|
|
+
|
|
|
+ // 绘制内圆(进度条背景)
|
|
|
+ ctx.beginPath();
|
|
|
+ ctx.arc(centerX, centerY, radius - strokeWidth, 0, 2 * Math.PI);
|
|
|
+ ctx.setStrokeStyle('#e0e0e0'); // 内圆颜色
|
|
|
+ ctx.setLineWidth(strokeWidth); // 内圆线宽
|
|
|
+ ctx.stroke();
|
|
|
+
|
|
|
+ // 绘制进度条
|
|
|
+ ctx.beginPath();
|
|
|
+ ctx.arc(centerX, centerY, radius - strokeWidth, -0.5 * Math.PI, -0.5 * Math.PI + 2 * Math.PI * (percentage / 100));
|
|
|
+ ctx.setStrokeStyle('#007aff'); // 进度条颜色
|
|
|
+ ctx.setLineWidth(strokeWidth);
|
|
|
+ ctx.setLineCap('round'); // 设置线条端点的样式为圆形
|
|
|
+ ctx.stroke();
|
|
|
+
|
|
|
+ // 绘制中心圆点
|
|
|
+ ctx.beginPath();
|
|
|
+ ctx.arc(centerX, centerY, 5, 0, 2 * Math.PI);
|
|
|
+ ctx.setFillStyle('#ffffff');
|
|
|
+ ctx.fill();
|
|
|
+
|
|
|
+ // 绘制完成,将内容渲染到canvas中
|
|
|
+ ctx.draw();
|
|
|
+ },
|
|
|
+ // 假设你有一个方法来更新进度条的值
|
|
|
+ updateProgress: function (newPercentage) {
|
|
|
+ this.setData({
|
|
|
+ percentage: newPercentage
|
|
|
+ });
|
|
|
+ this.drawProgressCircle(); // 重新绘制进度条
|
|
|
+ },
|
|
|
+
|
|
|
+ buttonClicked: function () {
|
|
|
+ var that = this;
|
|
|
+ // 切换按钮的点击状态
|
|
|
+ this.setData({
|
|
|
+ isButtonClicked: !that.data.isButtonClicked,
|
|
|
+ });
|
|
|
+
|
|
|
+ // 在这里可以添加其他点击后的逻辑,比如调用接口等
|
|
|
+ },
|
|
|
+
|
|
|
+ telScreeProjection: function (tvEntityId) {
|
|
|
var that = this;
|
|
|
- chart0 = echarts.init(canvas, null, {
|
|
|
- width: width,
|
|
|
- height: height
|
|
|
+ that.setData({
|
|
|
+ isLoading: true,
|
|
|
+ });
|
|
|
+ wx.request({
|
|
|
+ url: `${aipushApi}` + '/getbigreport',
|
|
|
+ method: 'POST',
|
|
|
+ header: {
|
|
|
+ 'content-type': 'application/json', // 默认值
|
|
|
+ 'Authorization': 'Bearer ' + token // 在头部设置认证信息,例如使用Bearer Token
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ "sn": that.data.rsn, "tokens": token_push
|
|
|
+ },
|
|
|
+ success(ress) {
|
|
|
+ console.log('wx.getStorageSync(tvEntityId)=' + wx.getStorageSync('tvEntityId'));
|
|
|
+ console.log('tvEntityId=' + JSON.stringify(tvEntityId));
|
|
|
+ let tvEntityIdss = tvEntityId ? tvEntityId : wx.getStorageSync('tvEntityId')
|
|
|
+ if (ress && ress.data && tvEntityIdss) {
|
|
|
+ console.log("ress.data==" + JSON.stringify(ress.data.url));
|
|
|
+ console.log("tvEntityIdss==" + tvEntityIdss);
|
|
|
+ wx.request({
|
|
|
+ // url: `${homeApi_http}`+':'+`${homeApi_http_port}`+'/api/services/media_player/play_media', //http
|
|
|
+ // url: `${homeApi_https}`+'/api/services/media_player/play_media', //https
|
|
|
+ url: `${homeApi_https}` + '/api/services/media_player/select_source', //https
|
|
|
+ method: 'POST',
|
|
|
+ header: {
|
|
|
+ 'content-type': 'application/json', // 默认值
|
|
|
+ 'Authorization': 'Bearer ' + token // 在头部设置认证信息,例如使用Bearer Token
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ "entity_id": tvEntityIdss,
|
|
|
+ // "media_content_id": ress.data.url,
|
|
|
+ // "media_content_id": 'https://alifei01.cfp.cn/creative/vcg/800/new/VCG41175510742.jpg',
|
|
|
+ // "media_content_id": 'https://alifei01.cfp.cn/creative/vcg/veer/1600water/veer-368621010.jpg',
|
|
|
+ // "media_content_type": "image/jpeg/png",
|
|
|
+ "source": "X浏览器"
|
|
|
+ },
|
|
|
+ success(res) {
|
|
|
+ that.setData({
|
|
|
+ isLoading: false,
|
|
|
+ });
|
|
|
+ if (res && res.data) {
|
|
|
+ var resData = res.data
|
|
|
+ console.log('res-推送=' + JSON.stringify(res));
|
|
|
+ console.log('res.data-推送=' + JSON.stringify(resData));
|
|
|
+ wx.showToast({
|
|
|
+ title: "推送成功",
|
|
|
+ icon: "success",
|
|
|
+ mask: true,
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ wx.showToast({
|
|
|
+ title: '推送失败',
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: function (error) {
|
|
|
+ // 请求失败后的回调函数
|
|
|
+ console.error('推送失败', error);
|
|
|
+ // 在这里处理请求失败的情况,比如显示错误信息给用户
|
|
|
+ that.setData({
|
|
|
+ isLoading: false,
|
|
|
+ });
|
|
|
+ wx.showToast({
|
|
|
+ title: '推送失败',
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ that.setData({
|
|
|
+ isLoading: false,
|
|
|
+ });
|
|
|
+ wx.showToast({
|
|
|
+ title: '找不到电视,推送失败',
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
});
|
|
|
- console.log("plot in ......")
|
|
|
- canvas.setChart(chart0);
|
|
|
- var percentage = parseFloat(that.data.percentage)
|
|
|
- var unPercentage = 100-percentage;
|
|
|
- var percentages = []
|
|
|
- var obj = {};
|
|
|
- obj.name = '已完成';
|
|
|
- obj.value = percentage;
|
|
|
- percentages.push(obj);
|
|
|
- obj = {};
|
|
|
- obj.name = '未完成';
|
|
|
- obj.value = unPercentage;
|
|
|
- percentages.push(obj);
|
|
|
- console.log("that.data.rdt_arrNew,that.data.rrh_arrNew="+that.data.rdt_arrNew+","+that.data.rrh_arrNew);
|
|
|
- flushChart0(percentages);
|
|
|
- },
|
|
|
-
|
|
|
- initChart(canvas, width, height){
|
|
|
- var that = this;
|
|
|
- chart = echarts.init(canvas, null, {
|
|
|
- width: width,
|
|
|
- height: height
|
|
|
- });
|
|
|
- console.log("plot in ......")
|
|
|
- canvas.setChart(chart);
|
|
|
- flushChart(that.data.target_sleep_list)
|
|
|
- },
|
|
|
-
|
|
|
- initChart1(canvas, width, height,reportId){
|
|
|
+ },
|
|
|
+ getData(sn, hotelcode, roomcode, reportId) {
|
|
|
var that = this;
|
|
|
wx.request({
|
|
|
- url: `${aipushApi}`+'/getsn',
|
|
|
- data: {
|
|
|
- // "hotelcode":that.data.hotelcode?that.data.hotelcode:"club",
|
|
|
- // "roomcode":that.data.hotelcode?that.data.roomcode:"nuange",
|
|
|
- "hotelcode":that.data.hotelcode?that.data.hotelcode:"club",
|
|
|
- "roomcode":that.data.roomcode?that.data.roomcode:"nuange",
|
|
|
- "token":token_push},
|
|
|
- method: 'POST',
|
|
|
- success(res) {
|
|
|
- try {
|
|
|
- if(res && res.data && res.data[0]){
|
|
|
- that.setData({
|
|
|
- roomname: res.data[0].rn
|
|
|
- });
|
|
|
- console.log("res.data=sn="+JSON.stringify(res.data));
|
|
|
+ url: `${aipushApi}` + '/getsn',
|
|
|
+ data: {
|
|
|
+ "hotelcode": hotelcode ? hotelcode : "club",
|
|
|
+ "roomcode": roomcode ? roomcode : "nuange",
|
|
|
+ "token": token_push
|
|
|
+ },
|
|
|
+ method: 'POST',
|
|
|
+ success(res) {
|
|
|
+
|
|
|
+ try {
|
|
|
+ // that.setData({
|
|
|
+ // airText: now.category, //空气质量
|
|
|
+ // airValue: now.aqi //空气指数
|
|
|
+ // })
|
|
|
+ if (res && res.data && res.data[0]) {
|
|
|
+ that.setData({
|
|
|
+ roomname: res.data[0].rn
|
|
|
+ });
|
|
|
+ console.log("res.data-sn=" + JSON.stringify(res.data));
|
|
|
wx.request({
|
|
|
- url: `${aipushApi}`+'/getsingle',
|
|
|
- data: {
|
|
|
- "sn":that.data.rsn?that.data.rsn:res.data[0].sn,
|
|
|
- "token":token_push,
|
|
|
- "rpids":reportId},
|
|
|
- method: 'POST',
|
|
|
- success(ress) {
|
|
|
- if(ress && ress.data){
|
|
|
- // console.log('ress.data-getsingle='+JSON.stringify(ress.data.results));
|
|
|
+ url: `${aipushApi}` + '/getsingle',
|
|
|
+ data: {
|
|
|
+ "sn": sn ? sn : res.data[0].sn,
|
|
|
+ "token": token_push,
|
|
|
+ "rpids": reportId
|
|
|
+ },
|
|
|
+ method: 'POST',
|
|
|
+ success(ress) {
|
|
|
try {
|
|
|
- let rdt_arrTemp = [];
|
|
|
- if(ress.data.results.rrh_arr){
|
|
|
- rdt_arrTemp = that.splitN(ress.data.results.rdt_arr.split(","),100);
|
|
|
- }
|
|
|
- if(ress.data.results.rdate){
|
|
|
- that.setData({
|
|
|
- reportDate: ress.data.results.rdate
|
|
|
- });
|
|
|
- }
|
|
|
- let rrh_arrTemp = [];
|
|
|
- if(ress.data.results.rrh_arr){
|
|
|
- rrh_arrTemp = that.splitN(ress.data.results.rrh_arr.split(","),100);
|
|
|
- }
|
|
|
- that.setData({
|
|
|
- rdt_arrNew:rdt_arrTemp,
|
|
|
- rrh_arrNew:rrh_arrTemp,
|
|
|
- });
|
|
|
- chart1 = echarts.init(canvas, null, {
|
|
|
- width: width,
|
|
|
- height: height
|
|
|
- });
|
|
|
- // console.log("plot in ......")
|
|
|
- canvas.setChart(chart1);
|
|
|
- console.log("that.data.rdt_arrNew,that.data.rrh_arrNew="+that.data.rdt_arrNew+","+that.data.rrh_arrNew);
|
|
|
- flushChart1(that.data.rdt_arrNew,that.data.rrh_arrNew);
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
- }
|
|
|
- // console.log("that.data.rdt_arrNew1,that.data.rrh_arrNew1="+that.data.rdt_arrNew+","+that.data.rrh_arrNew);
|
|
|
- // console.log("");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
- }
|
|
|
-
|
|
|
- },
|
|
|
- })
|
|
|
- },
|
|
|
- initChart2(canvas, width, height){
|
|
|
- var that = this;
|
|
|
- wx.request({
|
|
|
- url: `${aipushApi}`+'/getsn',
|
|
|
- data: {"hotelcode":that.data.hotelcode?that.data.hotelcode:"club",
|
|
|
- "roomcode":that.data.roomcode?that.data.roomcode:"nuange",
|
|
|
- "token":token_push},
|
|
|
- method: 'POST',
|
|
|
- success(res) {
|
|
|
- try {
|
|
|
- if(res && res.data && res.data[0]){
|
|
|
- that.setData({
|
|
|
- roomname: res.data[0].rn
|
|
|
- });
|
|
|
- wx.request({
|
|
|
- url: `${aipushApi}`+'/getsingle',
|
|
|
- data: {"sn":res.data[0].sn,
|
|
|
- "token":token_push},
|
|
|
- method: 'POST',
|
|
|
- success(ress) {
|
|
|
- if(ress&&ress.data){
|
|
|
- // console.log('ress.data-getsingle='+JSON.stringify(ress.data.results));
|
|
|
- try {
|
|
|
+ if (ress && ress.data) {
|
|
|
+ console.log('ress.data-getsingle=' + JSON.stringify(ress.data.results));
|
|
|
+ // that.setData({
|
|
|
+ // airText: now.category, //空气质量
|
|
|
+ // airValue: now.aqi //空气指数
|
|
|
+ // })
|
|
|
+ // rdt_arr = ress.data.results.rdt_arr //睡眠时间轴数据集合
|
|
|
+ // rrh_arr = ress.data.results.rdt_arr//睡眠心率数据集合
|
|
|
+ // rhx_arr = ress.data.results.rhx_arr//睡眠呼吸数据集合
|
|
|
+ // rsnoring_arr = ress.data.results.rsnoring_arr//睡眠打鼾数据集合,0-否,1-打鼾状态
|
|
|
+ // routbed_arr = ress.data.results.routbed_arr//离床状态数据集合,0-离床,1-在床
|
|
|
+ // rmove_arr = ress.data.results.rmove_arr//体动状态数据集合,0-否,1-体动状态
|
|
|
+ // rhxstop_arr = ress.data.results.rhxstop_arr//呼吸停止状态数据集合
|
|
|
+ // rsleep_arr = ress.data.results.rsleep_arr//睡眠状态数据集合,0-清醒,10-浅睡,20-中睡,30-深睡
|
|
|
+
|
|
|
+ // rdeep_duration = ress.data.results.rdeep_duration//深睡时长,单位分钟
|
|
|
+ // rlight_duration = ress.data.results.rlight_duration//浅睡时长,单位分钟
|
|
|
+ // rin_duration = ress.data.results.rin_duration//中睡时长,单位分钟
|
|
|
+ // rawake_duration = ress.data.results.rawake_duration//清醒时长,单位分钟
|
|
|
+ // ravg_hx_value = ress.data.results.ravg_hx_value//呼吸平均值
|
|
|
+ // ravg_hx_desc = ress.data.results.ravg_hx_desc//呼吸平均值评分描述
|
|
|
+ // ravg_rh_value = ress.data.results.ravg_rh_value//心率平均值
|
|
|
+ // ravg_rh_desc = ress.data.results.ravg_rh_desc//心率平均值评分描述
|
|
|
+ // rscore_value = ress.data.results.rscore_value//睡眠报告得分值
|
|
|
+ // rscore_desc = ress.data.results.rscore_desc//睡眠报告得分评比描述
|
|
|
+
|
|
|
+
|
|
|
+ // that.setData({
|
|
|
+ // rdt_arr: ress.data.results.rdt_arr?ress.data.results.rdt_arr.split(','):[],
|
|
|
+ // rrh_arr: ress.data.results.rrh_arr?ress.data.results.rrh_arr.split(','):[],
|
|
|
+ // rhx_arr: ress.data.results.rhx_arr?ress.data.results.rhx_arr.split(','):[],
|
|
|
+ // rsnoring_arr: ress.data.results.rsnoring_arr?ress.data.results.rsnoring_arr.split(','):[],
|
|
|
+ // routbed_arr: ress.data.results.routbed_arr?ress.data.results.routbed_arr.split(','):[],
|
|
|
+ // rmove_arr: ress.data.results.rmove_arr?ress.data.results.rmove_arr.split(','):[],
|
|
|
+ // rhxstop_arr: ress.data.results.rhxstop_arr?ress.data.results.rhxstop_arr.split(','):[],
|
|
|
+ // rsleep_arr: ress.data.results.rsleep_arr?ress.data.results.rsleep_arr.split(','):[],
|
|
|
+
|
|
|
+ // rdeep_duration: ress.data.results.rdeep_duration,
|
|
|
+ // rlight_duration: ress.data.results.rlight_duration,
|
|
|
+ // rin_duration: ress.data.results.rin_duration,
|
|
|
+ // rawake_duration: ress.data.results.rawake_duration,
|
|
|
+ // ravg_hx_value: ress.data.results.ravg_hx_value,
|
|
|
+ // ravg_hx_desc: ress.data.results.ravg_hx_desc,
|
|
|
+ // ravg_rh_value: ress.data.results.ravg_rh_value,
|
|
|
+ // ravg_rh_desc: ress.data.results.ravg_rh_desc,
|
|
|
+ // rscore_value: ress.data.results.rscore_value,
|
|
|
+ // rscore_desc: ress.data.results.rscore_desc,
|
|
|
+
|
|
|
+ // rsn: ress.data.results.rsn,
|
|
|
+ // rdate: ress.data.results.rdate,
|
|
|
+ // rtotal_duration: ress.data.results.rtotal_duration,//睡眠总时长,单位分钟
|
|
|
+ // rinbed_duration: ress.data.results.rinbed_duration,//在床时长,单位分钟
|
|
|
+ // rgobed_time: ress.data.results.rgobed_time,//上床时间
|
|
|
+ // routbed_time: ress.data.results.routbed_time,//离床时间
|
|
|
+ // routbed_count_value: ress.data.results.routbed_count_value,//离床次数
|
|
|
+ // rsn: ress.data.results.rsn,
|
|
|
+
|
|
|
+ // });
|
|
|
+
|
|
|
let durationDataTemp = [];
|
|
|
let obj = {};
|
|
|
obj.name = '深睡';
|
|
|
obj.value = ress.data.results.rdeep_duration;
|
|
|
durationDataTemp.push(obj);
|
|
|
obj = {};
|
|
|
- obj.name = '中睡';
|
|
|
- obj.value = ress.data.results.rin_duration;
|
|
|
- durationDataTemp.push(obj);
|
|
|
- obj = {};
|
|
|
obj.name = '浅睡';
|
|
|
obj.value = ress.data.results.rlight_duration;
|
|
|
durationDataTemp.push(obj);
|
|
|
obj = {};
|
|
|
+ obj.name = '中睡';
|
|
|
+ obj.value = ress.data.results.rin_duration;
|
|
|
+ durationDataTemp.push(obj);
|
|
|
+ obj = {};
|
|
|
obj.name = '清醒';
|
|
|
obj.value = ress.data.results.rawake_duration;
|
|
|
durationDataTemp.push(obj);
|
|
|
- console.log("durationDataTemp="+JSON.stringify(durationDataTemp));
|
|
|
- that.setData({
|
|
|
- durationData:durationDataTemp,
|
|
|
- });
|
|
|
- chart2 = echarts.init(canvas, null, {
|
|
|
- width: width,
|
|
|
- height: height
|
|
|
- });
|
|
|
- // console.log("plot in ......")
|
|
|
- canvas.setChart(chart2);
|
|
|
- flushChart2(that.data.durationData)
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
- }
|
|
|
- // console.log("that.data.rdt_arrNew1,that.data.rrh_arrNew1="+that.data.rdt_arrNew+","+that.data.rrh_arrNew);
|
|
|
- // console.log("");
|
|
|
- }
|
|
|
- },
|
|
|
- });
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
- }
|
|
|
-
|
|
|
- },
|
|
|
- })
|
|
|
- },
|
|
|
- initChart3(canvas, width, height){
|
|
|
- var that = this;
|
|
|
- wx.request({
|
|
|
- url: `${aipushApi}`+'/getsn',
|
|
|
- data: {"hotelcode":that.data.hotelcode?that.data.hotelcode:"club",
|
|
|
- "roomcode":that.data.roomcode?that.data.roomcode:"nuange",
|
|
|
- "token":token_push},
|
|
|
- method: 'POST',
|
|
|
- success(res) {
|
|
|
- try {
|
|
|
- if(res && res.data && res.data[0]){
|
|
|
- that.setData({
|
|
|
- roomname: res.data[0].rn
|
|
|
- });
|
|
|
- wx.request({
|
|
|
- url: `${aipushApi}`+'/getsingle',
|
|
|
- data: {"sn":res.data[0].sn,
|
|
|
- "token":token_push},
|
|
|
- method: 'POST',
|
|
|
- success(ress) {
|
|
|
- if(ress && ress.data){
|
|
|
- // console.log('ress.data-getsingle='+JSON.stringify(ress.data.results));
|
|
|
- try {
|
|
|
- let rdt_arrTemp = [];
|
|
|
- if(ress.data.results.rrh_arr){
|
|
|
- rdt_arrTemp = that.splitN(ress.data.results.rdt_arr.split(","),100);
|
|
|
- }
|
|
|
- let rhx_arrTemp = [];
|
|
|
- if(ress.data.results.rhx_arr){
|
|
|
- rhx_arrTemp = that.splitN(ress.data.results.rhx_arr.split(","),100);
|
|
|
- }
|
|
|
- that.setData({
|
|
|
- rdt_arrNew:rdt_arrTemp,
|
|
|
- rhx_arrNew:rhx_arrTemp,
|
|
|
- });
|
|
|
- chart3 = echarts.init(canvas, null, {
|
|
|
- width: width,
|
|
|
- height: height
|
|
|
- });
|
|
|
- console.log("plot in ......")
|
|
|
- canvas.setChart(chart3);
|
|
|
- flushChart3(that.data.rdt_arrNew,that.data.rhx_arrNew)
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
+ console.log("durationDataTemp=" + JSON.stringify(durationDataTemp));
|
|
|
+
|
|
|
+ let sleep_durationCount = 0;
|
|
|
+ if (ress.data.results.rdeep_duration) {
|
|
|
+ sleep_durationCount += parseFloat(ress.data.results.rdeep_duration)
|
|
|
}
|
|
|
- // console.log("that.data.rdt_arrNew1,that.data.rrh_arrNew1="+that.data.rdt_arrNew+","+that.data.rrh_arrNew);
|
|
|
- // console.log("");
|
|
|
- }
|
|
|
- },
|
|
|
- });
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
- }
|
|
|
-
|
|
|
- },
|
|
|
- })
|
|
|
- },
|
|
|
- initChart11(canvas, width, height,reportId){
|
|
|
- var that = this;
|
|
|
- wx.request({
|
|
|
- url: `${aipushApi}`+'/getsn',
|
|
|
- data: {"hotelcode":that.data.hotelcode?that.data.hotelcode:"club",
|
|
|
- "roomcode":that.data.roomcode?that.data.roomcode:"nuange",
|
|
|
- "token":token_push},
|
|
|
- method: 'POST',
|
|
|
- success(res) {
|
|
|
- try {
|
|
|
- if(res && res.data && res.data[0]){
|
|
|
- that.setData({
|
|
|
- roomname: res.data[0].rn
|
|
|
- });
|
|
|
- wx.request({
|
|
|
- url: `${aipushApi}`+'/getsingle',
|
|
|
- data: {"sn":that.data.rsn?that.data.rsn:res.data[0].sn,
|
|
|
- "token":token_push,
|
|
|
- "rpids":reportId},
|
|
|
- method: 'POST',
|
|
|
- success(ress) {
|
|
|
- if(ress && ress.data){
|
|
|
- // console.log('ress.data-getsingle='+JSON.stringify(ress.data.results));
|
|
|
- try {
|
|
|
- let rdt_arrTemp = [];
|
|
|
- if(ress.data.results.rrh_arr){
|
|
|
- rdt_arrTemp = that.splitN(ress.data.results.rdt_arr.split(","),100);
|
|
|
- }
|
|
|
- let rsleep_arr_Temp = [];
|
|
|
- if(ress.data.results.rsleep_arr){
|
|
|
- rsleep_arr_Temp = that.splitN(ress.data.results.rsleep_arr.split(","),100);
|
|
|
- }
|
|
|
- that.setData({
|
|
|
- rdt_arrNew:rdt_arrTemp,
|
|
|
- rsleep_arr:rsleep_arr_Temp,
|
|
|
- rdeep_durationFormat: that.convertTimeToHoursAndMinutes(ress.data.results.rdeep_duration,1),
|
|
|
- rlight_durationFormat: that.convertTimeToHoursAndMinutes(ress.data.results.rlight_duration,1),
|
|
|
- rin_durationFormat: that.convertTimeToHoursAndMinutes(ress.data.results.rin_duration,1),
|
|
|
- rawake_durationFormat: that.convertTimeToHoursAndMinutes(ress.data.results.rawake_duration,1),
|
|
|
- });
|
|
|
-
|
|
|
- console.log('ress.data.results.rdeep_duration='+ress.data.results.rdeep_duration);
|
|
|
- console.log('ress.data.results.rlight_duration='+ress.data.results.rlight_duration);
|
|
|
- console.log('ress.data.results.rin_duration='+ress.data.results.rin_duration);
|
|
|
- console.log('ress.data.results.rawake_duration='+ress.data.results.rawake_duration);
|
|
|
-
|
|
|
- chart11 = echarts.init(canvas, null, {
|
|
|
- width: width,
|
|
|
- height: height
|
|
|
- });
|
|
|
- console.log("plot in ......")
|
|
|
- canvas.setChart(chart11);
|
|
|
- flushChart11(that.data.rdt_arrNew,that.data.rsleep_arr,that)
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
- }
|
|
|
- console.log("that.data.rsleep_arr="+that.data.rsleep_arr);
|
|
|
- console.log("");
|
|
|
- }
|
|
|
- },
|
|
|
- });
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
- }
|
|
|
-
|
|
|
- },
|
|
|
- })
|
|
|
- },
|
|
|
- initChart4(canvas, width, height){
|
|
|
- var that = this;
|
|
|
- wx.request({
|
|
|
- url: `${aipushApi}`+'/getsn',
|
|
|
- data: {"hotelcode":that.data.hotelcode?that.data.hotelcode:"club",
|
|
|
- "roomcode":that.data.roomcode?that.data.roomcode:"nuange",
|
|
|
- "token":token_push},
|
|
|
- method: 'POST',
|
|
|
- success(res) {
|
|
|
- try {
|
|
|
- if(res && res.data && res.data[0]){
|
|
|
- that.setData({
|
|
|
- roomname: res.data[0].rn
|
|
|
- });
|
|
|
- wx.request({
|
|
|
- url: `${aipushApi}`+'/getsingle',
|
|
|
- data: {"sn":res.data[0].sn,
|
|
|
- "token":token_push},
|
|
|
- method: 'POST',
|
|
|
- success(ress) {
|
|
|
- if(ress && ress.data){
|
|
|
- // console.log('ress.data-getsingle='+JSON.stringify(ress.data.results));
|
|
|
- try {
|
|
|
- let sleep_durationCount = 0;
|
|
|
- if(ress.data.results.rdeep_duration){
|
|
|
- sleep_durationCount += parseFloat(ress.data.results.rdeep_duration)
|
|
|
- }
|
|
|
- if(ress.data.results.rlight_duration){
|
|
|
- sleep_durationCount += parseFloat(ress.data.results.rlight_duration)
|
|
|
- }
|
|
|
- if(ress.data.results.rin_duration){
|
|
|
- sleep_durationCount += parseFloat(ress.data.results.rin_duration)
|
|
|
- }
|
|
|
- let sleep_durationTemp = [];
|
|
|
- // let data1 = [];
|
|
|
- let obj1 = {};
|
|
|
- obj1.name = '睡眠时间';
|
|
|
- obj1.value = Math.ceil(sleep_durationCount / 60);
|
|
|
- sleep_durationTemp.push(obj1);
|
|
|
- // data1.push(obj1);
|
|
|
- // let data2 = [];
|
|
|
- obj1 = {};
|
|
|
- obj1.name = '清醒时间';
|
|
|
- obj1.value = Math.ceil(parseFloat(ress.data.results.rawake_duration) / 60);
|
|
|
- sleep_durationTemp.push(obj1);
|
|
|
- // data2.push(obj1);
|
|
|
- that.setData({
|
|
|
- sleep_duration:sleep_durationTemp,
|
|
|
- });
|
|
|
- chart4 = echarts.init(canvas, null, {
|
|
|
- width: width,
|
|
|
- height: height
|
|
|
- });
|
|
|
- console.log("plot in ......")
|
|
|
- canvas.setChart(chart4);
|
|
|
- // console.log("that.data.sleep_duration="+JSON.stringify(that.data.sleep_duration))
|
|
|
- flushChart4(that.data.sleep_duration)
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
- }
|
|
|
- console.log("");
|
|
|
- }
|
|
|
- },
|
|
|
- });
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
- }
|
|
|
-
|
|
|
- },
|
|
|
- })
|
|
|
- },
|
|
|
- initChart5(canvas, width, height){
|
|
|
- var that = this;
|
|
|
- wx.request({
|
|
|
- url: `${aipushApi}`+'/getsn',
|
|
|
- data: {"hotelcode":that.data.hotelcode?that.data.hotelcode:"club",
|
|
|
- "roomcode":that.data.roomcode?that.data.roomcode:"nuange",
|
|
|
- "token":token_push},
|
|
|
- method: 'POST',
|
|
|
- success(res) {
|
|
|
- if(res && res.data && res.data[0]){
|
|
|
- that.setData({
|
|
|
- roomname: res.data[0].rn
|
|
|
- });
|
|
|
- try {
|
|
|
- wx.request({
|
|
|
- url: `${aipushApi}`+'/getsingle',
|
|
|
- data: {"sn":res.data[0].sn,
|
|
|
- "token":token_push},
|
|
|
- method: 'POST',
|
|
|
- success(ress) {
|
|
|
- if(ress && ress.data){
|
|
|
- // console.log('ress.data-getsingle='+JSON.stringify(ress.data.results));
|
|
|
- try {
|
|
|
- let rdt_arrTemp = [];
|
|
|
- if(ress.data.results.rrh_arr){
|
|
|
- rdt_arrTemp = that.splitN(ress.data.results.rdt_arr.split(","),100);
|
|
|
- }
|
|
|
- let rsleep_arrTemp = [];
|
|
|
- if(ress.data.results.rsleep_arr){
|
|
|
- rsleep_arrTemp = that.splitN(ress.data.results.rsleep_arr.split(","),100);
|
|
|
- }
|
|
|
- that.setData({
|
|
|
- rdt_arrNew:rdt_arrTemp,
|
|
|
- rsleep_arrNew:rsleep_arrTemp,
|
|
|
-
|
|
|
- });
|
|
|
- chart5 = echarts.init(canvas, null, {
|
|
|
- width: width,
|
|
|
- height: height
|
|
|
- });
|
|
|
- console.log("plot in ......")
|
|
|
- canvas.setChart(chart5);
|
|
|
- flushChart5(that.data.rdt_arrNew,that.data.rsleep_arrNew,that)
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
+ if (ress.data.results.rlight_duration) {
|
|
|
+ sleep_durationCount += parseFloat(ress.data.results.rlight_duration)
|
|
|
}
|
|
|
- console.log("that.data.rdt_arrNew1,that.data.rrh_arrNew1="+that.data.rdt_arrNew+","+that.data.rrh_arrNew);
|
|
|
- console.log("");
|
|
|
- }
|
|
|
- },
|
|
|
- });
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- })
|
|
|
- },
|
|
|
- initChart6(canvas, width, height){
|
|
|
- var that = this;
|
|
|
- wx.request({
|
|
|
- url: `${aipushApi}`+'/getsn',
|
|
|
- data: {"hotelcode":that.data.hotelcode?that.data.hotelcode:"club",
|
|
|
- "roomcode":that.data.roomcode?that.data.roomcode:"nuange",
|
|
|
- "token":token_push},
|
|
|
- method: 'POST',
|
|
|
- success(res) {
|
|
|
- try {
|
|
|
- if(res && res.data && res.data[0]){
|
|
|
- that.setData({
|
|
|
- roomname: res.data[0].rn
|
|
|
- });
|
|
|
- wx.request({
|
|
|
- url: `${aipushApi}`+'/getsingle',
|
|
|
- data: {"sn":res.data[0].sn,
|
|
|
- "token":token_push},
|
|
|
- method: 'POST',
|
|
|
- success(ress) {
|
|
|
- if(ress && ress.data){
|
|
|
- // console.log('ress.data-getsingle='+JSON.stringify(ress.data.results));
|
|
|
- try {
|
|
|
- var rsleep_arr_all_Temp = [];
|
|
|
- if(ress.data.results.rsleep_arr){
|
|
|
- rsleep_arr_all_Temp = ress.data.results.rsleep_arr.split(",");
|
|
|
- }
|
|
|
-
|
|
|
- that.setData({
|
|
|
- rdt_arr: that.splitN(ress.data.results.rdt_arr?ress.data.results.rdt_arr.split(','):[],100),
|
|
|
- rsleep_arr_all: that.splitN(rsleep_arr_all_Temp,100),
|
|
|
- rgobed_time: ress.data.results.rgobed_time,
|
|
|
- routbed_time: ress.data.results.routbed_time,
|
|
|
+ if (ress.data.results.rin_duration) {
|
|
|
+ sleep_durationCount += parseFloat(ress.data.results.rin_duration)
|
|
|
+ }
|
|
|
+
|
|
|
+ let sleep_efficiency_temp = ress.data.results.rtotal_duration ? (Math.ceil((sleep_durationCount / ress.data.results.rtotal_duration) * 100) + '%') : '%'
|
|
|
+
|
|
|
+ let rdeep_duration_efficiency_temp = ress.data.results.rtotal_duration ? (Math.ceil(((ress.data.results.rdeep_duration ? parseFloat(ress.data.results.rdeep_duration) : 0) / ress.data.results.rtotal_duration) * 100) + '%') : '%'
|
|
|
+ let rlight_duration_efficiency_temp = ress.data.results.rtotal_duration ? (Math.ceil(((ress.data.results.rlight_duration ? parseFloat(ress.data.results.rlight_duration) : 0) / ress.data.results.rtotal_duration) * 100) + '%') : '%'
|
|
|
+ let rin_duration_efficiency_temp = ress.data.results.rtotal_duration ? (Math.ceil(((ress.data.results.rin_duration ? parseFloat(ress.data.results.rin_duration) : 0) / ress.data.results.rtotal_duration) * 100) + '%') : '%'
|
|
|
+
|
|
|
+
|
|
|
+ let sleep_durationTemp = [];
|
|
|
+ let obj1 = {};
|
|
|
+ obj1.name = '睡眠时间';
|
|
|
+ obj1.value = Math.ceil(sleep_durationCount / 60);
|
|
|
+ sleep_durationTemp.push(obj1);
|
|
|
+ obj1 = {};
|
|
|
+ obj1.name = '清醒时间';
|
|
|
+ obj1.value = Math.ceil(parseFloat(ress.data.results.rawake_duration) / 60);
|
|
|
+ sleep_durationTemp.push(obj1);
|
|
|
+
|
|
|
+ let zdPointTemp = [];
|
|
|
+ let rdt_arrTemp = [];
|
|
|
+
|
|
|
+ let rrh_arrTemp = [];
|
|
|
+
|
|
|
+ let rhx_arrTemp = [];
|
|
|
+
|
|
|
+
|
|
|
+ let rmove_arrTemp = [];
|
|
|
+
|
|
|
+ let rsleep_arrTemp = [];
|
|
|
+
|
|
|
+ let rsleep_arr_all_Temp = [];
|
|
|
+
|
|
|
+ if (ress.data.results.rrh_arr) {
|
|
|
+ rdt_arrTemp = that.splitN(ress.data.results.rdt_arr.split(","), 100);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ress.data.results.rrh_arr) {
|
|
|
+ rrh_arrTemp = that.splitN(ress.data.results.rrh_arr.split(","), 100);
|
|
|
+ }
|
|
|
+ if (ress.data.results.rhx_arr) {
|
|
|
+ rhx_arrTemp = that.splitN(ress.data.results.rhx_arr.split(","), 100);
|
|
|
+ }
|
|
|
+ if (ress.data.results.rmove_arr) {
|
|
|
+ rmove_arrTemp = that.splitN(ress.data.results.rmove_arr.split(","), 100);
|
|
|
+ }
|
|
|
+ if (ress.data.results.rsleep_arr) {
|
|
|
+ rsleep_arrTemp = that.splitN(ress.data.results.rsleep_arr.split(","), 100);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ress.data.results.rsleep_arr) {
|
|
|
+ rsleep_arr_all_Temp = ress.data.results.rsleep_arr.split(",");
|
|
|
+ }
|
|
|
+
|
|
|
+ console.log("rdt_arrTemp=" + JSON.stringify(rdt_arrTemp));
|
|
|
+ console.log("rrh_arrTemp=" + JSON.stringify(rrh_arrTemp));
|
|
|
+ console.log("rhx_arrTemp=" + JSON.stringify(rhx_arrTemp));
|
|
|
+ console.log("rmove_arrTemp=" + JSON.stringify(rmove_arrTemp));
|
|
|
+ console.log("rsleep_arrTemp=" + JSON.stringify(rsleep_arrTemp));
|
|
|
+ console.log("rsleep_arr_all_Temp=" + JSON.stringify(rsleep_arr_all_Temp));
|
|
|
+ console.log("sleep_durationTemp=" + JSON.stringify(sleep_durationTemp));
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ that.setData({
|
|
|
+
|
|
|
+ rdt_arr: ress.data.results.rdt_arr ? ress.data.results.rdt_arr.split(',') : [],
|
|
|
+ rrh_arr: ress.data.results.rrh_arr ? ress.data.results.rrh_arr.split(',') : [],
|
|
|
+ rhx_arr: ress.data.results.rhx_arr ? ress.data.results.rhx_arr.split(',') : [],
|
|
|
+ rsnoring_arr: ress.data.results.rsnoring_arr ? ress.data.results.rsnoring_arr.split(',') : [],
|
|
|
+ routbed_arr: ress.data.results.routbed_arr ? ress.data.results.routbed_arr.split(',') : [],
|
|
|
+ rmove_arr: ress.data.results.rmove_arr ? ress.data.results.rmove_arr.split(',') : [],
|
|
|
+ rhxstop_arr: ress.data.results.rhxstop_arr ? ress.data.results.rhxstop_arr.split(',') : [],
|
|
|
+ rsleep_arr: ress.data.results.rsleep_arr ? ress.data.results.rsleep_arr.split(',') : [],
|
|
|
+
|
|
|
+ rsnoring_arrFrequency: that.getFrequency(ress.data.results.rsnoring_arr ? ress.data.results.rsnoring_arr.split(',') : [], 1),
|
|
|
+ routbed_arrFrequency: that.getFrequency(ress.data.results.routbed_arr ? ress.data.results.routbed_arr.split(',') : [], 0),
|
|
|
+ rmove_arrFrequency: that.getFrequency(ress.data.results.rmove_arr ? ress.data.results.rmove_arr.split(',') : [], 1),
|
|
|
+ rhxstop_arrFrequency: that.getFrequency(ress.data.results.rhxstop_arr ? ress.data.results.rhxstop_arr.split(',') : [], 1),
|
|
|
+
|
|
|
+ rdeep_durationFormatA: that.convertTimeToHoursAndMinutes(ress.data.results.rdeep_duration),
|
|
|
+ rlight_duration: ress.data.results.rlight_duration,
|
|
|
+ rin_duration: ress.data.results.rin_duration,
|
|
|
+ rawake_duration: ress.data.results.rawake_duration,
|
|
|
+ ravg_hx_value: ress.data.results.ravg_hx_value,
|
|
|
+ ravg_hx_desc: ress.data.results.ravg_hx_desc,
|
|
|
+ ravg_rh_value: ress.data.results.ravg_rh_value,
|
|
|
+ ravg_rh_desc: ress.data.results.ravg_rh_desc,
|
|
|
+ rscore_value: ress.data.results.rscore_value,
|
|
|
+ rscore_desc: ress.data.results.rscore_desc,
|
|
|
+
|
|
|
+ rsn: ress.data.results.rsn,
|
|
|
+ rdate: ress.data.results.rdate,
|
|
|
+ rtotal_duration: that.convertTimeToHoursAndMinutes(ress.data.results.rtotal_duration),//睡眠总时长,单位小时分钟
|
|
|
+ rinbed_duration: that.convertTimeToHoursAndMinutes(ress.data.results.rinbed_duration),//在床时长,单位小时分钟
|
|
|
+ rgobed_time: ress.data.results.rgobed_time,//上床时间
|
|
|
+ routbed_time: ress.data.results.routbed_time,//离床时间
|
|
|
rgobed_routbed: ress.data.results.rgobed_time + '~' + ress.data.results.routbed_time,
|
|
|
- });
|
|
|
- chart6 = echarts.init(canvas, null, {
|
|
|
- width: width,
|
|
|
- height: height
|
|
|
+ sleepHourSub: that.getTimeDiffInHours(ress.data.results.rgobed_time, ress.data.results.routbed_time),
|
|
|
+ routbed_count_value: ress.data.results.routbed_count_value,//离床次数
|
|
|
+ rsn: ress.data.results.rsn,
|
|
|
+ zdPointT: zdPointTemp,
|
|
|
+ rdt_arrNew: rdt_arrTemp,
|
|
|
+ rrh_arrNew: rrh_arrTemp,
|
|
|
+ rhx_arrNew: rhx_arrTemp,
|
|
|
+ rmove_arrNew: rmove_arrTemp,
|
|
|
+ rsleep_arrNew: rsleep_arrTemp,
|
|
|
+ rsleep_arr_all_New: rsleep_arr_all_Temp,
|
|
|
+ durationData: durationDataTemp,
|
|
|
+ sleep_duration: sleep_durationTemp,
|
|
|
+ sleep_efficiency: sleep_efficiency_temp,
|
|
|
+ sleep_durationCountA: that.convertTimeToHoursAndMinutes(sleep_durationCount ? sleep_durationCount.toString() : '0'),
|
|
|
+ sns: res.data,
|
|
|
+ tvEntityIds: wx.getStorageSync('tvEntityIds'),
|
|
|
+ ifOneMoreTV: (wx.getStorageSync('tvEntityIds') && wx.getStorageSync('tvEntityIds').length > 1),
|
|
|
+ hotelname: res.data[0].hn,
|
|
|
+ rdeep_duration_efficiency: rdeep_duration_efficiency_temp,
|
|
|
+ rlight_duration_efficiency: rlight_duration_efficiency_temp,
|
|
|
+ rin_duration_efficiency: rin_duration_efficiency_temp,
|
|
|
+ pushReportId: ress.data.results.rdid,
|
|
|
+
|
|
|
+ rrs_duration: that.convertTimeToHoursAndMinutes(ress.data.results.rrs_duration ? ress.data.results.rrs_duration.toString() : '0'),
|
|
|
+ routbed_count_value: ress.data.results.routbed_count_value,
|
|
|
+ rsleep_eff_value: ress.data.results.rsleep_eff_value,
|
|
|
+ });
|
|
|
+
|
|
|
+ that.getDateTimeJsonData(sn ? sn : res.data[0].sn);
|
|
|
+ // resolve(ress.data); // 请求成功,使用 resolve 返回数据
|
|
|
+ console.log('ress.data.results-' + ress.data.results)
|
|
|
+ if (!ress.data.results || ress.data.results == '') {
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '无数据',
|
|
|
+ showCancel: false
|
|
|
});
|
|
|
- console.log("plot in ......")
|
|
|
- canvas.setChart(chart6);
|
|
|
- // var list = that.getRsleep_arr(ress.data.results.rsleep_arr?ress.data.results.rsleep_arr.split(","):[])
|
|
|
- flushChart6(that.data.rdt_arr,that.data.rsleep_arr_all,that.data.rgobed_time,that.data.routbed_time,that)
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
+ return;
|
|
|
}
|
|
|
- console.log("that.data.rdt_arrNew1,that.data.rrh_arrNew1="+that.data.rdt_arrNew+","+that.data.rrh_arrNew);
|
|
|
- console.log("");
|
|
|
- }
|
|
|
- },
|
|
|
- });
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
- }
|
|
|
-
|
|
|
- },
|
|
|
- })
|
|
|
- },
|
|
|
- initChart7(canvas, width, height,reportId){//离床次数
|
|
|
- var that = this;
|
|
|
- wx.request({
|
|
|
- url: `${aipushApi}`+'/getsn',
|
|
|
- data: {"hotelcode":that.data.hotelcode?that.data.hotelcode:"club",
|
|
|
- "roomcode":that.data.roomcode?that.data.roomcode:"nuange",
|
|
|
- "token":token_push},
|
|
|
- method: 'POST',
|
|
|
- success(res) {
|
|
|
- try {
|
|
|
- if(res && res.data && res.data[0]){
|
|
|
- that.setData({
|
|
|
- roomname: res.data[0].rn
|
|
|
- });
|
|
|
- wx.request({
|
|
|
- url: `${aipushApi}`+'/getsingle',
|
|
|
- data: {"sn":that.data.rsn?that.data.rsn:res.data[0].sn,
|
|
|
- "token":token_push,
|
|
|
- "rpids":reportId},
|
|
|
- method: 'POST',
|
|
|
- success(ress) {
|
|
|
- if(ress && ress.data){
|
|
|
- // console.log('ress.data-getsingle='+JSON.stringify(ress.data.results));
|
|
|
- try {
|
|
|
- var routbed_arr_Temp = [];
|
|
|
- if(ress.data.results.routbed_arr){
|
|
|
- routbed_arr_Temp = ress.data.results.routbed_arr.split(",");
|
|
|
- }
|
|
|
-
|
|
|
- that.setData({
|
|
|
- // rdt_arr: that.splitN(ress.data.results.rdt_arr?ress.data.results.rdt_arr.split(','):[],100),
|
|
|
- // routbed_arr: that.splitN(routbed_arr_Temp,100),
|
|
|
- rdt_arr: ress.data.results.rdt_arr?ress.data.results.rdt_arr.split(','):[],
|
|
|
- routbed_arr: routbed_arr_Temp,
|
|
|
- rgobed_time: ress.data.results.rgobed_time,
|
|
|
- routbed_time: ress.data.results.routbed_time,
|
|
|
- rgobed_routbed: ress.data.results.rgobed_time + '~' + ress.data.results.routbed_time,
|
|
|
- });
|
|
|
- chart7 = echarts.init(canvas, null, {
|
|
|
- width: width,
|
|
|
- height: height
|
|
|
- });
|
|
|
- console.log("plot in ......")
|
|
|
- canvas.setChart(chart7);
|
|
|
- // var list = that.getRsleep_arr(ress.data.results.rsleep_arr?ress.data.results.rsleep_arr.split(","):[])
|
|
|
- // flushChart7(that.takePortionDateData(that.data.rdt_arr,that.data.routbed_arr,0),that.takePortionData(that.data.routbed_arr,0),that.data.routbed_time,that)
|
|
|
- flushChart7(that.data.rdt_arr,that.data.routbed_arr,that.data.routbed_time,that)
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
- }
|
|
|
- console.log("that.data.routbed_arr="+that.data.routbed_arr);
|
|
|
- console.log("");
|
|
|
- }
|
|
|
- },
|
|
|
- });
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
- }
|
|
|
-
|
|
|
- },
|
|
|
- })
|
|
|
- },
|
|
|
- initChart8(canvas, width, height,reportId){//体动次数
|
|
|
- var that = this;
|
|
|
- wx.request({
|
|
|
- url: `${aipushApi}`+'/getsn',
|
|
|
- data: {"hotelcode":that.data.hotelcode?that.data.hotelcode:"club",
|
|
|
- "roomcode":that.data.roomcode?that.data.roomcode:"nuange",
|
|
|
- "token":token_push},
|
|
|
- method: 'POST',
|
|
|
- success(res) {
|
|
|
- try {
|
|
|
- if(res && res.data && res.data[0]){
|
|
|
- that.setData({
|
|
|
- roomname: res.data[0].rn
|
|
|
- });
|
|
|
- wx.request({
|
|
|
- url: `${aipushApi}`+'/getsingle',
|
|
|
- data: {"sn":that.data.rsn?that.data.rsn:res.data[0].sn,
|
|
|
- "token":token_push,
|
|
|
- "rpids":reportId},
|
|
|
- method: 'POST',
|
|
|
- success(ress) {
|
|
|
- if(ress && ress.data){
|
|
|
- // console.log('ress.data-getsingle='+JSON.stringify(ress.data.results));
|
|
|
- try {
|
|
|
- var rmove_arr_Temp = [];
|
|
|
- if(ress.data.results.rmove_arr){
|
|
|
- rmove_arr_Temp = ress.data.results.rmove_arr.split(",");
|
|
|
- }
|
|
|
-
|
|
|
- that.setData({
|
|
|
- rdt_arr: that.splitN(ress.data.results.rdt_arr?ress.data.results.rdt_arr.split(','):[],100),
|
|
|
- rmove_arr: that.splitN(rmove_arr_Temp,100),
|
|
|
- rgobed_time: ress.data.results.rgobed_time,
|
|
|
- routbed_time: ress.data.results.routbed_time,
|
|
|
- rgobed_routbed: ress.data.results.rgobed_time + '~' + ress.data.results.routbed_time,
|
|
|
- });
|
|
|
- chart8 = echarts.init(canvas, null, {
|
|
|
- width: width,
|
|
|
- height: height
|
|
|
- });
|
|
|
- console.log("plot in ......")
|
|
|
- canvas.setChart(chart8);
|
|
|
- // var list = that.getRsleep_arr(ress.data.results.rsleep_arr?ress.data.results.rsleep_arr.split(","):[])
|
|
|
- flushChart8(that.data.rdt_arr,that.data.rmove_arr,that.data.rgobed_time,that.data.routbed_time,that)
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
- }
|
|
|
- console.log("c8_that.data.rmove_arr="+that.data.rmove_arr);
|
|
|
- console.log("");
|
|
|
- }
|
|
|
- },
|
|
|
+
|
|
|
+ } else {
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '无数据',
|
|
|
+ showCancel: false
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+ console.log("that.data.rdt_arrNew1,that.data.rrh_arrNew1=" + that.data.rdt_arrNew + "," + that.data.rrh_arrNew);
|
|
|
+ console.log("");
|
|
|
+ },
|
|
|
+ fail: function (error) {
|
|
|
+ wx.showToast({
|
|
|
+ title: "无数据",
|
|
|
+ icon: "error",
|
|
|
+ mask: true,
|
|
|
});
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
- }
|
|
|
-
|
|
|
- },
|
|
|
- })
|
|
|
- },
|
|
|
- initChart81(canvas, width, height,reportId){//平均呼吸率
|
|
|
- var that = this;
|
|
|
- wx.request({
|
|
|
- url: `${aipushApi}`+'/getsn',
|
|
|
- data: {"hotelcode":that.data.hotelcode?that.data.hotelcode:"club",
|
|
|
- "roomcode":that.data.roomcode?that.data.roomcode:"nuange",
|
|
|
- "token":token_push},
|
|
|
- method: 'POST',
|
|
|
- success(res) {
|
|
|
- try {
|
|
|
- if(res && res.data && res.data[0]){
|
|
|
- that.setData({
|
|
|
- roomname: res.data[0].rn
|
|
|
- });
|
|
|
- wx.request({
|
|
|
- url: `${aipushApi}`+'/getsingle',
|
|
|
- data: {"sn":that.data.rsn?that.data.rsn:res.data[0].sn,
|
|
|
- "token":token_push,
|
|
|
- "rpids":reportId},
|
|
|
- method: 'POST',
|
|
|
- success(ress) {
|
|
|
- if(ress && ress.data){
|
|
|
- // console.log('ress.data-getsingle='+JSON.stringify(ress.data.results));
|
|
|
- try {
|
|
|
- var rhx_arr_Temp = [];
|
|
|
- if(ress.data.results.rhx_arr){
|
|
|
- rhx_arr_Temp = ress.data.results.rhx_arr.split(",");
|
|
|
- }
|
|
|
-
|
|
|
- that.setData({
|
|
|
- rdt_arr: that.splitN(ress.data.results.rdt_arr?ress.data.results.rdt_arr.split(','):[],100),
|
|
|
- rhx_arr: that.splitN(rhx_arr_Temp,100),
|
|
|
- rgobed_time: ress.data.results.rgobed_time,
|
|
|
- routbed_time: ress.data.results.routbed_time,
|
|
|
- rgobed_routbed: ress.data.results.rgobed_time + '~' + ress.data.results.routbed_time,
|
|
|
- });
|
|
|
- chart81 = echarts.init(canvas, null, {
|
|
|
- width: width,
|
|
|
- height: height
|
|
|
- });
|
|
|
- console.log("plot in ......")
|
|
|
- canvas.setChart(chart81);
|
|
|
- // var list = that.getRsleep_arr(ress.data.results.rsleep_arr?ress.data.results.rsleep_arr.split(","):[])
|
|
|
- flushChart81(that.data.rdt_arr,that.data.rhx_arr,that.data.rgobed_time,that.data.routbed_time,that)
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
- }
|
|
|
- console.log("c81_that.data.ravg_hx_value="+that.data.ravg_hx_value);
|
|
|
- console.log("");
|
|
|
- }
|
|
|
- },
|
|
|
- });
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
- }
|
|
|
-
|
|
|
- },
|
|
|
- })
|
|
|
- },
|
|
|
- initChart9(canvas, width, height,reportId){//体动次数
|
|
|
- var that = this;
|
|
|
- wx.request({
|
|
|
- url: `${aipushApi}`+'/getsn',
|
|
|
- data: {"hotelcode":that.data.hotelcode?that.data.hotelcode:"club",
|
|
|
- "roomcode":that.data.roomcode?that.data.roomcode:"nuange",
|
|
|
- "token":token_push},
|
|
|
- method: 'POST',
|
|
|
- success(res) {
|
|
|
- try {
|
|
|
- if(res && res.data && res.data[0]){
|
|
|
- that.setData({
|
|
|
- roomname: res.data[0].rn
|
|
|
- });
|
|
|
- wx.request({
|
|
|
- url: `${aipushApi}`+'/getsingle',
|
|
|
- data: {"sn":that.data.rsn?that.data.rsn:res.data[0].sn,
|
|
|
- "token":token_push,
|
|
|
- "rpids":reportId},
|
|
|
- method: 'POST',
|
|
|
- success(ress) {
|
|
|
- if(ress && ress.data){
|
|
|
- // console.log('ress.data-getsingle='+JSON.stringify(ress.data.results));
|
|
|
- try {
|
|
|
- var rsnoring_arr_Temp = [];
|
|
|
- if(ress.data.results.rsnoring_arr){
|
|
|
- rsnoring_arr_Temp = ress.data.results.rsnoring_arr.split(",");
|
|
|
- }
|
|
|
-
|
|
|
- that.setData({
|
|
|
- rdt_arr: that.splitN(ress.data.results.rdt_arr?ress.data.results.rdt_arr.split(','):[],100),
|
|
|
- rsnoring_arr: that.splitN(rsnoring_arr_Temp,100),
|
|
|
- rgobed_time: ress.data.results.rgobed_time,
|
|
|
- routbed_time: ress.data.results.routbed_time,
|
|
|
- rgobed_routbed: ress.data.results.rgobed_time + '~' + ress.data.results.routbed_time,
|
|
|
- });
|
|
|
- chart9 = echarts.init(canvas, null, {
|
|
|
- width: width,
|
|
|
- height: height
|
|
|
- });
|
|
|
- console.log("plot in ......")
|
|
|
- canvas.setChart(chart9);
|
|
|
- // var list = that.getRsleep_arr(ress.data.results.rsleep_arr?ress.data.results.rsleep_arr.split(","):[])
|
|
|
- flushChart9(that.data.rdt_arr,that.data.rsnoring_arr,that.data.rgobed_time,that.data.routbed_time,that)
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
- }
|
|
|
- console.log("c8_that.data.rmove_arr="+that.data.rmove_arr);
|
|
|
- console.log("");
|
|
|
- }
|
|
|
- },
|
|
|
- });
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
- }
|
|
|
-
|
|
|
- },
|
|
|
- })
|
|
|
- },
|
|
|
- initChart10(canvas, width, height,reportId){//体动次数
|
|
|
- var that = this;
|
|
|
- wx.request({
|
|
|
- url: `${aipushApi}`+'/getsn',
|
|
|
- data: {"hotelcode":that.data.hotelcode?that.data.hotelcode:"club",
|
|
|
- "roomcode":that.data.roomcode?that.data.roomcode:"nuange",
|
|
|
- "token":token_push},
|
|
|
- method: 'POST',
|
|
|
- success(res) {
|
|
|
- try {
|
|
|
- if(res && res.data && res.data[0]){
|
|
|
- that.setData({
|
|
|
- roomname: res.data[0].rn
|
|
|
- });
|
|
|
- wx.request({
|
|
|
- url: `${aipushApi}`+'/getsingle',
|
|
|
- data: {"sn":that.data.rsn?that.data.rsn:res.data[0].sn,
|
|
|
- "token":token_push,
|
|
|
- "rpids":reportId},
|
|
|
- method: 'POST',
|
|
|
- success(ress) {
|
|
|
- if(ress && ress.data){
|
|
|
- // console.log('ress.data-getsingle='+JSON.stringify(ress.data.results));
|
|
|
- try {
|
|
|
- var rhxstop_arr_Temp = [];
|
|
|
- if(ress.data.results.rhxstop_arr){
|
|
|
- rhxstop_arr_Temp = ress.data.results.rhxstop_arr.split(",");
|
|
|
- }
|
|
|
-
|
|
|
- that.setData({
|
|
|
- rdt_arr: that.splitN(ress.data.results.rdt_arr?ress.data.results.rdt_arr.split(','):[],100),
|
|
|
- rhxstop_arr: that.splitN(rhxstop_arr_Temp,100),
|
|
|
- rgobed_time: ress.data.results.rgobed_time,
|
|
|
- routbed_time: ress.data.results.routbed_time,
|
|
|
- rgobed_routbed: ress.data.results.rgobed_time + '~' + ress.data.results.routbed_time,
|
|
|
- });
|
|
|
- chart10 = echarts.init(canvas, null, {
|
|
|
- width: width,
|
|
|
- height: height
|
|
|
- });
|
|
|
- console.log("plot in ......")
|
|
|
- canvas.setChart(chart10);
|
|
|
- // var list = that.getRsleep_arr(ress.data.results.rsleep_arr?ress.data.results.rsleep_arr.split(","):[])
|
|
|
- flushChart10(that.data.rdt_arr,that.data.rhxstop_arr,that.data.rgobed_time,that.data.routbed_time,that)
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
- }
|
|
|
- console.log("c8_that.data.rhxstop_arr="+that.data.rhxstop_arr);
|
|
|
- console.log("");
|
|
|
- }
|
|
|
- },
|
|
|
- });
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
}
|
|
|
-
|
|
|
- },
|
|
|
- })
|
|
|
- },
|
|
|
- getRsleep_arr(list){
|
|
|
- if(list){
|
|
|
- console.log("getRsleep_arr_list1=="+JSON.stringify(list));
|
|
|
- for (let i = 0; i < list.length; i++) {
|
|
|
- if (list[i] == '0') {
|
|
|
- list[i] = '清醒';
|
|
|
- }else if (list[i] == '10') {
|
|
|
- list[i] = '浅睡';
|
|
|
- }else if (list[i] == '20') {
|
|
|
- list[i] = '中睡';
|
|
|
- }else if (list[i] == '30') {
|
|
|
- list[i] = '深睡';
|
|
|
- }else{
|
|
|
- list[i] = '其他';
|
|
|
+ });
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
- console.log("getRsleep_arr_list2=="+JSON.stringify(list));
|
|
|
- },
|
|
|
- getFrequency(list){//获取
|
|
|
- if(list){
|
|
|
- console.log("getRsleep_arr_list1=="+JSON.stringify(list));
|
|
|
- for (let i = 0; i < list.length; i++) {
|
|
|
- if (list[i] == '0') {
|
|
|
- list[i] = '清醒';
|
|
|
- }else if (list[i] == '10') {
|
|
|
- list[i] = '浅睡';
|
|
|
- }else if (list[i] == '20') {
|
|
|
- list[i] = '中睡';
|
|
|
- }else if (list[i] == '30') {
|
|
|
- list[i] = '深睡';
|
|
|
- }else{
|
|
|
- list[i] = '其他';
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- console.log("getRsleep_arr_list2=="+JSON.stringify(list));
|
|
|
- },
|
|
|
- initChart12(canvas, width, height){//体动次数
|
|
|
- var that = this;
|
|
|
- wx.request({
|
|
|
- url: `${aipushApi}`+'/getsn',
|
|
|
- data: {"hotelcode":that.data.hotelcode?that.data.hotelcode:"club",
|
|
|
- "roomcode":that.data.roomcode?that.data.roomcode:"nuange",
|
|
|
- "token":token_push},
|
|
|
- method: 'POST',
|
|
|
- success(res) {
|
|
|
- try {
|
|
|
- if(res && res.data && res.data[0]){
|
|
|
- that.setData({
|
|
|
- roomname: res.data[0].rn
|
|
|
- });
|
|
|
- wx.request({
|
|
|
- url: `${aipushApi}`+'/getsingle',
|
|
|
- data: {"sn":res.data[0].sn,
|
|
|
- "token":token_push},
|
|
|
- method: 'POST',
|
|
|
- success(ress) {
|
|
|
- if(ress && ress.data){
|
|
|
- // console.log('ress.data-getsingle='+JSON.stringify(ress.data.results));
|
|
|
- try {
|
|
|
- var rsnoring_arr_Temp = [];
|
|
|
- if(ress.data.results.rsnoring_arr){
|
|
|
- rsnoring_arr_Temp = ress.data.results.rsnoring_arr.split(",");
|
|
|
- }
|
|
|
-
|
|
|
- that.setData({
|
|
|
- rdt_arr: that.splitN(ress.data.results.rdt_arr?ress.data.results.rdt_arr.split(','):[],100),
|
|
|
- rsnoring_arr: that.splitN(rsnoring_arr_Temp,100),
|
|
|
- rgobed_time: ress.data.results.rgobed_time,
|
|
|
- routbed_time: ress.data.results.routbed_time,
|
|
|
- rgobed_routbed: ress.data.results.rgobed_time + '~' + ress.data.results.routbed_time,
|
|
|
- });
|
|
|
- chart9 = echarts.init(canvas, null, {
|
|
|
- width: width,
|
|
|
- height: height
|
|
|
- });
|
|
|
- console.log("plot in ......")
|
|
|
- canvas.setChart(chart9);
|
|
|
- // var list = that.getRsleep_arr(ress.data.results.rsleep_arr?ress.data.results.rsleep_arr.split(","):[])
|
|
|
- flushChart9(that.data.rdt_arr,that.data.rsnoring_arr,that.data.rgobed_time,that.data.routbed_time,that)
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
- }
|
|
|
- console.log("c8_that.data.rmove_arr="+that.data.rmove_arr);
|
|
|
- console.log("");
|
|
|
- }
|
|
|
- },
|
|
|
- });
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
- }
|
|
|
-
|
|
|
- },
|
|
|
- })
|
|
|
- },
|
|
|
- sleepStateChange(data){
|
|
|
- console.log("change-data=="+data)
|
|
|
- switch(data) {
|
|
|
- case 0:
|
|
|
- return '清醒';
|
|
|
- case 10:
|
|
|
- return '浅睡';
|
|
|
- case 20:
|
|
|
- return '中睡';
|
|
|
- case 30:
|
|
|
- return '深睡';
|
|
|
- default:
|
|
|
- return '';
|
|
|
- }
|
|
|
- },
|
|
|
- sleepRoutbed_arrChange(data){
|
|
|
- console.log("change-data=="+data)
|
|
|
- switch(data) {
|
|
|
- case 0:
|
|
|
- return '离床';
|
|
|
- case 1:
|
|
|
- return '在床';
|
|
|
- default:
|
|
|
- return '';
|
|
|
- }
|
|
|
- },
|
|
|
- sleepRmove_arrChange(data){
|
|
|
- console.log("change-data=="+data)
|
|
|
- switch(data) {
|
|
|
- case 0:
|
|
|
- return '否';
|
|
|
- case 1:
|
|
|
- return '体动';
|
|
|
- default:
|
|
|
- return '';
|
|
|
- }
|
|
|
- },
|
|
|
- sleepRsnoring_arrChange(data){
|
|
|
- console.log("change-data=="+data)
|
|
|
- switch(data) {
|
|
|
- case 0:
|
|
|
- return '否';
|
|
|
- case 1:
|
|
|
- return '打鼾';
|
|
|
- default:
|
|
|
- return '';
|
|
|
- }
|
|
|
- },
|
|
|
- sleepRhxstop_arrChange(data){
|
|
|
- console.log("change-data=="+data)
|
|
|
- switch(data) {
|
|
|
- case 0:
|
|
|
- return '否';
|
|
|
- case 1:
|
|
|
- return '停止';
|
|
|
- default:
|
|
|
- return '';
|
|
|
- }
|
|
|
- },
|
|
|
- splitN(originalArray,n){
|
|
|
- if(!originalArray) return [];
|
|
|
- // 计算每份的大小
|
|
|
- let chunkSize = Math.ceil(originalArray.length / n);
|
|
|
-
|
|
|
- // 分割数组并获取每份的最后一个元素
|
|
|
- let lastElements = [];
|
|
|
- for (let i = 0; i < originalArray.length; i += chunkSize) {
|
|
|
- let chunk = originalArray.slice(i, i + chunkSize);
|
|
|
- lastElements.push(chunk[chunk.length - 1]);
|
|
|
+ // that.startInterval();
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ wx.request({
|
|
|
+ url: `${aipushApi}/getha`, //
|
|
|
+ method: 'POST',
|
|
|
+ // header: {
|
|
|
+ // 'content-type': 'application/json', // 默认值
|
|
|
+ // 'Authorization': 'Bearer ' + token // 在头部设置认证信息,例如使用Bearer Token
|
|
|
+ // },
|
|
|
+ data: {
|
|
|
+ "locations": hotelcode, "room": (hotelcode && hotelcode.includes('hotel')) ? roomcode : "", "token": token_push
|
|
|
+ },
|
|
|
+ success(res) {
|
|
|
+ if (!res || !res.data) {
|
|
|
+ that.setData({
|
|
|
+ isLoading: false,
|
|
|
+ });
|
|
|
+ return;
|
|
|
}
|
|
|
- // 输出每份的最后一个元素
|
|
|
- console.log('lastElements='+lastElements);
|
|
|
- return lastElements;
|
|
|
- },
|
|
|
- takePortionDateData(rdt_arrArray,originalArray,n){
|
|
|
- if(!rdt_arrArray || !originalArray) return [];
|
|
|
- var portionDateData = [];
|
|
|
- var portionData = [];
|
|
|
- for (let i = 0; i < originalArray.length; i ++) {
|
|
|
- if(originalArray[i] == n){
|
|
|
- portionDateData.push(rdt_arrArray[i]);
|
|
|
- portionData.push(originalArray[i]);
|
|
|
- } else{
|
|
|
-
|
|
|
- }
|
|
|
+
|
|
|
+ var resData = res.data
|
|
|
+ console.log('res.data.睡眠报告.ha=' + JSON.stringify(resData));
|
|
|
+ if (res.data.code == "400") {
|
|
|
+ console.error("400错误!");
|
|
|
+ return;
|
|
|
}
|
|
|
- console.log('portionDateData='+JSON.stringify(portionDateData));
|
|
|
- return portionDateData;
|
|
|
- },
|
|
|
- takePortionData(originalArray,n){
|
|
|
- if(!originalArray) return [];
|
|
|
- var portionData = [];
|
|
|
- for (let i = 0; i < originalArray.length; i ++) {
|
|
|
- if(originalArray[i] == n){
|
|
|
- portionData.push(originalArray[i])
|
|
|
- } else{
|
|
|
-
|
|
|
- }
|
|
|
+ if (res.data.code == "401") {
|
|
|
+ console.error("401错误!");
|
|
|
+ return;
|
|
|
}
|
|
|
- console.log('portionData='+JSON.stringify(portionData));
|
|
|
- return portionData;
|
|
|
- },
|
|
|
- getFrequency(list,o){//获取次数
|
|
|
- if(!list) return 0;
|
|
|
- let frequency = 0;
|
|
|
- for (let i = 0; i < list.length; i++) {
|
|
|
- if(list[i] == o) frequency++;
|
|
|
+
|
|
|
+ homeApi_https = resData.loc;
|
|
|
+ token = resData.token;
|
|
|
+ },
|
|
|
+ fail: function (error) {
|
|
|
+ console.error('error', error);
|
|
|
+ that.setData({
|
|
|
+ isLoading: false,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ },
|
|
|
+ convertTimeToHoursAndMinutes: function (timeWithText, flag = 0) {
|
|
|
+ if (!timeWithText) return;
|
|
|
+ // 移除'分钟'两个字
|
|
|
+ var minutesStr = timeWithText.replace('分钟', '');
|
|
|
+ var minutes = parseInt(minutesStr); // 将字符串转换为整数
|
|
|
+
|
|
|
+ if (isNaN(minutes)) {
|
|
|
+ // 如果转换失败,则可能是输入的不是有效的数字
|
|
|
+ console.error('Invalid minutes format');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ var hours = Math.floor(minutes / 60); // 整除60得到小时数
|
|
|
+ var remainingMinutes = minutes % 60; // 取余得到剩余的分钟数
|
|
|
+
|
|
|
+ // 如果小时数或分钟数小于10,前面补0
|
|
|
+ // var formattedHours = hours < 10 ? '0' + hours : hours;
|
|
|
+ var formattedHours = hours;
|
|
|
+ // var formattedMinutes = remainingMinutes < 10 ? '0' + remainingMinutes : remainingMinutes;
|
|
|
+ var formattedMinutes = remainingMinutes;
|
|
|
+
|
|
|
+ // 拼接小时和分钟,形成HH:mm格式
|
|
|
+ var formattedTime = '';
|
|
|
+ if (flag == 1) {
|
|
|
+ formattedTime = formattedHours + 'H ' + formattedMinutes + 'M';
|
|
|
+ } else if(flag == 2) {
|
|
|
+ formattedTime = formattedHours + '{units|小时}' + formattedMinutes + '{units|分钟}';
|
|
|
+ } else {
|
|
|
+ formattedTime = {
|
|
|
+ formattedHours,
|
|
|
+ formattedMinutes
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ // 更新数据
|
|
|
+ // this.setData({
|
|
|
+ // formattedTime: formattedTime
|
|
|
+ // });
|
|
|
+ return formattedTime;
|
|
|
+ },
|
|
|
+ getDateTimeJsonData: function (sn) {
|
|
|
+ var that = this;
|
|
|
+ var sourceFourthTemp = [];
|
|
|
+ wx.request({
|
|
|
+ url: `${aipushApi}/getdatefromsn`, //
|
|
|
+ method: 'POST',
|
|
|
+ // header: {
|
|
|
+ // 'content-type': 'application/json', // 默认值
|
|
|
+ // 'Authorization': 'Bearer ' + token // 在头部设置认证信息,例如使用Bearer Token
|
|
|
+ // },
|
|
|
+ data: {
|
|
|
+ "sn": sn, "token": token_push
|
|
|
+ },
|
|
|
+ success(res) {
|
|
|
+ if (!res || !res.data || !res.data.results) {
|
|
|
+ return;
|
|
|
}
|
|
|
- console.log('frequency='+frequency);
|
|
|
- return frequency;
|
|
|
- },
|
|
|
- getTimeDiffInHours: function(startTimeStr, endTimeStr) {
|
|
|
- // 假设两个时间都是同一天的,这里我们使用当前日期作为基准
|
|
|
- if(!startTimeStr || !endTimeStr) return null;
|
|
|
- const now = new Date();
|
|
|
- const startDate = new Date(now.getFullYear(), now.getMonth(), now.getDate(), ...startTimeStr.split(':').map(Number));
|
|
|
- const endDate = new Date(now.getFullYear(), now.getMonth(), now.getDate(), ...endTimeStr.split(':').map(Number));
|
|
|
-
|
|
|
- // 处理跨天的情况
|
|
|
- if (endDate < startDate) {
|
|
|
- endDate.setDate(endDate.getDate() + 1); // 将结束时间设置为第二天的同一时间
|
|
|
- }
|
|
|
-
|
|
|
- // 计算时间差(毫秒)
|
|
|
- const diffInMs = endDate - startDate;
|
|
|
-
|
|
|
- // 转换为小时
|
|
|
- const diffInHours = diffInMs / (1000 * 60 * 60);
|
|
|
-
|
|
|
- return diffInHours;
|
|
|
- },
|
|
|
- drawProgressCircle: function() {
|
|
|
- const ctx = wx.createCanvasContext('progressCircleCanvas');
|
|
|
- // 假设屏幕的宽度为 windowWidth px
|
|
|
- const windowWidth = wx.getSystemInfoSync().windowWidth;
|
|
|
-
|
|
|
- // 假设你有一个以 rpx 为单位的值
|
|
|
- const valueInRpx = 300;
|
|
|
-
|
|
|
- // 计算对应的 px 值
|
|
|
- const valueInPx = (valueInRpx / 750) * windowWidth;
|
|
|
-
|
|
|
- const radius = 60; // 圆的半径
|
|
|
- const centerX = valueInPx; // 圆心的x坐标
|
|
|
- const centerY = valueInPx/2; // 圆心的y坐标
|
|
|
- const strokeWidth = 10; // 进度条的宽度
|
|
|
- const percentage = this.data.percentage; // 进度百分比
|
|
|
-
|
|
|
- // 绘制外圆
|
|
|
- ctx.beginPath();
|
|
|
- ctx.arc(centerX, centerY, radius, 0, 2 * Math.PI);
|
|
|
- ctx.setStrokeStyle('#46ff81'); // 外圆颜色
|
|
|
- ctx.setLineWidth(strokeWidth * 2); // 外圆线宽
|
|
|
- ctx.stroke();
|
|
|
-
|
|
|
- // 绘制内圆(进度条背景)
|
|
|
- ctx.beginPath();
|
|
|
- ctx.arc(centerX, centerY, radius - strokeWidth, 0, 2 * Math.PI);
|
|
|
- ctx.setStrokeStyle('#e0e0e0'); // 内圆颜色
|
|
|
- ctx.setLineWidth(strokeWidth); // 内圆线宽
|
|
|
- ctx.stroke();
|
|
|
-
|
|
|
- // 绘制进度条
|
|
|
- ctx.beginPath();
|
|
|
- ctx.arc(centerX, centerY, radius - strokeWidth, -0.5 * Math.PI, -0.5 * Math.PI + 2 * Math.PI * (percentage / 100));
|
|
|
- ctx.setStrokeStyle('#007aff'); // 进度条颜色
|
|
|
- ctx.setLineWidth(strokeWidth);
|
|
|
- ctx.setLineCap('round'); // 设置线条端点的样式为圆形
|
|
|
- ctx.stroke();
|
|
|
-
|
|
|
- // 绘制中心圆点
|
|
|
- ctx.beginPath();
|
|
|
- ctx.arc(centerX, centerY, 5, 0, 2 * Math.PI);
|
|
|
- ctx.setFillStyle('#ffffff');
|
|
|
- ctx.fill();
|
|
|
-
|
|
|
- // 绘制完成,将内容渲染到canvas中
|
|
|
- ctx.draw();
|
|
|
- },
|
|
|
- // 假设你有一个方法来更新进度条的值
|
|
|
- updateProgress: function(newPercentage) {
|
|
|
- this.setData({
|
|
|
- percentage: newPercentage
|
|
|
- });
|
|
|
- this.drawProgressCircle(); // 重新绘制进度条
|
|
|
- },
|
|
|
-
|
|
|
- buttonClicked: function() {
|
|
|
- var that = this;
|
|
|
- // 切换按钮的点击状态
|
|
|
- this.setData({
|
|
|
- isButtonClicked: !that.data.isButtonClicked,
|
|
|
- });
|
|
|
-
|
|
|
- // 在这里可以添加其他点击后的逻辑,比如调用接口等
|
|
|
- },
|
|
|
-
|
|
|
- telScreeProjection: function(tvEntityId) {
|
|
|
- var that = this;
|
|
|
- that.setData({
|
|
|
- isLoading: true,
|
|
|
- });
|
|
|
- wx.request({
|
|
|
- url: `${aipushApi}`+'/getbigreport',
|
|
|
+
|
|
|
+ var resDataSn = res.data.results
|
|
|
+ console.log('resDataSn====' + JSON.stringify(resDataSn))
|
|
|
+ var tt = 0;
|
|
|
+ resDataSn.forEach(function (item, index) {
|
|
|
+ wx.request({
|
|
|
+ url: `${aipushApi}/getimefromsn`, //
|
|
|
method: 'POST',
|
|
|
- header: {
|
|
|
- 'content-type': 'application/json', // 默认值
|
|
|
- 'Authorization': 'Bearer ' + token // 在头部设置认证信息,例如使用Bearer Token
|
|
|
- },
|
|
|
- data:{
|
|
|
- "sn":that.data.rsn,"tokens":token_push
|
|
|
+ // header: {
|
|
|
+ // 'content-type': 'application/json', // 默认值
|
|
|
+ // 'Authorization': 'Bearer ' + token // 在头部设置认证信息,例如使用Bearer Token
|
|
|
+ // },
|
|
|
+ data: {
|
|
|
+ "sn": sn, "date": item.rdate, "token": token_push
|
|
|
},
|
|
|
success(ress) {
|
|
|
- console.log('wx.getStorageSync(tvEntityId)='+wx.getStorageSync('tvEntityId'));
|
|
|
- console.log('tvEntityId='+JSON.stringify(tvEntityId));
|
|
|
- let tvEntityIdss = tvEntityId?tvEntityId:wx.getStorageSync('tvEntityId')
|
|
|
- if(ress && ress.data && tvEntityIdss){
|
|
|
- console.log("ress.data=="+JSON.stringify(ress.data.url));
|
|
|
- console.log("tvEntityIdss=="+tvEntityIdss);
|
|
|
- wx.request({
|
|
|
- // url: `${homeApi_http}`+':'+`${homeApi_http_port}`+'/api/services/media_player/play_media', //http
|
|
|
- // url: `${homeApi_https}`+'/api/services/media_player/play_media', //https
|
|
|
- url: `${homeApi_https}`+'/api/services/media_player/select_source', //https
|
|
|
- method: 'POST',
|
|
|
- header: {
|
|
|
- 'content-type': 'application/json', // 默认值
|
|
|
- 'Authorization': 'Bearer ' + token // 在头部设置认证信息,例如使用Bearer Token
|
|
|
- },
|
|
|
- data:{
|
|
|
- "entity_id": tvEntityIdss,
|
|
|
- // "media_content_id": ress.data.url,
|
|
|
- // "media_content_id": 'https://alifei01.cfp.cn/creative/vcg/800/new/VCG41175510742.jpg',
|
|
|
- // "media_content_id": 'https://alifei01.cfp.cn/creative/vcg/veer/1600water/veer-368621010.jpg',
|
|
|
- // "media_content_type": "image/jpeg/png",
|
|
|
- "source": "X浏览器"
|
|
|
- },
|
|
|
- success(res) {
|
|
|
- that.setData({
|
|
|
- isLoading: false,
|
|
|
- });
|
|
|
- if(res && res.data){
|
|
|
- var resData = res.data
|
|
|
- console.log('res-推送='+JSON.stringify(res));
|
|
|
- console.log('res.data-推送='+JSON.stringify(resData));
|
|
|
- wx.showToast({
|
|
|
- title: "推送成功",
|
|
|
- icon: "success",
|
|
|
- mask: true,
|
|
|
- });
|
|
|
- }else{
|
|
|
- wx.showToast({
|
|
|
- title: '推送失败',
|
|
|
- icon: 'none'
|
|
|
- });
|
|
|
+ if (!ress || !ress.data || !ress.data.results) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var resDataItem = ress.data.results;
|
|
|
+ resDataItem.forEach(function (item_item, index) {
|
|
|
+ item_item.text = item_item.durations;
|
|
|
+ item_item.reportId = item_item.rpids;
|
|
|
+ });
|
|
|
+ var json = {};
|
|
|
+ json.text = item.rdate;
|
|
|
+ json.children = resDataItem;
|
|
|
+ sourceFourthTemp.push(json);
|
|
|
+ console.log('sourceFourthTemp0=' + JSON.stringify(sourceFourthTemp));
|
|
|
+ if (tt == (resDataSn.length - 1)) {
|
|
|
+ console.log('sourceFourthTemp=' + JSON.stringify(sourceFourthTemp));
|
|
|
+
|
|
|
+ // 使用 sort 方法进行排序
|
|
|
+ sourceFourthTemp.sort(function (a, b) {
|
|
|
+ // 将字符串转换为 Date 对象
|
|
|
+ let dateA = new Date(a.text);
|
|
|
+ let dateB = new Date(b.text);
|
|
|
+ if (dateA < dateB) {
|
|
|
+ return 1;
|
|
|
}
|
|
|
- },
|
|
|
- fail: function (error) {
|
|
|
- // 请求失败后的回调函数
|
|
|
- console.error('推送失败', error);
|
|
|
- // 在这里处理请求失败的情况,比如显示错误信息给用户
|
|
|
- that.setData({
|
|
|
- isLoading: false,
|
|
|
- });
|
|
|
- wx.showToast({
|
|
|
- title: '推送失败',
|
|
|
- icon: 'none'
|
|
|
- });
|
|
|
- }
|
|
|
+ if (dateA > dateB) {
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ // 如果日期相等,返回 0
|
|
|
+ return 0;
|
|
|
});
|
|
|
- }else{
|
|
|
+ console.log('sourceFourthTemp1=' + JSON.stringify(sourceFourthTemp));
|
|
|
+ //初始化弹出面板
|
|
|
+ var array = that.data.arrayFourth;
|
|
|
+ array[0] = sourceFourthTemp;
|
|
|
+ array[1] = array[0][0].children;
|
|
|
+
|
|
|
that.setData({
|
|
|
- isLoading: false,
|
|
|
- });
|
|
|
- wx.showToast({
|
|
|
- title: '找不到电视,推送失败',
|
|
|
- icon: 'none'
|
|
|
- });
|
|
|
+ valueFourth: [0, 0],
|
|
|
+ sourceFourth: sourceFourthTemp,
|
|
|
+ arrayFourth: array,
|
|
|
+ })
|
|
|
+ tt = 0;
|
|
|
}
|
|
|
+ tt++
|
|
|
},
|
|
|
- });
|
|
|
- },
|
|
|
- getData(sn,hotelcode,roomcode,reportId){
|
|
|
- var that = this;
|
|
|
- wx.request({
|
|
|
- url: `${aipushApi}`+'/getsn',
|
|
|
- data: {"hotelcode":hotelcode?hotelcode:"club",
|
|
|
- "roomcode":roomcode?roomcode:"nuange",
|
|
|
- "token":token_push},
|
|
|
- method: 'POST',
|
|
|
- success(res) {
|
|
|
-
|
|
|
- try {
|
|
|
- // that.setData({
|
|
|
- // airText: now.category, //空气质量
|
|
|
- // airValue: now.aqi //空气指数
|
|
|
- // })
|
|
|
- if(res && res.data && res.data[0]){
|
|
|
- that.setData({
|
|
|
- roomname: res.data[0].rn
|
|
|
- });
|
|
|
- console.log("res.data-sn="+JSON.stringify(res.data));
|
|
|
- wx.request({
|
|
|
- url: `${aipushApi}`+'/getsingle',
|
|
|
- data: {"sn":sn?sn:res.data[0].sn,
|
|
|
- "token":token_push,
|
|
|
- "rpids":reportId},
|
|
|
- method: 'POST',
|
|
|
- success(ress) {
|
|
|
- try {
|
|
|
- if(ress && ress.data){
|
|
|
- console.log('ress.data-getsingle='+JSON.stringify(ress.data.results));
|
|
|
- // that.setData({
|
|
|
- // airText: now.category, //空气质量
|
|
|
- // airValue: now.aqi //空气指数
|
|
|
- // })
|
|
|
- // rdt_arr = ress.data.results.rdt_arr //睡眠时间轴数据集合
|
|
|
- // rrh_arr = ress.data.results.rdt_arr//睡眠心率数据集合
|
|
|
- // rhx_arr = ress.data.results.rhx_arr//睡眠呼吸数据集合
|
|
|
- // rsnoring_arr = ress.data.results.rsnoring_arr//睡眠打鼾数据集合,0-否,1-打鼾状态
|
|
|
- // routbed_arr = ress.data.results.routbed_arr//离床状态数据集合,0-离床,1-在床
|
|
|
- // rmove_arr = ress.data.results.rmove_arr//体动状态数据集合,0-否,1-体动状态
|
|
|
- // rhxstop_arr = ress.data.results.rhxstop_arr//呼吸停止状态数据集合
|
|
|
- // rsleep_arr = ress.data.results.rsleep_arr//睡眠状态数据集合,0-清醒,10-浅睡,20-中睡,30-深睡
|
|
|
-
|
|
|
- // rdeep_duration = ress.data.results.rdeep_duration//深睡时长,单位分钟
|
|
|
- // rlight_duration = ress.data.results.rlight_duration//浅睡时长,单位分钟
|
|
|
- // rin_duration = ress.data.results.rin_duration//中睡时长,单位分钟
|
|
|
- // rawake_duration = ress.data.results.rawake_duration//清醒时长,单位分钟
|
|
|
- // ravg_hx_value = ress.data.results.ravg_hx_value//呼吸平均值
|
|
|
- // ravg_hx_desc = ress.data.results.ravg_hx_desc//呼吸平均值评分描述
|
|
|
- // ravg_rh_value = ress.data.results.ravg_rh_value//心率平均值
|
|
|
- // ravg_rh_desc = ress.data.results.ravg_rh_desc//心率平均值评分描述
|
|
|
- // rscore_value = ress.data.results.rscore_value//睡眠报告得分值
|
|
|
- // rscore_desc = ress.data.results.rscore_desc//睡眠报告得分评比描述
|
|
|
-
|
|
|
-
|
|
|
- // that.setData({
|
|
|
- // rdt_arr: ress.data.results.rdt_arr?ress.data.results.rdt_arr.split(','):[],
|
|
|
- // rrh_arr: ress.data.results.rrh_arr?ress.data.results.rrh_arr.split(','):[],
|
|
|
- // rhx_arr: ress.data.results.rhx_arr?ress.data.results.rhx_arr.split(','):[],
|
|
|
- // rsnoring_arr: ress.data.results.rsnoring_arr?ress.data.results.rsnoring_arr.split(','):[],
|
|
|
- // routbed_arr: ress.data.results.routbed_arr?ress.data.results.routbed_arr.split(','):[],
|
|
|
- // rmove_arr: ress.data.results.rmove_arr?ress.data.results.rmove_arr.split(','):[],
|
|
|
- // rhxstop_arr: ress.data.results.rhxstop_arr?ress.data.results.rhxstop_arr.split(','):[],
|
|
|
- // rsleep_arr: ress.data.results.rsleep_arr?ress.data.results.rsleep_arr.split(','):[],
|
|
|
-
|
|
|
- // rdeep_duration: ress.data.results.rdeep_duration,
|
|
|
- // rlight_duration: ress.data.results.rlight_duration,
|
|
|
- // rin_duration: ress.data.results.rin_duration,
|
|
|
- // rawake_duration: ress.data.results.rawake_duration,
|
|
|
- // ravg_hx_value: ress.data.results.ravg_hx_value,
|
|
|
- // ravg_hx_desc: ress.data.results.ravg_hx_desc,
|
|
|
- // ravg_rh_value: ress.data.results.ravg_rh_value,
|
|
|
- // ravg_rh_desc: ress.data.results.ravg_rh_desc,
|
|
|
- // rscore_value: ress.data.results.rscore_value,
|
|
|
- // rscore_desc: ress.data.results.rscore_desc,
|
|
|
-
|
|
|
- // rsn: ress.data.results.rsn,
|
|
|
- // rdate: ress.data.results.rdate,
|
|
|
- // rtotal_duration: ress.data.results.rtotal_duration,//睡眠总时长,单位分钟
|
|
|
- // rinbed_duration: ress.data.results.rinbed_duration,//在床时长,单位分钟
|
|
|
- // rgobed_time: ress.data.results.rgobed_time,//上床时间
|
|
|
- // routbed_time: ress.data.results.routbed_time,//离床时间
|
|
|
- // routbed_count_value: ress.data.results.routbed_count_value,//离床次数
|
|
|
- // rsn: ress.data.results.rsn,
|
|
|
-
|
|
|
- // });
|
|
|
-
|
|
|
- let durationDataTemp = [];
|
|
|
- let obj = {};
|
|
|
- obj.name = '深睡';
|
|
|
- obj.value = ress.data.results.rdeep_duration;
|
|
|
- durationDataTemp.push(obj);
|
|
|
- obj = {};
|
|
|
- obj.name = '浅睡';
|
|
|
- obj.value = ress.data.results.rlight_duration;
|
|
|
- durationDataTemp.push(obj);
|
|
|
- obj = {};
|
|
|
- obj.name = '中睡';
|
|
|
- obj.value = ress.data.results.rin_duration;
|
|
|
- durationDataTemp.push(obj);
|
|
|
- obj = {};
|
|
|
- obj.name = '清醒';
|
|
|
- obj.value = ress.data.results.rawake_duration;
|
|
|
- durationDataTemp.push(obj);
|
|
|
- console.log("durationDataTemp="+JSON.stringify(durationDataTemp));
|
|
|
-
|
|
|
- let sleep_durationCount = 0;
|
|
|
- if(ress.data.results.rdeep_duration){
|
|
|
- sleep_durationCount += parseFloat(ress.data.results.rdeep_duration)
|
|
|
- }
|
|
|
- if(ress.data.results.rlight_duration){
|
|
|
- sleep_durationCount += parseFloat(ress.data.results.rlight_duration)
|
|
|
- }
|
|
|
- if(ress.data.results.rin_duration){
|
|
|
- sleep_durationCount += parseFloat(ress.data.results.rin_duration)
|
|
|
- }
|
|
|
-
|
|
|
- let sleep_efficiency_temp = ress.data.results.rtotal_duration?(Math.ceil((sleep_durationCount / ress.data.results.rtotal_duration)*100)+'%'):'%'
|
|
|
-
|
|
|
- let rdeep_duration_efficiency_temp = ress.data.results.rtotal_duration?(Math.ceil(((ress.data.results.rdeep_duration?parseFloat(ress.data.results.rdeep_duration):0) / ress.data.results.rtotal_duration)*100)+'%'):'%'
|
|
|
- let rlight_duration_efficiency_temp = ress.data.results.rtotal_duration?(Math.ceil(((ress.data.results.rlight_duration?parseFloat(ress.data.results.rlight_duration):0) / ress.data.results.rtotal_duration)*100)+'%'):'%'
|
|
|
- let rin_duration_efficiency_temp = ress.data.results.rtotal_duration?(Math.ceil(((ress.data.results.rin_duration?parseFloat(ress.data.results.rin_duration):0) / ress.data.results.rtotal_duration)*100)+'%'):'%'
|
|
|
-
|
|
|
-
|
|
|
- let sleep_durationTemp = [];
|
|
|
- let obj1 = {};
|
|
|
- obj1.name = '睡眠时间';
|
|
|
- obj1.value = Math.ceil(sleep_durationCount / 60);
|
|
|
- sleep_durationTemp.push(obj1);
|
|
|
- obj1 = {};
|
|
|
- obj1.name = '清醒时间';
|
|
|
- obj1.value = Math.ceil(parseFloat(ress.data.results.rawake_duration) / 60);
|
|
|
- sleep_durationTemp.push(obj1);
|
|
|
-
|
|
|
- let zdPointTemp = [];
|
|
|
- let rdt_arrTemp = [];
|
|
|
-
|
|
|
- let rrh_arrTemp = [];
|
|
|
-
|
|
|
- let rhx_arrTemp = [];
|
|
|
-
|
|
|
-
|
|
|
- let rmove_arrTemp = [];
|
|
|
-
|
|
|
- let rsleep_arrTemp = [];
|
|
|
-
|
|
|
- let rsleep_arr_all_Temp = [];
|
|
|
-
|
|
|
- if(ress.data.results.rrh_arr){
|
|
|
- rdt_arrTemp = that.splitN(ress.data.results.rdt_arr.split(","),100);
|
|
|
- }
|
|
|
-
|
|
|
- if(ress.data.results.rrh_arr){
|
|
|
- rrh_arrTemp = that.splitN(ress.data.results.rrh_arr.split(","),100);
|
|
|
- }
|
|
|
- if(ress.data.results.rhx_arr){
|
|
|
- rhx_arrTemp = that.splitN(ress.data.results.rhx_arr.split(","),100);
|
|
|
- }
|
|
|
- if(ress.data.results.rmove_arr){
|
|
|
- rmove_arrTemp = that.splitN(ress.data.results.rmove_arr.split(","),100);
|
|
|
- }
|
|
|
- if(ress.data.results.rsleep_arr){
|
|
|
- rsleep_arrTemp = that.splitN(ress.data.results.rsleep_arr.split(","),100);
|
|
|
- }
|
|
|
-
|
|
|
- if(ress.data.results.rsleep_arr){
|
|
|
- rsleep_arr_all_Temp = ress.data.results.rsleep_arr.split(",");
|
|
|
- }
|
|
|
-
|
|
|
- console.log("rdt_arrTemp="+JSON.stringify(rdt_arrTemp));
|
|
|
- console.log("rrh_arrTemp="+JSON.stringify(rrh_arrTemp));
|
|
|
- console.log("rhx_arrTemp="+JSON.stringify(rhx_arrTemp));
|
|
|
- console.log("rmove_arrTemp="+JSON.stringify(rmove_arrTemp));
|
|
|
- console.log("rsleep_arrTemp="+JSON.stringify(rsleep_arrTemp));
|
|
|
- console.log("rsleep_arr_all_Temp="+JSON.stringify(rsleep_arr_all_Temp));
|
|
|
- console.log("sleep_durationTemp="+JSON.stringify(sleep_durationTemp));
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- that.setData({
|
|
|
-
|
|
|
- rdt_arr: ress.data.results.rdt_arr?ress.data.results.rdt_arr.split(','):[],
|
|
|
- rrh_arr: ress.data.results.rrh_arr?ress.data.results.rrh_arr.split(','):[],
|
|
|
- rhx_arr: ress.data.results.rhx_arr?ress.data.results.rhx_arr.split(','):[],
|
|
|
- rsnoring_arr: ress.data.results.rsnoring_arr?ress.data.results.rsnoring_arr.split(','):[],
|
|
|
- routbed_arr: ress.data.results.routbed_arr?ress.data.results.routbed_arr.split(','):[],
|
|
|
- rmove_arr: ress.data.results.rmove_arr?ress.data.results.rmove_arr.split(','):[],
|
|
|
- rhxstop_arr: ress.data.results.rhxstop_arr?ress.data.results.rhxstop_arr.split(','):[],
|
|
|
- rsleep_arr: ress.data.results.rsleep_arr?ress.data.results.rsleep_arr.split(','):[],
|
|
|
-
|
|
|
- rsnoring_arrFrequency: that.getFrequency(ress.data.results.rsnoring_arr?ress.data.results.rsnoring_arr.split(','):[],1),
|
|
|
- routbed_arrFrequency: that.getFrequency(ress.data.results.routbed_arr?ress.data.results.routbed_arr.split(','):[],0),
|
|
|
- rmove_arrFrequency: that.getFrequency(ress.data.results.rmove_arr?ress.data.results.rmove_arr.split(','):[],1),
|
|
|
- rhxstop_arrFrequency: that.getFrequency(ress.data.results.rhxstop_arr?ress.data.results.rhxstop_arr.split(','):[],1),
|
|
|
-
|
|
|
- rdeep_duration: that.convertTimeToHoursAndMinutes(ress.data.results.rdeep_duration),
|
|
|
- rlight_duration: ress.data.results.rlight_duration,
|
|
|
- rin_duration: ress.data.results.rin_duration,
|
|
|
- rawake_duration: ress.data.results.rawake_duration,
|
|
|
- ravg_hx_value: ress.data.results.ravg_hx_value,
|
|
|
- ravg_hx_desc: ress.data.results.ravg_hx_desc,
|
|
|
- ravg_rh_value: ress.data.results.ravg_rh_value,
|
|
|
- ravg_rh_desc: ress.data.results.ravg_rh_desc,
|
|
|
- rscore_value: ress.data.results.rscore_value,
|
|
|
- rscore_desc: ress.data.results.rscore_desc,
|
|
|
-
|
|
|
- rsn: ress.data.results.rsn,
|
|
|
- rdate: ress.data.results.rdate,
|
|
|
- rtotal_duration: that.convertTimeToHoursAndMinutes(ress.data.results.rtotal_duration),//睡眠总时长,单位小时分钟
|
|
|
- rinbed_duration: that.convertTimeToHoursAndMinutes(ress.data.results.rinbed_duration),//在床时长,单位小时分钟
|
|
|
- rgobed_time: ress.data.results.rgobed_time,//上床时间
|
|
|
- routbed_time: ress.data.results.routbed_time,//离床时间
|
|
|
- rgobed_routbed: ress.data.results.rgobed_time + '~' + ress.data.results.routbed_time,
|
|
|
- sleepHourSub: that.getTimeDiffInHours(ress.data.results.rgobed_time,ress.data.results.routbed_time),
|
|
|
- routbed_count_value: ress.data.results.routbed_count_value,//离床次数
|
|
|
- rsn: ress.data.results.rsn,
|
|
|
- zdPointT:zdPointTemp,
|
|
|
- rdt_arrNew:rdt_arrTemp,
|
|
|
- rrh_arrNew:rrh_arrTemp,
|
|
|
- rhx_arrNew:rhx_arrTemp,
|
|
|
- rmove_arrNew:rmove_arrTemp,
|
|
|
- rsleep_arrNew:rsleep_arrTemp,
|
|
|
- rsleep_arr_all_New:rsleep_arr_all_Temp,
|
|
|
- durationData:durationDataTemp,
|
|
|
- sleep_duration:sleep_durationTemp,
|
|
|
- sleep_efficiency:sleep_efficiency_temp,
|
|
|
- sleep_durationCountA:that.convertTimeToHoursAndMinutes(sleep_durationCount?sleep_durationCount.toString():'0'),
|
|
|
- sns:res.data,
|
|
|
- tvEntityIds:wx.getStorageSync('tvEntityIds'),
|
|
|
- ifOneMoreTV:(wx.getStorageSync('tvEntityIds') && wx.getStorageSync('tvEntityIds').length>1),
|
|
|
- hotelname:res.data[0].hn,
|
|
|
- rdeep_duration_efficiency:rdeep_duration_efficiency_temp,
|
|
|
- rlight_duration_efficiency:rlight_duration_efficiency_temp,
|
|
|
- rin_duration_efficiency:rin_duration_efficiency_temp,
|
|
|
- pushReportId:ress.data.results.rdid,
|
|
|
-
|
|
|
- rrs_duration:that.convertTimeToHoursAndMinutes(ress.data.results.rrs_duration?ress.data.results.rrs_duration.toString():'0'),
|
|
|
- routbed_count_value:ress.data.results.routbed_count_value,
|
|
|
- rsleep_eff_value:ress.data.results.rsleep_eff_value,
|
|
|
- });
|
|
|
-
|
|
|
- that.getDateTimeJsonData(sn?sn:res.data[0].sn);
|
|
|
- // resolve(ress.data); // 请求成功,使用 resolve 返回数据
|
|
|
- console.log('ress.data.results-'+ress.data.results)
|
|
|
- if(!ress.data.results || ress.data.results == ''){
|
|
|
- wx.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '无数据',
|
|
|
- showCancel: false
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- }else{
|
|
|
- wx.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '无数据',
|
|
|
- showCancel: false
|
|
|
- });
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
- }
|
|
|
- console.log("that.data.rdt_arrNew1,that.data.rrh_arrNew1="+that.data.rdt_arrNew+","+that.data.rrh_arrNew);
|
|
|
- console.log("");
|
|
|
- },
|
|
|
- fail: function (error) {
|
|
|
- wx.showToast({
|
|
|
- title: "无数据",
|
|
|
- icon: "error",
|
|
|
- mask: true,
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- // that.startInterval();
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
- }
|
|
|
- },
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
- wx.request({
|
|
|
- url: `${aipushApi}/getha`, //
|
|
|
- method: 'POST',
|
|
|
- // header: {
|
|
|
- // 'content-type': 'application/json', // 默认值
|
|
|
- // 'Authorization': 'Bearer ' + token // 在头部设置认证信息,例如使用Bearer Token
|
|
|
- // },
|
|
|
- data:{
|
|
|
- "locations":hotelcode,"room":(hotelcode && hotelcode.includes('hotel'))?roomcode:"","token":token_push
|
|
|
- },
|
|
|
- success(res) {
|
|
|
- if(!res || !res.data){
|
|
|
- that.setData({
|
|
|
- isLoading: false,
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- var resData = res.data
|
|
|
- console.log('res.data.睡眠报告.ha='+JSON.stringify(resData));
|
|
|
- if (res.data.code == "400") {
|
|
|
- console.error("400错误!");
|
|
|
- return;
|
|
|
- }
|
|
|
- if (res.data.code == "401") {
|
|
|
- console.error("401错误!");
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- homeApi_https = resData.loc;
|
|
|
- token = resData.token;
|
|
|
- },
|
|
|
- fail: function (error) {
|
|
|
- console.error('error', error);
|
|
|
- that.setData({
|
|
|
- isLoading: false,
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- },
|
|
|
- convertTimeToHoursAndMinutes: function(timeWithText,flag) {
|
|
|
- if(!timeWithText) return;
|
|
|
- // 移除'分钟'两个字
|
|
|
- var minutesStr = timeWithText.replace('分钟', '');
|
|
|
- var minutes = parseInt(minutesStr); // 将字符串转换为整数
|
|
|
-
|
|
|
- if (isNaN(minutes)) {
|
|
|
- // 如果转换失败,则可能是输入的不是有效的数字
|
|
|
- console.error('Invalid minutes format');
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- var hours = Math.floor(minutes / 60); // 整除60得到小时数
|
|
|
- var remainingMinutes = minutes % 60; // 取余得到剩余的分钟数
|
|
|
-
|
|
|
- // 如果小时数或分钟数小于10,前面补0
|
|
|
- // var formattedHours = hours < 10 ? '0' + hours : hours;
|
|
|
- var formattedHours = hours;
|
|
|
- // var formattedMinutes = remainingMinutes < 10 ? '0' + remainingMinutes : remainingMinutes;
|
|
|
- var formattedMinutes = remainingMinutes;
|
|
|
-
|
|
|
- // 拼接小时和分钟,形成HH:mm格式
|
|
|
- var formattedTime = '';
|
|
|
- if(flag){
|
|
|
- formattedTime = formattedHours + 'H ' + formattedMinutes + 'M';
|
|
|
- }else{
|
|
|
- formattedTime = formattedHours + '小时' + formattedMinutes;
|
|
|
+ fail: function (error) {
|
|
|
+
|
|
|
+ console.error('error', error);
|
|
|
}
|
|
|
-
|
|
|
- // 更新数据
|
|
|
- // this.setData({
|
|
|
- // formattedTime: formattedTime
|
|
|
- // });
|
|
|
- return formattedTime;
|
|
|
- },
|
|
|
- getDateTimeJsonData: function(sn) {
|
|
|
- var that = this;
|
|
|
- var sourceFourthTemp = [];
|
|
|
- wx.request({
|
|
|
- url: `${aipushApi}/getdatefromsn`, //
|
|
|
- method: 'POST',
|
|
|
- // header: {
|
|
|
- // 'content-type': 'application/json', // 默认值
|
|
|
- // 'Authorization': 'Bearer ' + token // 在头部设置认证信息,例如使用Bearer Token
|
|
|
- // },
|
|
|
- data:{
|
|
|
- "sn":sn,"token":token_push
|
|
|
- },
|
|
|
- success(res) {
|
|
|
- if(!res || !res.data || !res.data.results){
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- var resDataSn = res.data.results
|
|
|
- console.log('resDataSn===='+JSON.stringify(resDataSn))
|
|
|
- var tt = 0;
|
|
|
- resDataSn.forEach(function(item, index) {
|
|
|
- wx.request({
|
|
|
- url: `${aipushApi}/getimefromsn`, //
|
|
|
- method: 'POST',
|
|
|
- // header: {
|
|
|
- // 'content-type': 'application/json', // 默认值
|
|
|
- // 'Authorization': 'Bearer ' + token // 在头部设置认证信息,例如使用Bearer Token
|
|
|
- // },
|
|
|
- data:{
|
|
|
- "sn":sn,"date":item.rdate,"token":token_push
|
|
|
- },
|
|
|
- success(ress) {
|
|
|
- if(!ress || !ress.data || !ress.data.results){
|
|
|
- return;
|
|
|
- }
|
|
|
- var resDataItem = ress.data.results;
|
|
|
- resDataItem.forEach(function(item_item, index) {
|
|
|
- item_item.text = item_item.durations;
|
|
|
- item_item.reportId = item_item.rpids;
|
|
|
});
|
|
|
- var json = {};
|
|
|
- json.text = item.rdate;
|
|
|
- json.children = resDataItem;
|
|
|
- sourceFourthTemp.push(json);
|
|
|
- console.log('sourceFourthTemp0='+JSON.stringify(sourceFourthTemp));
|
|
|
- if (tt == (resDataSn.length - 1)) {
|
|
|
- console.log('sourceFourthTemp='+JSON.stringify(sourceFourthTemp));
|
|
|
-
|
|
|
- // 使用 sort 方法进行排序
|
|
|
- sourceFourthTemp.sort(function(a, b) {
|
|
|
- // 将字符串转换为 Date 对象
|
|
|
- let dateA = new Date(a.text);
|
|
|
- let dateB = new Date(b.text);
|
|
|
- if (dateA < dateB) {
|
|
|
- return 1;
|
|
|
- }
|
|
|
- if (dateA > dateB) {
|
|
|
- return -1;
|
|
|
- }
|
|
|
- // 如果日期相等,返回 0
|
|
|
- return 0;
|
|
|
- });
|
|
|
- console.log('sourceFourthTemp1='+JSON.stringify(sourceFourthTemp));
|
|
|
- //初始化弹出面板
|
|
|
- var array = that.data.arrayFourth;
|
|
|
- array[0] = sourceFourthTemp;
|
|
|
- array[1] = array[0][0].children;
|
|
|
-
|
|
|
- that.setData({
|
|
|
- valueFourth: [0, 0],
|
|
|
- sourceFourth: sourceFourthTemp,
|
|
|
- arrayFourth: array,
|
|
|
- })
|
|
|
- tt = 0;
|
|
|
- }
|
|
|
- tt++
|
|
|
- },
|
|
|
- fail: function (error) {
|
|
|
-
|
|
|
- console.error('error', error);
|
|
|
- }
|
|
|
});
|
|
|
- });
|
|
|
-
|
|
|
- },
|
|
|
- fail: function (error) {
|
|
|
- console.error('error', error);
|
|
|
- } ,
|
|
|
- complete: function (e) {
|
|
|
- }
|
|
|
- });
|
|
|
+
|
|
|
+ },
|
|
|
+ fail: function (error) {
|
|
|
+ console.error('error', error);
|
|
|
+ },
|
|
|
+ complete: function (e) {
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
// 在全局或者组件中定义函数
|
|
|
- fontSize: function(res) {
|
|
|
- const clientWidth = wx.getSystemInfoSync().windowWidth; // 获取屏幕宽度
|
|
|
- if (!clientWidth) return;
|
|
|
- let fontSize = clientWidth / 1920; // 假设以1920为基准宽度
|
|
|
- return res * fontSize;
|
|
|
+ fontSize: function (res) {
|
|
|
+ const clientWidth = wx.getSystemInfoSync().windowWidth; // 获取屏幕宽度
|
|
|
+ if (!clientWidth) return;
|
|
|
+ let fontSize = clientWidth / 1920; // 假设以1920为基准宽度
|
|
|
+ return res * fontSize;
|
|
|
},
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面加载
|
|
|
- */
|
|
|
- onShow: function(options) {
|
|
|
- var that = this;
|
|
|
- console.log("that.data.month + 1", that.data.month + 1)
|
|
|
- var clickDate = String(that.data.year) + String(that.data.month) + String(that.data.date)
|
|
|
- clickDate = String(parseInt(clickDate) + 100)
|
|
|
- // that.getTargetData(clickDate)
|
|
|
- that.setData({
|
|
|
- clickDate: clickDate,
|
|
|
- // ec000: {
|
|
|
- // onInit: that.initChart000
|
|
|
- // },
|
|
|
- ec00: {
|
|
|
- onInit: that.initChart00
|
|
|
- },
|
|
|
- ec0: {
|
|
|
- onInit: that.initChart0
|
|
|
- },
|
|
|
- ec: {
|
|
|
- onInit: that.initChart
|
|
|
- },
|
|
|
- ec1: {
|
|
|
- onInit: that.initChart1
|
|
|
- },
|
|
|
- ec2: {
|
|
|
- onInit: that.initChart2
|
|
|
- },
|
|
|
- ec3: {
|
|
|
- onInit: that.initChart3
|
|
|
- },
|
|
|
- ec4: {
|
|
|
- onInit: that.initChart4
|
|
|
- },
|
|
|
- ec5: {
|
|
|
- onInit: that.initChart5
|
|
|
- },
|
|
|
- ec6: {
|
|
|
- onInit: that.initChart6
|
|
|
- },
|
|
|
- ec7: {
|
|
|
- onInit: that.initChart7
|
|
|
- },
|
|
|
- ec8: {
|
|
|
- onInit: that.initChart8
|
|
|
- },
|
|
|
- ec81: {
|
|
|
- onInit: that.initChart81
|
|
|
- },
|
|
|
- ec9: {
|
|
|
- onInit: that.initChart9
|
|
|
- },
|
|
|
- ec10: {
|
|
|
- onInit: that.initChart10
|
|
|
- },
|
|
|
- ec11: {
|
|
|
- onInit: that.initChart11
|
|
|
- },
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- },
|
|
|
-onLoad(option){
|
|
|
- var that = this;
|
|
|
- console.log("data页面");
|
|
|
- // wx.clearStorage();
|
|
|
- console.log('option.res='+JSON.stringify(wx.getStorageSync('res')));
|
|
|
- if(!wx.getStorageSync('res') || !wx.getStorageSync('res').result){
|
|
|
- wx.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '请先扫描房间二维码',
|
|
|
- showCancel: false
|
|
|
- });
|
|
|
-
|
|
|
- setTimeout(function() {
|
|
|
- wx.reLaunch({
|
|
|
- url: '/pages/scan/scan',
|
|
|
- })
|
|
|
- }, 2000) // 设置延时时间,单位为毫秒
|
|
|
- }else if(wx.getStorageSync('res').result.split('|').length != 2){
|
|
|
- wx.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '房间二维码不正确,请重新扫码',
|
|
|
- showCancel: false
|
|
|
- });
|
|
|
-
|
|
|
- setTimeout(function() {
|
|
|
- wx.reLaunch({
|
|
|
- url: '/pages/scan/scan',
|
|
|
- })
|
|
|
- }, 2000) // 设置延时时间,单位为毫秒
|
|
|
- }else{
|
|
|
- // const expiresAt = wx.getStorageSync('scanResultExpiresAt');
|
|
|
- // const now = Date.now()
|
|
|
- // if (expiresAt || expiresAt < now) {
|
|
|
- // // 扫码结果已过期
|
|
|
- // wx.showToast({
|
|
|
- // title: '扫码结果失效或已过期,请重新扫码',
|
|
|
- // icon: 'none'
|
|
|
- // });
|
|
|
- // // 清除过期的扫码结果
|
|
|
- // wx.removeStorageSync('scanResultExpiresAt');
|
|
|
- // setTimeout(function() {
|
|
|
- // wx.reLaunch({
|
|
|
- // url: '/pages/scan/scan',
|
|
|
- // })
|
|
|
- // }, 2000) // 设置延时时间,单位为毫秒
|
|
|
-
|
|
|
- // }else{
|
|
|
- // //续期
|
|
|
- // wx.setStorageSync('scanResultExpiresAt', Date.now() + 2 * 60 * 60 * 1000)
|
|
|
- // }
|
|
|
-
|
|
|
- let hotelcodeTemp = '';
|
|
|
- let roomcodeTemp = '';
|
|
|
-
|
|
|
- hotelcodeTemp = wx.getStorageSync('res').result.split('|')[0];
|
|
|
- roomcodeTemp = wx.getStorageSync('res').result.split('|')[1];
|
|
|
- this.getData(null,hotelcodeTemp,roomcodeTemp,null);
|
|
|
- // const result = await this.getData();
|
|
|
- // console.log('result='+JSON.stringify(result));
|
|
|
- this.drawProgressCircle();
|
|
|
- // 获取系统信息
|
|
|
- const systemInfo = wx.getSystemInfoSync();
|
|
|
- const windowWidth = systemInfo.windowWidth; // 窗口宽度
|
|
|
-
|
|
|
- // 计算canvas的宽度和高度
|
|
|
- const canvasWidth = windowWidth; // 可以根据需求调整canvas的宽度
|
|
|
- const canvasHeight = windowWidth * 0.5; // 假设高度是宽度的一半,可以根据需求调整
|
|
|
-
|
|
|
-
|
|
|
- // var now = new Date(); // 创建一个Date对象,表示当前的日期和时间
|
|
|
- // var year = now.getFullYear(); // 获取年份
|
|
|
- // var month = now.getMonth() + 1; // 获取月份(注意月份是从0开始的,所以需要+1)
|
|
|
- // var date = now.getDate(); // 获取日期
|
|
|
- // var hours = now.getHours(); // 获取小时
|
|
|
- // var minutes = now.getMinutes(); // 获取分钟
|
|
|
- // var seconds = now.getSeconds(); // 获取秒
|
|
|
-
|
|
|
- // month = month < 10 ? '0' + month : month;
|
|
|
- // date = date < 10 ? '0' + date : date;
|
|
|
- // hours = hours < 10 ? '0' + hours : hours;
|
|
|
- // minutes = minutes < 10 ? '0' + minutes : minutes;
|
|
|
- // seconds = seconds < 10 ? '0' + seconds : seconds;
|
|
|
-
|
|
|
- // // 拼接日期和时间字符串
|
|
|
- // var currentDateTime = year + '-' + month + '-' + date + ' ' + hours + ':' + minutes + ':' + seconds;
|
|
|
-
|
|
|
- // console.log(currentDateTime);
|
|
|
- // var currentDate = year + '-' + month + '-' + date;
|
|
|
- // var currentTime = hours + ':' + minutes + ':' + seconds;
|
|
|
-
|
|
|
- // this.selectComponent('#mychart-dom-bar00').init((canvas, width, height) => {
|
|
|
- // that.initChart00(canvas, width, height)
|
|
|
- // });
|
|
|
-
|
|
|
- // 设置canvas的宽高
|
|
|
- this.setData({
|
|
|
- // currentDate: currentDate,
|
|
|
- // currentTime: currentTime,
|
|
|
- canvasWidth: canvasWidth,
|
|
|
- canvasHeight: canvasHeight,
|
|
|
- hotelcode: hotelcodeTemp,
|
|
|
- roomcode: roomcodeTemp,
|
|
|
-// roomname: wx.getStorageSync('roomname'),
|
|
|
-
|
|
|
- // arrayFourth: array,
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- // else if(!this.data.home_room.includes(wx.getStorageSync('res').result)){
|
|
|
- // wx.showModal({
|
|
|
- // title: '提示',
|
|
|
- // content: '房间二维码不正确,请重新扫描',
|
|
|
- // showCancel: false
|
|
|
- // });
|
|
|
-
|
|
|
- // setTimeout(function() {
|
|
|
- // wx.reLaunch({
|
|
|
- // url: '/pages/scan/scan',
|
|
|
- // })
|
|
|
- // }, 2000) // 设置延时时间,单位为毫秒
|
|
|
-
|
|
|
- // }
|
|
|
- // else if(this.data.home_room.includes(wx.getStorageSync('res').result) && wx.getStorageSync('res').result.includes('辰悦颐养斋')){
|
|
|
- // else if(wx.getStorageSync('res').result.includes('辰悦颐养斋')){
|
|
|
-
|
|
|
- // homeApi = "http://zhh.aidsleep.cn";
|
|
|
- // homeApi_http = "http://zhh.aidsleep.cn";
|
|
|
- // homeApi_http_port = "9123";
|
|
|
- // homeApi_https = "https://zhh.aidsleep.cn";
|
|
|
- // }
|
|
|
-
|
|
|
- this.drawCircle();
|
|
|
-
|
|
|
+ onReady() {
|
|
|
+ var that = this;
|
|
|
+ that.initChartCircle();
|
|
|
+ that.initOutOfBed();
|
|
|
+ that.initBodyMovements();
|
|
|
+ that.initCardiacSystem();
|
|
|
+ that.initChartRespiratory();
|
|
|
+ that.initChartSnoring();
|
|
|
+ that.initChartApnea();
|
|
|
+ that.initTimeWaterfall();
|
|
|
},
|
|
|
-mounted() {
|
|
|
+ /**
|
|
|
+ * 生命周期函数--监听页面加载
|
|
|
+ */
|
|
|
+ onShow: function (options) {
|
|
|
+ const app = getApp();
|
|
|
+ app.globalData.selectedTabIndex = 2;
|
|
|
+ this.getTabBar().setData({
|
|
|
+ selected: 2
|
|
|
+ })
|
|
|
+ var that = this;
|
|
|
+ console.log("that.data.month + 1", that.data.month + 1)
|
|
|
+ var clickDate = String(that.data.year) + String(that.data.month) + String(that.data.date)
|
|
|
+ clickDate = String(parseInt(clickDate) + 100)
|
|
|
+ // that.getTargetData(clickDate)
|
|
|
|
|
|
-},
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面隐藏
|
|
|
- */
|
|
|
- onHide: function() {
|
|
|
- // wx.clearStorage();
|
|
|
- // this.clearInterval();
|
|
|
- },
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面卸载
|
|
|
- */
|
|
|
- onUnload: function() {
|
|
|
- // wx.clearStorage();
|
|
|
- // this.clearInterval();
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 页面相关事件处理函数--监听用户下拉动作
|
|
|
- */
|
|
|
- onPullDownRefresh: function() {
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 页面上拉触底事件的处理函数
|
|
|
- */
|
|
|
- onReachBottom: function() {
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 用户点击右上角分享
|
|
|
- */
|
|
|
- onShareAppMessage: function() {
|
|
|
-
|
|
|
- }
|
|
|
+ that.setData({
|
|
|
+ clickDate: clickDate,
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
+ onLoad(option) {
|
|
|
+ var that = this;
|
|
|
+ console.log("data页面");
|
|
|
+ // wx.clearStorage();
|
|
|
+ console.log('option.res=' + JSON.stringify(wx.getStorageSync('res')));
|
|
|
+ if (!wx.getStorageSync('res') || !wx.getStorageSync('res').result) {
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '请先扫描房间二维码',
|
|
|
+ showCancel: false
|
|
|
+ });
|
|
|
+
|
|
|
+ setTimeout(function () {
|
|
|
+ wx.reLaunch({
|
|
|
+ url: '/pages/scan/scan',
|
|
|
+ })
|
|
|
+ }, 2000) // 设置延时时间,单位为毫秒
|
|
|
+ } else if (wx.getStorageSync('res').result.split('|').length != 2) {
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '房间二维码不正确,请重新扫码',
|
|
|
+ showCancel: false
|
|
|
+ });
|
|
|
+
|
|
|
+ setTimeout(function () {
|
|
|
+ wx.reLaunch({
|
|
|
+ url: '/pages/scan/scan',
|
|
|
+ })
|
|
|
+ }, 2000) // 设置延时时间,单位为毫秒
|
|
|
+ } else {
|
|
|
+ // const expiresAt = wx.getStorageSync('scanResultExpiresAt');
|
|
|
+ // const now = Date.now()
|
|
|
+ // if (expiresAt || expiresAt < now) {
|
|
|
+ // // 扫码结果已过期
|
|
|
+ // wx.showToast({
|
|
|
+ // title: '扫码结果失效或已过期,请重新扫码',
|
|
|
+ // icon: 'none'
|
|
|
+ // });
|
|
|
+ // // 清除过期的扫码结果
|
|
|
+ // wx.removeStorageSync('scanResultExpiresAt');
|
|
|
+ // setTimeout(function() {
|
|
|
+ // wx.reLaunch({
|
|
|
+ // url: '/pages/scan/scan',
|
|
|
+ // })
|
|
|
+ // }, 2000) // 设置延时时间,单位为毫秒
|
|
|
+
|
|
|
+ // }else{
|
|
|
+ // //续期
|
|
|
+ // wx.setStorageSync('scanResultExpiresAt', Date.now() + 2 * 60 * 60 * 1000)
|
|
|
+ // }
|
|
|
+
|
|
|
+ let hotelcodeTemp = '';
|
|
|
+ let roomcodeTemp = '';
|
|
|
+
|
|
|
+ hotelcodeTemp = wx.getStorageSync('res').result.split('|')[0];
|
|
|
+ roomcodeTemp = wx.getStorageSync('res').result.split('|')[1];
|
|
|
+ this.getData(null, hotelcodeTemp, roomcodeTemp, null);
|
|
|
+ // const result = await this.getData();
|
|
|
+ // console.log('result='+JSON.stringify(result));
|
|
|
+ this.drawProgressCircle();
|
|
|
+ // 获取系统信息
|
|
|
+ const systemInfo = wx.getSystemInfoSync();
|
|
|
+ const windowWidth = systemInfo.windowWidth; // 窗口宽度
|
|
|
+
|
|
|
+ // 计算canvas的宽度和高度
|
|
|
+ const canvasWidth = windowWidth; // 可以根据需求调整canvas的宽度
|
|
|
+ const canvasHeight = windowWidth * 0.5; // 假设高度是宽度的一半,可以根据需求调整
|
|
|
+
|
|
|
+
|
|
|
+ // var now = new Date(); // 创建一个Date对象,表示当前的日期和时间
|
|
|
+ // var year = now.getFullYear(); // 获取年份
|
|
|
+ // var month = now.getMonth() + 1; // 获取月份(注意月份是从0开始的,所以需要+1)
|
|
|
+ // var date = now.getDate(); // 获取日期
|
|
|
+ // var hours = now.getHours(); // 获取小时
|
|
|
+ // var minutes = now.getMinutes(); // 获取分钟
|
|
|
+ // var seconds = now.getSeconds(); // 获取秒
|
|
|
+
|
|
|
+ // month = month < 10 ? '0' + month : month;
|
|
|
+ // date = date < 10 ? '0' + date : date;
|
|
|
+ // hours = hours < 10 ? '0' + hours : hours;
|
|
|
+ // minutes = minutes < 10 ? '0' + minutes : minutes;
|
|
|
+ // seconds = seconds < 10 ? '0' + seconds : seconds;
|
|
|
+
|
|
|
+ // // 拼接日期和时间字符串
|
|
|
+ // var currentDateTime = year + '-' + month + '-' + date + ' ' + hours + ':' + minutes + ':' + seconds;
|
|
|
+
|
|
|
+ // console.log(currentDateTime);
|
|
|
+ // var currentDate = year + '-' + month + '-' + date;
|
|
|
+ // var currentTime = hours + ':' + minutes + ':' + seconds;
|
|
|
+
|
|
|
+ // this.selectComponent('#mychart-dom-bar00').init((canvas, width, height) => {
|
|
|
+ // that.initChart00(canvas, width, height)
|
|
|
+ // });
|
|
|
+
|
|
|
+ // 设置canvas的宽高
|
|
|
+ this.setData({
|
|
|
+ // currentDate: currentDate,
|
|
|
+ // currentTime: currentTime,
|
|
|
+ canvasWidth: canvasWidth,
|
|
|
+ canvasHeight: canvasHeight,
|
|
|
+ hotelcode: hotelcodeTemp,
|
|
|
+ roomcode: roomcodeTemp,
|
|
|
+ // roomname: wx.getStorageSync('roomname'),
|
|
|
+
|
|
|
+ // arrayFourth: array,
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // else if(!this.data.home_room.includes(wx.getStorageSync('res').result)){
|
|
|
+ // wx.showModal({
|
|
|
+ // title: '提示',
|
|
|
+ // content: '房间二维码不正确,请重新扫描',
|
|
|
+ // showCancel: false
|
|
|
+ // });
|
|
|
+
|
|
|
+ // setTimeout(function() {
|
|
|
+ // wx.reLaunch({
|
|
|
+ // url: '/pages/scan/scan',
|
|
|
+ // })
|
|
|
+ // }, 2000) // 设置延时时间,单位为毫秒
|
|
|
+
|
|
|
+ // }
|
|
|
+ // else if(this.data.home_room.includes(wx.getStorageSync('res').result) && wx.getStorageSync('res').result.includes('辰悦颐养斋')){
|
|
|
+ // else if(wx.getStorageSync('res').result.includes('辰悦颐养斋')){
|
|
|
+
|
|
|
+ // homeApi = "http://zhh.aidsleep.cn";
|
|
|
+ // homeApi_http = "http://zhh.aidsleep.cn";
|
|
|
+ // homeApi_http_port = "9123";
|
|
|
+ // homeApi_https = "https://zhh.aidsleep.cn";
|
|
|
+ // }
|
|
|
+
|
|
|
+ this.drawCircle();
|
|
|
+
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 生命周期函数--监听页面隐藏
|
|
|
+ */
|
|
|
+ onHide: function () {
|
|
|
+ // wx.clearStorage();
|
|
|
+ // this.clearInterval();
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 生命周期函数--监听页面卸载
|
|
|
+ */
|
|
|
+ onUnload: function () {
|
|
|
+ // wx.clearStorage();
|
|
|
+ // this.clearInterval();
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 页面相关事件处理函数--监听用户下拉动作
|
|
|
+ */
|
|
|
+ onPullDownRefresh: function () {
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 页面上拉触底事件的处理函数
|
|
|
+ */
|
|
|
+ onReachBottom: function () {
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 用户点击右上角分享
|
|
|
+ */
|
|
|
+ onShareAppMessage: function () {
|
|
|
+
|
|
|
+ }
|
|
|
})
|