afterWorkList.vue 15 KB

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