afterSchoolTeach.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. <!-- -->
  2. <template>
  3. <div class="m-core">
  4. <div class="m-core">
  5. <el-form :inline="true" :model="searchForm">
  6. <el-form-item>
  7. <el-input
  8. v-model.trim="searchForm.search"
  9. @keyup.enter.native="search"
  10. placeholder="学生姓名 老师姓名"
  11. ></el-input>
  12. </el-form-item>
  13. <el-form-item prop="organId">
  14. <el-select
  15. class="multiple"
  16. v-model.trim="searchForm.organIdList"
  17. filterable
  18. clearable
  19. placeholder="请选择分部"
  20. >
  21. <el-option
  22. v-for="(item,index) in organList"
  23. :key="index"
  24. :label="item.name"
  25. :value="item.id"
  26. ></el-option>
  27. </el-select>
  28. </el-form-item>
  29. <el-form-item>
  30. <el-select placeholder="实际安排" v-model="searchForm.actualExercisesNumIsAchieve" clearable>
  31. <el-option label="符合预期" value="1"></el-option>
  32. <el-option label="不符合预期" value="0"></el-option>
  33. </el-select>
  34. </el-form-item>
  35. <el-form-item>
  36. <el-select placeholder="提交次数" v-model="searchForm.exercisesReplyNumIsAchieve" clearable>
  37. <el-option label="符合预期" value="1"></el-option>
  38. <el-option label="不符合预期" value="0"></el-option>
  39. </el-select>
  40. </el-form-item>
  41. <el-form-item>
  42. <el-select placeholder="评价次数" v-model="searchForm.exercisesMessageNumIsAchieve" clearable>
  43. <el-option label="符合预期" value="1"></el-option>
  44. <el-option label="不符合预期" value="0"></el-option>
  45. </el-select>
  46. </el-form-item>
  47. <el-form-item>
  48. <el-select
  49. placeholder="及时评价"
  50. v-model="searchForm.exercisesMessageTimelyNumIsAchieve"
  51. clearable
  52. >
  53. <el-option label="符合预期" value="1"></el-option>
  54. <el-option label="不符合预期" value="0"></el-option>
  55. </el-select>
  56. </el-form-item>
  57. <el-form-item label="周次选择">
  58. <el-date-picker
  59. v-model.trim="searchForm.timer"
  60. style="width:400px;"
  61. type="daterange"
  62. :picker-options="{
  63. firstDayOfWeek: 1
  64. }"
  65. value-format="yyyy-MM-dd"
  66. range-separator="至"
  67. start-placeholder="开始日期"
  68. end-placeholder="结束日期"
  69. @change="getWeekTime"
  70. ></el-date-picker>
  71. </el-form-item>
  72. <el-form-item>
  73. <el-button type="danger" @click="search">搜索</el-button>
  74. <el-button @click="onReSet" type="primary">重置</el-button>
  75. <el-button
  76. @click="onExport"
  77. type="primary"
  78. v-permission="'export/exercisesSituations'"
  79. style=" background: #14928a; border:1px solid #14928a;"
  80. >导出</el-button>
  81. </el-form-item>
  82. </el-form>
  83. <div class="tableWrap">
  84. <el-table
  85. style="width: 100%"
  86. :header-cell-style="{background:'#EDEEF0',color:'#444'}"
  87. :data="tableList"
  88. >
  89. <el-table-column align="center" prop="studentId" label="学员编号"></el-table-column>
  90. <el-table-column align="center" prop="studentName" label="学生姓名"></el-table-column>
  91. <el-table-column align="center" prop="organName" label="所属分部"></el-table-column>
  92. <el-table-column align="center" prop="teacherName" label="指导老师"></el-table-column>
  93. <el-table-column align="center" prop label="预期安排">
  94. <template slot-scope="scope">
  95. <div>{{scope.row.expectExercisesNum+'次'}}</div>
  96. </template>
  97. </el-table-column>
  98. <el-table-column align="center" prop label="实际安排">
  99. <template slot-scope="scope">
  100. <div>{{scope.row.actualExercisesNum+'次'}}</div>
  101. </template>
  102. </el-table-column>
  103. <el-table-column align="center" prop label="提交次数">
  104. <template slot-scope="scope">
  105. <div>{{scope.row.exercisesReplyNum+'次'}}</div>
  106. </template>
  107. </el-table-column>
  108. <el-table-column align="center" prop label="评价次数">
  109. <template slot-scope="scope">
  110. <div>{{scope.row.exercisesMessageNum+'次'}}</div>
  111. </template>
  112. </el-table-column>
  113. <el-table-column align="center" prop label="及时评价次数">
  114. <template slot-scope="scope">
  115. <div>{{scope.row.exercisesMessageNum+'次'}}</div>
  116. </template>
  117. </el-table-column>
  118. <!-- <el-table-column align="center" prop="teacherName" label="老师姓名">
  119. <template slot-scope="scope">
  120. <div v-if="scope.row.extracurricularExercises&&scope.row.extracurricularExercises.teacher">{{scope.row.extracurricularExercises.teacher.username}}</div>
  121. </template>
  122. </el-table-column>-->
  123. <el-table-column align="center" label="操作">
  124. <template slot-scope="scope">
  125. <div v-if="scope.row.actualExercisesNum >0">
  126. <el-button type="text" @click="lookDetail(scope.row)">查看</el-button>
  127. </div>
  128. </template>
  129. </el-table-column>
  130. </el-table>
  131. <pagination
  132. :total="rules.total"
  133. :page.sync="rules.page"
  134. :limit.sync="rules.limit"
  135. :page-sizes="rules.page_size"
  136. @pagination="getList"
  137. />
  138. </div>
  139. </div>
  140. </div>
  141. </template>
  142. <script>
  143. import axios from "axios";
  144. import { getToken } from "@/utils/auth";
  145. import pagination from "@/components/Pagination/index";
  146. import { getEmployeeOrgan } from "@/api/buildTeam";
  147. import { findStudentExtracurricularExercisesSituations } from "@/api/afterSchool";
  148. // findStudentExtracurricularExercisesSituations
  149. let nowTime = new Date();
  150. nowTime =
  151. nowTime.getFullYear() +
  152. "-" +
  153. (nowTime.getMonth() + 1) +
  154. "-" +
  155. nowTime.getDate();
  156. export default {
  157. components: { pagination },
  158. data() {
  159. return {
  160. tableList: [],
  161. searchForm: {
  162. timer: [],
  163. search: null,
  164. organIdList:null,
  165. actualExercisesNumIsAchieve: null, // 训练次数
  166. exercisesMessageNumIsAchieve: null, //评价
  167. exercisesMessageTimelyNumIsAchieve: null, //及时评价
  168. exercisesReplyNumIsAchieve: null // 提交次数
  169. },
  170. organList: [],
  171. teacherList: [],
  172. rules: {
  173. // 分页规则
  174. limit: 10, // 限制显示条数
  175. page: 1, // 当前页
  176. total: 0, // 总条数
  177. page_size: [10, 20, 40, 50] // 选择限制显示条数
  178. }
  179. };
  180. },
  181. //生命周期 - 创建完成(可以访问当前this实例)
  182. created() {
  183. // 设置默认为当前周
  184. },
  185. //生命周期 - 挂载完成(可以访问DOM元素)
  186. mounted() {
  187. this.searchForm.timer = [];
  188. this.searchForm.timer.push(this.getNowDateAndMonday(nowTime));
  189. this.searchForm.timer.push(this.getNowDateAndSunday(nowTime));
  190. getEmployeeOrgan().then(res => {
  191. if (res.code == 200) {
  192. this.organList = res.data;
  193. }
  194. });
  195. // 获取分部 老师
  196. this.init();
  197. },
  198. activated() {
  199. this.init();
  200. },
  201. methods: {
  202. init() {
  203. this.getList();
  204. },
  205. getDate(){
  206. let obj = {
  207. search: this.searchForm.search || null,
  208. actualExercisesNumIsAchieve:
  209. this.searchForm.actualExercisesNumIsAchieve || null, // 训练次数
  210. exercisesMessageNumIsAchieve:
  211. this.searchForm.exercisesMessageNumIsAchieve || null, //评价
  212. exercisesMessageTimelyNumIsAchieve:
  213. this.searchForm.exercisesMessageTimelyNumIsAchieve || null, //及时评价
  214. exercisesReplyNumIsAchieve:
  215. this.searchForm.exercisesReplyNumIsAchieve || null, // 提交次数
  216. organIdList:this.searchForm.organIdList || null,
  217. page: this.rules.page,
  218. rows : this.rules.limit
  219. };
  220. if (this.searchForm.timer && this.searchForm.timer.length > 0) {
  221. obj.monday = this.searchForm.timer[0];
  222. obj.sunday = this.searchForm.timer[1];
  223. } else {
  224. this.$message.error("请选择时间段");
  225. return false;
  226. }
  227. return obj
  228. },
  229. getList() {
  230. let obj = this.getDate()
  231. if(!obj)return
  232. findStudentExtracurricularExercisesSituations(obj).then(res => {
  233. if (res.code == 200) {
  234. this.tableList = res.data.rows;
  235. this.rules.total = res.data.total;
  236. }
  237. });
  238. },
  239. onReSet() {
  240. this.searchForm = {
  241. timer: [],
  242. search: null,
  243. actualExercisesNumIsAchieve: null, // 训练次数
  244. exercisesMessageNumIsAchieve: null, //评价
  245. exercisesMessageTimelyNumIsAchieve: null, //及时评价
  246. exercisesReplyNumIsAchieve: null // 提交次数
  247. };
  248. this.search();
  249. },
  250. onExport() {
  251. let url = "/api-web/export/exercisesSituations";
  252. let obj = this.getDate();
  253. const options = {
  254. method: "get",
  255. headers: {
  256. Authorization: getToken()
  257. },
  258. url,
  259. params: obj,
  260. responseType: "blob"
  261. };
  262. this.$confirm("您确定导出列表?", "提示", {
  263. confirmButtonText: "确定",
  264. cancelButtonText: "取消",
  265. type: "warning"
  266. })
  267. .then(() => {
  268. axios(options).then(res => {
  269. let blob = new Blob([res.data], {
  270. // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8',
  271. type: "application/vnd.ms-excel;charset=utf-8"
  272. // word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
  273. });
  274. let objectUrl = URL.createObjectURL(blob);
  275. let link = document.createElement("a");
  276. let nowTime = new Date();
  277. let ymd =
  278. nowTime.getFullYear() +
  279. "" +
  280. (nowTime.getMonth() + 1) +
  281. "" +
  282. nowTime.getDate() +
  283. "" +
  284. nowTime.getHours() +
  285. "" +
  286. nowTime.getMinutes();
  287. let fname = ymd + "课外训练(教学)";
  288. link.href = objectUrl;
  289. link.setAttribute("download", fname);
  290. document.body.appendChild(link);
  291. link.click();
  292. });
  293. })
  294. .catch(() => {});
  295. },
  296. search() {
  297. this.rules.page = 1;
  298. this.getList();
  299. },
  300. getNowDateAndMonday(time) {
  301. let timestamp = new Date(time.replace(/-/g, "/")).getTime();
  302. let serverDate = new Date(time);
  303. if(serverDate.getDay() == 0){
  304. timestamp -=7* 24 * 60 * 60 * 1000
  305. }
  306. let mondayTime =
  307. timestamp - (serverDate.getDay() - 1) * 24 * 60 * 60 * 1000;
  308. let mondayData = new Date(mondayTime);
  309. //年
  310. let mondayY = mondayData.getFullYear();
  311. //月
  312. let mondayM =
  313. mondayData.getMonth() + 1 < 10
  314. ? "0" + (mondayData.getMonth() + 1)
  315. : mondayData.getMonth() + 1;
  316. //日
  317. let mondayD =
  318. mondayData.getDate() < 10
  319. ? "0" + mondayData.getDate()
  320. : mondayData.getDate();
  321. let str = mondayY + "-" + mondayM + "-" + mondayD;
  322. return str;
  323. },
  324. getNowDateAndSunday(time) {
  325. let timestamp = new Date(time.replace(/-/g, "/")).getTime();
  326. let serverDate = new Date(time);
  327. let num = 7 - serverDate.getDay();
  328. if(num == 7){
  329. num = 0
  330. }
  331. let sundayTiem =
  332. timestamp + (num * 24 * 60 * 60 * 1000);
  333. let SundayData = new Date(sundayTiem);
  334. //年
  335. let tomorrowY = SundayData.getFullYear(); //月
  336. let tomorrowM =
  337. SundayData.getMonth() + 1 < 10
  338. ? "0" + (SundayData.getMonth() + 1)
  339. : SundayData.getMonth() + 1;
  340. //日
  341. let tomorrowD =
  342. SundayData.getDate() < 10
  343. ? "0" + SundayData.getDate()
  344. : SundayData.getDate();
  345. let str = tomorrowY + "-" + tomorrowM + "-" + tomorrowD;
  346. return str;
  347. },
  348. getWeekTime(val) {
  349. if (val && val.length > 0) {
  350. let start = this.getNowDateAndMonday(val[0]);
  351. let end = this.getNowDateAndSunday(val[1]);
  352. this.searchForm.timer.splice(0, 1, start);
  353. this.searchForm.timer.splice(1, 1, end);
  354. }
  355. },
  356. lookDetail(row) {
  357. // this.afterSchoolVisible = true;
  358. let rules = JSON.stringify(this.rules);
  359. let searchForm = JSON.stringify(this.searchForm);
  360. this.$router.push({
  361. path: "/business/afterSchoolDetail",
  362. query: {
  363. studentId: row.studentId,
  364. rules,
  365. searchForm,
  366. title: row.studentName,
  367. extracurricularExercisesId: "yes",
  368. startTime:this.searchForm.timer[0],
  369. endTime:this.searchForm.timer[1]
  370. }
  371. });
  372. }
  373. }
  374. };
  375. </script>
  376. <style lang='scss' scoped>
  377. </style>