加入 结构图开发完成

This commit is contained in:
java110 2022-03-05 16:16:38 +08:00
parent 583c3edc00
commit 502ff36e34
5 changed files with 91 additions and 35 deletions

8
app.js
View File

@ -36,10 +36,10 @@ let opts = {
// app.use('/callComponent',proxy('http://api.demo.winqi.cn:8012',opts));
// app.use('/callComponent', proxy('http://proxy.homecommunity.cn:9034', opts));
// app.use('/app', proxy('http://proxy.homecommunity.cn:9034', opts));
app.use('/callComponent', proxy('http://proxy.homecommunity.cn:9011', opts));
app.use('/app', proxy('http://proxy.homecommunity.cn:9011', opts));
app.use('/callComponent', proxy('http://proxy.homecommunity.cn:9034', opts));
app.use('/app', proxy('http://proxy.homecommunity.cn:9034', opts));
// app.use('/callComponent', proxy('http://proxy.homecommunity.cn:9011', opts));
// app.use('/app', proxy('http://proxy.homecommunity.cn:9011', opts));
// app.use('/callComponent', proxy('http://127.0.0.1:8008', opts));

View File

@ -1,4 +1,4 @@
<div class="bg-white margin-top padding">
<div class="bg-white margin-top-xs padding">
<div id="jstree_floorUnit">
</div>
</div>

View File

@ -3,6 +3,9 @@
**/
(function(vc) {
vc.extends({
propTypes: {
callBackListener: vc.propTypes.string, //父组件名称
},
data: {
floorUnitTreeInfo: {
units: []
@ -51,33 +54,30 @@
'data': _data
}
});
$('#jstree_privilege').on("changed.jstree", function(e, data) {
$("#jstree_floorUnit").on("ready.jstree", function(e, data) {
//data.instance.open_all();//打开所有节点
$('#jstree_floorUnit').jstree('select_node', _data[0].children[0].id /* , true */ );
});
$('#jstree_floorUnit').on("changed.jstree", function(e, data) {
if (data.action == 'model' || data.action == 'ready') {
//默认合并
$("#jstree_floorUnit").jstree("close_all");
//$("#jstree_floorUnit").jstree("close_all");
return;
}
// let _selected = data.node.state.selected;
// let _d = data.node.children_d;
// if (_d.length < 1) {
// _d.push(data.node.id);
// }
// let _selectPrivileges = [];
// _d.forEach(_dItem => {
// if (_dItem.indexOf('p_') > -1) {
// _selectPrivileges.push(_dItem.substring(2));
// }
// });
let _selected = data.selected[0];
// if (_selectPrivileges.length < 1) {
// return;
// }
if (_selected.startsWith('f_')) {
return;
}
// if (_selected) {
// $that.addPrivilegeToPrivilegeFloor(_selectPrivileges);
// } else {
// $that.deletePrivilege(_selectPrivileges);
// }
//console.log(_selected, data.node.original.unitId)
vc.emit($props.callBackListener, 'switchUnit', {
unitId: data.node.original.unitId
})
});
@ -98,7 +98,7 @@
if (!_includeFloor) {
let _floorItem = {
id: 'g_' + pItem.floorId,
id: 'f_' + pItem.floorId,
floorId: pItem.floorId,
icon: "/img/floor.png",
text: pItem.floorNum + "栋",
@ -127,13 +127,10 @@
}
if (!_includeMenu) {
let _menuItem = {
id: 'm_' + _units[_pIndex].unitId,
id: 'u_' + _units[_pIndex].unitId,
unitId: _units[_pIndex].unitId,
text: _units[_pIndex].unitNum + "单元",
icon: "/img/unit.png",
state: {
opened: true
}
icon: "/img/unit.png"
};
_children.push(_menuItem);
}

View File

@ -1,11 +1,23 @@
<div>
<div class="row">
<div class="col-md-2">
<vc:create path="property/floorUnitTree"></vc:create>
<vc:create path="property/floorUnitTree" callBackListener="roomStructure"></vc:create>
</div>
<div class="col-md-10">
<div class="row margin-top-xs bg-white">
<div class="col-md-1 text-center margin-sm padding-xs" title="双击查看详情" @dblclick="_toSimplifyAcceptance(room)" v-for="(room,index) in roomStructureInfo.rooms" :style="{'background-color': _getBgColor(room)}" style="color: #fff;border-radius: 5px;cursor:pointer">
<div>{{room.floorNum}}-{{room.unitNum}}-{{room.roomNum}}</div>
<div>{{room.stateName}}</div>
<div>{{room.ownerName?room.ownerName:'无'}}</div>
<div>欠费:{{room.oweAmount}}元</div>
</div>
</div>
</div>
<div class="col-md-10"></div>
</div>

View File

@ -7,6 +7,7 @@
vc.extends({
data: {
roomStructureInfo: {
rooms: [],
}
},
@ -15,9 +16,55 @@
},
_initEvent: function() {
vc.on('roomStructure', 'switchUnit', function(_param) {
$that._loadRooms(_param.unitId)
});
},
methods: {
_loadRooms: function(_unitId) {
let param = {
params: {
page: 1,
row: 100,
unitId: _unitId,
communityId: vc.getCurrentCommunity().communityId
}
}
vc.http.apiGet('/room.listRoomStructure',
param,
function(json, res) {
let listRoomData = JSON.parse(json);
$that.roomStructureInfo.rooms = listRoomData.data;
},
function(errInfo, error) {
console.log('请求失败处理');
}
);
},
_getBgColor: function(room) {
if (!room.ownerName) {
return "#1AB394";
}
if (room.oweAmount > 0) {
return "#DC3545";
}
return "#1296db"
},
_toSimplifyAcceptance: function(_room) {
let _date = new Date();
vc.saveData("JAVA110_IS_BACK", _date.getTime());
vc.saveData('simplifyAcceptanceSearch', {
searchType: '1',
searchValue: _room.floorNum + "-" + _room.unitNum + "-" + _room.roomNum,
searchPlaceholder: '请输入房屋编号 楼栋-单元-房屋 如1-1-1',
})
vc.jumpToPage('/#/pages/property/simplifyAcceptance?tab=业务受理');
}
}
});
})(window.vc);