afterWorkList.vue 18 KB

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