From a31deb55464435b01fa45487b354ca2350780868 Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期六, 15 二月 2020 12:36:56 +0800
Subject: [PATCH] 隶属小区修改
---
WebService/src/main/resources/components/orgPackage/addOrgCommunity/addOrgCommunity.js | 87 +++++++++++++++++++++++++++++++++++++------
1 files changed, 75 insertions(+), 12 deletions(-)
diff --git a/WebService/src/main/resources/components/orgPackage/addOrgCommunity/addOrgCommunity.js b/WebService/src/main/resources/components/orgPackage/addOrgCommunity/addOrgCommunity.js
index 4af8920..0cd6f07 100644
--- a/WebService/src/main/resources/components/orgPackage/addOrgCommunity/addOrgCommunity.js
+++ b/WebService/src/main/resources/components/orgPackage/addOrgCommunity/addOrgCommunity.js
@@ -1,19 +1,37 @@
(function(vc){
vc.extends({
+ propTypes: {
+ emitListener:vc.propTypes.string,
+ emitFunction:vc.propTypes.string
+ },
data:{
addOrgCommunityInfo:{
communitys:[],
communityName:'',
+ orgId:'',
+ orgName:'',
selectCommunitys:[]
+ }
+ },
+ watch: { // 鐩戣鍙屽悜缁戝畾鐨勬暟鎹暟缁�
+ checkData: {
+ handler(){ // 鏁版嵁鏁扮粍鏈夊彉鍖栧皢瑙﹀彂姝ゅ嚱鏁�
+ if(vc.component.addOrgCommunityInfo.selectCommunitys.length == vc.component.addOrgCommunityInfo.communitys.length){
+ document.querySelector('#quan').checked = true;
+ }else {
+ document.querySelector('#quan').checked = false;
+ }
+ },
+ deep: true // 娣卞害鐩戣
}
},
_initMethod:function(){
},
_initEvent:function(){
vc.on('addOrgCommunity','openAddOrgCommunityModal',function(_param){
+ vc.component._refreshChooseOrgInfo();
$('#addOrgCommunityModel').modal('show');
vc.copyObject(_param,vc.component.addOrgCommunityInfo);
- vc.component._refreshChooseOrgInfo();
vc.component._loadAllCommunityInfo(1,10,'');
});
},
@@ -23,10 +41,8 @@
params:{
page:_page,
row:_row,
- communityId:vc.getCurrentCommunity().communityId,
name:_name,
- orgLevel:vc.component.addOrgCommunityInfo.orgLevel,
- parentOrgId:vc.component.addOrgCommunityInfo.parentOrgId,
+ orgId:vc.component.addOrgCommunityInfo.orgId
}
};
@@ -35,21 +51,54 @@
'list',
param,
function(json){
- var _orgInfo = JSON.parse(json);
- vc.component.addOrgCommunityInfo.orgs = _orgInfo.orgs;
+ var _communityInfo = JSON.parse(json);
+ vc.component.addOrgCommunityInfo.communitys = _communityInfo.communitys;
},function(){
console.log('璇锋眰澶辫触澶勭悊');
}
);
},
addOrgCommunity:function(_org){
- if(_org.hasOwnProperty('name')){
- _org.orgName = _org.name;
+ var _selectCommunitys = vc.component.addOrgCommunityInfo.selectCommunitys;
+ var _tmpCommunitys = vc.component.addOrgCommunityInfo.communitys;
+ if(_selectCommunitys.length <1){
+ vc.toast("璇烽�夋嫨闅跺睘灏忓尯");
+ return ;
}
- vc.emit($props.emitChooseOrg,'addOrgCommunity',_org);
- vc.emit($props.emitLoadData,'listOrgData',{
- orgId:_org.orgId
- });
+ var _communitys = [];
+ for(var _selectIndex = 0 ;_selectIndex <_selectCommunitys.length ;_selectIndex ++){
+ for(var _communityIndex =0; _communityIndex < _tmpCommunitys.length;_communityIndex++){
+ if(_selectCommunitys[_selectIndex] == _tmpCommunitys[_communityIndex].communityId){
+ _communitys.push({
+ communityId:_tmpCommunitys[_communityIndex].communityId,
+ communityName:_tmpCommunitys[_communityIndex].name
+ });
+ }
+ }
+ }
+ var _objData = {
+ orgId:vc.component.addOrgCommunityInfo.orgId,
+ orgName:vc.component.addOrgCommunityInfo.orgName,
+ communitys:_communitys
+ }
+ vc.http.post('addOrgCommunity',
+ 'save',
+ JSON.stringify(_objData),
+ {
+ emulateJSON: true
+ },
+ function(json,res){
+ $('#addOrgCommunityModel').modal('hide');
+ if(res.status == 200){
+ vc.emit($props.emitListener,$props.emitFunction,{
+ });
+ return ;
+ }
+ vc.toast(json);
+ },function(){
+ console.log('璇锋眰澶辫触澶勭悊');
+ }
+ );
$('#addOrgCommunityModel').modal('hide');
},
queryCommunitys:function(){
@@ -59,8 +108,22 @@
vc.component.addOrgCommunityInfo={
communitys:[],
communityName:'',
+ orgId:'',
+ orgName:'',
selectCommunitys:[]
};
+ },
+ checkAll:function(e){
+ var checkObj = document.querySelectorAll('.checkItem'); // 鑾峰彇鎵�鏈塩heckbox椤�
+ if(e.target.checked){ // 鍒ゅ畾鍏ㄩ�塩heckbox鐨勫嬀閫夌姸鎬�
+ for(var i=0;i<checkObj.length;i++){
+ if(!checkObj[i].checked){ // 灏嗘湭鍕鹃�夌殑checkbox閫夐」push鍒扮粦瀹氭暟缁勪腑
+ vc.component.addOrgCommunityInfo.selectCommunitys.push(checkObj[i].value);
+ }
+ }
+ }else { // 濡傛灉鏄幓鎺夊叏閫夊垯娓呯┖checkbox閫夐」缁戝畾鏁扮粍
+ vc.component.addOrgCommunityInfo.selectCommunitys = [];
+ }
}
}
--
Gitblit v1.8.0