Просмотр исходного кода

Merge branch 'wrdp' into 'develop'

Wrdp

See merge request o2oa/o2oa!2350
蔡祥熠 5 лет назад
Родитель
Сommit
0e6a0b753b

+ 56 - 56
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/view/ActionListNextPageViewData.java

@@ -30,9 +30,9 @@ import java.util.List;
 import java.util.Map;
 
 public class ActionListNextPageViewData extends BaseAction {
-	
+
 	private static  Logger logger = LoggerFactory.getLogger( ActionListNextPageViewData.class );
-	
+
 	protected ActionResult<List<Wo>> execute( HttpServletRequest request, EffectivePerson effectivePerson, String lastDocId, Integer pageSize, JsonElement jsonElement ) throws Exception {
 		ActionResult<List<Wo>> result = new ActionResult<>();
 		List<Wo> wos = new ArrayList<>();
@@ -54,15 +54,15 @@ public class ActionListNextPageViewData extends BaseAction {
 		List<String> sortableFieldNames = null;
 		List<String> sortableFieldNames_upperCase = null;
 		QueryFilter queryFilter = null;
-		
+
 		if( pageSize <= 0 || pageSize == null ){
 			pageSize = 12;
 		}
-		
+
 		if( "(0)".equals( lastDocId ) || StringUtils.isEmpty( lastDocId ) ){
 			lastDocId = null;
 		}
-		
+
 		try {
 			wi = this.convertToWrapIn( jsonElement, Wi.class );
 		} catch (Exception e ) {
@@ -71,19 +71,19 @@ public class ActionListNextPageViewData extends BaseAction {
 			result.error( exception );
 			logger.error( e, effectivePerson, request, null );
 		}
-		
+
 		if( StringUtils.isEmpty( wi.getCategoryId() ) ) {
 			check = false;
 			Exception exception = new ExceptionViewDateQueryCategoryIdEmpty();
 			result.error( exception );
 		}
-		
+
 		if( StringUtils.isEmpty( wi.getViewId() ) ) {
 			check = false;
 			Exception exception = new ExceptionViewDataQueryViewIdEmpty();
 			result.error( exception );
 		}
-		
+
 		try {
 			isManager = userManagerService.isManager(effectivePerson );
 		} catch (Exception e) {
@@ -108,7 +108,7 @@ public class ActionListNextPageViewData extends BaseAction {
 				logger.error( e, effectivePerson, request, null);
 			}
 		}
-		
+
 		if( check ){
 			try{
 				view = viewServiceAdv.get( wi.getViewId() );
@@ -133,7 +133,7 @@ public class ActionListNextPageViewData extends BaseAction {
 				result.error( exception );
 			}
 		}
-		
+
 		if( check ){
 			try{
 				//检查当前Category与View的关联是否存在
@@ -151,7 +151,7 @@ public class ActionListNextPageViewData extends BaseAction {
 				logger.error( e, effectivePerson, request, null);
 			}
 		}
-		
+
 		if( check ){//设置查询条件的默认值,如果不传入则使用列表设置的值
 			if( StringUtils.isEmpty( wi.getOrderField() ) ) {
 				wi.setOrderField(view.getOrderField());
@@ -184,7 +184,7 @@ public class ActionListNextPageViewData extends BaseAction {
 				}
 			}
 		}
-		
+
 		if (check) {
 			try {
 				queryFilter = wi.getQueryFilter();
@@ -195,12 +195,12 @@ public class ActionListNextPageViewData extends BaseAction {
 				logger.error(e, effectivePerson, request, null);
 			}
 		}
-		
+
 		if( check ) {
 			if( StringUtils.isNotEmpty( lastDocId )) {
 				document = documentQueryService.get( lastDocId );
 			}
-			
+
 			//判断一下,如果排序的列不是Document的常规列, 需要从Item里查出符合条件的DocumentID列表
 			//从正常的Document属性列和全大写的属性列中都需要判断一下, sortableFieldNames and sortableFieldNames_upperCase
 			//如果sortableFieldNames and sortableFieldNames_upperCase都没有,那么就属性业务属性数据了,需要从item里去查询
@@ -209,20 +209,20 @@ public class ActionListNextPageViewData extends BaseAction {
 				List<String> viewableDocList = null;
 				if( isManager ) {
 					documentCount = documentQueryService.countWithConditionOutofPermission( queryFilter );
-					viewableDocList = documentQueryService.listIdsByCategoryId( category.getId(), wi.getOrderField(), wi.getOrderField(), 2000 );
+					viewableDocList = documentQueryService.listIdsByCategoryId( category.getId(), wi.getOrderField(), wi.getOrderType(), 2000 );
 				}else {
 					documentCount = documentQueryService.countWithConditionInReview( personName, queryFilter );
-					viewableDocList = documentQueryService.listDocIdsWithConditionInReview( personName, wi.getOrderField(), wi.getOrderField(), queryFilter, 2000 );
+					viewableDocList = documentQueryService.listDocIdsWithConditionInReview( personName, wi.getOrderField(), wi.getOrderType(), queryFilter, 2000 );
 				}
-				
+				logger.debug("documentCount:{}===viewableDocListCount:{}",documentCount,viewableDocList.size());
 				//以所有可见的DocId为基准,从Item里查询出2000个排序好的对象,拼成 dataObjList ( docId, sortFieldValue )返回
 				List<SimpleItemObj> simpleItems = documentQueryService.listSortObjWithOrderFieldInData( viewableDocList, wi.getOrderField(), wi.getOrderField(), wi.getOrderType() );
-			
+
 				if( ListTools.isNotEmpty( simpleItems )) {
 					String sequence = null;
 					Boolean  pickDocument = false;
-					documentList = new ArrayList<>();
-					for( SimpleItemObj item : simpleItems ) {				
+					searchResultList = new ArrayList<>();
+					for( SimpleItemObj item : simpleItems ) {
 						//填充Document数据
 						sequence = documentQueryService.getSequence( item.getId() );
 						if( StringUtils.isNotEmpty( sequence)) {
@@ -232,10 +232,10 @@ public class ActionListNextPageViewData extends BaseAction {
 								}
 							}else {
 								pickDocument = true;//取第1页的pageSize个document
-							}							
+							}
 							if( pickDocument ) {
-								if( documentList.size() < pageSize ) {
-									documentList.add( documentQueryService.get( item.getId() ));
+								if( searchResultList.size() < pageSize ) {
+									searchResultList.add( documentQueryService.get( item.getId() ));
 								}else {//数据够一页了
 									break;
 								}
@@ -297,10 +297,10 @@ public class ActionListNextPageViewData extends BaseAction {
 							}
 						}
 					}
-				}	
+				}
 			}
-		}		
-		
+		}
+
 		if( check ){
 			//补充业务数据
 			if( searchResultList != null && searchResultList.size() > 0 ){
@@ -334,7 +334,7 @@ public class ActionListNextPageViewData extends BaseAction {
 							result.error( exception );
 							logger.error( e, effectivePerson, request, null);
 						}
-					}					
+					}
 					wos.add( wo );
 				}
 			}
@@ -342,36 +342,36 @@ public class ActionListNextPageViewData extends BaseAction {
 			result.setData( wos );
 			result.setCount( documentCount );
 		}
-		
+
 		return result;
 	}
 
 	public class Wi {
-		
+
 		@FieldDescribe( "是否置顶:ALL|TOP|UNTOP." )
 		private String topFlag = "ALL";
-		
+
 		@FieldDescribe("需要过滤文档的分类ID")
 		private String categoryId;
 
 		@FieldDescribe("需要查询的列表ID")
 		private String viewId;
-		
+
 		@FieldDescribe("当前查询用于排序的列名,默认以列表配置为主")
 		private String orderField;
 
 		@FieldDescribe("当前排序方式:DESC|ASC,默认以列表配置为主")
 		private String orderType;
-		
+
 		@FieldDescribe("值类别:支持string | date | time | datetime | boolean | boolean | text")
 		private String fieldType;
-		
+
 		@FieldDescribe("查询文档类型: 全部 | 信息 | 数据 ")
 		private String documentType;
-		
+
 		@FieldDescribe("需要查询的文档状态:published | draft | archived")
 		private String docStatus;
-		
+
 		public String getFieldType() {
 			return fieldType;
 		}
@@ -427,7 +427,7 @@ public class ActionListNextPageViewData extends BaseAction {
 		public void setDocumentType(String documentType) {
 			this.documentType = documentType;
 		}
-		
+
 		public String getTopFlag() {
 			return topFlag;
 		}
@@ -439,27 +439,27 @@ public class ActionListNextPageViewData extends BaseAction {
 		/**
 		 * 根据传入的查询参数,组织一个完整的QueryFilter对象
 		 * @return
-		 * @throws Exception 
+		 * @throws Exception
 		 */
 		public QueryFilter getQueryFilter() throws Exception {
-			QueryFilter queryFilter = new QueryFilter();		
+			QueryFilter queryFilter = new QueryFilter();
 			queryFilter.setJoinType( "and" );
-			
+
 			if( StringUtils.isNotEmpty( this.getCategoryId() )) {
 				queryFilter.addEqualsTerm( new EqualsTerm( "categoryId", this.getCategoryId() ) );
 			}
-			
+
 			//文档类型:全部 | 信息 | 数据
-			if( StringUtils.isNotEmpty( this.getDocumentType())) {			
+			if( StringUtils.isNotEmpty( this.getDocumentType())) {
 				if( "信息".equals( this.getDocumentType() )) {
 					queryFilter.addEqualsTerm( new EqualsTerm( "documentType", this.getDocumentType() ) );
 				}else if( "数据".equals( this.getDocumentType() )) {
 					queryFilter.addEqualsTerm( new EqualsTerm( "documentType", this.getDocumentType() ) );
 				}
 			}
-			
+
 			//是否置顶:ALL|TOP|UNTOP
-			if( StringUtils.isNotEmpty( this.getTopFlag())) {			
+			if( StringUtils.isNotEmpty( this.getTopFlag())) {
 				if( "TOP".equals( this.getTopFlag() )) {
 					queryFilter.addIsTrueTerm( new IsTrueTerm( "isTop" ) );
 				}else if( "UNTOP".equals( this.getDocumentType() )) {
@@ -470,20 +470,20 @@ public class ActionListNextPageViewData extends BaseAction {
 			if( StringUtils.isNotEmpty( this.getDocStatus())) {
 				queryFilter.addEqualsTerm( new EqualsTerm( "docStatus", this.getDocStatus() ) );
 			}
-			
+
 			return queryFilter;
 		}
 
 	}
-	
+
 	public static class Wo extends GsonPropertyObject {
-		
+
 		@FieldDescribe( "文档对象的序列." )
 		private String sequence = null;
-		
+
 		@FieldDescribe( "文档对象的ID." )
 		private String id = null;
-		
+
 		@FieldDescribe( "排序列的值." )
 		private String orderFieldValue = null;
 
@@ -531,21 +531,21 @@ public class ActionListNextPageViewData extends BaseAction {
 
 		public void setOrderFieldValue(String orderFieldValue) {
 			this.orderFieldValue = orderFieldValue;
-		}		
+		}
 	}
-	
+
 	public static class WoDocument extends Document {
-		
+
 		private static final long serialVersionUID = -5076990764713538973L;
-		
+
 		public static WrapCopier<Document, WoDocument> copier = WrapCopierFactory.wo( Document.class, WoDocument.class, null, JpaObject.FieldsInvisible);
 
 		@FieldDescribe("创建者姓名(简称)")
 		private String creatorPersonShort = null;
-		
+
 		@FieldDescribe("创建者所属组织(简称)")
 		private String creatorUnitNameShort = null;
-		
+
 		@FieldDescribe("创建者顶层组织(简称)")
 		private String creatorTopUnitNameShort = null;
 
@@ -571,6 +571,6 @@ public class ActionListNextPageViewData extends BaseAction {
 
 		public void setCreatorTopUnitNameShort(String creatorTopUnitNameShort) {
 			this.creatorTopUnitNameShort = creatorTopUnitNameShort;
-		}		
+		}
 	}
-}
+}

+ 18 - 1
o2web/source/x_component_process_FormDesigner/Module/Datagrid$Data.js

@@ -64,7 +64,7 @@ MWF.xApplication.process.FormDesigner.Module.Datagrid$Data = MWF.FCDatagrid$Data
 			"MWFType": "datagrid$Data",
 			"id": this.json.id
 		});
-		
+
 		if (!this.form.json.moduleList[this.json.id]){
 			this.form.json.moduleList[this.json.id] = this.json;
 		}
@@ -76,6 +76,11 @@ MWF.xApplication.process.FormDesigner.Module.Datagrid$Data = MWF.FCDatagrid$Data
         this._setEditStyle_custom("id");
         this.checkSequence();
         this.json.moduleName = this.moduleName;
+
+        debugger;
+		if( this.json.isShow === false ){
+			this._switchShow();
+		}
 	},
     _setEditStyle_custom: function(name, obj, oldValue) {
         if (name == "cellType") this.checkSequence(obj, oldValue);
@@ -118,6 +123,10 @@ MWF.xApplication.process.FormDesigner.Module.Datagrid$Data = MWF.FCDatagrid$Data
         }.bind(this));
 
 		this.setCustomNodeStyles(this.node, this.parentContainer.json.contentStyles);
+
+		if( this.json.isShow === false ){
+			this._switchShow();
+		}
 	},
     checkSequence: function(obj, oldValue){
         if ((this.json.cellType == "sequence") && (oldValue != "sequence")){
@@ -251,6 +260,14 @@ MWF.xApplication.process.FormDesigner.Module.Datagrid$Data = MWF.FCDatagrid$Data
 			}
 			
 		}
+	},
+	_switchShow : function (isShow) {
+		if( typeOf(isShow) === "boolean" ){
+			this.json.isShow = isShow;
+		}else{
+			isShow = this.json.isShow !== false ;
+		}
+		this.node.setStyle("opacity", isShow ? "1" : "0.3");
 	}
 	
 });

