master
lion 1 year ago
parent 7663fc6e5a
commit 8419eaa6e0

@ -22,9 +22,9 @@
<span style="color: red;font-weight: bold;padding-right: 4px;">*</span>{{type==='more'?'无需预约人':'预约人'}}
</div>
<div class="xy-table-item-content">
<div v-if="type==='editor'">
<span v-if="type==='editor'">
{{form.name}}
</div>
</span>
<el-select v-else v-model="form.user_id" @change="changeUser" style="width:100%"
:multiple="type==='more'?true:false" filterable remote reserve-keyword
:placeholder="type==='more'?'请选择无需预约的学员,不选则全部预约':'请选择学员或查找学员'"
@ -45,7 +45,7 @@
</div>
</div>
</template>
<template v-slot:mobile v-if="type==='add'">
<template v-slot:mobile v-if="type!='more'">
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;">*</span>联系方式
@ -93,7 +93,7 @@
</div>
</div>
</template>
<template v-slot:content v-if="type==='add'">
<template v-slot:content v-if="type!='more'">
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>预约事项
@ -103,7 +103,7 @@
</div>
</div>
</template>
<template v-slot:plate>
<template v-slot:plate v-if="type!='more'">
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>车牌
@ -113,16 +113,48 @@
</div>
</div>
</template>
<template v-slot:accompany_total v-if="type==='add'">
<template v-slot:accompany_total v-if="type!='more'">
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>同行人数
</div>
<div class="xy-table-item-content">
<el-input v-model="form.accompany_total" type="number" placeholder="请输入同行人数" clearable
<el-input v-model="form.accompany_total" :disabled="type==='editor'" type="number" placeholder="请输入同行人数" clearable
style="width: 100%;"></el-input>
</div>
</div>
</template>
<template v-slot:accompany v-if="type!='more'">
<div>
陪同人<Button v-if="type==='add'" type="primary" @click="accompanyList.push({name:'',mobile:''})"></Button>
</div>
<div>
<xy-table style="width:800px;max-width:800px;height:300px" :list="accompanyList" :isPage="false" :table-item="accompany_item">
<template v-slot:name>
<el-table-column align='center' label="姓名" width="300" header-align="center">
<template slot-scope="scope">
<el-input :disabled="type==='editor'" v-model="scope.row.name"></el-input>
</template>
</el-table-column>
</template>
<template v-slot:mobile>
<el-table-column align='center' label="联系方式" width="300" header-align="center">
<template slot-scope="scope">
<el-input :disabled="type==='editor'" v-model="scope.row.mobile"></el-input>
</template>
</el-table-column>
</template>
<template v-slot:btns>
<el-table-column align='center' label="操作" width="200" header-align="center">
<template slot-scope="scope">
<el-popconfirm v-if="type==='add'" style="margin-left:10px" @confirm="accompanyList.splice(scope.$index,1)" title="确定删除吗?">
<el-button type="danger" size="small" slot="reference">删除</el-button>
</el-popconfirm>
</template>
</el-table-column>
</template>
</xy-table>
</div>
</template>
<!-- <template v-slot:footerContent>
@ -160,7 +192,15 @@
type: 'add',
typeName: '手动预约',
id: '',
siteData:[],
siteData:[],
accompanyList:[],
accompany_item:[{
prop:'name',
label: '姓名',
},{
prop:'mobile',
label: '联系方式',
}],
form: {
course_id: '',
user_id: '',
@ -173,7 +213,8 @@
content: '',
site: '',
plate: '',
accompany_total: 0,
accompany_total: 0,
accompany:[],
status: 1,
reason: ''
},
@ -240,44 +281,75 @@
return sign1.isBefore(date1)
},
submit(status) {
this.form.status = 1
console.log(this.form)
this.form.status = 1
if(this.compareTime(this.form.start_time)){
this.$Message.warning('预约开始时间不能早于当前时间')
return
}
if (this.type === 'add') {
if (this.base.isNull(this.form.user_id) && this.base.isNull(this.form.name)) {
this.$Message.warning('请选择学员或输入预约人姓名')
return
}
}
}
if (this.type === 'more') {
console.log("this.form.user_id",this.form.user_id)
let _arr = []
if (this.base.isNull(this.form.user_id)) {
this.allUser.map(item => {
_arr.push(item.id)
})
} else {
console.log("this.form.user_id",this.form.user_id)
let _arr = []
if (this.base.isNull(this.form.user_id)) {
this.allUser.map(item => {
_arr.push(item.id)
})
} else {
let _filterarr = this.allUser.filter(item => !this.form.user_id.includes(item.id))
console.log("_filterarr",_filterarr)
console.log("_filterarr",_filterarr)
_filterarr.map(item => {
_arr.push(item.id)
})
}
})
}
console.log("_arr", _arr)
if(_arr.length===0){
this.$Message.warning('当前没有筛选出学员')
return
}
this.form.user_id = _arr.join(",")
}
this.form.user_id = _arr.join(",")
}
if (this.type === 'add') {
if (this.base.isNull(this.form.user_id) && this.base.isNull(this.form.name)) {
this.$Message.warning('请选择学员或输入预约人姓名')
return
}
}
// return
if (this.type === "editor") {
this.form.status = 0
}
}
console.log("accompanyList",this.accompanyList)
if(this.type==='add' || this.type==='editor'){
if(this.accompanyList.length>0){
var nullCount = 0
var errMobile = 0
this.form.accompany_total = this.accompanyList.length
this.accompanyList.map(item=>{
if(this.base.isNull(item.name) || this.base.isNull(item.mobile)){
nullCount++
}
if(!this.base.isNull(item.mobile) && !this.base.isPhone(item.mobile)){
errMobile++
}
})
console.log("nullCount",nullCount,errMobile)
if(nullCount>0){
this.$Message.warning("陪同人姓名或联系方式不能为空")
return
}
if(errMobile>0){
this.$Message.warning("陪同人联系方式不正确")
return
}
this.form.accompany = this.accompanyList
}else{
this.form.accompany = []
this.form.accompany_total = 0
}
}
// return
save(this.form).then(res => {
if (res.success < res.total) {
this.$Message.warning(res.err.join("。"))
@ -304,7 +376,7 @@
this.siteData.push(parseInt(item))
})
this.form.timeRange = [res.start_time, res.end_time]
this.accompanyList = res.appointment_accompany
})
},
formatHH(val) {
@ -355,6 +427,7 @@
page_size: 300,
name: query,
course_id: this.form.course_id,
status:1
})
this.user_options = res.list.data
if(res.list.data===0){
@ -367,7 +440,8 @@
page: 1,
page_size: 300,
name: query,
course_id: this.form.course_id,
course_id: this.form.course_id,
status:1
})
this.user_options = res.list.data
this.allUser = res.list.data
@ -428,6 +502,7 @@
this.typeName = '手动预约'
this.course_id = ''
this.siteData = []
this.accompanyList = []
this.form = {
course_id: '',
user_id: '',
@ -441,6 +516,7 @@
site: '',
plate: '',
accompany_total: 0,
accompany:[],
status: 1,
reason: ''
}
@ -452,7 +528,11 @@
}
</script>
<style scoped lang="scss">
<style scoped lang="scss">
::v-deep .accompany{
flex-basis: 100%;
padding:0 60px;
}
.bookInfo {
&>div {
span {

Loading…
Cancel
Save