dev
parent
c9ff8138e0
commit
bc3fee3ba0
@ -0,0 +1,59 @@
|
||||
import request from "@/utils/request";
|
||||
function customParamsSerializer(params) {
|
||||
let result = '';
|
||||
for (let key in params) {
|
||||
if (params.hasOwnProperty(key)) {
|
||||
if (Array.isArray(params[key])) {
|
||||
params[key].forEach((item,index) => {
|
||||
if(item.key){
|
||||
result += `${key}[${index}][key]=${item.key}&${key}[${index}][op]=${item.op}&${key}[${index}][value]=${item.value}&`;
|
||||
|
||||
}else{
|
||||
result +=`${key}[${index}]=${item}&`
|
||||
}
|
||||
});
|
||||
} else {
|
||||
result += `${key}=${params[key]}&`;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.slice(0, -1);
|
||||
}
|
||||
|
||||
export function index(params,isLoading = false) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/api/admin/appointment-configs/index",
|
||||
params,
|
||||
paramsSerializer: customParamsSerializer,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
|
||||
export function show(params, isLoading = true) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/api/admin/appointment-configs/show",
|
||||
params,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
|
||||
export function save(data) {
|
||||
return request({
|
||||
method: "post",
|
||||
url: "/api/admin/appointment-configs/save",
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function destroy(params) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/api/admin/appointment-configs/destroy",
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,171 @@
|
||||
<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>
|
||||
<el-input v-model="select.name" placeholder="请输入场地名称"></el-input>
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="primary" size="small" @click="getList">查询</el-button>
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="primary" size="small" @click="editAppointment('add')">新增</el-button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</lx-header>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<xy-table :list="list" :total="total" @pageIndexChange="pageIndexChange" @pageSizeChange="pageSizeChange"
|
||||
:table-item="table_item">
|
||||
<template v-slot:status>
|
||||
<el-table-column align='center' label="状态" width="120" header-align="center">
|
||||
<template slot-scope="scope">
|
||||
<div v-for="item in types_status">
|
||||
<el-tag :type="item.type" v-if="scope.row.status===item.id">{{item.value}}</el-tag>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
<template v-slot:btns>
|
||||
<el-table-column align='center' label="操作" width="180" header-align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="primary" size="small" @click="editAppointment('editor',scope.row.id)">编辑</el-button>
|
||||
<el-popconfirm style="margin:0 10px" @confirm="deleteList(scope.row.id)" title="确定删除吗?">
|
||||
<el-button type="danger" size="small" slot="reference">删除</el-button>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
</xy-table>
|
||||
</div>
|
||||
|
||||
<addAppointment ref="addAppointment" @refresh="getList"></addAppointment>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import myMixins from "@/mixin/selectMixin.js";
|
||||
import addAppointment from './components/addAppointment.vue';
|
||||
import {
|
||||
index,
|
||||
destroy
|
||||
} from "@/api/book/appointment.js"
|
||||
export default {
|
||||
mixins: [myMixins],
|
||||
components: {
|
||||
addAppointment
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
select: {
|
||||
name: '',
|
||||
page: 1,
|
||||
page_size: 10,
|
||||
},
|
||||
list: [],
|
||||
total: 0,
|
||||
table_item: [{
|
||||
prop: 'no',
|
||||
label: '编号',
|
||||
align: 'center',
|
||||
width: 120,
|
||||
},{
|
||||
prop: 'name',
|
||||
label: '场地名称',
|
||||
align: 'left',
|
||||
width: 120,
|
||||
}, {
|
||||
prop: 'content',
|
||||
label: '场地简介',
|
||||
align: 'center'
|
||||
}, {
|
||||
prop: 'total',
|
||||
label: '场地容纳人数',
|
||||
align: 'center',
|
||||
width: 120,
|
||||
}, {
|
||||
prop: 'status',
|
||||
label: '状态',
|
||||
align: 'center',
|
||||
width: 120,
|
||||
}]
|
||||
|
||||
}
|
||||
},
|
||||
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 index({
|
||||
page: this.select.page,
|
||||
page_size: this.select.page_size,
|
||||
filter: [{
|
||||
key: 'name',
|
||||
op: 'like',
|
||||
value: this.select.name
|
||||
}]
|
||||
})
|
||||
this.list = res.data
|
||||
this.total = res.total
|
||||
},
|
||||
|
||||
editAppointment(type, id) {
|
||||
if (id) {
|
||||
this.$refs.addAppointment.id = id
|
||||
}
|
||||
|
||||
this.$refs.addAppointment.type = type
|
||||
this.$refs.addAppointment.isShow = true
|
||||
},
|
||||
deleteList(id) {
|
||||
var that = this;
|
||||
destroy({
|
||||
id: id,
|
||||
}).then(response => {
|
||||
this.$Message.success('删除成功');
|
||||
this.getList()
|
||||
}).catch(error => {
|
||||
console.log(error)
|
||||
reject(error)
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.searchwrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
&>div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-right: 10px;
|
||||
|
||||
span {
|
||||
min-width: 70px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,150 @@
|
||||
<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>
|
||||
Loading…
Reference in new issue