临时添加

This commit is contained in:
Zy
2026-04-08 08:56:37 +08:00
parent b87a594d4e
commit dc3080db32
7 changed files with 88 additions and 79 deletions

View File

@@ -1,7 +1,7 @@
# 页面标题
VITE_APP_TITLE = RuoYi-Vue-Plus多租户管理系统
VITE_APP_LOGO_TITLE = RuoYi-Vue-Plus
VITE_APP_TITLE = 智慧物业后台管理系统
VITE_APP_LOGO_TITLE = 智慧物业后台管理系统
# 生产环境配置
VITE_APP_ENV = 'production'
@@ -15,7 +15,7 @@ VITE_APP_MONITOR_ADMIN = '/admin/applications'
VITE_APP_SNAILJOB_ADMIN = '/snail-job'
# 生产环境
VITE_APP_BASE_API = '/prod-api'
VITE_APP_BASE_API = 'http://wuyeadmin.bugtc.com/'
# 是否在打包时开启压缩,支持 gzip 和 brotli
VITE_BUILD_COMPRESS = gzip

View File

@@ -60,6 +60,6 @@ export interface FloorsType {
}
// 房间
export interface HouseType {
houseId: number;
houseId: string;
houseNo: string;
}

View File

@@ -3,7 +3,19 @@ import { communitylist_rows_type } from '@/api/system/community/type';
import { getBuildinglistAPI, getHouselistAPI } from '@/api/system/house';
import { BuildingUnit, BuildingVo } from '@/api/system/house/type';
import { defineStore } from 'pinia';
// 数字排序
function sortNumberStr(a: string, b: string) {
const numA = parseFloat(a);
const numB = parseFloat(b);
// 如果都是有效数字 → 按数字大小排(支持负数、小数)
if (!isNaN(numA) && !isNaN(numB)) {
return numA - numB;
}
// 否则按自然语言排
return a.localeCompare(b, 'zh-CN', { numeric: true });
}
export const useHouseStore = defineStore('house', () => {
// 当前小区信息
const currentVilageInfo = ref<communitylist_rows_type>();
@@ -11,13 +23,32 @@ export const useHouseStore = defineStore('house', () => {
// 当前小区 所有楼栋信息
const currentBuildingInfoList = ref<BuildingVo[]>([]);
// 当前楼栋信息
const currentBuildingInfo = ref<BuildingVo>();
const currentBuildingInfo = ref<BuildingVo>({
'id': null,
'villageId': null,
'villageName': '',
'buildingName': '',
'buildingUse': null,
'buildToward': '',
'buildTall': '',
'buildStructure': '',
'unitCount': null,
'floorCount': null,
'remark': ''
});
// 当前楼栋 所有房屋信息
const currentHouseInfoList = ref<BuildingUnit[]>([]);
// 当前楼栋 所有楼层数据
const currentFloorInfoList = ref<string[]>([]);
// 最大楼层
const maxFloors = ref(0);
// 楼层列表 set
const floorslist = ref<Set<string>>(new Set());
// 初始化
const initHouse = async (buildingtype: number) => {
// 查找当前小区
const res = await getCommunitylistAPI();
const currentVilage = res.rows.find((item) => item.choiceStatus === 0);
currentVilageInfo.value = currentVilage;
@@ -26,9 +57,20 @@ export const useHouseStore = defineStore('house', () => {
currentBuildingInfoList.value = res2.data;
// 获取当前小区 楼栋信息
currentBuildingInfo.value = res2.data[0];
console.log(currentBuildingInfo.value);
// 获取当前楼栋 所有房屋信息
const res3 = await getHouselistAPI(currentBuildingInfo.value.id);
currentHouseInfoList.value = res3.data;
currentHouseInfoList.value.forEach((item) => {
maxFloors.value = Math.max(maxFloors.value, item.actualFloorCount);
item.floors_Json = JSON.parse(`[${item.floors.replaceAll('\\', '')}]`);
item.floors_Json.forEach((floor) => {
floorslist.value.add(floor.floorNo);
});
});
// 对当前小区的 楼层进行排序
currentFloorInfoList.value = (Array.from(floorslist.value) as string[]).sort(sortNumberStr);
};
// 切换住宅类型
@@ -48,6 +90,7 @@ export const useHouseStore = defineStore('house', () => {
currentBuildingInfoList,
currentBuildingInfo,
currentHouseInfoList,
currentFloorInfoList,
initHouse,
switchHouseType,
switchBuilding

View File

@@ -58,8 +58,8 @@ const { t } = useI18n();
const loginForm = ref<LoginData>({
tenantId: '000000',
username: 'admin',
password: 'admin123',
username: '',
password: '',
rememberMe: false,
code: '',
uuid: ''

View File

@@ -1,7 +1,7 @@
<template>
<div class="house-list">
<div class="house flex align-center" @contextmenu="contextMenu.open($event, house.id)" v-for="house in unit" :key="house.id">
<el-checkbox @click="handleClick(house)" :label="house.id" :value="house.id" />
<div class="house flex align-center" @contextmenu="contextMenu.open($event, house.houseId)" v-for="house in list.houses" :key="house.houseId">
<el-checkbox @click="handleClick(house)" :label="house.houseNo" :value="house.houseId" />
</div>
<!-- 右键菜单组件 -->
<ContextMenu ref="contextMenu" :menu="menuList" @select="handleSelect" />
@@ -11,45 +11,33 @@
<script setup lang="ts">
import ContextMenu from '@/components/ContextMenu/index.vue';
import { ref } from 'vue';
import type { FloorsType, HouseType } from '@/api/system/house/type';
const props = defineProps<{
unit: any;
fIdx: number;
unit: FloorsType[];
fIdx: string;
menuList: {
label: string;
value: string;
}[];
}>();
const houstlist = ref([]);
props.unit;
const router = useRouter();
const checked = ref([]);
// 菜单
const menuList = ref([
{ label: '编辑', value: 'edit' },
{ label: '收费标准', value: 'money' },
{ label: '详情', value: 'main' },
{ label: '删除', value: 'delete' }
]);
const list = props.unit.find((item) => item.floorNo === props.fIdx);
const checked = ref<string[]>([]);
// 菜单ref
const contextMenu = ref();
// 点击事件
const handleSelect = (val) => {
switch (val) {
case 'edit':
break;
case 'money':
break;
case 'main':
router.push({
path: '/house/houseDetails'
});
break;
case 'delete':
break;
}
const handleSelect = (val: string) => {
emit('contextmenufun', val);
};
function handleClick(house: any) {
checked.value = checked.value.includes(house.id) ? checked.value.filter((item) => item !== house.id) : checked.value.concat(house.id);
function handleClick(house: HouseType) {
checked.value = checked.value.includes(house.houseId)
? checked.value.filter((item) => item !== house.houseId)
: checked.value.concat(house.houseId);
emit('change', checked.value);
}
const emit = defineEmits<{
change: string[];
change: [value: string[]];
contextmenufun: [value: string];
}>();
</script>

View File

@@ -1,8 +1,8 @@
<template>
<div class="TableBox p-5 h-full">
<el-table border :data="floorsSortList">
<el-table border :data="currentFloorInfoList">
<el-table-column align="center" fixed label="楼层\单元" width="85">
<template #default="{ $index, row }">
<template #default="{ row }">
<span>{{ row }}</span>
</template>
</el-table-column>
@@ -10,12 +10,12 @@
min-width="160"
class="column"
align="center"
:label="units.buildingName"
:label="`${units.unitNo}单元`"
v-for="(units, index) in currentHouseInfoList"
:key="index"
>
<template #default="{ $index, row }">
<houseItem :unit="units.floors_Json" :f-idx="row"></houseItem>
<template #default="{ row }">
<houseItem :menu-list="menutlist" :unit="units.floors_Json" :f-idx="row"></houseItem>
</template>
</el-table-column>
</el-table>
@@ -23,40 +23,16 @@
</template>
<script setup lang="ts">
import { ref } from 'vue';
import houseItem from './houseItem.vue';
import { useHouseStore } from '@/store/modules/house';
const houseStore = useHouseStore();
const { currentHouseInfoList } = storeToRefs(houseStore); // 数据
console.log(currentHouseInfoList);
const maxFloors = ref(0);
const maxUnits = ref(currentHouseInfoList.value.length);
const floorslist = ref(new Set());
const floorsSortList = computed(() => {
const list = Array.from(floorslist.value) as string[];
return list.sort(sortNumberStr);
});
function sortNumberStr(a, b) {
const numA = parseFloat(a);
const numB = parseFloat(b);
// 如果都是有效数字 → 按数字大小排(支持负数、小数)
if (!isNaN(numA) && !isNaN(numB)) {
return numA - numB;
}
// 否则按自然语言排
return a.localeCompare(b, 'zh-CN', { numeric: true });
}
currentHouseInfoList.value.forEach((item) => {
maxFloors.value = Math.max(maxFloors.value, item.actualFloorCount);
item.floors_Json = JSON.parse(`[${item.floors.replaceAll('\\', '')}]`);
console.log(item.floors_Json);
item.floors_Json.forEach((floor) => {
floorslist.value.add(floor.floorNo);
});
});
const { currentHouseInfoList, currentFloorInfoList } = storeToRefs(houseStore); // 数据
const menutlist = [
{ label: '编辑', value: 'edit' },
{ label: '收费标准', value: 'money' },
{ label: '详情', value: 'main' },
{ label: '删除', value: 'delete' }
];
</script>
<style scoped lang="scss">

View File

@@ -3,11 +3,11 @@
<div class="Unit_top flex align-center justify-between">
<div>
<span class="text-size-16px text-color-black text-widget-bold mr-30px">
<strong>B栋</strong>
<strong>{{ houseStore.currentBuildingInfo.buildingName }}</strong>
</span>
<span class="mr-30px">楼栋朝向:西南</span>
<span class="mr-30px">楼高30</span>
<span class="mr-30px">楼栋结构框架 </span>
<span class="mr-30px">楼栋朝向:{{ houseStore.currentBuildingInfo.buildToward }}</span>
<span class="mr-30px">楼高{{ houseStore.currentBuildingInfo.buildTall }}</span>
<span class="mr-30px">楼栋结构{{ houseStore.currentBuildingInfo.buildStructure }} </span>
</div>
<div class="rightActions">
<span class="mr-20px" @click="handleAddHouse">+增加房屋</span>
@@ -24,6 +24,8 @@
<script setup lang="ts">
import { ref } from 'vue';
import TableUnit from './components/table.vue';
import { useHouseStore } from '@/store/modules/house';
const houseStore = useHouseStore();
const router = useRouter();
function handleAddHouse() {
router.push({