Commit c65859c6b6b6a5a0f6d00461bb1a1e049371977f

Authored by wuxw
1 parent acfe91a9

v1.9 优化房屋 商铺 业主功能

src/api/room/roomApi.js
... ... @@ -59,7 +59,7 @@ export function queryRoomsWithSell(params) {
59 59 params
60 60 }).then(response => {
61 61 const res = response.data
62   - if (res.code === 0) {
  62 + if (res.code == 0) {
63 63 resolve(res)
64 64 } else {
65 65 reject(new Error(res.msg || '查询已售房屋信息失败'))
... ... @@ -79,11 +79,12 @@ export function queryRoomsWithOutSell(params) {
79 79 params
80 80 }).then(response => {
81 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 88 }).catch(error => {
88 89 reject(error)
89 90 })
... ...
src/components/owner/deleteOwner.vue
... ... @@ -40,7 +40,7 @@ export default {
40 40 this.visible = false
41 41 this.$emit('success')
42 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 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 3 <el-row>
4 4 <el-col :span="24">
5 5 <div class="table-container">
... ... @@ -100,6 +100,6 @@ export default {
100 100  
101 101 <style scoped>
102 102 .table-container {
103   - margin-top: 15px;
  103 + margin-top: 0px;
104 104 }
105 105 </style>
106 106 \ No newline at end of file
... ...
src/components/room/addShops.vue
... ... @@ -2,14 +2,14 @@
2 2 <el-dialog :title="$t('shops.addShop')" :visible.sync="dialogVisible" width="40%">
3 3 <el-form ref="form" :model="formData" :rules="rules" label-width="120px">
4 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 6 </el-form-item>
7 7 <el-form-item :label="$t('shops.shopFloor')" prop="layer">
8 8 <el-input v-model="formData.layer" :placeholder="$t('shops.floorRequired')"></el-input>
9 9 </el-form-item>
10 10 <el-form-item :label="$t('shops.building')" prop="floorId">
11 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 13 :value="item.floorId"></el-option>
14 14 </el-select>
15 15 </el-form-item>
... ...
src/components/room/bindOwnerShops.vue
... ... @@ -98,8 +98,8 @@ export default {
98 98 computed: {
99 99 formTitle() {
100 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 105 methods: {
... ...
src/components/room/editRoom.vue
... ... @@ -18,7 +18,7 @@
18 18 <el-col :span="12">
19 19 <el-form-item :label="$t('room.editRoom.unit')" required>
20 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 22 :value="unit.unitId" />
23 23 </el-select>
24 24 </el-form-item>
... ...
src/components/room/floorUnitTree.vue
... ... @@ -81,7 +81,7 @@ export default {
81 81 floorId: item.floorId,
82 82 floorNum: item.floorNum,
83 83 icon: 'el-icon-office-building',
84   - text: `${item.floorNum}${this.$t('room.floorUnitTree.building')}(${item.floorName})`,
  84 + text: `${item.floorNum}(${item.floorName})`,
85 85 children: []
86 86 }
87 87 treeData.push(floorMap[item.floorId])
... ... @@ -91,7 +91,7 @@ export default {
91 91 floorMap[item.floorId].children.push({
92 92 id: `u_${item.unitId}`,
93 93 unitId: item.unitId,
94   - text: `${item.unitNum}${this.$t('room.floorUnitTree.unit')}`,
  94 + text: `${item.unitNum}`,
95 95 icon: 'el-icon-house'
96 96 })
97 97 }
... ...
src/components/room/searchRoom.vue
... ... @@ -115,9 +115,9 @@ export default {
115 115 }
116 116  
117 117 let response
118   - if (this.roomFlag === '1') {
  118 + if (this.roomFlag == '1') {
119 119 response = await queryRoomsWithSell(params)
120   - } else if (this.roomFlag === '2') {
  120 + } else if (this.roomFlag == '2') {
121 121 response = await queryRoomsWithOutSell(params)
122 122 } else {
123 123 response = await queryRooms(params)
... ... @@ -127,7 +127,7 @@ export default {
127 127 this.pagination.total = response.total || 0
128 128 } catch (error) {
129 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 133 chooseRoom(room) {
... ... @@ -166,14 +166,6 @@ export default {
166 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 170 </script>
179 171  
... ...
src/views/owner/listOwner.vue
... ... @@ -412,7 +412,7 @@ export default {
412 412 openOwnerDetail(owner) {
413 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 55 </el-col>
56 56 </el-row>
57 57  
58   - <search-room ref="searchRoomRef" :roomFlag="2" @chooseRoom="handleChooseRoom" />
  58 + <search-room ref="searchRoomRef" :roomFlag="roomFlag" @chooseRoom="handleChooseRoom" />
59 59 </div>
60 60 </template>
61 61  
... ... @@ -73,6 +73,7 @@ export default {
73 73 },
74 74 data() {
75 75 return {
  76 + roomFlag: '2',
76 77 roomBindOwnerInfo: {
77 78 roomId: '',
78 79 roomName: '',
... ...
src/views/room/addRoomViewList.vue
... ... @@ -189,11 +189,16 @@ export default {
189 189 }
190 190 }
191 191 },
192   - created() {
  192 + async created() {
193 193 this.addRoomViewInfo.communityId = getCommunityId()
  194 + this.addRoomViewInfo.floorId = this.$route.query.floorId
194 195 this._loadRoomAttrSpec()
195 196 this._loadDictData()
196 197 this._loadFloor()
  198 + if(this.addRoomViewInfo.floorId){
  199 + await this._loadUnit()
  200 + this.addRoomViewInfo.unitId = this.$route.query.unitId
  201 + }
197 202 },
198 203 methods: {
199 204 async _loadDictData() {
... ...
src/views/room/roomLang.js
... ... @@ -451,8 +451,8 @@ export const messages = {
451 451 editRoom: {
452 452 title: '修改房屋',
453 453 roomNum: '房屋编号',
454   - layer: '房屋楼层',
455   - unit: '房屋单元',
  454 + layer: '楼层',
  455 + unit: '单元',
456 456 roomType: '房屋类型',
457 457 apartment1: '户型室',
458 458 apartment2: '户型厅',
... ...
src/views/room/roomList.vue
... ... @@ -31,10 +31,10 @@
31 31 <i class="el-icon-plus"></i>
32 32 <span>{{ $t('roomList.importRoom') }}</span>
33 33 </el-button>
34   - <el-button type="primary" size="small" @click="showMarkdown">
  34 + <!-- <el-button type="primary" size="small" @click="showMarkdown">
35 35 <i class="el-icon-document"></i>
36 36 <span>{{ $t('roomList.document') }}</span>
37   - </el-button>
  37 + </el-button> -->
38 38 </div>
39 39  
40 40 <!-- 替换原有的 el-row 布局为可拖拽布局 -->
... ... @@ -525,8 +525,13 @@ export default {
525 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 537 openEditRoomModel(room) {
... ...
src/views/room/shopsLang.js
... ... @@ -57,7 +57,9 @@ export const messages = {
57 57 tenantNameRequired: 'Tenant name is required',
58 58 leaseStartRequired: 'Lease start date is required',
59 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 65 zh: {
... ... @@ -67,7 +69,7 @@ export const messages = {
67 69 shopId: '商铺ID',
68 70 shopIdPlaceholder: '请填写商铺ID',
69 71 shopNumber: '商铺编号',
70   - shopNumberPlaceholder: '请填写商铺编号(格式:楼栋-商铺)',
  72 + shopNumberPlaceholder: '商铺编号(格式:楼栋-商铺)',
71 73 state: '状态',
72 74 statePlaceholder: '请选择状态',
73 75 rented: '已出租',
... ... @@ -118,7 +120,9 @@ export const messages = {
118 120 tenantNameRequired: '租户名称不能为空',
119 121 leaseStartRequired: '起租时间不能为空',
120 122 leaseEndRequired: '截租时间不能为空',
121   - phoneFormatError: '手机号格式错误'
  123 + phoneFormatError: '手机号格式错误',
  124 + rentShop:'出租商铺',
  125 + sellShop:'出售商铺'
122 126 }
123 127 }
124 128 }
125 129 \ No newline at end of file
... ...
src/views/room/shopsList.vue
... ... @@ -7,15 +7,15 @@
7 7 <span>{{ $t('shops.queryCondition') }}</span>
8 8 </div>
9 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 11 <el-input v-model.trim="queryParams.roomId" :placeholder="$t('shops.shopIdPlaceholder')"
12 12 clearable></el-input>
13 13 </el-form-item>
14   - <el-form-item :label="$t('shops.shopNumber')">
  14 + <el-form-item>
15 15 <el-input v-model.trim="queryParams.roomNum" :placeholder="$t('shops.shopNumberPlaceholder')"
16 16 clearable></el-input>
17 17 </el-form-item>
18   - <el-form-item :label="$t('shops.state')">
  18 + <el-form-item>
19 19 <el-select v-model="queryParams.state" :placeholder="$t('shops.statePlaceholder')" clearable
20 20 style="width: 100%">
21 21 <el-option :label="$t('shops.rented')" value="2006"></el-option>
... ... @@ -176,9 +176,9 @@ export default {
176 176 this.loading = true
177 177 queryShops(this.queryParams)
178 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 183 .catch(error => {
184 184 console.error(error)
... ... @@ -231,7 +231,7 @@ export default {
231 231 },
232 232 dealShopsAttr(shopss) {
233 233 // 处理商铺属性列
234   - // this.listColumns = ['Attr1', 'Attr2'] // 实际应从API获取
  234 + // this.listColumns = ['Attr1', 'Attr2'] // 实际应从API获取
235 235 shopss.forEach(shop => {
236 236 shop.listValues = [] // 实际应从API获取
237 237 })
... ...