serverIndexList.vue 20 KB

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