Commit c65859c6b6b6a5a0f6d00461bb1a1e049371977f
1 parent
acfe91a9
v1.9 优化房屋 商铺 业主功能
Showing
15 changed files
with
53 additions
and
45 deletions
src/api/room/roomApi.js
| @@ -59,7 +59,7 @@ export function queryRoomsWithSell(params) { | @@ -59,7 +59,7 @@ export function queryRoomsWithSell(params) { | ||
| 59 | params | 59 | params |
| 60 | }).then(response => { | 60 | }).then(response => { |
| 61 | const res = response.data | 61 | const res = response.data |
| 62 | - if (res.code === 0) { | 62 | + if (res.code == 0) { |
| 63 | resolve(res) | 63 | resolve(res) |
| 64 | } else { | 64 | } else { |
| 65 | reject(new Error(res.msg || '查询已售房屋信息失败')) | 65 | reject(new Error(res.msg || '查询已售房屋信息失败')) |
| @@ -79,11 +79,12 @@ export function queryRoomsWithOutSell(params) { | @@ -79,11 +79,12 @@ export function queryRoomsWithOutSell(params) { | ||
| 79 | params | 79 | params |
| 80 | }).then(response => { | 80 | }).then(response => { |
| 81 | const res = response.data | 81 | const res = response.data |
| 82 | - if (res.code === 0) { | ||
| 83 | - resolve(res) | ||
| 84 | - } else { | ||
| 85 | - reject(new Error(res.msg || '查询未售房屋信息失败')) | 82 | + if(res.rooms){ |
| 83 | + res.rooms.forEach(room => { | ||
| 84 | + room.roomName = room.floorNum+"-"+room.unitNum+"-"+room.roomNum | ||
| 85 | + }); | ||
| 86 | } | 86 | } |
| 87 | + resolve(res) | ||
| 87 | }).catch(error => { | 88 | }).catch(error => { |
| 88 | reject(error) | 89 | reject(error) |
| 89 | }) | 90 | }) |
src/components/owner/deleteOwner.vue
| @@ -40,7 +40,7 @@ export default { | @@ -40,7 +40,7 @@ export default { | ||
| 40 | this.visible = false | 40 | this.visible = false |
| 41 | this.$emit('success') | 41 | this.$emit('success') |
| 42 | } catch (error) { | 42 | } catch (error) { |
| 43 | - this.$message.error(this.$t('listOwner.deleteFailed')) | 43 | + this.$message.error(error) |
| 44 | } | 44 | } |
| 45 | } | 45 | } |
| 46 | } | 46 | } |
src/components/owner/ownerCars.vue
| 1 | <template> | 1 | <template> |
| 2 | - <el-dialog :visible.sync="dialogVisible" :title="$t('ownerCars.title')" width="80%" top="5vh" @close="handleClose"> | 2 | + <el-dialog :visible.sync="dialogVisible" :title="$t('ownerCars.title')" width="80%" @close="handleClose"> |
| 3 | <el-row> | 3 | <el-row> |
| 4 | <el-col :span="24"> | 4 | <el-col :span="24"> |
| 5 | <div class="table-container"> | 5 | <div class="table-container"> |
| @@ -100,6 +100,6 @@ export default { | @@ -100,6 +100,6 @@ export default { | ||
| 100 | 100 | ||
| 101 | <style scoped> | 101 | <style scoped> |
| 102 | .table-container { | 102 | .table-container { |
| 103 | - margin-top: 15px; | 103 | + margin-top: 0px; |
| 104 | } | 104 | } |
| 105 | </style> | 105 | </style> |
| 106 | \ No newline at end of file | 106 | \ No newline at end of file |
src/components/room/addShops.vue
| @@ -2,14 +2,14 @@ | @@ -2,14 +2,14 @@ | ||
| 2 | <el-dialog :title="$t('shops.addShop')" :visible.sync="dialogVisible" width="40%"> | 2 | <el-dialog :title="$t('shops.addShop')" :visible.sync="dialogVisible" width="40%"> |
| 3 | <el-form ref="form" :model="formData" :rules="rules" label-width="120px"> | 3 | <el-form ref="form" :model="formData" :rules="rules" label-width="120px"> |
| 4 | <el-form-item :label="$t('shops.shopNumber')" prop="roomNum"> | 4 | <el-form-item :label="$t('shops.shopNumber')" prop="roomNum"> |
| 5 | - <el-input v-model="formData.roomNum" :placeholder="$t('shops.shopNumberPlaceholder')"></el-input> | 5 | + <el-input v-model="formData.roomNum" :placeholder="$t('shops.shopNumber')"></el-input> |
| 6 | </el-form-item> | 6 | </el-form-item> |
| 7 | <el-form-item :label="$t('shops.shopFloor')" prop="layer"> | 7 | <el-form-item :label="$t('shops.shopFloor')" prop="layer"> |
| 8 | <el-input v-model="formData.layer" :placeholder="$t('shops.floorRequired')"></el-input> | 8 | <el-input v-model="formData.layer" :placeholder="$t('shops.floorRequired')"></el-input> |
| 9 | </el-form-item> | 9 | </el-form-item> |
| 10 | <el-form-item :label="$t('shops.building')" prop="floorId"> | 10 | <el-form-item :label="$t('shops.building')" prop="floorId"> |
| 11 | <el-select v-model="formData.floorId" :placeholder="$t('shops.building')" style="width: 100%"> | 11 | <el-select v-model="formData.floorId" :placeholder="$t('shops.building')" style="width: 100%"> |
| 12 | - <el-option v-for="item in floors" :key="item.floorId" :label="item.floorNum + $t('shops.building')" | 12 | + <el-option v-for="item in floors" :key="item.floorId" :label="item.floorNum" |
| 13 | :value="item.floorId"></el-option> | 13 | :value="item.floorId"></el-option> |
| 14 | </el-select> | 14 | </el-select> |
| 15 | </el-form-item> | 15 | </el-form-item> |
src/components/room/bindOwnerShops.vue
| @@ -98,8 +98,8 @@ export default { | @@ -98,8 +98,8 @@ export default { | ||
| 98 | computed: { | 98 | computed: { |
| 99 | formTitle() { | 99 | formTitle() { |
| 100 | return this.formData.shopsState === '2007' | 100 | return this.formData.shopsState === '2007' |
| 101 | - ? this.$t('shops.sell') + this.$t('shops.shopInfo') | ||
| 102 | - : this.$t('shops.rent') + this.$t('shops.shopInfo') | 101 | + ? this.$t('shops.sellShop') |
| 102 | + : this.$t('shops.rentShop') | ||
| 103 | } | 103 | } |
| 104 | }, | 104 | }, |
| 105 | methods: { | 105 | methods: { |
src/components/room/editRoom.vue
| @@ -18,7 +18,7 @@ | @@ -18,7 +18,7 @@ | ||
| 18 | <el-col :span="12"> | 18 | <el-col :span="12"> |
| 19 | <el-form-item :label="$t('room.editRoom.unit')" required> | 19 | <el-form-item :label="$t('room.editRoom.unit')" required> |
| 20 | <el-select v-model="form.unitId" :placeholder="$t('room.editRoom.placeholder.unit')" style="width: 100%;"> | 20 | <el-select v-model="form.unitId" :placeholder="$t('room.editRoom.placeholder.unit')" style="width: 100%;"> |
| 21 | - <el-option v-for="unit in units" :key="unit.unitId" :label="`${unit.unitNum}${$t('room.editRoom.unit')}`" | 21 | + <el-option v-for="unit in units" :key="unit.unitId" :label="`${unit.unitNum}`" |
| 22 | :value="unit.unitId" /> | 22 | :value="unit.unitId" /> |
| 23 | </el-select> | 23 | </el-select> |
| 24 | </el-form-item> | 24 | </el-form-item> |
src/components/room/floorUnitTree.vue
| @@ -81,7 +81,7 @@ export default { | @@ -81,7 +81,7 @@ export default { | ||
| 81 | floorId: item.floorId, | 81 | floorId: item.floorId, |
| 82 | floorNum: item.floorNum, | 82 | floorNum: item.floorNum, |
| 83 | icon: 'el-icon-office-building', | 83 | icon: 'el-icon-office-building', |
| 84 | - text: `${item.floorNum}${this.$t('room.floorUnitTree.building')}(${item.floorName})`, | 84 | + text: `${item.floorNum}(${item.floorName})`, |
| 85 | children: [] | 85 | children: [] |
| 86 | } | 86 | } |
| 87 | treeData.push(floorMap[item.floorId]) | 87 | treeData.push(floorMap[item.floorId]) |
| @@ -91,7 +91,7 @@ export default { | @@ -91,7 +91,7 @@ export default { | ||
| 91 | floorMap[item.floorId].children.push({ | 91 | floorMap[item.floorId].children.push({ |
| 92 | id: `u_${item.unitId}`, | 92 | id: `u_${item.unitId}`, |
| 93 | unitId: item.unitId, | 93 | unitId: item.unitId, |
| 94 | - text: `${item.unitNum}${this.$t('room.floorUnitTree.unit')}`, | 94 | + text: `${item.unitNum}`, |
| 95 | icon: 'el-icon-house' | 95 | icon: 'el-icon-house' |
| 96 | }) | 96 | }) |
| 97 | } | 97 | } |
src/components/room/searchRoom.vue
| @@ -115,9 +115,9 @@ export default { | @@ -115,9 +115,9 @@ export default { | ||
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | let response | 117 | let response |
| 118 | - if (this.roomFlag === '1') { | 118 | + if (this.roomFlag == '1') { |
| 119 | response = await queryRoomsWithSell(params) | 119 | response = await queryRoomsWithSell(params) |
| 120 | - } else if (this.roomFlag === '2') { | 120 | + } else if (this.roomFlag == '2') { |
| 121 | response = await queryRoomsWithOutSell(params) | 121 | response = await queryRoomsWithOutSell(params) |
| 122 | } else { | 122 | } else { |
| 123 | response = await queryRooms(params) | 123 | response = await queryRooms(params) |
| @@ -127,7 +127,7 @@ export default { | @@ -127,7 +127,7 @@ export default { | ||
| 127 | this.pagination.total = response.total || 0 | 127 | this.pagination.total = response.total || 0 |
| 128 | } catch (error) { | 128 | } catch (error) { |
| 129 | console.error('Failed to load room info:', error) | 129 | console.error('Failed to load room info:', error) |
| 130 | - this.$message.error(this.$t('searchRoom.loadFailed')) | 130 | + this.$message.error(error) |
| 131 | } | 131 | } |
| 132 | }, | 132 | }, |
| 133 | chooseRoom(room) { | 133 | chooseRoom(room) { |
| @@ -166,14 +166,6 @@ export default { | @@ -166,14 +166,6 @@ export default { | ||
| 166 | this.rooms = rooms | 166 | this.rooms = rooms |
| 167 | } | 167 | } |
| 168 | }, | 168 | }, |
| 169 | - mounted() { | ||
| 170 | - this.$on('listener-floor-info', this.listenerFloorInfo) | ||
| 171 | - this.$on('show-owner-rooms', this.showOwnerRooms) | ||
| 172 | - }, | ||
| 173 | - beforeDestroy() { | ||
| 174 | - this.$off('listener-floor-info', this.listenerFloorInfo) | ||
| 175 | - this.$off('show-owner-rooms', this.showOwnerRooms) | ||
| 176 | - } | ||
| 177 | } | 169 | } |
| 178 | </script> | 170 | </script> |
| 179 | 171 |
src/views/owner/listOwner.vue
| @@ -412,7 +412,7 @@ export default { | @@ -412,7 +412,7 @@ export default { | ||
| 412 | openOwnerDetail(owner) { | 412 | openOwnerDetail(owner) { |
| 413 | console.log('Owner detail:', owner) | 413 | console.log('Owner detail:', owner) |
| 414 | // 实际项目中跳转到详情页面 | 414 | // 实际项目中跳转到详情页面 |
| 415 | - this.$router.push(`/views/owner/ownerDetail?ownerId=${owner.ownerId}`) | 415 | + this.$router.push(`/views/owner/ownerDetail?ownerId=${owner.ownerId}&needBack=Y`) |
| 416 | 416 | ||
| 417 | }, | 417 | }, |
| 418 | 418 |
src/views/owner/ownerBindRoom.vue
| @@ -55,7 +55,7 @@ | @@ -55,7 +55,7 @@ | ||
| 55 | </el-col> | 55 | </el-col> |
| 56 | </el-row> | 56 | </el-row> |
| 57 | 57 | ||
| 58 | - <search-room ref="searchRoomRef" :roomFlag="2" @chooseRoom="handleChooseRoom" /> | 58 | + <search-room ref="searchRoomRef" :roomFlag="roomFlag" @chooseRoom="handleChooseRoom" /> |
| 59 | </div> | 59 | </div> |
| 60 | </template> | 60 | </template> |
| 61 | 61 | ||
| @@ -73,6 +73,7 @@ export default { | @@ -73,6 +73,7 @@ export default { | ||
| 73 | }, | 73 | }, |
| 74 | data() { | 74 | data() { |
| 75 | return { | 75 | return { |
| 76 | + roomFlag: '2', | ||
| 76 | roomBindOwnerInfo: { | 77 | roomBindOwnerInfo: { |
| 77 | roomId: '', | 78 | roomId: '', |
| 78 | roomName: '', | 79 | roomName: '', |
src/views/room/addRoomViewList.vue
| @@ -189,11 +189,16 @@ export default { | @@ -189,11 +189,16 @@ export default { | ||
| 189 | } | 189 | } |
| 190 | } | 190 | } |
| 191 | }, | 191 | }, |
| 192 | - created() { | 192 | + async created() { |
| 193 | this.addRoomViewInfo.communityId = getCommunityId() | 193 | this.addRoomViewInfo.communityId = getCommunityId() |
| 194 | + this.addRoomViewInfo.floorId = this.$route.query.floorId | ||
| 194 | this._loadRoomAttrSpec() | 195 | this._loadRoomAttrSpec() |
| 195 | this._loadDictData() | 196 | this._loadDictData() |
| 196 | this._loadFloor() | 197 | this._loadFloor() |
| 198 | + if(this.addRoomViewInfo.floorId){ | ||
| 199 | + await this._loadUnit() | ||
| 200 | + this.addRoomViewInfo.unitId = this.$route.query.unitId | ||
| 201 | + } | ||
| 197 | }, | 202 | }, |
| 198 | methods: { | 203 | methods: { |
| 199 | async _loadDictData() { | 204 | async _loadDictData() { |
src/views/room/roomLang.js
| @@ -451,8 +451,8 @@ export const messages = { | @@ -451,8 +451,8 @@ export const messages = { | ||
| 451 | editRoom: { | 451 | editRoom: { |
| 452 | title: '修改房屋', | 452 | title: '修改房屋', |
| 453 | roomNum: '房屋编号', | 453 | roomNum: '房屋编号', |
| 454 | - layer: '房屋楼层', | ||
| 455 | - unit: '房屋单元', | 454 | + layer: '楼层', |
| 455 | + unit: '单元', | ||
| 456 | roomType: '房屋类型', | 456 | roomType: '房屋类型', |
| 457 | apartment1: '户型室', | 457 | apartment1: '户型室', |
| 458 | apartment2: '户型厅', | 458 | apartment2: '户型厅', |
src/views/room/roomList.vue
| @@ -31,10 +31,10 @@ | @@ -31,10 +31,10 @@ | ||
| 31 | <i class="el-icon-plus"></i> | 31 | <i class="el-icon-plus"></i> |
| 32 | <span>{{ $t('roomList.importRoom') }}</span> | 32 | <span>{{ $t('roomList.importRoom') }}</span> |
| 33 | </el-button> | 33 | </el-button> |
| 34 | - <el-button type="primary" size="small" @click="showMarkdown"> | 34 | + <!-- <el-button type="primary" size="small" @click="showMarkdown"> |
| 35 | <i class="el-icon-document"></i> | 35 | <i class="el-icon-document"></i> |
| 36 | <span>{{ $t('roomList.document') }}</span> | 36 | <span>{{ $t('roomList.document') }}</span> |
| 37 | - </el-button> | 37 | + </el-button> --> |
| 38 | </div> | 38 | </div> |
| 39 | 39 | ||
| 40 | <!-- 替换原有的 el-row 布局为可拖拽布局 --> | 40 | <!-- 替换原有的 el-row 布局为可拖拽布局 --> |
| @@ -525,8 +525,13 @@ export default { | @@ -525,8 +525,13 @@ export default { | ||
| 525 | this.$refs.floorUnitTree.refreshTree(param) | 525 | this.$refs.floorUnitTree.refreshTree(param) |
| 526 | }, | 526 | }, |
| 527 | // 按钮操作相关方法 | 527 | // 按钮操作相关方法 |
| 528 | - openAddRoom() { | ||
| 529 | - this.$router.push('/views/room/addRoomView') | 528 | + async openAddRoom() { |
| 529 | + let _floorId = this.roomInfo.conditions.floorId; | ||
| 530 | + if(this.roomInfo.conditions.unitId){ | ||
| 531 | + const unitData = await this.loadUnits(this.roomInfo.conditions.unitId) | ||
| 532 | + _floorId = unitData.floorId; | ||
| 533 | + } | ||
| 534 | + this.$router.push('/views/room/addRoomView?floorId='+_floorId+"&unitId="+this.roomInfo.conditions.unitId) | ||
| 530 | }, | 535 | }, |
| 531 | 536 | ||
| 532 | openEditRoomModel(room) { | 537 | openEditRoomModel(room) { |
src/views/room/shopsLang.js
| @@ -57,7 +57,9 @@ export const messages = { | @@ -57,7 +57,9 @@ export const messages = { | ||
| 57 | tenantNameRequired: 'Tenant name is required', | 57 | tenantNameRequired: 'Tenant name is required', |
| 58 | leaseStartRequired: 'Lease start date is required', | 58 | leaseStartRequired: 'Lease start date is required', |
| 59 | leaseEndRequired: 'Lease end date is required', | 59 | leaseEndRequired: 'Lease end date is required', |
| 60 | - phoneFormatError: 'Invalid phone format' | 60 | + phoneFormatError: 'Invalid phone format', |
| 61 | + rentShop:'rent shop', | ||
| 62 | + sellShop:'sell shop' | ||
| 61 | } | 63 | } |
| 62 | }, | 64 | }, |
| 63 | zh: { | 65 | zh: { |
| @@ -67,7 +69,7 @@ export const messages = { | @@ -67,7 +69,7 @@ export const messages = { | ||
| 67 | shopId: '商铺ID', | 69 | shopId: '商铺ID', |
| 68 | shopIdPlaceholder: '请填写商铺ID', | 70 | shopIdPlaceholder: '请填写商铺ID', |
| 69 | shopNumber: '商铺编号', | 71 | shopNumber: '商铺编号', |
| 70 | - shopNumberPlaceholder: '请填写商铺编号(格式:楼栋-商铺)', | 72 | + shopNumberPlaceholder: '商铺编号(格式:楼栋-商铺)', |
| 71 | state: '状态', | 73 | state: '状态', |
| 72 | statePlaceholder: '请选择状态', | 74 | statePlaceholder: '请选择状态', |
| 73 | rented: '已出租', | 75 | rented: '已出租', |
| @@ -118,7 +120,9 @@ export const messages = { | @@ -118,7 +120,9 @@ export const messages = { | ||
| 118 | tenantNameRequired: '租户名称不能为空', | 120 | tenantNameRequired: '租户名称不能为空', |
| 119 | leaseStartRequired: '起租时间不能为空', | 121 | leaseStartRequired: '起租时间不能为空', |
| 120 | leaseEndRequired: '截租时间不能为空', | 122 | leaseEndRequired: '截租时间不能为空', |
| 121 | - phoneFormatError: '手机号格式错误' | 123 | + phoneFormatError: '手机号格式错误', |
| 124 | + rentShop:'出租商铺', | ||
| 125 | + sellShop:'出售商铺' | ||
| 122 | } | 126 | } |
| 123 | } | 127 | } |
| 124 | } | 128 | } |
| 125 | \ No newline at end of file | 129 | \ No newline at end of file |
src/views/room/shopsList.vue
| @@ -7,15 +7,15 @@ | @@ -7,15 +7,15 @@ | ||
| 7 | <span>{{ $t('shops.queryCondition') }}</span> | 7 | <span>{{ $t('shops.queryCondition') }}</span> |
| 8 | </div> | 8 | </div> |
| 9 | <el-form :inline="true" :model="queryParams" class="demo-form-inline text-left"> | 9 | <el-form :inline="true" :model="queryParams" class="demo-form-inline text-left"> |
| 10 | - <el-form-item :label="$t('shops.shopId')"> | 10 | + <el-form-item> |
| 11 | <el-input v-model.trim="queryParams.roomId" :placeholder="$t('shops.shopIdPlaceholder')" | 11 | <el-input v-model.trim="queryParams.roomId" :placeholder="$t('shops.shopIdPlaceholder')" |
| 12 | clearable></el-input> | 12 | clearable></el-input> |
| 13 | </el-form-item> | 13 | </el-form-item> |
| 14 | - <el-form-item :label="$t('shops.shopNumber')"> | 14 | + <el-form-item> |
| 15 | <el-input v-model.trim="queryParams.roomNum" :placeholder="$t('shops.shopNumberPlaceholder')" | 15 | <el-input v-model.trim="queryParams.roomNum" :placeholder="$t('shops.shopNumberPlaceholder')" |
| 16 | clearable></el-input> | 16 | clearable></el-input> |
| 17 | </el-form-item> | 17 | </el-form-item> |
| 18 | - <el-form-item :label="$t('shops.state')"> | 18 | + <el-form-item> |
| 19 | <el-select v-model="queryParams.state" :placeholder="$t('shops.statePlaceholder')" clearable | 19 | <el-select v-model="queryParams.state" :placeholder="$t('shops.statePlaceholder')" clearable |
| 20 | style="width: 100%"> | 20 | style="width: 100%"> |
| 21 | <el-option :label="$t('shops.rented')" value="2006"></el-option> | 21 | <el-option :label="$t('shops.rented')" value="2006"></el-option> |
| @@ -176,9 +176,9 @@ export default { | @@ -176,9 +176,9 @@ export default { | ||
| 176 | this.loading = true | 176 | this.loading = true |
| 177 | queryShops(this.queryParams) | 177 | queryShops(this.queryParams) |
| 178 | .then(res => { | 178 | .then(res => { |
| 179 | - this.shopsData = res.rooms | ||
| 180 | - this.pagination.total = res.total | ||
| 181 | - this.dealShopsAttr(res.rooms) | 179 | + this.shopsData = res.rooms |
| 180 | + this.pagination.total = res.total | ||
| 181 | + this.dealShopsAttr(res.rooms) | ||
| 182 | }) | 182 | }) |
| 183 | .catch(error => { | 183 | .catch(error => { |
| 184 | console.error(error) | 184 | console.error(error) |
| @@ -231,7 +231,7 @@ export default { | @@ -231,7 +231,7 @@ export default { | ||
| 231 | }, | 231 | }, |
| 232 | dealShopsAttr(shopss) { | 232 | dealShopsAttr(shopss) { |
| 233 | // 处理商铺属性列 | 233 | // 处理商铺属性列 |
| 234 | - // this.listColumns = ['Attr1', 'Attr2'] // 实际应从API获取 | 234 | + // this.listColumns = ['Attr1', 'Attr2'] // 实际应从API获取 |
| 235 | shopss.forEach(shop => { | 235 | shopss.forEach(shop => { |
| 236 | shop.listValues = [] // 实际应从API获取 | 236 | shop.listValues = [] // 实际应从API获取 |
| 237 | }) | 237 | }) |