描述:展厅管理增加 地区、园区、楼宇、楼层

This commit is contained in:
SelfRidicule 2024-04-04 16:49:54 +08:00
parent 22aced73cd
commit b50b1f32f3
2 changed files with 241 additions and 63 deletions

View File

@ -334,8 +334,7 @@ export default {
parkList: [], // parkList: [], //
buildingList: [], // buildingList: [], //
buildingDetailList: [], // buildingDetailList: [], //
floorList: [], roomList: [], //
roomList: [],
tenantEnable: false, tenantEnable: false,
parkEnable: false parkEnable: false
} }

View File

@ -2,7 +2,7 @@
<a-modal <a-modal
title='操作' title='操作'
style='top: 20px;' style='top: 20px;'
:width='1000' :width='1200'
v-model='visible' v-model='visible'
:confirmLoading='confirmLoading' :confirmLoading='confirmLoading'
@ok='handleSubmit' @ok='handleSubmit'
@ -14,53 +14,79 @@
<a-form-item style='display:none'> <a-form-item style='display:none'>
<a-input v-decorator="['version']" /> <a-input v-decorator="['version']" />
</a-form-item> </a-form-item>
<a-row> <a-row>
<a-col :span='10'> <a-col :span='10'>
<a-form-item :labelCol='labelCol' :wrapperCol='wrapperCol' label='所属建筑'> <a-form-item :labelCol='labelCol' :wrapperCol='wrapperCol' label='所属地区'>
<a-input placeholder='所属建筑' v-decorator="['build']" disabled='disabled' defaultValue='创智大厦' /> <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>
</a-col> </a-col>
<a-col :span='10'> <a-col :span='10'>
<a-form-item label='展厅名称' :labelCol='labelCol' :wrapperCol='wrapperCol'> <a-form-item :labelCol='labelCol' :wrapperCol='wrapperCol' label='所属园区'>
<a-input placeholder='展厅名称' <a-select v-decorator="['parkId', {rules: [{ required: true, message: '请选择所属园区' }]}]"
v-decorator="['meetingName',{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>
</a-col> </a-col>
</a-row> </a-row>
<a-row> <a-row>
<a-col :span='10'>
<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>
</a-col>
<a-col :span='10'> <a-col :span='10'>
<a-form-item :labelCol='labelCol' :wrapperCol='wrapperCol' label='所属楼层'> <a-form-item :labelCol='labelCol' :wrapperCol='wrapperCol' label='所属楼层'>
<a-select v-decorator="['buildId',{rules: [{ required: true, message: '请选择所属楼层' }]}]" <a-select v-decorator="['buildId',{rules: [{ required: true, message: '请选择所属楼层' }]}]"
placeholder='所属楼层' placeholder='所属楼层'
@change='getRoomList'> @change='selectBuildingDetail'>
<a-select-option v-for='item in floorList' :key='item.id' :value='item.id'> <a-select-option v-for='item in buildingDetailList' :key='item.id' :value='item.id'>
{{ item.floorName }} {{ item.floorName }}
</a-select-option> </a-select-option>
</a-select> </a-select>
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row>
<a-row>
<a-col :span='10'> <a-col :span='10'>
<a-form-item :labelCol='labelCol' :wrapperCol='wrapperCol' label='所属房间'> <a-form-item :labelCol='labelCol' :wrapperCol='wrapperCol' label='所属房间'>
<a-select v-decorator="['roomId',{rules: [{ required: true, message: '选择所属房间' }]}]" <a-select v-decorator="['roomId',{rules: [{ required: true, message: '选择所属房间' }]}]"
placeholder='所属房间' placeholder='所属房间'
@change='getArea'> @change='selectRoom'>
<a-select-option v-for='item in roomList' :key='item.id' :value='item.id'> <a-select-option v-for='item in roomList' :key='item.id' :value='item.id'>
{{ item.name }} {{ item.name }}
</a-select-option> </a-select-option>
</a-select> </a-select>
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row>
<a-row>
<a-col :span='10'> <a-col :span='10'>
<a-form-item label='会议面积' :labelCol='labelCol' :wrapperCol='wrapperCol'> <a-form-item label='会议室面积' :labelCol='labelCol' :wrapperCol='wrapperCol'>
<a-input placeholder='会议面积' <a-input placeholder='会议室面积'
v-decorator="['area',{rules: [{ required: true, message: '请输入会议面积' }]}]" v-decorator="['area',{rules: [{ required: true, message: '请输入会议面积' }]}]"
disabled='disabled' /> disabled='disabled' />
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row>
<a-row>
<a-col :span='10'>
<a-form-item label='展厅名称' :labelCol='labelCol' :wrapperCol='wrapperCol'>
<a-input placeholder='展厅名称'
v-decorator="['meetingName',{rules: [{ required: true, message: '输入会议名称' }]}]" />
</a-form-item>
</a-col>
<a-col :span='10'> <a-col :span='10'>
<a-form-item label='容纳人数' :labelCol='labelCol' :wrapperCol='wrapperCol'> <a-form-item label='容纳人数' :labelCol='labelCol' :wrapperCol='wrapperCol'>
<a-input placeholder='容纳人数' <a-input placeholder='容纳人数'
@ -138,7 +164,7 @@
</a-row> </a-row>
<a-row> <a-row>
<a-col :span='10'> <a-col :span='10'>
<a-form-item :labelCol='labelCol' :wrapperCol='wrapperCol' label='室内图片url'> <a-form-item :labelCol='labelCol' :wrapperCol='wrapperCol' label='室内图片'>
<!-- <a-input placeholder="室内图片url" v-decorator="['indoorPicUrl']" />--> <!-- <a-input placeholder="室内图片url" v-decorator="['indoorPicUrl']" />-->
<a-upload <a-upload
v-decorator="['indoorPicUrl']" v-decorator="['indoorPicUrl']"
@ -164,15 +190,16 @@
</template> </template>
<script> <script>
import { saveShowroom, get } from '@/api/admin/meeting/showroom' import { saveShowroom, get } from '@/api/admin/meeting/showroom'
import {
getFloorList,
getRoomListByFloorId,
selectRoomById
} from '@/api/admin/meeting/roomContent'
import pick from 'lodash.pick' import pick from 'lodash.pick'
import moment from 'moment' import moment from 'moment'
import storage from 'store' import storage from 'store'
import { ACCESS_TOKEN } from '@/store/mutation-types' import { ACCESS_TOKEN } from '@/store/mutation-types'
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'
import { getRoomListByFloorId, selectRoomById } from '@/api/admin/meeting/roomContent'
export default { export default {
name: 'ShowroomModal', name: 'ShowroomModal',
@ -186,7 +213,7 @@ export default {
visible: false, visible: false,
labelCol: { labelCol: {
xs: { span: 24 }, xs: { span: 24 },
sm: { span: 5 } sm: { span: 8 }
}, },
uploadUrl: process.env.VUE_APP_API_BASE_URL + '/api/dfs/upload', uploadUrl: process.env.VUE_APP_API_BASE_URL + '/api/dfs/upload',
imageUrl: '', imageUrl: '',
@ -201,8 +228,15 @@ export default {
mdl: {}, mdl: {},
floorList: [], floorList: [],
roomList: [], form: this.$form.createForm(this),
form: this.$form.createForm(this) userDetail: {},
tenantList: [], //
parkList: [], //
buildingList: [], //
buildingDetailList: [], //
roomList: [], //
tenantEnable: false,
parkEnable: false
} }
}, },
beforeCreate() { beforeCreate() {
@ -210,6 +244,147 @@ export default {
created() { created() {
}, },
methods: { methods: {
//
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.buildId = null //
this.mdl.roomId = null //
this.mdl.area = null //
this.form.setFieldsValue({
parkId: null, //
buildingId: null, //
buildId: null, //
roomId: null, //
area: null //
})
//
getParkList({
tenantId: id
}).then(res => {
this.parkList = res.rows
})
},
// ->
selectPark(id) {
//
this.mdl.buildingId = null //
this.mdl.buildId = null //
this.mdl.roomId = null //
this.mdl.area = null //
this.form.setFieldsValue({
buildingId: null, //
buildId: null, //
roomId: null, //
area: null //
})
//
getBuildingList({
parkId: id
}).then(res => {
this.buildingList = res.rows
})
},
// ->
selectBuilding(id) {
//
this.mdl.buildId = null //
this.mdl.roomId = null //
this.mdl.area = null //
this.form.setFieldsValue({
buildId: null, //
roomId: null, //
area: null //
})
//
getBuildingDetailList({
buildingId: id
}).then(res => {
this.buildingDetailList = res.rows
})
},
// ->
selectBuildingDetail(buildingDetailId) {
//
this.getRoomListByFloorIdMethod(buildingDetailId)
},
//
getRoomListByFloorIdMethod(buildingDetailId, id) {
//
this.mdl.roomId = null //
this.mdl.area = null //
this.form.setFieldsValue({
roomId: null, //
area: null //
})
//
getRoomListByFloorId({
'id': id,
'buildingDetailId': buildingDetailId,
'type': 0
}).then((res) => {
this.roomList = res.data
})
},
// ->
selectRoom(id) {
//
this.mdl.area = null //
this.form.setFieldsValue({
area: null //
})
//
selectRoomById({
'id': id
}).then((res) => {
this.form.setFieldsValue({
area: res.data.area
})
})
},
moment, moment,
beforeUpload(file) { beforeUpload(file) {
@ -245,54 +420,58 @@ export default {
}) })
} }
}, },
getArea(value) {
let param = {
'id': value
}
selectRoomById(param).then((res) => {
this.form.setFieldsValue({
area: res.data.area
})
})
},
getFloorList() {
getFloorList().then((res) => {
this.floorList = res.data
})
},
getRoomList(value) {
let param = {
'buildingDetailId': value
}
getRoomListByFloorId(param).then((res) => {
this.roomList = res.data
})
},
add() { add() {
this.form.resetFields() this.form.resetFields()
this.edit({ id: 0 }) this.edit({ id: 0 })
}, },
edit(record) { edit(record) {
this.mdl = Object.assign(record) this.mdl = Object.assign(record)
console.log('this.mdl.indoorPicUrl' , this.mdl.indoorPicUrl) let copyMdl = JSON.parse(JSON.stringify(this.mdl))
//
this.getTenantData()
//
if (record.id) { //
// ->
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)
}
// ->
if (copyMdl.buildId) {
this.mdl = JSON.parse(JSON.stringify(copyMdl))
this.getRoomListByFloorIdMethod(copyMdl.buildId, copyMdl.roomId)
}
//
this.mdl = JSON.parse(JSON.stringify(copyMdl))
} else { //
}
//
this.getUserDetail()
//
if (this.mdl.indoorPicUrl) { if (this.mdl.indoorPicUrl) {
this.imageUrl = process.env.VUE_APP_API_BASE_URL + this.mdl.indoorPicUrl this.imageUrl = process.env.VUE_APP_API_BASE_URL + this.mdl.indoorPicUrl
} else {
this.imageUrl = ''
} }
this.visible = true this.visible = true
this.$nextTick(() => { this.$nextTick(() => {
this.form.setFieldsValue(pick(this.mdl, 'id', 'showroomCode', 'meetingName', 'capacityNum', 'expandNum', 'buildId', 'indoorPicUrl', 'address', 'startTime', 'endDate', 'isShow', 'headName', 'headPhone', 'content', 'createBy', 'createTime', 'updateBy', 'updateTime', 'version', 'deleteFlag', 'roomId', 'area')) this.form.setFieldsValue(pick(this.mdl, 'id', 'showroomCode', 'meetingName', 'capacityNum', 'expandNum',
}) 'indoorPicUrl', 'address', 'startTime', 'endDate', 'isShow',
get(record.id).then(res => { 'headName', 'headPhone', 'content', 'createBy', 'createTime',
let param = { 'updateBy', 'updateTime', 'version', 'deleteFlag',
'buildingDetailId': res.buildId 'tenantId', 'parkId', 'buildingId', 'buildId', 'roomId', 'area'))
}
getRoomListByFloorId(param).then((res) => {
this.roomList = res.data
})
this.form.setFieldsValue({})
}) })
}, },
handleSubmit(e) { handleSubmit(e) {