diff --git a/src/App.vue b/src/App.vue index f8bc532..6260200 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,12 +1,30 @@ @@ -66,13 +147,40 @@ export default { name: 'App', data() { return { - activeIndex: 'dashboard' + activeIndex: 'dashboard', + isMobile: false, + drawerVisible: false, + drawerWidth: '70%' } }, + mounted() { + this.checkDevice() + window.addEventListener('resize', this.checkDevice) + }, + beforeDestroy() { + window.removeEventListener('resize', this.checkDevice) + }, methods: { + checkDevice() { + const width = window.innerWidth + this.isMobile = width <= 768 + // 根据屏幕宽度调整抽屉大小 + if (width <= 375) { + this.drawerWidth = '80%' + } else if (width <= 768) { + this.drawerWidth = '70%' + } + }, handleSelect(key, keyPath) { this.activeIndex = key - // 根据选择的菜单项导航到对应的路由 + this.navigateToRoute(key) + }, + handleMobileSelect(key, keyPath) { + this.activeIndex = key + this.drawerVisible = false + this.navigateToRoute(key) + }, + navigateToRoute(key) { const routeMap = { 'dashboard': '/', 'region-list': '/region/list', @@ -93,7 +201,6 @@ export default { } }, logout() { - // 退出登录逻辑 this.$message.success('退出成功') } } @@ -114,8 +221,179 @@ export default { color: #2c3e50; } +/* 顶部导航栏样式 */ +.app-header { + background-color: #333; + color: white; + display: flex; + align-items: center; + justify-content: space-between; + padding: 0 20px; +} + +.header-left { + display: flex; + align-items: center; + gap: 15px; +} + +.menu-toggle-btn { + padding: 0; + margin: 0; +} + +.app-title { + margin: 0; + font-size: 18px; +} + +/* 侧边栏样式 */ +.app-aside { + background-color: #f0f2f5; + min-height: calc(100vh - 60px); +} + .el-menu-vertical-demo:not(.el-menu--collapse) { width: 200px; min-height: 400px; } - \ No newline at end of file + +/* 主内容区样式 */ +.app-main { + padding: 20px; + background-color: #f5f7fa; + min-height: calc(100vh - 60px); +} + +/* 移动端抽屉样式 */ +.mobile-drawer .el-drawer__body { + padding: 0; +} + +.drawer-header { + display: flex; + justify-content: space-between; + align-items: center; + padding: 15px 20px; + border-bottom: 1px solid #ebeef5; + background-color: #f5f7fa; +} + +.drawer-header h3 { + margin: 0; + font-size: 16px; + color: #333; +} + +/* 移动端适配 */ +@media screen and (max-width: 768px) { + .app-header { + padding: 0 15px; + } + + .app-title { + font-size: 16px; + } + + .app-main { + padding: 10px; + } + + /* 表格横向滚动 */ + .el-table { + width: 100%; + overflow-x: auto; + } + + .el-table__body-wrapper { + overflow-x: auto; + } + + /* 表单元素适配 */ + .el-form-item { + margin-bottom: 15px; + } + + .el-form-item__label { + float: none; + display: block; + text-align: left; + padding: 0 0 8px; + line-height: 1.5; + } + + .el-form-item__content { + margin-left: 0 !important; + } + + /* 搜索表单适配 */ + .search-form .el-form-item { + display: block; + margin-right: 0; + } + + .search-form .el-form-item__content { + width: 100%; + } + + .search-form .el-input, + .search-form .el-select { + width: 100%; + } + + /* 卡片适配 */ + .el-card { + margin-bottom: 10px; + } + + .el-card__header { + padding: 12px 15px; + } + + .el-card__body { + padding: 15px; + } + + /* 分页适配 */ + .el-pagination { + text-align: center; + padding: 10px 0; + } + + .el-pagination .el-pagination__total, + .el-pagination .el-pagination__sizes, + .el-pagination .el-pagination__jump { + display: none; + } + + /* 按钮组适配 */ + .el-button + .el-button { + margin-left: 5px; + } + + /* 对话框适配 */ + .el-dialog { + width: 90% !important; + margin-top: 10vh !important; + } + + .el-dialog__body { + padding: 15px; + } +} + +/* 小屏幕手机适配 */ +@media screen and (max-width: 375px) { + .app-title { + font-size: 14px; + } + + .app-main { + padding: 8px; + } + + .el-card__body { + padding: 12px; + } +} + diff --git a/src/main.js b/src/main.js index 9f2080d..9998878 100644 --- a/src/main.js +++ b/src/main.js @@ -3,6 +3,7 @@ import App from './App.vue' import router from './router' import ElementUI from 'element-ui' import 'element-ui/lib/theme-chalk/index.css' +import './styles/responsive.css' Vue.use(ElementUI) @@ -11,4 +12,4 @@ Vue.config.productionTip = false new Vue({ router, render: h => h(App) -}).$mount('#app') \ No newline at end of file +}).$mount('#app') diff --git a/src/styles/responsive.css b/src/styles/responsive.css new file mode 100644 index 0000000..e7cde62 --- /dev/null +++ b/src/styles/responsive.css @@ -0,0 +1,152 @@ +/* 全局响应式样式 */ + +/* 移动端隐藏类 */ +.hidden-xs-only { + display: block; +} + +.hidden-sm-and-up { + display: none; +} + +/* 移动端适配 */ +@media screen and (max-width: 768px) { + .hidden-xs-only { + display: none !important; + } + + .hidden-sm-and-up { + display: block !important; + } + + /* 表单适配 */ + .search-form .el-form-item { + display: block; + margin-right: 0; + margin-bottom: 10px; + } + + .search-form .el-form-item__content { + width: 100%; + } + + .search-form .el-input, + .search-form .el-select { + width: 100%; + } + + /* 表格横向滚动 */ + .table-wrapper { + overflow-x: auto; + } + + .el-table { + min-width: 600px; + } + + /* 分页适配 */ + .pagination-wrapper, + .pagination { + justify-content: center; + } + + /* 卡片头部适配 */ + .card-header { + flex-wrap: wrap; + gap: 10px; + } + + .card-header span { + font-size: 16px; + } + + /* 移动端卡片列表样式 */ + .mobile-list { + display: block; + } + + .mobile-card { + background: #fff; + border: 1px solid #ebeef5; + border-radius: 4px; + padding: 15px; + margin-bottom: 10px; + } + + .mobile-card-header { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 10px; + padding-bottom: 10px; + border-bottom: 1px solid #ebeef5; + } + + .mobile-card-title { + font-size: 16px; + font-weight: bold; + color: #303133; + } + + .mobile-card-id { + font-size: 12px; + color: #909399; + } + + .mobile-card-body { + margin-bottom: 10px; + } + + .mobile-card-item { + display: flex; + margin-bottom: 8px; + font-size: 14px; + } + + .mobile-card-label { + color: #909399; + min-width: 70px; + flex-shrink: 0; + } + + .mobile-card-value { + color: #606266; + flex: 1; + word-break: break-all; + } + + .mobile-card-footer { + display: flex; + justify-content: flex-end; + gap: 10px; + padding-top: 10px; + border-top: 1px solid #ebeef5; + } + + /* 对话框适配 */ + .el-dialog { + width: 90% !important; + margin-top: 10vh !important; + } + + .el-dialog__body { + padding: 15px; + } +} + +@media screen and (min-width: 769px) { + .hidden-sm-and-up { + display: none !important; + } +} + +/* 小屏幕手机适配 */ +@media screen and (max-width: 375px) { + .mobile-card { + padding: 12px; + } + + .mobile-card-title { + font-size: 14px; + } +} diff --git a/src/views/Dashboard.vue b/src/views/Dashboard.vue index f4a7604..886314e 100644 --- a/src/views/Dashboard.vue +++ b/src/views/Dashboard.vue @@ -6,10 +6,10 @@ - +
- +
{{ regionCount }}
区域数量
@@ -17,10 +17,10 @@
- +
- +
{{ apartmentCount }}
公寓数量
@@ -28,10 +28,10 @@
- +
- +
{{ roomCount }}
房间数量
@@ -40,10 +40,10 @@ - +
- +
{{ emptyRoomCount }}
空房数量
@@ -51,10 +51,10 @@
- +
- +
{{ rentedRoomCount }}
在租数量
@@ -62,10 +62,10 @@
- +
- +
{{ soonExpireRoomCount }}
即将到期
@@ -73,10 +73,10 @@
- +
- +
{{ expiredRoomCount }}
已到期
@@ -84,23 +84,23 @@
- +
- +
-
¥{{ collectedRentAmount }}
+
{{ formatMoney(collectedRentAmount) }}
已收租金
- +
- +
-
¥{{ collectedWaterAmount }}
+
{{ formatMoney(collectedWaterAmount) }}
已收水费
@@ -108,23 +108,31 @@
- + - - - - - - - - - - - +
+ + + + + + + + + + + +
@@ -178,6 +186,12 @@ export default { this.$message.error('加载数据失败') } }, + formatMoney(value) { + if (value >= 10000) { + return '¥' + (value / 10000).toFixed(1) + '万' + } + return '¥' + value + }, getSummary(param) { const { columns, data } = param; const sums = []; @@ -208,32 +222,39 @@ export default { \ No newline at end of file + +.stats-table-card { + margin-top: 20px; +} + +.table-wrapper { + overflow-x: auto; +} + +.stats-table { + min-width: 800px; +} + +/* 移动端适配 */ +@media screen and (max-width: 768px) { + .welcome-card { + padding: 20px 0; + } + + .welcome-card h2 { + font-size: 18px; + } + + .welcome-card p { + font-size: 13px; + } + + .stat-card { + margin-bottom: 10px; + } + + .stat-item { + padding: 5px; + flex-direction: column; + text-align: center; + } + + .stat-icon { + font-size: 24px; + margin-right: 0; + margin-bottom: 8px; + } + + .stat-value { + font-size: 16px; + } + + .stat-label { + font-size: 12px; + } + + .stats-table-card { + margin-top: 10px; + } +} + +@media screen and (max-width: 375px) { + .welcome-card h2 { + font-size: 16px; + } + + .stat-icon { + font-size: 20px; + } + + .stat-value { + font-size: 14px; + } + + .stat-label { + font-size: 11px; + } +} + diff --git a/src/views/apartment/Add.vue b/src/views/apartment/Add.vue index ba91b8f..a2d7767 100644 --- a/src/views/apartment/Add.vue +++ b/src/views/apartment/Add.vue @@ -6,9 +6,9 @@ 添加公寓
- + - + @@ -18,7 +18,7 @@ - + 提交 重置 返回 @@ -90,7 +90,7 @@ export default { \ No newline at end of file + +.form-content { + max-width: 600px; +} + +.form-actions { + margin-top: 30px; +} + +/* 移动端适配 */ +@media screen and (max-width: 768px) { + .form-content { + max-width: 100%; + } + + .form-content .el-form-item__label { + float: none; + display: block; + text-align: left; + margin-bottom: 5px; + } + + .form-content .el-form-item__content { + margin-left: 0 !important; + } + + .form-actions { + text-align: center; + } + + .form-actions .el-button { + margin-bottom: 10px; + } +} + diff --git a/src/views/apartment/Edit.vue b/src/views/apartment/Edit.vue index 8c2d6ed..86c1b6d 100644 --- a/src/views/apartment/Edit.vue +++ b/src/views/apartment/Edit.vue @@ -6,9 +6,9 @@ 编辑公寓
- + - + @@ -18,7 +18,7 @@ - + 提交 重置 返回 @@ -103,7 +103,7 @@ export default { \ No newline at end of file + +.form-content { + max-width: 600px; +} + +.form-actions { + margin-top: 30px; +} + +/* 移动端适配 */ +@media screen and (max-width: 768px) { + .form-content { + max-width: 100%; + } + + .form-content .el-form-item__label { + float: none; + display: block; + text-align: left; + margin-bottom: 5px; + } + + .form-content .el-form-item__content { + margin-left: 0 !important; + } + + .form-actions { + text-align: center; + } + + .form-actions .el-button { + margin-bottom: 10px; + } +} + diff --git a/src/views/apartment/List.vue b/src/views/apartment/List.vue index 6eeded2..171901a 100644 --- a/src/views/apartment/List.vue +++ b/src/views/apartment/List.vue @@ -4,12 +4,14 @@ + + - + @@ -22,22 +24,55 @@ 重置 - - - - - - - - - - - - + - + - + 提交 重置 返回 @@ -84,7 +84,7 @@ export default { \ No newline at end of file + +.form-content { + max-width: 600px; +} + +.form-actions { + margin-top: 30px; +} + +/* 移动端适配 */ +@media screen and (max-width: 768px) { + .form-content { + max-width: 100%; + } + + .form-content .el-form-item__label { + float: none; + display: block; + text-align: left; + margin-bottom: 5px; + } + + .form-content .el-form-item__content { + margin-left: 0 !important; + } + + .form-actions { + text-align: center; + } + + .form-actions .el-button { + margin-bottom: 10px; + } +} + diff --git a/src/views/region/List.vue b/src/views/region/List.vue index 54f2c69..ce44097 100644 --- a/src/views/region/List.vue +++ b/src/views/region/List.vue @@ -4,24 +4,53 @@ - - - - - - - - - - -
+
状态: - - {{ getStatusText(room.status) }} - {{ getSubStatusText(room.subStatus) }} - {{ getOtherStatusText(room.otherStatus) }} + + {{ getStatusText(room.status) }} + {{ getSubStatusText(room.subStatus) }} + {{ getOtherStatusText(room.otherStatus) }}
@@ -46,37 +46,39 @@ - - - - - - - - - - - - - - - -
+
+ + + + + + + + + + + + + + + +
+
@@ -85,46 +87,51 @@
添加水费
- - - - - - - - - - - - - - - -
+
+ + + + + + + + + + + + + + + + + +
+
- - + @@ -141,7 +148,7 @@ - + @@ -153,11 +160,9 @@ - - - + @@ -205,13 +210,10 @@ export default { waterBills: [], isLoading: false, activeTab: 'rental', - // 保存返回时的查询参数 returnQuery: {}, - // 分页相关 - 租赁档案 currentPage: 1, pageSize: 10, total: 0, - // 分页相关 - 水费记录 waterCurrentPage: 1, waterPageSize: 10, waterTotal: 0, @@ -255,14 +257,21 @@ export default { } } }, + computed: { + isMobile() { + return window.innerWidth <= 768 + } + }, mounted() { - // 获取返回时的查询参数 this.returnQuery = this.$route.query this.loadData() + window.addEventListener('resize', this.handleResize) + }, + beforeDestroy() { + window.removeEventListener('resize', this.handleResize) }, watch: { activeTab: function() { - // 当tab切换时,刷新对应的数据 if (this.activeTab === 'rental') { this.loadRentalHistory() } else if (this.activeTab === 'water') { @@ -271,19 +280,16 @@ export default { } }, methods: { + handleResize() { + this.$forceUpdate() + }, async loadData() { this.isLoading = true try { const roomId = this.$route.params.id - - // 加载房间数据 const roomResponse = await roomApi.getById(roomId) this.room = roomResponse - - // 加载租赁历史 await this.loadRentalHistory() - - // 如果当前激活的是水费tab,加载水费数据 if (this.activeTab === 'water') { await this.loadWaterBills() } @@ -297,17 +303,12 @@ export default { this.isLoading = true try { const roomId = this.$route.params.id - // 调用API获取水费记录,支持分页 const response = await waterBillApi.getAll({ roomId, page: this.waterCurrentPage, pageSize: this.waterPageSize }) - - // 处理返回数据 this.waterBills = response.data || response - - // 设置总数 this.waterTotal = response.total || 0 } catch (error) { this.$message.error('加载水费记录失败') @@ -319,22 +320,13 @@ export default { this.isLoading = true try { const roomId = this.$route.params.id - // 调用API获取当前房间的租赁记录,支持分页 const response = await rentalApi.getAll({ roomId, page: this.currentPage, pageSize: this.pageSize }) - - // 处理返回数据 const data = response.data || response - this.rentalHistory = data.map(rental => { - return { - ...rental - } - }) - - // 设置总数 + this.rentalHistory = data.map(rental => ({ ...rental })) this.total = response.total || 0 } catch (error) { this.$message.error('加载租赁历史失败') @@ -433,17 +425,12 @@ export default { type: 'warning' }).then(async () => { try { - // 找到当前房间的租房记录 const roomId = this.$route.params.id const rental = this.rentalHistory.find(r => r.roomId == roomId && r.status === 'active') if (rental) { - // 更新租房记录状态 await rentalApi.update(rental.id, { status: 'expired' }) - - // 更新房间状态 await roomApi.update(roomId, { status: 'empty' }) - this.$message.success('退房成功') this.loadData() } else { @@ -453,9 +440,7 @@ export default { console.error('退房失败:', error) this.$message.error('退房失败:' + (error.message || '未知错误')) } - }).catch(() => { - // 取消退房 - }) + }).catch(() => {}) }, async handleCleaning() { this.$confirm('确定要标记为打扫中吗?', '提示', { @@ -471,9 +456,7 @@ export default { } catch (error) { this.$message.error('操作失败') } - }).catch(() => { - // 取消操作 - }) + }).catch(() => {}) }, async handleMaintenance() { this.$confirm('确定要标记为维修中吗?', '提示', { @@ -489,9 +472,7 @@ export default { } catch (error) { this.$message.error('操作失败') } - }).catch(() => { - // 取消操作 - }) + }).catch(() => {}) }, async handleComplete() { this.$confirm('确定要完成打扫/维修吗?', '提示', { @@ -507,9 +488,7 @@ export default { } catch (error) { this.$message.error('操作失败') } - }).catch(() => { - // 取消操作 - }) + }).catch(() => {}) }, handleAddWaterBill() { this.waterBillForm = { @@ -536,15 +515,10 @@ export default { try { const roomId = this.$route.params.id if (this.waterBillForm.id) { - // 更新水费记录 await waterBillApi.update(this.waterBillForm.id, this.waterBillForm) this.$message.success('水费记录更新成功') } else { - // 创建水费记录 - await waterBillApi.create({ - ...this.waterBillForm, - roomId - }) + await waterBillApi.create({ ...this.waterBillForm, roomId }) this.$message.success('水费记录添加成功') } this.waterBillDialogVisible = false @@ -566,11 +540,8 @@ export default { } catch (error) { this.$message.error('删除失败') } - }).catch(() => { - // 取消删除 - }) + }).catch(() => {}) }, - handleEditRental(rental) { this.rentalForm = { ...rental, @@ -580,19 +551,13 @@ export default { this.rentalDialogVisible = true }, handleRenewRental(rental) { - // 计算新的开始日期和结束日期 const oldEndDate = new Date(rental.endDate) const newStartDate = new Date(oldEndDate) - - // 计算租赁时长(月) const oldStartDate = new Date(rental.startDate) const monthsDiff = (oldEndDate.getFullYear() - oldStartDate.getFullYear()) * 12 + (oldEndDate.getMonth() - oldStartDate.getMonth()) - - // 计算新的结束日期 const newEndDate = new Date(newStartDate) newEndDate.setMonth(newEndDate.getMonth() + monthsDiff) - // 预填表单,保持租客信息不变,清空ID this.rentalForm = { id: '', roomId: rental.roomId, @@ -611,11 +576,9 @@ export default { async handleSaveRental() { try { if (this.rentalForm.id) { - // 更新租赁记录 await rentalApi.update(this.rentalForm.id, this.rentalForm) this.$message.success('租赁记录更新成功') } else { - // 创建租赁记录 await rentalApi.create(this.rentalForm) this.$message.success('租赁记录添加成功') } @@ -632,36 +595,22 @@ export default { type: 'danger' }).then(async () => { try { - // 先获取租赁记录的详细信息 const rental = this.rentalHistory.find(r => r.id == id) - - // 删除租赁记录 await rentalApi.delete(id) this.$message.success('租赁记录删除成功') - - // 如果是在租状态,更新房间状态为空房 if (rental && rental.status === 'active' && rental.roomId) { - await roomApi.update(rental.roomId, { - status: 'empty', - subStatus: 'normal' - }) + await roomApi.update(rental.roomId, { status: 'empty', subStatus: 'normal' }) this.$message.success('房间状态已更新为空房') } - this.loadData() } catch (error) { console.error('删除失败:', error) this.$message.error('删除失败:' + (error.message || '未知错误')) } - }).catch(() => { - // 取消删除 - }) + }).catch(() => {}) }, goBack() { - this.$router.push({ - path: '/rental/list', - query: this.returnQuery - }) + this.$router.push({ path: '/rental/list', query: this.returnQuery }) } } } @@ -669,13 +618,15 @@ export default { diff --git a/src/views/rental/List.vue b/src/views/rental/List.vue index babc3a6..7c191ac 100644 --- a/src/views/rental/List.vue +++ b/src/views/rental/List.vue @@ -6,22 +6,24 @@ 租房管理
+ + - + - + - + @@ -29,7 +31,7 @@ - + @@ -43,47 +45,50 @@ 重置 -
+ + +
-
-

{{ getApartmentName(room.apartmentId) }}

-
- {{ getSubStatusText(room.subStatus) }} - 空房 - {{ getOtherStatusText(room.otherStatus) }} -
-
-
-
- {{ room.roomNumber }} - {{ room.area }}㎡ -
- ¥{{ room.monthlyPrice }}/月 - ¥{{ room.yearlyPrice }}/年 +
+

{{ getApartmentName(room.apartmentId) }}

+
+ {{ getSubStatusText(room.subStatus) }} + 空房 + {{ getOtherStatusText(room.otherStatus) }}
-
-

租客: {{ room.Rentals[0].tenantName }}

-

租期: {{ room.Rentals[0].startDate }} 至 {{ room.Rentals[0].endDate }}

+
+
+ {{ room.roomNumber }} + {{ room.area }}㎡ +
+ ¥{{ room.monthlyPrice }}/月 + ¥{{ room.yearlyPrice }}/年 +
+
+
+

{{ room.Rentals[0].tenantName }}

+

{{ room.Rentals[0].startDate }} 至 {{ room.Rentals[0].endDate }}

+
+
+

暂无租客信息

+
-
-

暂无租客信息

-
-
- + +
- + - + @@ -176,15 +238,27 @@ export default { } } }, + computed: { + isMobile() { + return window.innerWidth <= 768 + } + }, mounted() { this.loadApartments() this.loadAllRooms() this.loadData() + window.addEventListener('resize', this.handleResize) + }, + beforeDestroy() { + window.removeEventListener('resize', this.handleResize) }, methods: { + handleResize() { + this.$forceUpdate() + }, async loadApartments() { try { - const response = await apartmentApi.getAll() + const response = await apartmentApi.list() this.apartments = response.data || response } catch (error) { this.$message.error('加载公寓数据失败') @@ -192,7 +266,7 @@ export default { }, async loadAllRooms() { try { - const response = await roomApi.getAll() + const response = await roomApi.list() this.allRooms = response.data || response } catch (error) { this.$message.error('加载房间数据失败') @@ -204,7 +278,7 @@ export default { return } try { - const response = await roomApi.getAll({ apartmentId: this.searchForm.apartmentId }) + const response = await roomApi.list({ apartmentId: this.searchForm.apartmentId }) this.rooms = response.data || response } catch (error) { this.$message.error('加载房间数据失败') @@ -353,7 +427,7 @@ export default { diff --git a/src/views/rental/WaterArchive.vue b/src/views/rental/WaterArchive.vue index 0c5787b..5c25b2c 100644 --- a/src/views/rental/WaterArchive.vue +++ b/src/views/rental/WaterArchive.vue @@ -42,49 +42,96 @@ 重置 - - - - - - - - - - - - - - - - - - - - +
+
+ 计费周期: + {{ item.startDate }} 至 {{ item.endDate }} +
+
+ 用水量: + {{ item.usage }} 吨 +
+
+ 费用: + ¥{{ item.amount }} +
+
+ 读数: + {{ item.startReading }} → {{ item.endReading }} +
+
+ 单价: + ¥{{ item.unitPrice }}/吨 +
+
+ +
+
+ +
- + @@ -163,15 +210,27 @@ export default { } } }, + computed: { + isMobile() { + return window.innerWidth <= 768 + } + }, mounted() { this.loadApartments() this.loadAllRooms() this.loadData() + window.addEventListener('resize', this.handleResize) + }, + beforeDestroy() { + window.removeEventListener('resize', this.handleResize) }, methods: { + handleResize() { + this.$forceUpdate() + }, async loadApartments() { try { - const response = await apartmentApi.getAll() + const response = await apartmentApi.list() this.apartments = response.data || response } catch (error) { this.$message.error('加载公寓数据失败') @@ -179,7 +238,7 @@ export default { }, async loadAllRooms() { try { - const response = await roomApi.getAll() + const response = await roomApi.list() this.allRooms = response.data || response } catch (error) { this.$message.error('加载房间数据失败') @@ -191,7 +250,7 @@ export default { return } try { - const response = await roomApi.getAll({ apartmentId: this.searchForm.apartmentId }) + const response = await roomApi.list({ apartmentId: this.searchForm.apartmentId }) this.rooms = response.data || response } catch (error) { this.$message.error('加载房间数据失败') @@ -325,7 +384,7 @@ export default { diff --git a/src/views/room/Add.vue b/src/views/room/Add.vue index bdd48fe..9c36ce9 100644 --- a/src/views/room/Add.vue +++ b/src/views/room/Add.vue @@ -6,9 +6,9 @@ 添加房间
- + - + @@ -25,14 +25,14 @@ - + - + @@ -40,13 +40,13 @@ - + - + 提交 重置 返回 @@ -160,7 +160,7 @@ export default { \ No newline at end of file + +.form-content { + max-width: 600px; +} + +.form-actions { + margin-top: 30px; +} + +/* 移动端适配 */ +@media screen and (max-width: 768px) { + .form-content { + max-width: 100%; + } + + .form-content .el-form-item__label { + float: none; + display: block; + text-align: left; + margin-bottom: 5px; + } + + .form-content .el-form-item__content { + margin-left: 0 !important; + } + + .form-actions { + text-align: center; + } + + .form-actions .el-button { + margin-bottom: 10px; + } +} + diff --git a/src/views/room/Edit.vue b/src/views/room/Edit.vue index fc876bf..720dc13 100644 --- a/src/views/room/Edit.vue +++ b/src/views/room/Edit.vue @@ -6,9 +6,9 @@ 编辑房间
- + - + @@ -25,14 +25,14 @@ - + - + @@ -40,13 +40,13 @@ - + - + 提交 重置 返回 @@ -74,7 +74,6 @@ export default { otherStatus: '', subStatus: 'normal' }, - // 保存返回时的查询参数 returnQuery: {}, apartments: [], rules: { @@ -125,7 +124,6 @@ export default { } }, mounted() { - // 获取返回时的查询参数 this.returnQuery = this.$route.query this.loadApartments() this.loadRoomData() @@ -183,7 +181,7 @@ export default { \ No newline at end of file + +.form-content { + max-width: 600px; +} + +.form-actions { + margin-top: 30px; +} + +/* 移动端适配 */ +@media screen and (max-width: 768px) { + .form-content { + max-width: 100%; + } + + .form-content .el-form-item__label { + float: none; + display: block; + text-align: left; + margin-bottom: 5px; + } + + .form-content .el-form-item__content { + margin-left: 0 !important; + } + + .form-actions { + text-align: center; + } + + .form-actions .el-button { + margin-bottom: 10px; + } +} + diff --git a/src/views/room/List.vue b/src/views/room/List.vue index 96de8ff..36d9eb1 100644 --- a/src/views/room/List.vue +++ b/src/views/room/List.vue @@ -4,25 +4,27 @@ + + - + - + - + @@ -30,7 +32,7 @@ - + @@ -44,45 +46,94 @@ 重置 - - - - - - - - - - - - - - - - - - - - - - -