Browse Source

修改首页概况

plg 4 months ago
parent
commit
9849350b17

BIN
src/assets/img/home/bg.png


BIN
src/assets/img/home/bg1.png


BIN
src/assets/img/home/bg_p.png


+ 2 - 2
src/utils/http.js

@@ -17,8 +17,8 @@ import { router } from "@/router";
 // axios.defaults.baseURL = 'https://child.hhnao.com:8070';
 // axios.defaults.baseURL = 'https://child.hhnao.com:8070';
 //https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx01d1a44906973cf2&redirect_uri=http%3A%2F%2F192.168.18.51%3A8085&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect
-// export const basePath='http://10.113.248.4:8089'
-export const basePath = "http://43.143.198.30:8089";
+export const basePath='http://10.113.248.4:8089'
+// export const basePath = "http://43.143.198.30:8089";
 // const base_url = 'http://43.143.198.30:8089/'
 // const base_url = 'http://10.113.248.4:8090/'
 // export const basePath='http://43.143.198.30:8086'

+ 316 - 154
src/views/manage/generalSituation.vue

@@ -3,6 +3,11 @@
     <!-- <img style="width:90%;" src="../../assets/report/home2.png" /> -->
     <div class="general_situation">
       <div class="number_people">
+        <img
+          style="width: 80px; position: absolute; right: 20px; top: 20px"
+          src="../../assets/img/home/bg_p.png"
+          alt=""
+        />
         <div class="number_people_top">人数统计</div>
         <div class="number_people_yuan">
           <div class="out">
@@ -12,13 +17,6 @@
 
             <span class="yuan_people">{{ peopleData["总人数"] }}人</span>
           </div>
-          <!-- <div class="computer">
-            <div v-for="(item, key) in peopleData" :key="key">
-              <div class="computer_detail" v-if="key != '总人数'">
-                {{ key }}:{{ item }}人
-              </div>
-            </div>
-          </div> -->
         </div>
       </div>
       <div class="plan">
@@ -105,7 +103,7 @@
           <div class="detail">
             <img
               @click="queryDetail"
-              style="width: 120px; cursor: pointer"
+              style="width: 80px; cursor: pointer"
               src="../../assets//img/home/detail.png"
               alt=""
             />
@@ -165,29 +163,25 @@
         </div>
       </div>
       <div class="block_right">
-        <div class="block_avg">
-          各个专业维度平均分
-          <el-select v-model="profession" placeholder="请选择" @change="professionChange">
-            <el-option
-              v-for="item in professionOptions"
-              :key="item.value"
-              :label="item.label"
-              :value="item.value"
+        <div class="right_zu">
+          <div class="cpqs">
+            测评趋势<span style="font-size: 16px; margin-left: 10px"
+              >(近期10次测试趋势图)</span
             >
-            </el-option>
-          </el-select>
-        </div>
-        <div v-if="profession != ''" class="block_lei" ref="echarts_lei"></div>
-        <div
-          v-else
-          style="
-            display: flex;
-            justify-content: center;
-            align-items: center;
-            height: 100%;
-          "
-        >
-          暂无数据
+          </div>
+
+          <div v-if="true" class="block_lei" ref="echarts_lei"></div>
+          <div
+            v-else
+            style="
+              display: flex;
+              justify-content: center;
+              align-items: center;
+              height: 100%;
+            "
+          >
+            暂无数据
+          </div>
         </div>
       </div>
     </div>
@@ -257,11 +251,32 @@ export default {
         trigger: "axis",
         axisPointer: {
           type: "shadow",
+          // shadowStyle:{
+          // color:'rgba(0,0,0,0.5)',
+          // shadowBlur: 10,
+          // shadowOffsetX:0,
+          // shadowOffsetY:'0'
+          // }
+        },
+        formatter: function (params) {
+          var relVal = '';
+          let na = params[0].name;
+          for (var i = 0, l = params.length; i < l; i++) {
+            relVal +=
+         
+              params[i].marker +
+              na +
+              " : " +
+              params[i].value +
+              "%";
+          }
+          return relVal;
         },
-        // formatter: function (arg) {
-        //   console.log("arg");
-        //   console.log(arg);
-        //   return "我就是提示的内容";
+        // formatter: "{b} : {c} % ",
+        
+        // formatter: function (params,trigger) {
+
+        //   return '{a} <br/>{b} : {c} <br/>百分比 : {d}%'
         // },
       },
       legend: {},
@@ -331,7 +346,7 @@ export default {
             position: "top",
             color: "#006FFF",
             formatter: function (params) {
-              return params.value + "%";
+              return parseInt(params.value) + "%";
             },
           },
         },