+ 36 - 3
o2web/source/x_component_process_FormDesigner/Module/Datagrid$Title.js

@@ -104,14 +104,18 @@ MWF.xApplication.process.FormDesigner.Module.Datagrid$Title = MWF.FCDatagrid$Tit
 		this.parentContainer = this.treeNode.parentNode.module;
         this._setEditStyle_custom("id");
         this.json.moduleName = this.moduleName;
+
+		if( this.json.isShow === false ){
+			this._switchShow();
+		}
 	},
 	
 	_createMoveNode: function(){
 		return false;
 	},
-	_setEditStyle_custom: function(name){
-
-	},
+	// _setEditStyle_custom: function(name){
+	//
+	// },
 	_dragInLikeElement: function(module){
 		return false;
 	},
@@ -134,6 +138,10 @@ MWF.xApplication.process.FormDesigner.Module.Datagrid$Title = MWF.FCDatagrid$Tit
 		}.bind(this));
 
 		this.setCustomNodeStyles(this.node, this.parentContainer.json.titleStyles);
+
+		if( this.json.isShow === false ){
+			this._switchShow();
+		}
 	},
 
 	insertCol: function(){
@@ -265,5 +273,30 @@ MWF.xApplication.process.FormDesigner.Module.Datagrid$Title = MWF.FCDatagrid$Tit
 				this.node.set("text", this.json.name);
 			}
 		}
