临时
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
:key="index"
|
||||
@click="switchBuilding(item.id)"
|
||||
>
|
||||
<div class="buildingname">{{ item.villageName ?? '未知' }}</div>
|
||||
<div class="buildingname">{{ item.buildingName ?? '测试数据' }}</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>
|
||||
@@ -26,13 +26,12 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { useHouseStore } from '@/store/modules/house';
|
||||
const houseStore = useHouseStore();
|
||||
const { switchBuilding } = houseStore; // 方法
|
||||
const { currentBuildingInfoList, currentBuildingInfo } = storeToRefs(houseStore); // 数据
|
||||
const router = useRouter();
|
||||
|
||||
console.log(currentBuildingInfoList);
|
||||
const handleAddBuilding = () => {
|
||||
router.push({
|
||||
path: '/house/addbuilding'
|
||||
|
||||
@@ -25,8 +25,8 @@ const checked = ref<string[]>([]);
|
||||
// 菜单ref
|
||||
const contextMenu = ref();
|
||||
// 点击事件
|
||||
const handleSelect = (val: string) => {
|
||||
emit('contextmenufun', val);
|
||||
const handleSelect = (data: { type: string; value: string }) => {
|
||||
emit('contextmenufun', data);
|
||||
};
|
||||
function handleClick(house: HouseType) {
|
||||
checked.value = checked.value.includes(house.houseId)
|
||||
@@ -37,7 +37,7 @@ function handleClick(house: HouseType) {
|
||||
|
||||
const emit = defineEmits<{
|
||||
change: [value: string[]];
|
||||
contextmenufun: [value: string];
|
||||
contextmenufun: [value: { type: string; value: string }];
|
||||
}>();
|
||||
</script>
|
||||
|
||||
|
||||
@@ -15,7 +15,13 @@
|
||||
:key="index"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<houseItem :menu-list="menutlist" :unit="units.floors_Json" :f-idx="row"></houseItem>
|
||||
<houseItem
|
||||
@contextmenufun="contextMenuFun"
|
||||
@change="handleChange"
|
||||
:menu-list="menutlist"
|
||||
:unit="units.floors_Json"
|
||||
:f-idx="row"
|
||||
></houseItem>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -33,6 +39,26 @@ const menutlist = [
|
||||
{ label: '详情', value: 'main' },
|
||||
{ label: '删除', value: 'delete' }
|
||||
];
|
||||
function contextMenuFun(val: { type: string; value: string }) {
|
||||
switch (val.type) {
|
||||
case 'edit':
|
||||
console.log('你选择了:', val);
|
||||
break;
|
||||
case 'money':
|
||||
console.log('你选择了:', val);
|
||||
break;
|
||||
case 'main':
|
||||
console.log('你选择了:', val);
|
||||
break;
|
||||
case 'delete':
|
||||
console.log('你选择了:', val);
|
||||
houseStore.deleteHouseFun(val.value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
function handleChange(data: string[]) {
|
||||
houseStore.checkoutHousesFun(data);
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
Reference in New Issue
Block a user