This commit is contained in:
Zy
2026-04-06 14:45:50 +08:00
commit f414026af8
373 changed files with 30667 additions and 0 deletions

View File

@@ -0,0 +1,104 @@
<template>
<div class="AddBuildingBox">
<PageHeader title="新建楼栋"></PageHeader>
<div class="AddBuildingBody">
<div class="title">基本信息</div>
<div class="addBuildingFormBody">
<el-form class="formBody" ref="formRef" :model="form" :rules="rules" label-width="100px">
<el-form-item label="楼栋名称" prop="buildingName">
<el-input v-model="form.buildingName" placeholder="请输入楼栋名称" />
</el-form-item>
<el-form-item label="楼栋朝向" prop="buildingCode">
<el-input v-model="form.buildingCode" placeholder="请输入楼栋朝向" />
</el-form-item>
<el-form-item label="楼高(m)" prop="buildingType">
<el-input v-model="form.buildingType" placeholder="请输入楼高(m)" />
</el-form-item>
<el-form-item label="楼栋结构" prop="buildingArea">
<el-input v-model="form.buildingArea" placeholder="请输入楼栋结构" />
</el-form-item>
<el-form-item label="单元数" prop="buildingAddress">
<el-input-number :min="1" v-model="form.buildingAddress" placeholder="单元数" />
</el-form-item>
<el-form-item label="楼层" prop="buildingDescription">
<el-input-number :min="1" v-model="form.buildingDescription" placeholder="楼层数" />
</el-form-item>
<el-form-item style="margin-top: 30px">
<el-button type="primary" @click="submitForm">确定</el-button>
<el-button @click="cancelForm">取消</el-button>
</el-form-item>
</el-form>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import PageHeader from '@/components/Pageheader/index.vue';
const formRef = ref();
const form = ref({
buildingName: '',
buildingCode: '',
buildingType: '',
buildingArea: '',
buildingAddress: null,
buildingDescription: null
});
const rules = ref({
buildingName: [{ required: true, message: '请输入楼栋名称', trigger: 'blur' }],
buildingAddress: [{ required: true, message: '请输入单元数', trigger: 'blur' }],
buildingDescription: [{ required: true, message: '请输入楼层', trigger: 'blur' }]
});
const submitForm = () => {
formRef.value?.validate(async (valid: boolean) => {
if (valid) {
console.log(form.value);
}
});
};
const cancelForm = () => {
console.log('取消');
};
</script>
<style scoped lang="scss">
.AddBuildingBox {
padding: 15px;
height: 100%;
width: 100%;
}
.AddBuildingBody {
margin-top: 20px;
display: flex;
flex-direction: column;
justify-content: center;
background-color: white;
padding: 15px;
.title {
height: 40px;
line-height: 40px;
padding-left: 20px;
background-color: rgba(255, 255, 255, 1);
color: rgba(16, 16, 16, 1);
border-bottom: 1px solid #bbbbbb;
margin-bottom: 60px;
}
.addBuildingFormBody {
.formBody {
width: 550px;
margin: 0 auto;
.el-form-item {
margin-bottom: 20px;
}
.el-button {
width: 80px;
height: 35px;
margin-right: 20px;
}
}
padding-bottom: 40px;
}
}
</style>

View File