@@ -340,76 +355,104 @@ export default {
     // echarts.init(this.echarts_zhu).setOption(this.option);
 
     this.option_lei = {
-      radar: {
-        // shape: 'circle',
-        indicator: [
-          { name: "Sales", max: 100 },
-          { name: "Administration", max: 100 },
-          { name: "Information Technology", max: 100 },
-          { name: "Customer Support", max: 100 },
-          { name: "Development", max: 100 },
-          { name: "Marketing", max: 100 },
-        ],
+      title: {
+        text: "",
       },
-      //   label:{
-      //     show:true,
-      //     textStyle:{
-      //         color:'#000000'
-      //     }
-      //   },
-      name: {
-        //修改indicator文字的颜色
-        textStyle: {
-          color: "#000000",
+      // tooltip: {
+      //   trigger: "axis",
+      // },
+      tooltip: {
+        trigger: "axis",
+        axisPointer: {
+          type: "shadow",
         },
+        // formatter: '{b} : {c} % '
+        // formatter: function (params,trigger) {
+        formatter: function (params) {
+          var relVal = params[0].name;
+          for (var i = 0, l = params.length; i < l; i++) {
+            relVal +=
+              "<br/>" +
+              params[i].marker +
+              params[i].seriesName +
+              " : " +
+              params[i].value +
+              "%";
+          }
+          return relVal;
+        },
+        //   return '{a} <br/>{b} : {c} <br/>百分比 : {d}%'
+        // },
       },
-      axisLine: {
-        lineStyle: {
-          color: "#000000",
+      legend: {
+        data: ["焦虑", "抑郁", "压力", "精神障碍", "心理健康"],
+      },
+      grid: {
+        left: "3%",
+        right: "4%",
+        bottom: "3%",
+        containLabel: true,
+      },
+      toolbox: {
+        feature: {
+          // saveAsImage: {},
         },
       },
+      xAxis: {
+        type: "category",
+        boundaryGap: false,
+        data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
+        axisLabel: {
+          interval: 0,
+          // rotate:'-90',
+          formatter: function (value) {
+            console.log("-------------");
+            console.log(value);
+            // return ''
+            // return value
+            return value.substring(0, 4) + "...";
+          },
+        },
+      },
+      yAxis: {
+        max: 100,
+        type: "value",
+      },
       series: [
         {
-          name: "",
-          type: "radar",
-          data: [
-            {
-              value: [20, 30, 40, 50, 60, 70],
-              name: "",
-              itemStyle: {
-                //该数值区域样式设置
-                //边框及原点颜色
-                normal: {
-                  color: "#FF1E00", //背景颜色,还需设置areaStyle
-                  lineStyle: {
-                    color: "rgba(255,225,0,.3)", //边框颜色
-                  },
-                },
-              },
-              //   label: {
-              //     //显示value中具体的数值
-              //     normal: {
-              //       show: true,
-              //       textStyle: {
-              //         //更改数值样式
-              //         color: "orange",
-              //       },
-              //     },
-              //   },
-              areaStyle: {
-                //设置区域背景颜色透明度
-                normal: {
-                  width: 1,
-                  opacity: 0.3,
-                },
-              },
-            },
-          ],
+          name: "焦虑",
+          type: "line",
+
+          data: [],
+        },
+        {
+          name: "抑郁",
+          type: "line",
+
+          data: [],
+        },
+        {
+          name: "压力",
+          type: "line",
+
+          data: [],
+        },
+        {
+          name: "精神障碍",
+          type: "line",
+
+          data: [],
+        },
+        {
+          name: "心理健康",
+          type: "line",
+
+          data: [],
         },
       ],
     };
 
-    // this.getOrg();
+    this.queryDetailScore();
   },
   methods: {
     queryDetail() {
@@ -435,7 +478,6 @@ export default {
       this.$http.get(url, {}, (res) => {
         if (res && res.code == 200) {
           this.tableData = res.data.content;
-          debugger;
           //   this.total = res.data.totalElements;
         } else {
           // this.$toast.fail(res.msg);
@@ -517,16 +559,15 @@ export default {
           scoreList.push(
             parseInt(((this.completeNum - this.abnormalNum) / this.completeNum) * 100)
           );
-          scoreList.push((parseInt(dimensionList[1]["抑郁"]) / this.completeNum) * 100);
-          scoreList.push((parseInt(dimensionList[2]["压力"]) / this.completeNum) * 100);
-          scoreList.push((parseInt(dimensionList[0]["焦虑"]) / this.completeNum) * 100);
+          scoreList.push(parseInt((dimensionList[1]["抑郁"] / this.completeNum) * 100));
+          scoreList.push(parseInt((dimensionList[2]["压力"] / this.completeNum) * 100));
+          scoreList.push(parseInt((dimensionList[0]["焦虑"] / this.completeNum) * 100));
           scoreList.push(
-            (parseInt(dimensionList[3]["精神障碍"]) / this.completeNum) * 100
+            parseInt((dimensionList[3]["精神障碍"] / this.completeNum) * 100)
           );
           this.echarts_zhu = this.$refs.echarts_zhu;
           this.option.xAxis.data = nameList;
           this.option.series[0].data = scoreList;
-          debugger;
           let myChart1 = echarts.init(this.echarts_zhu);
           myChart1.setOption(this.option);
         }
@@ -549,64 +590,164 @@ export default {
           this.echarts_zhu = this.$refs.echarts_zhu;
           this.option.xAxis.data = nameList;
           this.option.series[0].data = scoreList;
-          debugger;
           let myChart1 = echarts.init(this.echarts_zhu);
           myChart1.setOption(this.option);
         }
       });
     },
     //获取子组织
-    getOrg() {
-      let url = `/org/findChildOrg?orgNo=${this.userInfo.orgNo}`;
-      this.$http.get(url, {}, (res) => {
-        if (res && res.code == 200) {
-          if (res.data.length > 0) {
-            let list = [];
-            for (let i = 0; i < res.data.length; i++) {
-              let obj = { value: "", label: "" };
-              obj.value = res.data[i].orgNo;
-              obj.label = res.data[i].orgName;
-              list.push(obj);
-            }
-            this.professionOptions = list;
-            this.profession = list[0].value;
-            //然后根据选择的这个选项、、查询具体数据
-            this.queryDetailScore(list[0].value);
-          }
-        } else {
-          // this.$toast.fail(res.msg);
-          this.$message.error(res.msg);
-        }
-      });
-    },
+    // getOrg() {
+    //   let url = `/org/findChildOrg?orgNo=${this.userInfo.orgNo}`;
+    //   this.$http.get(url, {}, (res) => {
+    //     if (res && res.code == 200) {
+    //       if (res.data.length > 0) {
+    //         let list = [];
+    //         for (let i = 0; i < res.data.length; i++) {
+    //           let obj = { value: "", label: "" };
+    //           obj.value = res.data[i].orgNo;
+    //           obj.label = res.data[i].orgName;
+    //           list.push(obj);
+    //         }
+    //         this.professionOptions = list;
+    //         this.profession = list[0].value;
+    //         //然后根据选择的这个选项、、查询具体数据
+    //         this.queryDetailScore(list[0].value);
+    //       }
+    //     } else {
+    //       // this.$toast.fail(res.msg);
+    //       this.$message.error(res.msg);
+    //     }
+    //   });
+    // },
     //查看各个组织下各个维度的平均得分
-    queryDetailScore(val) {
-      let url = `/userRecordScore/findAvgScoreByOrgNo?orgNo=${val}`;
+    queryDetailScore() {
+      let url = `/plan/countRecentPlanDetails`;
       this.$http.get(url, {}, (res) => {
         if (res.code == 200) {
           this.avgData = res.data;
+          console.log(res);
+          console.log(JSON.stringify(res));
+          let scoreList = [
+            {
+              name: "焦虑",
+              type: "line",
+              stack: "Total",
+              data: [],
+              symbolSize: 6,
+              lineStyle: {
+                // type: "dashed",
+                width: 3,
+              },
+            },
+            {
+              name: "抑郁",
+              type: "line",
+
+              data: [],
+              symbolSize: 6,
+              lineStyle: {
+                // type: "dashed",
+                width: 3,
+              },
+            },
+            {
+              name: "压力",
+              type: "line",
+
+              data: [],
+              symbolSize: 6,
+              lineStyle: {
+                // type: "dashed",
+                width: 3,
+              },
+            },
+            {
+              name: "精神障碍",
+              type: "line",
+
+              data: [],
+              symbolSize: 6,
+              lineStyle: {
+                type: "dashed",
+                width: 3,
+              },
+            },
+            {
+              name: "心理健康",
+              type: "line",
+
+              data: [],
+              symbolSize: 6,
+              lineStyle: {
+                type: "dashed",
+                width: 3,
+              },
+            },
+          ];
+
           let nameList = [];
-          let scoreList = [];
-          //设置总共维度
-          for (let i = 0; i < res.data.length; i++) {
-            let obj = { name: res.data[i].name, max: 100, color: "#000000" };
-            nameList.push(obj);
-            scoreList.push(res.data[i].score);
+
+          if (res.data.length > 0) {
+            //
+            for (let i = 0; i < res.data.length; i++) {
+              let k = Object.keys(res.data[i])[0];
+              nameList.push(k);
+              console.log("------------");
+              console.log(res.data[i][k]);
+              let subList = res.data[i][k];
+              for (let j = 0; j < subList.length; j++) {
+                //当前对象 例如 //{"焦虑":"1"}
+                let currentObj = subList[j];
+                //修改焦虑
+                if (currentObj.hasOwnProperty("焦虑")) {
+                  //
+                  scoreList[0].data.push(currentObj["焦虑"]);
+                }
+                //修改抑郁
+                if (currentObj.hasOwnProperty("抑郁")) {
+                  //
+                  scoreList[1].data.push(currentObj["抑郁"]);
+                }
+                //压力
+                if (currentObj.hasOwnProperty("压力")) {
+                  //
+                  scoreList[2].data.push(currentObj["压力"]);
+                }
+                //精神障碍
+                if (currentObj.hasOwnProperty("精神障碍")) {
+                  //
+                  scoreList[3].data.push(currentObj["精神障碍"]);
+                }
+                //心理健康
+                if (currentObj.hasOwnProperty("心理健康")) {
+                  //
+                  scoreList[4].data.push(currentObj["心理健康"]);
+                }
+              }
+            }
           }
+          //   {
+          //   name: "焦虑",
+          //   type: "line",
+          //   stack: "Total",
+          //   data: [132, 101, 134],
+          // },
+          //设置总共维度
+
           //测试计划---
           //修改option
           this.echarts_lei = this.$refs.echarts_lei;
-          this.option_lei.radar.indicator = nameList;
-          this.option_lei.series[0].data[0].value = scoreList;
+          this.option_lei.xAxis.data = nameList;
+          this.option_lei.series = scoreList;
 
           echarts.init(this.echarts_lei).setOption(this.option_lei);
         }
       });
     },
     //选择的专业改变后接着调用
-    professionChange(val) {
-      this.queryDetailScore(val);
-    },
+    // professionChange(val) {
+    //   this.queryDetailScore(val);
+    // },
     //状态---
     planStatusFun(val) {
       let planStatus = val.planStatus;
@@ -667,6 +808,7 @@ export default {
     display: flex;
     min-width: 980px;
     .number_people {
+      position: relative;
       background: url(../../assets/img/home/bg.png) no-repeat;
       background-size: cover;
       border-radius: 20px;
@@ -678,7 +820,7 @@ export default {
         margin-top: 20px;
         margin-left: 20px;
         color: #ffffff;
-        font-size: 24px;
+        font-size: 20px;
         letter-spacing: 3px;
         margin-bottom: 20px;
         font-weight: 700;
@@ -693,18 +835,21 @@ export default {
           display: flex;
           flex-direction: column;
           .yuan_name {
-            overflow: hidden;
-            text-overflow: ellipsis;
-            white-space: nowrap;
+            width: 80%;
             margin-left: 20px;
-            margin-top: 20px;
+            margin-top: 10px;
             color: #ffffff;
             letter-spacing: 3px;
-            font-size: 32px;
+            font-size: 26px;
+            // flex:1,;
+            overflow: hidden;
+            -webkit-line-clamp: 1;
+            display: -webkit-box;
+            -webkit-box-orient: vertical;
           }
           .yuan_people {
             margin-left: 20px;
-            margin-top: 20px;
+            margin-top: 10px;
             color: #ffffff;
             font-size: 60px;
             letter-spacing: 3px;
@@ -741,7 +886,7 @@ export default {
         width: 100%;
         flex-direction: column;
         .plan_top {
-          font-size: 24px;
+          font-size: 20px;
           letter-spacing: 3px;
           font-weight: 700;
           color: #000000;
@@ -820,7 +965,7 @@ export default {
           padding: 0 20px;
           color: #222222;
           font-weight: 700;
-          font-size: 24px;
+          font-size: 20px;
         }
         .detail {
           padding: 0 20px;
@@ -882,22 +1027,39 @@ export default {
       }
     }
     .block_right {
-      box-sizing: border-box;
-
+      // box-sizing: border-box;
+      // background-color: #00bf78;
       flex: 10;
       // background-color: #d32d2d;
       height: 100%;
       display: flex;
       flex-direction: column;
-      background-color: #f7f7f7;
-      .block_avg {
+      // background-color: #f7f7f7;
+      .right_zu {
+        border-radius: 20px;
         margin-left: 20px;
-        font-weight: 700;
+        background-color: #ffffff;
+        flex: 10;
+        // background-color: #d32d2d;
+        height: 100%;
+        display: flex;
+        flex-direction: column;
+        .cpqs {
+          margin-top: 10px;
+          margin-left: 20px;
+          font-size: 20px;
+          letter-spacing: 3px;
+          font-weight: 700;
+        }
+        .block_lei {
+          flex: 1;
+          // background-color: #000000;
+          margin-left: 20px;
+        }
       }
-      .block_lei {
-        flex: 1;
-        // background-color: #000000;
+      .block_avg {
         margin-left: 20px;
+        font-weight: 700;
       }
     }
   }