serverIndexList.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  1. <!-- -->
  2. <template>
  3. <div class="m-container">
  4. <h2>
  5. <div class="squrt"></div>服务指标
  6. </h2>
  7. <div class="m-core">
  8. <el-form :inline="true"
  9. :model="searchForm">
  10. <el-form-item>
  11. <el-input v-model.trim="searchForm.search"
  12. @keyup.enter.native="search"
  13. placeholder="学生姓名"></el-input>
  14. </el-form-item>
  15. <el-form-item>
  16. <el-select placeholder="指导老师"
  17. v-model="searchForm.teacherId"
  18. clearable
  19. filterable>
  20. <el-option v-for="(item,index) in teacherList"
  21. :label="item.realName"
  22. :value="item.id"
  23. :key="index"></el-option>
  24. </el-select>
  25. </el-form-item>
  26. <el-form-item prop="organId">
  27. <el-select class="multiple"
  28. v-model.trim="searchForm.organIdList"
  29. filterable
  30. clearable
  31. placeholder="请选择分部">
  32. <el-option v-for="(item,index) in organList"
  33. :key="index"
  34. :label="item.name"
  35. :value="item.id"></el-option>
  36. </el-select>
  37. </el-form-item>
  38. <!-- <el-form-item>
  39. <el-select placeholder="当前有VIP课" v-model="searchForm.existVipCourse" clearable>
  40. <el-option label="是" value="1"></el-option>
  41. <el-option label="否" value="0"></el-option>
  42. </el-select>
  43. </el-form-item> -->
  44. <el-form-item>
  45. <el-select placeholder="实际安排"
  46. v-model="searchForm.actualExercisesNumIsAchieve"
  47. clearable>
  48. <el-option label="符合预期"
  49. value="1"></el-option>
  50. <el-option label="不符合预期"
  51. value="0"></el-option>
  52. </el-select>
  53. </el-form-item>
  54. <el-form-item>
  55. <el-select placeholder="提交次数"
  56. v-model="searchForm.exercisesReplyNumIsAchieve"
  57. clearable>
  58. <el-option label="符合预期"
  59. value="1"></el-option>
  60. <el-option label="不符合预期"
  61. value="0"></el-option>
  62. </el-select>
  63. </el-form-item>
  64. <el-form-item>
  65. <el-select placeholder="评价次数"
  66. v-model="searchForm.exercisesMessageNumIsAchieve"
  67. clearable>
  68. <el-option label="符合预期"
  69. value="1"></el-option>
  70. <el-option label="不符合预期"
  71. value="0"></el-option>
  72. </el-select>
  73. </el-form-item>
  74. <el-form-item>
  75. <el-select placeholder="及时评价"
  76. v-model="searchForm.exercisesMessageTimelyNumIsAchieve"
  77. clearable>
  78. <el-option label="符合预期"
  79. value="1"></el-option>
  80. <el-option label="不符合预期"
  81. value="0"></el-option>
  82. </el-select>
  83. </el-form-item>
  84. <el-form-item>
  85. <el-select placeholder="是否有VIP课"
  86. v-model="searchForm.existVipCourse"
  87. clearable>
  88. <el-option label="是"
  89. value="1"></el-option>
  90. <el-option label="否"
  91. value="0"></el-option>
  92. </el-select>
  93. </el-form-item>
  94. <el-form-item>
  95. <el-select placeholder="是否有付费网管课"
  96. v-model="searchForm.existPracticeCourse"
  97. clearable>
  98. <el-option label="是"
  99. value="1"></el-option>
  100. <el-option label="否"
  101. value="0"></el-option>
  102. </el-select>
  103. </el-form-item>
  104. <br>
  105. <el-form-item label="周次选择">
  106. <el-date-picker v-model.trim="searchForm.timer"
  107. style="width:400px;"
  108. type="daterange"
  109. :picker-options="{
  110. firstDayOfWeek: 1
  111. }"
  112. value-format="yyyy-MM-dd"
  113. range-separator="至"
  114. start-placeholder="周次开始日期"
  115. end-placeholder="周次结束日期"
  116. @change="getWeekTime"></el-date-picker>
  117. </el-form-item>
  118. <el-form-item label="作业提交时间">
  119. <el-date-picker v-model.trim="searchForm.workTimer"
  120. style="width:400px;"
  121. type="daterange"
  122. :picker-options="{
  123. firstDayOfWeek: 1
  124. }"
  125. value-format="yyyy-MM-dd"
  126. range-separator="至"
  127. start-placeholder="提交开始日期"
  128. end-placeholder="提交结束日期"></el-date-picker>
  129. </el-form-item>
  130. <el-form-item>
  131. <el-button type="danger"
  132. @click="search">搜索</el-button>
  133. <el-button @click="onReSet"
  134. type="primary">重置</el-button>
  135. <el-button @click="onExport"
  136. type="primary"
  137. v-permission="'export/exercisesSituations'"
  138. style=" background: #14928a; border:1px solid #14928a;">导出</el-button>
  139. </el-form-item>
  140. </el-form>
  141. <div class="tableWrap">
  142. <el-table style="width: 100%"
  143. :header-cell-style="{background:'#EDEEF0',color:'#444'}"
  144. :data="tableList">
  145. <el-table-column align="center"
  146. prop="studentId"
  147. label="学员编号"></el-table-column>
  148. <el-table-column align="center"
  149. prop="studentName"
  150. label="学生姓名"></el-table-column>
  151. <el-table-column align="center"
  152. prop="organName"
  153. label="所属分部"></el-table-column>
  154. <el-table-column align="center"
  155. prop="teacherName"
  156. label="指导老师"></el-table-column>
  157. <el-table-column align="center"
  158. prop="educationalTeacherName"
  159. label="教务老师"></el-table-column>
  160. <!-- <el-table-column align="center" label="当前有VIP课" width="100" >
  161. <template slot-scope="scope">
  162. <div>{{scope.row.existVipCourse?'是':'否'}}</div>
  163. </template>
  164. </el-table-column> -->
  165. <el-table-column align="center"
  166. label="预期安排">
  167. <template slot-scope="scope">
  168. <div>{{scope.row.expectExercisesNum+'次'}}</div>
  169. </template>
  170. </el-table-column>
  171. <el-table-column align="center"
  172. width="120"
  173. prop>
  174. <template slot="header"
  175. slot-scope="scope">
  176. <p style="position: relative; "> 实际安排 <el-tooltip placement="top"
  177. popper-class="mTooltip">
  178. <div slot="content">
  179. 以周为单位,实际发生一次课外训练或网管课作业布置,记一次,一周只统计一次
  180. </div>
  181. <!-- <img :src="imageIcon"
  182. class="micon el-tooltip"
  183. style="width:8px height:8px"
  184. alt /> -->
  185. <i class="el-icon-question"
  186. style="font-size: 18px; color: #F56C6C"></i>
  187. </el-tooltip>
  188. </p>
  189. </template>
  190. <template slot-scope="scope">
  191. <div>{{scope.row.actualExercisesNum+'次'}}</div>
  192. </template>
  193. </el-table-column>
  194. <el-table-column align="center"
  195. prop
  196. label="提交次数">
  197. <template slot-scope="scope">
  198. <div>{{scope.row.exercisesReplyNum+'次'}}</div>
  199. </template>
  200. </el-table-column>
  201. <el-table-column align="center"
  202. prop
  203. label="评价次数">
  204. <template slot-scope="scope">
  205. <div>{{scope.row.exercisesMessageNum+'次'}}</div>
  206. </template>
  207. </el-table-column>
  208. <el-table-column align="center"
  209. prop
  210. label="及时评价次数">
  211. <template slot-scope="scope">
  212. <div>{{scope.row.exercisesMessageTimelyNum+'次'}}</div>
  213. </template>
  214. </el-table-column>
  215. <el-table-column align="center"
  216. label="VIP课">
  217. <template slot-scope="scope">
  218. <div>{{scope.row.existVipCourse + '节'}}</div>
  219. </template>
  220. </el-table-column>
  221. <el-table-column align="center"
  222. label="付费网管课">
  223. <template slot-scope="scope">
  224. <div>{{scope.row.existPracticeCourse+ '节'}}</div>
  225. </template>
  226. </el-table-column>
  227. <el-table-column align="center"
  228. label="作业提交时间">
  229. <template slot-scope="scope">
  230. <div>{{scope.row.lastSubmitTime}}</div>
  231. </template>
  232. </el-table-column>
  233. <el-table-column align="center"
  234. label="操作">
  235. <!-- -->
  236. <template slot-scope="scope">
  237. <div v-if="scope.row.actualExercisesNum >0">
  238. <el-button type="text"
  239. @click="lookDetail(scope.row)">查看</el-button>
  240. </div>
  241. </template>
  242. </el-table-column>
  243. </el-table>
  244. <pagination :total="rules.total"
  245. :page.sync="rules.page"
  246. :limit.sync="rules.limit"
  247. :page-sizes="rules.page_size"
  248. @pagination="getList" />
  249. </div>
  250. </div>
  251. </div>
  252. </template>
  253. <script>
  254. import axios from "axios";
  255. import { getToken } from "@/utils/auth";
  256. import pagination from "@/components/Pagination/index";
  257. import load from "@/utils/loading";
  258. import { getEmployeeOrgan, getTeacher } from "@/api/buildTeam";
  259. import { findStudentExtracurricularExercisesSituations } from "@/api/afterSchool";
  260. // findStudentExtracurricularExercisesSituations
  261. let nowTime = new Date();
  262. nowTime =
  263. nowTime.getFullYear() +
  264. "-" +
  265. (nowTime.getMonth() + 1) +
  266. "-" +
  267. nowTime.getDate();
  268. export default {
  269. components: { pagination },
  270. data () {
  271. return {
  272. tableList: [],
  273. searchForm: {
  274. timer: [],
  275. search: null,
  276. organIdList: null,
  277. actualExercisesNumIsAchieve: null, // 训练次数
  278. exercisesMessageNumIsAchieve: null, //评价
  279. exercisesMessageTimelyNumIsAchieve: null, //及时评价
  280. exercisesReplyNumIsAchieve: null, // 提交次数
  281. teacherId: null,
  282. existVipCourse: null,
  283. existPracticeCourse: null,
  284. workTimer: []
  285. },
  286. organList: [],
  287. teacherList: [],
  288. rules: {
  289. // 分页规则
  290. limit: 10, // 限制显示条数
  291. page: 1, // 当前页
  292. total: 0, // 总条数
  293. page_size: [10, 20, 40, 50] // 选择限制显示条数
  294. },
  295. // imageIcon: require("@/assets/images/base/warning.png"),
  296. };
  297. },
  298. //生命周期 - 创建完成(可以访问当前this实例)
  299. created () {
  300. // 设置默认为当前周
  301. },
  302. //生命周期 - 挂载完成(可以访问DOM元素)
  303. mounted () {
  304. this.searchForm.timer = [];
  305. this.searchForm.timer.push(this.getNowDateAndMonday(nowTime));
  306. this.searchForm.timer.push(this.getNowDateAndSunday(nowTime));
  307. getTeacher().then(res => {
  308. if (res.code == 200) {
  309. this.teacherList = res.data;
  310. }
  311. });
  312. getEmployeeOrgan().then(res => {
  313. if (res.code == 200) {
  314. this.organList = res.data;
  315. }
  316. });
  317. // 获取分部 老师
  318. this.init();
  319. },
  320. activated () {
  321. this.init();
  322. },
  323. methods: {
  324. init () {
  325. if (this.$route.query.teacherId) {
  326. this.searchForm.teacherId = this.$route.query.teacherId * 1;
  327. }
  328. if (this.$route.query.search) {
  329. this.$route.query.search instanceof Object ? this.topForm = this.$route.query.search : this.topForm = JSON.parse(this.$route.query.search);
  330. }
  331. if (this.$route.query.rules) {
  332. this.$route.query.rules instanceof Object ? this.rules = this.$route.query.rules : this.rules = JSON.parse(this.$route.query.rules);
  333. }
  334. this.getList();
  335. },
  336. getDate () {
  337. let obj = {
  338. search: this.searchForm.search || null,
  339. actualExercisesNumIsAchieve:
  340. this.searchForm.actualExercisesNumIsAchieve || null, // 训练次数
  341. exercisesMessageNumIsAchieve:
  342. this.searchForm.exercisesMessageNumIsAchieve || null, //评价
  343. exercisesMessageTimelyNumIsAchieve:
  344. this.searchForm.exercisesMessageTimelyNumIsAchieve || null, //及时评价
  345. exercisesReplyNumIsAchieve:
  346. this.searchForm.exercisesReplyNumIsAchieve || null, // 提交次数
  347. organIdList: this.searchForm.organIdList || null,
  348. teacherId: this.searchForm.teacherId,
  349. page: this.rules.page,
  350. rows: this.rules.limit,
  351. existVipCourse: this.searchForm.existVipCourse || null,
  352. existPracticeCourse: this.searchForm.existPracticeCourse || null,
  353. };
  354. if (this.searchForm.timer && this.searchForm.timer.length > 0) {
  355. obj.monday = this.searchForm.timer[0];
  356. obj.sunday = this.searchForm.timer[1];
  357. } else {
  358. this.$message.error("请选择时间段");
  359. return false;
  360. }
  361. if (this.searchForm.workTimer && this.searchForm.workTimer.length > 0) {
  362. obj.submitStartDate = this.searchForm.workTimer[0];
  363. obj.submitEndDate = this.searchForm.workTimer[1];
  364. }
  365. return obj;
  366. },
  367. getList () {
  368. let obj = this.getDate();
  369. if (!obj) return;
  370. findStudentExtracurricularExercisesSituations(obj).then(res => {
  371. if (res.code == 200) {
  372. this.tableList = res.data.rows;
  373. this.rules.total = res.data.total;
  374. }
  375. });
  376. },
  377. onReSet () {
  378. this.searchForm = {
  379. timer: [],
  380. search: null,
  381. actualExercisesNumIsAchieve: null, // 训练次数
  382. exercisesMessageNumIsAchieve: null, //评价
  383. exercisesMessageTimelyNumIsAchieve: null, //及时评价
  384. exercisesReplyNumIsAchieve: null, // 提交次数
  385. teacherId: null,
  386. existVipCourse: null
  387. };
  388. this.search();
  389. },
  390. onExport () {
  391. let url = "/api-web/export/exercisesSituations";
  392. let obj = this.getDate();
  393. const options = {
  394. method: "get",
  395. headers: {
  396. Authorization: getToken()
  397. },
  398. url,
  399. params: obj,
  400. responseType: "blob"
  401. };
  402. this.$confirm("您确定导出列表?", "提示", {
  403. confirmButtonText: "确定",
  404. cancelButtonText: "取消",
  405. type: "warning"
  406. })
  407. .then(() => {
  408. load.startLoading();
  409. axios(options)
  410. .then(res => {
  411. let blob = new Blob([res.data], {
  412. // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8',
  413. type: "application/vnd.ms-excel;charset=utf-8"
  414. // word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
  415. });
  416. let text = new Response(blob).text();
  417. text.then(res => {
  418. // 判断是否报错
  419. if (res.indexOf("code") != -1) {
  420. let json = JSON.parse(res);
  421. this.$message.error(json.msg);
  422. } else {
  423. let objectUrl = URL.createObjectURL(blob);
  424. let link = document.createElement("a");
  425. let nowTime = new Date();
  426. let ymd =
  427. nowTime.getFullYear() +
  428. "" +
  429. (nowTime.getMonth() + 1) +
  430. "" +
  431. nowTime.getDate() +
  432. "" +
  433. nowTime.getHours() +
  434. "" +
  435. nowTime.getMinutes();
  436. let fname = ymd + "服务指标";
  437. link.href = objectUrl;
  438. link.setAttribute("download", fname);
  439. document.body.appendChild(link);
  440. link.click();
  441. }
  442. });
  443. load.endLoading();
  444. })
  445. .catch(error => {
  446. this.$message.error("导出数据失败,请联系管理员");
  447. load.endLoading();
  448. });
  449. })
  450. .catch(() => { });
  451. },
  452. search () {
  453. this.rules.page = 1;
  454. this.getList();
  455. },
  456. getNowDateAndMonday (time) {
  457. let timestamp = new Date(time.replace(/-/g, "/")).getTime();
  458. let serverDate = new Date(time);
  459. if (serverDate.getDay() == 0) {
  460. timestamp -= 7 * 24 * 60 * 60 * 1000;
  461. }
  462. let mondayTime =
  463. timestamp - (serverDate.getDay() - 1) * 24 * 60 * 60 * 1000;
  464. let mondayData = new Date(mondayTime);
  465. //年
  466. let mondayY = mondayData.getFullYear();
  467. //月
  468. let mondayM =
  469. mondayData.getMonth() + 1 < 10
  470. ? "0" + (mondayData.getMonth() + 1)
  471. : mondayData.getMonth() + 1;
  472. //日
  473. let mondayD =
  474. mondayData.getDate() < 10
  475. ? "0" + mondayData.getDate()
  476. : mondayData.getDate();
  477. let str = mondayY + "-" + mondayM + "-" + mondayD;
  478. return str;
  479. },
  480. getNowDateAndSunday (time) {
  481. let timestamp = new Date(time.replace(/-/g, "/")).getTime();
  482. let serverDate = new Date(time);
  483. let num = 7 - serverDate.getDay();
  484. if (num == 7) {
  485. num = 0;
  486. }
  487. let sundayTiem = timestamp + num * 24 * 60 * 60 * 1000;
  488. let SundayData = new Date(sundayTiem);
  489. //年
  490. let tomorrowY = SundayData.getFullYear(); //月
  491. let tomorrowM =
  492. SundayData.getMonth() + 1 < 10
  493. ? "0" + (SundayData.getMonth() + 1)
  494. : SundayData.getMonth() + 1;
  495. //日
  496. let tomorrowD =
  497. SundayData.getDate() < 10
  498. ? "0" + SundayData.getDate()
  499. : SundayData.getDate();
  500. let str = tomorrowY + "-" + tomorrowM + "-" + tomorrowD;
  501. return str;
  502. },
  503. getWeekTime (val) {
  504. if (val && val.length > 0) {
  505. let start = this.getNowDateAndMonday(val[0]);
  506. let end = this.getNowDateAndSunday(val[1]);
  507. this.searchForm.timer.splice(0, 1, start);
  508. this.searchForm.timer.splice(1, 1, end);
  509. }
  510. },
  511. lookDetail (row) {
  512. // this.afterSchoolVisible = true;
  513. let rules = JSON.stringify(this.rules);
  514. let searchForm = JSON.stringify(this.searchForm);
  515. this.$router.push({
  516. path: "/operateManager/serverIndexDetail",
  517. query: {
  518. studentId: row.studentId,
  519. studentName: row.studentName,
  520. rules,
  521. searchForm,
  522. title: row.studentName,
  523. extracurricularExercisesId: "yes",
  524. startTime: this.searchForm.timer[0],
  525. endTime: this.searchForm.timer[1]
  526. }
  527. });
  528. }
  529. }
  530. };
  531. </script>
  532. <style lang='scss' scoped>
  533. .micon {
  534. position: absolute;
  535. top: 3px;
  536. right: 2px;
  537. }
  538. </style>