home.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. <template>
  2. <div class="page">
  3. <el-row gutter="10">
  4. <el-col :span="6">
  5. <div class="home_box">
  6. <div class="tg_top adfacjb">
  7. <div class="tgt_l">执行项目</div>
  8. <div class="tgt_r">
  9. <img src="@/assets/images/agent/home_xm.png">
  10. </div>
  11. </div>
  12. <div class="tg_num adfac">{{ 42 }}<span>个</span></div>
  13. <div class="tg_jd">
  14. <div class="tj tj1" :style="{'width':70+'%'}"></div>
  15. </div>
  16. <div class="tg_tn adfac">
  17. <div class="tt_pre adfac">进行中<span>{{6}}</span></div>
  18. <div class="tt_pre adfac">已完成<span>{{36}}</span></div>
  19. </div>
  20. </div>
  21. </el-col>
  22. <el-col :span="6">
  23. <div class="home_box">
  24. <div class="tg_top adfacjb">
  25. <div class="tgt_l">调查问卷</div>
  26. <div class="tgt_r">
  27. <img src="@/assets/images/agent/home_wj.png">
  28. </div>
  29. </div>
  30. <div class="tg_num adfac">{{ 120 }}<span>份</span></div>
  31. <div class="tg_jd">
  32. <div class="tj tj2" :style="{'width':40+'%'}"></div>
  33. </div>
  34. <div class="tg_tn adfac">
  35. <div class="tt_pre adfac">已完成<span>{{36}}</span></div>
  36. <div class="tt_pre adfac">进行中<span>{{6}}</span></div>
  37. </div>
  38. </div>
  39. </el-col>
  40. <el-col :span="6">
  41. <div class="home_box">
  42. <div class="tg_top adfacjb">
  43. <div class="tgt_l">团队</div>
  44. <div class="tgt_r">
  45. <img src="@/assets/images/agent/home_td.png">
  46. </div>
  47. </div>
  48. <div class="tg_num adfac">{{ 43 }}<span>个</span></div>
  49. <div class="tg_jd">
  50. <div class="tj tj3" :style="{'width':100+'%'}"></div>
  51. </div>
  52. <div class="tg_tn adfac">
  53. <div class="tt_pre adfac">团队成员<span>{{236}}</span></div>
  54. </div>
  55. </div>
  56. </el-col>
  57. <el-col :span="6">
  58. <div class="home_box">
  59. <div class="tg_top adfacjb">
  60. <div class="tgt_l">知识总量</div>
  61. <div class="tgt_r">
  62. <img src="@/assets/images/agent/home_zs.png">
  63. </div>
  64. </div>
  65. <div class="tg_num adfac">{{ 356720 }}<span>条</span></div>
  66. <div class="tg_jd">
  67. <div class="tj tj4" :style="{'width':80+'%'}"></div>
  68. </div>
  69. <div class="tg_tn adfac">
  70. <div class="tt_pre adfac">解析中<span>{{6}}</span></div>
  71. <div class="tt_pre adfac">已完成<span>{{356714}}</span></div>
  72. </div>
  73. </div>
  74. </el-col>
  75. </el-row>
  76. <el-row gutter="10" style="margin-top: 10px;">
  77. <el-col :span="12">
  78. <div class="home_box tb">
  79. <div class="tj_top adfacjb">
  80. <div class="tjt_l">
  81. <p>答卷数量统计</p>
  82. <!-- <el-date-picker style="border: none;"
  83. v-model="startEndDate"
  84. type="daterange"
  85. range-separator="-"
  86. start-placeholder="开始日期"
  87. end-placeholder="结束日期">
  88. </el-date-picker> -->
  89. </div>
  90. <div class="tjt_r adf">
  91. <div class="tjtr_pre" :class="{'active':tidx===1}" @click="handleChangeTime(1)">近15天</div>
  92. <div class="tjtr_pre" :class="{'active':tidx===2}" @click="handleChangeTime(2)">近一月</div>
  93. </div>
  94. </div>
  95. <div class="tj_chart">
  96. <div ref="djsltjRef" style="width: 100%; height: 290px;"></div>
  97. </div>
  98. </div>
  99. </el-col>
  100. <el-col :span="12">
  101. <div class="home_box tb">
  102. <div class="zb_title">问卷类别占比</div>
  103. <div ref="wjlbzbRef" style="width: 100%; height: 300px;"></div>
  104. </div>
  105. </el-col>
  106. </el-row>
  107. <el-row gutter="10" style="margin-top: 10px;">
  108. <el-col :span="12">
  109. <div class="home_box hb">
  110. <div class="hb_title adfacjb">
  111. <div class="hbt_l">最近的调查问卷</div>
  112. <div class="hbt_r" @click="toTurn('agent-questionnaire')">查看更多 ></div>
  113. </div>
  114. <div class="hb_list">
  115. <div class="hl_item adfacjb" v-for="(item,index) in dcwjList" :key="index">
  116. <div class="hil_l">
  117. <p>{{ item.enterpriseName }}</p>
  118. <p class="tip">{{ item.teamName }} · {{ item.userNum }}名成员</p>
  119. </div>
  120. <div class="hil_r">
  121. <div class="hr_btn" v-if="item.status===1">已完成</div>
  122. <div class="hr_btn jxz" v-if="item.status===0">进行中</div>
  123. </div>
  124. </div>
  125. </div>
  126. </div>
  127. </el-col>
  128. <el-col :span="12">
  129. <div class="home_box hb">
  130. <div class="hb_title adfacjb">
  131. <div class="hbt_l">近期报告</div>
  132. <div class="hbt_r" @click="toTurn('agent-report')">更多报告 ></div>
  133. </div>
  134. <div class="hb_list">
  135. <div class="hl_item adfacjb" v-for="(item,index) in jqbgList" :key="index">
  136. <div class="hil_l">
  137. <p>{{ item.name }}</p>
  138. <p class="tip">{{ item.type }} · 生成于{{ item.time }}</p>
  139. </div>
  140. <div class="hil_r">
  141. <div class="hr_btn ck">查看</div>
  142. </div>
  143. </div>
  144. </div>
  145. </div>
  146. </el-col>
  147. </el-row>
  148. </div>
  149. </template>
  150. <script setup name="">
  151. import * as echarts from "echarts";
  152. import { ref, getCurrentInstance, onMounted } from 'vue'
  153. import { getTeamQuestionnaireList,getQueNumLineGraph,getQueTypePieChart } from '@/api/agent/index.js'
  154. const { proxy } = getCurrentInstance();
  155. const tidx = ref(1);
  156. const startEndDate = ref('');
  157. const djsltjRef = ref(null);
  158. const wjlbzbRef = ref(null);
  159. const dcwjList = ref([
  160. {name:'领导团队评估',team:'泰科公司阿尔法团队',persons:12,status:1},
  161. {name:'领导团队评估',team:'泰科公司阿尔法团队',persons:12,status:0},
  162. {name:'领导团队评估',team:'泰科公司阿尔法团队',persons:12,status:1},
  163. {name:'领导团队评估',team:'泰科公司阿尔法团队',persons:12,status:1},
  164. {name:'领导团队评估',team:'泰科公司阿尔法团队',persons:12,status:1}
  165. ]);
  166. const jqbgList = ref([
  167. {name:'TechCorp 团队分析',type:'团队报告',time:'2025-04-20 13:00'},
  168. {name:'TechCorp 团队分析',type:'个人报告',time:'2025-04-20 13:00'},
  169. {name:'TechCorp 团队分析',type:'团队报告',time:'2025-04-20 13:00'},
  170. {name:'TechCorp 团队分析',type:'团队报告',time:'2025-04-20 13:00'},
  171. {name:'TechCorp 团队分析',type:'团队报告',time:'2025-04-20 13:00'}
  172. ])
  173. const typeName = {
  174. 1:'初级问卷',
  175. 2:'中级问卷',
  176. 3:'高级问卷'
  177. }
  178. const handleChangeTime = (idx) => {
  179. tidx.value = idx;
  180. getQueNumLineGraphFn();
  181. }
  182. const toTurn = (path) => {
  183. proxy.$router.push({path: path});
  184. }
  185. const initDjsltjChart = (xdata,ydata) => {
  186. let myChart = echarts.init(djsltjRef.value);
  187. let option = {
  188. xAxis: {
  189. type: 'category',
  190. data: xdata
  191. },
  192. tooltip: {
  193. trigger: 'axis'
  194. },
  195. yAxis: {
  196. type: 'value'
  197. },
  198. grid: {
  199. left: '1%',
  200. right: '1%',
  201. bottom: '1%',
  202. top: '10%',
  203. containLabel: true
  204. },
  205. series: [
  206. {
  207. name: '答卷数量',
  208. data: ydata,
  209. type: 'line',
  210. smooth: true,
  211. showSymbol: false,
  212. areaStyle: {
  213. opacity: 0.8,
  214. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  215. {
  216. offset: 0,
  217. color: '#D5E5FC'
  218. },
  219. {
  220. offset: 1,
  221. color: '#F2E9F0'
  222. }
  223. ])
  224. },
  225. lineStyle: {
  226. width: 3,
  227. color:{
  228. type: 'linear',
  229. x: 0,
  230. y: 0,
  231. x2: 1,
  232. y2: 0,
  233. colorStops: [{
  234. offset: 1, color: '#8360FC'
  235. }, {
  236. offset: 0.5, color: '#8E49CB'
  237. }, {
  238. offset: 0, color: '#25D9FF'
  239. }]
  240. }
  241. },
  242. }
  243. ]
  244. };
  245. myChart.setOption(option)
  246. }
  247. const initWjlbzbChart = (data) => {
  248. let myChart = echarts.init(wjlbzbRef.value);
  249. let option = {
  250. tooltip: {
  251. trigger: 'item'
  252. },
  253. legend: {
  254. bottom: '-1%',
  255. left: 'center'
  256. },
  257. color:['#761E6A','#D2B7CE','#9D5F94'],
  258. series: [
  259. {
  260. name: '问卷类别占比',
  261. type: 'pie',
  262. radius: ['50%', '80%'],
  263. center: ['50%', '45%'],
  264. itemStyle: {
  265. borderRadius: 0
  266. },
  267. data
  268. }
  269. ]
  270. };
  271. myChart.setOption(option)
  272. }
  273. const getTeamQuestionnaireListFn = () => {
  274. getTeamQuestionnaireList({}).then(res=>{
  275. dcwjList.value = res.data.list.splice(0,5);
  276. })
  277. }
  278. const getQueNumLineGraphFn = () => {
  279. getQueNumLineGraph(tidx.value).then(res=>{
  280. if(res.code===0){
  281. let xdata = res.data.map(d=>d.reportDate);
  282. let ydata = res.data.map(d=>d.dataCount);
  283. initDjsltjChart(xdata,ydata);
  284. }
  285. })
  286. }
  287. const getQueTypePieChartFn = () => {
  288. getQueTypePieChart().then(res=>{
  289. if(res.code===0){
  290. let data = res.data.map(d=>{
  291. return {
  292. value: d.quantity,
  293. name: typeName[d.type]
  294. }
  295. })
  296. initWjlbzbChart(data);
  297. }
  298. })
  299. }
  300. onMounted(()=>{
  301. initDjsltjChart();
  302. initWjlbzbChart();
  303. getTeamQuestionnaireListFn();
  304. getQueNumLineGraphFn();
  305. getQueTypePieChartFn();
  306. })
  307. </script>
  308. <style scoped lang="scss">
  309. .page{
  310. padding: 14px 16px;
  311. background-color: #FAFAFA;
  312. overflow-y: auto;
  313. .home_box{
  314. padding: 26px 20px;
  315. background: #FFFFFF;
  316. border-radius: 6px;
  317. border: 1px solid #F3F4F6;
  318. &.hb{
  319. min-height: 446px;
  320. }
  321. &.tb{
  322. min-height: 352px;
  323. }
  324. .tg_top{
  325. .tgt_l{
  326. font-family: PingFangSC, PingFang SC;
  327. font-weight: 400;
  328. font-size: 14px;
  329. color: #646464;
  330. line-height: 16px;
  331. }
  332. .tgt_r{
  333. img{
  334. width: 40px;
  335. height: 40px;
  336. }
  337. }
  338. }
  339. .tg_num{
  340. margin-top: 1px;
  341. font-family: DINAlternate, DINAlternate;
  342. font-weight: bold;
  343. font-size: 32px;
  344. color: #252525;
  345. line-height: 32px;
  346. span{
  347. font-family: PingFangSC, PingFang SC;
  348. font-weight: 400;
  349. font-size: 14px;
  350. color: #999999;
  351. line-height: 16px;
  352. margin-left: 5px;
  353. }
  354. }
  355. .tg_jd{
  356. margin-top: 14px;
  357. width: 100%;
  358. height: 8px;
  359. background: #F3F4F6;
  360. position: relative;
  361. border-radius: 4px;
  362. .tj{
  363. height: 8px;
  364. border-radius: 4px;
  365. position: absolute;
  366. left: 0;
  367. top: 0;
  368. &.tj1{
  369. background: linear-gradient( 270deg, #3C82F6 0%, #3C82F6 100%);
  370. }
  371. &.tj2{
  372. background: linear-gradient( 270deg, #9D5F94 0%, #761E6A 100%);
  373. }
  374. &.tj3{
  375. background: linear-gradient( 90deg, #189B9B 0%, #7DC6C6 100%);
  376. }
  377. &.tj4{
  378. background: linear-gradient( 90deg, #FFD750 0%, #FDE182 100%);
  379. }
  380. }
  381. }
  382. .tg_tn{
  383. margin-top: 18px;
  384. .tt_pre{
  385. font-family: PingFangSC, PingFang SC;
  386. font-weight: 400;
  387. font-size: 14px;
  388. color: #6B7280;
  389. line-height: 14px;
  390. span{
  391. color: #252525;
  392. margin-left: 5px;
  393. }
  394. &:last-child{
  395. margin-left: 48px;
  396. }
  397. }
  398. }
  399. .tj_top{
  400. .tjt_l{
  401. p{
  402. font-family: PingFang-SC, PingFang-SC;
  403. font-weight: bold;
  404. font-size: 16px;
  405. color: #393939;
  406. line-height: 22px;
  407. }
  408. }
  409. .tjt_r{
  410. .tjtr_pre{
  411. width: 54px;
  412. height: 32px;
  413. border-radius: 6px;
  414. border: 1px solid #E5E7EB;
  415. font-family: PingFangSC, PingFang SC;
  416. font-weight: 400;
  417. font-size: 12px;
  418. color: #4B5563;
  419. line-height: 28px;
  420. text-align: center;
  421. cursor: pointer;
  422. margin-left: 16px;
  423. &.active{
  424. background: #761E6A;
  425. color: #FFFFFF;
  426. }
  427. }
  428. }
  429. }
  430. .zb_title{
  431. font-family: PingFang-SC, PingFang-SC;
  432. font-weight: bold;
  433. font-size: 16px;
  434. color: #252525;
  435. line-height: 22px;
  436. }
  437. .hb_title{
  438. .hbt_l{
  439. font-family: PingFang-SC, PingFang-SC;
  440. font-weight: bold;
  441. font-size: 16px;
  442. color: #252525;
  443. line-height: 22px;
  444. }
  445. .hbt_r{
  446. font-family: PingFangSC, PingFang SC;
  447. font-weight: 400;
  448. font-size: 14px;
  449. color: #761E6A;
  450. line-height: 20px;
  451. text-align: right;
  452. cursor: pointer;
  453. }
  454. }
  455. .hb_list{
  456. margin-top: 12px;
  457. .hl_item{
  458. width: 100%;
  459. padding: 10px 20px;
  460. box-sizing: border-box;
  461. margin-top: 12px;
  462. background: #F9FAFB;
  463. border-radius: 8px;
  464. .hil_l{
  465. p{
  466. font-family: PingFang-SC, PingFang-SC;
  467. font-weight: bold;
  468. font-size: 14px;
  469. color: #252525;
  470. line-height: 20px;
  471. &.tip{
  472. font-weight: 400;
  473. color: #6B7280;
  474. margin-top: 2px;
  475. }
  476. }
  477. }
  478. .hil_r{
  479. .hr_btn{
  480. width: 68px;
  481. height: 28px;
  482. background: #E1F0F0;
  483. border-radius: 14px;
  484. font-family: PingFangSC, PingFang SC;
  485. font-weight: 400;
  486. font-size: 14px;
  487. color: #009191;
  488. line-height: 28px;
  489. text-align: center;
  490. &.jxz{
  491. background: #FCECB6;
  492. color: #864F10;
  493. }
  494. &.ck{
  495. background: rgba(118,30,106,0.16);
  496. color: #761E6A;
  497. cursor: pointer;
  498. }
  499. }
  500. }
  501. }
  502. }
  503. }
  504. }
  505. ::v-deep .el-range-editor.el-input__inner{
  506. padding: 3px 0 !important;
  507. }
  508. ::v-deep .el-date-editor .el-range__icon{
  509. display: none !important;
  510. }
  511. ::v-deep .el-date-editor .el-range-input{
  512. width: 30% !important;
  513. }
  514. </style>