From fa0b23dd73d57f3460e878fa9d990ec7440baae9 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期三, 26 二月 2020 12:50:01 +0800
Subject: [PATCH] 优化查询房屋信息
---
WebService/src/main/resources/components/orgPackage/org-manage/orgManage.js | 319 ++++++++++++++++++++++++++++++----------------------
1 files changed, 185 insertions(+), 134 deletions(-)
diff --git a/WebService/src/main/resources/components/orgPackage/org-manage/orgManage.js b/WebService/src/main/resources/components/orgPackage/org-manage/orgManage.js
index 95f1e0b..8ab3d62 100644
--- a/WebService/src/main/resources/components/orgPackage/org-manage/orgManage.js
+++ b/WebService/src/main/resources/components/orgPackage/org-manage/orgManage.js
@@ -1,196 +1,247 @@
/**
- 鍏ラ┗灏忓尯
-**/
-(function(vc){
+ 鍏ラ┗灏忓尯
+ **/
+(function (vc) {
var DEFAULT_PAGE = 1;
var DEFAULT_ROWS = 10;
var ALL_ROWS = 100;
vc.extends({
- data:{
- orgManageInfo:{
- orgs:[],
- total:0,
- records:1,
- moreCondition:false,
- orgName:'',
- headOrg:[],
- branchOrg:[],
- orgTree:[],
- conditions:{
- headOrgId:'',
- branchOrgId:'',
- orgId:'',
- orgName:'',
- orgLevel:'',
- parentOrgId:'',
+ data: {
+ orgManageInfo: {
+ orgs: [],
+ total: 0,
+ records: 1,
+ currentSelectOrgId:"-1",
+ moreCondition: false,
+ showBelongCommunity:false,
+ orgName: '',
+ headOrg: [],
+ branchOrg: [],
+ orgTree: [],
+ currentBelongCommunityId:'',
+ conditions: {
+ orgId: '',
+ orgName: '',
+ communityId: '',
+ orgLevel: '',
+ parentOrgId: '',
}
}
},
- watch:{
- "orgManageInfo.conditions.headOrgId":{//娣卞害鐩戝惉锛屽彲鐩戝惉鍒板璞°�佹暟缁勭殑鍙樺寲
- handler(val, oldVal){
- vc.component._getOrgsByOrgLevel(DEFAULT_PAGE, DEFAULT_ROWS,2,val);
+ watch: {
+ "orgManageInfo.conditions.headOrgId": {//娣卞害鐩戝惉锛屽彲鐩戝惉鍒板璞°�佹暟缁勭殑鍙樺寲
+ handler(val, oldVal) {
+ vc.component._getOrgsByOrgLevel(DEFAULT_PAGE, DEFAULT_ROWS, 2, val);
- vc.component.orgManageInfo.conditions.parentOrgId = val;
+ vc.component.orgManageInfo.conditions.parentOrgId = val;
- vc.component.orgManageInfo.conditions.branchOrgId = '';
+ vc.component.orgManageInfo.conditions.branchOrgId = '';
- vc.component._listOrgs(DEFAULT_PAGE, DEFAULT_ROWS);
+ vc.component._listOrgs(DEFAULT_PAGE, DEFAULT_ROWS);
},
- deep:true
+ deep: true
},
- "orgManageInfo.conditions.branchOrgId":{//娣卞害鐩戝惉锛屽彲鐩戝惉鍒板璞°�佹暟缁勭殑鍙樺寲
- handler(val, oldVal){
- if(val == ''){
+ "orgManageInfo.conditions.branchOrgId": {//娣卞害鐩戝惉锛屽彲鐩戝惉鍒板璞°�佹暟缁勭殑鍙樺寲
+ handler(val, oldVal) {
+ if (val == '') {
vc.component.orgManageInfo.conditions.parentOrgId = vc.component.orgManageInfo.conditions.headOrgId;
- }else{
+ } else {
vc.component.orgManageInfo.conditions.parentOrgId = val;
}
- vc.component._listOrgs(DEFAULT_PAGE, DEFAULT_ROWS);
+ vc.component._listOrgs(DEFAULT_PAGE, DEFAULT_ROWS);
},
- deep:true
+ deep: true
}
- },
- _initMethod:function(){
+ },
+ _initMethod: function () {
//鍙煡 鏌ヨ鎬诲叕鍙哥骇缁勭粐
vc.component.orgManageInfo.orgTree = [];
- vc.component._listOrgTrees(vc.component.orgManageInfo.orgTree,'1', '',function(){
+ vc.component._listOrgTrees(vc.component.orgManageInfo.orgTree, '1', '', function () {
vc.component._loadBranchOrgTrees();
});
- vc.component._getOrgsByOrgLevel(DEFAULT_PAGE, DEFAULT_ROWS,1,'');
+ vc.component._getOrgsByOrgLevel(DEFAULT_PAGE, DEFAULT_ROWS, 1, '');
+
},
- _initEvent:function(){
-
- vc.on('orgManage','listOrg',function(_param){
- vc.component._listOrgs(DEFAULT_PAGE, DEFAULT_ROWS);
- });
- vc.on('pagination','page_event',function(_currentPage){
- vc.component._listOrgs(_currentPage,DEFAULT_ROWS);
- });
- },
- methods:{
- _refreshOrgTree:function(){
- $('#orgTree').treeview({
- data: vc.component.orgManageInfo.orgTree
+ _initEvent: function () {
+
+ vc.on('orgManage', 'listOrg', function (_param) {
+ //vc.copyObject(_param, vc.component.orgManageInfo.conditions);
+ vc.component._listOrgs(DEFAULT_PAGE, DEFAULT_ROWS);
+ vc.component.orgManageInfo.orgTree = [];
+ vc.component._listOrgTrees(vc.component.orgManageInfo.orgTree, '1', '', function () {
+ vc.component._loadBranchOrgTrees();
});
+ });
+ vc.on('pagination', 'page_event', function (_currentPage) {
+ vc.component._listOrgs(_currentPage, DEFAULT_ROWS);
+ });
+ vc.on('orgManage','onBack',function(_param){
+ vc.component.orgManageInfo.showBelongCommunity = false;
+ })
+
+ },
+ methods: {
+ _refreshOrgTree: function () {
+ $('#orgTree').treeview({
+ data: vc.component.orgManageInfo.orgTree,
+ selectedBackColor: '#1ab394'
+ });
+ $('#orgTree').on('nodeSelected', function (event, data) {
+ console.log(event,data);
+ vc.component.orgManageInfo.currentSelectOrgId = data.orgId;
+ vc.component.orgManageInfo.conditions.orgLevel = (parseInt(data.orgLevel) + 1);
+ vc.component.orgManageInfo.conditions.parentOrgId = data.orgId;
+ vc.component.orgManageInfo.currentBelongCommunityId = data.belongCommunityId;
+ vc.component._listOrgs(DEFAULT_PAGE, DEFAULT_ROWS);
+ });
+// if(vc.component.orgManageInfo.currentSelectOrgId == '-1'){
+// console.log('鏄惁杩涘叆');
+// $('#orgTree').treeview("selectNode", [0]);
+// }
},
- _loadBranchOrgTrees:function(){
+ _loadBranchOrgTrees: function () {
//榛樿鏌ヨ鍒嗗叕鍙哥粍缁囦俊鎭�
vc.component._listOrgTrees(vc.component.orgManageInfo.orgTree[0].nodes,
- '2',
- vc.component.orgManageInfo.orgTree[0].orgId,
- function(){
- vc.component._refreshOrgTree();
- });
+ '2',
+ vc.component.orgManageInfo.orgTree[0].orgId,
+ function (_tmpOrgs) {
+ vc.component._refreshOrgTree();
+ });
},
- _listOrgTrees:function(_nodes,_orgLevel,_parentOrgId,_callback){
+ _listOrgTrees: function (_nodes, _orgLevel, _parentOrgId, _callback) {
var param = {
- params:{
- page:DEFAULT_PAGE,
- row:ALL_ROWS,
- orgLevel:_orgLevel,
- parentOrgId:_parentOrgId
+ params: {
+ page: DEFAULT_PAGE,
+ row: ALL_ROWS,
+ orgLevel: _orgLevel,
+ parentOrgId: _parentOrgId
}
- };
- //鍙戦�乬et璇锋眰
- vc.http.get('orgManage',
- 'list',
- param,
- function(json,res){
- var _tmpOrgs =JSON.parse(json).orgs;
- _tmpOrgs.forEach(function (_item) {
- _nodes.push({
- orgId:_item.orgId,
- text:_item.orgName,
- href:function(_item){},
- tags:[0],
- nodes:[]
- });
- _callback();
- });
- },function(errInfo,error){
- console.log('璇锋眰澶辫触澶勭悊');
- }
- );
+ };
+ //鍙戦�乬et璇锋眰
+ vc.http.get('orgManage',
+ 'list',
+ param,
+ function (json, res) {
+ var _tmpOrgs = JSON.parse(json).orgs;
+ _tmpOrgs.forEach(function (_item) {
+ var _selected = false;
+ var _currentSelectOrgId = vc.component.orgManageInfo.currentSelectOrgId;
+ if(_currentSelectOrgId == '-1' && _orgLevel == 1){
+ _selected = true;
+ vc.component.orgManageInfo.currentSelectOrgId = _item.orgId;
+ vc.component.orgManageInfo.conditions.orgLevel = (parseInt(_item.orgLevel) + 1);
+ vc.component.orgManageInfo.conditions.parentOrgId = _item.orgId;
+ vc.component.orgManageInfo.currentBelongCommunityId = _item.belongCommunityId;
+ vc.component._listOrgs(DEFAULT_PAGE, DEFAULT_ROWS);
+ }else if(_item.orgId == vc.component.orgManageInfo.currentSelectOrgId){
+ _selected = true;
+ }
+ _nodes.push({
+ orgId: _item.orgId,
+ orgLevel: _orgLevel,
+ text: _item.orgLevelName + '|' + _item.orgName,
+ belongCommunityId:_item.belongCommunityId,
+ href: function (_item) {
+ },
+ state:{
+ selected:_selected
+ },
+ tags: [0],
+ nodes: []
+ });
+ _callback();
+ });
+ }, function (errInfo, error) {
+ console.log('璇锋眰澶辫触澶勭悊');
+ }
+ );
},
- _listOrgs:function(_page, _rows){
+ _listOrgs: function (_page, _rows) {
vc.component.orgManageInfo.conditions.page = _page;
vc.component.orgManageInfo.conditions.row = _rows;
var param = {
- params:vc.component.orgManageInfo.conditions
- };
+ params: vc.component.orgManageInfo.conditions
+ };
- //鍙戦�乬et璇锋眰
- vc.http.get('orgManage',
- 'list',
- param,
- function(json,res){
- var _orgManageInfo=JSON.parse(json);
- vc.component.orgManageInfo.total = _orgManageInfo.total;
- vc.component.orgManageInfo.records = _orgManageInfo.records;
- vc.component.orgManageInfo.orgs = _orgManageInfo.orgs;
- vc.emit('pagination','init',{
- total:vc.component.orgManageInfo.records,
- currentPage:_page
- });
- },function(errInfo,error){
- console.log('璇锋眰澶辫触澶勭悊');
- }
- );
+ //鍙戦�乬et璇锋眰
+ vc.http.get('orgManage',
+ 'list',
+ param,
+ function (json, res) {
+ var _orgManageInfo = JSON.parse(json);
+ vc.component.orgManageInfo.total = _orgManageInfo.total;
+ vc.component.orgManageInfo.records = _orgManageInfo.records;
+ vc.component.orgManageInfo.orgs = _orgManageInfo.orgs;
+ vc.emit('pagination', 'init', {
+ total: vc.component.orgManageInfo.records,
+ currentPage: _page
+ });
+ }, function (errInfo, error) {
+ console.log('璇锋眰澶辫触澶勭悊');
+ }
+ );
},
- _openAddOrgModal:function(){
- vc.emit('addOrg','openAddOrgModal',{});
+ _openAddOrgModal: function () {
+ vc.emit('addOrg', 'openAddOrgModal', {
+ parentOrgId: vc.component.orgManageInfo.conditions.parentOrgId,
+ orgLevel: vc.component.orgManageInfo.conditions.orgLevel,
+ belongCommunityId: vc.component.orgManageInfo.currentBelongCommunityId
+ });
},
- _openEditOrgModel:function(_org){
- vc.emit('editOrg','openEditOrgModal',_org);
+ _openEditOrgModel: function (_org) {
+ vc.emit('editOrg', 'openEditOrgModal', _org);
},
- _openDeleteOrgModel:function(_org){
- vc.emit('deleteOrg','openDeleteOrgModal',_org);
+ _openDeleteOrgModel: function (_org) {
+ vc.emit('deleteOrg', 'openDeleteOrgModal', _org);
},
- _queryOrgMethod:function(){
+ _openBeyondCommunity:function(_org){
+ vc.component.orgManageInfo.showBelongCommunity = true;
+ vc.emit('orgCommunityManageInfo', 'openOrgCommunity',_org);
+ },
+ _queryOrgMethod: function () {
vc.component._listOrgs(DEFAULT_PAGE, DEFAULT_ROWS);
},
- _moreCondition:function(){
- if(vc.component.orgManageInfo.moreCondition){
+ _moreCondition: function () {
+ if (vc.component.orgManageInfo.moreCondition) {
vc.component.orgManageInfo.moreCondition = false;
- }else{
+ } else {
vc.component.orgManageInfo.moreCondition = true;
}
},
- _getOrgsByOrgLevel:function(_page, _rows,_orgLevel,_parentOrgId){
+ _getOrgsByOrgLevel: function (_page, _rows, _orgLevel, _parentOrgId) {
var param = {
- params:{
+ params: {
page: _page,
row: _rows,
- orgLevel:_orgLevel,
+ orgLevel: _orgLevel,
parentOrgId: _parentOrgId
}
- };
+ };
- //鍙戦�乬et璇锋眰
- vc.http.get('orgManage',
- 'list',
- param,
- function(json,res){
- var _orgManageInfo=JSON.parse(json);
- if(_orgLevel == 1){
- vc.component.orgManageInfo.headOrg = _orgManageInfo.orgs;
- }else{
- vc.component.orgManageInfo.branchOrg = _orgManageInfo.orgs;
- }
- },function(errInfo,error){
- console.log('璇锋眰澶辫触澶勭悊');
- }
- );
+ //鍙戦�乬et璇锋眰
+ vc.http.get('orgManage',
+ 'list',
+ param,
+ function (json, res) {
+ var _orgManageInfo = JSON.parse(json);
+ if (_orgLevel == 1) {
+ vc.component.orgManageInfo.headOrg = _orgManageInfo.orgs;
+ } else {
+ vc.component.orgManageInfo.branchOrg = _orgManageInfo.orgs;
+ }
+ }, function (errInfo, error) {
+ console.log('璇锋眰澶辫触澶勭悊');
+ }
+ );
}
-
+
}
});
})(window.vc);
--
Gitblit v1.8.0