@@ -0,0 +1,203 @@
<template>
<div class="AddBuildingBox">
<PageHeader title="新建楼栋"></PageHeader>
<div class="AddBuildingBody">
<div class="title">基本信息</div>
<div class="addBuildingFormBody">
<el-form class="formBody" ref="formRef" :model="form" :rules="rules" label-width="180px">
<el-form-item label="楼栋" prop="buildingID">
<el-select v-model="form.buildingID" class="m-2" placeholder="请选择" size="large">
<el-option v-for="item in building" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="单元" prop="unit">
<el-select v-model="form.unit" class="m-2" placeholder="请选择" size="large">
<el-option v-for="item in units" :key="item.no" :label="item.name" :value="item.no" />
</el-select>
</el-form-item>
<el-form-item label="楼层" prop="floor">
<el-select v-model="form.floor" class="m-2" placeholder="请选择" size="large">
<el-option v-for="item in floors" :key="item.no" :label="item.name" :value="item.no" />
</el-select>
</el-form-item>
<el-form-item label="房间号" prop="buildingName">
<el-input v-model="form.buildingName" placeholder="请输入房间号" />
</el-form-item>
<el-form-item label="建筑面积" prop="buildingArea">
<div class="unitBox flex align-center">
<el-input v-model="form.buildingArea" placeholder="请输入建筑面积" />
<span></span>
</div>
</el-form-item>
<el-form-item label="套内面积" prop="internalFloorArea">
<div class="unitBox flex align-center">
<el-input v-model="form.internalFloorArea" placeholder="请输入套内面积" />
<span></span>
</div>
</el-form-item>
<el-form-item label="公摊面积" prop="CommonArea">
<div class="unitBox flex align-center">
<el-input v-model="form.CommonArea" placeholder="请输入公摊面积" />
<span></span>
</div>
</el-form-item>
<el-form-item label="房屋户型">
<div class="houseTypebox">
<el-input v-model="housetype[0]" placeholder="室" />
<span></span>
<el-input v-model="housetype[1]" placeholder="厅" />
<span></span>
<el-input v-model="housetype[2]" placeholder="卫" />
<span></span>
</div>
</el-form-item>
<el-form-item label="车位号" prop="buildingAddress">
<el-select v-model="form.ParkingSpaceNumber" class="m-2" placeholder="请选择车位号" size="large">
<el-option v-for="item in building" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="储藏室" prop="buildingDescription">
<el-select v-model="form.storeroom" class="m-2" placeholder="请选择储藏室" size="large">
<el-option v-for="item in building" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item style="margin-top: 30px">
<el-button type="primary" @click="submitForm">确定</el-button>
<el-button @click="cancelForm">取消</el-button>
</el-form-item>
</el-form>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import PageHeader from '@/components/Pageheader/index.vue';
const formRef = ref();
const form = ref({
buildingID: '',
unit: '',
floor: '',
buildingName: '', // 房间号
buildingArea: '', //建筑面积
internalFloorArea: '', //套内面积
CommonArea: '', // 公摊面积
Housetype: '', // 房屋户型
ParkingSpaceNumber: '', // 车位号
storeroom: '' // 储藏室
});
const housetype = ref([]);
const rules = ref({
buildingID: [{ required: true, message: '请输入楼栋', trigger: 'blur' }],
unit: [{ required: true, message: '请选择单元', trigger: 'blur' }],
floor: [{ required: true, message: '请选择楼层', trigger: 'blur' }],
buildingName: [{ required: true, message: '请输入房间号', trigger: 'blur' }],
buildingArea: [{ required: true, message: '请输入建筑面积', trigger: 'blur' }],
internalFloorArea: [{ required: true, message: '请输入套内面积', trigger: 'blur' }],
CommonArea: [{ required: true, message: '请输入公摊面积', trigger: 'blur' }]
});
// 楼栋
const building = ref([
{
id: '1',
name: '1号楼'
}
]);
const units = ref([
{
no: '1',
name: '1单元'
},
{
no: '2',
name: '2单元'
}
]);
const floors = ref([
{
no: '1',
name: '1层'
},
{
no: '2',
name: '2层'
}
]);
const submitForm = () => {
formRef.value?.validate(async (valid: boolean) => {
if (valid) {
console.log(form.value);
}
});
};
const cancelForm = () => {
console.log('取消');
};
</script>
<style scoped lang="scss">
.AddBuildingBox {
padding: 15px;
height: 100%;
width: 100%;
}
.AddBuildingBody {
margin-top: 20px;
display: flex;
flex-direction: column;
justify-content: center;
background-color: white;
padding: 15px;
.title {
height: 40px;
line-height: 40px;
padding-left: 20px;
background-color: rgba(255, 255, 255, 1);
color: rgba(16, 16, 16, 1);
border-bottom: 1px solid #bbbbbb;
margin-bottom: 60px;
}
.addBuildingFormBody {
.formBody {
width: 550px;
margin: 0 auto;
.el-input {
width: 440px;
margin-right: 10px;
}
.el-form-item {
margin-bottom: 20px;
align-items: center;
}
.unitBox {
.el-input {
width: 440px;
margin-right: 10px;
}
}
.el-button {
width: 80px;
height: 35px;
margin-right: 20px;
}
.houseTypebox {
display: flex;
align-items: center;
.el-input {
width: 100px;
margin-right: 0px;
}
span {
margin: 0 20px;
}
}
}
padding-bottom: 40px;
}
}
</style>

View File

