|
|
|
@ -1,410 +1,510 @@ |
|
|
|
|
<template> |
|
|
|
|
<div class="page"> |
|
|
|
|
<h6 class="p-title">筛选</h6> |
|
|
|
|
<div class="tool mul"> |
|
|
|
|
<ul class="filter"> |
|
|
|
|
<li> |
|
|
|
|
<label>创建时间</label> |
|
|
|
|
<el-radio-group v-model="form.month" @change="initData"> |
|
|
|
|
<el-radio v-for="(item,index) in dateList" :key="index" :label="item.id" border>{{ item.name }}</el-radio> |
|
|
|
|
</el-radio-group> |
|
|
|
|
<el-date-picker v-model="date" @blur='pickerInput' align="right" unlink-panels type="daterange" style="width: 300px;margin-left: 10px;" start-placeholder="开始日期" end-placeholder="结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd" clearable></el-date-picker> |
|
|
|
|
</li> |
|
|
|
|
<li> |
|
|
|
|
<label>发布类型</label> |
|
|
|
|
<el-select v-model="form.type" clearable placeholder="请选择发布类型" @change="initData"> |
|
|
|
|
<el-option v-for="(item,index) in typeList" :key="index" :label="item.name" :value="item.value"></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</li> |
|
|
|
|
<li> |
|
|
|
|
<label>实验状态</label> |
|
|
|
|
<el-select v-model="form.status" clearable placeholder="请选择实验状态" @change="initData"> |
|
|
|
|
<el-option v-for="(item,index) in statusList" :key="index" :label="item.name" :value="item.value"></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</li> |
|
|
|
|
<li> |
|
|
|
|
<label>课程</label> |
|
|
|
|
<el-select v-model="curriculumId" placeholder="请选择" @change="initData"> |
|
|
|
|
<el-option label="不限" value=""></el-option> |
|
|
|
|
<el-option |
|
|
|
|
v-for="item in curriculumList" |
|
|
|
|
:key="item.cid" |
|
|
|
|
:label="item.curriculumName" |
|
|
|
|
:value="item.cid" |
|
|
|
|
></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</li> |
|
|
|
|
</ul> |
|
|
|
|
</div> |
|
|
|
|
<div class="tool mul"> |
|
|
|
|
<ul class="filter"> |
|
|
|
|
<li> |
|
|
|
|
<el-input placeholder="请输入实验班级/项目名称/考核名称" prefix-icon="el-icon-search" v-model.trim="keyWord" clearable style="width: 300px"></el-input> |
|
|
|
|
</li> |
|
|
|
|
</ul> |
|
|
|
|
<div> |
|
|
|
|
<div> |
|
|
|
|
<el-button v-auth type="info" round @click="add" >创建考核</el-button> |
|
|
|
|
<el-button v-auth type="primary" round @click="delAllData">批量删除</el-button> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div class="page"> |
|
|
|
|
<h6 class="p-title">筛选</h6> |
|
|
|
|
<div class="tool mul"> |
|
|
|
|
<ul class="filter"> |
|
|
|
|
<li> |
|
|
|
|
<label>创建时间</label> |
|
|
|
|
<el-radio-group v-model="form.month" |
|
|
|
|
@change="initData"> |
|
|
|
|
<el-radio v-for="(item,index) in dateList" |
|
|
|
|
:key="index" |
|
|
|
|
:label="item.id" |
|
|
|
|
border>{{ item.name }}</el-radio> |
|
|
|
|
</el-radio-group> |
|
|
|
|
<el-date-picker v-model="date" |
|
|
|
|
@blur='pickerInput' |
|
|
|
|
align="right" |
|
|
|
|
unlink-panels |
|
|
|
|
type="daterange" |
|
|
|
|
style="width: 300px;margin-left: 10px;" |
|
|
|
|
start-placeholder="开始日期" |
|
|
|
|
end-placeholder="结束日期" |
|
|
|
|
format="yyyy-MM-dd" |
|
|
|
|
value-format="yyyy-MM-dd" |
|
|
|
|
clearable></el-date-picker> |
|
|
|
|
</li> |
|
|
|
|
<li> |
|
|
|
|
<label>发布类型</label> |
|
|
|
|
<el-select v-model="form.type" |
|
|
|
|
clearable |
|
|
|
|
placeholder="请选择发布类型" |
|
|
|
|
@change="initData"> |
|
|
|
|
<el-option v-for="(item,index) in typeList" |
|
|
|
|
:key="index" |
|
|
|
|
:label="item.name" |
|
|
|
|
:value="item.value"></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</li> |
|
|
|
|
<li> |
|
|
|
|
<label>实验状态</label> |
|
|
|
|
<el-select v-model="form.status" |
|
|
|
|
clearable |
|
|
|
|
placeholder="请选择实验状态" |
|
|
|
|
@change="initData"> |
|
|
|
|
<el-option v-for="(item,index) in statusList" |
|
|
|
|
:key="index" |
|
|
|
|
:label="item.name" |
|
|
|
|
:value="item.value"></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</li> |
|
|
|
|
<li> |
|
|
|
|
<label>课程</label> |
|
|
|
|
<el-select v-model="curriculumId" |
|
|
|
|
placeholder="请选择" |
|
|
|
|
@change="initData"> |
|
|
|
|
<el-option label="不限" |
|
|
|
|
value=""></el-option> |
|
|
|
|
<el-option v-for="item in curriculumList" |
|
|
|
|
:key="item.cid" |
|
|
|
|
:label="item.curriculumName" |
|
|
|
|
:value="item.cid"></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</li> |
|
|
|
|
</ul> |
|
|
|
|
</div> |
|
|
|
|
<div class="tool mul"> |
|
|
|
|
<ul class="filter"> |
|
|
|
|
<li> |
|
|
|
|
<el-input placeholder="请输入实验班级/项目名称/考核名称" |
|
|
|
|
prefix-icon="el-icon-search" |
|
|
|
|
v-model.trim="keyWord" |
|
|
|
|
clearable |
|
|
|
|
style="width: 300px"></el-input> |
|
|
|
|
</li> |
|
|
|
|
</ul> |
|
|
|
|
<div> |
|
|
|
|
<div> |
|
|
|
|
<el-button v-auth |
|
|
|
|
type="info" |
|
|
|
|
round |
|
|
|
|
@click="add">创建考核</el-button> |
|
|
|
|
<el-button v-auth |
|
|
|
|
type="primary" |
|
|
|
|
round |
|
|
|
|
@click="delAllData">批量删除</el-button> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<el-table v-loading="listLoading" ref="table" :data="listData" class="table" stripe header-align="center" @selection-change="handleSelectionChange" row-key="id"> |
|
|
|
|
<el-table-column type="selection" :selectable="row => row.status !== 1" width="50" align="center" :reserve-selection="true"></el-table-column> |
|
|
|
|
<el-table-column type="index" width="60" label="序号" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
{{ scope.$index + (pageNum - 1) * pageSize + 1 }} |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="className" label="实验班级" align="center" min-width="120px" show-overflow-tooltip></el-table-column> |
|
|
|
|
<el-table-column prop="experimentalName" label="考核名称" align="center" min-width="120px" show-overflow-tooltip></el-table-column> |
|
|
|
|
<el-table-column prop="projectName" label="项目名称" min-width="200" show-overflow-tooltip align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="experimenterNum" label="实验人数" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="experimentDuration" label="实验时长" align="center"></el-table-column> |
|
|
|
|
<el-table-column label="邀请码" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<span>{{ scope.row.isEnableCode == 1 ? scope.row.invitationCode : "" }}</span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="type" label="发布类型" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<span>{{ types[scope.row.type] }}</span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="createTime" width="150" label="创建时间" align="center"> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="startTime" width="150" label="起始时间" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<span>{{ transferTime(scope.row.startTime) }}</span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="stopTime" width="150" label="结束时间" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<span>{{ transferTime(scope.row.stopTime) }}</span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="倒计时" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<span>{{ timeFilter(scope.row) }}</span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="实验状态" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<span> |
|
|
|
|
{{ status[scope.row.status] }} |
|
|
|
|
</span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="操作" width="170" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<template v-if="scope.row.status == 0 && (roleName.includes('超级') || roleName === scope.row.roleName || (roleName === '管理员' && !scope.row.roleName.includes('超级')))"> |
|
|
|
|
<el-button v-auth v-if="scope.row.type == 1" type="text" @click="start(scope.row)">启动</el-button> |
|
|
|
|
<el-button v-auth type="text" @click="edit(scope.row)">修改</el-button> |
|
|
|
|
</template> |
|
|
|
|
<template v-else-if="scope.row.status == 1 && (roleName.includes('超级') || roleName === scope.row.roleName || (roleName === '管理员' && !scope.row.roleName.includes('超级')))"> |
|
|
|
|
<el-button v-auth type="text" @click="finish(scope.row)">提前结束</el-button> |
|
|
|
|
</template> |
|
|
|
|
<template v-else-if="scope.row.status == 2"> |
|
|
|
|
<el-button v-auth type="text" @click="show(scope.row)">查看成绩</el-button> |
|
|
|
|
</template> |
|
|
|
|
<el-button v-auth v-if="(scope.row.status == 0 || scope.row.status == 2) && (roleName.includes('超级') || roleName === scope.row.roleName || (roleName === '管理员' && !scope.row.roleName.includes('超级')))" type="text" @click="delData(scope.row)">删除</el-button> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
</el-table> |
|
|
|
|
<div class="pagination"> |
|
|
|
|
<el-pagination background layout="total, prev, pager, next" :total="total" @current-change="handleCurrentChange" :current-page="pageNum"></el-pagination> |
|
|
|
|
</div> |
|
|
|
|
<el-table v-loading="listLoading" |
|
|
|
|
ref="table" |
|
|
|
|
:data="listData" |
|
|
|
|
class="table" |
|
|
|
|
stripe |
|
|
|
|
header-align="center" |
|
|
|
|
@selection-change="handleSelectionChange" |
|
|
|
|
row-key="id"> |
|
|
|
|
<el-table-column type="selection" |
|
|
|
|
:selectable="row => row.status !== 1" |
|
|
|
|
width="50" |
|
|
|
|
align="center" |
|
|
|
|
:reserve-selection="true"></el-table-column> |
|
|
|
|
<el-table-column type="index" |
|
|
|
|
width="60" |
|
|
|
|
label="序号" |
|
|
|
|
align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
{{ scope.$index + (pageNum - 1) * pageSize + 1 }} |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="className" |
|
|
|
|
label="实验班级" |
|
|
|
|
align="center" |
|
|
|
|
min-width="120px" |
|
|
|
|
show-overflow-tooltip></el-table-column> |
|
|
|
|
<el-table-column prop="experimentalName" |
|
|
|
|
label="考核名称" |
|
|
|
|
align="center" |
|
|
|
|
min-width="120px" |
|
|
|
|
show-overflow-tooltip></el-table-column> |
|
|
|
|
<el-table-column prop="projectName" |
|
|
|
|
label="项目名称" |
|
|
|
|
min-width="200" |
|
|
|
|
show-overflow-tooltip |
|
|
|
|
align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="experimenterNum" |
|
|
|
|
label="实验人数" |
|
|
|
|
align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="experimentDuration" |
|
|
|
|
label="实验时长" |
|
|
|
|
align="center"></el-table-column> |
|
|
|
|
<el-table-column label="邀请码" |
|
|
|
|
align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<span>{{ scope.row.isEnableCode == 1 ? scope.row.invitationCode : "" }}</span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="type" |
|
|
|
|
label="发布类型" |
|
|
|
|
align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<span>{{ types[scope.row.type] }}</span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="createTime" |
|
|
|
|
width="150" |
|
|
|
|
label="创建时间" |
|
|
|
|
align="center"> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="startTime" |
|
|
|
|
width="150" |
|
|
|
|
label="起始时间" |
|
|
|
|
align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<span>{{ transferTime(scope.row.startTime) }}</span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="stopTime" |
|
|
|
|
width="150" |
|
|
|
|
label="结束时间" |
|
|
|
|
align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<span>{{ transferTime(scope.row.stopTime) }}</span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="倒计时" |
|
|
|
|
align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<span>{{ timeFilter(scope.row) }}</span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="实验状态" |
|
|
|
|
align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<span> |
|
|
|
|
{{ status[scope.row.status] }} |
|
|
|
|
</span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="操作" |
|
|
|
|
width="170" |
|
|
|
|
align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<template v-if="scope.row.status == 0 && (roleName.includes('超级') || roleName === scope.row.roleName || (roleName === '管理员' && !scope.row.roleName.includes('超级')))"> |
|
|
|
|
<el-button v-auth |
|
|
|
|
v-if="scope.row.type == 1" |
|
|
|
|
type="text" |
|
|
|
|
@click="start(scope.row)">启动</el-button> |
|
|
|
|
<el-button v-auth |
|
|
|
|
type="text" |
|
|
|
|
@click="edit(scope.row)">修改</el-button> |
|
|
|
|
</template> |
|
|
|
|
<template v-else-if="scope.row.status == 1 && (roleName.includes('超级') || roleName === scope.row.roleName || (roleName === '管理员' && !scope.row.roleName.includes('超级')))"> |
|
|
|
|
<el-button v-auth |
|
|
|
|
type="text" |
|
|
|
|
@click="finish(scope.row)">提前结束</el-button> |
|
|
|
|
</template> |
|
|
|
|
<template v-else-if="scope.row.status == 2"> |
|
|
|
|
<el-button v-auth |
|
|
|
|
type="text" |
|
|
|
|
@click="show(scope.row)">查看成绩</el-button> |
|
|
|
|
</template> |
|
|
|
|
<el-button v-auth |
|
|
|
|
v-if="(scope.row.status == 0 || scope.row.status == 2) && (roleName.includes('超级') || roleName === scope.row.roleName || (roleName === '管理员' && !scope.row.roleName.includes('超级')))" |
|
|
|
|
type="text" |
|
|
|
|
@click="delData(scope.row)">删除</el-button> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
</el-table> |
|
|
|
|
<div class="pagination"> |
|
|
|
|
<el-pagination background |
|
|
|
|
layout="total, prev, pager, next" |
|
|
|
|
:total="total" |
|
|
|
|
@current-change="handleCurrentChange" |
|
|
|
|
:current-page="pageNum"></el-pagination> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import { mapState } from "vuex"; |
|
|
|
|
import util from "@/libs/util"; |
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
typeList: [ |
|
|
|
|
{ |
|
|
|
|
value: "", |
|
|
|
|
name: "不限" |
|
|
|
|
}, { |
|
|
|
|
value: 1, |
|
|
|
|
name: "手动发布" |
|
|
|
|
}, { |
|
|
|
|
value: 2, |
|
|
|
|
name: "定时发布" |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
types: ["", "手动发布", "定时发布"], |
|
|
|
|
statusList: [ |
|
|
|
|
{ |
|
|
|
|
value: "", |
|
|
|
|
name: "不限" |
|
|
|
|
}, { |
|
|
|
|
value: 0, |
|
|
|
|
name: "待开始" |
|
|
|
|
}, { |
|
|
|
|
value: 1, |
|
|
|
|
name: "进行中" |
|
|
|
|
}, { |
|
|
|
|
value: 2, |
|
|
|
|
name: "已结束" |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
status: ["待开始", "进行中", "已结束"], |
|
|
|
|
dateList: [ |
|
|
|
|
{ |
|
|
|
|
id: "", |
|
|
|
|
name: "不限" |
|
|
|
|
}, { |
|
|
|
|
id: 1, |
|
|
|
|
name: "近一个月" |
|
|
|
|
}, { |
|
|
|
|
id: 3, |
|
|
|
|
name: "近三个月" |
|
|
|
|
}, { |
|
|
|
|
id: 6, |
|
|
|
|
name: "近六个月" |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
date: [], |
|
|
|
|
curriculumList: [], |
|
|
|
|
curriculumId: "", |
|
|
|
|
keyWord: "", // 搜索框筛选条件 |
|
|
|
|
searchTimer: null, |
|
|
|
|
form: { |
|
|
|
|
type: "", |
|
|
|
|
status: "", |
|
|
|
|
startTime: "", |
|
|
|
|
endTime: "", |
|
|
|
|
month: "" |
|
|
|
|
}, |
|
|
|
|
pageNum: +this.$route.query.page || 1, // 当前页数 |
|
|
|
|
pageSize: 10, // 每页10条 |
|
|
|
|
total: 0, // 总数 |
|
|
|
|
listData: [], // 表格数据 |
|
|
|
|
multipleSelection: [], // 多选 |
|
|
|
|
listLoading:false,// 列表加载 |
|
|
|
|
ticker: null, // 倒计时定时器 |
|
|
|
|
}; |
|
|
|
|
data () { |
|
|
|
|
return { |
|
|
|
|
typeList: [ |
|
|
|
|
{ |
|
|
|
|
value: "", |
|
|
|
|
name: "不限" |
|
|
|
|
}, { |
|
|
|
|
value: 1, |
|
|
|
|
name: "手动发布" |
|
|
|
|
}, { |
|
|
|
|
value: 2, |
|
|
|
|
name: "定时发布" |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
types: ["", "手动发布", "定时发布"], |
|
|
|
|
statusList: [ |
|
|
|
|
{ |
|
|
|
|
value: "", |
|
|
|
|
name: "不限" |
|
|
|
|
}, { |
|
|
|
|
value: 0, |
|
|
|
|
name: "待开始" |
|
|
|
|
}, { |
|
|
|
|
value: 1, |
|
|
|
|
name: "进行中" |
|
|
|
|
}, { |
|
|
|
|
value: 2, |
|
|
|
|
name: "已结束" |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
status: ["待开始", "进行中", "已结束"], |
|
|
|
|
dateList: [ |
|
|
|
|
{ |
|
|
|
|
id: "", |
|
|
|
|
name: "不限" |
|
|
|
|
}, { |
|
|
|
|
id: 1, |
|
|
|
|
name: "近一个月" |
|
|
|
|
}, { |
|
|
|
|
id: 3, |
|
|
|
|
name: "近三个月" |
|
|
|
|
}, { |
|
|
|
|
id: 6, |
|
|
|
|
name: "近六个月" |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
date: [], |
|
|
|
|
curriculumList: [], |
|
|
|
|
curriculumId: "", |
|
|
|
|
keyWord: "", // 搜索框筛选条件 |
|
|
|
|
searchTimer: null, |
|
|
|
|
form: { |
|
|
|
|
type: "", |
|
|
|
|
status: "", |
|
|
|
|
startTime: "", |
|
|
|
|
endTime: "", |
|
|
|
|
month: "" |
|
|
|
|
}, |
|
|
|
|
pageNum: +this.$route.query.page || 1, // 当前页数 |
|
|
|
|
pageSize: 10, // 每页10条 |
|
|
|
|
total: 0, // 总数 |
|
|
|
|
listData: [], // 表格数据 |
|
|
|
|
multipleSelection: [], // 多选 |
|
|
|
|
listLoading: false,// 列表加载 |
|
|
|
|
ticker: null, // 倒计时定时器 |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
computed: { |
|
|
|
|
...mapState("user", [ |
|
|
|
|
'roleName' |
|
|
|
|
]) |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
|
"form.month": function (val) { |
|
|
|
|
if (val) { |
|
|
|
|
let unit = 24 * 60 * 60 * 1000; |
|
|
|
|
this.date = [util.formatDate("yyyy-MM-dd", new Date(new Date().getTime() - unit * 30 * val)), util.formatDate("yyyy-MM-dd", new Date(new Date().getTime() + unit))]; |
|
|
|
|
} else { |
|
|
|
|
this.date = []; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
computed: { |
|
|
|
|
...mapState("user", [ |
|
|
|
|
'roleName' |
|
|
|
|
]) |
|
|
|
|
date: function (val) { |
|
|
|
|
if (val) { |
|
|
|
|
this.form.startTime = val[0]; |
|
|
|
|
this.form.endTime = val[1]; |
|
|
|
|
} else { |
|
|
|
|
this.form.startTime = ""; |
|
|
|
|
this.form.endTime = ""; |
|
|
|
|
this.form.month = ''; |
|
|
|
|
} |
|
|
|
|
this.initData(); |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
|
"form.month": function(val) { |
|
|
|
|
if (val) { |
|
|
|
|
let unit = 24 * 60 * 60 * 1000; |
|
|
|
|
this.date = [util.formatDate("yyyy-MM-dd", new Date(new Date().getTime() - unit * 30 * val)), util.formatDate("yyyy-MM-dd", new Date(new Date().getTime() + unit))]; |
|
|
|
|
} else { |
|
|
|
|
this.date = []; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
date: function(val) { |
|
|
|
|
if (val) { |
|
|
|
|
this.form.startTime = val[0]; |
|
|
|
|
this.form.endTime = val[1]; |
|
|
|
|
} else { |
|
|
|
|
this.form.startTime = ""; |
|
|
|
|
this.form.endTime = ""; |
|
|
|
|
this.form.month = ''; |
|
|
|
|
keyWord: function (val) { |
|
|
|
|
clearTimeout(this.searchTimer); |
|
|
|
|
this.searchTimer = setTimeout(() => { |
|
|
|
|
this.initData(); |
|
|
|
|
}, 500); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
mounted () { |
|
|
|
|
// 页面离开的时候销毁手机和邮箱验证码定时器 |
|
|
|
|
this.$once("hook:beforeDestroy", function () { |
|
|
|
|
clearInterval(this.ticker); |
|
|
|
|
this.ticker = null; |
|
|
|
|
}); |
|
|
|
|
this.getData(1); |
|
|
|
|
this.getschoolCourse(); |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
pickerInput () { |
|
|
|
|
this.form.month = '6' |
|
|
|
|
}, |
|
|
|
|
beginTimer () { |
|
|
|
|
clearInterval(this.ticker) |
|
|
|
|
this.ticker = setInterval(() => { |
|
|
|
|
for (let i = 0; i < this.listData.length; i++) { |
|
|
|
|
const item = this.listData[i]; |
|
|
|
|
if (item.countDown > 0) { |
|
|
|
|
item.countDown--; |
|
|
|
|
} else { |
|
|
|
|
if (item.status == 0 && item.type == 2) { // 待开始-定时发布 |
|
|
|
|
item.status = 1; |
|
|
|
|
item.countDown = (new Date(item.stopTime).getTime() - new Date().getTime()) / 1000; |
|
|
|
|
// } |
|
|
|
|
} else if (item.status == 1) { |
|
|
|
|
// item.status = 2; |
|
|
|
|
} |
|
|
|
|
this.initData(); |
|
|
|
|
}, |
|
|
|
|
keyWord: function(val) { |
|
|
|
|
clearTimeout(this.searchTimer); |
|
|
|
|
this.searchTimer = setTimeout(() => { |
|
|
|
|
this.initData(); |
|
|
|
|
}, 500); |
|
|
|
|
} |
|
|
|
|
this.$set(this.listData, i, item); |
|
|
|
|
} |
|
|
|
|
}, 1000); |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
|
// 页面离开的时候销毁手机和邮箱验证码定时器 |
|
|
|
|
this.$once("hook:beforeDestroy", function() { |
|
|
|
|
clearInterval(this.ticker); |
|
|
|
|
this.ticker = null; |
|
|
|
|
}); |
|
|
|
|
this.getData(1); |
|
|
|
|
this.getschoolCourse(); |
|
|
|
|
timeFilter (countDown) { |
|
|
|
|
if (countDown.countDown > 0) { |
|
|
|
|
let h = Math.floor(countDown.countDown / (60 * 60)); |
|
|
|
|
let m = Math.floor(countDown.countDown % (60 * 60) / 60); |
|
|
|
|
let s = Math.floor(countDown.countDown % (60 * 60) % 60); |
|
|
|
|
return `${h > 9 ? h : `0${h}`}:${m > 9 ? m : `0${m}`}:${s > 9 ? s : `0${s}`}`; |
|
|
|
|
} else { |
|
|
|
|
if (countDown.status == 1) { |
|
|
|
|
countDown.status = 2 |
|
|
|
|
} |
|
|
|
|
return "00:00:00"; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
pickerInput(){ |
|
|
|
|
this.form.month = '6' |
|
|
|
|
}, |
|
|
|
|
beginTimer() { |
|
|
|
|
clearInterval(this.ticker) |
|
|
|
|
this.ticker = setInterval(() => { |
|
|
|
|
for (let i = 0; i < this.listData.length; i++) { |
|
|
|
|
const item = this.listData[i]; |
|
|
|
|
if (item.countDown > 0) { |
|
|
|
|
item.countDown--; |
|
|
|
|
} else { |
|
|
|
|
if (item.status == 0 && item.type == 2) { // 待开始-定时发布 |
|
|
|
|
item.status = 1; |
|
|
|
|
item.countDown = (new Date(item.stopTime).getTime() - new Date().getTime()) / 1000; |
|
|
|
|
// } |
|
|
|
|
} else if (item.status == 1) { |
|
|
|
|
// item.status = 2; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
this.$set(this.listData, i, item); |
|
|
|
|
getData (counddown) { |
|
|
|
|
this.listLoading = true; |
|
|
|
|
let data = { |
|
|
|
|
...this.form, |
|
|
|
|
keyWord: this.keyWord, |
|
|
|
|
pageNum: this.pageNum, |
|
|
|
|
pageSize: this.pageSize, |
|
|
|
|
curriculumId: this.curriculumId |
|
|
|
|
}; |
|
|
|
|
this.$post(this.api.pageByCondition, data).then(res => { |
|
|
|
|
this.listData = res.list; |
|
|
|
|
this.total = res.total; |
|
|
|
|
this.listData.forEach(i => { |
|
|
|
|
if (i.status == 2) { // 已结束 |
|
|
|
|
i.countDown = 0; |
|
|
|
|
} else { |
|
|
|
|
if (i.type == 2) { // 定时发布 |
|
|
|
|
if (i.status == 0) { |
|
|
|
|
// 待开始 |
|
|
|
|
i.countDown = (new Date(i.startTime).getTime() - new Date().getTime()) / 1000; // 获得两个日期时间的秒数差 |
|
|
|
|
} else if (i.status == 1) { |
|
|
|
|
// 进行中 |
|
|
|
|
i.countDown = (new Date(i.stopTime).getTime() - new Date().getTime()) / 1000; |
|
|
|
|
} |
|
|
|
|
} else if (i.type == 1) { // 手动发布 |
|
|
|
|
if (i.status == 0) { |
|
|
|
|
// 待开始 |
|
|
|
|
i.countDown = 0; |
|
|
|
|
} else if (i.status == 1) { |
|
|
|
|
// 进行中 |
|
|
|
|
i.countDown = (new Date(i.stopTime).getTime() - new Date().getTime()) / 1000; |
|
|
|
|
} |
|
|
|
|
}, 1000); |
|
|
|
|
}, |
|
|
|
|
timeFilter(countDown) { |
|
|
|
|
if (countDown.countDown > 0) { |
|
|
|
|
let h = Math.floor(countDown.countDown / (60 * 60)); |
|
|
|
|
let m = Math.floor(countDown.countDown % (60 * 60) / 60); |
|
|
|
|
let s = Math.floor(countDown.countDown % (60 * 60) % 60); |
|
|
|
|
return `${h > 9 ? h : `0${h}`}:${m > 9 ? m : `0${m}`}:${s > 9 ? s : `0${s}`}`; |
|
|
|
|
} else { |
|
|
|
|
if(countDown.status == 1){ |
|
|
|
|
countDown.status = 2 |
|
|
|
|
} |
|
|
|
|
return "00:00:00"; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
getData(counddown) { |
|
|
|
|
this.listLoading = true; |
|
|
|
|
let data = { |
|
|
|
|
...this.form, |
|
|
|
|
keyWord: this.keyWord, |
|
|
|
|
pageNum: this.pageNum, |
|
|
|
|
pageSize: this.pageSize, |
|
|
|
|
curriculumId: this.curriculumId |
|
|
|
|
}; |
|
|
|
|
this.$post(this.api.pageByCondition, data).then(res => { |
|
|
|
|
this.listData = res.list; |
|
|
|
|
this.total = res.total; |
|
|
|
|
this.listData.forEach(i => { |
|
|
|
|
if (i.status == 2) { // 已结束 |
|
|
|
|
i.countDown = 0; |
|
|
|
|
} else { |
|
|
|
|
if (i.type == 2) { // 定时发布 |
|
|
|
|
if (i.status == 0) { |
|
|
|
|
// 待开始 |
|
|
|
|
i.countDown = (new Date(i.startTime).getTime() - new Date().getTime()) / 1000; // 获得两个日期时间的秒数差 |
|
|
|
|
} else if (i.status == 1) { |
|
|
|
|
// 进行中 |
|
|
|
|
i.countDown = (new Date(i.stopTime).getTime() - new Date().getTime()) / 1000; |
|
|
|
|
} |
|
|
|
|
} else if (i.type == 1) { // 手动发布 |
|
|
|
|
if (i.status == 0) { |
|
|
|
|
// 待开始 |
|
|
|
|
i.countDown = 0; |
|
|
|
|
} else if (i.status == 1) { |
|
|
|
|
// 进行中 |
|
|
|
|
i.countDown = (new Date(i.stopTime).getTime() - new Date().getTime()) / 1000; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
counddown && this.beginTimer() |
|
|
|
|
this.listLoading = false; |
|
|
|
|
}).catch(err => { |
|
|
|
|
this.listLoading = false; |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
initData() { |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
counddown && this.beginTimer() |
|
|
|
|
this.listLoading = false; |
|
|
|
|
}).catch(err => { |
|
|
|
|
this.listLoading = false; |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
initData () { |
|
|
|
|
this.$refs.table.clearSelection(); |
|
|
|
|
this.pageNum = 1; |
|
|
|
|
this.getData(); |
|
|
|
|
}, |
|
|
|
|
getschoolCourse () { // 获取课程下拉框数据 |
|
|
|
|
this.$get(this.api.schoolCourse).then(res => { |
|
|
|
|
this.curriculumList = res.data; |
|
|
|
|
}).catch(err => { |
|
|
|
|
console.log(err); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
add () { |
|
|
|
|
this.$router.push("add"); |
|
|
|
|
}, |
|
|
|
|
edit (row) { |
|
|
|
|
this.$router.push(`add?id=${row.id}`); |
|
|
|
|
}, |
|
|
|
|
show (row) { |
|
|
|
|
this.$router.push(`/achievement/teach?id=${row.id}&projectName=${row.projectName}&permissions=1`) |
|
|
|
|
}, |
|
|
|
|
start (row) { |
|
|
|
|
this.$post(`${this.api.enableAssessment}?id=${row.id}`).then(res => { |
|
|
|
|
util.successMsg("启动成功!"); |
|
|
|
|
this.getData(1); |
|
|
|
|
}).catch(err => { |
|
|
|
|
console.log(err); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
finish (row) { |
|
|
|
|
this.$confirm("确定要提前结束吗?", "提示", { |
|
|
|
|
type: "warning" |
|
|
|
|
}).then(() => { |
|
|
|
|
let data = { |
|
|
|
|
id: row.id, |
|
|
|
|
endTime: util.formatDate("yyyy-MM-dd hh:mm:ss", new Date()), |
|
|
|
|
status: 2 |
|
|
|
|
}; |
|
|
|
|
this.$post(`${this.api.collectPaper}?id=${row.id}`).then(async res => { |
|
|
|
|
util.successMsg("提前结束成功!"); |
|
|
|
|
this.getData(); |
|
|
|
|
// await this.$post(`${this.api.refreshPageNotification}?content=3-${row.id}`) |
|
|
|
|
}).catch(err => { |
|
|
|
|
console.log(err); |
|
|
|
|
}); |
|
|
|
|
}).catch(() => { |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
delData (row) { |
|
|
|
|
this.$confirm("确定要删除吗?", "提示", { |
|
|
|
|
type: "warning" |
|
|
|
|
}).then(() => { |
|
|
|
|
this.$post(this.api.deleteAssessment, [row.id]).then(res => { |
|
|
|
|
util.successMsg("删除成功"); |
|
|
|
|
this.getData(); |
|
|
|
|
}).catch(res => { |
|
|
|
|
}); |
|
|
|
|
}).catch(() => { |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
delAllData () { |
|
|
|
|
if (this.multipleSelection.length) { |
|
|
|
|
let ids = this.multipleSelection.map(item => { |
|
|
|
|
return item.id; |
|
|
|
|
}); |
|
|
|
|
this.$confirm("确定要删除吗?", "提示", { |
|
|
|
|
type: "warning" |
|
|
|
|
}).then(() => { |
|
|
|
|
|
|
|
|
|
this.$post(this.api.deleteAssessment, ids).then(res => { |
|
|
|
|
this.multipleSelection = []; |
|
|
|
|
this.$refs.table.clearSelection(); |
|
|
|
|
this.pageNum = 1; |
|
|
|
|
util.successMsg("删除成功"); |
|
|
|
|
this.getData(); |
|
|
|
|
}, |
|
|
|
|
getschoolCourse() { // 获取课程下拉框数据 |
|
|
|
|
this.$get(this.api.schoolCourse).then(res => { |
|
|
|
|
this.curriculumList = res.data; |
|
|
|
|
}).catch(err => { |
|
|
|
|
console.log(err); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
add() { |
|
|
|
|
this.$router.push("add"); |
|
|
|
|
}, |
|
|
|
|
edit(row) { |
|
|
|
|
this.$router.push(`add?id=${row.id}`); |
|
|
|
|
}, |
|
|
|
|
show(row) { |
|
|
|
|
this.$router.push(`/achievement/teach?id=${row.id}&projectName=${row.projectName}&permissions=1`) |
|
|
|
|
}, |
|
|
|
|
start(row) { |
|
|
|
|
this.$post(`${this.api.enableAssessment}?id=${row.id}`).then(res => { |
|
|
|
|
util.successMsg("启动成功!"); |
|
|
|
|
this.getData(1); |
|
|
|
|
}).catch(err => { |
|
|
|
|
console.log(err); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
finish(row) { |
|
|
|
|
this.$confirm("确定要提前结束吗?", "提示", { |
|
|
|
|
type: "warning" |
|
|
|
|
}).then(() => { |
|
|
|
|
let data = { |
|
|
|
|
id: row.id, |
|
|
|
|
endTime: util.formatDate("yyyy-MM-dd hh:mm:ss", new Date()), |
|
|
|
|
status: 2 |
|
|
|
|
}; |
|
|
|
|
this.$post(`${this.api.collectPaper}?id=${row.id}`).then(res => { |
|
|
|
|
util.successMsg("提前结束成功!"); |
|
|
|
|
this.getData(); |
|
|
|
|
}).catch(err => { |
|
|
|
|
console.log(err); |
|
|
|
|
}); |
|
|
|
|
}).catch(() => { |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
delData(row) { |
|
|
|
|
this.$confirm("确定要删除吗?", "提示", { |
|
|
|
|
type: "warning" |
|
|
|
|
}).then(() => { |
|
|
|
|
this.$post(this.api.deleteAssessment, [row.id]).then(res => { |
|
|
|
|
util.successMsg("删除成功"); |
|
|
|
|
this.getData(); |
|
|
|
|
}).catch(res => { |
|
|
|
|
}); |
|
|
|
|
}).catch(() => { |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
delAllData() { |
|
|
|
|
if (this.multipleSelection.length) { |
|
|
|
|
let ids = this.multipleSelection.map(item => { |
|
|
|
|
return item.id; |
|
|
|
|
}); |
|
|
|
|
this.$confirm("确定要删除吗?", "提示", { |
|
|
|
|
type: "warning" |
|
|
|
|
}).then(() => { |
|
|
|
|
|
|
|
|
|
this.$post(this.api.deleteAssessment, ids).then(res => { |
|
|
|
|
this.multipleSelection = []; |
|
|
|
|
this.$refs.table.clearSelection(); |
|
|
|
|
util.successMsg("删除成功"); |
|
|
|
|
this.getData(); |
|
|
|
|
}).catch(res => { |
|
|
|
|
}); |
|
|
|
|
if(this.multipleSelection.length === this.listData.length && this.pageNum>1) { |
|
|
|
|
this.handleCurrentChange(this.pageNum - 1) |
|
|
|
|
} |
|
|
|
|
}).catch(() => { |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
util.errorMsg("请先选择数据 !"); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
handleSelectionChange(val) { |
|
|
|
|
this.multipleSelection = val; |
|
|
|
|
}, |
|
|
|
|
handleCurrentChange(val) { |
|
|
|
|
this.pageNum = val |
|
|
|
|
this.$router.push(`list?page=${val}`) |
|
|
|
|
this.getData(); |
|
|
|
|
}, |
|
|
|
|
transferTime(date) { |
|
|
|
|
if (date == "0000-00-00 00:00:00" || !date) return "---"; |
|
|
|
|
return date; |
|
|
|
|
} |
|
|
|
|
}).catch(res => { |
|
|
|
|
}); |
|
|
|
|
if (this.multipleSelection.length === this.listData.length && this.pageNum > 1) { |
|
|
|
|
this.handleCurrentChange(this.pageNum - 1) |
|
|
|
|
} |
|
|
|
|
}).catch(() => { |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
util.errorMsg("请先选择数据 !"); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
handleSelectionChange (val) { |
|
|
|
|
this.multipleSelection = val; |
|
|
|
|
}, |
|
|
|
|
handleCurrentChange (val) { |
|
|
|
|
this.pageNum = val |
|
|
|
|
this.$router.push(`list?page=${val}`) |
|
|
|
|
this.getData(); |
|
|
|
|
}, |
|
|
|
|
transferTime (date) { |
|
|
|
|
if (date == "0000-00-00 00:00:00" || !date) return "---"; |
|
|
|
|
return date; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|