CompareOrigin.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <template>
  2. <div>
  3. <el-dialog :visible.sync="dialogVisible" :close-on-click-modal="false" width="60%" style="border-radius: 40px">
  4. <div slot="title">
  5. <p style="text-align: center; margin-bottom: 20px; font-weight: 700">
  6. <!-- {{ planName }}完成及得分情况 -->
  7. 专业报告对比
  8. </p>
  9. <div class="c_wrap">
  10. <p class="c_name">
  11. </p>
  12. <div class="c_main">
  13. <div class="chart_wrap">
  14. <PieChart :options="options1" chartId="myPieChart1" chartName="完成度" />
  15. </div>
  16. <div class="chart_wrap">
  17. <PieChart :options="options2" chartId="myPieChart2" chartName="焦虑" />
  18. </div>
  19. <div class="chart_wrap">
  20. <PieChart :options="options3" chartId="myPieChart3" chartName="抑郁" />
  21. </div>
  22. <div class="chart_wrap">
  23. <PieChart :options="options4" chartId="myPieChart4" chartName="压力" />
  24. </div>
  25. <div class="chart_wrap">
  26. <PieChart :options="options5" chartId="myPieChart5" chartName="精神障碍" />
  27. </div>
  28. <div class="chart_wrap">
  29. <PieChart :options="options6" chartId="myPieChart6" chartName="存在心理健康情况" />
  30. </div>
  31. </div>
  32. <p class="c_name">{{ comparePlanList[1].planName }}</p>
  33. <div class="c_main">
  34. <div class="chart_wrap">
  35. <PieChart :options="options7" chartId="myPieChart7" chartName="完成度" />
  36. </div>
  37. <div class="chart_wrap">
  38. <PieChart :options="options8" chartId="myPieChart8" chartName="焦虑" />
  39. </div>
  40. <div class="chart_wrap">
  41. <PieChart :options="options9" chartId="myPieChart9" chartName="抑郁" />
  42. </div>
  43. <div class="chart_wrap">
  44. <PieChart :options="options10" chartId="myPieChart10" chartName="压力" />
  45. </div>
  46. <div class="chart_wrap">
  47. <PieChart :options="options11" chartId="myPieChart11" chartName="精神障碍" />
  48. </div>
  49. <div class="chart_wrap">
  50. <PieChart :options="options12" chartId="myPieChart12" chartName="存在心理健康情况" />
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </el-dialog>
  56. <div></div>
  57. </div>
  58. </template>
  59. <script>
  60. //引入echarts组件
  61. import * as echarts from "echarts";
  62. import PieChart from "@/components/PieChart";
  63. export default {
  64. components: {
  65. PieChart,
  66. },
  67. data() {
  68. return {
  69. dialogVisible: false,
  70. options1: [],
  71. options2: [],
  72. options3: [],
  73. options4: [],
  74. options5: [],
  75. options6: [],
  76. options7: [],
  77. options8: [],
  78. options9: [],
  79. options10: [],
  80. options11: [],
  81. options12: [],
  82. completeNum: 0,
  83. unComplete: 0,
  84. userType: "",
  85. comparePlanList: [],
  86. comparePlanDate: []
  87. };
  88. },
  89. mounted() {
  90. },
  91. methods: {
  92. open(arr) {
  93. this.comparePlanList = arr;
  94. this.queryCompletePople(0);
  95. this.queryCompletePople(1);
  96. this.dialogVisible = true;
  97. },
  98. // 查询计划完成和未完成人数
  99. queryCompletePople(i) {
  100. //调用接口返回信息
  101. let url = `/plan/countComplete?planId=${this.comparePlanList[i].id}`;
  102. this.$http.get(url, {}, (res) => {
  103. if (res.code == 200) {
  104. this.comparePlanDate[i] = { 'unComplete': res.data[0], 'completeNum': res.data[1] }
  105. this.getPlanDimNun(i);
  106. }
  107. });
  108. },
  109. // 查询不同维度的中重度数量
  110. getPlanDimNun(i) {
  111. this.$http.get(
  112. `userRecordScore/countNumByPlanDim?planId=${this.comparePlanList[i].id}`,
  113. {},
  114. (res) => {
  115. let dimensionList = res.data;
  116. if (i == 0) {
  117. this.options1 = [
  118. { value: this.comparePlanDate[0].completeNum + this.comparePlanDate[0].unComplete, name: "已完成人数" },
  119. { value: this.comparePlanDate[0].unComplete, name: "未完成占比" },
  120. ];
  121. this.options2 = [
  122. { value: this.comparePlanDate[0].completeNum - dimensionList[0]["焦虑"], name: "焦虑" },
  123. { value: parseInt(dimensionList[0]["焦虑"]), name: "焦虑占比" },
  124. ];
  125. this.options3 = [
  126. { value: this.comparePlanDate[0].completeNum, name: "已完成人数" },
  127. { value: parseInt(dimensionList[1]["抑郁"]), name: "抑郁占比" },
  128. ];
  129. this.options4 = [
  130. { value: this.comparePlanDate[0].completeNum, name: "已完成人数" },
  131. { value: parseInt(dimensionList[2]["压力"]), name: "压力占比" },
  132. ];
  133. this.options5 = [
  134. { value: this.comparePlanDate[0].completeNum, name: "已完成人数" },
  135. { value: parseInt(dimensionList[3]["精神障碍"]), name: "精神障碍占比" },
  136. ];
  137. this.options6 = [
  138. {
  139. value: this.comparePlanDate[0].completeNum - dimensionList[3]["精神障碍"],
  140. name: "已完成人数",
  141. },
  142. { value: dimensionList[3]["精神障碍"], name: "精神障碍" },
  143. ];
  144. } else {
  145. this.options7 = [
  146. { value: this.comparePlanDate[1].completeNum + this.unComplete, name: "已完成人数" },
  147. { value: this.comparePlanDate[1].unComplete, name: "未完成占比" },
  148. ];
  149. this.options8 = [
  150. { value: this.comparePlanDate[1].completeNum - dimensionList[0]["焦虑"], name: "焦虑" },
  151. { value: parseInt(dimensionList[0]["焦虑"]), name: "焦虑占比" },
  152. ];
  153. this.options9 = [
  154. { value: this.comparePlanDate[1].completeNum, name: "已完成人数" },
  155. { value: parseInt(dimensionList[1]["抑郁"]), name: "抑郁占比" },
  156. ];
  157. this.options10 = [
  158. { value: this.comparePlanDate[1].completeNum, name: "已完成人数" },
  159. { value: parseInt(dimensionList[2]["压力"]), name: "压力占比" },
  160. ];
  161. this.options11 = [
  162. { value: this.comparePlanDate[1].completeNum, name: "已完成人数" },
  163. { value: parseInt(dimensionList[3]["精神障碍"]), name: "精神障碍占比" },
  164. ];
  165. this.options12 = [
  166. {
  167. value: this.comparePlanDate[1].completeNum - dimensionList[3]["精神障碍"],
  168. name: "已完成人数",
  169. },
  170. { value: dimensionList[3]["精神障碍"], name: "精神障碍" },
  171. ];
  172. }
  173. }
  174. );
  175. }
  176. },
  177. };
  178. </script>
  179. <style lang="less" scoped>
  180. .c_wrap {
  181. // display: flex;
  182. width: 100%;
  183. }
  184. .c_main {
  185. width: 100%;
  186. display: flex;
  187. }
  188. .pag_class /deep/ .el-input__inner {
  189. width: 100% !important;
  190. }
  191. .chart_wrap {
  192. flex: 1;
  193. height: 200px;
  194. }
  195. </style>