| | |
| | | */ |
| | | vc.on('roomTreeDiv', 'initRoomTreeDiv', function (_param) { |
| | | // 设置调用名称 |
| | | $that.roomTreeDivInfo.callName = _param.callName; |
| | | vc.component.roomTreeDivInfo.callName = _param.callName; |
| | | // 加载楼层和单元 |
| | | $that._loadRoomTreeDivFloorAndUnits(); |
| | | vc.component._loadRoomTreeDivFloorAndUnits(); |
| | | }); |
| | | }, |
| | | /** |
| | |
| | | console.log('当前社区ID:', communityId); |
| | | if (!communityId) { |
| | | console.error('未获取到有效的社区ID'); |
| | | $that.roomTreeDivInfo.units = []; |
| | | $that._initJsTreeRoomTreeDivFloorUnit(); |
| | | vc.component.roomTreeDivInfo.units = []; |
| | | vc.component._initJsTreeRoomTreeDivFloorUnit(); |
| | | return; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | console.log('最终处理后的单元数据:', unitsData); |
| | | $that.roomTreeDivInfo.units = unitsData; |
| | | vc.component.roomTreeDivInfo.units = unitsData; |
| | | |
| | | // 初始化树结构 |
| | | $that._initJsTreeRoomTreeDivFloorUnit(); |
| | | vc.component._initJsTreeRoomTreeDivFloorUnit(); |
| | | }, |
| | | /** |
| | | * 请求失败回调 |
| | |
| | | function (errInfo, error) { |
| | | console.error('获取单元数据失败:', errInfo, error); |
| | | // 重置 units 为空数组 |
| | | $that.roomTreeDivInfo.units = []; |
| | | vc.component.roomTreeDivInfo.units = []; |
| | | // 初始化树结构 |
| | | $that._initJsTreeRoomTreeDivFloorUnit(); |
| | | vc.component._initJsTreeRoomTreeDivFloorUnit(); |
| | | }); |
| | | }, |
| | | /** |
| | |
| | | */ |
| | | _initJsTreeRoomTreeDivFloorUnit: function () { |
| | | // 构建树数据 |
| | | let _data = $that._doJsTreeRoomTreeDivData(); |
| | | let _data = vc.component._doJsTreeRoomTreeDivData(); |
| | | // 销毁旧的树实例 |
| | | $.jstree.destroy() |
| | | // 初始化新的树实例 |
| | |
| | | */ |
| | | $("#jstree_floorUnitRoomDiv").on("ready.jstree", function (e, data) { |
| | | // 获取调用名称 |
| | | let _callName = $that.roomTreeDivInfo.callName; |
| | | let _callName = vc.component.roomTreeDivInfo.callName; |
| | | // 如果是欠费可调用,直接返回 |
| | | if (_callName == 'oweFeeCallable') { |
| | | return; |
| | |
| | | |
| | | // 如果提取到unitId,调用加载房间列表方法 |
| | | if (unitId) { |
| | | $that._roomTreeDivLoadRoom(unitId, data); |
| | | vc.component._roomTreeDivLoadRoom(unitId, data); |
| | | } |
| | | } |
| | | |
| | |
| | | // 房间名称格式:房间号(业主姓名),例如:101(张三) |
| | | let roomName = data.node.text; |
| | | |
| | | // 从节点data属性获取完整的房间信息 |
| | | let roomData = data.node.data || {}; |
| | | |
| | | // 构建完整的房间信息对象 |
| | | let roomInfo = { |
| | | roomName: roomData.roomName || roomName, |
| | | roomId: roomId, |
| | | ownerId: roomData.ownerId || '', |
| | | ownerName: roomData.ownerName || '', |
| | | floorNum: roomData.floorNum || '', |
| | | unitNum: roomData.unitNum || '', |
| | | roomNum: roomData.roomNum || '', |
| | | roomType: roomData.roomType || '', |
| | | builtUpArea: roomData.builtUpArea || 0 |
| | | }; |
| | | |
| | | // 打印房间信息,用于调试 |
| | | console.log('Room info:', {roomName, roomId}); |
| | | console.log('Selected room info:', roomInfo); |
| | | |
| | | // 如果提取到roomId,触发selectRoom事件 |
| | | if (roomId) { |
| | |
| | | * 1. 设置 conditions.objId = roomId |
| | | * 2. 当objId存在时,抄表按钮(v-if="meterWaterManageInfo.conditions.objId")会显示 |
| | | */ |
| | | vc.emit($that.roomTreeDivInfo.callName, 'selectRoom', { |
| | | roomName: roomName, // 房间名称 |
| | | roomId: roomId // 房间ID |
| | | }); |
| | | vc.emit(vc.component.roomTreeDivInfo.callName, 'selectRoom', roomInfo); |
| | | } |
| | | } |
| | | }); |
| | |
| | | icon: "/img/room.png", |
| | | data: { |
| | | roomId: _room.roomId, |
| | | roomName: _room.floorNum + "-" + _room.unitNum + "-" + _room.roomNum |
| | | roomName: _room.floorNum + "-" + _room.unitNum + "-" + _room.roomNum, |
| | | ownerId: _room.ownerId || '', |
| | | ownerName: _room.ownerName || '', |
| | | floorNum: _room.floorNum || '', |
| | | unitNum: _room.unitNum || '', |
| | | roomNum: _room.roomNum || '', |
| | | roomType: _room.roomType || '', |
| | | builtUpArea: _room.builtUpArea || 0 |
| | | } |
| | | }; |
| | | // 添加到房间数据数组 |
| | |
| | | // 如果有房间数据,默认选中第一个房间 |
| | | if (listRoomData.rooms.length > 0) { |
| | | let _firstRoom = listRoomData.rooms[0]; |
| | | vc.emit($that.roomTreeDivInfo.callName, 'selectRoom', { |
| | | // 构建完整的房间信息对象 |
| | | let roomInfo = { |
| | | roomName: _firstRoom.floorNum + "-" + _firstRoom.unitNum + "-" + _firstRoom.roomNum, |
| | | roomId: _firstRoom.roomId |
| | | }); |
| | | roomId: _firstRoom.roomId, |
| | | ownerId: _firstRoom.ownerId || '', |
| | | ownerName: _firstRoom.ownerName || '', |
| | | floorNum: _firstRoom.floorNum || '', |
| | | unitNum: _firstRoom.unitNum || '', |
| | | roomNum: _firstRoom.roomNum || '', |
| | | roomType: _firstRoom.roomType || '', |
| | | builtUpArea: _firstRoom.builtUpArea || 0 |
| | | }; |
| | | console.log('Selected room info:', roomInfo); |
| | | vc.emit(vc.component.roomTreeDivInfo.callName, 'selectRoom', roomInfo); |
| | | } else { |
| | | // 如果没有房间数据,发送空房间信息 |
| | | vc.emit($that.roomTreeDivInfo.callName, 'selectRoom', { |
| | | vc.emit(vc.component.roomTreeDivInfo.callName, 'selectRoom', { |
| | | roomName: '', |
| | | roomId: '' |
| | | roomId: '', |
| | | ownerId: '', |
| | | ownerName: '', |
| | | floorNum: '', |
| | | unitNum: '', |
| | | roomNum: '', |
| | | roomType: '', |
| | | builtUpArea: 0 |
| | | }); |
| | | } |
| | | } |
| | |
| | | * 单元列表 |
| | | * @type {Array} |
| | | */ |
| | | let _units = $that.roomTreeDivInfo.units || []; |
| | | let _units = vc.component.roomTreeDivInfo.units || []; |
| | | // 构建第一层菜单组 |
| | | _units.forEach(pItem => { |
| | | if (!pItem) return; |
| | |
| | | let _includeFloor = false; |
| | | // 检查是否已包含该楼层 |
| | | for (let _mgIndex = 0; _mgIndex < _mFloorTree.length; _mgIndex++) { |
| | | if (pItem.floorId == _mFloorTree[_mgIndex].floorId) { |
| | | if (pItem.floorId == _mFloorTree[_mgIndex].data.floorId) { |
| | | _includeFloor = true; |
| | | } |
| | | } |
| | |
| | | } |
| | | }; |
| | | // 构建楼层下的单元数据 |
| | | $that._doJsTreeRoomTreeDivMenuData(_floorItem); |
| | | vc.component._doJsTreeRoomTreeDivMenuData(_floorItem); |
| | | // 添加楼层节点到树数据 |
| | | _mFloorTree.push(_floorItem); |
| | | } |
| | |
| | | * 单元列表 |
| | | * @type {Array} |
| | | */ |
| | | let _units = $that.roomTreeDivInfo.units || []; |
| | | let _units = vc.component.roomTreeDivInfo.units || []; |
| | | /** |
| | | * 子节点列表 |
| | | * @type {Array} |