+		if( name=="isShow" ){
+			this._switchShow( true );
+		}
+	},
+	_switchShow: function( isChangeTd ){
+		debugger;
+		var tr = this.node.getParent("tr");
+		var table = tr.getParent("table");
+		var colIndex = this.node.cellIndex;
+		var isShow = this.json.isShow !== false;
+
+		var titleTr = table.rows[0];
+		var currentTh = titleTr.cells[colIndex];
+		if( currentTh ){
+			currentTh.setStyle("opacity", isShow ? "1" : "0.3")
+		}
+
+		if(isChangeTd){
+			var dataTr = table.rows[1];
+			var currentTd = dataTr.cells[colIndex];
+			if( currentTd ){
+				var module = currentTd.retrieve("module");
+				if( module )module._switchShow( isShow );
+			}
+		}
 	}
 });

+ 7 - 0
o2web/source/x_component_process_FormDesigner/Module/Datagrid$Title/datagrid$Title.html

@@ -21,6 +21,13 @@
                     <input class="editTableRadio" name="total" text{($.total=='count')?'checked':''} type="radio" value="count"/>合计数量 <br/>
                 </td>
             </tr>
+            <tr>
+                <td class="editTableTitle">隐藏:</td>
+                <td class="editTableValue">
+                    <input class="editTableRadio" name="isShow" text{($.isShow!==false)?'checked':''} type="radio" value="true"/>显示该列 <br/>
+                    <input class="editTableRadio" name="isShow" text{($.isShow==false)?'checked':''} type="radio" value="false"/>隐藏该列 <br/>
+                </td>
+            </tr>
         </table>
 
         <div class="MWFMaplist" name="styles" title="样式"></div>

