mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-02-24 21:59:12 +08:00
优化房屋产权
This commit is contained in:
parent
8fc7c7915a
commit
20ddb87696
@ -1,151 +0,0 @@
|
||||
<template>
|
||||
<el-card class="tree-card">
|
||||
<el-tree
|
||||
ref="tree"
|
||||
:data="treeData"
|
||||
:props="defaultProps"
|
||||
node-key="id"
|
||||
:default-expanded-keys="expandedKeys"
|
||||
:highlight-current="true"
|
||||
@node-click="handleNodeClick"
|
||||
>
|
||||
<template #default="{ node, data }">
|
||||
<span class="custom-tree-node">
|
||||
<img :src="data.icon" class="tree-icon" v-if="data.icon">
|
||||
<span>{{ node.label }}</span>
|
||||
</span>
|
||||
</template>
|
||||
</el-tree>
|
||||
<div v-if="!treeData || treeData.length === 0" class="no-data">
|
||||
{{ $t('floorUnitTree.noBuilding') }}
|
||||
</div>
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { queryFloorAndUnits } from '@/api/car/carStructureApi'
|
||||
import { getCommunityId } from '@/api/community/communityApi'
|
||||
|
||||
export default {
|
||||
name: 'FloorUnitTree',
|
||||
props: {
|
||||
floorId: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
treeData: [],
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'text'
|
||||
},
|
||||
expandedKeys: [],
|
||||
communityId: ''
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
floorId(newVal) {
|
||||
this.$nextTick(() => {
|
||||
if (newVal) {
|
||||
const node = this.$refs.tree.getNode('f_' + newVal)
|
||||
if (node) {
|
||||
this.$refs.tree.setCurrentKey(node.key)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.communityId = getCommunityId()
|
||||
this.loadFloorAndUnits()
|
||||
},
|
||||
methods: {
|
||||
async loadFloorAndUnits() {
|
||||
try {
|
||||
const params = {
|
||||
communityId: this.communityId
|
||||
}
|
||||
const data = await queryFloorAndUnits(params)
|
||||
this.treeData = this.formatTreeData(data)
|
||||
this.setDefaultExpanded()
|
||||
} catch (error) {
|
||||
this.$message.error(this.$t('floorUnitTree.fetchError'))
|
||||
}
|
||||
},
|
||||
formatTreeData(data) {
|
||||
const formattedData = []
|
||||
const floorMap = {}
|
||||
|
||||
// First pass: create floor nodes
|
||||
data.forEach(item => {
|
||||
if (!floorMap[item.floorId]) {
|
||||
floorMap[item.floorId] = {
|
||||
id: 'f_' + item.floorId,
|
||||
floorId: item.floorId,
|
||||
floorNum: item.floorNum,
|
||||
icon: require('@/assets/img/floor.png'),
|
||||
text: `${item.floorNum}${this.$t('floorUnitTree.building')}(${item.floorName})`,
|
||||
children: []
|
||||
}
|
||||
formattedData.push(floorMap[item.floorId])
|
||||
}
|
||||
|
||||
// Add unit if it exists and not '0'
|
||||
if (item.unitId && item.unitNum !== '0') {
|
||||
floorMap[item.floorId].children.push({
|
||||
id: 'u_' + item.unitId,
|
||||
unitId: item.unitId,
|
||||
text: `${item.unitNum}${this.$t('floorUnitTree.unit')}`,
|
||||
icon: require('@/assets/img/unit.png')
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
return formattedData
|
||||
},
|
||||
setDefaultExpanded() {
|
||||
if (this.treeData.length > 0) {
|
||||
this.expandedKeys = [this.treeData[0].id]
|
||||
}
|
||||
},
|
||||
handleNodeClick(data) {
|
||||
if (data.id.startsWith('f_')) {
|
||||
this.$emit('switchFloor', { floorId: data.floorId })
|
||||
} else if (data.id.startsWith('u_')) {
|
||||
this.$emit('switchUnit', { unitId: data.unitId })
|
||||
}
|
||||
},
|
||||
refreshTree(params) {
|
||||
if (params && params.floorId) {
|
||||
this.floorId = params.floorId
|
||||
}
|
||||
this.loadFloorAndUnits()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.tree-card {
|
||||
height: 100%;
|
||||
|
||||
.custom-tree-node {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.tree-icon {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.no-data {
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
color: #909399;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -114,30 +114,32 @@ export default {
|
||||
this.visible = true
|
||||
},
|
||||
loadPhotos() {
|
||||
setTimeout(() => {
|
||||
if (this.editPropertyRightRegistrationDetailInfo.securities === '001' && this.editPropertyRightRegistrationDetailInfo.idCardUrl) {
|
||||
const urls = this.editPropertyRightRegistrationDetailInfo.idCardUrl.trim()
|
||||
const urls = this.editPropertyRightRegistrationDetailInfo.idCardUrl
|
||||
if (urls) {
|
||||
this.$refs.idCardUpload.setImages(urls.split(','))
|
||||
}
|
||||
}
|
||||
if (this.editPropertyRightRegistrationDetailInfo.securities === '002' && this.editPropertyRightRegistrationDetailInfo.housePurchaseUrl) {
|
||||
const urls = this.editPropertyRightRegistrationDetailInfo.housePurchaseUrl.trim()
|
||||
const urls = this.editPropertyRightRegistrationDetailInfo.housePurchaseUrl
|
||||
if (urls) {
|
||||
this.$refs.housePurchaseUpload.setImages(urls.split(','))
|
||||
}
|
||||
}
|
||||
if (this.editPropertyRightRegistrationDetailInfo.securities === '003' && this.editPropertyRightRegistrationDetailInfo.repairUrl) {
|
||||
const urls = this.editPropertyRightRegistrationDetailInfo.repairUrl.trim()
|
||||
const urls = this.editPropertyRightRegistrationDetailInfo.repairUrl
|
||||
if (urls) {
|
||||
this.$refs.repairUpload.setImages(urls.split(','))
|
||||
}
|
||||
}
|
||||
if (this.editPropertyRightRegistrationDetailInfo.securities === '004' && this.editPropertyRightRegistrationDetailInfo.deedTaxUrl) {
|
||||
const urls = this.editPropertyRightRegistrationDetailInfo.deedTaxUrl.trim()
|
||||
const urls = this.editPropertyRightRegistrationDetailInfo.deedTaxUrl
|
||||
if (urls) {
|
||||
this.$refs.deedTaxUpload.setImages(urls.split(','))
|
||||
this.$refs.deedTaxUpload.setImages(urls.split(','))
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 1000)
|
||||
},
|
||||
handleIdCardImageChange(photos) {
|
||||
this.editPropertyRightRegistrationDetailInfo.idCardPhotos = photos
|
||||
|
||||
@ -48,6 +48,13 @@ export default {
|
||||
refreshTree(param) {
|
||||
this.handleRefreshTree(param)
|
||||
},
|
||||
selectFirstUnit(){
|
||||
if(this.treeData.length > 0){
|
||||
this.handleNodeClick(this.treeData[0].children[0])
|
||||
// 并且展开
|
||||
|
||||
}
|
||||
},
|
||||
handleRefreshTree(param) {
|
||||
if (param) {
|
||||
this.currentFloorId = param.floorId
|
||||
|
||||
@ -46,6 +46,9 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.communityId = getCommunityId()
|
||||
setTimeout(() => {
|
||||
this.$refs.floorUnitTree.selectFirstUnit()
|
||||
}, 1000)
|
||||
},
|
||||
methods: {
|
||||
switchFloorUnit(data) {
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
<template>
|
||||
<div class="property-right-detail-container">
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<div class="card-header">
|
||||
<div slot="header" class="flex justify-between">
|
||||
<div>
|
||||
<span>{{ listPropertyRightRegistrationDetailInfo.conditions.floorNum }}-{{
|
||||
listPropertyRightRegistrationDetailInfo.conditions.unitNum }}-{{
|
||||
@ -15,7 +14,7 @@
|
||||
<span>{{ $t('common.back') }}</span>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<el-table :data="listPropertyRightRegistrationDetailInfo.propertyRightRegistrationDetails" border
|
||||
|
||||
@ -305,7 +305,7 @@ export default {
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.property-right-registration-container {
|
||||
padding: 0;
|
||||
padding: 10px;
|
||||
margin: 0;
|
||||
|
||||
.search-wrapper {
|
||||
|
||||
@ -70,6 +70,9 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.communityId = getCommunityId()
|
||||
setTimeout(() => {
|
||||
this.$refs.floorUnitTree.selectFirstUnit()
|
||||
}, 1500)
|
||||
},
|
||||
methods: {
|
||||
handleSwitchUnit(params) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user