|
|
@@ -2,7 +2,7 @@ |
|
|
|
|
|
|
|
<template> |
|
|
|
<div class="report "> |
|
|
|
<NavBar title="周报" @on-click-left="onNavBack" right-text=""> </NavBar> |
|
|
|
<NavBar :title="navTitle" @on-click-left="onNavBack" right-text=""> </NavBar> |
|
|
|
<!-- 日期切换 --> |
|
|
|
<div class="periodSwitch"> |
|
|
|
<div class="arrow arrowLeft"> |
|
|
@@ -107,10 +107,10 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import axios from 'axios'; |
|
|
|
import NavBar from '@/components/NavBar'; |
|
|
|
import { Signsmodel } from '@/config/models'; |
|
|
|
import EchartBox from '@/components/EchartBox'; |
|
|
|
import { getMonthsByYear, getWeeksByYear } from '@/services/utils-service'; |
|
|
|
export default { |
|
|
|
components: { |
|
|
|
NavBar, EchartBox |
|
|
@@ -126,8 +126,8 @@ export default { |
|
|
|
currentRecord: {}, |
|
|
|
psyCurrent: 0, |
|
|
|
psyList: [ |
|
|
|
{ name: 'temperature', text: '体温', value: 1 }, |
|
|
|
{ name: 'heartrate', text: '心率', value: 0 }, |
|
|
|
{ name: 'temperature', text: '体温', value: 1 }, |
|
|
|
{ name: 'step', text: '步数', value: 2 } |
|
|
|
], |
|
|
|
healthyType: '', |
|
|
@@ -389,6 +389,9 @@ export default { |
|
|
|
}, |
|
|
|
surveyTitle() { |
|
|
|
return this.params.dateType == 0 ? '本周概览' : '本月概览' |
|
|
|
}, |
|
|
|
navTitle() { |
|
|
|
return this.params.dateType == 0 ? '周报详情' : '月报详情' |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
@@ -398,7 +401,12 @@ export default { |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
this.$nextTick(() => { |
|
|
|
this.getWeekResult() |
|
|
|
if (this.params.dateType == 1) { |
|
|
|
this.getMonths(); |
|
|
|
} else { |
|
|
|
this.getWeeks() |
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
}, |
|
|
|
methods: { |
|
|
@@ -407,6 +415,7 @@ export default { |
|
|
|
if (params) { |
|
|
|
this.params = params; |
|
|
|
this.emoName = Signsmodel[params.name].name; |
|
|
|
this.psyCurrent = this.calcPsyTabindex(Signsmodel[params.name].type); |
|
|
|
this.currentEmoName = params.name; |
|
|
|
} |
|
|
|
}, |
|
|
@@ -456,9 +465,11 @@ export default { |
|
|
|
} |
|
|
|
this.count--; |
|
|
|
this.isPreClick = true; |
|
|
|
|
|
|
|
this.currentRecord = this.weekList.filter(item => { |
|
|
|
return item.count === this.count; |
|
|
|
})[0]; |
|
|
|
// 注意,周/月切换,日期不同 |
|
|
|
let date = this.weekList.filter(item => { |
|
|
|
return item.count === this.count; |
|
|
|
})[0].name; |
|
|
@@ -474,6 +485,7 @@ export default { |
|
|
|
this.count++; |
|
|
|
this.isAddClick = true; |
|
|
|
// 当前切换的日期 |
|
|
|
// 注意,周/月切换,日期不同 |
|
|
|
let date = this.weekList.filter(item => { |
|
|
|
return item.count === this.count; |
|
|
|
})[0].name; |
|
|
@@ -486,41 +498,6 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
getWeekResult() { |
|
|
|
let baseUrl = |
|
|
|
process.env.NODE_ENV === 'production' ? 'https://dbmq.rzliot.com/auth_heart' : 'https://dbmq.rzliot.com/heart'; |
|
|
|
let reqUrl = `${baseUrl}/api/Data/GetWeekResult`; |
|
|
|
let reqParams = { |
|
|
|
uid: this.$store.getters.uid, |
|
|
|
type: 1 |
|
|
|
}; |
|
|
|
axios |
|
|
|
.get(reqUrl, { |
|
|
|
params: { ...reqParams } |
|
|
|
/* headers: { 'AccessToken': this.$store.getters.ssjlToken } */ |
|
|
|
}) |
|
|
|
.then(res => { |
|
|
|
console.log('res', res); |
|
|
|
const data = res.data.response; |
|
|
|
this.weekList = data.reverse() |
|
|
|
.map((item, index) => { |
|
|
|
return { |
|
|
|
name: item.Name.replace('周报', '').replace(/-/g, '.').replace(/~/g, '-'), |
|
|
|
recordId: item.RecordId, |
|
|
|
summary: item.Summary, |
|
|
|
summaryLevel: item.SummaryLevel, |
|
|
|
count: index |
|
|
|
}; |
|
|
|
}) |
|
|
|
|
|
|
|
this.currentRecord = this.weekList[0]; |
|
|
|
this.count = 0; |
|
|
|
this.maxCount = data.length - 1; |
|
|
|
this.isAddClick = this.maxCount - this.count < this.maxCount; |
|
|
|
this.isPreClick = this.maxCount - this.count > 0; |
|
|
|
console.log("weekList", this.weekList, this.count); |
|
|
|
}); |
|
|
|
}, |
|
|
|
onPsyTabClick(item) { |
|
|
|
this.healthyType = item.value; |
|
|
|
this.psyCurrent = this.calcPsyTabindex(Signsmodel[item.name].type); |
|
|
@@ -531,10 +508,10 @@ export default { |
|
|
|
let psyIndex = ''; |
|
|
|
switch (type) { |
|
|
|
case 0: |
|
|
|
psyIndex = 1; |
|
|
|
psyIndex = 0; |
|
|
|
break; |
|
|
|
case 1: |
|
|
|
psyIndex = 0; |
|
|
|
psyIndex = 1; |
|
|
|
break; |
|
|
|
case 2: |
|
|
|
psyIndex = 2; |
|
|
@@ -551,6 +528,43 @@ export default { |
|
|
|
this.pieEcharts = this.$echarts.init(this.$refs.pieChart); |
|
|
|
this.pieEcharts.setOption(this.pieOption); |
|
|
|
}, |
|
|
|
getMonths() { |
|
|
|
const months = getMonthsByYear(2); |
|
|
|
console.log("months", months); |
|
|
|
this.weekList = months.reverse() |
|
|
|
.map((item, index) => { |
|
|
|
return { |
|
|
|
name: item.curYear + '-' + item.curMonth, |
|
|
|
count: index |
|
|
|
}; |
|
|
|
}) |
|
|
|
this.currentRecord = this.weekList.filter(item => { |
|
|
|
return item.count === this.count; |
|
|
|
})[0]; |
|
|
|
this.count = 0; |
|
|
|
this.maxCount = months.length - 1; |
|
|
|
this.isAddClick = this.maxCount - this.count < this.maxCount; |
|
|
|
this.isPreClick = this.maxCount - this.count > 0; |
|
|
|
}, |
|
|
|
getWeeks() { |
|
|
|
const weeks = getWeeksByYear(1); |
|
|
|
console.log("week", weeks); |
|
|
|
this.weekList = weeks.reverse() |
|
|
|
.map((item, index) => { |
|
|
|
return { |
|
|
|
|
|
|
|
name: item.start + '-' + item.end, |
|
|
|
count: index |
|
|
|
}; |
|
|
|
}) |
|
|
|
this.currentRecord = this.weekList.filter(item => { |
|
|
|
return item.count === this.count; |
|
|
|
})[0]; |
|
|
|
this.count = 0; |
|
|
|
this.maxCount = weeks.length - 1; |
|
|
|
this.isAddClick = this.maxCount - this.count < this.maxCount; |
|
|
|
this.isPreClick = this.maxCount - this.count > 0; |
|
|
|
} |
|
|
|
}, |
|
|
|
} |
|
|
|
</script> |
|
|
|