+ 8 - 0
o2web/source/x_component_process_FormDesigner/Module/Datagrid.js

@@ -315,13 +315,17 @@ MWF.xApplication.process.FormDesigner.Module.Datagrid = MWF.FCDatagrid = new Cla
         if (name=="titleStyles"){
             var ths = this.table.getElements("th");
             ths.each(function(th){
+            	var opacity = th.getStyle("opacity");
                 this.setCustomNodeStyles(th, this.json.titleStyles);
+                if(opacity)th.setStyle("opacity", opacity);
             }.bind(this));
         }
         if (name=="contentStyles"){
             var tds = this.table.getElements("td");
             tds.each(function(td){
+				var opacity = td.getStyle("opacity");
                 this.setCustomNodeStyles(td, this.json.contentStyles);
+				if(opacity)td.setStyle("opacity", opacity);
             }.bind(this));
         }
         //if (name=="sequence") this.checkSequenceShow();
@@ -330,13 +334,17 @@ MWF.xApplication.process.FormDesigner.Module.Datagrid = MWF.FCDatagrid = new Cla
         if (this.json.titleStyles){
             var ths = this.table.getElements("th");
             ths.each(function(th){
+				var opacity = th.getStyle("opacity");
                 this.setCustomNodeStyles(th, this.json.titleStyles);
+				if(opacity)th.setStyle("opacity", opacity);
             }.bind(this));
         }
         if (this.json.contentStyles){
             var tds = this.table.getElements("td");
             tds.each(function(td){
+				var opacity = td.getStyle("opacity");
                 this.setCustomNodeStyles(td, this.json.contentStyles);
+				if(opacity)td.setStyle("opacity", opacity);
             }.bind(this));
         }
     },

