afterWorkList.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  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" :model="searchForm" v-if="!extracurricularExercisesId">
  9. <el-form-item>
  10. <el-input
  11. v-model.trim="searchForm.search"
  12. @keyup.enter.native="search"
  13. placeholder="请输入标题 学生姓名"
  14. ></el-input>
  15. </el-form-item>
  16. <!-- <el-form-item>
  17. <el-select placeholder="老师姓名" v-model="searchForm.teacherId" clearable filterable>
  18. <el-option
  19. v-for="(item,index) in teacherList"
  20. :label="item.realName"
  21. :value="item.id"
  22. :key="index"
  23. ></el-option>
  24. </el-select>
  25. </el-form-item>-->
  26. <el-form-item>
  27. <el-date-picker
  28. v-model.trim="searchForm.timer"
  29. style="width:410px;"
  30. type="daterange"
  31. value-format="yyyy-MM-dd"
  32. range-separator="至"
  33. start-placeholder="开始日期"
  34. end-placeholder="结束日期"
  35. ></el-date-picker>
  36. </el-form-item>
  37. <!-- <el-form-item>
  38. <el-select placeholder="是否提交" v-model="searchForm.hasReport" clearable>
  39. <el-option label="是" value="1"></el-option>
  40. <el-option label="否" value="0"></el-option>
  41. </el-select>
  42. </el-form-item>
  43. <el-form-item>
  44. <el-select placeholder="是否回复" v-model="searchForm.hasReport" clearable>
  45. <el-option label="是" value="1"></el-option>
  46. <el-option label="否" value="0"></el-option>
  47. </el-select>
  48. </el-form-item>-->
  49. <el-form-item>
  50. <el-button type="danger" @click="search">搜索</el-button>
  51. <el-button @click="onReSet" type="primary">重置</el-button>
  52. </el-form-item>
  53. </el-form>
  54. <div class="tableWrap">
  55. <el-table
  56. style="width: 100%"
  57. :header-cell-style="{background:'#EDEEF0',color:'#444'}"
  58. :data="tableList"
  59. >
  60. <el-table-column align="center" prop="createTime" label="布置时间"></el-table-column>
  61. <el-table-column align="center" prop="title" label="训练标题">
  62. <template slot-scope="scope">
  63. <div>
  64. <div
  65. v-if="scope.row.extracurricularExercises"
  66. >{{scope.row.extracurricularExercises.title}}</div>
  67. </div>
  68. </template>
  69. </el-table-column>
  70. <el-table-column align="center" prop="createTime" label="学生姓名">
  71. <template slot-scope="scope">
  72. <div>
  73. <div v-if="scope.row.user">{{scope.row.user.username}}</div>
  74. </div>
  75. </template>
  76. </el-table-column>
  77. <el-table-column align="center" label="提交状态">
  78. <template slot-scope="scope">
  79. <div>{{scope.row.status?'是':'否'}}</div>
  80. </template>
  81. </el-table-column>
  82. <el-table-column align="center" prop="isReplied" label="是否提交">
  83. <template slot-scope="scope">
  84. <div>{{scope.row.isReplied?'是':'否'}}</div>
  85. </template>
  86. </el-table-column>
  87. <el-table-column align="center" prop="isView" label="是否回复">
  88. <template slot-scope="scope">
  89. <div>{{scope.row.isView?'是':'否'}}</div>
  90. </template>
  91. </el-table-column>
  92. <!-- <el-table-column align="center" prop="teacherName" label="老师姓名">
  93. <template slot-scope="scope">
  94. <div v-if="scope.row.extracurricularExercises&&scope.row.extracurricularExercises.teacher">{{scope.row.extracurricularExercises.teacher.username}}</div>
  95. </template>
  96. </el-table-column>-->
  97. <el-table-column align="center" label="操作">
  98. <template slot-scope="scope">
  99. <div>
  100. <el-button type="text" @click="lookDetail(scope.row)">查看</el-button>
  101. </div>
  102. </template>
  103. </el-table-column>
  104. </el-table>
  105. <pagination
  106. :total="rules.total"
  107. :page.sync="rules.page"
  108. :limit.sync="rules.limit"
  109. :page-sizes="rules.page_size"
  110. @pagination="getList"
  111. />
  112. </div>
  113. </div>
  114. <el-dialog title="课外训练详情" :visible.sync="afterSchoolVisible" width="600px">
  115. <el-form :model="visibleForm">
  116. <!-- <el-form-item label="结束时间">
  117. <p class="schoolCell">{{visibleForm.expiryDate}}</p>
  118. </el-form-item>-->
  119. <el-form-item label="老师姓名">
  120. <p class="schoolCell">{{visibleForm.teacherName}}</p>
  121. </el-form-item>
  122. <el-form-item label="学生姓名">
  123. <el-popover
  124. placement="top-start"
  125. width="400"
  126. trigger="hover"
  127. :content="visibleForm.studentName"
  128. >
  129. <p class="schoolCell" slot="reference">{{visibleForm.studentName}}</p>
  130. </el-popover>
  131. </el-form-item>
  132. <el-form-item label="截止时间">
  133. <p class="schoolCell">{{visibleForm.expiryDate}}</p>
  134. </el-form-item>
  135. <el-form-item label="训练标题">
  136. <p class="schoolCell">{{visibleForm.title}}</p>
  137. </el-form-item>
  138. <el-form-item label="训练内容">
  139. <el-input
  140. disabled
  141. type="textarea"
  142. rows="5"
  143. v-model="visibleForm.content"
  144. style="width:400px"
  145. ></el-input>
  146. </el-form-item>
  147. <el-form-item label="学生上传" v-for="(item,index) in visibleForm.attachments" :key="index">
  148. <p class="schoolCell" @click="lookWork(item)">点击播放</p>
  149. </el-form-item>
  150. </el-form>
  151. </el-dialog>
  152. <el-dialog title="查看作业" width="680px" append-to-body :visible.sync="workVisible">
  153. <!-- activeUrl -->
  154. <video
  155. style="width:640px;"
  156. :src="activeSrc"
  157. ref="dialogVideo"
  158. controls="controls"
  159. >您的浏览器不支持视频播放</video>
  160. </el-dialog>
  161. </div>
  162. </template>
  163. <script>
  164. import pagination from "@/components/Pagination/index";
  165. import {
  166. extracurricularExercisesReply,
  167. findStudentExtraExerciseDetail
  168. } from "@/api/afterSchool";
  169. import { getTeacher } from "@/api/buildTeam";
  170. export default {
  171. props:['id'],
  172. components: { pagination },
  173. data() {
  174. return {
  175. searchForm: {
  176. search: null,
  177. timer: [],
  178. teacherId: null,
  179. hasReport: null,
  180. isView: null
  181. },
  182. rules: {
  183. // 分页规则
  184. limit: 10, // 限制显示条数
  185. page: 1, // 当前页
  186. total: 0, // 总条数
  187. page_size: [10, 20, 40, 50] // 选择限制显示条数
  188. },
  189. teacherList: [],
  190. tableList: [],
  191. visibleForm: {
  192. expiryDate: "啦啦啦啦",
  193. teacherName: "",
  194. title: "",
  195. studentName: "",
  196. content: "",
  197. attachments: []
  198. },
  199. afterSchoolVisible: false,
  200. workVisible: false,
  201. activeSrc: "",
  202. extracurricularExercisesId:null
  203. };
  204. },
  205. //生命周期 - 创建完成(可以访问当前this实例)
  206. created() {},
  207. //生命周期 - 挂载完成(可以访问DOM元素)
  208. mounted() {
  209. getTeacher().then(res => {
  210. if (res.code == 200) {
  211. this.teacherList = res.data;
  212. }
  213. });
  214. this.init();
  215. },
  216. activated() {
  217. this.init();
  218. },
  219. methods: {
  220. init() {
  221. // var now = new Date();
  222. // var startDate = new Date(
  223. // Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())
  224. // )
  225. // .toISOString()
  226. // .slice(0, 10);
  227. // // + " 00:00:00" + " 23:59:59"
  228. // var endDate = new Date(
  229. // Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())
  230. // )
  231. // .toISOString()
  232. // .slice(0, 10);
  233. // this.searchForm.timer = [];
  234. // this.searchForm.timer.push(startDate);
  235. // this.searchForm.timer.push(endDate);
  236. this.extracurricularExercisesId = this.id;
  237. this.getList();
  238. },
  239. getList() {
  240. // assignStartTime assignEndTime page search teacherId title
  241. let obj = {};
  242. if (this.searchForm.timer && this.searchForm.timer.length > 0) {
  243. obj.submitStartTime = this.searchForm.timer[0];
  244. obj.submitEndTime = this.searchForm.timer[1];
  245. }
  246. obj.page = this.rules.page;
  247. (obj.rows = this.rules.limit),
  248. this.searchForm.teacherId
  249. ? (obj.teacherId = this.searchForm.teacherId)
  250. : null;
  251. this.searchForm.search ? (obj.search = this.searchForm.search) : null;
  252. this.extracurricularExercisesId
  253. ? (obj.extracurricularExercisesId = this.extracurricularExercisesId)
  254. : null;
  255. extracurricularExercisesReply(obj).then(res => {
  256. if (res.code == 200) {
  257. this.tableList = res.data.rows;
  258. this.rules.total = res.data.total;
  259. }
  260. });
  261. },
  262. search() {
  263. this.rules.page = 1;
  264. this.getList();
  265. },
  266. onReSet() {
  267. this.searchForm = {
  268. search: null,
  269. timer: [],
  270. teacherId: null,
  271. hasReport: null,
  272. isView: null,
  273. };
  274. this.extracurricularExercisesId = null;
  275. this.getList();
  276. },
  277. lookDetail(row) {
  278. // this.afterSchoolVisible = true;
  279. // console.log(row)
  280. findStudentExtraExerciseDetail({
  281. studentExerciseId: row.extracurricularExercisesId
  282. }).then(res => {
  283. if (res.code == 200) {
  284. this.visibleForm = {
  285. expiryDate: res.data.expiryDate,
  286. teacherName: res.data.teacherName,
  287. title: row.extracurricularExercises.title,
  288. studentName: res.data.studentName,
  289. content: res.data.content,
  290. attachments: res.data.attachments.split(",")
  291. };
  292. // console.log(this.visibleForm)
  293. this.afterSchoolVisible = true;
  294. }
  295. });
  296. },
  297. lookWork(src) {
  298. this.activeSrc = src;
  299. this.workVisible = true;
  300. }
  301. }
  302. };
  303. </script>
  304. <style lang='scss' scoped>
  305. .schoolCell {
  306. width: 400px;
  307. color: #333;
  308. background-color: #f5f7fa;
  309. border-color: #e4e7ed;
  310. height: 40px;
  311. line-height: 40px;
  312. outline: 0;
  313. padding: 0 15px;
  314. border-radius: 4px;
  315. border: 1px solid #dcdfe6;
  316. display: inline-block;
  317. box-sizing: border-box;
  318. white-space: nowrap;
  319. text-overflow: ellipsis;
  320. overflow: hidden;
  321. }
  322. /deep/.el-textarea.is-disabled .el-textarea__inner {
  323. color: #333;
  324. }
  325. </style>