home.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  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.reportName }}</p>
  138. <p class="tip">{{ item.type==1?'团队报告':item.type==2?'个人报告':'未知' }} · 生成于{{ item.createDate }}</p>
  139. </div>
  140. <div class="hil_r">
  141. <div class="hr_btn ck" @click="handleViewReport(item)">查看</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,getReportList } 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 getReportListFn = () => {
  279. getReportList().then(res=>{
  280. jqbgList.value = res.data.splice(0,5);
  281. })
  282. }
  283. const getQueNumLineGraphFn = () => {
  284. getQueNumLineGraph(tidx.value).then(res=>{
  285. if(res.code===0){
  286. let xdata = res.data.map(d=>d.reportDate);
  287. let ydata = res.data.map(d=>d.dataCount);
  288. initDjsltjChart(xdata,ydata);
  289. }
  290. })
  291. }
  292. const getQueTypePieChartFn = () => {
  293. getQueTypePieChart().then(res=>{
  294. if(res.code===0){
  295. let data = res.data.map(d=>{
  296. return {
  297. value: d.quantity,
  298. name: typeName[d.type]
  299. }
  300. })
  301. initWjlbzbChart(data);
  302. }
  303. })
  304. }
  305. const handleViewReport = (item) => {
  306. proxy.$router.push({path:'/agent-report',query:{relationId: item.relationId,type: item.type}});
  307. }
  308. onMounted(()=>{
  309. initDjsltjChart();
  310. initWjlbzbChart();
  311. getTeamQuestionnaireListFn();
  312. getReportListFn();
  313. getQueNumLineGraphFn();
  314. getQueTypePieChartFn();
  315. })
  316. </script>
  317. <style scoped lang="scss">
  318. .page{
  319. padding: 14px 16px;
  320. background-color: #FAFAFA;
  321. overflow-y: auto;
  322. .home_box{
  323. padding: 26px 20px;
  324. background: #FFFFFF;
  325. border-radius: 6px;
  326. border: 1px solid #F3F4F6;
  327. &.hb{
  328. min-height: 446px;
  329. }
  330. &.tb{
  331. min-height: 352px;
  332. }
  333. .tg_top{
  334. .tgt_l{
  335. font-family: PingFangSC, PingFang SC;
  336. font-weight: 400;
  337. font-size: 14px;
  338. color: #646464;
  339. line-height: 16px;
  340. }
  341. .tgt_r{
  342. img{
  343. width: 40px;
  344. height: 40px;
  345. }
  346. }
  347. }
  348. .tg_num{
  349. margin-top: 1px;
  350. font-family: DINAlternate, DINAlternate;
  351. font-weight: bold;
  352. font-size: 32px;
  353. color: #252525;
  354. line-height: 32px;
  355. span{
  356. font-family: PingFangSC, PingFang SC;
  357. font-weight: 400;
  358. font-size: 14px;
  359. color: #999999;
  360. line-height: 16px;
  361. margin-left: 5px;
  362. }
  363. }
  364. .tg_jd{
  365. margin-top: 14px;
  366. width: 100%;
  367. height: 8px;
  368. background: #F3F4F6;
  369. position: relative;
  370. border-radius: 4px;
  371. .tj{
  372. height: 8px;
  373. border-radius: 4px;
  374. position: absolute;
  375. left: 0;
  376. top: 0;
  377. &.tj1{
  378. background: linear-gradient( 270deg, #3C82F6 0%, #3C82F6 100%);
  379. }
  380. &.tj2{
  381. background: linear-gradient( 270deg, #9D5F94 0%, #761E6A 100%);
  382. }
  383. &.tj3{
  384. background: linear-gradient( 90deg, #189B9B 0%, #7DC6C6 100%);
  385. }
  386. &.tj4{
  387. background: linear-gradient( 90deg, #FFD750 0%, #FDE182 100%);
  388. }
  389. }
  390. }
  391. .tg_tn{
  392. margin-top: 18px;
  393. .tt_pre{
  394. font-family: PingFangSC, PingFang SC;
  395. font-weight: 400;
  396. font-size: 14px;
  397. color: #6B7280;
  398. line-height: 14px;
  399. span{
  400. color: #252525;
  401. margin-left: 5px;
  402. }
  403. &:last-child{
  404. margin-left: 48px;
  405. }
  406. }
  407. }
  408. .tj_top{
  409. .tjt_l{
  410. p{
  411. font-family: PingFang-SC, PingFang-SC;
  412. font-weight: bold;
  413. font-size: 16px;
  414. color: #393939;
  415. line-height: 22px;
  416. }
  417. }
  418. .tjt_r{
  419. .tjtr_pre{
  420. width: 54px;
  421. height: 32px;
  422. border-radius: 6px;
  423. border: 1px solid #E5E7EB;
  424. font-family: PingFangSC, PingFang SC;
  425. font-weight: 400;
  426. font-size: 12px;
  427. color: #4B5563;
  428. line-height: 28px;
  429. text-align: center;
  430. cursor: pointer;
  431. margin-left: 16px;
  432. &.active{
  433. background: #761E6A;
  434. color: #FFFFFF;
  435. }
  436. }
  437. }
  438. }
  439. .zb_title{
  440. font-family: PingFang-SC, PingFang-SC;
  441. font-weight: bold;
  442. font-size: 16px;
  443. color: #252525;
  444. line-height: 22px;
  445. }
  446. .hb_title{
  447. .hbt_l{
  448. font-family: PingFang-SC, PingFang-SC;
  449. font-weight: bold;
  450. font-size: 16px;
  451. color: #252525;
  452. line-height: 22px;
  453. }
  454. .hbt_r{
  455. font-family: PingFangSC, PingFang SC;
  456. font-weight: 400;
  457. font-size: 14px;
  458. color: #761E6A;
  459. line-height: 20px;
  460. text-align: right;
  461. cursor: pointer;
  462. }
  463. }
  464. .hb_list{
  465. margin-top: 12px;
  466. .hl_item{
  467. width: 100%;
  468. padding: 10px 20px;
  469. box-sizing: border-box;
  470. margin-top: 12px;
  471. background: #F9FAFB;
  472. border-radius: 8px;
  473. .hil_l{
  474. p{
  475. font-family: PingFang-SC, PingFang-SC;
  476. font-weight: bold;
  477. font-size: 14px;
  478. color: #252525;
  479. line-height: 20px;
  480. &.tip{
  481. font-weight: 400;
  482. color: #6B7280;
  483. margin-top: 2px;
  484. }
  485. }
  486. }
  487. .hil_r{
  488. .hr_btn{
  489. width: 68px;
  490. height: 28px;
  491. background: #E1F0F0;
  492. border-radius: 14px;
  493. font-family: PingFangSC, PingFang SC;
  494. font-weight: 400;
  495. font-size: 14px;
  496. color: #009191;
  497. line-height: 28px;
  498. text-align: center;
  499. &.jxz{
  500. background: #FCECB6;
  501. color: #864F10;
  502. }
  503. &.ck{
  504. background: rgba(118,30,106,0.16);
  505. color: #761E6A;
  506. cursor: pointer;
  507. }
  508. }
  509. }
  510. }
  511. }
  512. }
  513. }
  514. ::v-deep .el-range-editor.el-input__inner{
  515. padding: 3px 0 !important;
  516. }
  517. ::v-deep .el-date-editor .el-range__icon{
  518. display: none !important;
  519. }
  520. ::v-deep .el-date-editor .el-range-input{
  521. width: 30% !important;
  522. }
  523. </style>