@@ -0,0 +1,107 @@
<template>
<div class="BuildingBox">
<div class="buildingheader flex align-center justify-between">
<div>楼栋</div>
<div>
<span class="pointer" @click="handleAddBuilding">+增加楼栋</span>
</div>
</div>
<ul>
<li
v-for="(item, index) in buildingList"
:class="{
active: index === activeId
}"
:key="index"
@click="checkBuilding(index)"
>
<div class="buildingname">{{ item.name }}</div>
<div class="buildactions flex align-center justify-around">
<el-icon class="pointer hover-color-blue"><Setting /></el-icon>
<el-icon class="pointer hover-color-red"><Delete /></el-icon>
</div>
</li>
</ul>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
const router = useRouter();
const activeId = ref(0);
const buildingList = ref([
{
id: 1,
name: 'a栋'
},
{
id: 2,
name: 'b栋'
},
{
id: 3,
name: 'c栋'
}
]);
const checkBuilding = (index: number) => {
activeId.value = index;
};
const handleAddBuilding = () => {
router.push({
path: '/house/addbuilding'
});
};
</script>
<style scoped lang="scss">
$primary_color: #1978fe;
.BuildingBox {
width: 220px;
height: 100%;
font-size: 14px;
background-color: #fff;
border-radius: 2px;
color: rgba(0, 0, 0, 1);
margin-right: 10px;
.buildingheader {
height: 60px;
line-height: 60px;
padding: 0 15px;
border-bottom: 1px solid #f2f2f2;
span {
color: $primary_color;
}
}
li {
height: 45px;
line-height: 45px;
color: rgba(16, 16, 16, 1);
position: relative;
cursor: pointer;
border-bottom: 1px solid #f2f2f2;
.buildingname {
text-align: center;
width: 100%;
padding: 0 20px 0 0;
}
.buildactions {
position: absolute;
right: 0;
top: 0;
width: 75px;
font-size: 15px;
padding: 15px 0;
padding-right: 10px;
color: rgba(153, 153, 153, 1);
}
&.active {
color: $primary_color;
border-bottom: 1px solid $primary_color;
}
}
}
</style>

View File

@@ -0,0 +1,81 @@
<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>
<!-- 右键菜单组件 -->
<ContextMenu ref="contextMenu" :menu="menuList" @select="handleSelect" />
</div>
</template>
<script setup lang="ts">
import ContextMenu from '@/components/ContextMenu/index.vue';
import { ref } from 'vue';
const props = defineProps<{
unit: any;
fIdx: number;
}>();
const checked = ref([]);
// 菜单
const menuList = ref([
{ label: '编辑', value: 'edit' },
{ label: '收费标准', value: 'money' },
{ label: '详情', value: 'main' },
{ label: '删除', value: 'delete' }
]);
// 菜单ref
const contextMenu = ref();
// 点击事件
const handleSelect = (val) => {
console.log('你选择了:', val);
};
function handleClick(house: any) {
checked.value = checked.value.includes(house.id) ? checked.value.filter((item) => item !== house.id) : checked.value.concat(house.id);
}
const emit = defineEmits<{
change: string[];
}>();
function handleContextMenu(e) {
console.log(e);
}
</script>
<style scoped lang="scss">
.house-list {
display: flex;
flex-wrap: wrap;
max-height: 300px;
overflow: auto;
}
.house {
width: 110px;
height: 40px;
line-height: 40px;
border: 1px solid #ddd;
border-radius: 4px;
cursor: pointer;
margin: 5px;
padding-left: 10px;
padding-top: 3px;
}
.house:hover {
background: #e8f3ff;
border-color: #409eff;
color: #409eff;
}
.house.checked {
background: #e8f3ff;
border-color: #409eff;
color: #409eff;
}
.dropdownClass {
position: absolute;
top: 0;
left: 0;
}
</style>

View File

