天波h5前端应用
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2251 lines
70KB

  1. <template>
  2. <div class="psychological-container">
  3. <van-nav-bar :title="emoName + '监测'" :border="true" :left-arrow="true" @click-left="onNavBack" v-if="isShowLeft">
  4. <template #left>
  5. <van-icon name="arrow-left" size="24" style="padding: 0" />
  6. <span>返回</span>
  7. </template>
  8. </van-nav-bar>
  9. <div class="tab-bar" v-if="isshowTab">
  10. <div class="date-tab-con">
  11. <div class="date-tab-list">
  12. <div :class="[
  13. 'date-tab-item',
  14. { active: current === index, notClick: false },
  15. ]" @click="onTabClick(item.value, index)" v-for="(item, index) in dateList" :key="index">
  16. <img :src="tabImgUrl" alt v-if="index == 3" />
  17. <span>{{ item.text }}</span>
  18. <img class="more" :src="selectDownImg" alt v-if="index == 3" />
  19. </div>
  20. </div>
  21. </div>
  22. </div>
  23. <div class="main" v-show="current !== 3">
  24. <div class="top">
  25. <!-- 日期选择 -->
  26. <!-- 标题 -->
  27. <div class="title">
  28. <div class="title-left">
  29. {{ titleLeft }}<van-icon name="question-o" @click="onHelp" />
  30. </div>
  31. <div class="title-right" v-show="currentDays === 0">
  32. <p @click="onHistory">历史监测</p>
  33. </div>
  34. </div>
  35. <!-- 日历 -->
  36. <van-dialog class="calenddar-dialog" v-model="calendarDialogShow" :show-confirm-button="false"
  37. :show-cancle-button="false" :close-on-click-overlay="true" ref="calenddarDialog">
  38. <template #default>
  39. <div class="calendar" ref="calendarCon">
  40. <van-calendar v-model="calendarShow" :min-date="minDate" :max-date="maxDate" :default-date="defaultDate"
  41. :round="false" :poppable="false" color="#62BD48" :show-confirm="false" :show-title="false"
  42. :show-subtitle="false" :formatter="formatter" @select="onSelect" />
  43. </div>
  44. </template>
  45. </van-dialog>
  46. <!-- 监测次数 -->
  47. <div class="monitoring-count">
  48. <p>监测次数:{{ monitoringCount || "0" }}次</p>
  49. </div>
  50. <!-- 折线图-非日报 -->
  51. <div class="pie-chart-con">
  52. <div class="pie-chart-left">
  53. <div id="pieChartDay" ref="pieChartDay"></div>
  54. </div>
  55. <div class="pie-chart-right">
  56. <div class="list">
  57. <div class="item" v-for="(item, index) in pieRightList" :key="index">
  58. <div class="item-left">
  59. <div class="circle" :style="{ backgroundColor: item.color }"></div>
  60. <span class="text">{{ item.text || "--" }}</span>
  61. </div>
  62. <div class="item-right">
  63. <span :style="{ color: item.color }">{{
  64. item.count ? item.count + "次" : "0次"
  65. }}</span>
  66. <label :style="{ color: item.color }">{{
  67. item.percentage ? "(" + item.percentage + "%" + ")" : "(0%)"
  68. }}</label>
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. <!-- 统计 -->
  75. <div class="statistics">
  76. <div class="list">
  77. <div class="item" v-for="(item, index) in statisticsList" :key="index">
  78. <div class="top">
  79. <span>{{ item.label || "--" }}</span>
  80. </div>
  81. <div class="middle">
  82. <span :style="{ color: calcResultColor(item.level) }">{{
  83. item.value || "--"
  84. }}</span>
  85. </div>
  86. <div class="bottom">
  87. <span>{{ item.time || "--" }}</span>
  88. </div>
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. <!-- 分割线 -->
  94. <div class="line"></div>
  95. <!-- 底部 -->
  96. <!-- 情绪切换 -->
  97. <div class="psy-tab-bar">
  98. <div class="psy-tab-con">
  99. <div class="psy-tab-list">
  100. <div :class="[
  101. 'psy-tab-item',
  102. { active: psyCurrent === index, notClick: false },
  103. ]" @click="onPsyTabClick(item.name, index)" v-for="(item, index) in psyList" :key="index">
  104. <span>{{ item.text }}</span>
  105. </div>
  106. </div>
  107. </div>
  108. </div>
  109. <div class="bottom">
  110. <div class="echart-container">
  111. <div class="echart" ref="dayCharts"></div>
  112. </div>
  113. <div class="line-gray"></div>
  114. <div class="result" v-if="monitoringCount == ''">
  115. <div class="result-con">
  116. <div class="title">
  117. <span class="title-no-data">结果解读</span>
  118. <div class="no-data">
  119. <img src="../../../../assets/img/no_data_01.png" alt />
  120. <p>暂无数据</p>
  121. </div>
  122. </div>
  123. </div>
  124. </div>
  125. <div class="result" v-else>
  126. <div class="result-con reminder" v-show="current === 0">
  127. <div class="title">
  128. <span class="title-reminder">结果解读</span>
  129. <p class="title-emo" :style="{ color: currentColor }">
  130. {{ this.$replaceAll(result, '抑郁', '忧郁') }}
  131. </p>
  132. <span class="font-28"><!-- 继续保持积极乐观,培养健康的生活习惯,预防消极事件对情绪带来的不良影响。 -->{{
  133. advice
  134. }}</span>
  135. </div>
  136. <div class="friendly-reminder" v-if="emoType === 2">
  137. <p :style="{ color: currentColor }">友情提示:</p>
  138. <span>如果您发现{{ anxietyText }}倾向分值升高或处于轻度水平,不需要过度紧张,这可能是由正常的情绪波动或者生活习惯(睡眠时间、运动量等)的改变造成的。如果您发现{{ anxietyText
  139. }}倾向分值连续7天及以上处于中度或重度水平,建议您寻求家人朋友或心理咨询师的帮助,及早进行干预。</span>
  140. </div>
  141. <div class="warm-reminder">
  142. <p :style="{ color: currentColor }">温馨提示:</p>
  143. <span>{{ warmTips }}</span>
  144. </div>
  145. </div>
  146. <div class="result-con" v-show="current > 0">
  147. <div class="title">
  148. <span class="title-text">{{ surveyTitle }}</span>
  149. <div class="mood-list" v-if="emotionList.length > 0">
  150. <div class="item" v-for="(item, index) in emotionList" :key="index">
  151. <p>
  152. <span :style="{ color: item.color }" class="day">{{
  153. item.days
  154. }}</span>
  155. <span class="day-text">天</span>
  156. </p>
  157. <p>{{ item.text }}</p>
  158. </div>
  159. </div>
  160. <div class="mood-list-no-data" v-else>
  161. <div class="no-data">
  162. <img src="../../../../assets/img/no_data_01.png" alt />
  163. <p>暂无数据</p>
  164. </div>
  165. </div>
  166. </div>
  167. </div>
  168. </div>
  169. <!-- -->
  170. </div>
  171. </div>
  172. <!-- 周报菜单 -->
  173. <div class="main-details" :class="{hideNav:!isShowLeft,hideTab:!isshowTab,hideNavTab:!isShowLeft && !isshowTab}" v-show="current == 3">
  174. <div class="report-details">
  175. <div class="overall-rating">
  176. <div class="con">
  177. <p class="space-between">
  178. <span class="bold">本周总评</span>
  179. <span class="time">{{
  180. resetDate(weekResult.StartDate, weekResult.EndDate) || "--"
  181. }}</span>
  182. </p>
  183. <p class="bold-pro" :style="{ color: calcResultColor(weekResult.SummaryLevel) || '--' }">
  184. {{ weekResult.Summary }}
  185. </p>
  186. <p class="normal">监测次数: {{ weekResult.Total || "--" }}次</p>
  187. <p class="normal">{{ weekResult.Explain || "--" }}</p>
  188. </div>
  189. </div>
  190. <!-- <div class="line"></div> -->
  191. <!-- 情绪切换 -->
  192. <div class="psy-tab-bar">
  193. <div class="psy-tab-con">
  194. <div class="psy-tab-list">
  195. <div :class="[
  196. 'psy-tab-item',
  197. { active: psyCurrent === index, notClick: false },
  198. ]" @click="onPsyTabClick(item.name, index)" v-for="(item, index) in psyList" :key="index">
  199. <span>{{ item.text }}</span>
  200. </div>
  201. </div>
  202. </div>
  203. </div>
  204. <div class="pie-chart-top">
  205. <p class="bold">上周趋势对比</p>
  206. <p>{{ resetDate(weekResult.StartDate, weekResult.EndDate) || "--" }}</p>
  207. </div>
  208. <div class="count">
  209. <p>监测次数:{{ weekResult.LastTotal || "--" }}次</p>
  210. </div>
  211. <!-- 趋势对比-饼状图 -->
  212. <div class="pie-chart-con">
  213. <div class="pie-chart-left">
  214. <div id="pieChart" ref="pieChart"></div>
  215. </div>
  216. <div class="pie-chart-right">
  217. <div class="list">
  218. <div class="item" v-for="(item, index) in pieRightList" :key="index">
  219. <div class="item-left">
  220. <div class="circle" :style="{ backgroundColor: item.color }"></div>
  221. <span class="text">{{ item.text || "--" }}</span>
  222. </div>
  223. <div class="item-right">
  224. <span :style="{ color: item.color }">{{
  225. item.count ? item.count + "次" : "0次"
  226. }}</span>
  227. <label :style="{ color: item.color }">{{
  228. item.percentage ? "(" + item.percentage + "%" + ")" : "(0%)"
  229. }}</label>
  230. </div>
  231. <div class="status" v-if="isShowCompare">
  232. <img :src="calcImg(item.percentage, item.lastPercentage)" alt="" />
  233. <span :style="{
  234. color:
  235. calcImg(item.percentage, item.lastPercentage, true) != 0
  236. ? item.color
  237. : '',
  238. }">{{
  239. calcImg(item.percentage, item.lastPercentage, true)
  240. ? Math.abs(
  241. calcImg(item.percentage, item.lastPercentage, true)
  242. ) + "%"
  243. : "持平"
  244. }}</span>
  245. </div>
  246. </div>
  247. </div>
  248. </div>
  249. </div>
  250. <div class="statistics">
  251. <div class="list">
  252. <div class="item" v-for="(item, index) in statisticsList" :key="index">
  253. <div class="top">
  254. <span>{{ item.label || "--" }}</span>
  255. </div>
  256. <div class="middle">
  257. <span :style="{ color: calcResultColor(item.level) }">{{
  258. item.value || "--"
  259. }}</span>
  260. </div>
  261. <div class="bottom">
  262. <span>{{ item.time || "--" }}</span>
  263. </div>
  264. </div>
  265. </div>
  266. </div>
  267. <div class="line"></div>
  268. <!-- 数据图-柱形图 -->
  269. <div class="bar-chart">
  270. <div class="echart" ref="charts"></div>
  271. </div>
  272. <div class="line"></div>
  273. <!-- 建议 -->
  274. <div class="advice">
  275. <div class="content">
  276. <p class="title">健康建议</p>
  277. <p>{{ weekResult.Advice || "--" }}</p>
  278. </div>
  279. </div>
  280. <!-- 概览 -->
  281. <div class="overview">
  282. <div class="content">
  283. <div class="title">
  284. <span class="title-text">{{ surveyTitle }}</span>
  285. <div class="mood-list">
  286. <div class="item" v-for="(item, index) in emotionList" :key="index">
  287. <p>
  288. <span :style="{ color: item.color }" class="day">{{
  289. item.days
  290. }}</span>
  291. <span class="day-text">天</span>
  292. <img :src="calcWeekImg(item.days, item.lastDay)" alt="" v-if="isShowCompare" />
  293. <span class="day-text status" v-if="isShowCompare">{{
  294. calcWeekImg(item.days, item.lastDay, true)
  295. }}</span>
  296. </p>
  297. <p>{{ item.text }}</p>
  298. </div>
  299. </div>
  300. </div>
  301. </div>
  302. </div>
  303. </div>
  304. </div>
  305. <!-- 弹出层 -->
  306. <van-popup v-model="isPopup">
  307. <div class="popup">
  308. <div class="item science-tips first" v-if="emoType === 2">
  309. <div class="tips">
  310. <h5>小科普</h5>
  311. </div>
  312. <p>
  313. {{ anxietyText }}症是一种心理疾病,严重时可发展为精神障碍。然而当我们体会到了痛苦、悲伤、和郁闷等负面情绪,并不意味着我们就是{{ anxietyText
  314. }}症。日常的短时的喜、怒、哀、乐,都是正常的情绪变化,然而长期的低落情绪、兴趣缺失等可能会让我们有{{ anxietyText }}的风险。
  315. </p>
  316. </div>
  317. <div class="item">
  318. <h5 v-html="title1"></h5>
  319. <div v-html="article1"></div>
  320. </div>
  321. <div class="item">
  322. <h5 v-html="title2"></h5>
  323. <div v-html="article2"></div>
  324. </div>
  325. <van-button size="large" @click="onClose">返回</van-button>
  326. </div>
  327. </van-popup>
  328. </div>
  329. </template>
  330. <script>
  331. import { EmotionModel, PsyBaseUrl, } from "@/config/models";
  332. import axios from "axios";
  333. import { anxietyText } from "@/config/models";
  334. import { isNotNull } from "@/utils/index";
  335. import APICore from "@/api/core";
  336. export default {
  337. name: "psychological-monitor",
  338. data() {
  339. return {
  340. isShowLeft:true,
  341. isshowTab:true,
  342. // 日期选择标签
  343. dateList: [
  344. { name: "today", text: "今天", value: 0 },
  345. { name: "week", text: "前7天", value: 7 },
  346. { name: "month", text: "前30天", value: 30 },
  347. { name: "weekReport", text: "周报", value: 49 },
  348. ],
  349. // 情绪tab
  350. psyList: [
  351. { name: "tiredness", text: "疲劳", value: 0 },
  352. { name: "stress", text: "压力", value: 1 },
  353. { name: "depression", text: this.$replaceAll('抑郁', '抑郁', '忧郁'), value: 2 },
  354. ],
  355. // 当前情绪下标
  356. psyCurrent: 0,
  357. current: 0, // 日期选择标签-当前选中的标签
  358. currentDays: 0, //日期选择标签-日期参数
  359. emotionData: [], //情绪数据,TODO 接口对接
  360. echarts: null, //折线图
  361. itemHeight: Number(((document.body.clientWidth / 750) * 95).toFixed()), // 日历组件item高度
  362. xAxisData: [], //图表x轴展示的数据
  363. monitoringCount: "", //监测次数
  364. pieEcharts: null, //饼状图
  365. pieData: [], //饼状图数据
  366. //饼状图右边数据,TODO 根据接口数据和 模块 重新封装数组
  367. pieRightList: [
  368. /* {
  369. text: "无情绪倾向",
  370. count: 12,
  371. percentage: "80",
  372. color: "#62BD48"
  373. },
  374. {
  375. text: "轻度情绪倾向",
  376. count: 2,
  377. percentage: "80",
  378. color: "#ffde00"
  379. },
  380. {
  381. text: "中度情绪倾向",
  382. count: 1,
  383. percentage: "80",
  384. color: "#ff8a00"
  385. },
  386. {
  387. text: "重度情绪倾向",
  388. count: 1,
  389. percentage: "80",
  390. color: "#d70d0d"
  391. } */
  392. ],
  393. // 情绪状态列表
  394. statisticsList: [
  395. /* { label: "最大值", value: "75", time: "08:15" },
  396. { label: "最小值", value: "40", time: "10:15" },
  397. { label: "最近值", value: "50", time: "18:15" } */
  398. ],
  399. // 周报-情绪计算
  400. emotionList: [
  401. /* { days: "5", text: "无情绪倾向", color: "#62BD48" },
  402. { days: "4", text: "轻度情绪倾向", color: "#ffde00" },
  403. { days: "3", text: "中度情绪倾向", color: "#ff8a00" },
  404. { days: "2", text: "重度情绪倾向", color: "#ACACAC" } */
  405. ],
  406. // 弹窗-日历是否显示
  407. calendarDialogShow: false,
  408. // 日历是否显示,默认为true
  409. calendarShow: true,
  410. // 日历 默认最小可选择日期,默认为最近1个月
  411. minDate: new Date(
  412. this.$dayjs()
  413. .month(this.$dayjs().month() - 1)
  414. .hour(0)
  415. .minute(0)
  416. .second(0)
  417. .format()
  418. ),
  419. // 日历 默认最小可选择日期,默认为当前时间
  420. maxDate: new Date(this.$dayjs().hour(0).minute(0).second(0).format()),
  421. // 默认日历日期时间
  422. defaultDate: new Date(this.$dayjs().hour(0).minute(0).second(0).format()),
  423. // 路由传过来的情绪参数
  424. emoName: "",
  425. // 默认折线图 Series 配置
  426. defaultSeries: null,
  427. // 非日报折线图 Series 配置
  428. weekAndMonthSeries: null,
  429. // 当前情绪类型
  430. emoType: "",
  431. // 结果解读
  432. result: "",
  433. // 需要高亮的日期数组
  434. highlightDates: [],
  435. // 选中的日历日期
  436. selectDate: "",
  437. uid: "",
  438. // 建议
  439. advice: "",
  440. // 底部天数标题
  441. surveyTitle: "" || "7天概览",
  442. // 路由中的日期
  443. routeDate: "",
  444. // 路由参数
  445. params: {},
  446. // 是否显示帮助
  447. isPopup: false,
  448. // 结果等级
  449. resultLevel: "",
  450. // 轻度级别颜色
  451. mildColor: "#ffde00",
  452. // 中度级别颜色
  453. severeColor: "#ff8a00",
  454. // 重度级别颜色
  455. moderateColor: "#d70d0d",
  456. // 7天和30天最大数据列表
  457. weekAndMonData: [],
  458. tabImgUrl: require("@/assets/img/psychological/statistical_form.png"),
  459. selectDownImg: require("@/assets/img/psychological/select_down.png"),
  460. weekImg: require("@/assets/img/psychological/week_report.png"),
  461. moreImg: require("@/assets/img/psychological/more.png"),
  462. noDataImg: require("@/assets/img/no_data_01.png"),
  463. weekList: [],
  464. startDate: "", //接口需要的开始时间
  465. endDate: "", //接口需要的结束时间
  466. currentEmoName: "", //当前情绪名称
  467. weekResultList: [], //周报新详情周报列表
  468. weekResult: {},
  469. isShowCompare: null, //是否显示周对比
  470. pieDayEcharts: null, //非周报饼状图
  471. pieDayData: [], //非周报饼状图
  472. dayEcharts: null
  473. };
  474. },
  475. computed: {
  476. // 页面类型,0 保持不动,1显示方式为新页面显示方式
  477. pageType() {
  478. return Number(this.$route.query.pageType) || 0
  479. },
  480. anxietyText() {
  481. const appTypeList = ['1'];
  482. return appTypeList.indexOf(this.$store.getters.appType) > -1 ? `忧郁` : `抑郁`
  483. },
  484. // 默认折线图配置,echarts 具体配置 见 https://echarts.apache.org/zh/option.html#title
  485. defaultOptions() {
  486. return {
  487. time: {
  488. useUTC: false,
  489. },
  490. title: {
  491. text: this.echartsTitle,
  492. left: 1,
  493. right: 25,
  494. bottom: 20,
  495. top: "3%",
  496. textStyle: {
  497. fontSize: 16,
  498. fontWeight: "bold",
  499. },
  500. },
  501. legend: {
  502. width: "65%",
  503. orient: "horizontal",
  504. right: "5%",
  505. top: 1,
  506. bottom: "1%",
  507. itemHeight: 12,
  508. itemWidth: 12,
  509. itemGap: 10,
  510. align: "left",
  511. selectedMode: false,
  512. data: [
  513. {
  514. name: `无${this.emoName}倾向`,
  515. icon: "rect",
  516. itemStyle: {
  517. color: "#62BD48",
  518. },
  519. textStyle: {
  520. fontSize: 12,
  521. },
  522. },
  523. {
  524. name: `轻度${this.emoName}倾向`,
  525. icon: "rect",
  526. itemStyle: {
  527. color: "#ffde00",
  528. },
  529. textStyle: {
  530. fontSize: 12,
  531. },
  532. },
  533. {
  534. name: `中度${this.emoName}倾向`,
  535. itemStyle: {
  536. color: "#ff8a00",
  537. },
  538. icon: "rect",
  539. textStyle: {
  540. fontSize: 12,
  541. },
  542. },
  543. {
  544. name: `重度${this.emoName}倾向`,
  545. itemStyle: {
  546. color: "#d70d0d",
  547. },
  548. icon: "rect",
  549. textStyle: {
  550. fontSize: 12,
  551. },
  552. },
  553. ],
  554. formatter: function (name) {
  555. // 自定义显示内容
  556. if (name.length > 6) {
  557. return name.substring(0, 6) + "\n" + name.substring(6);
  558. } else {
  559. return name;
  560. }
  561. },
  562. },
  563. grid: {
  564. show: true,
  565. borderWidth: 1,
  566. top: "20%",
  567. left: "1%",
  568. right: "5%",
  569. bottom: "10%",
  570. containLabel: true,
  571. },
  572. xAxis: {
  573. type: "category",
  574. axisLine: {
  575. show: false,
  576. },
  577. textStyle: {
  578. fontSize: 10,
  579. },
  580. axisTick: {
  581. show: false,
  582. },
  583. splitLine: {
  584. show: false,
  585. lineStyle: {
  586. color: "#ddd",
  587. width: 2,
  588. },
  589. },
  590. nameLocation: "center",
  591. axisLabel: {
  592. show: true,
  593. fontSize: 12,
  594. showMinLabel: true, //显示最小值
  595. showMaxLabel: true, //显示最大值
  596. },
  597. data: this.xAxisData,
  598. },
  599. dataZoom: [
  600. /* {
  601. type: "inside",
  602. start: 0,
  603. end: 100,
  604. }, */
  605. {
  606. start: 0,
  607. end: 100,
  608. textStyle: {
  609. color: "#FFF",
  610. fontSize: 14,
  611. },
  612. show: true,
  613. height: 15,
  614. bottom: 5,
  615. handleStyle: {
  616. borderWidth: 1,
  617. borderCap: "square",
  618. },
  619. },
  620. ],
  621. tooltip: {
  622. trigger: "axis",
  623. textStyle: {
  624. fontSize: 14,
  625. align: "center",
  626. },
  627. formatter: function (params) {
  628. return (
  629. params[0].marker +
  630. params[0].name +
  631. "--" +
  632. params[0].value +
  633. "</br>"
  634. );
  635. },
  636. },
  637. yAxis: {
  638. type: "value",
  639. max: 100,
  640. min: 0,
  641. interval: 20,
  642. splitNumber: 1,
  643. boundaryGap: ["5%", "5%"],
  644. nameTextStyle: {
  645. fontSize: 13,
  646. },
  647. alignTicks: true,
  648. axisTick: {
  649. show: true,
  650. },
  651. axisLabel: {
  652. show: true,
  653. fontSize: 13,
  654. },
  655. splitLine: {
  656. show: true,
  657. lineStyle: {
  658. color: "#ddd",
  659. width: 1,
  660. },
  661. },
  662. },
  663. series: [
  664. {
  665. name: `无${this.emoName}倾向`,
  666. type: "line",
  667. padding: 5,
  668. data: this.emotionData,
  669. symbol: "circle",
  670. symbolSize: 8,
  671. },
  672. {
  673. name: `轻度${this.emoName}倾向`,
  674. type: "line",
  675. data: "",
  676. },
  677. {
  678. name: `中度${this.emoName}倾向`,
  679. type: "line",
  680. data: "",
  681. },
  682. {
  683. name: `重度${this.emoName}倾向`,
  684. type: "line",
  685. data: "",
  686. },
  687. ],
  688. };
  689. },
  690. imei() {
  691. return this.$store.getters.serialNo;
  692. },
  693. // 饼状图配置
  694. pieOption() {
  695. return {
  696. tooltip: {
  697. trigger: "item",
  698. textStyle: {
  699. fontSize: 14,
  700. },
  701. position: "right",
  702. },
  703. legend: {
  704. top: "5%",
  705. left: "center",
  706. show: false,
  707. },
  708. series: [
  709. {
  710. type: "pie",
  711. radius: ["40%", "80%"],
  712. avoidLabelOverlap: false,
  713. startAngle: 270, // 设置逆时针渲染
  714. itemStyle: {
  715. borderRadius: 5,
  716. borderColor: "#fff",
  717. borderWidth: 2,
  718. fontSize: 16,
  719. },
  720. label: {
  721. show: false,
  722. position: "center",
  723. fontSize: 16,
  724. },
  725. emphasis: {
  726. label: {
  727. show: false,
  728. fontSize: 16,
  729. fontWeight: "bold",
  730. },
  731. },
  732. labelLine: {
  733. show: false,
  734. },
  735. data: this.pieData,
  736. },
  737. ],
  738. };
  739. },
  740. pieDayOption() {
  741. return {
  742. tooltip: {
  743. trigger: "item",
  744. textStyle: {
  745. fontSize: 14,
  746. },
  747. position: "right",
  748. },
  749. legend: {
  750. top: "5%",
  751. left: "center",
  752. show: false,
  753. },
  754. series: [
  755. {
  756. type: "pie",
  757. radius: ["40%", "80%"],
  758. avoidLabelOverlap: false,
  759. startAngle: 270, // 设置逆时针渲染
  760. itemStyle: {
  761. borderRadius: 5,
  762. borderColor: "#fff",
  763. borderWidth: 2,
  764. fontSize: 16,
  765. },
  766. label: {
  767. show: false,
  768. position: "center",
  769. fontSize: 16,
  770. },
  771. emphasis: {
  772. label: {
  773. show: false,
  774. fontSize: 16,
  775. fontWeight: "bold",
  776. },
  777. },
  778. labelLine: {
  779. show: false,
  780. },
  781. data: this.pieDayData,
  782. },
  783. ],
  784. };
  785. },
  786. titleLeft() {
  787. let text = this.emoName === "depression" ? "趋势" : "";
  788. let today = "";
  789. if (this.currentDays !== 0) {
  790. today = "";
  791. } else {
  792. today =
  793. this.$dayjs(this.selectDate || this.defaultDate).format(
  794. "YYYY-MM-DD"
  795. ) === this.$dayjs(new Date()).format("YYYY-MM-DD")
  796. ? "今天"
  797. : "";
  798. }
  799. return `${today}${this.emoName}倾向${text}`;
  800. },
  801. // 折线图标题
  802. echartsTitle() {
  803. let today = "";
  804. if (this.currentDays !== 0) {
  805. today = "";
  806. } else {
  807. today =
  808. this.$dayjs(this.selectDate || this.defaultDate).format(
  809. "YYYY-MM-DD"
  810. ) === this.$dayjs(new Date()).format("YYYY-MM-DD")
  811. ? "今天"
  812. : "";
  813. }
  814. return `${today}${this.emoName}数据图`;
  815. },
  816. warmTips() {
  817. return `正常连续佩戴腕表,每${this.emoType == 2 ? "一" : "半"
  818. }小时计算一个${this.emoName}分值。`;
  819. /* return `正常连续佩戴手表,每半小时计算一个${this.emoName}分值,睡眠期间不进行计算。` */
  820. },
  821. title1() {
  822. return this.params.name ? this.$replaceAll(EmotionModel[this.params.name].title1, '抑郁', '忧郁') : ''
  823. },
  824. article1() {
  825. return this.params.name ? this.$replaceAll(EmotionModel[this.params.name].article1, '抑郁', '忧郁') : ''
  826. },
  827. title2() {
  828. return this.params.name ? this.$replaceAll(EmotionModel[this.params.name].title2, '抑郁', '忧郁') : ''
  829. },
  830. article2() {
  831. return this.params.name ? this.$replaceAll(EmotionModel[this.params.name].article2, '抑郁', '忧郁') : ''
  832. },
  833. // 当前情绪颜色
  834. currentColor() {
  835. return this.calcResultColor(this.resultLevel) || "#62BD48";
  836. },
  837. },
  838. watch: {
  839. // 监听数据发生变化 初始化各项图表
  840. emotionData: {
  841. handler(n, o) {
  842. this.initEchart();
  843. },
  844. deep: true,
  845. },
  846. xAxisData: {
  847. handler(n, o) {
  848. this.initEchart();
  849. },
  850. deep: true,
  851. },
  852. pieData: {
  853. handler(n, o) {
  854. this.initPieEchart();
  855. },
  856. deep: true,
  857. },
  858. pieDayData: {
  859. handler(n, o) {
  860. this.initPieDayEchart();
  861. },
  862. deep: true,
  863. }
  864. },
  865. created() {},
  866. mounted() {
  867. /* window.addEventListener("resize", this.onResize, false); */
  868. },
  869. destroyed(){
  870. /* window.removeEventListener("resize", this.onResize, false); */
  871. },
  872. methods: {
  873. async initData(){
  874. // 读取路由传过来的参数,根据路由传过来的参数判断是哪种情绪
  875. await this.loadParams();
  876. this.initEchartText();
  877. this.getCalendarData();
  878. this.$nextTick(()=>{
  879. this.getPsychologiclData();
  880. this.getWeekResultDetail();
  881. this.getWeekResult();
  882. /* this.initEchart(); */
  883. if(this.params.current) {
  884. this.current = Number(this.params.current);
  885. this.currentDays = this.calcDaysByTabClick(
  886. Number(this.params.current)
  887. );
  888. } else {
  889. this.current = Number(this.$store.getters.tabClick) || 0;
  890. this.currentDays = this.calcDaysByTabClick(
  891. Number(this.$store.getters.tabClick)
  892. );
  893. }
  894. this.psyCurrent = this.calcPsyTabindex(EmotionModel[this.params.name].type);
  895. window.document.title = "心理监测";
  896. })
  897. },
  898. /* onResize(){
  899. if(this.pieEcharts){
  900. this.pieEcharts.resize();
  901. }
  902. if(this.echarts) {
  903. this.echarts.resize();
  904. }
  905. }, */
  906. calcWeekImg(cur, last, callBackText) {
  907. let imgurl = "";
  908. let text = "";
  909. if (isNotNull(cur) && isNotNull(last) && this.weekAndMonData.length > 0) {
  910. let curNumber = Number(cur);
  911. let latNumber = Number(last);
  912. if (curNumber - latNumber == 0) {
  913. text = "持平";
  914. } else {
  915. imgurl = curNumber < latNumber ? this.downImg : this.upImg;
  916. text = Math.abs(curNumber - latNumber) + "天";
  917. }
  918. if (callBackText) {
  919. return text;
  920. } else {
  921. return imgurl;
  922. }
  923. }
  924. },
  925. // 计算显示是上升or下降的图片
  926. /**
  927. *
  928. * @param { 本周情绪比例} current
  929. * @param { 上周情绪比例 } last
  930. * @param { 是否返回对比比例 } isCallBackCompare
  931. */
  932. calcImg(current, last, isCallBackCompare) {
  933. let imgUrl = "";
  934. let compare = "";
  935. if (isNotNull(current) && isNotNull(last)) {
  936. compare = Number(current) - Number(last);
  937. imgUrl = compare > 0 ? this.upImg : compare == 0 ? "" : this.downImg;
  938. }
  939. if (isCallBackCompare) {
  940. return compare;
  941. } else {
  942. return imgUrl;
  943. }
  944. },
  945. async loadParams() {
  946. let params = this.$route.query;
  947. if (params) {
  948. // 获取token
  949. if (!params.accessToken) {
  950. this.$toast.loading({
  951. message: "数据加载中",
  952. });
  953. let authToken = await this.getAuth();
  954. this.$toast.clear()
  955. this.$store.commit("ssjlToken", authToken);
  956. } else {
  957. this.$store.commit("ssjlToken", params.accessToken);
  958. }
  959. this.emoName = this.$replaceAll(EmotionModel[params.name].name, '抑郁', '忧郁');
  960. this.emoType = EmotionModel[params.name].type;
  961. this.uid = params.uid;
  962. this.routeDate = params.date;
  963. this.params = params;
  964. this.currentEmoName = params.name;
  965. if(params.isShowLeft === 'false'){
  966. this.isShowLeft = false
  967. }
  968. if(params.isshowTab === 'false'){
  969. this.isshowTab = false
  970. }
  971. if (params.date) {
  972. this.dateList[0].text =
  973. this.$dayjs(params.date).format("YYYY-MM-DD") ===
  974. this.$dayjs(new Date()).format("YYYY-MM-DD")
  975. ? "今天"
  976. : this.$dayjs(params.date).format("MM-DD");
  977. this.defaultDate = new Date(
  978. this.$dayjs(params.date).hour(0).minute(0).second(0).format()
  979. );
  980. }
  981. }
  982. },
  983. // 获取b端token
  984. getAuth() {
  985. let manufactorId = "5bf13062-a41e-4d00-ba14-1101aad12650";
  986. let that = this;
  987. return new Promise((resolve, reject) => {
  988. APICore.getAuth({ manufactorId: manufactorId }).then((res) => {
  989. let data = res.data;
  990. if (data.code === 0) {
  991. resolve(res.data.data);
  992. } else {
  993. this.$toast.fail(`${data.message}`);
  994. reject("");
  995. }
  996. });
  997. });
  998. },
  999. // 计算点击的天数
  1000. calcDaysByTabClick(value) {
  1001. let days = "";
  1002. console.log("value", value);
  1003. switch (value) {
  1004. case 0:
  1005. days = 0;
  1006. break;
  1007. case 1:
  1008. days = 7;
  1009. break;
  1010. case 2:
  1011. days = 30;
  1012. break;
  1013. case 3:
  1014. days = 49;
  1015. break;
  1016. default:
  1017. break;
  1018. }
  1019. return days;
  1020. },
  1021. // 计算psyTab的下标值
  1022. calcPsyTabindex(type) {
  1023. let psyIndex = "";
  1024. switch (type) {
  1025. case 1:
  1026. psyIndex = 1;
  1027. break;
  1028. case 2:
  1029. psyIndex = 2;
  1030. break;
  1031. case 3:
  1032. psyIndex = 0;
  1033. break;
  1034. default:
  1035. break;
  1036. }
  1037. return psyIndex;
  1038. },
  1039. // 获取这个月中有数据的日期,控制日历组件的日期样式
  1040. getCalendarData() {
  1041. let currentDate = new Date();
  1042. // 获取最近30天的心情等级日历数据
  1043. let dateList = this.getPostDate(currentDate, 30, true);
  1044. let reqUrl = `${PsyBaseUrl}/api/Data/GetCalendarData`;
  1045. let reqParams = {
  1046. uid: this.uid,
  1047. startDate: dateList[0],
  1048. endDate: dateList[1],
  1049. };
  1050. axios
  1051. .get(reqUrl, {
  1052. params: { ...reqParams },
  1053. headers: { AccessToken: this.$store.getters.ssjlToken },
  1054. })
  1055. .then((res) => {
  1056. if (res.data) {
  1057. let data = res.data.response;
  1058. // const mergedArr = [...new Set([...arr1, ...arr2, ...arr3])];
  1059. /* let name = this.params.name.charAt(0).toUpperCase()+ this.params.name.slice(1); */
  1060. let currentName = this.currentEmoName;
  1061. let list = [];
  1062. if (currentName === "stress") {
  1063. list = data.Stress;
  1064. } else if (currentName === "depression") {
  1065. list = data.Depression;
  1066. } else {
  1067. list = data.Tiredness;
  1068. }
  1069. list = list.map((item) => {
  1070. item.Date = this.$dayjs(item.Date.replace(/-/g, "/")).format(
  1071. "YYYY/MM/DD"
  1072. );
  1073. return item;
  1074. });
  1075. this.highlightDates = [...list];
  1076. }
  1077. });
  1078. },
  1079. // 获取饼状图数据,TODO 对接接口数据
  1080. getPieData() {
  1081. this.pieData = [
  1082. { value: 12, name: "", itemStyle: { color: "green" } },
  1083. { value: 2, name: "", itemStyle: { color: "orange" } },
  1084. { value: 1, name: "", itemStyle: { color: "#FFC0CB" } },
  1085. { value: 1, name: "", itemStyle: { color: "red" } },
  1086. ];
  1087. },
  1088. // 获取情绪数据
  1089. getPsychologiclData(date, startDate, endDate) {
  1090. this.$toast.loading({
  1091. message: "数据加载中",
  1092. });
  1093. let reqDate = date
  1094. ? this.$dayjs(date).format("YYYY-MM-DD")
  1095. : this.routeDate ||
  1096. this.$dayjs(this.defaultDate).format("YYYY-MM-DD"); /* "2023-05-23" */
  1097. let reqParams = {
  1098. uid: this.uid,
  1099. startDate: startDate || reqDate,
  1100. endDate: endDate || reqDate,
  1101. type: this.emoType,
  1102. };
  1103. console.log("请求参数", reqParams);
  1104. let reqUrl = `${PsyBaseUrl}/api/Data/GetHisData`;
  1105. axios
  1106. .get(reqUrl, {
  1107. params: { ...reqParams },
  1108. headers: { AccessToken: this.$store.getters.ssjlToken },
  1109. })
  1110. .then((res) => {
  1111. if (res.data) {
  1112. let data = res.data.response;
  1113. // 监测次数
  1114. this.monitoringCount = data.Count;
  1115. this.pieRightList = [];
  1116. this.statisticsList = [];
  1117. this.emotionList = [];
  1118. let None = {
  1119. count: data.None,
  1120. percentage: this.calcPercentage(data.None, data.Count),
  1121. text: `无${this.emoName}倾向`,
  1122. color: "#62BD48",
  1123. };
  1124. let Mild = {
  1125. count: data.Mild,
  1126. percentage: this.calcPercentage(data.Mild, data.Count),
  1127. text: `轻度${this.emoName}倾向`,
  1128. color: "#ffde00",
  1129. };
  1130. let Moderate = {
  1131. count: data.Moderate,
  1132. percentage: this.calcPercentage(data.Moderate, data.Count),
  1133. text: `中度${this.emoName}倾向`,
  1134. color: "#ff8a00",
  1135. };
  1136. let Severe = {
  1137. count: data.Severe,
  1138. percentage: this.calcPercentage(data.Severe, data.Count),
  1139. text: `重度${this.emoName}倾向`,
  1140. color: "#d70d0d",
  1141. };
  1142. // 饼状图右边数据
  1143. this.pieRightList.push(None);
  1144. this.pieRightList.push(Mild);
  1145. this.pieRightList.push(Moderate);
  1146. this.pieRightList.push(Severe);
  1147. this.pieDayData = this.pieRightList.map((item) => {
  1148. item.value = item.count;
  1149. item.itemStyle = {
  1150. color: item.color,
  1151. };
  1152. return item;
  1153. });
  1154. // 最大,最小和最近值
  1155. let Max = {
  1156. label: "最大值",
  1157. value: data.Max,
  1158. time: data.MaxDesc
  1159. ? this.currentDays === 0
  1160. ? this.$dayjs(data.MaxDesc).format("HH:mm")
  1161. : this.$dayjs(data.MaxDesc).format("MM/DD HH:mm")
  1162. : "",
  1163. level: data.MaxLevel
  1164. };
  1165. let Min = {
  1166. label: "最小值",
  1167. value: data.Min,
  1168. time: data.MinDesc
  1169. ? this.currentDays === 0
  1170. ? this.$dayjs(data.MinDesc).format("HH:mm")
  1171. : this.$dayjs(data.MinDesc).format("MM/DD HH:mm")
  1172. : "",
  1173. level: data.MinLevel
  1174. };
  1175. let Avg = {
  1176. label: "平均值",
  1177. value: data.Avg,
  1178. time: data.AvgDesc
  1179. ? this.currentDays === 0
  1180. ? this.$dayjs(data.AvgDesc).format("HH:mm")
  1181. : this.$dayjs(data.AvgDesc).format("MM/DD HH:mm")
  1182. : "",
  1183. level: data.AvgLevel
  1184. };
  1185. let Current = {
  1186. label: "最近值",
  1187. value: data.Current,
  1188. time: data.CurrentDesc
  1189. ? this.currentDays === 0
  1190. ? this.$dayjs(data.CurrentDesc).format("HH:mm")
  1191. : this.$dayjs(data.CurrentDesc).format("MM/DD HH:mm")
  1192. : "",
  1193. level: data.CurrentLevel
  1194. };
  1195. this.statisticsList.push(Max);
  1196. this.statisticsList.push(Min);
  1197. this.statisticsList.push(Avg);
  1198. this.statisticsList.push(Current);
  1199. // 周报月报底部显示数据
  1200. let NoneDay = {
  1201. days: data.NoneDay,
  1202. text: `无${this.emoName}倾向`,
  1203. color: "#62BD48",
  1204. };
  1205. let MildDay = {
  1206. days: data.MildDay,
  1207. text: `轻度${this.emoName}倾向`,
  1208. color: "#ffde00",
  1209. };
  1210. let ModerateDay = {
  1211. days: data.ModerateDay,
  1212. text: `中度${this.emoName}倾向`,
  1213. color: "#ff8a00",
  1214. };
  1215. let SevereDay = {
  1216. days: data.SevereDay,
  1217. text: `重度${this.emoName}倾向`,
  1218. color: "#d70d0d",
  1219. };
  1220. this.emotionList.push(NoneDay);
  1221. this.emotionList.push(MildDay);
  1222. this.emotionList.push(ModerateDay);
  1223. this.emotionList.push(SevereDay);
  1224. // 图表数据
  1225. this.emotionData = data.ChartDatas.map((item) => {
  1226. return {
  1227. value: item.Value,
  1228. itemStyle: {
  1229. color: this.calcResultColor(item.Level),
  1230. },
  1231. };
  1232. });
  1233. // 7天 和 30天柱形图显示
  1234. this.weekAndMonData = data.ChartDatas.map((item, index) => {
  1235. return {
  1236. value: [index, item.MinValue, item.MaxValue],
  1237. };
  1238. });
  1239. // x轴显示数据
  1240. if (this.currentDays === 0) {
  1241. // 显示今天数据
  1242. this.xAxisData = data.ChartDatas.map((item) => {
  1243. return this.$dayjs(item.Key.replace(/-/g, "/")).format("HH:mm");
  1244. });
  1245. } else {
  1246. this.xAxisData = data.ChartDatas.map((item) => {
  1247. return this.$dayjs(item.Key.replace(/-/g, "/")).format("MM/DD");
  1248. });
  1249. let emphasisStyle = {
  1250. itemStyle: {
  1251. shadowBlur: 10,
  1252. shadowColor: "rgba(0,0,0,0.3)",
  1253. },
  1254. };
  1255. let that = this;
  1256. // 7天和30天变成柱状图
  1257. this.weekAndMonthSeries = [
  1258. {
  1259. name: "平均值",
  1260. type: "scatter",
  1261. symbolSize: 8,
  1262. data: this.emotionData,
  1263. },
  1264. {
  1265. name: "",
  1266. type: "custom",
  1267. data: this.weekAndMonData,
  1268. renderItem: function (params, api) {
  1269. var categoryIndex = api.value(0);
  1270. var end = api.coord([categoryIndex, api.value(1)]);
  1271. var start = api.coord([categoryIndex, api.value(2)]);
  1272. var width = 8;
  1273. var rectShape = that.$echarts.graphic.clipRectByRect(
  1274. {
  1275. x: start[0] - width / 2,
  1276. y: start[1],
  1277. width: 8,
  1278. height: end[1] - start[1],
  1279. },
  1280. {
  1281. x: params.coordSys.x,
  1282. y: params.coordSys.y,
  1283. width: params.coordSys.width,
  1284. height: params.coordSys.height,
  1285. }
  1286. );
  1287. if (rectShape) {
  1288. rectShape.r = [10];
  1289. }
  1290. return (
  1291. rectShape && {
  1292. type: "rect",
  1293. shape: rectShape,
  1294. style: api.style(),
  1295. }
  1296. );
  1297. },
  1298. itemStyle: {
  1299. opacity: 0.8,
  1300. },
  1301. encode: {
  1302. y: [1, 2],
  1303. x: 0,
  1304. },
  1305. },
  1306. {
  1307. name: `轻度${this.emoName}倾向`,
  1308. type: "scatter",
  1309. symbolSize: 8,
  1310. data: "",
  1311. },
  1312. {
  1313. name: `中度${this.emoName}倾向`,
  1314. type: "scatter",
  1315. symbolSize: 8,
  1316. data: "",
  1317. },
  1318. {
  1319. name: `重度${this.emoName}倾向`,
  1320. type: "scatter",
  1321. symbolSize: 8,
  1322. data: "",
  1323. },
  1324. {
  1325. name: `无${this.emoName}倾向`,
  1326. type: "scatter",
  1327. symbolSize: 8,
  1328. data: "",
  1329. },
  1330. ];
  1331. // 点击提示此时为空
  1332. this.defaultOptions.tooltip = {
  1333. trigger: "axis",
  1334. formatter: function (params) {
  1335. return (
  1336. params[0].marker +
  1337. "平均值:" +
  1338. params[0].name +
  1339. "--" +
  1340. params[0].value +
  1341. "</br>" +
  1342. params[1].marker +
  1343. "最大值:" +
  1344. params[1].name +
  1345. "--" +
  1346. params[1].value[2] +
  1347. "</br>" +
  1348. params[1].marker +
  1349. "最小值:" +
  1350. params[1].name +
  1351. "--" +
  1352. params[1].value[1]
  1353. );
  1354. },
  1355. };
  1356. this.defaultOptions.series = this.weekAndMonthSeries;
  1357. }
  1358. // 结果解读
  1359. this.result = data.Result;
  1360. this.resultLevel = data.ResultLevel;
  1361. this.advice = data.Advice;
  1362. this.$toast.success({
  1363. message: "数据加载完成",
  1364. });
  1365. }
  1366. })
  1367. .catch(() => {
  1368. this.$dialog({
  1369. message: "登录过期,请重新进入",
  1370. });
  1371. })
  1372. .finally(() => { });
  1373. },
  1374. // 计算百分比
  1375. calcPercentage(value, total) {
  1376. if (
  1377. typeof value !== "number" ||
  1378. typeof total !== "number" ||
  1379. total === 0
  1380. ) {
  1381. return 0;
  1382. }
  1383. let milValue = value * 1000;
  1384. let milTotal = total * 1000;
  1385. return Math.round((milValue / milTotal) * 100);
  1386. },
  1387. // 初始化图表的文字内容
  1388. initEchartText() {
  1389. let text = this.emoName === "depression" ? "趋势" : "";
  1390. let today =
  1391. this.$dayjs(this.defaultDate).format("YYYY-MM-DD") ===
  1392. this.$dayjs(new Date()).format("YYYY-MM-DD")
  1393. ? "今天"
  1394. : "";
  1395. this.result = `无${this.emoName}倾向`;
  1396. this.defaultSeries = [
  1397. {
  1398. name: ``,
  1399. type: "line",
  1400. padding: 5,
  1401. data: this.emotionData,
  1402. symbol: "circle",
  1403. symbolSize: 8, // 拐点圆的大小
  1404. areaStyle: {},
  1405. },
  1406. {
  1407. name: `轻度${this.emoName}倾向`,
  1408. type: "line",
  1409. padding: 10,
  1410. data: "",
  1411. symbol: "circle",
  1412. symbolSize: 8, // 拐点圆的大小
  1413. },
  1414. {
  1415. name: `中度${this.emoName}倾向`,
  1416. type: "line",
  1417. data: "",
  1418. },
  1419. {
  1420. name: `重度${this.emoName}倾向`,
  1421. type: "line",
  1422. data: "",
  1423. },
  1424. ];
  1425. this.pieRightList = this.pieRightList.map((item) => {
  1426. item.text = item.text.replace("情绪", this.emoName);
  1427. return item;
  1428. });
  1429. },
  1430. // 初始化饼状图
  1431. initPieEchart() {
  1432. if (
  1433. this.pieEcharts != null &&
  1434. this.pieEcharts != "" &&
  1435. this.pieEcharts != undefined
  1436. ) {
  1437. this.pieEcharts.dispose();
  1438. }
  1439. this.pieEcharts = this.$echarts.init(this.$refs.pieChart);
  1440. this.pieEcharts.setOption(this.pieOption);
  1441. },
  1442. initPieDayEchart() {
  1443. if (
  1444. this.pieDayEcharts != null &&
  1445. this.pieDayEcharts != "" &&
  1446. this.pieDayEcharts != undefined
  1447. ) {
  1448. this.pieDayEcharts.dispose();
  1449. }
  1450. this.pieDayEcharts = this.$echarts.init(this.$refs.pieChartDay);
  1451. this.pieDayEcharts.setOption(this.pieDayOption);
  1452. },
  1453. // 格式化日期显示参数
  1454. formatter(day) {
  1455. const month = day.date.getMonth() + 1;
  1456. const date = day.date.getDate();
  1457. const formatDate = this.$dayjs(day.date).format("YYYY/MM/DD");
  1458. const currentDate = this.$dayjs(new Date()).format("YYYY/MM/DD");
  1459. day.className = "custom-calendar";
  1460. for (let h = 0; h < this.highlightDates.length; h++) {
  1461. if (this.highlightDates[h].Date === formatDate) {
  1462. day.className = `highlight-border ${this.calcResultColor(
  1463. this.highlightDates[h].SummaryLevel,
  1464. true
  1465. )}`;
  1466. } else if (formatDate === currentDate) {
  1467. day.text = "今天";
  1468. }
  1469. }
  1470. return day;
  1471. },
  1472. // 返回
  1473. onNavBack() {
  1474. this.$router.replace({
  1475. name: "psychological",
  1476. query: {
  1477. name: this.params.name,
  1478. uid: this.params.uid,
  1479. pageType: 1,
  1480. current: this.params.current
  1481. },
  1482. });
  1483. },
  1484. // 点击日期选择
  1485. onTabClick(value, index) {
  1486. this.current = index;
  1487. this.currentDays = value;
  1488. this.$store.commit("tabClick", index);
  1489. let currentDate = value === 0 ? new Date() : new Date(this.$dayjs().subtract(1, 'days'))
  1490. this.surveyTitle = value === 7 ? "7天概览" : "30天概览";
  1491. if (value === 7) {
  1492. let dateList = this.getPostDate(currentDate, 6, true);
  1493. this.getPsychologiclData("", dateList[0], dateList[1]);
  1494. this.startDate = dateList[0];
  1495. this.endDate = dateList[1];
  1496. } else if (value === 0) {
  1497. // 今天
  1498. this.defaultOptions.xAxis.data = this.xAxisData;
  1499. this.defaultOptions.series = this.defaultSeries;
  1500. this.defaultOptions.series[0].data = this.emotionData;
  1501. this.getPsychologiclData(
  1502. this.selectDate
  1503. ? this.selectDate
  1504. : this.$dayjs(currentDate).format("YYYY-MM-DD")
  1505. );
  1506. this.startDate =
  1507. this.selectDate || this.$dayjs(currentDate).format("YYYY-MM-DD");
  1508. this.endDate =
  1509. this.selectDate || this.$dayjs(currentDate).format("YYYY-MM-DD");
  1510. } else if (value === 30) {
  1511. // 30天
  1512. this.defaultOptions.xAxis.data = this.xAxisData;
  1513. this.defaultOptions.series = this.defaultSeries;
  1514. this.defaultOptions.series[0].data = this.emotionData;
  1515. let dateList = this.getPostDate(currentDate, 30, true);
  1516. this.getPsychologiclData("", dateList[0], dateList[1]);
  1517. this.startDate = dateList[0];
  1518. this.endDate = dateList[1];
  1519. } else {
  1520. // 周报菜单
  1521. console.log("点击周报");
  1522. this.onPsyTabClick(this.psyList[this.psyCurrent].name, this.psyCurrent);
  1523. /* this.getWeekResultDetail(); */
  1524. }
  1525. },
  1526. // 点击情绪tab
  1527. async onPsyTabClick(name, index) {
  1528. this.psyCurrent = index;
  1529. this.emoName = this.$replaceAll(EmotionModel[name].name, '抑郁', '忧郁');
  1530. this.currentEmoName = name;
  1531. this.emoType = EmotionModel[name].type;
  1532. console.log("this.currentDays", this.currentDays);
  1533. if (this.currentDays === 49) {
  1534. // 即点击了周报,此时调用获取周报详情接口
  1535. // 根据 getWeekResult 获取到的的周报列表筛选出指定日期的类型
  1536. let recordId = await this.getWeekResult();
  1537. if(recordId) {
  1538. this.getWeekResultDetail(recordId)
  1539. }
  1540. } else {
  1541. this.getPsychologiclData(this.selectDate, this.startDate, this.endDate);
  1542. }
  1543. this.getCalendarData();
  1544. },
  1545. getCurrentMonthStaAndEnd(currentDate) {
  1546. let list = [];
  1547. let monthStart = new Date(
  1548. currentDate.getFullYear(),
  1549. currentDate.getMonth(),
  1550. 1
  1551. ); // 获取本月第一天的日期时间
  1552. let monthEnd = new Date(
  1553. currentDate.getFullYear(),
  1554. currentDate.getMonth() + 1,
  1555. 0,
  1556. 23,
  1557. 59,
  1558. 59
  1559. ); // 获取本月最后一天的日期时间(时间为23:59:59)
  1560. list.push(this.$dayjs(monthStart).format("YYYY-MM-DD"));
  1561. list.push(this.$dayjs(monthEnd).format("YYYY-MM-DD"));
  1562. return list;
  1563. },
  1564. // 获取指定天数的起始日期
  1565. /**
  1566. *
  1567. * @param dateNow :Date类
  1568. * @param intervalDays :间隔天数
  1569. * @param bolPastTime :Boolean,判断在参数date之前,还是之后,
  1570. */
  1571. getPostDate(dateNow, intervalDays, bolPastTime) {
  1572. let oneDayTime = 24 * 60 * 60 * 1000;
  1573. let list = [];
  1574. let lastDay;
  1575. if (bolPastTime == true) {
  1576. lastDay = new Date(dateNow.getTime() - intervalDays * oneDayTime);
  1577. list.push(this.formateDate(lastDay));
  1578. list.push(this.formateDate(dateNow));
  1579. } else {
  1580. lastDay = new Date(dateNow.getTime() + intervalDays * oneDayTime);
  1581. list.push(this.formateDate(dateNow));
  1582. list.push(this.formateDate(lastDay));
  1583. }
  1584. return list;
  1585. },
  1586. formateDate(time) {
  1587. let year = time.getFullYear();
  1588. let month = time.getMonth() + 1;
  1589. let day = time.getDate();
  1590. if (month < 10) {
  1591. month = "0" + month;
  1592. }
  1593. if (day < 10) {
  1594. day = "0" + day;
  1595. }
  1596. return year + "-" + month + "-" + day + "";
  1597. },
  1598. // 字体大小转化
  1599. fontChar(res) {
  1600. const clientWidth =
  1601. window.innerWidth ||
  1602. document.documentElement.clientWidth ||
  1603. document.body.clientWidth;
  1604. if (!clientWidth) return;
  1605. let fontSize = clientWidth / 750;
  1606. return res * fontSize;
  1607. },
  1608. // 初始化折线图表
  1609. initEchart() {
  1610. if(this.current === 3) {
  1611. // 周报详情
  1612. if (
  1613. this.echarts != null &&
  1614. this.echarts != "" &&
  1615. this.echarts != undefined
  1616. ) {
  1617. this.echarts.resize();
  1618. this.echarts.dispose();
  1619. }
  1620. this.echarts = this.$echarts.init(this.$refs.charts);
  1621. this.echarts.setOption(this.defaultOptions);
  1622. } else {
  1623. if (
  1624. this.dayEcharts != null &&
  1625. this.dayEcharts != "" &&
  1626. this.dayEcharts != undefined
  1627. ) {
  1628. this.dayEcharts.resize();
  1629. this.dayEcharts.dispose();
  1630. }
  1631. this.dayEcharts = this.$echarts.init(this.$refs.dayCharts);
  1632. this.dayEcharts.setOption(this.defaultOptions);
  1633. }
  1634. },
  1635. // 点击历史监测,打开日历
  1636. onHistory() {
  1637. this.calendarDialogShow = true;
  1638. },
  1639. // 选择日历具体某一个日期
  1640. onSelect(value) {
  1641. const selectDate = this.$dayjs(value).format("YYYY-MM-DD");
  1642. this.dateList[0].text =
  1643. this.$dayjs(value).format("YYYY-MM-DD") ===
  1644. this.$dayjs(new Date()).format("YYYY-MM-DD")
  1645. ? "今天"
  1646. : this.$dayjs(value).format("MM-DD");
  1647. this.calendarDialogShow = false;
  1648. this.selectDate = selectDate;
  1649. this.startDate = selectDate;
  1650. this.endDate = selectDate;
  1651. this.current = 0;
  1652. this.getPsychologiclData(selectDate);
  1653. },
  1654. // 计算字体显示的颜色
  1655. calcColor(value) {
  1656. let color = "";
  1657. if (value <= 40) {
  1658. color = "#62BD48";
  1659. } else if (value > 40 && value <= 65) {
  1660. color = "#ffde00";
  1661. } else if (value > 65 && value <= 80) {
  1662. color = "#ff8a00";
  1663. } else if (value > 80) {
  1664. color = "#d70d0d";
  1665. } else {
  1666. color = "";
  1667. }
  1668. return color;
  1669. },
  1670. // 计算结果采用哪种颜色
  1671. calcResultColor(value, isCallBackClass) {
  1672. let color = "";
  1673. let className = "";
  1674. switch (Number(value)) {
  1675. case 0:
  1676. color = "#62BD48";
  1677. className = "none";
  1678. break;
  1679. case 1:
  1680. color = "#ffde00";
  1681. className = "mild";
  1682. break;
  1683. case 2:
  1684. color = "#ff8a00";
  1685. className = "moderate";
  1686. break;
  1687. case 3:
  1688. color = "#d70d0d";
  1689. className = "severe";
  1690. break;
  1691. }
  1692. return isCallBackClass ? className : color;
  1693. },
  1694. // 点击帮助
  1695. onHelp() {
  1696. this.isPopup = true;
  1697. },
  1698. // 关闭poup
  1699. onClose() {
  1700. this.isPopup = false;
  1701. },
  1702. //循环调用3次 GetWeekResult 接口
  1703. async getWeekResultAny() {
  1704. Promise.all([
  1705. await this.getWeekResultPro(1),
  1706. await this.getWeekResultPro(2),
  1707. await this.getWeekResultPro(3),
  1708. ]).then(res => {
  1709. let weekResultLists = res.reduce((accumulator, currentValue) => accumulator.concat(currentValue), [])
  1710. let typeMap = {};
  1711. weekResultLists.forEach(item => {
  1712. if (!typeMap[item.name]) {
  1713. typeMap[item.name] = {
  1714. name: item.name,
  1715. recordId: [],
  1716. summary: [],
  1717. summaryLevel: [],
  1718. summaryDetails: [],
  1719. type: item.type,
  1720. };
  1721. weekResultLists.push(typeMap[item.name]);
  1722. }
  1723. typeMap[item.name].recordId.push(item.recordId);
  1724. typeMap[item.name].summary.push(item.summary);
  1725. typeMap[item.name].summaryLevel.push(item.summaryLevel);
  1726. let combinedArray = typeMap[item.name].summary.map((sum, index) => ({ summary: sum, summaryLevel: typeMap[item.name].summaryLevel[index] }));
  1727. console.log(combinedArray);
  1728. typeMap[item.name].summaryDetails = combinedArray
  1729. });
  1730. let array = Object.entries(typeMap);
  1731. this.weekResultList = array;
  1732. console.log("weekResultLists", this.weekResultList);
  1733. console.log("typeMap", typeMap);
  1734. });
  1735. },
  1736. getWeekResultPro(type) {
  1737. let baseUrl =
  1738. process.env.NODE_ENV === "production"
  1739. ? "https://dbmq.rzliot.com/auth_heart"
  1740. : "https://dbmq.rzliot.com/heart";
  1741. let reqUrl = `${baseUrl}/api/Data/GetWeekResult`;
  1742. let reqParams = {
  1743. uid: this.uid /* '2023101521270090082' */,
  1744. type: type || this.emoType,
  1745. };
  1746. axios
  1747. .get(reqUrl, {
  1748. params: { ...reqParams },
  1749. /* headers: { 'AccessToken': this.$store.getters.ssjlToken } */
  1750. }).then(res => {
  1751. const data = res.data.response;
  1752. let summaryList = data.map(item => {
  1753. return {
  1754. name: item.Name.replace("周报", "")
  1755. .replace(/-/g, ".")
  1756. .replace(/~/g, "-"),
  1757. recordId: item.RecordId,
  1758. summary: this.$replaceAll(item.Summary, '抑郁', '忧郁'),
  1759. summaryLevel: item.SummaryLevel,
  1760. type: item.Type,
  1761. };
  1762. });
  1763. })
  1764. },
  1765. getWeekResult(type) {
  1766. this.$toast.loading("数据加载中");
  1767. let baseUrl =
  1768. process.env.NODE_ENV === "production"
  1769. ? "https://dbmq.rzliot.com/auth_heart"
  1770. : "https://dbmq.rzliot.com/heart";
  1771. let reqUrl = `${baseUrl}/api/Data/GetWeekResult`;
  1772. let reqParams = {
  1773. uid: this.uid /* '2023101521270090082' */,
  1774. type: this.emoType,
  1775. };
  1776. return new Promise(resolve => {
  1777. axios
  1778. .get(reqUrl, {
  1779. params: { ...reqParams },
  1780. })
  1781. .then((res) => {
  1782. console.log("res", res);
  1783. const data = res.data.response;
  1784. let time = this.$route.query.time;
  1785. let selectData = data.filter(item => {
  1786. return item.Name.replace("周报", "")
  1787. .replace(/-/g, ".")
  1788. .replace(/~/g, "-") === time
  1789. });
  1790. console.log("selectData", selectData);
  1791. let recordId = selectData && selectData[0].RecordId;
  1792. console.log("根据当前日期不同emoType得到的周报列表数据", selectData);
  1793. this.$toast.success("数据加载完成");
  1794. resolve(recordId)
  1795. });
  1796. })
  1797. },
  1798. onClickItem(recordId) {
  1799. this.$router.push({
  1800. name: "psychologicalReport",
  1801. query: {
  1802. recordId: recordId,
  1803. name: this.currentEmoName,
  1804. isShowLeft: true,
  1805. uid: this.uid,
  1806. },
  1807. });
  1808. },
  1809. // 重新拼接日期
  1810. resetDate(startDate, endDate) {
  1811. let callBackDate = "";
  1812. if (startDate && endDate) {
  1813. callBackDate =
  1814. startDate.replace(/-/g, ".") +
  1815. "-" +
  1816. endDate.slice(5, endDate.length).replace(/-/g, ".");
  1817. }
  1818. return callBackDate;
  1819. },
  1820. async getWeekResultDetail(recordId) {
  1821. // 优先取传过来的值
  1822. if(!recordId){
  1823. recordId = this.$route.query.recordId
  1824. }
  1825. // 没有则自动取
  1826. if(!recordId) {
  1827. recordId = await this.getWeekResult();
  1828. }
  1829. this.$toast.loading("数据加载中");
  1830. let baseUrl =
  1831. process.env.NODE_ENV === "production"
  1832. ? "https://dbmq.rzliot.com/auth_heart"
  1833. : "https://dbmq.rzliot.com/heart";
  1834. let reqUrl = `${baseUrl}/api/Data/GetWeekResultDetail`;
  1835. let reqParams = {
  1836. recordId: recordId,
  1837. };
  1838. axios
  1839. .get(reqUrl, {
  1840. params: { ...reqParams },
  1841. /* headers: { 'AccessToken': this.$store.getters.ssjlToken } */
  1842. })
  1843. .then((res) => {
  1844. const data = res.data.response;
  1845. let chartData = data.ChartData
  1846. ? JSON.parse(data.ChartData).filter((item) => {
  1847. return item.Key;
  1848. })
  1849. : [];
  1850. console.log("chartData", chartData);
  1851. if (data) {
  1852. this.monitoringCount = data.Total;
  1853. this.pieRightList = [];
  1854. this.statisticsList = [];
  1855. this.emotionList = [];
  1856. this.weekResult = data;
  1857. this.weekResult.Explain = this.$replaceAll(data.Explain, '抑郁', '忧郁')
  1858. this.weekResult.Summary = this.$replaceAll(data.Summary, '抑郁', '忧郁')
  1859. this.weekResult.Advice = this.$replaceAll(data.Advice, '抑郁', '忧郁')
  1860. this.emoName = this.calcTitle(data.Type);
  1861. this.isShowCompare = data.LastweekData;
  1862. }
  1863. let None = {
  1864. count: data.None,
  1865. percentage: this.calcPercentage(data.None, data.Total),
  1866. text: `无${this.emoName}倾向`,
  1867. color: "#62BD48",
  1868. scale: data.NoneRatio,
  1869. lastPercentage: this.calcPercentage(data.LastNone, data.LastTotal),
  1870. };
  1871. let Mild = {
  1872. count: data.Mild,
  1873. percentage: this.calcPercentage(data.Mild, data.Total),
  1874. text: `轻度${this.emoName}倾向`,
  1875. color: "#ffde00",
  1876. scale: data.MildRatio,
  1877. lastPercentage: this.calcPercentage(data.LastMild, data.LastTotal),
  1878. };
  1879. let Moderate = {
  1880. count: data.Moderate,
  1881. percentage: this.calcPercentage(data.Moderate, data.Total),
  1882. text: `中度${this.emoName}倾向`,
  1883. color: "#ff8a00",
  1884. scale: data.ModerateRatio,
  1885. lastPercentage: this.calcPercentage(
  1886. data.LastModerate,
  1887. data.LastTotal
  1888. ),
  1889. };
  1890. let Severe = {
  1891. count: data.Severe,
  1892. percentage: this.calcPercentage(data.Severe, data.Total),
  1893. text: `重度${this.emoName}倾向`,
  1894. color: "#d70d0d",
  1895. scale: data.SevereRatio,
  1896. lastPercentage: this.calcPercentage(
  1897. data.LastSevere,
  1898. data.LastTotal
  1899. ),
  1900. };
  1901. // 饼状图右边数据
  1902. this.pieRightList.push(None);
  1903. this.pieRightList.push(Mild);
  1904. this.pieRightList.push(Moderate);
  1905. this.pieRightList.push(Severe);
  1906. this.pieData = this.pieRightList.map((item) => {
  1907. item.value = item.count;
  1908. item.itemStyle = {
  1909. color: item.color,
  1910. };
  1911. return item;
  1912. });
  1913. let Max = {
  1914. label: "最大值",
  1915. value: data.Max,
  1916. time: data.MaxDesc
  1917. ? this.currentDays === 0
  1918. ? this.$dayjs(data.MaxDesc).format("HH:mm")
  1919. : this.$dayjs(data.MaxDesc).format("MM/DD HH:mm")
  1920. : "",
  1921. level: data.MaxLevel
  1922. };
  1923. let Min = {
  1924. label: "最小值",
  1925. value: data.Min,
  1926. time: data.MinDesc
  1927. ? this.currentDays === 0
  1928. ? this.$dayjs(data.MinDesc).format("HH:mm")
  1929. : this.$dayjs(data.MinDesc).format("MM/DD HH:mm")
  1930. : "",
  1931. level: data.MinLevel
  1932. };
  1933. let Avg = {
  1934. label: "平均值",
  1935. value: data.Avg,
  1936. time: data.AvgDesc
  1937. ? this.currentDays === 0
  1938. ? this.$dayjs(data.AvgDesc).format("HH:mm")
  1939. : this.$dayjs(data.AvgDesc).format("MM/DD HH:mm")
  1940. : "",
  1941. level: data.AvgLevel
  1942. };
  1943. this.statisticsList.push(Max);
  1944. this.statisticsList.push(Min);
  1945. this.statisticsList.push(Avg);
  1946. let NoneDay = {
  1947. days: data.NoneDay,
  1948. text: `无${this.emoName}倾向`,
  1949. color: "#62BD48",
  1950. lastDay: data.LastNoneDay,
  1951. scale: data.NoneDayRatio,
  1952. };
  1953. let MildDay = {
  1954. days: data.MildDay,
  1955. text: `轻度${this.emoName}倾向`,
  1956. color: "#ffde00",
  1957. lastDay: data.LastMildDay,
  1958. scale: data.MildDayRatio,
  1959. };
  1960. let ModerateDay = {
  1961. days: data.ModerateDay,
  1962. text: `中度${this.emoName}倾向`,
  1963. color: "#ff8a00",
  1964. lastDay: data.LastModerateDay,
  1965. scale: data.ModerateDayRatio,
  1966. };
  1967. let SevereDay = {
  1968. days: data.SevereDay,
  1969. text: `重度${this.emoName}倾向`,
  1970. color: "#d70d0d",
  1971. lastDay: data.LastSevereDay,
  1972. scale: data.SevereDayRatio,
  1973. };
  1974. this.emotionList.push(NoneDay);
  1975. this.emotionList.push(MildDay);
  1976. this.emotionList.push(ModerateDay);
  1977. this.emotionList.push(SevereDay);
  1978. // 图表数据
  1979. this.emotionData = chartData.map(item => {
  1980. return {
  1981. value: item.Value,
  1982. itemStyle: {
  1983. color: this.calcResultColor(item.Level),
  1984. },
  1985. };
  1986. });
  1987. console.log("emotionData", this.emotionData);
  1988. this.weekAndMonData = chartData.map((item, index) => {
  1989. return {
  1990. value: [index, item.MinValue, item.MaxValue],
  1991. };
  1992. });
  1993. this.xAxisData = chartData.map((item) => {
  1994. return item.Key
  1995. ? this.$dayjs(item.Key.replace(/-/g, "/")).format("MM/DD")
  1996. : item.key;
  1997. });
  1998. let emphasisStyle = {
  1999. itemStyle: {
  2000. shadowBlur: 10,
  2001. shadowColor: "rgba(0,0,0,0.3)",
  2002. },
  2003. };
  2004. let that = this;
  2005. // 7天和30天变成柱状图
  2006. this.weekAndMonthSeries = [
  2007. {
  2008. name: "平均值",
  2009. type: "scatter",
  2010. symbolSize: 8,
  2011. data: this.emotionData,
  2012. },
  2013. {
  2014. name: "",
  2015. type: "custom",
  2016. data: this.weekAndMonData,
  2017. renderItem: function (params, api) {
  2018. var categoryIndex = api.value(0);
  2019. var end = api.coord([categoryIndex, api.value(1)]);
  2020. var start = api.coord([categoryIndex, api.value(2)]);
  2021. var width = 8;
  2022. var rectShape = that.$echarts.graphic.clipRectByRect(
  2023. {
  2024. x: start[0] - width / 2,
  2025. y: start[1],
  2026. width: 8,
  2027. height: end[1] - start[1],
  2028. },
  2029. {
  2030. x: params.coordSys.x,
  2031. y: params.coordSys.y,
  2032. width: params.coordSys.width,
  2033. height: params.coordSys.height,
  2034. }
  2035. );
  2036. if (rectShape) {
  2037. rectShape.r = [10];
  2038. }
  2039. return (
  2040. rectShape && {
  2041. type: "rect",
  2042. shape: rectShape,
  2043. style: api.style(),
  2044. }
  2045. );
  2046. },
  2047. itemStyle: {
  2048. opacity: 0.8,
  2049. },
  2050. encode: {
  2051. y: [1, 2],
  2052. x: 0,
  2053. },
  2054. },
  2055. {
  2056. name: `轻度${this.emoName}倾向`,
  2057. type: "scatter",
  2058. symbolSize: 8,
  2059. data: "",
  2060. },
  2061. {
  2062. name: `中度${this.emoName}倾向`,
  2063. type: "scatter",
  2064. symbolSize: 8,
  2065. data: "",
  2066. },
  2067. {
  2068. name: `重度${this.emoName}倾向`,
  2069. type: "scatter",
  2070. symbolSize: 8,
  2071. data: "",
  2072. },
  2073. {
  2074. name: `无${this.emoName}倾向`,
  2075. type: "scatter",
  2076. symbolSize: 8,
  2077. data: "",
  2078. },
  2079. ];
  2080. // 点击提示此时为空
  2081. this.defaultOptions.tooltip = {
  2082. trigger: "axis",
  2083. formatter: function (params) {
  2084. if (params) {
  2085. return (
  2086. params[0].marker +
  2087. "平均值:" +
  2088. params[0].name +
  2089. "--" +
  2090. params[0].value +
  2091. "</br>" +
  2092. params[1].marker +
  2093. "最大值:" +
  2094. params[1].name +
  2095. "--" +
  2096. params[1].value[2] +
  2097. "</br>" +
  2098. params[1].marker +
  2099. "最小值:" +
  2100. params[1].name +
  2101. "--" +
  2102. params[1].value[1]
  2103. );
  2104. }
  2105. },
  2106. };
  2107. this.defaultOptions.series = this.weekAndMonthSeries;
  2108. this.$toast.success("数据加载完成");
  2109. });
  2110. },
  2111. calcTitle(type) {
  2112. let title = "";
  2113. switch (type) {
  2114. case 1:
  2115. title = "压力";
  2116. break;
  2117. case 2:
  2118. title = anxietyText;
  2119. break;
  2120. case 3:
  2121. title = "疲劳";
  2122. break;
  2123. default:
  2124. break;
  2125. }
  2126. return title;
  2127. },
  2128. },
  2129. };
  2130. </script>
  2131. <style lang="scss">
  2132. .van-nav-bar .van-icon {
  2133. padding-left: 10px;
  2134. }
  2135. .calenddar-dialog {
  2136. overflow: scroll;
  2137. }
  2138. .calendar {
  2139. overflow: scroll;
  2140. .van-calendar {
  2141. height: 350px;
  2142. .van-calendar__header {
  2143. display: none;
  2144. }
  2145. .van-calendar__days .van-calendar__day {
  2146. width: 27px;
  2147. height: 27px;
  2148. margin: 5px;
  2149. font-size: 12px;
  2150. &.custom-calendar {
  2151. width: 27px;
  2152. height: 27px;
  2153. }
  2154. &.highlight-border {
  2155. border: 1px solid #62bd48;
  2156. width: 27px;
  2157. height: 27px;
  2158. border-radius: 50%;
  2159. &.none {
  2160. border: 1px solid #62bd48;
  2161. }
  2162. &.mild {
  2163. border: 1px solid #ffde00;
  2164. }
  2165. &.moderate {
  2166. border: 1px solid #ff8a00;
  2167. }
  2168. &.severe {
  2169. border: 1px solid #d70d0d;
  2170. }
  2171. }
  2172. }
  2173. .van-calendar__selected-day {
  2174. width: 27px;
  2175. height: 27px;
  2176. border-radius: 50%;
  2177. font-size: 12px;
  2178. }
  2179. }
  2180. }
  2181. </style>
  2182. <style scoped lang="scss">
  2183. @import "./../index.scss";
  2184. @import "./index.scss";
  2185. </style>