mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-02-26 08:16:47 +08:00
优化代码
This commit is contained in:
parent
e57c5a8dac
commit
4614b4bcde
@ -48,7 +48,7 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row" v-if="addFeeConfigInfo.feeFlag=='1003006'">
|
||||
<div class="form-group row" v-if="addFeeConfigInfo.feeFlag !='2006012'">
|
||||
<label class="col-sm-2 col-form-label"><span><vc:i18n name="缴费周期" namespace="addFeeConfig"></vc:i18n></span></label>
|
||||
<div class="col-sm-10">
|
||||
<input v-model="addFeeConfigInfo.paymentCycle" type="text" :placeholder="vc.i18n('必填,请填写缴费周期 单位为月','addFeeConfig')" class="form-control">
|
||||
|
||||
@ -45,7 +45,7 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row" v-if="editFeeConfigInfo.feeFlag=='1003006'">
|
||||
<div class="form-group row" v-if="editFeeConfigInfo.feeFlag !='2006012'">
|
||||
<label class="col-sm-2 col-form-label"><span><vc:i18n name="缴费周期" namespace="editFeeConfig"></vc:i18n></span></label>
|
||||
<div class="col-sm-10">
|
||||
<input v-model="editFeeConfigInfo.paymentCycle" type="text" :placeholder="vc.i18n('必填,请填写缴费周期 单位为月','editFeeConfig')" class="form-control">
|
||||
|
||||
@ -146,7 +146,7 @@
|
||||
<input v-model="roomCreateFeeAddInfo.startTime" type="text" :placeholder="vc.i18n('必填,请填写计费起始时间','roomCreateFeeAdd')" class="form-control roomCreateFeeStartTime">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row" v-show="roomCreateFeeAddInfo.feeFlag == '2006012'">
|
||||
<div class="form-group row" v-show="roomCreateFeeAddInfo.feeFlag != '1003006'">
|
||||
<label class="col-sm-2 col-form-label"><span><vc:i18n name="计费结束时间" namespace="roomCreateFeeAdd"></vc:i18n></span></label>
|
||||
<div class="col-sm-10">
|
||||
<input v-model="roomCreateFeeAddInfo.endTime" type="text" :placeholder="vc.i18n('必填,请填写计费结束时间','roomCreateFeeAdd')" class="form-control roomCreateFeeEndTime">
|
||||
@ -166,4 +166,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -41,6 +41,7 @@
|
||||
_initEvent: function() {
|
||||
vc.on('roomCreateFeeAdd', 'openRoomCreateFeeAddModal',
|
||||
function(_room) {
|
||||
$that.clearRoomCreateFeeAddData();
|
||||
$that.roomCreateFeeAddInfo.isMore = _room.isMore;
|
||||
let room = _room.room;
|
||||
if (!_room.isMore) {
|
||||
@ -51,6 +52,10 @@
|
||||
$that.roomCreateFeeAddInfo.roomState.push('2005');
|
||||
$that.roomCreateFeeAddInfo.roomState.push('2009');
|
||||
$that.roomCreateFeeAddInfo.locationTypeCdName = room.floorNum + '-' + room.unitNum + '-' + room.roomNum + '(' + room.ownerName + ')';
|
||||
|
||||
if (room.hasOwnProperty('roomName') && room.roomName) {
|
||||
$that.roomCreateFeeAddInfo.locationTypeCdName = room.roomName;
|
||||
}
|
||||
}
|
||||
if (!_room.isMore && room.roomType == '2020602') {
|
||||
$that.roomCreateFeeAddInfo.roomState.push('2006');
|
||||
@ -177,7 +182,7 @@
|
||||
//关闭model
|
||||
var _json = JSON.parse(json);
|
||||
$('#roomCreateFeeAddModel').modal('hide');
|
||||
$that.clearAddFeeConfigInfo();
|
||||
$that.clearRoomCreateFeeAddData();
|
||||
vc.emit('listRoomFee', 'notify', {});
|
||||
vc.emit('simplifyRoomFee', 'notify', {});
|
||||
if (_json.hasOwnProperty('code') && _json.code != 0) {
|
||||
@ -194,7 +199,7 @@
|
||||
vc.toast(errInfo);
|
||||
});
|
||||
},
|
||||
clearAddFeeConfigInfo: function() {
|
||||
clearRoomCreateFeeAddData: function() {
|
||||
var _feeTypeCds = $that.roomCreateFeeAddInfo.feeTypeCds;
|
||||
$that.roomCreateFeeAddInfo = {
|
||||
feeConfigs: [],
|
||||
|
||||
6
public/components/property/roomTreeDiv/roomTreeDiv.html
Normal file
6
public/components/property/roomTreeDiv/roomTreeDiv.html
Normal file
@ -0,0 +1,6 @@
|
||||
<!-- 弹出层 modal -->
|
||||
<div class="bg-white margin-top-xs padding">
|
||||
<div id="jstree_floorUnitRoomDiv">
|
||||
</div>
|
||||
<!-- end 弹出层 moda -->
|
||||
</div>
|
||||
205
public/components/property/roomTreeDiv/roomTreeDiv.js
Normal file
205
public/components/property/roomTreeDiv/roomTreeDiv.js
Normal file
@ -0,0 +1,205 @@
|
||||
(function(vc) {
|
||||
let DEFAULT_PAGE = 1;
|
||||
let DEFAULT_ROW = 10;
|
||||
vc.extends({
|
||||
data: {
|
||||
roomTreeDivInfo: {
|
||||
units: [],
|
||||
callName: ''
|
||||
}
|
||||
},
|
||||
_initMethod: function() {},
|
||||
_initEvent: function() {
|
||||
vc.on('roomTreeDiv', 'initRoomTreeDiv', function(_param) {
|
||||
$that.roomTreeDivInfo.callName = _param.callName;
|
||||
$that._loadRoomTreeDivFloorAndUnits();
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
_loadRoomTreeDivFloorAndUnits: function() {
|
||||
let param = {
|
||||
params: {
|
||||
communityId: vc.getCurrentCommunity().communityId
|
||||
}
|
||||
};
|
||||
//发送get请求
|
||||
vc.http.apiGet('/unit.queryUnits',
|
||||
param,
|
||||
function(json) {
|
||||
let _unitInfo = JSON.parse(json);
|
||||
$that.roomTreeDivInfo.units = _unitInfo;
|
||||
$that._initJsTreeRoomTreeDivFloorUnit();
|
||||
},
|
||||
function() {
|
||||
console.log('请求失败处理');
|
||||
});
|
||||
},
|
||||
_initJsTreeRoomTreeDivFloorUnit: function() {
|
||||
|
||||
let _data = $that._doJsTreeRoomTreeDivData();
|
||||
|
||||
_data = _data.sort(function(a, b) {
|
||||
return a.floorNum - b.floorNum
|
||||
})
|
||||
$.jstree.destroy()
|
||||
$("#jstree_floorUnitRoomDiv").jstree({
|
||||
"checkbox": {
|
||||
"keep_selected_style": false
|
||||
},
|
||||
'state': { //一些初始化状态
|
||||
"opened": true,
|
||||
},
|
||||
'core': {
|
||||
"check_callback": true,
|
||||
'data': _data
|
||||
}
|
||||
});
|
||||
$("#jstree_floorUnitRoomDiv").on("ready.jstree", function(e, data) {
|
||||
//data.instance.open_all();//打开所有节点
|
||||
$('#jstree_floorUnitRoomDiv').jstree('select_node', _data[0].children[0].id /* , true */ );
|
||||
|
||||
});
|
||||
|
||||
$('#jstree_floorUnitRoomDiv').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._roomTreeDivLoadRoom(data.node.original.unitId, data);
|
||||
}
|
||||
|
||||
if (_selected.startsWith('r_')) {
|
||||
vc.emit($that.roomTreeDivInfo.callName, 'selectRoom', {
|
||||
roomName: data.node.original.roomName,
|
||||
roomId: data.node.original.roomId
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
_roomTreeDivLoadRoom: 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 < childNodes.length; childIndex++) {
|
||||
$('#jstree_floorUnitRoomDiv').jstree('delete_node', childNodes[childIndex]);
|
||||
}
|
||||
}
|
||||
let param = {
|
||||
params: {
|
||||
page: 1,
|
||||
row: 1000,
|
||||
unitId: _unitId,
|
||||
communityId: vc.getCurrentCommunity().communityId
|
||||
}
|
||||
}
|
||||
//发送get请求
|
||||
vc.http.apiGet('/room.queryRooms',
|
||||
param,
|
||||
function(json, res) {
|
||||
let listRoomData = JSON.parse(json);
|
||||
if (listRoomData.total < 1) {
|
||||
return;
|
||||
}
|
||||
listRoomData.rooms.forEach(_room => {
|
||||
let _text = _room.roomNum;
|
||||
if (_room.ownerName) {
|
||||
_text += ('(' + _room.ownerName + ")")
|
||||
}
|
||||
let _data = {
|
||||
id: 'r_' + _room.roomId,
|
||||
roomId: _room.roomId,
|
||||
roomName: _room.floorNum + "-" + _room.unitNum + "-" + _room.roomNum,
|
||||
text: _text,
|
||||
icon: "/img/room.png",
|
||||
};
|
||||
$('#jstree_floorUnitRoomDiv').jstree('create_node', $('#u_' + _unitId), _data, "last", false, false);
|
||||
})
|
||||
$('#jstree_floorUnitRoomDiv').jstree('open_node', $('#u_' + _unitId));
|
||||
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,
|
||||
roomId: listRoomData.rooms[0].roomId
|
||||
})
|
||||
}
|
||||
},
|
||||
function(errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
}
|
||||
);
|
||||
},
|
||||
_doJsTreeRoomTreeDivData: function() {
|
||||
let _mFloorTree = [];
|
||||
|
||||
let _units = $that.roomTreeDivInfo.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._doJsTreeRoomTreeDivMenuData(_floorItem);
|
||||
_mFloorTree.push(_floorItem);
|
||||
}
|
||||
});
|
||||
return _mFloorTree;
|
||||
},
|
||||
_doJsTreeRoomTreeDivMenuData: function(_floorItem) {
|
||||
let _units = $that.roomTreeDivInfo.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);
|
||||
@ -15,7 +15,7 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-2" style="padding-right:0px">
|
||||
<vc:create path="property/roomTree" callBackListener="roomCreateFee"></vc:create>
|
||||
<vc:create path="property/roomTreeDiv" callBackListener="roomCreateFee"></vc:create>
|
||||
</div>
|
||||
<div class="col-md-10 margin-top-xs">
|
||||
<div class="row">
|
||||
@ -35,7 +35,7 @@
|
||||
<button type="button" class="btn btn-primary btn-sm" style="margin-left:10px" v-on:click="_openRoomCreateFeeComboModal()" v-if="roomCreateFeeInfo.hireOwnerFee == '0'">
|
||||
创建费用套餐
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary btn-sm" style="margin-left:10px" v-on:click="_openRoomCreateFeeAddModal()" v-if="roomCreateFeeInfo.hireOwnerFee == '0'">
|
||||
<button type="button" class="btn btn-primary btn-sm" style="margin-left:10px" v-on:click="_openRoomCreateFeeAddModal(roomCreateFeeInfo,false)" v-if="roomCreateFeeInfo.hireOwnerFee == '0'">
|
||||
创建费用
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary btn-sm" style="margin-left:10px" v-on:click="_toOwnerPayFee()" v-if="roomCreateFeeInfo.hireOwnerFee == '0'">
|
||||
@ -162,4 +162,6 @@
|
||||
<vc:create path="property/roomCreateFeeAdd"></vc:create>
|
||||
<vc:create path="property/addMeterWater" callBackListener="" callBackFunction=""></vc:create>
|
||||
<vc:create path="property/addProxyFee" callBackListener="" callBackFunction=""></vc:create>
|
||||
<vc:create path="property/exportFeeImportExcel"></vc:create>
|
||||
<vc:create path="property/doImportCreateFee"></vc:create>
|
||||
</div>
|
||||
@ -3,7 +3,7 @@
|
||||
**/
|
||||
(function(vc) {
|
||||
var DEFAULT_PAGE = 1;
|
||||
var DEFAULT_ROW = 10;
|
||||
var DEFAULT_ROW = 15;
|
||||
var TEMP_SEARCH = 'roomCreateFeeSearch';
|
||||
vc.extends({
|
||||
data: {
|
||||
@ -19,9 +19,6 @@
|
||||
roomName: '',
|
||||
roomId: '',
|
||||
builtUpArea: 0.00,
|
||||
floorNum: '',
|
||||
unitNum: '',
|
||||
roomNum: '',
|
||||
ownerName: '',
|
||||
roomType: '',
|
||||
hireOwnerFee: '0',
|
||||
@ -30,24 +27,15 @@
|
||||
currentPage: 1,
|
||||
},
|
||||
_initMethod: function() {
|
||||
//检查是否有缓存数据
|
||||
let _tempData = vc.getData(TEMP_SEARCH);
|
||||
if (_tempData == null) {
|
||||
vc.component.roomCreateFeeInfo.conditions.floorId = vc.getParam("floorId");
|
||||
vc.component.roomCreateFeeInfo.conditions.floorName = vc.getParam("floorName");
|
||||
vc.component.listRoom(DEFAULT_PAGE, DEFAULT_ROW);
|
||||
} else {
|
||||
vc.component.roomCreateFeeInfo.conditions = _tempData.conditions;
|
||||
$that.updateCurrentPage(_tempData.currentPage);
|
||||
vc.component.listRoom(_tempData.currentPage, DEFAULT_ROW);
|
||||
}
|
||||
vc.emit('roomTreeDiv', 'initRoomTreeDiv', {
|
||||
callName: 'roomCreateFee'
|
||||
});
|
||||
},
|
||||
_initEvent: function() {
|
||||
vc.on('roomCreateFee', 'selectRoom', function(_param) {
|
||||
vc.component.roomCreateFeeInfo.roomId = _param.roomId;
|
||||
vc.component.roomCreateFeeInfo.roomName = _param.roomName;
|
||||
vc.component._loadListRoomCreateFeeInfo();
|
||||
|
||||
vc.component._loadListRoomCreateFeeInfo(DEFAULT_PAGE, DEFAULT_ROW);
|
||||
});
|
||||
vc.on('pagination', 'page_event', function(_currentPage) {
|
||||
$that.updateCurrentPage(_currentPage);
|
||||
@ -200,12 +188,7 @@
|
||||
_toOwnerPayFee: function() {
|
||||
vc.jumpToPage('/#/pages/property/owePayFeeOrder?payObjId=' + $that.roomCreateFeeInfo.roomId + "&payObjType=3333&roomName=" + $that.roomCreateFeeInfo.roomName);
|
||||
},
|
||||
_openRoomCreateFeeAddModal: function() {
|
||||
vc.emit('roomCreateFeeAdd', 'openRoomCreateFeeAddModal', {
|
||||
isMore: false,
|
||||
room: $that.roomCreateFeeInfo
|
||||
});
|
||||
},
|
||||
|
||||
_openRoomCreateFeeComboModal: function() {
|
||||
vc.jumpToPage('/#/pages/property/createFeeByCombo?payerObjId=' +
|
||||
$that.roomCreateFeeInfo.roomId +
|
||||
|
||||
Loading…
Reference in New Issue
Block a user