From 448c1fae3affc4bbff3e3da350c0f31c5074511f Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: Fri, 15 Apr 2022 17:42:30 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8A=A0=E5=85=A5=E9=80=89?=
=?UTF-8?q?=E6=8B=A9=E6=88=BF=E5=B1=8B=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../chooseEnterCommunity.html | 1 +
.../property/roomTree/roomTree.html | 18 ++
.../components/property/roomTree/roomTree.js | 201 ++++++++++++++++++
.../simplifyAcceptance.html | 5 +-
.../simplifyAcceptance/simplifyAcceptance.js | 11 +
5 files changed, 235 insertions(+), 1 deletion(-)
create mode 100755 public/components/property/roomTree/roomTree.html
create mode 100755 public/components/property/roomTree/roomTree.js
diff --git a/public/components/common/chooseEnterCommunity/chooseEnterCommunity.html b/public/components/common/chooseEnterCommunity/chooseEnterCommunity.html
index a0fdcf745..7902037c0 100755
--- a/public/components/common/chooseEnterCommunity/chooseEnterCommunity.html
+++ b/public/components/common/chooseEnterCommunity/chooseEnterCommunity.html
@@ -66,5 +66,6 @@
+
\ No newline at end of file
diff --git a/public/components/property/roomTree/roomTree.html b/public/components/property/roomTree/roomTree.html
new file mode 100755
index 000000000..aad4b00c5
--- /dev/null
+++ b/public/components/property/roomTree/roomTree.html
@@ -0,0 +1,18 @@
+
+
\ No newline at end of file
diff --git a/public/components/property/roomTree/roomTree.js b/public/components/property/roomTree/roomTree.js
new file mode 100755
index 000000000..8f6ddcc5b
--- /dev/null
+++ b/public/components/property/roomTree/roomTree.js
@@ -0,0 +1,201 @@
+(function(vc){
+ let DEFAULT_PAGE = 1;
+ let DEFAULT_ROW = 10;
+ vc.extends({
+ data:{
+ roomTreeInfo: {
+ units:[],
+ callName:''
+ }
+ },
+ _initMethod:function(){
+ },
+ _initEvent:function(){
+ vc.on('roomTree','openRoomTree',function(_param){
+ $that.roomTreeInfo.callName = _param.callName;
+ $('#roomTreeModal').modal('show');
+ $that._loadRoomTreeFloorAndUnits();
+ });
+ },
+ methods:{
+ _loadRoomTreeFloorAndUnits: function() {
+
+ let param = {
+ params: {
+ communityId: vc.getCurrentCommunity().communityId
+ }
+ };
+ //发送get请求
+ vc.http.apiGet('/unit.queryUnits',
+ param,
+ function(json) {
+ let _unitInfo = JSON.parse(json);
+ $that.roomTreeInfo.units = _unitInfo;
+ $that._initJsTreeRoomTreeFloorUnit();
+ },
+ function() {
+ console.log('请求失败处理');
+ });
+ },
+ _initJsTreeRoomTreeFloorUnit: function() {
+
+ let _data = $that._doJsTreeRoomTreeData();
+
+ _data = _data.sort(function(a, b) {
+ return a.floorNum - b.floorNum
+ })
+ $.jstree.destroy()
+ $("#jstree_floorUnitRoom").jstree({
+ "checkbox": {
+ "keep_selected_style": false
+ },
+ 'state': { //一些初始化状态
+ "opened": true,
+ },
+ 'core': {
+ "check_callback": true,
+ 'data': _data
+ }
+ });
+ $("#jstree_floorUnitRoom").on("ready.jstree", function(e, data) {
+ //data.instance.open_all();//打开所有节点
+ $('#jstree_floorUnitRoom').jstree('select_node', _data[0].children[0].id /* , true */ );
+
+ });
+
+ $('#jstree_floorUnitRoom').on("changed.jstree", function(e, data) {
+ if (data.action == 'model' || data.action == 'ready') {
+ //默认合并
+ //$("#jstree_floorUnit").jstree("close_all");
+ return;
+ }
+ let _selected = data.selected[0];
+
+ if (_selected.startsWith('f_')) {
+ return;
+ }
+
+ //console.log(_selected, data.node.original.unitId)
+ if (_selected.startsWith('u_')) {
+ $that._roomTreeLoadRoom(data.node.original.unitId,data);
+ }
+
+ if(_selected.startsWith('r_')){
+ $('#roomTreeModal').modal('hide');
+ vc.emit($that.roomTreeInfo.callName, 'selectRoom', {
+ roomName: data.node.original.roomName,
+ roomId:data.node.original.roomId
+ })
+ }
+ });
+ },
+ _roomTreeLoadRoom:function(_unitId,data){
+ //获取选中的节点
+ let node = data.instance.get_node(data.selected[0]);
+ //遍历选中节点的子节点
+ let childNodes = data.instance.get_children_dom(node);
+ if(childNodes && childNodes.length>0){
+ for(var childIndex = 0; childIndex{
+ let _data = {
+ id: 'r_' + _room.roomId,
+ roomId: _room.roomId,
+ roomName:_room.floorNum+"-"+_room.unitNum+"-"+_room.roomNum,
+ text: _room.roomNum,
+ icon: "/img/unit.png",
+ };
+
+ $('#jstree_floorUnitRoom').jstree('create_node', $('#u_'+_unitId), _data, "last", false, false);
+
+ })
+ $('#jstree_floorUnitRoom').jstree('open_node', $('#u_'+_unitId));
+ },
+ function(errInfo, error) {
+ console.log('请求失败处理');
+ }
+ );
+ },
+ _doJsTreeRoomTreeData: function() {
+ let _mFloorTree = [];
+
+ let _units = $that.roomTreeInfo.units;
+
+ //构建 第一层菜单组
+ _units.forEach(pItem => {
+ let _includeFloor = false;
+ for (let _mgIndex = 0; _mgIndex < _mFloorTree.length; _mgIndex++) {
+ if (pItem.floorId == _mFloorTree[_mgIndex].floorId) {
+ _includeFloor = true;
+ }
+ }
+
+ if (!_includeFloor) {
+ let _floorItem = {
+ id: 'f_' + pItem.floorId,
+ floorId: pItem.floorId,
+ floorNum: pItem.floorNum,
+ icon: "/img/floor.png",
+ text: pItem.floorNum + "栋",
+ state: {
+ opened: false
+ },
+ children: []
+ };
+ $that._doJsTreeRoomTreeMenuData(_floorItem);
+ _mFloorTree.push(_floorItem);
+ }
+ });
+ return _mFloorTree;
+ },
+ _doJsTreeRoomTreeMenuData: function(_floorItem) {
+ let _units = $that.roomTreeInfo.units;
+ //构建菜单
+ let _children = _floorItem.children;
+ for (let _pIndex = 0; _pIndex < _units.length; _pIndex++) {
+ if (_floorItem.floorId == _units[_pIndex].floorId) {
+ let _includeMenu = false;
+ for (let _mgIndex = 0; _mgIndex < _children.length; _mgIndex++) {
+ if (_units[_pIndex].unitId == _children[_mgIndex].unitId) {
+ _includeMenu = true;
+ }
+ }
+ if (!_includeMenu) {
+ let _menuItem = {
+ id: 'u_' + _units[_pIndex].unitId,
+ unitId: _units[_pIndex].unitId,
+ text: _units[_pIndex].unitNum + "单元",
+ icon: "/img/unit.png",
+ state: {
+ opened: true
+ },
+ children: []
+ };
+ _children.push(_menuItem);
+ }
+
+ }
+ }
+ },
+ }
+
+ });
+})(window.vc);
\ No newline at end of file
diff --git a/public/pages/property/simplifyAcceptance/simplifyAcceptance.html b/public/pages/property/simplifyAcceptance/simplifyAcceptance.html
index 08087d54f..631ae9d20 100755
--- a/public/pages/property/simplifyAcceptance/simplifyAcceptance.html
+++ b/public/pages/property/simplifyAcceptance/simplifyAcceptance.html
@@ -23,7 +23,10 @@
-
diff --git a/public/pages/property/simplifyAcceptance/simplifyAcceptance.js b/public/pages/property/simplifyAcceptance/simplifyAcceptance.js
index 431304d99..db8d1bc22 100755
--- a/public/pages/property/simplifyAcceptance/simplifyAcceptance.js
+++ b/public/pages/property/simplifyAcceptance/simplifyAcceptance.js
@@ -58,6 +58,12 @@
$that.simplifyAcceptanceInfo.roomName = _room.floorNum + '栋' + _room.unitNum + '单元' + _room.roomNum;
vc.emit('simplifyRoomFee', 'switch', $that.simplifyAcceptanceInfo)
});
+ vc.on('simplifyAcceptance','selectRoom',function(_param){
+ $that.simplifyAcceptanceInfo.searchType ='1';
+ $that.simplifyAcceptanceInfo.searchValue = _param.roomName;
+ $that.simplifyAcceptanceInfo.searchPlaceholder = "请输入房屋编号 楼栋-单元-房屋 如1-1-1";
+ $that._doSearch();
+ })
},
methods: {
_changeSearchType: function () {
@@ -206,6 +212,11 @@
roomArea:'',
roomRent:''
}
+ },
+ _simplifyAcceptanceChooseRoom:function(){
+ vc.emit('roomTree','openRoomTree',{
+ callName:'simplifyAcceptance'
+ })
}
}
});