afterWorkList.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496
  1. <!-- -->
  2. <template>
  3. <div class>
  4. <!-- <h2>
  5. <div class="squrt"></div>课外作业
  6. </h2>-->
  7. <div class="m-core">
  8. <save-form :inline="true"
  9. :model="searchForm"
  10. @submit="search"
  11. :saveKey="'afterWorkList'"
  12. @reset="onReSet"
  13. v-if="show">
  14. <el-form-item>
  15. <el-input v-model.trim="searchForm.search"
  16. @keyup.enter.native="search" clearable
  17. placeholder="请输入标题 学生姓名"></el-input>
  18. </el-form-item>
  19. <el-form-item prop="organId">
  20. <el-select class="multiple"
  21. v-model.trim="searchForm.organIdList"
  22. filterable
  23. clearable
  24. placeholder="请选择分部">
  25. <el-option v-for="(item,index) in selects.branchs"
  26. :key="index"
  27. :label="item.name"
  28. :value="item.id"></el-option>
  29. </el-select>
  30. </el-form-item>
  31. <el-form-item>
  32. <el-select placeholder="是否提交"
  33. v-model="searchForm.status"
  34. clearable>
  35. <el-option label="是"
  36. value="1"></el-option>
  37. <el-option label="否"
  38. value="0"></el-option>
  39. </el-select>
  40. </el-form-item>
  41. <el-form-item>
  42. <el-select placeholder="是否评价"
  43. v-model="searchForm.isReplied"
  44. clearable>
  45. <el-option label="是"
  46. value="1"></el-option>
  47. <el-option label="否"
  48. value="0"></el-option>
  49. </el-select>
  50. </el-form-item>
  51. <el-form-item>
  52. <el-select placeholder="及时评价"
  53. v-model="searchForm.isRepliedTimely"
  54. clearable>
  55. <el-option label="是"
  56. value="1"></el-option>
  57. <el-option label="否"
  58. value="0"></el-option>
  59. </el-select>
  60. </el-form-item>
  61. <el-form-item>
  62. <el-select placeholder="是否有vip"
  63. v-model="searchForm.existVipCourse"
  64. clearable>
  65. <el-option label="是"
  66. value="1"></el-option>
  67. <el-option label="否"
  68. value="0"></el-option>
  69. </el-select>
  70. </el-form-item>
  71. <br />
  72. <el-form-item label="布置时间">
  73. <el-date-picker v-model.trim="searchForm.timer"
  74. style="width:400px;"
  75. type="daterange"
  76. value-format="yyyy-MM-dd"
  77. range-separator="至"
  78. start-placeholder="布置开始日期"
  79. end-placeholder="布置结束日期"
  80. :picker-options="{
  81. firstDayOfWeek: 1
  82. }"></el-date-picker>
  83. </el-form-item>
  84. <br />
  85. <el-form-item label="截止时间">
  86. <el-date-picker v-model.trim="searchForm.expireDate"
  87. style="width:400px;"
  88. type="daterange"
  89. value-format="yyyy-MM-dd"
  90. range-separator="至"
  91. start-placeholder="截止开始日期"
  92. end-placeholder="截止结束日期"
  93. :picker-options="{
  94. firstDayOfWeek: 1
  95. }"></el-date-picker>
  96. </el-form-item>
  97. <el-form-item>
  98. <el-button type="danger" native-type="submit">搜索</el-button>
  99. <el-button type="primary" native-type="reset">重置</el-button>
  100. <el-button @click="onExport"
  101. type="primary"
  102. v-permission="'export/extraExercisesReplys'">导出</el-button>
  103. </el-form-item>
  104. </save-form>
  105. <div class="tableWrap">
  106. <el-table style="width: 100%"
  107. :header-cell-style="{background:'#EDEEF0',color:'#444'}"
  108. :data="tableList">
  109. <el-table-column align="center"
  110. prop="createTime"
  111. label="布置时间"
  112. width="150">
  113. <template slot-scope="scope">{{scope.row.createTime | dateForMinFormat}}</template>
  114. </el-table-column>
  115. <el-table-column align="center"
  116. prop="expireDate"
  117. label="截止时间"
  118. width="150">
  119. <template slot-scope="scope">{{scope.row.expireDate | dateForMinFormat}}</template>
  120. </el-table-column>
  121. <el-table-column align="center"
  122. prop="title"
  123. label="训练标题">
  124. <template slot-scope="scope">
  125. <div>
  126. <div v-if="scope.row.extracurricularExercises">{{scope.row.extracurricularExercises.title}}</div>
  127. </div>
  128. </template>
  129. </el-table-column>
  130. <el-table-column align="center"
  131. prop="teacherName"
  132. label="老师"></el-table-column>
  133. <el-table-column align="center"
  134. prop="organName"
  135. label="学员分部"></el-table-column>
  136. <el-table-column align="center"
  137. prop="createTime"
  138. label="学生姓名">
  139. <template slot-scope="scope">
  140. <div>
  141. <div v-if="scope.row.user">{{scope.row.user.username}}</div>
  142. </div>
  143. </template>
  144. </el-table-column>
  145. <el-table-column align="center"
  146. prop="userId"
  147. label="学生编号"></el-table-column>
  148. <el-table-column align="center"
  149. label="提交作业">
  150. <template slot-scope="scope">
  151. <div>{{scope.row.status?'是':'否'}}</div>
  152. </template>
  153. </el-table-column>
  154. <el-table-column align="center"
  155. prop="createTime"
  156. label="提交时间"
  157. width="150">
  158. <template slot-scope="scope">{{scope.row.submitTime | dateForMinFormat}}</template>
  159. </el-table-column>
  160. <el-table-column align="center"
  161. prop="isReplied"
  162. label="是否评价">
  163. <template slot-scope="scope">
  164. <div>{{scope.row.isReplied?'是':'否'}}</div>
  165. </template>
  166. </el-table-column>
  167. <el-table-column align="center"
  168. label="是否有vip"
  169. width="100"
  170. fixed="right">
  171. <template slot-scope="scope">
  172. <div>{{scope.row.existVipCourse?'是':'否'}}</div>
  173. </template>
  174. </el-table-column>
  175. <el-table-column align="center"
  176. prop="isRepliedTimely"
  177. label="及时评价"
  178. width="100"
  179. fixed="right">
  180. <template slot-scope="scope">
  181. <div>{{scope.row.isRepliedTimely?'是':'否'}}</div>
  182. </template>
  183. </el-table-column>
  184. <!-- <el-table-column align="center" prop="teacherName" label="老师姓名">
  185. <template slot-scope="scope">
  186. <div v-if="scope.row.extracurricularExercises&&scope.row.extracurricularExercises.teacher">{{scope.row.extracurricularExercises.teacher.username}}</div>
  187. </template>
  188. </el-table-column>-->
  189. <el-table-column align="center"
  190. label="操作"
  191. fixed="right">
  192. <template slot-scope="scope">
  193. <div>
  194. <el-button type="text"
  195. v-permission="'afterWorkList/look'"
  196. @click="lookDetail(scope.row)">查看</el-button>
  197. </div>
  198. </template>
  199. </el-table-column>
  200. </el-table>
  201. <pagination
  202. :saveKey="'afterWorkList'"
  203. :total="rules.total"
  204. :page.sync="rules.page"
  205. :limit.sync="rules.limit"
  206. :page-sizes="rules.page_size"
  207. @pagination="getList" />
  208. </div>
  209. </div>
  210. <el-dialog title="课外训练详情"
  211. :visible.sync="afterSchoolVisible"
  212. width="600px">
  213. <el-form :model="visibleForm" label-width="100px">
  214. <el-form-item label="老师姓名">
  215. <el-input v-model="visibleForm.teacherName" disabled></el-input>
  216. </el-form-item>
  217. <el-form-item label="学生姓名">
  218. <el-input v-model="visibleForm.studentName" disabled></el-input>
  219. </el-form-item>
  220. <el-form-item label="截止时间">
  221. <el-input v-model="visibleForm.expiryDate" disabled></el-input>
  222. </el-form-item>
  223. <el-form-item label="训练标题">
  224. <el-input v-model="visibleForm.title" disabled></el-input>
  225. </el-form-item>
  226. <el-form-item label="训练内容">
  227. <el-input type="textarea" rows="5" v-model="visibleForm.content" disabled></el-input>
  228. </el-form-item>
  229. <el-form-item label="学生上传"
  230. v-for="(item,index) in visibleForm.attachments"
  231. :key="index">
  232. <!-- <el-button type="primary" v-if="item" @click="lookWork(item)">点击播放</el-button> -->
  233. <p class="schoolCell"
  234. v-if="item"
  235. @click="lookWork(item)">点击播放</p>
  236. </el-form-item>
  237. </el-form>
  238. </el-dialog>
  239. <el-dialog title="查看作业"
  240. width="680px"
  241. append-to-body
  242. :visible.sync="workVisible">
  243. <!-- activeUrl -->
  244. <video style="width:640px;"
  245. :src="activeSrc"
  246. ref="dialogVideo"
  247. controls="controls">您的浏览器不支持视频播放</video>
  248. </el-dialog>
  249. </div>
  250. </template>
  251. <script>
  252. import pagination from "@/components/Pagination/index";
  253. import {
  254. extracurricularExercisesReply,
  255. findStudentExtraExerciseDetail
  256. } from "@/api/afterSchool";
  257. import { getEmployeeOrgan } from "@/api/buildTeam";
  258. import axios from "axios";
  259. import { getToken } from "@/utils/auth";
  260. export default {
  261. props: ["id"],
  262. components: { pagination },
  263. data () {
  264. return {
  265. searchForm: {
  266. search: null,
  267. timer: [],
  268. status: null,
  269. isReplied: null,
  270. isRepliedTimely: null,
  271. isView: null,
  272. organIdList: null,
  273. expireDate: [],
  274. existVipCourse: null
  275. },
  276. rules: {
  277. // 分页规则
  278. limit: 10, // 限制显示条数
  279. page: 1, // 当前页
  280. total: 0, // 总条数
  281. page_size: [10, 20, 40, 50] // 选择限制显示条数
  282. },
  283. teacherList: [],
  284. tableList: [],
  285. organList: [],
  286. visibleForm: {
  287. expiryDate: "",
  288. teacherName: "",
  289. title: "",
  290. studentName: "",
  291. content: "",
  292. attachments: []
  293. },
  294. afterSchoolVisible: false,
  295. workVisible: false,
  296. activeSrc: "",
  297. extracurricularExercisesId: null,
  298. show: true
  299. };
  300. },
  301. //生命周期 - 创建完成(可以访问当前this实例)
  302. created () { },
  303. //生命周期 - 挂载完成(可以访问DOM元素)
  304. mounted () {
  305. this.$store.dispatch('setBranchs')
  306. this.init();
  307. },
  308. methods: {
  309. init () {
  310. this.extracurricularExercisesId = this.$route.query.extracurricularExercisesId;
  311. if (this.extracurricularExercisesId) {
  312. this.show = false;
  313. }
  314. this.searchForm.search = this.$route.query.studentId;
  315. if (this.$route.query.startTime && this.$route.query.endTime) {
  316. this.searchForm.timer = [
  317. this.$route.query.startTime,
  318. this.$route.query.endTime
  319. ];
  320. }
  321. // console.log(this.$route.query)
  322. this.getList();
  323. },
  324. getList () {
  325. // assignStartTime assignEndTime page search teacherId title
  326. let obj = this.getDate();
  327. extracurricularExercisesReply(obj).then(res => {
  328. if (res.code == 200) {
  329. this.tableList = res.data.rows;
  330. this.rules.total = res.data.total;
  331. }
  332. });
  333. },
  334. search () {
  335. this.rules.page = 1;
  336. this.getList();
  337. },
  338. // 导出
  339. onExport () {
  340. let url = "/api-web/export/extraExercisesReplys";
  341. let obj = this.getDate();
  342. const options = {
  343. method: "get",
  344. headers: {
  345. Authorization: getToken()
  346. },
  347. url,
  348. params: obj,
  349. responseType: "blob"
  350. };
  351. this.$confirm("您确定导出列表?", "提示", {
  352. confirmButtonText: "确定",
  353. cancelButtonText: "取消",
  354. type: "warning"
  355. })
  356. .then(() => {
  357. axios(options).then(res => {
  358. let blob = new Blob([res.data], {
  359. // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8',
  360. type: "application/vnd.ms-excel;charset=utf-8"
  361. // word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
  362. });
  363. let objectUrl = URL.createObjectURL(blob);
  364. let link = document.createElement("a");
  365. let nowTime = new Date();
  366. let ymd =
  367. nowTime.getFullYear() +
  368. "" +
  369. (nowTime.getMonth() + 1) +
  370. "" +
  371. nowTime.getDate() +
  372. "" +
  373. nowTime.getHours() +
  374. "" +
  375. nowTime.getMinutes();
  376. let fname = ymd + "课外训练(学员).xls";
  377. link.href = objectUrl;
  378. link.setAttribute("download", fname);
  379. document.body.appendChild(link);
  380. link.click();
  381. });
  382. })
  383. .catch(() => { });
  384. },
  385. getDate () {
  386. let obj = {};
  387. if (this.searchForm.timer && this.searchForm.timer.length > 0) {
  388. obj.submitStartTime = this.searchForm.timer[0];
  389. obj.submitEndTime = this.searchForm.timer[1];
  390. }
  391. if (this.searchForm.expireDate && this.searchForm.expireDate.length > 0) {
  392. obj.expireStartDate = this.searchForm.expireDate[0];
  393. obj.expireEndDate = this.searchForm.expireDate[1];
  394. }
  395. obj.page = this.rules.page;
  396. (obj.rows = this.rules.limit),
  397. this.searchForm.teacherId
  398. ? (obj.teacherId = this.searchForm.teacherId)
  399. : null;
  400. this.searchForm.search ? (obj.search = this.searchForm.search) : null;
  401. this.searchForm.status ? (obj.status = this.searchForm.status) : null;
  402. this.searchForm.isReplied ? (obj.isReplied = this.searchForm.isReplied) : null;
  403. this.searchForm.isRepliedTimely
  404. ? (obj.isRepliedTimely = this.searchForm.isRepliedTimely)
  405. : null;
  406. this.searchForm.isView ? (obj.isView = this.searchForm.isView) : null;
  407. this.extracurricularExercisesId &&
  408. this.extracurricularExercisesId != "yes"
  409. ? (obj.extracurricularExercisesId = this.extracurricularExercisesId)
  410. : null;
  411. this.searchForm.organIdList
  412. ? (obj.organIdList = this.searchForm.organIdList)
  413. : null;
  414. this.searchForm.existVipCourse
  415. ? (obj.existVipCourse = this.searchForm.existVipCourse)
  416. : null;
  417. return obj;
  418. },
  419. onReSet () {
  420. this.searchForm = {
  421. search: null,
  422. timer: [],
  423. status: null,
  424. isReplied: null,
  425. isRepliedTimely: null,
  426. isView: null,
  427. organId: null,
  428. expireDate: [],
  429. existVipCourse: null
  430. };
  431. this.extracurricularExercisesId = null;
  432. this.getList();
  433. },
  434. lookDetail (row) {
  435. // this.afterSchoolVisible = true;
  436. // console.log(row)
  437. findStudentExtraExerciseDetail({
  438. studentExerciseId: row.id
  439. }).then(res => {
  440. if (res.code == 200) {
  441. this.visibleForm = {
  442. expiryDate: res.data.expiryDate,
  443. teacherName: res.data.teacherName,
  444. title: row.extracurricularExercises.title,
  445. studentName: res.data.studentName,
  446. content: res.data.content,
  447. attachments: res.data.attachments.split(",")
  448. };
  449. // console.log(this.visibleForm)
  450. this.afterSchoolVisible = true;
  451. }
  452. });
  453. },
  454. lookWork (src) {
  455. this.activeSrc = src;
  456. this.workVisible = true;
  457. }
  458. },
  459. watch: {
  460. workVisible (val) {
  461. if (!val) {
  462. this.activeSrc = "";
  463. }
  464. }
  465. }
  466. };
  467. </script>
  468. <style lang='scss' scoped>
  469. .schoolCell {
  470. width: 400px;
  471. color: #333;
  472. background-color: #f5f7fa;
  473. border-color: #e4e7ed;
  474. height: 40px;
  475. line-height: 40px;
  476. outline: 0;
  477. padding: 0 15px;
  478. border-radius: 4px;
  479. border: 1px solid #dcdfe6;
  480. display: inline-block;
  481. box-sizing: border-box;
  482. white-space: nowrap;
  483. text-overflow: ellipsis;
  484. overflow: hidden;
  485. }
  486. /deep/.el-textarea.is-disabled .el-textarea__inner {
  487. color: #333;
  488. }
  489. </style>