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.

151 lines
4.3 KiB

1 year ago
<template>
<div>
<div>
<div ref="lxHeader">
<lx-header icon="md-apps" :text="$route.meta.title" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
<div slot="content">
<div class="searchwrap" style="display: flex;align-items: center;">
<div>
<div>
<el-input v-model="select.name" placeholder="请输入姓名"></el-input>
</div>
</div>
<div>
<el-button type="primary" size="small" @click="getList"></el-button>
</div>
</div>
</div>
</lx-header>
</div>
</div>
<div>
<xy-table :list="list" @pageIndexChange="pageIndexChange" @pageSizeChange="pageSizeChange" :total="total"
:table-item="table_item">
<template v-slot:appointments_count>
<el-table-column align='center' label="已预约次数" header-align="center">
<template slot-scope="scope">
<div @click="showCounts(scope.row.name)" v-if="scope.row.appointments_count>0"
style="color:#0077CC;text-decoration: underline;cursor: pointer;">{{scope.row.appointments_count}}</div>
<div v-else>{{scope.row.appointments_count}}</div>
</template>
</el-table-column>
</template>
<template v-slot:appointments_can>
<el-table-column align='center' label="预约剩余次数" header-align="center">
<template slot-scope="scope">
<div>
{{scope.row.appointment_total - scope.row.appointments_count>0?scope.row.appointment_total - scope.row.appointments_count:0}}
</div>
</template>
</el-table-column>
</template>
<template v-slot:btns>
<el-table-column align='center' label="操作" fixed="right" width="80" header-align="center">
<template slot-scope="scope">
<el-button type="primary" size="small" @click="editCount(scope.row)"></el-button>
</template>
</el-table-column>
</template>
</xy-table>
</div>
<addCount ref="addCount" @refresh="getList"></addCount>
<showCount ref="showCount"></showCount>
</div>
</template>
<script>
import addCount from './components/addCount.vue';
import showCount from './components/showCount.vue';
import {
indexStudy
} from '@/api/student/index.js'
export default {
components: {
addCount,
showCount
},
data() {
return {
select: {
name: '',
page: 1,
page_size: 10,
},
list: [],
total:0,
table_item: [{
prop: 'name',
label: '预约人',
align: 'center',
}, {
prop: 'appointment_total',
label: '可预约总数',
align: 'center',
}, {
prop: 'appointments_count',
label: '已预约次数',
align: 'center',
}, {
prop: 'appointments_can',
label: '预约剩余次数',
align: 'center',
}]
}
},
created() {
this.getList()
},
methods: {
pageIndexChange(e) {
this.select.page = e
this.getList()
},
pageSizeChange(e) {
this.select.page_size = e
this.select.page = 1
this.getList()
},
async getList() {
const res = await indexStudy({
page: this.select.page,
page_size: this.select.page_size,
name: this.select.name,
courses_ing: 1
})
this.list = res.list.data
this.total = res.list.total
},
editCount(row) {
this.$refs.addCount.setRow(row)
this.$refs.addCount.isShow = true
},
showCounts(name) {
this.$refs.showCount.setName(name)
this.$refs.showCount.isShow = true
},
}
}
</script>
<style lang="scss" scoped>
.searchwrap {
display: flex;
align-items: center;
&>div {
display: flex;
align-items: center;
&>div {
margin-right: 10px;
}
}
}
</style>