临时添加
This commit is contained in:
@@ -58,8 +58,8 @@ const { t } = useI18n();
|
||||
|
||||
const loginForm = ref<LoginData>({
|
||||
tenantId: '000000',
|
||||
username: 'admin',
|
||||
password: 'admin123',
|
||||
username: '',
|
||||
password: '',
|
||||
rememberMe: false,
|
||||
code: '',
|
||||
uuid: ''
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user