| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442 |
- <!-- -->
- <template>
- <div class>
- <!-- <h2>
- <div class="squrt"></div>课外作业
- </h2>-->
- <div class="m-core">
- <el-form :inline="true" :model="searchForm" v-if="show">
- <el-form-item>
- <el-input
- v-model.trim="searchForm.search"
- @keyup.enter.native="search"
- placeholder="请输入标题 学生姓名"
- ></el-input>
- </el-form-item>
- <el-form-item prop="organId">
- <el-select
- class="multiple"
- v-model.trim="searchForm.organIdList"
- filterable
- clearable
- placeholder="请选择分部"
- >
- <el-option
- v-for="(item,index) in organList"
- :key="index"
- :label="item.name"
- :value="item.id"
- ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item>
- <el-select placeholder="是否提交" v-model="searchForm.status" clearable>
- <el-option label="是" value="1"></el-option>
- <el-option label="否" value="0"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item>
- <el-select placeholder="是否回复" v-model="searchForm.isReplied" clearable>
- <el-option label="是" value="1"></el-option>
- <el-option label="否" value="0"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item>
- <el-select placeholder="是否查看" v-model="searchForm.isView" clearable>
- <el-option label="是" value="1"></el-option>
- <el-option label="否" value="0"></el-option>
- </el-select>
- </el-form-item>
- <br>
- <el-form-item label="布置时间">
- <el-date-picker
- v-model.trim="searchForm.timer"
- style="width:400px;"
- type="daterange"
- value-format="yyyy-MM-dd"
- range-separator="至"
- start-placeholder="布置开始日期"
- end-placeholder="布置结束日期"
- ></el-date-picker>
- </el-form-item>
- <br>
- <el-form-item label="截止时间">
- <el-date-picker
- v-model.trim="searchForm.expireDate"
- style="width:400px;"
- type="daterange"
- value-format="yyyy-MM-dd"
- range-separator="至"
- start-placeholder="截止开始日期"
- end-placeholder="截止结束日期"
- ></el-date-picker>
- </el-form-item>
-
- <el-form-item>
- <el-button type="danger" @click="search">搜索</el-button>
- <el-button @click="onReSet" type="primary">重置</el-button>
- <el-button @click="onExport" type="primary" v-permission="'export/extraExercisesReplys'" style=" background: #14928a; border:1px solid #14928a;">导出</el-button>
- </el-form-item>
- </el-form>
- <div class="tableWrap">
- <el-table
- style="width: 100%"
- :header-cell-style="{background:'#EDEEF0',color:'#444'}"
- :data="tableList"
- >
- <el-table-column align="center" prop="createTime" label="布置时间" width="150">
- <template slot-scope="scope">
- {{scope.row.createTime | dateForMinFormat}}
- </template>
- </el-table-column>
- <el-table-column align="center" prop="expireDate" label="截止时间" width="150">
- <template slot-scope="scope">
- {{scope.row.expireDate | dateForMinFormat}}
- </template>
- </el-table-column>
- <el-table-column align="center" prop="title" label="训练标题">
- <template slot-scope="scope">
- <div>
- <div
- v-if="scope.row.extracurricularExercises"
- >{{scope.row.extracurricularExercises.title}}</div>
- </div>
- </template>
- </el-table-column>
- <el-table-column align="center" prop="teacherName" label="老师"></el-table-column>
- <el-table-column align="center" prop="organName" label="分部"></el-table-column>
- <el-table-column align="center" prop="createTime" label="学生姓名">
- <template slot-scope="scope">
- <div>
- <div v-if="scope.row.user">{{scope.row.user.username}}</div>
- </div>
- </template>
- </el-table-column>
- <el-table-column align="center" label="提交作业">
- <template slot-scope="scope">
- <div>{{scope.row.status?'是':'否'}}</div>
- </template>
- </el-table-column>
- <el-table-column align="center" prop="isReplied" label="是否回复">
- <template slot-scope="scope">
- <div>{{scope.row.isReplied?'是':'否'}}</div>
- </template>
- </el-table-column>
- <el-table-column align="center" prop="isView" label="是否查看">
- <template slot-scope="scope">
- <div>{{scope.row.isView?'是':'否'}}</div>
- </template>
- </el-table-column>
- <!-- <el-table-column align="center" prop="teacherName" label="老师姓名">
- <template slot-scope="scope">
- <div v-if="scope.row.extracurricularExercises&&scope.row.extracurricularExercises.teacher">{{scope.row.extracurricularExercises.teacher.username}}</div>
- </template>
- </el-table-column>-->
- <el-table-column align="center" label="操作">
- <template slot-scope="scope">
- <div>
- <el-button type="text" v-permission="'afterWorkList/look'" @click="lookDetail(scope.row)">查看</el-button>
- </div>
- </template>
- </el-table-column>
- </el-table>
- <pagination
- :total="rules.total"
- :page.sync="rules.page"
- :limit.sync="rules.limit"
- :page-sizes="rules.page_size"
- @pagination="getList"
- />
- </div>
- </div>
- <el-dialog title="课外训练详情" :visible.sync="afterSchoolVisible" width="600px">
- <el-form :model="visibleForm">
- <!-- <el-form-item label="结束时间">
- <p class="schoolCell">{{visibleForm.expiryDate}}</p>
- </el-form-item>-->
- <el-form-item label="老师姓名">
- <p class="schoolCell">{{visibleForm.teacherName}}</p>
- </el-form-item>
- <el-form-item label="学生姓名">
- <el-popover
- placement="top-start"
- width="400"
- trigger="hover"
- :content="visibleForm.studentName"
- >
- <p class="schoolCell" slot="reference">{{visibleForm.studentName}}</p>
- </el-popover>
- </el-form-item>
- <el-form-item label="截止时间">
- <p class="schoolCell">{{visibleForm.expiryDate | dateForMinFormat}}</p>
- </el-form-item>
- <el-form-item label="训练标题">
- <p class="schoolCell">{{visibleForm.title}}</p>
- </el-form-item>
- <el-form-item label="训练内容">
- <el-input
- disabled
- type="textarea"
- rows="5"
- v-model="visibleForm.content"
- style="width:400px"
- ></el-input>
- </el-form-item>
- <el-form-item label="学生上传" v-for="(item,index) in visibleForm.attachments" :key="index">
- <p class="schoolCell" v-if="item" @click="lookWork(item)">点击播放</p>
- </el-form-item>
- </el-form>
- </el-dialog>
- <el-dialog title="查看作业" width="680px" append-to-body :visible.sync="workVisible">
- <!-- activeUrl -->
- <video
- style="width:640px;"
- :src="activeSrc"
- ref="dialogVideo"
- controls="controls"
- >您的浏览器不支持视频播放</video>
- </el-dialog>
- </div>
- </template>
- <script>
- import pagination from "@/components/Pagination/index";
- import {
- extracurricularExercisesReply,
- findStudentExtraExerciseDetail
- } from "@/api/afterSchool";
- import { getEmployeeOrgan } from "@/api/buildTeam";
- import axios from "axios";
- import { getToken } from "@/utils/auth";
- export default {
- props: ["id"],
- components: { pagination },
- data() {
- return {
- searchForm: {
- search: null,
- timer: [],
- status: null,
- isReplied: null,
- isView: null,
- organIdList: null,
- expireDate:[]
- },
- rules: {
- // 分页规则
- limit: 10, // 限制显示条数
- page: 1, // 当前页
- total: 0, // 总条数
- page_size: [10, 20, 40, 50] // 选择限制显示条数
- },
- teacherList: [],
- tableList: [],
- organList: [],
- visibleForm: {
- expiryDate: "啦啦啦啦",
- teacherName: "",
- title: "",
- studentName: "",
- content: "",
- attachments: []
- },
- afterSchoolVisible: false,
- workVisible: false,
- activeSrc: "",
- extracurricularExercisesId: null,
- show:true
- };
- },
- //生命周期 - 创建完成(可以访问当前this实例)
- created() {},
- //生命周期 - 挂载完成(可以访问DOM元素)
- mounted() {
- getEmployeeOrgan().then(res => {
- if (res.code == 200) {
- this.organList = res.data;
- }
- });
- this.init();
- },
- activated() {
- this.init();
- },
- methods: {
- init() {
- // var now = new Date();
- // var startDate = new Date(
- // Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())
- // )
- // .toISOString()
- // .slice(0, 10);
- // // + " 00:00:00" + " 23:59:59"
- // var endDate = new Date(
- // Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())
- // )
- // .toISOString()
- // .slice(0, 10);
- // this.searchForm.timer = [];
- // this.searchForm.timer.push(startDate);
- // this.searchForm.timer.push(endDate);
- this.extracurricularExercisesId = this.$route.query.extracurricularExercisesId;
- if(this.extracurricularExercisesId){
- this.show = false
- }
- this.searchForm.search = this.$route.query.studentId
- // console.log(this.$route.query)
- this.getList();
- },
- getList() {
- // assignStartTime assignEndTime page search teacherId title
- let obj = this.getDate();
- extracurricularExercisesReply(obj).then(res => {
- if (res.code == 200) {
- this.tableList = res.data.rows;
- this.rules.total = res.data.total;
- }
- });
- },
- search() {
- this.rules.page = 1;
- this.getList();
- },
- // 导出
- onExport(){
- let url = "/api-web/export/extraExercisesReplys";
- let obj = this.getDate()
- const options = {
- method: "get",
- headers: {
- Authorization: getToken()
- },
- url,
- params: obj,
- responseType: "blob"
- };
- this.$confirm("您确定导出列表?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- axios(options).then(res => {
- let blob = new Blob([res.data], {
- // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8',
- type: "application/vnd.ms-excel;charset=utf-8"
- // word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
- });
- let objectUrl = URL.createObjectURL(blob);
- let link = document.createElement("a");
- let nowTime = new Date()
- let ymd = nowTime.getFullYear() + '' + (nowTime.getMonth() + 1) + '' + nowTime.getDate() + '' +
- nowTime.getHours() +
- '' + nowTime.getMinutes()
- let fname =ymd+"课外训练(学员)";
- link.href = objectUrl;
- link.setAttribute("download", fname);
- document.body.appendChild(link);
- link.click();
- });
- })
- .catch(() => {});
- },
- getDate(){
- let obj = {};
- if (this.searchForm.timer && this.searchForm.timer.length > 0) {
- obj.submitStartTime = this.searchForm.timer[0];
- obj.submitEndTime = this.searchForm.timer[1];
- }
- if(this.searchForm.expireDate && this.searchForm.expireDate.length>0){
- obj.expireStartDate = this.searchForm.expireDate[0]
- obj.expireEndDate = this.searchForm.expireDate[1]
- }
- obj.page = this.rules.page;
- (obj.rows = this.rules.limit),
- this.searchForm.teacherId
- ? (obj.teacherId = this.searchForm.teacherId)
- : null;
- this.searchForm.search ? (obj.search = this.searchForm.search) : null;
- this.searchForm.status ? (obj.status = this.searchForm.status) : null;
- this.searchForm.isReplied
- ? (obj.isReplied = this.searchForm.isReplied)
- : null;
- this.searchForm.isView ? (obj.isView = this.searchForm.isView) : null;
- this.extracurricularExercisesId&&this.extracurricularExercisesId !='yes'
- ? (obj.extracurricularExercisesId = this.extracurricularExercisesId)
- : null;
- this.searchForm.organIdList ? (obj.organIdList = this.searchForm.organIdList) : null;
- return obj
- },
- onReSet() {
- this.searchForm = {
- search: null,
- timer: [],
- status: null,
- isReplied: null,
- isView: null,
- organId: null,
- expireDate:[]
- };
- this.extracurricularExercisesId = null;
- this.getList();
- },
- lookDetail(row) {
- // this.afterSchoolVisible = true;
- // console.log(row)
- findStudentExtraExerciseDetail({
- studentExerciseId: row.id
- }).then(res => {
- if (res.code == 200) {
- this.visibleForm = {
- expiryDate: res.data.expiryDate,
- teacherName: res.data.teacherName,
- title: row.extracurricularExercises.title,
- studentName: res.data.studentName,
- content: res.data.content,
- attachments: res.data.attachments.split(",")
- };
- // console.log(this.visibleForm)
- this.afterSchoolVisible = true;
- }
- });
- },
- lookWork(src) {
- this.activeSrc = src;
- this.workVisible = true;
- }
- },
- watch:{
- workVisible(val){
- if(!val){
- this.activeSrc = '';
- }
- }
- }
- };
- </script>
- <style lang='scss' scoped>
- .schoolCell {
- width: 400px;
- color: #333;
- background-color: #f5f7fa;
- border-color: #e4e7ed;
- height: 40px;
- line-height: 40px;
- outline: 0;
- padding: 0 15px;
- border-radius: 4px;
- border: 1px solid #dcdfe6;
- display: inline-block;
- box-sizing: border-box;
- white-space: nowrap;
- text-overflow: ellipsis;
- overflow: hidden;
- }
- /deep/.el-textarea.is-disabled .el-textarea__inner {
- color: #333;
- }
- </style>
|