generalSituation.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705
  1. <template>
  2. <div class="pp">
  3. <!-- <img style="width:90%;" src="../../assets/report/home2.png" /> -->
  4. <div class="general_situation">
  5. <div class="number_people">
  6. <div class="number_people_top">人数统计</div>
  7. <div class="number_people_yuan">
  8. <div class="out">
  9. <span class="yuan_name">科技学院</span>
  10. <span class="yuan_num">总人数</span>
  11. <span class="yuan_people">{{ peopleData["总人数"] }}人</span>
  12. </div>
  13. <div class="computer">
  14. <div v-for="(item, key) in peopleData" :key="key">
  15. <div class="computer_detail" v-if="key != '总人数'">
  16. {{ key }}:{{ item }}人
  17. </div>
  18. </div>
  19. </div>
  20. </div>
  21. </div>
  22. <div class="plan">
  23. <div class="plan_inner">
  24. <span class="plan_top">计划状态</span>
  25. <div class="table_header">
  26. <div class="detail">测试名称</div>
  27. <div class="detail">创建时间</div>
  28. <div class="detail">状态</div>
  29. </div>
  30. <div class="table_a">
  31. <div v-if="tableData.length == 0">
  32. <div style="text-align: center; margin-top: 10px">暂无数据</div>
  33. </div>
  34. <div v-else>
  35. <div class="table_body" v-for="item in tableData" :key="item.id">
  36. <div class="detail">{{ item.planName }}</div>
  37. <div class="detail">{{ item.createDate }}</div>
  38. <div
  39. class="detail"
  40. :style="{
  41. color:
  42. item.planStatus == '1'
  43. ? '#EE6060'
  44. : item.planStatus == '2'
  45. ? '#073CFF'
  46. : '#5ADE6C',
  47. fontWeight: '700',
  48. }"
  49. >
  50. {{ planStatusFun(item) }}
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. </div>
  57. </div>
  58. <div class="recently">
  59. <div class="recently_bottom">
  60. <div class="recently_bottom_font">最近测试结果</div>
  61. <div class="block">
  62. <div class="block_left">
  63. <div>
  64. <div class="block_table">
  65. <div class="block_detail">计划名称</div>
  66. <div class="block_detail">专业</div>
  67. <div class="block_detail">测试时间</div>
  68. <div class="block_detail">测试人数</div>
  69. </div>
  70. <div class="block_body">
  71. <div
  72. v-if="planData.hasOwnProperty('planName')"
  73. style="display: flex; flex: 1"
  74. >
  75. <div class="block_detail" v-for="(item, key) in planData" :key="key">
  76. {{ item }}
  77. </div>
  78. </div>
  79. <div v-else style="width: 100%; text-align: center; margin-top: 10px">
  80. <div>暂无数据</div>
  81. </div>
  82. <!-- <div class="block_detail">测试专业</div>
  83. <div class="block_detail">测试人数</div>
  84. <div class="block_detail">测试时间</div> -->
  85. </div>
  86. <div v-if="planData.hasOwnProperty('planName')" class="profession">
  87. {{ planData["planName"] }}计划总分等级人数
  88. </div>
  89. <div v-else class="profession">计划总分等级人数</div>
  90. </div>
  91. <div
  92. v-if="planData.hasOwnProperty('planName')"
  93. class="echarts_style"
  94. ref="echarts_zhu"
  95. ></div>
  96. <div
  97. v-else
  98. style="
  99. display: flex;
  100. align-items: center;
  101. justify-content: center;
  102. height: 100%;
  103. "
  104. >
  105. <span style="text-align: center">暂无数据</span>
  106. </div>
  107. </div>
  108. <div class="block_right">
  109. <div class="block_avg">
  110. 各个专业维度平均分
  111. <el-select
  112. v-model="profession"
  113. placeholder="请选择"
  114. @change="professionChange"
  115. >
  116. <el-option
  117. v-for="item in professionOptions"
  118. :key="item.value"
  119. :label="item.label"
  120. :value="item.value"
  121. >
  122. </el-option>
  123. </el-select>
  124. </div>
  125. <div v-if="profession != ''" class="block_lei" ref="echarts_lei"></div>
  126. <div
  127. v-else
  128. style="
  129. display: flex;
  130. justify-content: center;
  131. align-items: center;
  132. height: 100%;
  133. "
  134. >
  135. 暂无数据
  136. </div>
  137. </div>
  138. </div>
  139. </div>
  140. </div>
  141. </div>
  142. </template>
  143. <script>
  144. import { oSessionStorage } from "../../utils/utils";
  145. import * as echarts from "echarts";
  146. export default {
  147. data() {
  148. return {
  149. tableData: [],
  150. pageSize: 10,
  151. pageNum: 1,
  152. userInfo: {},
  153. echarts_zhu: "",
  154. option: {},
  155. echarts_lei: "",
  156. option_lei: {},
  157. //获取总人数字段
  158. //返回的总人数字段
  159. peopleData: {},
  160. //返回的最新的计划字段
  161. planData: {},
  162. planId: "",
  163. //组织下已选的专业
  164. profession: "",
  165. //组织下专业
  166. professionOptions: [],
  167. //各个维度平均分的数组
  168. avgData: [],
  169. };
  170. },
  171. mounted() {
  172. this.userInfo = JSON.parse(oSessionStorage.getItem("userInfo"));
  173. //查询最新人数统计
  174. this.queryAllPeople();
  175. //查询最新计划
  176. this.findNewPlan();
  177. //查询最近计划
  178. this.searchList();
  179. this.option = {
  180. title: {
  181. text: "",
  182. },
  183. tooltip: {
  184. trigger: "axis",
  185. axisPointer: {
  186. type: "shadow",
  187. },
  188. // formatter: function (arg) {
  189. // console.log("arg");
  190. // console.log(arg);
  191. // return "我就是提示的内容";
  192. // },
  193. },
  194. legend: {},
  195. grid: {
  196. left: "3%",
  197. right: "4%",
  198. bottom: "3%",
  199. containLabel: true,
  200. },
  201. xAxis: {
  202. type: "category",
  203. data: [],
  204. // axisLabel: {
  205. // width: 40, //设置内容宽度
  206. // // overflow:'break',
  207. // overflow: "truncate",
  208. // },
  209. // axisLabel: {
  210. // formatter: function (params) {
  211. // return "中等分值";
  212. // },
  213. // },
  214. },
  215. dataZoom: {
  216. type: "inside", //放大缩小x轴数值
  217. },
  218. yAxis: {
  219. type: "value",
  220. boundaryGap: [0, 0.01],
  221. minInterval: 1,
  222. },
  223. series: [
  224. {
  225. type: "bar",
  226. data: [],
  227. barWidth: '15',//修改柱状图的宽度
  228. itemStyle: {
  229. color: "#CCFFD7",
  230. borderWidth: 2,
  231. borderColor: "#2EE053",
  232. barBorderRadius:[10,10,0,0] //修改柱状图圆角
  233. },
  234. },
  235. ],
  236. };
  237. // echarts.init(this.echarts_zhu).setOption(this.option);
  238. this.option_lei = {
  239. radar: {
  240. // shape: 'circle',
  241. indicator: [
  242. { name: "Sales", max: 100 },
  243. { name: "Administration", max: 100 },
  244. { name: "Information Technology", max: 100 },
  245. { name: "Customer Support", max: 100 },
  246. { name: "Development", max: 100 },
  247. { name: "Marketing", max: 100 },
  248. ],
  249. },
  250. // label:{
  251. // show:true,
  252. // textStyle:{
  253. // color:'#000000'
  254. // }
  255. // },
  256. name: {
  257. //修改indicator文字的颜色
  258. textStyle: {
  259. color: "#000000",
  260. },
  261. },
  262. axisLine: {
  263. lineStyle: {
  264. color: "#000000",
  265. },
  266. },
  267. series: [
  268. {
  269. name: "",
  270. type: "radar",
  271. data: [
  272. {
  273. value: [20, 30, 40, 50, 60, 70],
  274. name: "",
  275. itemStyle: {
  276. //该数值区域样式设置
  277. //边框及原点颜色
  278. normal: {
  279. color: "#FF1E00", //背景颜色,还需设置areaStyle
  280. lineStyle: {
  281. color: "rgba(255,225,0,.3)", //边框颜色
  282. },
  283. },
  284. },
  285. // label: {
  286. // //显示value中具体的数值
  287. // normal: {
  288. // show: true,
  289. // textStyle: {
  290. // //更改数值样式
  291. // color: "orange",
  292. // },
  293. // },
  294. // },
  295. areaStyle: {
  296. //设置区域背景颜色透明度
  297. normal: {
  298. width: 1,
  299. opacity: 0.3,
  300. },
  301. },
  302. },
  303. ],
  304. },
  305. ],
  306. };
  307. this.getOrg();
  308. },
  309. methods: {
  310. //根据组织编号查询总人数
  311. queryAllPeople() {
  312. let url = `/user/countUserByOrgNo?orgNo=${this.userInfo.orgNo}`;
  313. this.$http.get(url, {}, (res) => {
  314. if (res && res.code == 200) {
  315. this.peopleData = res.data;
  316. // this.tableData = res.data.content;
  317. // this.total = res.data.totalElements;
  318. } else {
  319. // this.$toast.fail(res.msg);
  320. this.$message.error(res.msg);
  321. }
  322. });
  323. },
  324. searchList() {
  325. let url = `/plan/findListByPage?pageSize=${this.pageSize}&pageNum=${this.pageNum}&orgNo=${this.userInfo.orgNo}`;
  326. this.$http.get(url, {}, (res) => {
  327. if (res && res.code == 200) {
  328. this.tableData = res.data.content;
  329. // this.total = res.data.totalElements;
  330. } else {
  331. // this.$toast.fail(res.msg);
  332. this.$message.error(res.msg);
  333. }
  334. });
  335. },
  336. //查询最新结束的计划
  337. findNewPlan() {
  338. let url = `/plan/findNewCompletedPlan?orgNo=${this.userInfo.orgNo}`;
  339. this.$http.get(url, {}, (res) => {
  340. if (res && res.code == 200) {
  341. console.log("最新结束数计划");
  342. console.log(res.data);
  343. if (res.data != null) {
  344. this.planId = res.data.id;
  345. let list = Object.entries(res.data);
  346. //开始过滤
  347. let list1 = list.filter(([key, val]) => {
  348. return (
  349. key == "planName" ||
  350. key == "planOrgName" ||
  351. key == "createDate" ||
  352. key == "userNum"
  353. );
  354. });
  355. let list2 = Object.fromEntries(list1);
  356. console.log(JSON.stringify(list2));
  357. this.planData = list2;
  358. //调用各个专业不同总分人数
  359. this.isScore();
  360. }
  361. } else {
  362. // this.$toast.fail(res.msg);
  363. this.$message.error(res.msg);
  364. }
  365. });
  366. },
  367. //各个专业不同总分人数
  368. isScore() {
  369. let url = `/plan/countTotalNumber?planId=${this.planId}`;
  370. this.$http.get(url, {}, (res) => {
  371. console.log("isScore");
  372. console.log(res);
  373. if (res.code == 200) {
  374. console.log(res.data);
  375. let nameList = [];
  376. let scoreList = [];
  377. for (const item in res.data) {
  378. //
  379. nameList.push(item);
  380. scoreList.push(res.data[item]);
  381. }
  382. // nameList= ["中等", "高等", "低等", "多喝", "大"]
  383. console.log("namelist");
  384. // console.log(nameList)
  385. this.echarts_zhu = this.$refs.echarts_zhu;
  386. this.option.xAxis.data = nameList;
  387. this.option.series[0].data = scoreList;
  388. let myChart1 = echarts.init(this.echarts_zhu);
  389. myChart1.setOption(this.option);
  390. }
  391. });
  392. },
  393. //获取子组织
  394. getOrg() {
  395. let url = `/org/findChildOrg?orgNo=${this.userInfo.orgNo}`;
  396. this.$http.get(url, {}, (res) => {
  397. if (res && res.code == 200) {
  398. console.log("获取子组织");
  399. console.log(res.data);
  400. if (res.data.length > 0) {
  401. let list = [];
  402. for (let i = 0; i < res.data.length; i++) {
  403. let obj = { value: "", label: "" };
  404. obj.value = res.data[i].orgNo;
  405. obj.label = res.data[i].orgName;
  406. list.push(obj);
  407. }
  408. this.professionOptions = list;
  409. this.profession = list[0].value;
  410. //然后根据选择的这个选项、、查询具体数据
  411. this.queryDetailScore(list[0].value);
  412. }
  413. } else {
  414. // this.$toast.fail(res.msg);
  415. this.$message.error(res.msg);
  416. }
  417. });
  418. },
  419. //查看各个组织下各个维度的平均得分
  420. queryDetailScore(val) {
  421. let url = `/userRecordScore/findAvgScoreByOrgNo?orgNo=${val}`;
  422. this.$http.get(url, {}, (res) => {
  423. console.log("isScore");
  424. console.log(res);
  425. if (res.code == 200) {
  426. this.avgData = res.data;
  427. let nameList = [];
  428. let scoreList = [];
  429. //设置总共维度
  430. for (let i = 0; i < res.data.length; i++) {
  431. let obj = { name: res.data[i].name, max: 100, color: "#000000" };
  432. nameList.push(obj);
  433. scoreList.push(res.data[i].score);
  434. }
  435. //测试计划---
  436. //修改option
  437. this.echarts_lei = this.$refs.echarts_lei;
  438. this.option_lei.radar.indicator = nameList;
  439. this.option_lei.series[0].data[0].value = scoreList;
  440. echarts.init(this.echarts_lei).setOption(this.option_lei);
  441. }
  442. });
  443. },
  444. //选择的专业改变后接着调用
  445. professionChange(val) {
  446. this.queryDetailScore(val);
  447. },
  448. //状态---
  449. planStatusFun(val) {
  450. console.log(val);
  451. let planStatus = val.planStatus;
  452. if (planStatus == "1") {
  453. return "未开始";
  454. } else if (planStatus == "2") {
  455. return "进行中";
  456. } else if (planStatus == "3") {
  457. return "已完成";
  458. } else {
  459. return val.planStatus;
  460. }
  461. },
  462. },
  463. };
  464. </script>
  465. <style lang="less" scoped>
  466. .computer::-webkit-scrollbar {
  467. width: 6px;
  468. }
  469. .computer::-webkit-scrollbar-track {
  470. background: rgb(239, 239, 239);
  471. border-radius: 2px;
  472. }
  473. .computer::-webkit-scrollbar-thumb {
  474. background: #40a0ff49;
  475. border-radius: 10px;
  476. }
  477. .computer::-webkit-scrollbar-thumb:hover {
  478. background: #40a0ff;
  479. }
  480. .table_a::-webkit-scrollbar {
  481. width: 6px;
  482. }
  483. .table_a::-webkit-scrollbar-track {
  484. background: rgb(239, 239, 239);
  485. border-radius: 2px;
  486. }
  487. .table_a::-webkit-scrollbar-thumb {
  488. background: #40a0ff49;
  489. border-radius: 10px;
  490. }
  491. .table_a::-webkit-scrollbar-thumb:hover {
  492. background: #40a0ff;
  493. }
  494. .pp {
  495. display: flex;
  496. flex-direction: column;
  497. /* justify-content: center; */
  498. height: 100%;
  499. width: 100%;
  500. background-color: #ffffff;
  501. // background-color: aqua;
  502. .general_situation {
  503. height: 260px;
  504. width: 100%;
  505. display: flex;
  506. min-width: 980px;
  507. .number_people {
  508. border-radius: 20px;
  509. flex: 6;
  510. background-color: #48d68e;
  511. display: flex;
  512. flex-direction: column;
  513. .number_people_top {
  514. margin-top: 20px;
  515. margin-left: 20px;
  516. color: #ffffff;
  517. margin-bottom: 20px;
  518. font-weight: 700;
  519. }
  520. .number_people_yuan {
  521. display: flex;
  522. color: #ffffff;
  523. .out {
  524. width: 150px;
  525. height: 150px;
  526. border-radius: 20px;
  527. margin-left: 20px;
  528. background-color: #7fe2b0;
  529. display: flex;
  530. flex-direction: column;
  531. .yuan_name {
  532. margin-left: 20px;
  533. margin-top: 20px;
  534. color: #000000;
  535. font-size: 20px;
  536. }
  537. .yuan_num {
  538. margin-left: 20px;
  539. margin-top: 20px;
  540. color: #000000;
  541. font-size: 14px;
  542. }
  543. .yuan_people {
  544. margin-left: 20px;
  545. margin-top: 20px;
  546. color: #ffffff;
  547. font-size: 30px;
  548. }
  549. }
  550. .computer {
  551. max-height: 140px;
  552. // height: 140px;
  553. overflow-y: auto;
  554. flex: 1;
  555. display: flex;
  556. width: 100%;
  557. flex-wrap: wrap;
  558. justify-content: start;
  559. .computer_detail {
  560. width: 140px;
  561. // height: 20px;
  562. padding: 10px;
  563. }
  564. }
  565. }
  566. }
  567. .plan {
  568. display: flex;
  569. // height:30%;
  570. flex: 4;
  571. .plan_inner {
  572. padding: 20px;
  573. border-radius: 20px;
  574. margin-left: 20px;
  575. background-color: #f7f7f7;
  576. display: flex;
  577. width: 100%;
  578. flex-direction: column;
  579. .plan_top {
  580. font-weight: 700;
  581. color: #000000;
  582. margin-bottom: 20px;
  583. }
  584. //表头
  585. .table_header {
  586. display: flex;
  587. // justify-content: space-around;
  588. background-color: #ffffff;
  589. line-height: 40px;
  590. font-weight: 700;
  591. .detail {
  592. flex: 1;
  593. text-align: center;
  594. }
  595. }
  596. .table_a {
  597. overflow-y: auto;
  598. .table_body {
  599. display: flex;
  600. // justify-content: space-around;
  601. line-height: 30px;
  602. .detail {
  603. flex: 1;
  604. text-align: center;
  605. }
  606. }
  607. }
  608. }
  609. }
  610. }
  611. .recently {
  612. width: 100%;
  613. // height: 100%;
  614. // overflow: auto;
  615. height: calc(100% - 260px);
  616. // background-color: #000000;
  617. .recently_bottom {
  618. height: calc(100% - 20px);
  619. margin-top: 20px;
  620. // margin-bottom:20px;
  621. background-color: #f7f7f7;
  622. width: 100%;
  623. border-radius: 20px;
  624. display: flex;
  625. flex-direction: column;
  626. .recently_bottom_font {
  627. padding: 10px;
  628. font-weight: 700;
  629. }
  630. .block {
  631. width: 100%;
  632. height: 100%;
  633. display: flex;
  634. .block_left {
  635. display: flex;
  636. padding-left: 10px;
  637. flex-direction: column;
  638. // padding: 10px;
  639. flex: 6;
  640. // background-color: #000000;
  641. height: 100%;
  642. .block_table {
  643. display: flex;
  644. background-color: #ffffff;
  645. .block_detail {
  646. font-weight: 700;
  647. padding: 10px;
  648. flex: 1;
  649. display: flex;
  650. justify-content: center;
  651. }
  652. }
  653. .block_body {
  654. display: flex;
  655. .block_detail {
  656. justify-content: center;
  657. padding: 10px;
  658. flex: 1;
  659. display: flex;
  660. }
  661. }
  662. .profession {
  663. font-weight: 700;
  664. }
  665. .echarts_style {
  666. width: 100%;
  667. flex: 1;
  668. // background-color: #000000;
  669. }
  670. }
  671. .block_right {
  672. flex: 4;
  673. // background-color: #d32d2d;
  674. height: 100%;
  675. display: flex;
  676. flex-direction: column;
  677. .block_avg {
  678. margin-left: 20px;
  679. font-weight: 700;
  680. }
  681. .block_lei {
  682. flex: 1;
  683. // background-color: #000000;
  684. margin-left: 20px;
  685. }
  686. }
  687. }
  688. }
  689. }
  690. }
  691. </style>