2024-02-25 11:17:48 +08:00
|
|
|
|
<template>
|
|
|
|
|
<a-modal
|
2024-03-20 16:19:27 +08:00
|
|
|
|
title='操作'
|
|
|
|
|
style='top: 20px;'
|
|
|
|
|
:width='800'
|
|
|
|
|
v-model='visible'
|
|
|
|
|
:confirmLoading='confirmLoading'
|
|
|
|
|
@ok='handleSubmit'
|
2024-02-25 11:17:48 +08:00
|
|
|
|
>
|
2024-03-20 16:19:27 +08:00
|
|
|
|
<a-form :form='form'>
|
|
|
|
|
<a-form-item style='display:none'>
|
|
|
|
|
<a-input v-decorator="['id']" />
|
2024-02-25 11:17:48 +08:00
|
|
|
|
</a-form-item>
|
2024-03-20 16:19:27 +08:00
|
|
|
|
<a-form-item style='display:none'>
|
|
|
|
|
<a-input v-decorator="['version']" />
|
2024-02-25 11:17:48 +08:00
|
|
|
|
</a-form-item>
|
2024-03-20 16:19:27 +08:00
|
|
|
|
<a-form-item :labelCol='labelCol' :wrapperCol='wrapperCol' label='主题'>
|
|
|
|
|
<a-input placeholder='主题' v-decorator="['title', {rules: [{required: true, message: '请输入主题'}]}]" />
|
2024-02-25 11:17:48 +08:00
|
|
|
|
</a-form-item>
|
2024-03-19 16:20:52 +08:00
|
|
|
|
<a-form-item :labelCol='labelCol' :wrapperCol='wrapperCol' label='开始时间'>
|
2024-03-20 16:19:27 +08:00
|
|
|
|
<!-- <a-input placeholder='开始时间' v-decorator="['startTime']" />-->
|
2024-03-19 16:20:52 +08:00
|
|
|
|
<a-date-picker
|
|
|
|
|
:ranges="{ Today: [moment(), moment()], 'This Month': [moment(), moment().endOf('month')] }"
|
|
|
|
|
show-time
|
2024-03-20 16:19:27 +08:00
|
|
|
|
format='YYYY-MM-DD HH:mm'
|
|
|
|
|
valueFormat='YYYY-MM-DD HH:mm:ss'
|
|
|
|
|
v-decorator="['startTime', {rules: [{required: true, message: '请选择开始时间'}]}]"
|
|
|
|
|
placeholder='开始时间' />
|
2024-02-25 11:17:48 +08:00
|
|
|
|
</a-form-item>
|
2024-03-19 16:20:52 +08:00
|
|
|
|
<a-form-item :labelCol='labelCol' :wrapperCol='wrapperCol' label='结束时间'>
|
|
|
|
|
<a-date-picker
|
|
|
|
|
:ranges="{ Today: [moment(), moment()], 'This Month': [moment(), moment().endOf('month')] }"
|
|
|
|
|
show-time
|
2024-03-20 16:19:27 +08:00
|
|
|
|
format='YYYY-MM-DD HH:mm'
|
|
|
|
|
valueFormat='YYYY-MM-DD HH:mm:ss'
|
|
|
|
|
v-decorator="['endDate', {rules: [{required: true, message: '请选择结束时间'}]}]"
|
|
|
|
|
placeholder='结束时间' />
|
2024-02-25 11:17:48 +08:00
|
|
|
|
</a-form-item>
|
2024-04-04 15:12:46 +08:00
|
|
|
|
|
|
|
|
|
<a-form-item :labelCol='labelCol' :wrapperCol='wrapperCol' label='所属地区'>
|
|
|
|
|
<a-select v-decorator="['tenantId', {rules: [{ required: true, message: '请选择所属地区' }]}]"
|
|
|
|
|
@change='selectTenant'
|
|
|
|
|
:disabled='tenantEnable'>
|
|
|
|
|
<a-select-option v-for='item in tenantList' :key='item.id'>{{ item.name }}</a-select-option>
|
|
|
|
|
</a-select>
|
|
|
|
|
</a-form-item>
|
|
|
|
|
<a-form-item :labelCol='labelCol' :wrapperCol='wrapperCol' label='所属园区'>
|
|
|
|
|
<a-select v-decorator="['parkId', {rules: [{ required: true, message: '请选择所属园区' }]}]"
|
|
|
|
|
@change='selectPark'
|
|
|
|
|
:disabled='parkEnable'>
|
|
|
|
|
<a-select-option v-for='item in parkList' :key='item.id'>{{ item.name }}</a-select-option>
|
|
|
|
|
</a-select>
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
|
|
|
|
<a-form-item :labelCol='labelCol' :wrapperCol='wrapperCol' label='所属楼宇'>
|
|
|
|
|
<a-select v-decorator="['buildingId', {rules: [{ required: true, message: '请选择所属楼宇' }]}]"
|
|
|
|
|
@change='selectBuilding'>
|
|
|
|
|
<a-select-option v-for='item in buildingList' :key='item.id'>{{ item.buildingName }}</a-select-option>
|
|
|
|
|
</a-select>
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
2024-03-20 16:19:27 +08:00
|
|
|
|
<a-form-item :labelCol='labelCol' :wrapperCol='wrapperCol' label='会议室'>
|
|
|
|
|
<a-select v-decorator="['roomContentId',{rules: [{ required: true, message: '请选择会议室' }]}]"
|
|
|
|
|
placeholder='请选择会议室'>
|
|
|
|
|
<a-select-option v-for='item in roomContentList' :key='item.id' :value='item.id'>
|
|
|
|
|
{{ item.meetingName }}
|
|
|
|
|
</a-select-option>
|
|
|
|
|
</a-select>
|
2024-02-25 11:17:48 +08:00
|
|
|
|
</a-form-item>
|
2024-03-20 16:19:27 +08:00
|
|
|
|
<a-form-item :labelCol='labelCol' :wrapperCol='wrapperCol' label='备注'>
|
2024-03-26 11:13:45 +08:00
|
|
|
|
<a-input placeholder='备注' v-decorator="['remake']" />
|
2024-02-25 11:17:48 +08:00
|
|
|
|
</a-form-item>
|
|
|
|
|
</a-form>
|
|
|
|
|
</a-modal>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
2024-03-20 16:19:27 +08:00
|
|
|
|
import { saveReservation, get, roomContentList } from '@/api/admin/meeting/reservation'
|
|
|
|
|
import pick from 'lodash.pick'
|
|
|
|
|
import moment from 'moment'
|
|
|
|
|
import { selectRoomById } from '@/api/admin/meeting/roomContent'
|
2024-04-04 15:12:46 +08:00
|
|
|
|
import { getInfo } from '@/api/login'
|
|
|
|
|
import { getTenantList } from '@/api/tenant'
|
|
|
|
|
import { getParkList } from '@/api/admin/park'
|
|
|
|
|
import { getBuildingList } from '@/api/admin/building'
|
|
|
|
|
import { getBuildingDetailList } from '@/api/admin/buildingDetail'
|
2024-02-25 11:17:48 +08:00
|
|
|
|
|
2024-03-20 16:19:27 +08:00
|
|
|
|
export default {
|
2024-02-25 11:17:48 +08:00
|
|
|
|
name: 'ReservationModal',
|
2024-03-20 16:19:27 +08:00
|
|
|
|
props: {},
|
|
|
|
|
components: {},
|
|
|
|
|
data() {
|
2024-02-25 11:17:48 +08:00
|
|
|
|
return {
|
|
|
|
|
visible: false,
|
|
|
|
|
labelCol: {
|
|
|
|
|
xs: { span: 24 },
|
|
|
|
|
sm: { span: 5 }
|
|
|
|
|
},
|
|
|
|
|
wrapperCol: {
|
|
|
|
|
xs: { span: 24 },
|
|
|
|
|
sm: { span: 16 }
|
|
|
|
|
},
|
|
|
|
|
confirmLoading: false,
|
|
|
|
|
mdl: {},
|
2024-03-20 16:19:27 +08:00
|
|
|
|
form: this.$form.createForm(this),
|
2024-04-04 15:12:46 +08:00
|
|
|
|
tenantList: [], // 地区
|
|
|
|
|
parkList: [], // 园区
|
|
|
|
|
buildingList: [], // 楼宇
|
|
|
|
|
roomContentList: [], // 会议室
|
|
|
|
|
tenantEnable: false,
|
|
|
|
|
parkEnable: false
|
2024-02-25 11:17:48 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
2024-03-20 16:19:27 +08:00
|
|
|
|
beforeCreate() {
|
2024-02-25 11:17:48 +08:00
|
|
|
|
},
|
2024-03-20 16:19:27 +08:00
|
|
|
|
created() {
|
2024-04-04 15:12:46 +08:00
|
|
|
|
// 查询地区
|
|
|
|
|
this.getTenantData()
|
2024-02-25 11:17:48 +08:00
|
|
|
|
},
|
|
|
|
|
methods: {
|
2024-04-04 15:12:46 +08:00
|
|
|
|
// 获取用户详细信息
|
|
|
|
|
getUserDetail() {
|
|
|
|
|
getInfo().then(res => {
|
|
|
|
|
console.log('getUserDetail', res)
|
|
|
|
|
this.userDetail = res
|
|
|
|
|
// 园区:5
|
|
|
|
|
if (this.userDetail.roleIds && this.userDetail.roleIds.length > 0 && this.userDetail.roleIds[0] == 5) {
|
|
|
|
|
//
|
|
|
|
|
// 判断:是新增就查询园区
|
|
|
|
|
let { id } = this.mdl
|
|
|
|
|
if (!id) {
|
|
|
|
|
// 选择地区 -> 查询园区
|
|
|
|
|
this.selectTenant(this.userDetail.tenantId)
|
|
|
|
|
// 选择园区 -> 查询楼宇
|
|
|
|
|
this.selectPark(this.userDetail.parkId)
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
// 不可编辑
|
|
|
|
|
this.tenantEnable = true
|
|
|
|
|
this.parkEnable = true
|
|
|
|
|
// 关联地区和园区
|
|
|
|
|
this.mdl.parkId = this.userDetail.parkId
|
|
|
|
|
this.mdl.tenantId = this.userDetail.tenantId
|
|
|
|
|
this.form.setFieldsValue({
|
|
|
|
|
parkId: this.mdl.parkId,
|
|
|
|
|
tenantId: this.mdl.tenantId
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 查询地区
|
|
|
|
|
getTenantData() {
|
|
|
|
|
getTenantList().then(res => {
|
|
|
|
|
this.tenantList = res.rows
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 选择地区 -> 查询园区
|
|
|
|
|
selectTenant(id) {
|
|
|
|
|
console.log('selectTenant', id)
|
|
|
|
|
// 清空数据
|
|
|
|
|
this.mdl.parkId = null // 园区
|
|
|
|
|
this.mdl.buildingId = null // 楼宇
|
|
|
|
|
this.mdl.roomContentId = null // 会议室
|
|
|
|
|
|
|
|
|
|
this.form.setFieldsValue({
|
|
|
|
|
parkId: null, // 园区
|
|
|
|
|
buildingId: null, // 楼宇
|
|
|
|
|
roomContentId: null // 会议室
|
|
|
|
|
})
|
|
|
|
|
// 查询园区
|
|
|
|
|
getParkList({
|
|
|
|
|
tenantId: id
|
|
|
|
|
}).then(res => {
|
|
|
|
|
this.parkList = res.rows
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 选择园区 -> 查询楼宇
|
|
|
|
|
selectPark(id) {
|
|
|
|
|
// 清空数据
|
|
|
|
|
this.mdl.buildingId = null // 楼宇
|
|
|
|
|
this.mdl.roomContentId = null // 会议室
|
2024-03-19 16:20:52 +08:00
|
|
|
|
|
2024-04-04 15:12:46 +08:00
|
|
|
|
this.form.setFieldsValue({
|
|
|
|
|
buildingId: null, // 楼宇
|
|
|
|
|
roomContentId: null // 会议室
|
|
|
|
|
})
|
|
|
|
|
// 查询楼宇
|
|
|
|
|
getBuildingList({
|
|
|
|
|
parkId: id
|
|
|
|
|
}).then(res => {
|
|
|
|
|
this.buildingList = res.rows
|
|
|
|
|
})
|
2024-03-19 16:20:52 +08:00
|
|
|
|
},
|
2024-04-04 15:12:46 +08:00
|
|
|
|
// 选择楼宇 -> 查询会议室
|
|
|
|
|
selectBuilding(id) {
|
|
|
|
|
// 清空数据
|
|
|
|
|
this.mdl.roomContentId = null // 会议室
|
|
|
|
|
|
|
|
|
|
this.form.setFieldsValue({
|
|
|
|
|
roomContentId: null // 会议室
|
|
|
|
|
})
|
|
|
|
|
roomContentList({
|
|
|
|
|
buildingId: id
|
|
|
|
|
}).then(res => {
|
2024-03-20 16:19:27 +08:00
|
|
|
|
console.log('roomContentList', res)
|
|
|
|
|
this.roomContentList = res.data
|
|
|
|
|
})
|
2024-04-04 15:12:46 +08:00
|
|
|
|
},
|
|
|
|
|
moment,
|
|
|
|
|
onRangeChangeSign() {
|
|
|
|
|
|
2024-03-20 16:19:27 +08:00
|
|
|
|
},
|
|
|
|
|
add() {
|
2024-02-25 11:17:48 +08:00
|
|
|
|
this.form.resetFields()
|
|
|
|
|
this.edit({ id: 0 })
|
|
|
|
|
},
|
2024-03-20 16:19:27 +08:00
|
|
|
|
edit(record) {
|
2024-04-04 15:12:46 +08:00
|
|
|
|
this.mdl = Object.assign(this.mdl, record)
|
|
|
|
|
let copyMdl = JSON.parse(JSON.stringify(this.mdl))
|
|
|
|
|
//
|
|
|
|
|
if (record.id != 0) { // 编辑
|
|
|
|
|
// 选择地区 -> 查询园区
|
|
|
|
|
if (copyMdl.tenantId) {
|
|
|
|
|
this.mdl = JSON.parse(JSON.stringify(copyMdl))
|
|
|
|
|
this.selectTenant(copyMdl.tenantId)
|
|
|
|
|
}
|
|
|
|
|
// 选择园区 -> 查询楼宇
|
|
|
|
|
if (copyMdl.parkId) {
|
|
|
|
|
this.mdl = JSON.parse(JSON.stringify(copyMdl))
|
|
|
|
|
this.selectPark(copyMdl.parkId)
|
|
|
|
|
}
|
|
|
|
|
// 选择楼宇 -> 查询会议室
|
|
|
|
|
if (copyMdl.buildingId) {
|
|
|
|
|
this.mdl = JSON.parse(JSON.stringify(copyMdl))
|
|
|
|
|
this.selectBuilding(copyMdl.buildingId)
|
|
|
|
|
}
|
|
|
|
|
// 防止替换
|
|
|
|
|
this.mdl = JSON.parse(JSON.stringify(copyMdl))
|
|
|
|
|
|
|
|
|
|
} else { // 新增
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// 获取用户详细信息
|
|
|
|
|
this.getUserDetail()
|
|
|
|
|
|
2024-02-25 11:17:48 +08:00
|
|
|
|
this.visible = true
|
|
|
|
|
this.$nextTick(() => {
|
2024-04-04 15:12:46 +08:00
|
|
|
|
this.form.setFieldsValue(pick(this.mdl, 'id', 'tenantId', 'parkId', 'buildingId', 'roomContentId', 'userId', 'ticketId', 'customerId',
|
|
|
|
|
'title', 'stauts', 'isAfterSale', 'oderNumber', 'orderMoney', 'cancelTime', 'cancelResaon',
|
|
|
|
|
'visitType', 'explainNeedType', 'meetingNeedType', 'meetingId', 'photographType',
|
|
|
|
|
'startTime', 'endTime', 'endDate', 'deleteFlag', 'createBy', 'createTime', 'updateBy', 'updateTime', 'remake'))
|
2024-02-25 11:17:48 +08:00
|
|
|
|
})
|
2024-03-19 16:20:52 +08:00
|
|
|
|
|
2024-04-01 18:09:33 +08:00
|
|
|
|
|
2024-02-25 11:17:48 +08:00
|
|
|
|
},
|
2024-03-20 16:19:27 +08:00
|
|
|
|
handleSubmit(e) {
|
2024-02-25 11:17:48 +08:00
|
|
|
|
e.preventDefault()
|
|
|
|
|
this.form.validateFields((err, values) => {
|
|
|
|
|
if (!err) {
|
|
|
|
|
console.log('Received values of form: ', values)
|
|
|
|
|
this.confirmLoading = true
|
|
|
|
|
saveReservation(values).then(res => {
|
|
|
|
|
if (res.code === 0) {
|
|
|
|
|
this.$message.success('保存成功')
|
|
|
|
|
this.$emit('ok')
|
|
|
|
|
this.visible = false
|
|
|
|
|
} else {
|
|
|
|
|
this.$message.error(res.msg)
|
|
|
|
|
}
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
this.$message.error('系统错误,请稍后再试')
|
|
|
|
|
}).finally(() => {
|
|
|
|
|
this.confirmLoading = false
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
/*
|
|
|
|
|
'selectedRows': function (selectedRows) {
|
|
|
|
|
this.needTotalList = this.needTotalList.map(item => {
|
|
|
|
|
return {
|
|
|
|
|
...item,
|
|
|
|
|
total: selectedRows.reduce( (sum, val) => {
|
|
|
|
|
return sum + val[item.dataIndex]
|
|
|
|
|
}, 0)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|