@@ -0,0 +1,98 @@
<template>
<div class="TableBox p-5 h-full">
<el-table border :data="Array.from({ length: building.totalFloors }, (_, i) => i + 1)">
<el-table-column align="center" fixed label="楼层\单元" width="85">
<template #default="{ $index }">
<span>{{ $index + 1 }}</span>
</template>
</el-table-column>
<el-table-column min-width="160" class="column" align="center" :label="units.unitNo" v-for="(units, index) in building.units" :key="index">
<template #default="{ $index }">
<houseItem :unit="units.houses[$index]" :f-idx="$index"></houseItem>
</template>
</el-table-column>
</el-table>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import houseItem from './houseItem.vue';
import { build } from 'vite';
// 房屋信息
interface House {
id: string; // 唯一标识,如 B-1-101
roomNo: string; // 房号,如 101
checked: boolean; // 是否选中
// 可扩展:面积、户型、收费标准、状态等
}
// 单元信息
interface Unit {
id: string; // 唯一标识,如 1
unitNo: string; // 单元号,如 1单元
houses: House[][]; // 按楼层分组的房屋houses[0] 对应1楼houses[1]对应2楼...
}
// 楼栋信息
interface Building {
buildingNo: string; // 楼栋号,如 B栋
totalFloors: number; // 总楼层
units: Unit[]; // 单元列表
}
// 初始化B栋数据
const building: Building = {
buildingNo: 'B栋',
totalFloors: 5, // 总楼层
// 栋-> 单元 -> 楼 -> 房间
units: []
};
function init(length) {
const arr = Array.from({ length: length }).map((_, index) => {
return {
id: index,
unitNo: index + 1 + '单元',
// 1单元
houses: [
// 1楼
[
// 一楼房屋
{ id: 'B-3-301', roomNo: '101', checked: true },
{ id: 'B-3-302', roomNo: '102', checked: false },
{ id: 'B-3-303', roomNo: '103', checked: false },
{ id: 'B-3-304', roomNo: '104', checked: false },
{ id: 'B-3-305', roomNo: '105', checked: false },
{ id: 'B-3-306', roomNo: '106', checked: false },
{ id: 'B-3-307', roomNo: '107', checked: false },
{ id: 'B-3-308', roomNo: '108', checked: false }
],
[
{ id: 'B-1-201', roomNo: '201', checked: true },
{ id: 'B-1-202', roomNo: '202', checked: false },
{ id: 'B-1-203', roomNo: '203', checked: false },
{ id: 'B-1-204', roomNo: '204', checked: false },
{ id: 'B-1-205', roomNo: '205', checked: false },
{ id: 'B-1-206', roomNo: '206', checked: false },
{ id: 'B-1-207', roomNo: '207', checked: false },
{ id: 'B-1-208', roomNo: '208', checked: false }
]
]
};
}) as any;
console.log(arr);
building.units = arr;
}
init(20);
</script>
<style scoped lang="scss">
.TableBox {
overflow: hidden;
flex: 1;
.column {
width: 200px;
background-color: red;
}
}
</style>

View File

@@ -0,0 +1,60 @@
<template>
<div class="UnitBox">
<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>
</span>
<span class="mr-30px">楼栋朝向:西南</span>
<span class="mr-30px">楼高30</span>
<span class="mr-30px">楼栋结构框架 </span>
</div>
<div class="rightActions">
<span class="mr-20px" @click="handleAddHouse">+增加房屋</span>
<span class="mr-20px">收费标准设置</span>
<span>删除</span>
</div>
</div>
<div class="UnitBody">
<TableUnit></TableUnit>
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import TableUnit from './components/table.vue';
const router = useRouter();
function handleAddHouse() {
console.log('add house');
router.push({
path: '/house/addHouse'
});
}
</script>
<style scoped lang="scss">
$primary_color: #1978fe;
.UnitBox {
flex: 1;
height: 100%;
max-width: 100%;
border-radius: 2px;
font-size: 14px;
background-color: #fff;
display: flex;
flex-direction: column;
overflow: hidden;
.Unit_top {
padding: 20px;
height: 60px;
color: rgba(102, 102, 102, 1);
.rightActions {
color: $primary_color;
}
}
.UnitBody {
flex: 1;
}
}
</style>

View File

@@ -0,0 +1,80 @@
<template>
<div class="p-2 houselist">
<PageHeader>
<template #content>
<div class="houseAdressBox">
<span class="mr-50px">当前小区北境碧桂园小区</span>
<span>小区地址北境朝北市塔里克儿大道368号</span>
</div>
<div class="houseTypeBox flex">
<div
class="housetype"
:class="{
active: active === index
}"
@click="changeHouseType(index)"
v-for="(house, index) in housetypelist"
:key="index"
>
{{ house }}
</div>
</div>
</template>
</PageHeader>
<div class="houseBody mt-10px w-full flex align-center justify-center">
<building></building>
<unit></unit>
</div>
</div>
</template>
<script setup name="Houselist" lang="ts">
import building from './components/building.vue';
import unit from './components/unit.vue';
import PageHeader from '@/components/Pageheader/index.vue';
const housetypelist = ['住宅', '办公', '商用', '公寓'];
const active = ref(0);
const changeHouseType = (index: number) => {
active.value = index;
};
</script>
<style lang="scss" scoped>
.houselist {
flex: 1;
box-sizing: border-box;
height: calc(100vh - 84px);
min-height: calc(100vh - 84px);
.houseBody {
height: calc(100% - 200px);
}
}
.houseAdressBox {
margin-top: 25px;
height: 20px;
line-height: 20px;
color: rgba(102, 102, 102, 1);
font-size: 14px;
}
.houseTypeBox {
margin-top: 20px;
.housetype {
$activeColor: rgba(26, 117, 255, 1);
cursor: pointer;
width: 100px;
height: 40px;
line-height: 20px;
background-color: rgba(255, 255, 255, 1);
font-size: 14px;
text-align: center;
border: 1px solid transparent;
margin-left: -1px;
&:hover,
&.active {
color: $activeColor;
border-bottom-color: $activeColor;
}
}
}
</style>

View File