ExamStudentOnline.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. <template>
  2. <section class="content">
  3. <div class="box box-info">
  4. <div
  5. class="box-body"
  6. v-loading.body="loading"
  7. v-loading.fullscreen="loading"
  8. element-loading-text="请稍后..."
  9. >
  10. <div class="left-div">
  11. <div class="row-div">
  12. <div class="total-div">
  13. <span style="width: 85px;height: 85px;display:block;">
  14. <img
  15. src="../assets/img/u316.png"
  16. style="height: 50px;width: 50px;"
  17. /> </span
  18. ><span style="display:block;margin-left: 10px;">
  19. <span style="display:block;font-weight:bold;font-size:40px">{{
  20. totalStudent
  21. }}</span>
  22. <span style="display:block;">注册学生</span>
  23. </span>
  24. </div>
  25. <div class="online-div">
  26. <span style="width: 85px;height: 85px;display:block;">
  27. <img
  28. src="../assets/img/u326.png"
  29. style="height: 50px;width: 50px;"
  30. /> </span
  31. ><span style="display:block;margin-left: 10px;">
  32. <span style="display:block;font-weight:bold;font-size:40px">{{
  33. totalOnlineStudent
  34. }}</span>
  35. <span style="display:block;">在线学生</span>
  36. </span>
  37. </div>
  38. </div>
  39. <div class="tb-div">
  40. <div class="row-div">
  41. <span style="float:left;"> 学校在线学生</span
  42. ><span style="float:right;"
  43. ><el-button size="small" type="primary" @click="toInfoPage">
  44. 详情
  45. </el-button></span
  46. >
  47. <span style="float:right;margin-right: 10px;"
  48. ><el-button size="small" type="primary" @click="refresh">
  49. 刷新
  50. </el-button></span
  51. >
  52. </div>
  53. <div class="row-div">
  54. <el-table
  55. :data="tableData"
  56. border
  57. resizable
  58. stripe
  59. style="width: 100%;"
  60. >
  61. <el-table-column prop="rootOrgName" label="学校">
  62. </el-table-column>
  63. <el-table-column width="100" prop="totalCount" label="注册学生">
  64. </el-table-column>
  65. <el-table-column
  66. width="100"
  67. prop="onlineCount"
  68. label="在线学生"
  69. >
  70. </el-table-column>
  71. <el-table-column
  72. width="100"
  73. prop="onExamCount"
  74. label="在考学生"
  75. >
  76. </el-table-column>
  77. </el-table>
  78. <div class="page pull-right">
  79. <el-pagination
  80. v-if="paginationShow"
  81. @current-change="handleCurrentChange"
  82. :current-page="currentPage"
  83. :page-size="pageSize"
  84. :page-sizes="[10, 20, 50, 100, 200, 300]"
  85. @size-change="handleSizeChange"
  86. layout="total, sizes, prev, pager, next, jumper"
  87. :total="total"
  88. />
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. <div class="right-div">
  94. <div class="row-div">近5日在线学生</div>
  95. <div class="row-div">
  96. <v-charts style="width:500px;" :options="lastNdayData"></v-charts>
  97. </div>
  98. </div>
  99. </div>
  100. </div>
  101. </section>
  102. </template>
  103. <script>
  104. import { REPORTS_API } from "@/constants/constants.js";
  105. import { mapState } from "vuex";
  106. import ECharts from "vue-echarts/components/ECharts";
  107. export default {
  108. components: {
  109. "v-charts": ECharts
  110. },
  111. name: "ExamStudentOnline",
  112. data() {
  113. return {
  114. lastNdayData: {
  115. tooltip: {
  116. trigger: "axis"
  117. },
  118. xAxis: {
  119. axisLabel: {
  120. interval: 0,
  121. rotate: 20
  122. },
  123. type: "category",
  124. data: []
  125. },
  126. yAxis: {
  127. type: "value"
  128. },
  129. series: [
  130. {
  131. data: [],
  132. type: "line"
  133. }
  134. ]
  135. },
  136. totalStudent: 0,
  137. totalOnlineStudent: 0,
  138. loading: false,
  139. paginationShow: false,
  140. tableData: [],
  141. currentPage: 1,
  142. pageSize: 10,
  143. total: 10
  144. };
  145. },
  146. computed: {
  147. ...mapState({ user: state => state.user }),
  148. isSuperAdmin() {
  149. return this.user.roleList.some(role => role.roleCode == "SUPER_ADMIN");
  150. }
  151. },
  152. methods: {
  153. toInfoPage() {
  154. this.$router.push({
  155. path: "/reports/online-detail"
  156. });
  157. },
  158. refresh() {
  159. this.searchTotalStudent();
  160. this.searchLastNDayData();
  161. this.searchTotalOnlineStudent();
  162. this.searchForm();
  163. },
  164. handleSearchBtn() {
  165. this.currentPage = 1;
  166. this.searchForm();
  167. },
  168. handleSizeChange(val) {
  169. this.pageSize = val;
  170. this.currentPage = 1;
  171. this.searchForm();
  172. },
  173. handleCurrentChange(val) {
  174. this.currentPage = val;
  175. this.searchForm();
  176. },
  177. //查询
  178. async searchForm() {
  179. this.loading = true;
  180. var url =
  181. REPORTS_API +
  182. "/studentTotalCount/page/" +
  183. this.currentPage +
  184. "/" +
  185. this.pageSize;
  186. this.$httpWithMsg
  187. .get(url)
  188. .then(response => {
  189. this.tableData = response.data.list;
  190. this.total = response.data.total;
  191. this.loading = false;
  192. this.$nextTick(function() {
  193. this.paginationShow = true;
  194. });
  195. })
  196. .finally(() => (this.loading = false));
  197. },
  198. async searchTotalStudent() {
  199. var url = REPORTS_API + "/studentTotalCount/getSumTotalCount";
  200. this.$httpWithMsg.get(url).then(response => {
  201. this.totalStudent = response.data;
  202. });
  203. },
  204. async searchTotalOnlineStudent() {
  205. var url = REPORTS_API + "/studentCount/getSumOnlineCount";
  206. this.$httpWithMsg.get(url).then(response => {
  207. this.totalOnlineStudent = response.data;
  208. });
  209. },
  210. async searchLastNDayData() {
  211. var url =
  212. REPORTS_API + "/studentCumulativeCount/getLastNdayOnlineCount?nday=5";
  213. this.$httpWithMsg.get(url).then(response => {
  214. let xdata = [];
  215. response.data.forEach(e => {
  216. xdata.push(e.reportDay);
  217. });
  218. this.lastNdayData.xAxis.data = xdata;
  219. let ydata = [];
  220. response.data.forEach(e => {
  221. ydata.push(e.totalCount);
  222. });
  223. this.lastNdayData.series = [
  224. {
  225. data: ydata,
  226. type: "line"
  227. }
  228. ];
  229. });
  230. },
  231. init() {
  232. this.searchTotalStudent();
  233. this.searchLastNDayData();
  234. this.searchTotalOnlineStudent();
  235. this.searchForm();
  236. }
  237. },
  238. //初始化查询
  239. created() {
  240. this.init();
  241. }
  242. };
  243. </script>
  244. <style scoped>
  245. .page {
  246. margin-top: 10px;
  247. }
  248. .pull-length {
  249. width: 300px;
  250. }
  251. .pull-center {
  252. margin-top: 20px;
  253. }
  254. .editForm .el-form-item {
  255. margin-bottom: 12px;
  256. }
  257. .left-div {
  258. width: 49%;
  259. float: left;
  260. }
  261. .right-div {
  262. width: 49%;
  263. float: right;
  264. border: 1px solid #ddd;
  265. }
  266. .row-div {
  267. width: 100%;
  268. display: inline-block;
  269. }
  270. .total-div {
  271. display: flex;
  272. float: left;
  273. border: 1px solid #ddd;
  274. padding: 5px;
  275. width: 49%;
  276. }
  277. .online-div {
  278. display: flex;
  279. float: right;
  280. border: 1px solid #ddd;
  281. padding: 5px;
  282. width: 49%;
  283. }
  284. .tb-div {
  285. width: 100%;
  286. border: 1px solid #ddd;
  287. padding: 5px;
  288. }
  289. </style>