ComparePlanProfession3.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. <template>
  2. <div style="width: 100%;">
  3. <div slot="title">
  4. <p class="title">专业报告对比</p>
  5. </div>
  6. <div class="c_wrap">
  7. <el-form :inline="true" :model="formInline" class="demo-form-inline">
  8. <el-form-item label="计划名称">
  9. <el-select v-model="selectPlan1" placeholder="请选择计划" @change="planSelectHandle1">
  10. <el-option v-for="item in planList" :key="item.id" :label="item.planName" :value="item"></el-option>
  11. </el-select>
  12. </el-form-item>
  13. <el-form-item label="组织名称">
  14. <el-select v-model="orgInfo1" placeholder="请选择组织" @change="orgSelectHandle1">
  15. <el-option v-for="item in organizationsList" :key="item.id" :label="item.orgName" :value="item"></el-option>
  16. </el-select>
  17. </el-form-item>
  18. </el-form>
  19. <p class="c_name">{{ selectPlan1.planName }} - {{ orgInfo1.orgName }}</p>
  20. <div class="c_main">
  21. <div class="chart_wrap">
  22. <PieChart :options="options1" chartId="myPieChart1" chartName="完成度" />
  23. </div>
  24. <div class="chart_wrap">
  25. <PieChart :options="options2" chartId="myPieChart2" chartName="焦虑" />
  26. </div>
  27. <div class="chart_wrap">
  28. <PieChart :options="options3" chartId="myPieChart3" chartName="抑郁" />
  29. </div>
  30. <div class="chart_wrap">
  31. <PieChart :options="options4" chartId="myPieChart4" chartName="压力" />
  32. </div>
  33. <div class="chart_wrap">
  34. <PieChart :options="options5" chartId="myPieChart5" chartName="精神障碍" />
  35. </div>
  36. <div class="chart_wrap">
  37. <PieChart :options="options6" chartId="myPieChart6" chartName="存在心理健康情况" />
  38. </div>
  39. </div>
  40. <el-form :inline="true" :model="formInline" class="demo-form-inline" style="margin-top: 40px;">
  41. <el-form-item label="计划名称">
  42. <el-select v-model="selectPlan2" placeholder="请选择计划" @change="planSelectHandle2">
  43. <el-option v-for="item in planList" :key="item.id" :label="item.planName" :value="item"></el-option>
  44. </el-select>
  45. </el-form-item>
  46. <el-form-item label="组织名称">
  47. <el-select v-model="orgInfo2" placeholder="请选择组织" @change="orgSelectHandle2">
  48. <el-option v-for="item in organizationsList2" :key="item.id" :label="item.orgName"
  49. :value="item"></el-option>
  50. </el-select>
  51. </el-form-item>
  52. </el-form>
  53. <p class="c_name">{{ selectPlan2.planName }} - {{ orgInfo2.orgName }}</p>
  54. <div class="c_main">
  55. <div class="chart_wrap">
  56. <PieChart :options="options7" chartId="myPieChart7" chartName="完成度" />
  57. </div>
  58. <div class="chart_wrap">
  59. <PieChart :options="options8" chartId="myPieChart8" chartName="焦虑" />
  60. </div>
  61. <div class="chart_wrap">
  62. <PieChart :options="options9" chartId="myPieChart9" chartName="抑郁" />
  63. </div>
  64. <div class="chart_wrap">
  65. <PieChart :options="options10" chartId="myPieChart10" chartName="压力" />
  66. </div>
  67. <div class="chart_wrap">
  68. <PieChart :options="options11" chartId="myPieChart11" chartName="精神障碍" />
  69. </div>
  70. <div class="chart_wrap">
  71. <PieChart :options="options12" chartId="myPieChart12" chartName="存在心理健康情况" />
  72. </div>
  73. </div>
  74. </div>
  75. </div>
  76. </template>
  77. <script>
  78. import PieChart from "@/components/PieChart";
  79. export default {
  80. components: {
  81. PieChart,
  82. },
  83. data() {
  84. return {
  85. dialogVisible: false,
  86. selectPlan1: {},
  87. selectPlan2: {},
  88. orgInfo1: {
  89. orgName: ''
  90. },
  91. orgInfo2: {
  92. orgName: ''
  93. },
  94. pageNum: 1,
  95. pageSize: 10,
  96. planName: '',
  97. total: '',
  98. options1: [],
  99. options2: [],
  100. options3: [],
  101. options4: [],
  102. options5: [],
  103. options6: [],
  104. options7: [],
  105. options8: [],
  106. options9: [],
  107. options10: [],
  108. options11: [],
  109. options12: [],
  110. userType: "",
  111. planList: [],
  112. organizationsList: [],
  113. organizationsList2: [],
  114. comparePlanList: [],
  115. comparePlanDate: []
  116. };
  117. },
  118. created() {
  119. this.selectPlan1 = this.$route.params;
  120. this.selectPlan2 = this.$route.params;
  121. this.getPlanList();
  122. this.getPlanOrganization(this.selectPlan1.id).then((res) => {
  123. this.organizationsList = res.data;
  124. this.organizationsList2 = res.data;
  125. this.orgInfo1 = res.data[0];
  126. this.orgInfo2 = res.data[1];
  127. this.queryCompletePople(this.selectPlan1.id, [this.orgInfo1.orgNo], 0);
  128. this.queryCompletePople(this.selectPlan2.id, [this.orgInfo2.orgNo], 1);
  129. });
  130. },
  131. mounted() {
  132. },
  133. methods: {
  134. // 查询测试计划
  135. getPlanList() {
  136. this.$http.get(`plan/findListByPage?pageSize=${this.pageSize}&pageNum=${this.pageNum}&planName=${this.planName}`, {}, (res) => {
  137. if (res && res.code == 200) {
  138. console.log(res.data.content);
  139. this.planList = res.data.content;
  140. this.total = res.data.totalElements;
  141. } else {
  142. this.$message.error(res.msg);
  143. }
  144. });
  145. },
  146. // 查询计划下组织
  147. getPlanOrganization(id) {
  148. return new Promise((reslove, reject) => {
  149. this.$http.get(`/planOrg/findAllByPlanId?planId=${id}`, {}, res => {
  150. if (res && res.code == 200) {
  151. reslove(res);
  152. } else {
  153. this.$message.error(res.msg);
  154. reject();
  155. }
  156. })
  157. })
  158. },
  159. // 查询计划完成和未完成人数
  160. queryCompletePople(id, n, i) {
  161. let url = `plan/countComplete?planId=${id}&orgList=${n}`;
  162. this.$http.get(url, {}, (res) => {
  163. if (res.code == 200) {
  164. this.getPlanDimNun(id, n, i);
  165. this.comparePlanDate[i] = { 'unComplete': res.data[0], 'completeNum': res.data[1] }
  166. }
  167. });
  168. },
  169. // 查询不同维度的中重度数量
  170. getPlanDimNun(id, n, i) {
  171. this.$http.get(
  172. `userRecordScore/countNumByPlanDim?planId=${id}&orgList=${n}`,
  173. {},
  174. (res) => {
  175. console.log(res);
  176. let dimensionList = res.data;
  177. if (i == 0) {
  178. this.options1 = [
  179. { value: this.comparePlanDate[0].completeNum + this.comparePlanDate[0].unComplete, name: "已完成人数" },
  180. { value: this.comparePlanDate[0].unComplete, name: "未完成占比" },
  181. ];
  182. this.options2 = [
  183. { value: this.comparePlanDate[0].completeNum, name: "焦虑" },
  184. { value: parseInt(dimensionList[0]["焦虑"]), name: "焦虑占比" },
  185. ];
  186. this.options3 = [
  187. { value: this.comparePlanDate[0].completeNum, name: "已完成人数" },
  188. { value: parseInt(dimensionList[1]["抑郁"]), name: "抑郁占比" },
  189. ];
  190. this.options4 = [
  191. { value: this.comparePlanDate[0].completeNum, name: "已完成人数" },
  192. { value: parseInt(dimensionList[2]["压力"]), name: "压力占比" },
  193. ];
  194. this.options5 = [
  195. { value: this.comparePlanDate[0].completeNum, name: "已完成人数" },
  196. { value: parseInt(dimensionList[3]["精神障碍"]), name: "精神障碍占比" },
  197. ];
  198. } else {
  199. this.options7 = [
  200. { value: this.comparePlanDate[1].completeNum + this.comparePlanDate[1].unComplete, name: "已完成人数" },
  201. { value: this.comparePlanDate[1].unComplete, name: "未完成占比" },
  202. ];
  203. this.options8 = [
  204. { value: this.comparePlanDate[1].completeNum, name: "焦虑" },
  205. { value: parseInt(dimensionList[0]["焦虑"]), name: "焦虑占比" },
  206. ];
  207. this.options9 = [
  208. { value: this.comparePlanDate[1].completeNum, name: "已完成人数" },
  209. { value: parseInt(dimensionList[1]["抑郁"]), name: "抑郁占比" },
  210. ];
  211. this.options10 = [
  212. { value: this.comparePlanDate[1].completeNum, name: "已完成人数" },
  213. { value: parseInt(dimensionList[2]["压力"]), name: "压力占比" },
  214. ];
  215. this.options11 = [
  216. { value: this.comparePlanDate[1].completeNum, name: "已完成人数" },
  217. { value: parseInt(dimensionList[3]["精神障碍"]), name: "精神障碍占比" },
  218. ];
  219. }
  220. this.isAbnormal(id, n, i);
  221. }
  222. );
  223. },
  224. //查询统计心理健康异常人数
  225. isAbnormal(id, n, i) {
  226. //调用接口返回信息
  227. let url = `/planUser/countCompletedUserHighRisk?planId=${id}&orgList=${n}`;
  228. this.$http.get(url, {}, (res) => {
  229. if (res.code == 200) {
  230. if (i == 0) {
  231. this.options6 = [
  232. {
  233. value: this.comparePlanDate[0].completeNum,
  234. name: "已完成人数",
  235. },
  236. { value: res.data, name: "健康异常占比" },
  237. ];
  238. } else {
  239. this.options12 = [
  240. {
  241. value: this.comparePlanDate[1].completeNum,
  242. name: "已完成人数",
  243. },
  244. { value: res.data, name: "健康异常占比" },
  245. ];
  246. }
  247. }
  248. });
  249. },
  250. planSelectHandle1(item) {
  251. this.getPlanOrganization(item.id).then((res) => {
  252. this.organizationsList = res.data;
  253. this.orgInfo1 = res.data[0];
  254. this.queryCompletePople(this.selectPlan1.id, [this.orgInfo1.orgNo], 0);
  255. });
  256. },
  257. planSelectHandle2(item) {
  258. this.getPlanOrganization(item.id).then((res) => {
  259. this.organizationsList2 = res.data;
  260. this.orgInfo1 = res.data[1];
  261. this.queryCompletePople(item.id, [this.orgInfo2.orgNo], 1);
  262. });
  263. },
  264. orgSelectHandle1(item) {
  265. this.queryCompletePople(this.selectPlan1.id, [item.orgNo], 0);
  266. },
  267. orgSelectHandle2(item) {
  268. this.queryCompletePople(this.selectPlan2.id, [item.orgNo], 1);
  269. }
  270. },
  271. };
  272. </script>
  273. <style lang="less" scoped>
  274. .c_wrap {
  275. width: 100%;
  276. }
  277. .c_main {
  278. box-sizing: border-box;
  279. display: flex;
  280. padding: 0 50px;
  281. }
  282. .pag_class /deep/ .el-input__inner {
  283. width: 100% !important;
  284. }
  285. .chart_wrap {
  286. flex: 1;
  287. height: 200px;
  288. }
  289. .demo-form-inline {
  290. margin-left: 40px;
  291. }
  292. .c_name {
  293. font-size: 14px;
  294. font-weight: 600;
  295. text-align: center;
  296. margin: 16px 0;
  297. }
  298. .title {
  299. font-size: 20px;
  300. color: #222222;
  301. font-weight: 800;
  302. text-align: center;
  303. }
  304. </style>