优化代码

This commit is contained in:
java110 2022-07-21 19:50:30 +08:00
parent 664dd3e41d
commit 13697edbde
4 changed files with 1752 additions and 21 deletions

8
app.js
View File

@ -31,8 +31,8 @@ let opts = {
}
app.use('/callComponent', proxy('http://192.168.100.108:8008', opts));
app.use('/app', proxy('http://192.168.100.108:8008', opts));
// app.use('/callComponent', proxy('http://192.168.100.108:8008', opts));
// app.use('/app', proxy('http://192.168.100.108:8008', opts));
// app.use('/callComponent', proxy('http://127.0.0.1:8008', opts));
@ -41,8 +41,8 @@ app.use('/app', proxy('http://192.168.100.108:8008', opts));
// app.use('/callComponent',proxy('http://192.168.1.106:8012',opts));
// app.use('/app',proxy('http://192.168.1.106:8012',opts));
//app.use('/callComponent',proxy('http://192.168.1.16:8012',opts));
//app.use('/app',proxy('http://192.168.1.16:8012',opts));
app.use('/callComponent', proxy('http://47.106.15.126:8088', opts));
app.use('/app', proxy('http://47.106.15.126:8088', opts));
// app.use('/callComponent',proxy('http://192.168.100.108:8008',opts));
// app.use('/app',proxy('http://192.168.100.108:8008',opts));

View File

@ -92,14 +92,16 @@
})
},
_roomTreeLoadRoom: function(_unitId, data) {
//获取选中的节点
//获取选中的节点
let node = data.instance.get_node(data.selected[0]);
//遍历选中节点的子节点
let childNodes = data.instance.get_children_dom(node);
//let childNodes = data.instance.get_children_dom(node);
let childNodes = node.children;
//$('#u_' + _unitId)
if (childNodes && childNodes.length > 0) {
for (var childIndex = 0; childIndex < childNodes.length; childIndex++) {
$('#jstree_floorUnitRoom').jstree('delete_node', childNodes[childIndex]);
}
$('#jstree_floorUnitRoom').jstree('open_node', $('#u_' + _unitId));
return;
}
let param = {
params: {
@ -110,6 +112,7 @@
}
}
//发送get请求
let _datas = [];
vc.http.apiGet('/room.queryRoomsTree',
param,
function(json, res) {
@ -129,9 +132,13 @@
text: _text,
icon: "/img/room.png",
};
$('#jstree_floorUnitRoom').jstree('create_node', $('#u_' + _unitId), _data, "last", false, false);
_datas.push(_data);
// $('#jstree_floorUnitRoom').jstree('create_node', $('#u_' + _unitId), _data, "last", false, false);
})
$('#jstree_floorUnitRoom').jstree('open_node', $('#u_' + _unitId));
$('#jstree_floorUnitRoom').jstree('_append_json_data', $('#u_' + _unitId), _datas, function() {
// 这个回调函数要加 不然会报错,即使这个函数里面什么也不做
});
$('#jstree_floorUnitRoom').jstree('open_node', _datas[0].id);
},
function(errInfo, error) {
console.log('请求失败处理');

View File

@ -87,12 +87,18 @@
//获取选中的节点
let node = data.instance.get_node(data.selected[0]);
//遍历选中节点的子节点
let childNodes = data.instance.get_children_dom(node);
//let childNodes = data.instance.get_children_dom(node);
let childNodes = node.children;
//$('#u_' + _unitId)
if (childNodes && childNodes.length > 0) {
for (var childIndex = 0; childIndex < childNodes.length; childIndex++) {
$('#jstree_floorUnitRoomDiv').jstree('delete_node', childNodes[childIndex]);
}
$('#jstree_floorUnitRoomDiv').jstree('open_node', childNodes[0].id);
return;
}
// if (childNodes && childNodes.length > 0) {
// for (var childIndex = 0; childIndex < childNodes.length; childIndex++) {
// $('#jstree_floorUnitRoomDiv').jstree('delete_node', childNodes[childIndex]);
// }
// }
let param = {
params: {
page: 1,
@ -102,6 +108,7 @@
}
}
//发送get请求
let _datas = [];
vc.http.apiGet('/room.queryRoomsTree',
param,
function(json, res) {
@ -122,9 +129,13 @@
text: _text,
icon: "/img/room.png",
};
$('#jstree_floorUnitRoomDiv').jstree('create_node', $('#u_' + _unitId), _data, "last", false, false);
_datas.push(_data);
// $('#jstree_floorUnitRoomDiv').jstree('create_node', $('#u_' + _unitId), _data, "last", false, false);
})
$('#jstree_floorUnitRoomDiv').jstree('open_node', $('#u_' + _unitId));
$('#jstree_floorUnitRoomDiv').jstree('_append_json_data', $('#u_' + _unitId), _datas, function() {
// 这个回调函数要加 不然会报错,即使这个函数里面什么也不做
});
$('#jstree_floorUnitRoomDiv').jstree('open_node', _datas[0].id);
if (listRoomData.rooms && listRoomData.rooms.length > 0) {
vc.emit($that.roomTreeDivInfo.callName, 'selectRoom', {
roomName: listRoomData.rooms[0].floorNum + "-" + listRoomData.rooms[0].unitNum + "-" + listRoomData.rooms[0].roomNum,

File diff suppressed because one or more lines are too long