+ 2 - 0
o2web/source/x_component_process_Xform/Actionbar.js

@@ -16,6 +16,8 @@ MWF.xApplication.process.Xform.Actionbar = MWF.APPActionbar =  new Class({
         //     this.node.empty();
         // }else{
             this.toolbarNode = this.node.getFirst("div");
+            if(!this.toolbarNode)return;
+
             this.toolbarNode.empty();
 
             MWF.require("MWF.widget.Toolbar", function(){

+ 13 - 1
o2web/source/x_component_process_Xform/DatagridMobile.js

@@ -83,6 +83,9 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class({
                 "id": contentTds[i].get("id"),
                 "mwftype": contentTds[i].get("mwftype")
             });
+
+            var json = this.form._getDomjson(titleTd);
+            if( json && json.isShow === false )mobileTr.hide();
         }.bind(this));
         this.table.destroy();
         this.table = null;
@@ -298,6 +301,9 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class({
                         cell.set("text", idx+1);
                     }
 
+                    var json = this.form._getDomjson(th);
+                    if( json && json.isShow === false )tr.hide();
+
                 }.bind(this));
             }.bind(this));
         }
@@ -407,6 +413,8 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class({
                         cell.set("text", idx+1);
                     }
 
+                    var json = this.form._getDomjson(th);
+                    if( json && json.isShow === false )tr.hide();
                 }.bind(this));
                 var size = dataDiv.getSize();
                 //dataDiv.setStyle("height", ""+size.y+"px");
@@ -1224,6 +1232,9 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class({
                 }else{
                     tr.getElement("td").set("text", totalResaults[i] || "");
                 }
+
+                if( m.isShow === false )tr.hide();
+
                 this.totalResaults[m.module.json.id] = totalResaults[i];
             }.bind(this));
             if (this.totalTable){
@@ -1641,7 +1652,8 @@ MWF.xApplication.process.Xform.DatagridMobile$Title =  new Class({
             this.dataGrid.totalModules.push({
                 "module": this,
                 "index": this.node.getParent("tr").rowIndex,
-                "type": this.json.total
+                "type": this.json.total,
+                "isShow": this.json.isShow
             })
         }
         //	this.form._loadModules(this.node);

+ 8 - 0
o2web/source/x_component_process_Xform/DatagridPC.js

@@ -280,6 +280,7 @@ MWF.xApplication.process.Xform.DatagridPC = new Class({
 			var module = this.form._loadModule(json, cell);
 			cell.store("module", module);
 			this.form.modules.push(module);
+			if( json.isShow === false )cell.hide();
 		}
 
 	},
@@ -896,6 +897,8 @@ MWF.xApplication.process.Xform.DatagridPC = new Class({
 						cell.set("text", tr.rowIndex);
 					}
 
+					var json = this.form._getDomjson(th);
+					if( json && json.isShow === false )cell.hide();
 				}.bind(this));
 			}.bind(this));
 		}
@@ -968,6 +971,9 @@ MWF.xApplication.process.Xform.DatagridPC = new Class({
 		ths.each(function(th, idx){
 			var td = new Element("td", {"text": "", "styles": this.form.css.datagridTotalTd}).inject(this.totalTr);
 			if (this.json.amountStyles) td.setStyles(this.json.amountStyles);
+
+			var json = this.form._getDomjson(th);
+			if( json && json.isShow === false )td.hide();
 		}.bind(this));
 	},
 	_loadTotal: function(){
@@ -1060,6 +1066,7 @@ MWF.xApplication.process.Xform.DatagridPC = new Class({
 			if (json){
 				var module = this.form._loadModule(json, th);
 				this.form.modules.push(module);
+				if( json.isShow === false )th.hide();
 			}
 		}.bind(this));
 	},
@@ -1079,6 +1086,7 @@ MWF.xApplication.process.Xform.DatagridPC = new Class({
 				}
 				td.store("module", module);
 				this.form.modules.push(module);
+				if( json.isShow === false )td.hide();
 			}
 		}.bind(this));
 	},