afterWorkList.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  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 { Export } from '@/utils/downLoadFile'
  259. import axios from "axios";
  260. import { getToken } from "@/utils/auth";
  261. export default {
  262. props: ["id"],
  263. components: { pagination },
  264. data () {
  265. return {
  266. searchForm: {
  267. search: null,
  268. timer: [],
  269. status: null,
  270. isReplied: null,
  271. isRepliedTimely: null,
  272. isView: null,
  273. organIdList: null,
  274. expireDate: [],
  275. existVipCourse: null
  276. },
  277. rules: {
  278. // 分页规则
  279. limit: 10, // 限制显示条数
  280. page: 1, // 当前页
  281. total: 0, // 总条数
  282. page_size: [10, 20, 40, 50] // 选择限制显示条数
  283. },
  284. teacherList: [],
  285. tableList: [],
  286. organList: [],
  287. visibleForm: {
  288. expiryDate: "",
  289. teacherName: "",
  290. title: "",
  291. studentName: "",
  292. content: "",
  293. attachments: []
  294. },
  295. afterSchoolVisible: false,
  296. workVisible: false,
  297. activeSrc: "",
  298. extracurricularExercisesId: null,
  299. show: true
  300. };
  301. },
  302. //生命周期 - 创建完成(可以访问当前this实例)
  303. created () { },
  304. //生命周期 - 挂载完成(可以访问DOM元素)
  305. mounted () {
  306. this.$store.dispatch('setBranchs')
  307. this.init();
  308. },
  309. methods: {
  310. init () {
  311. this.extracurricularExercisesId = this.$route.query.extracurricularExercisesId;
  312. if (this.extracurricularExercisesId) {
  313. this.show = false;
  314. }
  315. this.searchForm.search = this.$route.query.studentId;
  316. if (this.$route.query.startTime && this.$route.query.endTime) {
  317. this.searchForm.timer = [
  318. this.$route.query.startTime,
  319. this.$route.query.endTime
  320. ];
  321. }
  322. // console.log(this.$route.query)
  323. this.getList();
  324. },
  325. getList () {
  326. // assignStartTime assignEndTime page search teacherId title
  327. let obj = this.getDate();
  328. extracurricularExercisesReply(obj).then(res => {
  329. if (res.code == 200) {
  330. this.tableList = res.data.rows;
  331. this.rules.total = res.data.total;
  332. }
  333. });
  334. },
  335. search () {
  336. this.rules.page = 1;
  337. this.getList();
  338. },
  339. // 导出
  340. async onExport () {
  341. let obj = this.getDate();
  342. await Export(this, {
  343. url: '/api-web/export/extraExercisesReplys',
  344. fileName: '课外训练(学员).xlsx',
  345. method: 'get',
  346. params: obj
  347. }, '您确定导出列表?')
  348. },
  349. getDate () {
  350. let obj = {};
  351. if (this.searchForm.timer && this.searchForm.timer.length > 0) {
  352. obj.submitStartTime = this.searchForm.timer[0];
  353. obj.submitEndTime = this.searchForm.timer[1];
  354. }
  355. if (this.searchForm.expireDate && this.searchForm.expireDate.length > 0) {
  356. obj.expireStartDate = this.searchForm.expireDate[0];
  357. obj.expireEndDate = this.searchForm.expireDate[1];
  358. }
  359. obj.page = this.rules.page;
  360. (obj.rows = this.rules.limit),
  361. this.searchForm.teacherId
  362. ? (obj.teacherId = this.searchForm.teacherId)
  363. : null;
  364. this.searchForm.search ? (obj.search = this.searchForm.search) : null;
  365. this.searchForm.status ? (obj.status = this.searchForm.status) : null;
  366. this.searchForm.isReplied ? (obj.isReplied = this.searchForm.isReplied) : null;
  367. this.searchForm.isRepliedTimely
  368. ? (obj.isRepliedTimely = this.searchForm.isRepliedTimely)
  369. : null;
  370. this.searchForm.isView ? (obj.isView = this.searchForm.isView) : null;
  371. this.extracurricularExercisesId &&
  372. this.extracurricularExercisesId != "yes"
  373. ? (obj.extracurricularExercisesId = this.extracurricularExercisesId)
  374. : null;
  375. this.searchForm.organIdList
  376. ? (obj.organIdList = this.searchForm.organIdList)
  377. : null;
  378. this.searchForm.existVipCourse
  379. ? (obj.existVipCourse = this.searchForm.existVipCourse)
  380. : null;
  381. return obj;
  382. },
  383. onReSet () {
  384. this.searchForm = {
  385. search: null,
  386. timer: [],
  387. status: null,
  388. isReplied: null,
  389. isRepliedTimely: null,
  390. isView: null,
  391. organId: null,
  392. expireDate: [],
  393. existVipCourse: null
  394. };
  395. this.extracurricularExercisesId = null;
  396. this.getList();
  397. },
  398. lookDetail (row) {
  399. // this.afterSchoolVisible = true;
  400. // console.log(row)
  401. findStudentExtraExerciseDetail({
  402. studentExerciseId: row.id
  403. }).then(res => {
  404. if (res.code == 200) {
  405. this.visibleForm = {
  406. expiryDate: res.data.expiryDate,
  407. teacherName: res.data.teacherName,
  408. title: row.extracurricularExercises.title,
  409. studentName: res.data.studentName,
  410. content: res.data.content,
  411. attachments: res.data.attachments.split(",")
  412. };
  413. // console.log(this.visibleForm)
  414. this.afterSchoolVisible = true;
  415. }
  416. });
  417. },
  418. lookWork (src) {
  419. this.activeSrc = src;
  420. this.workVisible = true;
  421. }
  422. },
  423. watch: {
  424. workVisible (val) {
  425. if (!val) {
  426. this.activeSrc = "";
  427. }
  428. }
  429. }
  430. };
  431. </script>
  432. <style lang='scss' scoped>
  433. .schoolCell {
  434. width: 400px;
  435. color: #333;
  436. background-color: #f5f7fa;
  437. border-color: #e4e7ed;
  438. height: 40px;
  439. line-height: 40px;
  440. outline: 0;
  441. padding: 0 15px;
  442. border-radius: 4px;
  443. border: 1px solid #dcdfe6;
  444. display: inline-block;
  445. box-sizing: border-box;
  446. white-space: nowrap;
  447. text-overflow: ellipsis;
  448. overflow: hidden;
  449. }
  450. /deep/.el-textarea.is-disabled .el-textarea__inner {
  451. color: #333;
  452. }
  453. </style>