You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

185 lines
5.8 KiB

<!-- 已上课记录 -->
<template>
<div>
<el-form ref="queryForm" :model="queryParams" :inline="true" label-width="68px">
<el-form-item label="上课时间" prop="claDateArray">
<el-date-picker
v-model="claDateArray"
clearable
size="small"
style="width: 230px"
type="daterange"
value-format="yyyy-MM-dd"
placeholder="选择上课时间进行查询"
/>
</el-form-item>
<el-form-item label="校区:" prop="deptId">
<dept-select v-model="queryParams.deptId" />
</el-form-item>
<el-form-item style="float: right">
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
</el-form-item>
</el-form>
<el-table
v-loading="loading"
:data="dataList"
@selection-change="handleSelectionChange"
border
:header-cell-style="{'text-align': 'center'}">
<el-table-column type="selection" width="55" align="center" />
<el-table-column align="center" width="180" prop="realClaDate" label="上课时间" fixed="left">
<template slot-scope="scope">
<span>{{ scope.row.realClaDate }} {{ scope.row.realStartTime.substr(0,5) }}~{{ scope.row.realEndTime.substr(0,5) }}</span>
</template>
</el-table-column>
<el-table-column align="center" width="180" prop="deptName" label="上课校区" />
<el-table-column align="center" width="180" prop="courseName" label="所属课程" />
<el-table-column align="center" width="180" prop="staffName" label="上课教练" />
<el-table-column align="center" width="180" prop="needAttendCnt" label="预约/实到">
<template slot-scope="scope">
<el-tooltip effect="dark" placement="top">
<template slot="content">
<div>
<div>到课: {{ scope.row.realAttendCnt }}人</div>
<div>预约: {{ scope.row.bookAttendCnt }}人</div>
</div>
</template>
<span>{{ scope.row.realAttendCnt }}/{{ scope.row.bookAttendCnt }}</span>
</el-tooltip>
</template>
</el-table-column>
<el-table-column align="center" width="180" prop="" label="课时消耗统计">
<template slot-scope="scope">
<span>{{ scope.row.payTotalHour }}</span>
</template>
</el-table-column>
<el-table-column align="center" width="180" prop="" label="学费消耗统计(元)">
<template slot-scope="scope">
<span> {{ scope.row.payTotalFee }} </span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" >
<template slot-scope="scope">
<el-button
v-hasPermi="['sc:claTime:update']"
size="mini"
type="text"
icon="el-icon-edit-outline"
@click="handleUpdate(scope.row)"
>详情</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<change-cla-time-attend ref="changeClaTimeAttend" :cla-id="chooseClaId" :course-time-id="chooseCourseTimeId" @success="getList" />
</div>
</template>
<script>
import { selectListForAttend } from '@/api/school/sc/cla/claTime'
import changeClaTimeAttend from '@/components/sc/claTime/changeClaTimeAttend'
import deptSelect from '@/components/system/dept/deptSelect'
import moment from 'moment'
export default {
components: {
deptSelect,
changeClaTimeAttend
},
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 总条数
total: 0,
// 表格树数据
dataList: [],
// 上课时间
claDateArray: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
attended: true
},
// 选择的上课记录
chooseCourseTimeId: undefined,
chooseClaId: undefined
}
},
watch: {
claDateArray: {
handler(newValue, oldValue) {
if (newValue && newValue.length === 2) {
this.handleQuery()
}
},
immediate: true
}
},
created() {
if (this.claDateArray.length === 0) {
this.claDateArray[0] = moment(new Date()).add(-7, 'days').format('YYYY-MM-DD')
this.claDateArray[1] = moment(new Date()).format('YYYY-MM-DD')
}
if (this.dataList.length === 0) {
this.handleQuery()
}
},
methods: {
getList() {
this.loading = true
selectListForAttend(this.queryParams).then(response => {
this.dataList = response.data.rows
this.total = response.data.total
this.loading = false
})
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
if (this.claDateArray !== undefined && this.claDateArray !== null && this.claDateArray.length === 2) {
this.queryParams.beginDate = this.claDateArray[0]
this.queryParams.endDate = this.claDateArray[1]
} else {
this.queryParams.beginDate = undefined
this.queryParams.endDate = undefined
}
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm')
this.handleQuery()
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.schoolId)
this.single = selection.length !== 1
this.multiple = !selection.length
},
handleUpdate(row) {
this.chooseCourseTimeId = row.courseTimeId
this.chooseClaId = row.claId
this.$refs.changeClaTimeAttend.open = true
},
}
}
</script>