Przeglądaj źródła

首页接口联调(部分,其他接口未完成)

htc 4 dni temu
rodzic
commit
233a154058
2 zmienionych plików z 83 dodań i 21 usunięć
  1. 15 0
      src/api/agent/index.js
  2. 68 21
      src/views/modules/home.vue

+ 15 - 0
src/api/agent/index.js

@@ -7,6 +7,21 @@ export function getContractList(query) {
   })
 }
 
+// ---start 工作台
+export function getQueNumLineGraph(query) {
+  return request({
+    url: '/core/home/getQueNumLineGraph/'+query,
+    method: 'get'
+  })
+}
+export function getQueTypePieChart() {
+  return request({
+    url: '/core/home/getQueTypePieChart',
+    method: 'get'
+  })
+}
+// ---start 工作台
+
 // ---start 问卷管理
 export function getQuestionnaireList(query) {
   return request({

+ 68 - 21
src/views/modules/home.vue

@@ -75,30 +75,30 @@
     </el-row>
     <el-row gutter="10" style="margin-top: 10px;">
       <el-col :span="12">
-        <div class="home_box">
+        <div class="home_box tb">
           <div class="tj_top adfacjb">
             <div class="tjt_l">
               <p>答卷数量统计</p>
-              <el-date-picker style="border: none;"
+              <!-- <el-date-picker style="border: none;"
                 v-model="startEndDate"
                 type="daterange"
                 range-separator="-"
                 start-placeholder="开始日期"
                 end-placeholder="结束日期">
-              </el-date-picker>
+              </el-date-picker> -->
             </div>
             <div class="tjt_r adf">
               <div class="tjtr_pre" :class="{'active':tidx===1}" @click="handleChangeTime(1)">近15天</div>
-              <div class="tjtr_pre" :class="{'active':tidx===2}" @click="handleChangeTime(2)">近一</div>
+              <div class="tjtr_pre" :class="{'active':tidx===2}" @click="handleChangeTime(2)">近一</div>
             </div>
           </div>
           <div class="tj_chart">
-            <div ref="djsltjRef" style="width: 100%; height: 260px;"></div>
+            <div ref="djsltjRef" style="width: 100%; height: 290px;"></div>
           </div>
         </div>
       </el-col>
       <el-col :span="12">
-        <div class="home_box">
+        <div class="home_box tb">
           <div class="zb_title">问卷类别占比</div>
           <div ref="wjlbzbRef" style="width: 100%; height: 300px;"></div>
         </div>
@@ -106,16 +106,16 @@
     </el-row>
     <el-row gutter="10" style="margin-top: 10px;">
       <el-col :span="12">
-        <div class="home_box">
+        <div class="home_box hb">
           <div class="hb_title adfacjb">
             <div class="hbt_l">最近的调查问卷</div>
-            <div class="hbt_r">查看更多 ></div>
+            <div class="hbt_r" @click="toTurn('agent-questionnaire')">查看更多 ></div>
           </div>
           <div class="hb_list">
             <div class="hl_item adfacjb" v-for="(item,index) in dcwjList" :key="index">
               <div class="hil_l">
-                <p>{{ item.name }}</p>
-                <p class="tip">{{ item.team }} · {{ item.persons }}名成员</p>
+                <p>{{ item.enterpriseName }}</p>
+                <p class="tip">{{ item.teamName }} · {{ item.userNum }}名成员</p>
               </div>
               <div class="hil_r">
                 <div class="hr_btn" v-if="item.status===1">已完成</div>
@@ -126,10 +126,10 @@
         </div>
       </el-col>
       <el-col :span="12">
-        <div class="home_box">
+        <div class="home_box hb">
           <div class="hb_title adfacjb">
             <div class="hbt_l">近期报告</div>
-            <div class="hbt_r">更多报告 ></div>
+            <div class="hbt_r" @click="toTurn('agent-report')">更多报告 ></div>
           </div>
           <div class="hb_list">
             <div class="hl_item adfacjb" v-for="(item,index) in jqbgList" :key="index">
@@ -151,6 +151,7 @@
 <script setup name="">
   import * as echarts from "echarts";
   import { ref, getCurrentInstance, onMounted } from 'vue'
+  import { getTeamQuestionnaireList,getQueNumLineGraph,getQueTypePieChart } from '@/api/agent/index.js'
   const { proxy } = getCurrentInstance();
 
   const tidx = ref(1);
@@ -172,17 +173,27 @@
     {name:'TechCorp 团队分析',type:'团队报告',time:'2025-04-20 13:00'},
     {name:'TechCorp 团队分析',type:'团队报告',time:'2025-04-20 13:00'}
   ])
+  const typeName = {
+    1:'初级问卷',
+    2:'中级问卷',
+    3:'高级问卷'
+  }
 
   const handleChangeTime = (idx) => {
     tidx.value = idx;
+    getQueNumLineGraphFn();
+  }
+
+  const toTurn = (path) => {
+    proxy.$router.push({path: path});
   }
 
-  const initDjsltjChart = () => {
+  const initDjsltjChart = (xdata,ydata) => {
     let myChart = echarts.init(djsltjRef.value);
     let option = {
       xAxis: {
         type: 'category',
-        data: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']
+        data: xdata
       },
       tooltip: {
         trigger: 'axis'
@@ -199,7 +210,8 @@
       },
       series: [
         {
-          data: [0, 40, 30, 70, 100, 60, 50, 40, 70, 60, 50, 0],
+          name: '答卷数量',
+          data: ydata,
           type: 'line',
           smooth: true,
           showSymbol: false,
@@ -239,7 +251,7 @@
     myChart.setOption(option)
   }
 
-  const initWjlbzbChart = () => {
+  const initWjlbzbChart = (data) => {
     let myChart = echarts.init(wjlbzbRef.value);
     let option = {
       tooltip: {
@@ -259,20 +271,49 @@
           itemStyle: {
             borderRadius: 0
           },
-          data: [
-            { value: 1048, name: '高级问卷' },
-            { value: 735, name: '中级问卷' },
-            { value: 580, name: '初级问卷' },
-          ]
+          data
         }
       ]
     };
     myChart.setOption(option)
   }
 
+  const getTeamQuestionnaireListFn = () => {
+    getTeamQuestionnaireList({}).then(res=>{
+      dcwjList.value = res.data.list.splice(0,5);
+    })
+  }
+
+  const getQueNumLineGraphFn = () => {
+    getQueNumLineGraph(tidx.value).then(res=>{
+      if(res.code===0){
+        let xdata = res.data.map(d=>d.reportDate);
+        let ydata = res.data.map(d=>d.dataCount);
+        initDjsltjChart(xdata,ydata);
+      }
+    })
+  }
+
+  const getQueTypePieChartFn = () => {
+    getQueTypePieChart().then(res=>{
+      if(res.code===0){
+        let data = res.data.map(d=>{
+          return {
+            value: d.quantity,
+            name: typeName[d.type]
+          }
+        })
+        initWjlbzbChart(data);
+      }
+    })
+  }
+
   onMounted(()=>{
     initDjsltjChart();
     initWjlbzbChart();
+    getTeamQuestionnaireListFn();
+    getQueNumLineGraphFn();
+    getQueTypePieChartFn();
   })
 </script>
 
@@ -287,6 +328,12 @@
       background: #FFFFFF;
       border-radius: 6px;
       border: 1px solid #F3F4F6;
+      &.hb{
+        min-height: 446px;
+      }
+      &.tb{
+        min-height: 352px;
+      }
       .tg_top{
         .tgt_l{
           font-family: PingFangSC, PingFang SC;