qa-prevention-gwj-vue/src/views/archives/semester/list.vue

161 lines
5.1 KiB
Vue
Raw Normal View History

2023-11-06 18:11:01 +08:00
<template>
<div class="app-container">
<el-form label-width="80px">
<el-row>
<el-col :span="4">
<el-form-item label="课程名称">
<el-input v-model="KEYWORDS" placeholder="请输入"/>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="开始时间">
<el-date-picker v-model="STARTTIME" value-format="yyyy-MM-dd" format="yyyy-MM-dd" type="date" placeholder="选择日期" style="width: 100%;" />
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="结束时间">
<el-date-picker v-model="ENDTIME" value-format="yyyy-MM-dd" format="yyyy-MM-dd" type="date" placeholder="选择日期" style="width: 100%;" />
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="状态">
<el-select v-model="STATUS" clearable placeholder="请选择" style="width: 100%;">
<el-option v-for="item in statusList" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label-width="10px">
<el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="getQuery">
搜索
</el-button>
<el-button v-waves class="filter-item" type="success" icon="el-icon-refresh" @click="goKeyReset">
重置
</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-table
v-loading="listLoading"
ref="multipleTable"
:data="varList"
:row-key="getRowKey"
:header-cell-style="{
'font-weight': 'bold',
'color': '#000'
}"
tooltip-effect="dark"
border
fit
highlight-current-row>
<el-table-column :reserve-selection="true" type="selection" width="55" align="center" />
<el-table-column type="index" label="序号" width="50" align="center" />
<el-table-column prop="STUDY_NAME" label="课程名称" />
<el-table-column prop="PEIXUE_START_TIME" label="开始时间" align="center" />
<el-table-column prop="PEIXUE_END_TIME" label="结束时间" align="center" />
<el-table-column prop="CURRICULUMUSERS" label="状态" align="center">
<template slot-scope="{row}">
{{ compareDate(row) }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="140">
<template slot-scope="{row}">
<el-button type="primary" icon="el-icon-edit" size="mini" @click="handleEdit(row.STUDYTASK_ID)"></el-button>
</template>
</el-table-column>
</el-table>
<div class="page-btn-group">
<div/>
<pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" />
</div>
</div>
</template>
<script>
import Pagination from '@/components/Pagination' // 通过 el-pagination二次打包
import { requestFN } from '@/utils/request'
import waves from '@/directive/waves' // waves directive
import dateformat from '@/utils/dateformat'
export default {
components: { Pagination },
directives: { waves },
data() {
return {
listLoading: true,
add: false,
del: false,
edit: false,
listQuery: {
page: 1,
limit: 20
},
total: 0,
config: config,
KEYWORDS: '',
LEARNERCATEGORY: '',
STARTTIME: '',
ENDTIME: '',
STATUS: '',
statusList: [{ value: 1, label: '未开始' }, { value: 2, label: '进行中' }, { value: 3, label: '已结束' }],
varList: []
}
},
created() {
this.getList()
},
methods: {
getRowKey(row) {
return row.STUDYTASK_ID
},
compareDate(row) {
if (row.PEIXUE_START_TIME > dateformat(new Date(), 'YYYY-MM-DD')) {
return '未开始'
} else if (row.PEIXUE_START_TIME <= dateformat(new Date(), 'YYYY-MM-DD') && row.PEIXUE_END_TIME >= dateformat(new Date(), 'YYYY-MM-DD')) {
return '进行中'
} else if (row.PEIXUE_END_TIME <= dateformat(new Date(), 'YYYY-MM-DD')) {
return '已结束'
}
},
// 搜索
getQuery() {
this.$refs.multipleTable.clearSelection()
this.getList()
},
goKeyReset() {
this.KEYWORDS = ''
this.STARTTIME = ''
this.ENDTIME = ''
this.STATUS = ''
this.getList()
},
// 获取列表
getList() {
this.listLoading = true
requestFN(
'/studytask/list?showCount=' + this.listQuery.limit + '&currentPage=' + this.listQuery.page,
{
KEYWORDS: this.KEYWORDS,
STARTTIME: this.STARTTIME,
ENDTIME: this.ENDTIME,
STATUS: this.STATUS
}
).then((data) => {
this.listLoading = false
this.varList = data.varList
this.total = data.page.totalResult
this.hasButton()
}).catch((e) => {
this.listLoading = false
})
},
// 修改
handleEdit(ID) {
this.$parent.STUDYTASK_ID = ID
this.$parent.activeName = 'Info'
}
}
}
</script>