Browse Source

Merge branch 'wrdp' into 'develop'

Wrdp

See merge request o2oa/o2oa!1908
胡起 5 years ago
parent
commit
9e3e39a96e
19 changed files with 964 additions and 255 deletions
  1. 3 0
      o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionBatchDownloadWithWorkOrWorkCompleted.java
  2. 3 0
      o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionBatchDownloadWithWorkOrWorkCompletedStream.java
  3. 3 0
      o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionUploadWorkInfo.java
  4. 1 1
      o2server/x_query_core_express/src/main/java/com/x/query/core/express/plan/DateRangeEntry.java
  5. 12 0
      o2web/source/o2_core/o2.js
  6. 4 2
      o2web/source/o2_core/o2/widget/AttachmentController.js
  7. 3 2
      o2web/source/o2_core/o2/widget/chart/Bar.js
  8. 27 4
      o2web/source/x_component_cms_Module/ViewExplorer.js
  9. 5 0
      o2web/source/x_component_process_FormDesigner/Module/Attachment.js
  10. 57 1
      o2web/source/x_component_process_FormDesigner/Module/Attachment/attachment.html
  11. 3 3
      o2web/source/x_component_process_FormDesigner/Module/Attachment/template.json
  12. 1 1
      o2web/source/x_component_process_FormDesigner/Module/Datagrid$Data.js
  13. 1 1
      o2web/source/x_component_process_ProcessManager/Explorer.js
  14. 104 12
      o2web/source/x_component_process_Xform/Attachment.js
  15. 138 13
      o2web/source/x_component_process_Xform/DatagridPC.js
  16. 446 89
      o2web/source/x_component_query_Query/Viewer.js
  17. 148 122
      o2web/source/x_component_query_ViewDesigner/$View/view.html
  18. 5 4
      o2web/source/x_desktop/js/base.js
  19. 0 0
      o2web/source/x_desktop/js/base_work_begin.js

+ 3 - 0
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionBatchDownloadWithWorkOrWorkCompleted.java

@@ -78,6 +78,9 @@ class ActionBatchDownloadWithWorkOrWorkCompleted extends BaseAction {
 				}
 			}
 			if (StringUtils.isBlank(fileName)) {
+				if(title.length()>60){
+					title = title.substring(0, 60);
+				}
 				fileName = title + DateTools.format(new Date(), DateTools.formatCompact_yyyyMMddHHmmss) + ".zip";
 			} else {
 				String extension = FilenameUtils.getExtension(fileName);

+ 3 - 0
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionBatchDownloadWithWorkOrWorkCompletedStream.java

@@ -78,6 +78,9 @@ class ActionBatchDownloadWithWorkOrWorkCompletedStream extends BaseAction {
 				}
 			}
 			if (StringUtils.isBlank(fileName)) {
+				if(title.length()>60){
+					title = title.substring(0, 60);
+				}
 				fileName = title + DateTools.format(new Date(), DateTools.formatCompact_yyyyMMddHHmmss) + ".zip";
 			} else {
 				String extension = FilenameUtils.getExtension(fileName);

+ 3 - 0
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/attachment/ActionUploadWorkInfo.java

@@ -89,6 +89,9 @@ class ActionUploadWorkInfo extends BaseAction {
 		try {
 			String name = "";
 			byte[] bytes;
+			if(title.length()>60){
+				title = title.substring(0, 60);
+			}
 			if ("word".equals(flag)) {
 				try (POIFSFileSystem fs = new POIFSFileSystem();
 						InputStream is = new ByteArrayInputStream(workHtml.getBytes("UTF-8"));

+ 1 - 1
o2server/x_query_core_express/src/main/java/com/x/query/core/express/plan/DateRangeEntry.java

@@ -120,7 +120,7 @@ public class DateRangeEntry extends GsonPropertyObject {
 			this.completed = now;
 			Calendar cal = Calendar.getInstance();
 			cal.add(Calendar.YEAR, -1);
-			this.start = cal.getTime();
+			//this.start = cal.getTime();
 			break;
 		default:
 			break;

+ 12 - 0
o2web/source/o2_core/o2.js

@@ -1701,6 +1701,18 @@ o2.core = true;
             return this.some(function(item){ return (arr.indexOf(item)!==-1); })
         }
     });
+    if (!Array.prototype.find){
+        if (Array.implement) Array.implement({
+            "find": this.find || function(callback, thisArg){
+                for (var i=0; i<this.length; i++){
+                    if (callback.apply((thisArg || this), this[i], i, this)){
+                        return this[i];
+                    }
+                }
+                return undefined;
+            }
+        });
+    }
     if (window.Element && Element.implement) Element.implement({
         "isIntoView": function() {
             // var pNode = this.getParent();

+ 4 - 2
o2web/source/o2_core/o2/widget/AttachmentController.js

@@ -1499,7 +1499,8 @@ o2.widget.AttachmentController.Attachment = new Class({
         this.node.addEvents({
             "mouseover": function(){if (!this.isSelected) this.node.setStyles(this.css["attachmentNode_"+this.controller.options.listStyle+"_over"])}.bind(this),
             "mouseout": function(){if (!this.isSelected) this.node.setStyles(this.css["attachmentNode_"+this.controller.options.listStyle])}.bind(this),
-            "mousedown": function(e){this.selected(e);}.bind(this),
+            "mousedown": function(e){this.selected(e); e.stopPropagation();}.bind(this),
+            "click": function(e){e.stopPropagation();}.bind(this),
             "dblclick": function(e){this.openAttachment(e);}.bind(this)
         });
     },
@@ -1869,7 +1870,8 @@ o2.widget.AttachmentController.AttachmentMin = new Class({
                     }
                 }
             }.bind(this),
-            "mousedown": function(e){this.selected(e);}.bind(this),
+            "mousedown": function(e){this.selected(e);e.stopPropagation();}.bind(this),
+            "click": function(e){e.stopPropagation();}.bind(this),
             "dblclick": function(e){this.openAttachment(e);}.bind(this)
         });
     },

+ 3 - 2
o2web/source/o2_core/o2/widget/chart/Bar.js

@@ -78,8 +78,9 @@ o2.widget.chart.Bar = new Class({
             );
         }.bind(this));
         var max = d3.max(this.barsData, function(d){ return d3.max(d, function(d){return d.data}); });
+        var min = d3.min(this.barsData, function(d){ return d3.min(d, function(d){return d.data}); });
 
-        this.yScale = d3.scaleLinear().domain([0, max])
+        this.yScale = d3.scaleLinear().domain([min*0.9, max*1.1])
             .range(this.getYScaleRange());
     },
 
@@ -263,4 +264,4 @@ o2.widget.chart.Bar = new Class({
         this.svgNode.destroy();
         o2.release(this);
     }
-});
+});

+ 27 - 4
o2web/source/x_component_cms_Module/ViewExplorer.js

@@ -65,7 +65,7 @@ MWF.xApplication.cms.Module.ViewExplorer = new Class({
             "select": "none",
             "titleStyles": this.css.normalThNode,
             "itemStyles": {},
-            "isExpand": "no",
+            // "isExpand": "no",
             "filter": []
         };
 
@@ -233,6 +233,7 @@ MWF.xApplication.cms.Module.QueryViewer = new Class({
         var flag = this.checkboxElement.get("checked");
         this.items.each(function (it) {
             if( it.clazzType == "category" ){
+                it.expand();
                 it.items.each( function(i){
                     if (i.checkboxElement)i.checkboxElement.set("checked", flag)
                 })
@@ -317,6 +318,13 @@ MWF.xApplication.cms.Module.QueryViewer = new Class({
             // if (this.json.titleStyles) this.selectTitleCell.setStyles(this.json.titleStyles);
             //}
 
+            this.viewJson.firstTdHidden = true;
+            if( this.json.defaultSelectedScript )this.json.defaultSelectedScript = "";
+            if( this.viewJson.defaultSelectedScript )this.viewJson.defaultSelectedScript = "";
+            if( this.isSelectTdHidden() ){
+                this.selectTitleCell.hide();
+            }
+
 
             //序号
             if (this.viewJson.isSequence==="yes"){
@@ -357,7 +365,9 @@ MWF.xApplication.cms.Module.QueryViewer = new Class({
 
             this.lookup(data);
         }else{
+            this.entries = {};
             this.viewJson.selectList.each(function(column){
+                this.entries[column.column] = column;
                 if (column.hideColumn) this.hideColumns.push(column.column);
                 if (!column.allowOpen) this.openColumns.push(column.column);
             }.bind(this));
@@ -381,6 +391,9 @@ MWF.xApplication.cms.Module.QueryViewer = new Class({
     //    }
     //},
     loadData: function(){
+        if( this.checkboxElement ){
+            this.checkboxElement.set("checked", false )
+        }
         if (this.gridJson.length){
             if( !this.options.paging ){
                 this.gridJson.each(function(line, i){
@@ -432,6 +445,9 @@ MWF.xApplication.cms.Module.QueryViewer = new Class({
         }
     },
     loadGroupData: function(){
+        if( this.checkboxElement ){
+            this.checkboxElement.set("checked", false )
+        }
         if (this.selectTitleCell && !this.selectTitleCell.retrieve("expandLoaded") ){
             if( this.viewJson.viewStyles && this.viewJson.viewStyles["groupCollapseNode"] ){
                 this.expandAllNode = new Element("span", {
@@ -445,7 +461,7 @@ MWF.xApplication.cms.Module.QueryViewer = new Class({
             this.selectTitleCell.addEvent("click", this.expandOrCollapseAll.bind(this));
             this.selectTitleCell.store("expandLoaded", true);
         }
-        this.expandAll = false;
+        // this.expandAll = false;
         if (this.gridJson.length){
             var i = 0;
             this.gridJson.each(function(data){
@@ -453,7 +469,7 @@ MWF.xApplication.cms.Module.QueryViewer = new Class({
                 i += data.list.length;
             }.bind(this));
 
-            if (this.json.isExpand=="yes")this.expandOrCollapseAll();
+            if (this.getExpandFlag()=="yes")this.expandOrCollapseAll();
         }else{
             if (this.viewPageAreaNode) this.viewPageAreaNode.empty();
         }
@@ -561,6 +577,10 @@ MWF.xApplication.cms.Module.QueryViewer.Item = new Class({
         if (this.view.json.itemStyles) this.selectTd.setStyles(this.view.json.itemStyles);
         //}
 
+        if( this.view.isSelectTdHidden() ){
+            this.selectTd.hide();
+        }
+
         //Object.each(this.data.data, function(cell, k){
         //    if (this.view.hideColumns.indexOf(k)===-1){
         //        var td = new Element("td", {"styles": this.css.viewContentTdNode}).inject(this.node);
@@ -797,7 +817,7 @@ MWF.xApplication.cms.Module.QueryViewer.ItemCategory = new Class({
 
         this.view.fireEvent("postLoadCategoryRow", [null, this]);
     },
-    expand: function(){
+    expand: function( from ){
         this.items.each(function(item){
             item.node.setStyle("display", "table-row");
         }.bind(this));
@@ -818,6 +838,9 @@ MWF.xApplication.cms.Module.QueryViewer.ItemCategory = new Class({
             this.loadChild = true;
             //}.bind(this), 10);
         }
+        if( from !== "view" ){
+            this.view.checkExpandAllStatus();
+        }
     }
 });
 

+ 5 - 0
o2web/source/x_component_process_FormDesigner/Module/Attachment.js

@@ -66,6 +66,8 @@ MWF.xApplication.process.FormDesigner.Module.Attachment = MWF.FCAttachment = new
 
 	_initModule: function(){
 		this.node.empty();
+		if (this.parentContainer.json.moduleName == "datagrid$Data" && !this.json.size) this.json.size = "min";
+		if (this.parentContainer.json.moduleName == "datagrid$Data" && !this.json.listStyle) this.json.listStyle = "sequence";
 		this.loadAttachmentController(this.json.editorProperties);
 
 		this.setPropertiesOrStyles("styles");
@@ -73,6 +75,9 @@ MWF.xApplication.process.FormDesigner.Module.Attachment = MWF.FCAttachment = new
 		this._setNodeProperty();
         if (!this.form.isSubform) this._createIconAction();
 		this._setNodeEvent();
+
+		debugger;
+
 	},
     loadAttachmentController: function(){
         MWF.require("MWF.widget.AttachmentController", function(){

+ 57 - 1
o2web/source/x_component_process_FormDesigner/Module/Attachment/attachment.html

@@ -13,6 +13,10 @@
                 <td class="editTableTitle">描述:</td>
                 <td class="editTableValue"><input type="text" name="description" value="text{$.description}" class="editTableInput"/></td>
             </tr>
+            <tr>
+                <td class="editTableTitle">site:</td>
+                <td class="editTableValue"><input type="text" name="site" value="text{$.site}" class="editTableInput"/><br>(默认与标识相同)</td>
+            </tr>
             <tr>
                 <td class="editTableTitle">在控件中编辑:</td>
                 <td class="editTableValue">
@@ -181,6 +185,58 @@
                 </td>
             </tr>
         </table>
+        <div style="height: 28px; font-weight: bold; line-height:28px; background-color: #EEE; padding: 0px 6px; border-top: 1px solid #999">数据网格中的展现</div>
+        <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
+            <tr>
+                <td class="editTableTitle">显示方式:</td>
+                <td class="editTableValue">
+                    <input class="editTableRadio" name="dg_size" text{($.dg_size=='max')?'checked':''} type="radio" value="max"/>完整
+                    <input class="editTableRadio" name="dg_size" text{($.dg_size!=='max')?'checked':''} type="radio" value="min"/>简单
+                </td>
+            </tr>
+            <tr>
+                <td class="editTableTitle">切换样式:</td>
+                <td class="editTableValue">
+                    <input class="editTableRadio" name="dg_isSizeChange" text{($.dg_isSizeChange=='y')?'checked':''} type="radio" value="y"/>允许
+                    <input class="editTableRadio" name="dg_isSizeChange" text{($.dg_isSizeChange!=='y')?'checked':''} type="radio" value="n"/>不允许
+                </td>
+            </tr>
+            <tr>
+                <td class="editTableTitle">改变大小:</td>
+                <td class="editTableValue">
+                    <input class="editTableRadio" name="dg_resize" text{($.resize=='y')?'checked':''} type="radio" value="y"/>允许
+                    <input class="editTableRadio" name="dg_resize" text{($.resize!=='y')?'checked':''} type="radio" value="n"/>不允许
+                </td>
+            </tr>
+            <tr>
+                <td class="editTableTitle">允许使用的附件样式:</td>
+                <td class="editTableValue">
+                    <input type="checkbox" name="dg_availableListStyles" text{(!$.dg_availableListStyles || $.dg_availableListStyles.indexOf('list')!=-1)?'checked':''} value="list">列表
+                    <input type="checkbox" name="dg_availableListStyles" text{(!$.dg_availableListStyles || $.dg_availableListStyles.indexOf('seq')!=-1)?'checked':''} value="seq">序列
+                    <input type="checkbox" name="dg_availableListStyles" text{(!$.dg_availableListStyles || $.dg_availableListStyles.indexOf('icon')!=-1)?'checked':''} value="icon">图标
+                    <input type="checkbox" name="dg_availableListStyles" text{(!$.dg_availableListStyles || $.dg_availableListStyles.indexOf('preview')!=-1)?'checked':''} value="preview">预览
+                </td>
+            </tr>
+            <tr>
+                <td class="editTableTitle">默认附件样式:</td>
+                <td class="editTableValue">
+                    <input class="editTableRadio" name="dg_listStyle" text{($.dg_listStyle=='list')?'checked':''} type="radio" value="list"/>列表 </br>
+                    <input class="editTableRadio" name="dg_listStyle" text{($.dg_listStyle=='icon')?'checked':''} type="radio" value="icon"/>图标 </br>
+                    <input class="editTableRadio" name="dg_listStyle" text{($.dg_listStyle=='preview')?'checked':''} type="radio" value="preview"/>预览</br>
+                    <input class="editTableRadio" name="dg_listStyle" text{($.dg_listStyle!=='list' && $.dg_listStyle!=='icon' && $.dg_listStyle!=='preview')?'checked':''} type="radio" value="sequence"/>序列
+                </td>
+            </tr>
+            <tr>
+                <td class="editTableTitle">操作条:</td>
+                <td class="editTableValue">
+                    <input class="editTableRadio" name="dg_toolbarGroupHidden" text{(($.dg_toolbarGroupHidden || []).indexOf('edit')!=-1)?'checked':''} type="checkbox" value="edit"/>隐藏编辑操作组<br/>
+                    <input class="editTableRadio" name="dg_toolbarGroupHidden" text{(($.dg_toolbarGroupHidden || []).indexOf('read')!=-1)?'checked':''} type="checkbox" value="read"/>隐藏阅读操作组<br/>
+                    <input class="editTableRadio" name="dg_toolbarGroupHidden" text{(($.dg_toolbarGroupHidden || []).indexOf('list')!=-1)?'checked':''} type="checkbox" value="list"/>隐藏布局操作组<br/>
+                    <input class="editTableRadio" name="dg_toolbarGroupHidden" text{(($.dg_toolbarGroupHidden || []).indexOf('config')!=-1)?'checked':''} type="checkbox" value="config"/>隐藏设置操作组<br/>
+                    <input class="editTableRadio" name="dg_toolbarGroupHidden" text{(($.dg_toolbarGroupHidden || []).indexOf('view')!=-1)?'checked':''} type="checkbox" value="view"/>隐藏模式操作<br/>
+                </td>
+            </tr>
+        </table>
     </div>
 
     <div title="事件"  class="MWFTab" style="overflow: hidden">
@@ -192,4 +248,4 @@
     <div title="JSON"  class="MWFTab">
         <div class="MWFJSONArea" style="font-family: Verdana, Geneva, sans-serif; font-size:14px"></div>
     </div>
-</div>
+</div>

+ 3 - 3
o2web/source/x_component_process_FormDesigner/Module/Attachment/template.json

@@ -65,11 +65,11 @@
       "html": ""
     }
   },
-  "size": "max", //max, min
+  "size": "", //max, min
   "isSizeChange": "y",
   "attachmentCount": "0",
   "resize": "n",
-  "listStyle": "icon", //list, icon, preview
+  "listStyle": "", //list, icon, preview
   "readonly": "n",
   "isUpload": "y",
   "isDelete": "y",
@@ -82,4 +82,4 @@
   "class": "",
   "styles": {},
   "container": ""
-}
+}

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

@@ -21,7 +21,7 @@ MWF.xApplication.process.FormDesigner.Module.Datagrid$Data = MWF.FCDatagrid$Data
 		    	"title": MWF.LP.process.formAction.deleteCol
 		    }
 		],
-		"allowModules": ["textfield", "number", "personfield", "orgfield", "org", "calendar", "textarea", "select", "radio", "checkbox", "html", "combox", "image", "label", "htmleditor", "button","imageclipper", "address"]
+		"allowModules": ["textfield", "number", "personfield", "orgfield", "org", "calendar", "textarea", "select", "radio", "checkbox", "combox", "image", "label", "htmleditor", "button","imageclipper", "address", "attachment"]
 	},
 	
 	initialize: function(form, options){

+ 1 - 1
o2web/source/x_component_process_ProcessManager/Explorer.js

@@ -171,7 +171,7 @@ MWF.xApplication.process.ProcessManager.Explorer = new Class({
         this.app.addEvent("resize", this.setContentSize.bind(this));
     },
     setContentSize: function(){
-        var toolbarSize = this.toolbarNode.getSize();
+        var toolbarSize = (this.toolbarNode) ? this.toolbarNode.getSize() : {"x": 0, "y": 0};
         var nodeSize = this.node.getSize();
         var pt = this.elementContentNode.getStyle("padding-top").toFloat();
         var pb = this.elementContentNode.getStyle("padding-bottom").toFloat();

+ 104 - 12
o2web/source/x_component_process_Xform/Attachment.js

@@ -1050,6 +1050,7 @@ MWF.xApplication.process.Xform.Attachment = MWF.APPAttachment = new Class({
         this.json = json;
         this.form = form;
         this.field = true;
+        debugger;
     },
 
     _loadUserInterface: function () {
@@ -1059,6 +1060,12 @@ MWF.xApplication.process.Xform.Attachment = MWF.APPAttachment = new Class({
             this.fireEvent("load");
         }
     },
+    reload: function(){
+        this.node.empty();
+        if (this.form.businessData.work.startTime){
+            this.loadAttachmentController();
+        }
+    },
     loadAttachmentController: function () {
         //MWF.require("MWF.widget.AttachmentController", function() {
         var options = {
@@ -1093,7 +1100,7 @@ MWF.xApplication.process.Xform.Attachment = MWF.APPAttachment = new Class({
 
         this.form.businessData.attachmentList.each(function (att) {
             //if (att.site===this.json.id || (this.json.isOpenInOffice && this.json.officeControlName===att.site)) this.attachmentController.addAttachment(att);
-            if (att.site === this.json.id) this.attachmentController.addAttachment(att);
+            if (att.site === (this.json.site || this.json.id)) this.attachmentController.addAttachment(att);
         }.bind(this));
         this.setAttachmentBusinessData();
         //}.bind(this));
@@ -1183,7 +1190,7 @@ MWF.xApplication.process.Xform.Attachment = MWF.APPAttachment = new Class({
         }
         var size = 0;
         if (this.json.attachmentSize) size = this.json.attachmentSize.toFloat();
-        this.attachmentController.doUploadAttachment({ "site": this.json.id }, this.form.workAction.action, "uploadAttachment", { "id": this.form.businessData.work.id }, null, function (o) {
+        this.attachmentController.doUploadAttachment({ "site": (this.json.site || this.json.id) }, this.form.workAction.action, "uploadAttachment", { "id": this.form.businessData.work.id }, null, function (o) {
             if (o.id) {
                 this.form.workAction.getAttachment(o.id, this.form.businessData.work.id, function (json) {
                     if (json.data) {
@@ -1252,9 +1259,9 @@ MWF.xApplication.process.Xform.Attachment = MWF.APPAttachment = new Class({
     },
     uploadAttachment: function (e, node) {
         if (window.o2android && window.o2android.uploadAttachment) {
-            window.o2android.uploadAttachment(this.json.id);
+            window.o2android.uploadAttachment((this.json.site || this.json.id));
         } else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.uploadAttachment) {
-            window.webkit.messageHandlers.uploadAttachment.postMessage({ "site": this.json.id });
+            window.webkit.messageHandlers.uploadAttachment.postMessage({ "site": (this.json.site || this.json.id) });
         } else {
             // if (!this.uploadFileAreaNode){
             this.createUploadFileNode();
@@ -1332,9 +1339,9 @@ MWF.xApplication.process.Xform.Attachment = MWF.APPAttachment = new Class({
 
     replaceAttachment: function (e, node, attachment) {
         if (window.o2android && window.o2android.replaceAttachment) {
-            window.o2android.replaceAttachment(attachment.data.id, this.json.id);
+            window.o2android.replaceAttachment(attachment.data.id, (this.json.site || this.json.id));
         } else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.replaceAttachment) {
-            window.webkit.messageHandlers.replaceAttachment.postMessage({ "id": attachment.data.id, "site": this.json.id });
+            window.webkit.messageHandlers.replaceAttachment.postMessage({ "id": attachment.data.id, "site": (this.json.site || this.json.id) });
         } else {
             var _self = this;
             this.form.confirm("warn", e, MWF.xApplication.process.Xform.LP.replaceAttachmentTitle, MWF.xApplication.process.Xform.LP.replaceAttachment + "( " + attachment.data.name + " )", 350, 120, function () {
@@ -1390,7 +1397,7 @@ MWF.xApplication.process.Xform.Attachment = MWF.APPAttachment = new Class({
         }
         var size = 0;
         if (this.json.attachmentSize) size = this.json.attachmentSize.toFloat();
-        this.attachmentController.doUploadAttachment({ "site": this.json.id }, this.form.workAction.action, "replaceAttachment",
+        this.attachmentController.doUploadAttachment({ "site": (this.json.site || this.json.id) }, this.form.workAction.action, "replaceAttachment",
             { "id": attachment.data.id, "workid": this.form.businessData.work.id }, null, function (o) {
                 this.form.workAction.getAttachment(attachment.data.id, this.form.businessData.work.id, function (json) {
                     attachment.data = json.data;
@@ -1474,7 +1481,7 @@ MWF.xApplication.process.Xform.Attachment = MWF.APPAttachment = new Class({
                 if (window.o2android && window.o2android.downloadAttachment) {
                     window.o2android.downloadAttachment(att.data.id);
                 } else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.downloadAttachment) {
-                    window.webkit.messageHandlers.downloadAttachment.postMessage({ "id": att.data.id, "site": this.json.id });
+                    window.webkit.messageHandlers.downloadAttachment.postMessage({ "id": att.data.id, "site": (this.json.site || this.json.id) });
                 } else if (window.wx && window.__wxjs_environment === 'miniprogram' && this.checkMiniProgramFile(att.data.extension)) { //微信小程序
                     wx.miniProgram.navigateTo({ 
                         url: '../file/download?attId=' + att.data.id + '&type=work&work=' + this.form.businessData.work.id
@@ -1498,7 +1505,7 @@ MWF.xApplication.process.Xform.Attachment = MWF.APPAttachment = new Class({
                 if (window.o2android && window.o2android.downloadAttachment) {
                     window.o2android.downloadAttachment(att.data.id);
                 } else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.downloadAttachment) {
-                    window.webkit.messageHandlers.downloadAttachment.postMessage({ "id": att.data.id, "site": this.json.id });
+                    window.webkit.messageHandlers.downloadAttachment.postMessage({ "id": att.data.id, "site": (this.json.site || this.json.id) });
                 } else if (window.wx && window.__wxjs_environment === 'miniprogram' && this.checkMiniProgramFile(att.data.extension)) { //微信小程序
                     wx.miniProgram.navigateTo({ 
                         url: '../file/download?attId=' + att.data.id + '&type=work&workCompleted=' + this.form.businessData.workCompleted.id
@@ -1525,7 +1532,7 @@ MWF.xApplication.process.Xform.Attachment = MWF.APPAttachment = new Class({
                 if (window.o2android && window.o2android.downloadAttachment) {
                     window.o2android.downloadAttachment(att.data.id);
                 } else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.downloadAttachment) {
-                    window.webkit.messageHandlers.downloadAttachment.postMessage({ "id": att.data.id, "site": this.json.id });
+                    window.webkit.messageHandlers.downloadAttachment.postMessage({ "id": att.data.id, "site": (this.json.site || this.json.id) });
                 } else if (window.wx && window.__wxjs_environment === 'miniprogram' && this.checkMiniProgramFile(att.data.extension)) { //微信小程序
                     wx.miniProgram.navigateTo({ 
                         url: '../file/download?attId=' + att.data.id + '&type=work&work=' + this.form.businessData.work.id
@@ -1550,7 +1557,7 @@ MWF.xApplication.process.Xform.Attachment = MWF.APPAttachment = new Class({
                 if (window.o2android && window.o2android.downloadAttachment) {
                     window.o2android.downloadAttachment(att.data.id);
                 } else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.downloadAttachment) {
-                    window.webkit.messageHandlers.downloadAttachment.postMessage({ "id": att.data.id, "site": this.json.id });
+                    window.webkit.messageHandlers.downloadAttachment.postMessage({ "id": att.data.id, "site": (this.json.site || this.json.id) });
                 } else if (window.wx && window.__wxjs_environment === 'miniprogram' && this.checkMiniProgramFile(att.data.extension)) { //微信小程序
                     wx.miniProgram.navigateTo({ 
                         url: '../file/download?attId=' + att.data.id + '&type=work&workCompleted=' + this.form.businessData.workCompleted.id
@@ -1579,6 +1586,25 @@ MWF.xApplication.process.Xform.Attachment = MWF.APPAttachment = new Class({
             this.form.workAction.getAttachmentWorkcompletedUrl(attachment.data.id, this.form.businessData.workCompleted.id, callback);
         }
     },
+    getTextData: function(){
+        var data = [];
+        this.attachmentController.attachments.each(function(att){
+            data.push(att.data);
+        });
+        return data;
+    },
+    setData: function(data){
+        this.attachmentController.clear();
+        data.each(function (att) {
+            var attachment = this.form.businessData.attachmentList.find(function(a){
+                return a.id==att.id;
+            });
+            var attData = attachment || att;
+
+            this.attachmentController.addAttachment(attData);
+        }.bind(this));
+        this.setAttachmentBusinessData();
+    },
     createErrorNode: function (text) {
         var node = new Element("div");
         var iconNode = new Element("div", {
@@ -1724,4 +1750,70 @@ MWF.xApplication.process.Xform.Attachment = MWF.APPAttachment = new Class({
         return true;
     }
 
-}); 
+});
+
+MWF.xApplication.process.Xform.AttachmentDg = MWF.APPAttachmentDg = new Class({
+    Extends: MWF.APPAttachment,
+    loadAttachmentController: function () {
+        //MWF.require("MWF.widget.AttachmentController", function() {
+        var options = {
+            "style": this.json.style || "default",
+            "title": "附件区域DG",
+            "listStyle": this.json.listStyle || "icon",
+            "size": this.json.size || "max",
+            "resize": (this.json.resize === "y" || this.json.resize === "true"),
+            "attachmentCount": this.json.attachmentCount || 0,
+            "isUpload": (this.json.isUpload === "y" || this.json.isUpload === "true"),
+            "isDelete": (this.json.isDelete === "y" || this.json.isDelete === "true"),
+            "isReplace": (this.json.isReplace === "y" || this.json.isReplace === "true"),
+            "isDownload": (this.json.isDownload === "y" || this.json.isDownload === "true"),
+            "isSizeChange": (this.json.isSizeChange === "y" || this.json.isSizeChange === "true"),
+            "readonly": (this.json.readonly === "y" || this.json.readonly === "true"),
+            "availableListStyles": this.json.availableListStyles ? this.json.availableListStyles : ["list", "seq", "icon", "preview"],
+            "isDeleteOption": this.json.isDelete,
+            "isReplaceOption": this.json.isReplace,
+            "toolbarGroupHidden": this.json.toolbarGroupHidden || [],
+            "onOrder": function () {
+                this.fireEvent("change");
+            }.bind(this)
+        };
+        if (this.readonly) options.readonly = true;
+        if (this.form.json.attachmentStyle) {
+            options = Object.merge(options, this.form.json.attachmentStyle);
+        }
+        this.attachmentController = new MWF.xApplication.process.Xform.AttachmentController(this.node, this, options);
+        this.attachmentController.load();
+
+        // var d = this._getBusinessData();
+        // if (d) d.each(function (att) {
+        //     this.attachmentController.addAttachment(att);
+        // }.bind(this));
+        this.form.businessData.attachmentList.each(function (att) {
+            if (att.site === (this.json.site || this.json.id)) this.attachmentController.addAttachment(att);
+        }.bind(this));
+        this.setAttachmentBusinessData();
+    },
+    setAttachmentBusinessData: function(){
+        if (this.attachmentController) {
+            if (this.attachmentController.attachments.length) {
+                var values = this.attachmentController.attachments.map(function (d) {
+                    return {
+                        "control": d.data.control,
+                        "name": d.data.name,
+                        "id": d.data.id,
+                        "person": d.data.person,
+                        "creatorUid": d.data.creatorUid,
+                        "orderNumber": d.data.orderNumber,
+                        "length": d.data.length,
+                        "extension": d.data.extension,
+                        "lastUpdateTime": d.data.lastUpdateTime,
+                        "activityName": d.data.activityName
+                    };
+                });
+                this._setBusinessData(values);
+            } else {
+                this._setBusinessData([]);
+            }
+        }
+    }
+});

+ 138 - 13
o2web/source/x_component_process_Xform/DatagridPC.js

@@ -79,6 +79,10 @@ MWF.xApplication.process.Xform.DatagridPC = new Class({
 		this.editorTr = trs[trs.length-1];
 		this.editorTr.addClass("datagridEditorTr");
 
+		this.editorTr.addEvent("blur", function(){
+			alert('blur')
+		});
+
 		return this.editorTr;
 	},
 	_addTitleActionColumn: function(){
@@ -226,6 +230,8 @@ MWF.xApplication.process.Xform.DatagridPC = new Class({
 			var module = this.editModules[idx-1];
 			if( module && module.json.type == "ImageClipper" ){
 				this._createImage( cell, module, text )
+			}else if( module && (module.json.type == "Attachment" || module.json.type == "AttachmentDg") ){
+				this._createAttachment( cell, module, text );
 			}else{
 				if( module && module.json.type == "Textarea" ){
 					cell.set("html", text);
@@ -316,9 +322,6 @@ MWF.xApplication.process.Xform.DatagridPC = new Class({
 				if (module){
 					if (module.json.type=="sequence"){
 						module.node.set("text", module.node.getParent("tr").rowIndex);
-
-						//var i = newTr.rowIndex;
-						//var data = {"value": [i], "text": [i]};
 					}else {
 						debugger;
 						if (data[id]) {
@@ -399,6 +402,15 @@ MWF.xApplication.process.Xform.DatagridPC = new Class({
 				datagrid.currentEditLine.setStyle("display", "table-row");
 			}
 
+			datagrid.editModules.each(function(module){
+				if (module && (module.json.type=="Attachment" || module.json.type=="AttachmentDg")){
+					module.attachmentController.attachments.each(function(att){
+						datagrid.form.workAction.deleteAttachment(att.data.id, datagrid.form.businessData.work.id);
+					});
+					module.attachmentController.clear();
+				}
+			});
+
 			datagrid.isEdit = false;
 			datagrid.currentEditLine = null;
 
@@ -428,7 +440,7 @@ MWF.xApplication.process.Xform.DatagridPC = new Class({
 		if (!this.editValidation()){
 			return false;
 		}
-
+debugger;
 		this.isEdit = false;
 
 		var flag = true;
@@ -453,8 +465,15 @@ MWF.xApplication.process.Xform.DatagridPC = new Class({
 			var module = this.editModules[idx-1];
 			if (module){
 				if (module.json.type=="sequence"){
+					flag = false;
 					var i = newTr.rowIndex;
 					var data = {"value": [i], "text": [i]};
+				}else if (module.json.type=="Attachment" || module.json.type == "AttachmentDg"){
+					flag = false;
+					var data = module.getTextData();
+					//data.site = module.json.site;
+					if (!griddata[id]) griddata[id] = {};
+					griddata[id][module.json.id] = data;
 				}else{
 					var data = module.getTextData();
 					if (data.value[0]) flag = false;
@@ -470,6 +489,8 @@ MWF.xApplication.process.Xform.DatagridPC = new Class({
 				if (cell){
 					if( module.json.type == "ImageClipper" ){
 						this._createImage( cell, module, data.text );
+					}if( module.json.type == "Attachment" || module.json.type == "AttachmentDg" ){
+						this._createAttachment( cell, module, data );
 					}else{
 						var text = this._getValueText(idx-1, data.text.join(", "));
 						if( module.json.type == "Textarea"){
@@ -479,8 +500,12 @@ MWF.xApplication.process.Xform.DatagridPC = new Class({
 						}
 					}
 				}else{
-					var text = this._getValueText(idx-1, data.text.join(", "));
-					this._createNewEditTd(newTr, idx, editorTds[idx].get("id"), text, titleThs.length-1);
+					if( module.json.type == "Attachment" || module.json.type == "AttachmentDg" ){
+						this._createNewEditTd(newTr, idx, editorTds[idx].get("id"), data, titleThs.length-1);
+					}else{
+						var text = this._getValueText(idx-1, data.text.join(", "));
+						this._createNewEditTd(newTr, idx, editorTds[idx].get("id"), text, titleThs.length-1);
+					}
 				}
 			}else{
 				if (!cell) this._createNewEditTd(newTr, idx, id, "", titleThs.length-1);
@@ -506,18 +531,15 @@ MWF.xApplication.process.Xform.DatagridPC = new Class({
 			newTr.getFirst().setStyles(this.json.actionStyles);
 		}
 
-
-		//this._loadTotal();
-
 		this._loadBorderStyle();
 		this._loadZebraStyle();
 		this._loadSequence();
-
-
 		this.getData();
 		this.validationMode();
 		this.fireEvent("completeLineEdit", [newTr]);
 
+		this.form.saveFormData();
+
 		return true;
 	},
 	_createImage : function( cell, module, data ){
@@ -537,6 +559,50 @@ MWF.xApplication.process.Xform.DatagridPC = new Class({
 			}
 		}
 	},
+	_createAttachment: function ( cell, module, data ){
+		cell.empty();
+		var options = {
+			"style": module.json.style || "default",
+			"title": "附件区域",
+			"listStyle": module.json.dg_listStyle || "icon",
+			"size": module.json.dg_size || "min",
+			"resize": (module.json.dg_resize === "y" || this.json.dg_resize === "true"),
+			"attachmentCount": 0,
+			"isUpload": false,
+			"isDelete": false,
+			"isReplace": false,
+			"isDownload": true,
+			"isSizeChange": (module.json.dg_isSizeChange === "y" || module.json.dg_isSizeChange === "true"),
+			"readonly": true,
+			"availableListStyles": module.json.dg_availableListStyles ? module.json.dg_availableListStyles : ["list", "seq", "icon", "preview"],
+			"isDeleteOption": "n",
+			"isReplaceOption": "n",
+			"toolbarGroupHidden": module.json.dg_toolbarGroupHidden || []
+		};
+		if (this.readonly) options.readonly = true;
+
+		var atts = [];
+		data.each(function(d){
+			var att = module.attachmentController.attachments.find(function(a){
+				return d.id == a.data.id;
+			});
+			if (att) module.attachmentController.removeAttachment(att);
+		});
+		module.setAttachmentBusinessData();
+
+
+		var attachmentController = new MWF.xApplication.process.Xform.AttachmentController(cell, this, options);
+		attachmentController.load();
+
+		data.each(function (att) {
+			var attachment = this.form.businessData.attachmentList.find(function(a){
+				return a.id==att.id;
+			});
+			var attData = attachment || att;
+			//if (att.site===this.json.id || (this.json.isOpenInOffice && this.json.officeControlName===att.site)) this.attachmentController.addAttachment(att);
+			attachmentController.addAttachment(attData);
+		}.bind(this));
+	},
 	_editorTrGoBack: function(){
 		this.editorTr.setStyle("display", "none");
 //		this.editTr.removeEvents("blur");
@@ -560,6 +626,29 @@ MWF.xApplication.process.Xform.DatagridPC = new Class({
 		var currentTr = node.getParent("tr");
 		if (currentTr){
 			this.editorTr.inject(currentTr, "after");
+			this.editorTr.focus();
+			this.editModules.each(function(module, idx){
+				if (module.json.type=="Attachment" || module.json.type == "AttachmentDg"){
+					//module.json.site = this.getAttachmentRandomSite();
+					//module.json.id = module.json.site;
+					//module.reload();
+					// var d = this.getData();
+					//
+					// var titleThs = this.titleTr.getElements("th");
+					// var th = titleThs[idx+1];
+					// var title = th.get("id");
+					//
+					// var atts = [];
+					// d.data.each(function(line){
+					// 	atts = line[title][module.json.id];
+					// });
+					//d.data
+
+					// if (json.type=="Attachment" || json.type=="AttachmentDg" ){
+					// 	module.
+					// }
+				}
+			}.bind(this));
 		}
 		this.isEdit =true;
 		this.validationMode();
@@ -576,9 +665,34 @@ MWF.xApplication.process.Xform.DatagridPC = new Class({
 			currentTr.tween("background-color", "#ffd4d4");
 			var datagrid = this;
 			var _self = this;
+
+
+
 			this.form.confirm("warn", e, MWF.xApplication.process.Xform.LP.deleteDatagridLineTitle, MWF.xApplication.process.Xform.LP.deleteDatagridLine, 300, 120, function(){
 				_self.fireEvent("deleteLine", [currentTr]);
 
+				var data = currentTr.retrieve("data");
+
+				//var attKeys = [];
+				var titleThs = _self.titleTr.getElements("th");
+				titleThs.each(function(th, i){
+					var key = th.get("id");
+					var module = (i>0) ? _self.editModules[i-1] : null;
+					if (key && module && (module.json.type=="Attachment" || module.json.type=="AttachmentDg")){
+						data[key][module.json.id].each(function(d){
+							_self.form.workAction.deleteAttachment(d.id, _self.form.businessData.work.id);
+						});
+					}
+				});
+				// attKeys.each(function(k){
+				// 	if (data[k]){
+				// 		data[k].each(function(d){
+				// 			_self.form.workAction.deleteAttachment(d.id, _self.form.businessData.work.id);
+				// 		});
+				// 	}
+				// });
+
+
 				currentTr.destroy();
 				datagrid._loadZebraStyle();
 				datagrid._loadSequence();
@@ -587,6 +701,8 @@ MWF.xApplication.process.Xform.DatagridPC = new Class({
 				this.close();
 
 				_self.fireEvent("afterDeleteLine");
+
+				_self.form.saveFormData();
 			}, function(){
 				var color = currentTr.retrieve("bgcolor");
 				currentTr.tween("background", color);
@@ -1214,6 +1330,10 @@ MWF.xApplication.process.Xform.DatagridPC = new Class({
 			return false;
 		}
 		return true;
+	},
+	getAttachmentRandomSite: function(){
+		var i = (new Date()).getTime();
+		return this.json.id+i;
 	}
 
 });
@@ -1260,8 +1380,12 @@ MWF.xApplication.process.Xform.DatagridPC$Data =  new Class({
 			moduleNodes.each(function(node){
 				var json = this.form._getDomjson(node);
 				var isField = false;
+				if (json.type=="Attachment" || json.type=="AttachmentDg" ){
+					json.type = "AttachmentDg";
+					//json.site = this.dataGrid.getAttachmentRandomSite();
+					//json.id = json.site;
+				}
 				var module = this.form._loadModule(json, node, function(){
-					debugger;
 					isField = this.field;
 					this.field = false;
 				});
@@ -1272,5 +1396,6 @@ MWF.xApplication.process.Xform.DatagridPC$Data =  new Class({
 				this.dataGrid.editModules.push(module);
 			}.bind(this));
 		}
-	}
+	},
+
 });

+ 446 - 89
o2web/source/x_component_query_Query/Viewer.js

@@ -53,6 +53,7 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({
 
 
         this.items = [];
+
         this.selectedItems = [];
         this.hideColumns = [];
         this.openColumns = [];
@@ -232,6 +233,10 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({
                 this.selectTitleCell.hide();
             }
 
+            if( this.getSelectFlag() !== "multi" || !this.viewJson.allowSelectAll ){
+                this.expandTitleCell = this.selectTitleCell;
+            }
+
 
             //序号
             if (this.viewJson.isSequence==="yes"){
@@ -240,12 +245,13 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({
                 }).inject(this.viewTitleLine);
                 this.sequenceTitleCell.setStyle("width", "10px");
                 if (this.json.titleStyles) this.sequenceTitleCell.setStyles(this.json.titleStyles);
+                if( !this.expandTitleCell )this.expandTitleCell = this.sequenceTitleCell;
             }
 
             this.entries = {};
+            debugger;
             this.viewJson.selectList.each(function(column){
                 this.entries[column.column] = column;
-
                 if (!column.hideColumn){
                     var viewCell = new Element("td", {
                         "styles": viewTitleCellNode,
@@ -255,6 +261,8 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({
                     viewCell.setStyle("min-width", ""+size.x+"px");
                     if (this.json.titleStyles) viewCell.setStyles(this.json.titleStyles);
 
+                    if( column.groupEntry && !this.expandTitleCell )this.expandTitleCell = viewCell;
+
                     if( typeOf(column.titleStyles) === "object" )viewCell.setStyles(column.titleStyles);
                     if( typeOf(column.titleProperties) === "object" )viewCell.setProperties(column.titleProperties);
 
@@ -270,30 +278,63 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({
             }.bind(this));
             this.lookup(data, callback);
         }else{
+            this.entries = {};
             this.viewJson.selectList.each(function(column){
+                this.entries[column.column] = column;
                 if (column.hideColumn) this.hideColumns.push(column.column);
                 if (!column.allowOpen) this.openColumns.push(column.column);
             }.bind(this));
             this.lookup(data, callback);
         }
     },
+    getExpandFlag : function(){
+        if( this.options && this.options.isExpand )return this.options.isExpand;
+        if( this.json && this.json.isExpand )return this.json.isExpand;
+        if( this.viewJson && this.viewJson.isExpand )return this.viewJson.isExpand;
+        return "no";
+    },
+    getSelectFlag : function(){
+        if( this.options && this.options.select )return this.options.select;
+        if( this.json && this.json.select )return this.json.select;
+        if( this.viewJson && this.viewJson.select )return this.viewJson.select;
+        // if( this.json.select === "single" || this.json.select === "multi" )return this.json.select;
+        // if( this.viewJson.select === "single" || this.viewJson.select === "multi" )return this.viewJson.select;
+        // if( this.options.select === "single" || this.options.select === "multi"  )return this.options.select;
+        return "none";
+    },
     isSelectTdHidden :function(){
         if( !this.viewJson.firstTdHidden ){
             return false;
         }
-        if( this.json.select === "single" || this.json.select === "multi" || this.json.defaultSelectedScript || this.viewJson.defaultSelectedScript ){
+        if( this.viewJson.group && this.viewJson.group.column ){
             return false;
         }
-        if( this.viewJson.select === "single" || this.viewJson.select === "multi"  ){
+        if( this.json.defaultSelectedScript || this.viewJson.defaultSelectedScript ){
             return false;
         }
-        if( this.options.select === "single" || this.options.select === "multi"  ){
-            return false;
+        if( this.options && this.options.select ){
+            return  this.options.select === "none";
         }
-        if( this.viewJson.group && this.viewJson.group.column ){
-            return false;
+        if( this.json && this.json.select ){
+            return  this.json.select === "none";
+        }
+        if( this.viewJson && this.viewJson.select ){
+            return  this.viewJson.select === "none";
         }
         return true;
+        // if( this.json.select === "single" || this.json.select === "multi" || this.json.defaultSelectedScript || this.viewJson.defaultSelectedScript ){
+        //     return false;
+        // }
+        // if( this.options.select === "single" || this.options.select === "multi"  ){
+        //     return false;
+        // }
+        // if( this.viewJson.select === "single" || this.viewJson.select === "multi"  ){
+        //     return false;
+        // }
+        // if( this.viewJson.group && this.viewJson.group.column ){
+        //     return false;
+        // }
+        // return true;
     },
     // _loadPageCountNode: function(){
     //     this.viewPageContentNode.empty();
@@ -479,9 +520,46 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({
             if(callback)callback();
         }.bind(this), null, async === false ? false : true );
     },
-
-
+    getMode: function(){
+        return this.viewJson.group.column ? "group" : "item";
+    },
+    createSelectAllNode: function(){
+        if( this.getSelectFlag() === "multi" && this.viewJson.allowSelectAll ){
+            if (this.selectTitleCell && !this.selectTitleCell.retrieve("selectAllLoaded") ){
+                if( this.viewJson.viewStyles && this.viewJson.viewStyles["checkboxNode"] ){
+                    this.selectAllNode = this.selectTitleCell;
+                    this.selectAllNode.setStyles( this.viewJson.viewStyles["checkboxNode"] );
+                    // this.selectAllNode = new Element("div", {
+                    //     styles : this.viewJson.viewStyles["checkboxNode"]
+                    // }).inject( this.selectTitleCell );
+                }else{
+                    this.selectAllNode.html( "<img src='../x_component_query_Query/$Viewer/"+this.options.style+"/icon/checkbox.png'/>"+"</span>" )
+                    // this.selectAllNode = new Element("div",{
+                    //     html : "<img src='../x_component_query_Query/$Viewer/"+this.options.style+"/icon/checkbox.png'/>"+"</span>",
+                    //     style : "font-family: Webdings"
+                    // }).inject( this.selectTitleCell );
+                }
+                this.selectTitleCell.setStyle("cursor", "pointer");
+                this.selectTitleCell.addEvent("click", function () {
+                    if( this.getSelectAllStatus() === "all" ){
+                        this.unSelectAll("view")
+                    }else{
+                        this.selectAll("view");
+                    }
+                }.bind(this));
+                this.selectTitleCell.store("selectAllLoaded", true);
+            }
+        }
+    },
     loadData: function(){
+        if( this.getSelectFlag() === "multi" && this.viewJson.allowSelectAll ) {
+            if(this.selectTitleCell && this.selectTitleCell.retrieve("selectAllLoaded")){
+                this.setUnSelectAllStyle();
+            }else{
+                this.createSelectAllNode();
+            }
+        }
+
         if (this.gridJson.length){
             // if( !this.options.paging ){
             this.gridJson.each(function(line, i){
@@ -533,20 +611,38 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({
         }
     },
     loadGroupData: function(){
-        if (this.selectTitleCell && !this.selectTitleCell.retrieve("expandLoaded") ){
-            if( this.viewJson.viewStyles && this.viewJson.viewStyles["groupCollapseNode"] ){
-                this.expandAllNode = new Element("span", {
-                    styles : this.viewJson.viewStyles["groupCollapseNode"]
-                }).inject( this.selectTitleCell );
-                this.selectTitleCell.setStyle("cursor", "pointer");
+        if( this.getSelectFlag() === "multi" && this.viewJson.allowSelectAll ) {
+            if(this.selectTitleCell && this.selectTitleCell.retrieve("selectAllLoaded")){
+                this.setUnSelectAllStyle();
             }else{
-                this.selectTitleCell.set("html", "<span style='font-family: Webdings'>"+"<img src='../x_component_query_Query/$Viewer/"+this.options.style+"/icon/expand.png'/>"+"</span>");
+                this.createSelectAllNode();
             }
-            this.selectTitleCell.setStyle("cursor", "pointer");
-            this.selectTitleCell.addEvent("click", this.expandOrCollapseAll.bind(this));
-            this.selectTitleCell.store("expandLoaded", true);
         }
-        this.expandAll = false;
+
+        if( this.expandTitleCell ){
+            if ( !this.expandTitleCell.retrieve("expandLoaded") ){
+                if( this.viewJson.viewStyles && this.viewJson.viewStyles["groupCollapseNode"] ){
+                    this.expandAllNode = new Element("span", {
+                        styles : this.viewJson.viewStyles["groupCollapseNode"]
+                    }).inject( this.expandTitleCell, "top" );
+                    // this.selectTitleCell.setStyle("cursor", "pointer");
+                }else{
+                    // this.selectTitleCell.set("html", "<span style='font-family: Webdings'>"+"<img src='../x_component_query_Query/$Viewer/"+this.options.style+"/icon/expand.png'/>"+"</span>");
+                    this.expandAllNode = new Element("span",{
+                        html : "<img src='../x_component_query_Query/$Viewer/"+this.options.style+"/icon/expand.png'/>"+"</span>",
+                        style : "font-family: Webdings"
+                    }).inject( this.expandTitleCell, "top" );
+                }
+                this.expandTitleCell.setStyle("cursor", "pointer");
+                this.expandTitleCell.addEvent("click", this.expandOrCollapseAll.bind(this));
+                this.expandTitleCell.store("expandLoaded", true);
+            }else if( this.getExpandFlag() !=="yes" ){
+                this.setCollapseAllStyle();
+            }
+        }
+
+
+        // this.isAllExpanded = false;
 
         if (this.gridJson.length){
             var i = 0;
@@ -555,50 +651,11 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({
                 i += data.list.length;
             }.bind(this));
 
-            if (this.json.isExpand=="yes") this.expandOrCollapseAll();
+            if (this.getExpandFlag()=="yes") this.expandOrCollapseAll();
         }else{
             if (this.viewPageAreaNode) this.viewPageAreaNode.empty();
         }
     },
-    expandOrCollapseAll: function(){
-        if( this.viewJson.viewStyles && this.viewJson.viewStyles["groupCollapseNode"] ){
-            var span = this.selectTitleCell.getElement("span");
-            if( this.expandAll ){
-                this.items.each(function(item){
-                    item.collapse();
-                    span.setStyles( this.viewJson.viewStyles["groupCollapseNode"] );
-                }.bind(this));
-                this.expandAll = false;
-            }else{
-                this.items.each(function(item, i){
-                    window.setTimeout(function(){
-                        item.expand();
-                    }.bind(this), 10*i+5);
-
-                    span.setStyles( this.viewJson.viewStyles["groupExpandNode"] );
-                    this.expandAll = true;
-                }.bind(this));
-            }
-        }else{
-            var icon = this.selectTitleCell.getElement("span");
-            if (icon.get("html").indexOf("expand.png")===-1){
-                this.items.each(function(item){
-                    item.collapse();
-                    icon.set("html", "<img src='../x_component_query_Query/$Viewer/"+this.options.style+"/icon/expand.png'/>");
-                }.bind(this));
-                this.expandAll = false;
-            }else{
-                this.items.each(function(item, i){
-                    window.setTimeout(function(){
-                        item.expand();
-                    }.bind(this), 10*i+5);
-
-                    icon.set("html", "<img src='../x_component_query_Query/$Viewer/"+this.options.style+"/icon/down.png'/>");
-                }.bind(this));
-                this.expandAll = true;
-            }
-        }
-    },
     getView: function(callback){
         this.getLookupAction(function(){
             if (this.json.application){
@@ -1225,39 +1282,192 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({
     getSelectedData : function(){
         return this.getData();
     },
+    getSelectAllStatus : function(){
+        if( this.getSelectFlag()!=="multi")return;
+        if( !this.items.length )return "none";
+        var allFlag = true, noneFlag = true;
+        for( var i=0; i<this.items.length; i++ ){
+            var item = this.items[i];
+            if( item.clazzType === "item" ){
+                item.isSelected ? ( noneFlag = false ) : (allFlag = false);
+            }else{
+                var f = item.getSelectAllStatus();
+                if( f === "none" ){
+                    allFlag = false;
+                }else if( f === "all" ){
+                    noneFlag = false;
+                }else if(f==="some"){
+                    allFlag = false;
+                    noneFlag = false;
+                }
+            }
+            if( !allFlag && !noneFlag )return "some"
+        }
+        if( allFlag )return "all";
+        if( noneFlag )return "none";
+        return "some";
+    },
+    checkSelectAllStatus : function(){
+        if(!this.selectAllNode)return;
+       var status = this.getSelectAllStatus();
+       if( status === "all" ){
+           this.setSelectAllStyle()
+       }else{
+           this.setUnSelectAllStyle()
+       }
+    },
+    setSelectAllStyle : function () {
+        if(!this.selectAllNode)return;
+        if( this.viewJson.viewStyles && this.viewJson.viewStyles["checkedCheckboxNode"] ){
+            this.selectAllNode.setStyles( this.viewJson.viewStyles["checkedCheckboxNode"] );
+        }else {
+            this.selectAllNode.getElement("img").set("src",
+                '../x_component_query_Query/$Viewer/" + this.options.style + "/icon/checkbox_checked.png' )
+        }
+    },
+    setUnSelectAllStyle : function () {
+        if(!this.selectAllNode)return;
+        if( this.viewJson.viewStyles && this.viewJson.viewStyles["checkboxNode"] ){
+            this.selectAllNode.setStyles( this.viewJson.viewStyles["checkboxNode"] );
+        }else {
+            this.selectAllNode.getElement("img").set("src",
+                '../x_component_query_Query/$Viewer/" + this.options.style + "/icon/checkbox.png' )
+        }
+    },
     selectAll : function(){
-        var flag = this.json.select || this.viewJson.select ||  "none";
-        if ( flag==="multi"){
+        // var flag = this.json.select || this.viewJson.select ||  "none";
+        if ( this.getSelectFlag()==="multi"){
             this.items.each( function (item) {
                 if( item.clazzType === "item" ){
-                    item.selected();
+                    item.selected("view");
                 }else{
-                    item.expand();
-                    if( item.items ){
-                        item.items.each( function (it) {
-                            it.selected();
-                        })
-                    }
+                    item.selectAll("view");
+                    // item.expand();
+                    // if( item.items ){
+                    //     item.items.each( function (it) {
+                    //         it.selected();
+                    //     })
+                    // }
                 }
             })
+            if( this.viewJson.allowSelectAll ) {
+                this.setSelectAllStyle();
+            }
         }
     },
     unSelectAll : function(){
-        var flag = this.json.select || this.viewJson.select ||  "none";
-        if ( flag==="multi"){
+        // var flag = this.json.select || this.viewJson.select ||  "none";
+        if ( this.getSelectFlag()==="multi"){
             this.items.each( function (item) {
                 if( item.clazzType === "item" ){
-                    item.unSelected();
+                    item.unSelected("view");
                 }else{
-                    if(item.items){
-                        item.items.each( function (it) {
-                            it.unSelected();
-                        })
-                    }
+                    item.unSelectAll("view");
+                    // if(item.items){
+                    //     item.items.each( function (it) {
+                    //         it.unSelected();
+                    //     })
+                    // }
                 }
             })
+            if( this.viewJson.allowSelectAll ) {
+                this.setUnSelectAllStyle();
+            }
         }
     },
+
+    getExpandAllStatus: function(){
+        if( !this.items.length )return "none";
+        var allFlag = true, noneFlag = true;
+        for( var i=0; i<this.items.length; i++ ){
+            var item = this.items[i];
+            item.expanded ? ( noneFlag = false ) : (allFlag = false);
+            if( !allFlag && !noneFlag )return "some"
+        }
+        if( allFlag )return "all";
+        if( noneFlag )return "none";
+        return "some";
+    },
+    checkExpandAllStatus: function(){
+        if(!this.expandAllNode)return;
+        var status = this.getExpandAllStatus();
+        if( status === "all" ){
+            this.setExpandAllStyle()
+        }else{
+            this.setCollapseAllStyle()
+        }
+    },
+    setExpandAllStyle: function(){
+        if(!this.expandAllNode)return;
+        if( this.viewJson.viewStyles && this.viewJson.viewStyles["groupExpandNode"] ){
+            this.expandAllNode.setStyles( this.viewJson.viewStyles["groupExpandNode"] );
+        }else{
+            this.expandAllNode.set("html", "<img src='../x_component_query_Query/$Viewer/"+this.options.style+"/icon/expand.png'/>");
+        }
+    },
+    setCollapseAllStyle : function(){
+        if(!this.expandAllNode)return;
+        if( this.viewJson.viewStyles && this.viewJson.viewStyles["groupCollapseNode"] ){
+            this.expandAllNode.setStyles( this.viewJson.viewStyles["groupCollapseNode"] );
+        }else{
+            this.expandAllNode.set("html", "<img src='../x_component_query_Query/$Viewer/"+this.options.style+"/icon/down.png'/>");
+        }
+    },
+    expandAll: function(){
+        this.items.each(function(item, i){
+            window.setTimeout(function(){
+                item.expand( "view" );
+            }.bind(this), 10*i+5);
+        }.bind(this));
+        this.setExpandAllStyle();
+    },
+    collapseAll: function(){
+        this.items.each(function(item){
+            item.collapse( "view" );
+        }.bind(this));
+        this.setCollapseAllStyle();
+    },
+    expandOrCollapseAll: function(){
+        this.getExpandAllStatus() === "all" ? this.collapseAll() : this.expandAll();
+        // if( this.viewJson.viewStyles && this.viewJson.viewStyles["groupCollapseNode"] ){
+        //     var span = this.expandAllNode; //this.selectTitleCell.getElement("span");
+        //     if( this.isAllExpanded ){
+        //         this.items.each(function(item){
+        //             item.collapse();
+        //             span.setStyles( this.viewJson.viewStyles["groupCollapseNode"] );
+        //         }.bind(this));
+        //         this.isAllExpanded = false;
+        //     }else{
+        //         this.items.each(function(item, i){
+        //             window.setTimeout(function(){
+        //                 item.expand();
+        //             }.bind(this), 10*i+5);
+        //
+        //             span.setStyles( this.viewJson.viewStyles["groupExpandNode"] );
+        //             this.isAllExpanded = true;
+        //         }.bind(this));
+        //     }
+        // }else{
+        //     var icon = this.expandAllNode; //this.selectTitleCell.getElement("span");
+        //     if (icon.get("html").indexOf("expand.png")===-1){
+        //         this.items.each(function(item){
+        //             item.collapse();
+        //             icon.set("html", "<img src='../x_component_query_Query/$Viewer/"+this.options.style+"/icon/expand.png'/>");
+        //         }.bind(this));
+        //         this.isAllExpanded = false;
+        //     }else{
+        //         this.items.each(function(item, i){
+        //             window.setTimeout(function(){
+        //                 item.expand();
+        //             }.bind(this), 10*i+5);
+        //
+        //             icon.set("html", "<img src='../x_component_query_Query/$Viewer/"+this.options.style+"/icon/down.png'/>");
+        //         }.bind(this));
+        //         this.isAllExpanded = true;
+        //     }
+        // }
+    },
+
     setFilter : function( filter, callback ){
         if( this.lookuping || this.pageloading )return;
         if( !filter )filter = [];
@@ -1302,11 +1512,12 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({
 });
 
 MWF.xApplication.query.Query.Viewer.Item = new Class({
-    initialize: function(view, data, prev, i){
+    initialize: function(view, data, prev, i, category){
         this.view = view;
         this.data = data;
         this.css = this.view.css;
         this.isSelected = false;
+        this.category = category;
         this.prev = prev;
         this.idx = i;
         this.clazzType = "item";
@@ -1332,6 +1543,24 @@ MWF.xApplication.query.Query.Viewer.Item = new Class({
         this.selectTd = new Element("td", { "styles": viewContentTdNode }).inject(this.node);
         this.selectTd.setStyles({"cursor": "pointer"});
         if (this.view.json.itemStyles) this.selectTd.setStyles(this.view.json.itemStyles);
+
+        //var selectFlag = this.view.json.select || this.view.viewJson.select ||  "none";
+        var selectFlag = this.view.getSelectFlag();
+        if ( ["multi","single"].contains(selectFlag) && this.view.viewJson.selectBoxShow==="always") {
+            var viewStyles = this.view.viewJson.viewStyles;
+            if (viewStyles) {
+                if (selectFlag === "single") {
+                    this.selectTd.setStyles(viewStyles["radioNode"]);
+                } else {
+                    this.selectTd.setStyles(viewStyles["checkboxNode"]);
+                }
+            } else {
+                var iconName = "checkbox";
+                if (selectFlag === "single") iconName = "radiobox";
+                this.selectTd.setStyles({"background": "url(" + "../x_component_query_Query/$Viewer/default/icon/" + iconName + ".png) center center no-repeat"});
+            }
+        }
+
         if( this.view.isSelectTdHidden() ){
             this.selectTd.hide();
         }
@@ -1594,11 +1823,11 @@ MWF.xApplication.query.Query.Viewer.Item = new Class({
     },
 
     setEvent: function(){
-        var flag = this.view.json.select || this.view.viewJson.select ||  "none";
+        var flag = this.view.getSelectFlag();
         if ( flag ==="single" || flag==="multi"){
             this.node.addEvents({
                 "mouseover": function(){
-                    if (!this.isSelected){
+                    if (!this.isSelected && this.view.viewJson.selectBoxShow !=="always" ){
                         var viewStyles = this.view.viewJson.viewStyles;
                         if( viewStyles ){
                             if( flag === "single" ){
@@ -1614,7 +1843,7 @@ MWF.xApplication.query.Query.Viewer.Item = new Class({
                     }
                 }.bind(this),
                 "mouseout": function(){
-                    if (!this.isSelected) this.selectTd.setStyles({"background": "transparent"});
+                    if (!this.isSelected && this.view.viewJson.selectBoxShow !=="always") this.selectTd.setStyles({"background": "transparent"});
                 }.bind(this),
                 "click": function(){this.select();}.bind(this)
             });
@@ -1622,7 +1851,8 @@ MWF.xApplication.query.Query.Viewer.Item = new Class({
     },
 
     select: function(  force ){
-        var flag = force || this.view.json.select || this.view.viewJson.select ||  "none";
+        // var flag = force || this.view.json.select || this.view.viewJson.select ||  "none";
+        var flag = force || this.view.getSelectFlag();
         if (this.isSelected){
             if (flag==="single"){
                 this.unSelectedSingle();
@@ -1639,7 +1869,7 @@ MWF.xApplication.query.Query.Viewer.Item = new Class({
         this.view.fireEvent("select"); //options 传入的事件
     },
 
-    selected: function(){
+    selected: function( from ){
         this.view.selectedItems.push(this);
         var viewStyles = this.view.viewJson.viewStyles;
         if( viewStyles ){
@@ -1650,18 +1880,34 @@ MWF.xApplication.query.Query.Viewer.Item = new Class({
             this.node.setStyles(this.css.viewContentTrNode_selected);
         }
         this.isSelected = true;
+        if( from !== "view" && from !=="category" && this.view.viewJson.allowSelectAll ){
+            this.view.checkSelectAllStatus();
+            if( this.category )this.category.checkSelectAllStatus();
+        }
         this.view.fireEvent("selectRow", [this]);
     },
-    unSelected: function(){
+    unSelected: function( from ){
         this.view.selectedItems.erase(this);
-        this.selectTd.setStyles({"background": "transparent"});
         var viewStyles = this.view.viewJson.viewStyles;
+        if( this.view.viewJson.selectBoxShow !=="always" ){
+            this.selectTd.setStyles({"background": "transparent"});
+        }else{
+            if (viewStyles) {
+                this.selectTd.setStyles(viewStyles["checkboxNode"]);
+            }else{
+                this.selectTd.setStyles({"background": "url(" + "../x_component_query_Query/$Viewer/default/icon/checkbox.png) center center no-repeat"});
+            }
+        }
         if( viewStyles ){
             this.node.setStyles( viewStyles["contentTr"] );
         }else{
             this.node.setStyles(this.css.viewContentTrNode);
         }
         this.isSelected = false;
+        if( from !== "view" && from !=="category" && this.view.viewJson.allowSelectAll ){
+            this.view.checkSelectAllStatus();
+            if( this.category )this.category.checkSelectAllStatus();
+        }
         this.view.fireEvent("unselectRow", [this]);
     },
     selectedSingle: function(){
@@ -1682,8 +1928,16 @@ MWF.xApplication.query.Query.Viewer.Item = new Class({
     unSelectedSingle: function(){
         this.view.selectedItems = [];
         this.view.currentSelectedItem = null;
-        this.selectTd.setStyles({"background": "transparent"});
         var viewStyles = this.view.viewJson.viewStyles;
+        if( this.view.viewJson.selectBoxShow !=="always" ){
+            this.selectTd.setStyles({"background": "transparent"});
+        }else{
+            if (viewStyles) {
+                this.selectTd.setStyles(viewStyles["radioNode"]);
+            }else{
+                this.selectTd.setStyles({"background": "url(" + "../x_component_query_Query/$Viewer/default/icon/radiobox.png) center center no-repeat"});
+            }
+        }
         if( viewStyles ){
             this.node.setStyles( viewStyles["contentTr"] );
         }else{
@@ -1718,6 +1972,32 @@ MWF.xApplication.query.Query.Viewer.ItemCategory = new Class({
         //if (this.view.json.select==="single" || this.view.json.select==="multi"){
         this.selectTd = new Element("td", {"styles": viewContentCategoryTdNode}).inject(this.node);
         if (this.view.json.itemStyles) this.selectTd.setStyles(this.view.json.itemStyles);
+
+        if( this.view.getSelectFlag() === "multi" && this.view.viewJson.allowSelectAll ){
+            this.selectAllNode = this.selectTd;
+            if( viewStyles && viewStyles["checkboxNode"] ){
+                this.selectAllNode.setStyles( viewStyles["checkboxNode"] )
+                // this.selectAllNode = new Element("span", {
+                //     styles : viewStyles["checkboxNode"]
+                // }).inject( this.selectTd );
+            }else{
+                this.selectAllNode.set( "html", "<img src='../x_component_query_Query/$Viewer/"+this.options.style+"/icon/checkbox.png'/>"+"</span>" )
+                // this.selectAllNode = new Element("span",{
+                //     html : "<img src='../x_component_query_Query/$Viewer/"+this.options.style+"/icon/checkbox.png'/>"+"</span>",
+                //     style : "font-family: Webdings"
+                // }).inject( this.selectTd );
+            }
+            this.selectAllNode.setStyle("cursor", "pointer");
+            this.selectAllNode.addEvent("click", function (ev) {
+                if( this.getSelectAllStatus() === "all" ){
+                    this.unSelectAll("category")
+                }else{
+                    this.selectAll("category");
+                }
+                ev.stopPropagation();
+            }.bind(this));
+        }
+
         // if( this.view.isSelectTdHidden() ){
         //     this.selectTd.hide();
         // }
@@ -1784,6 +2064,77 @@ MWF.xApplication.query.Query.Viewer.ItemCategory = new Class({
 
         this.view.fireEvent("postLoadCategoryRow", [null, this]);
     },
+    getSelectAllStatus : function(){
+        if ( this.view.getSelectFlag()!=="multi")return;
+        if( !this.items.length )return "none";
+        var flag = "all";
+        var allFlag = true, noneFlag = true;
+        for( var i=0; i<this.items.length; i++ ){
+            var item = this.items[i];
+            item.isSelected ? ( noneFlag = false ) : (allFlag = false);
+            if( !allFlag && !noneFlag )return "some"
+        }
+        if( allFlag )return "all";
+        if( noneFlag )return "none";
+        return "some";
+    },
+    checkSelectAllStatus : function(){
+        if( !this.selectAllNode )return;
+        var status = this.getSelectAllStatus();
+        if( status === "all" ){
+            this.setSelectAllStyle()
+        }else{
+            this.setUnSelectAllStyle()
+        }
+    },
+    setSelectAllStyle : function () {
+        if( !this.selectAllNode )return;
+        if( this.view.viewJson.viewStyles && this.view.viewJson.viewStyles["checkedCheckboxNode"] ){
+            this.selectAllNode.setStyles( this.view.viewJson.viewStyles["checkedCheckboxNode"] );
+        }else {
+            this.selectAllNode.getElement("img").set("src",
+                '../x_component_query_Query/$Viewer/" + this.options.style + "/icon/checkbox_checked.png' )
+        }
+    },
+    setUnSelectAllStyle : function () {
+        if( !this.selectAllNode )return;
+        if( this.view.viewJson.viewStyles && this.view.viewJson.viewStyles["checkboxNode"] ){
+            this.selectAllNode.setStyles( this.view.viewJson.viewStyles["checkboxNode"] );
+        }else {
+            this.selectAllNode.getElement("img").set("src",
+                '../x_component_query_Query/$Viewer/" + this.options.style + "/icon/checkbox.png' )
+        }
+    },
+    selectAll : function( from ){
+        // var flag = this.json.select || this.viewJson.select ||  "none";
+        if ( this.view.getSelectFlag()==="multi"){
+            this.expand();
+            this.items.each( function (item) {
+                item.selected( from );
+            })
+            if( this.view.viewJson.allowSelectAll ){
+                this.setSelectAllStyle();
+                if( from !== "view" ){
+                    this.view.checkSelectAllStatus();
+                }
+            }
+        }
+
+    },
+    unSelectAll : function( from ){
+        // var flag = this.json.select || this.viewJson.select ||  "none";
+        if ( this.view.getSelectFlag()==="multi"){
+            this.items.each( function (item) {
+                item.unSelected( from );
+            })
+            if( this.view.viewJson.allowSelectAll ) {
+                this.setUnSelectAllStyle();
+                if (from !== "view") {
+                    this.view.checkSelectAllStatus();
+                }
+            }
+        }
+    },
     setEvent: function(){
         //if (this.selectTd){
         this.node.addEvents({
@@ -1804,7 +2155,7 @@ MWF.xApplication.query.Query.Viewer.ItemCategory = new Class({
             this.expand();
         }
     },
-    collapse: function(){
+    collapse: function( from ){
         this.items.each(function(item){
             item.node.setStyle("display", "none");
         }.bind(this));
@@ -1814,8 +2165,11 @@ MWF.xApplication.query.Query.Viewer.ItemCategory = new Class({
             this.node.getElement("span").set("html", "<img src='../x_component_query_Query/$Viewer/"+this.view.options.style+"/icon/expand.png'/>");
         }
         this.expanded = false;
+        if( from !== "view" ){
+            this.view.checkExpandAllStatus();
+        }
     },
-    expand: function(){
+    expand: function( from ){
         this.items.each(function(item){
             item.node.setStyle("display", "table-row");
         }.bind(this));
@@ -1829,12 +2183,15 @@ MWF.xApplication.query.Query.Viewer.ItemCategory = new Class({
             //window.setTimeout(function(){
             this.data.list.each(function(line, i){
                 var s = this.idx+i;
-                this.lastItem = new MWF.xApplication.query.Query.Viewer.Item(this.view, line, (this.lastItem || this), s);
+                this.lastItem = new MWF.xApplication.query.Query.Viewer.Item(this.view, line, (this.lastItem || this), s, this);
                 this.items.push(this.lastItem);
             }.bind(this));
             this.loadChild = true;
             //}.bind(this), 10);
         }
+        if( from !== "view" ){
+            this.view.checkExpandAllStatus();
+        }
     }
 });
 

+ 148 - 122
o2web/source/x_component_query_ViewDesigner/$View/view.html

@@ -65,16 +65,42 @@
             <tr>
                 <td class="editTableTitle">选择:</td>
                 <td class="editTableValue">
-                    <input class="editTableRadio" name="data.select" text{($.data.select!=='single' || $.data.select!=='multi' )?'checked':''} type="radio" value="none"/>无
-                    <input class="editTableRadio" name="data.select" text{($.data.select==='single')?'checked':''} type="radio" value="single"/>单选
-                    <input class="editTableRadio" name="data.select" text{($.data.select==='multi')?'checked':''} type="radio" value="multi"/>多选
+                    <input class="editTableRadio" name="data.select" text{($.data.select!=='single' || $.data.select!=='multi' )?'checked':''} type="radio" value="none" onclick="
+                    if (this.checked){
+                        $('text{$.id}selectBoxShowTr').setStyle('display', 'none');
+                        $('text{$.id}allowSelectAllTr').setStyle('display', 'none');
+                    }"/>无
+                    <input class="editTableRadio" name="data.select" text{($.data.select==='single')?'checked':''} type="radio" value="single" onclick="
+                    if (this.checked){
+                        $('text{$.id}selectBoxShowTr').setStyle('display', 'table-row');
+                        $('text{$.id}allowSelectAllTr').setStyle('display', 'none');
+                    }"/>单选
+                    <input class="editTableRadio" name="data.select" text{($.data.select==='multi')?'checked':''} type="radio" value="multi" onclick="
+                    if (this.checked){
+                        $('text{$.id}selectBoxShowTr').setStyle('display', 'table-row');
+                        $('text{$.id}allowSelectAllTr').setStyle('display', 'table-row');
+                    }"/>多选
+                </td>
+            </tr>
+            <tr id="text{$.id}selectBoxShowTr" style="display: text{($.data.select=='single' || $.data.select=='multi')?'':'none'}">
+                <td class="editTableTitle">选择框显示:</td>
+                <td class="editTableValue">
+                    <input class="editTableRadio" name="data.selectBoxShow" text{($.data.selectBoxShow==='always')?'checked':''} type="radio" value="always"/>一直显示
+                    <input class="editTableRadio" name="data.selectBoxShow" text{($.data.selectBoxShow!=='always')?'checked':''} type="radio" value="mouseover"/>鼠标经过时
+                </td>
+            </tr>
+            <tr id="text{$.id}allowSelectAllTr" style="display: text{($.data.select=='multi')?'':'none'}">
+                <td class="editTableTitle" id="">允许全选:</td>
+                <td class="editTableValue">
+                    <input class="editTableRadio" name="data.allowSelectAll" text{($.data.allowSelectAll===true)?'checked':''} type="radio" value="true"/>是
+                    <input class="editTableRadio" name="data.allowSelectAll" text{($.data.allowSelectAll!==true)?'checked':''} type="radio" value="false"/>否
                 </td>
             </tr>
             <tr>
                 <td class="editTableTitle">无分类和选择隐藏首列</td>
                 <td class="editTableValue">
-                    <input class="editTableRadio" name="data.firstTdHidden" text{($.data.firstTdHidden===true)?'checked':''} type="radio" value="single"/>是
-                    <input class="editTableRadio" name="data.firstTdHidden" text{($.data.firstTdHidden!==true)?'checked':''} type="radio" value="multi"/>否
+                    <input class="editTableRadio" name="data.firstTdHidden" text{($.data.firstTdHidden===true)?'checked':''} type="radio" value="true"/>是
+                    <input class="editTableRadio" name="data.firstTdHidden" text{($.data.firstTdHidden!==true)?'checked':''} type="radio" value="false"/>否
                 </td>
             </tr>
             <tr>
@@ -131,124 +157,8 @@
 
 
     <div title="范围"  class="MWFTab">
-        <div style="height:24px; text-align: center; line-height: 24px; background-color: #EEE; border-top: 1px solid #999; font-weight: bold">范围</div>
-        <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
-            <tr>
-                <td class="editTableValue" colspan="2" align="center">
-                    <input class="editTableRadio" onclick="
-                    if (this.checked){
-                        $('text{$.id}dateRangeType_process').setStyle('display', 'block');
-                        $('text{$.id}dateRangeType_cms').setStyle('display', 'none');
-                        $$('.text{$.id}dataPathSelectedProcessArea').setStyle('display', '');
-                        $$('.text{$.id}dataPathSelectedCMSArea').setStyle('display', 'none');
-                    }" name="text{$.id}*type" text{($.type!='cms')?'checked':''} type="radio" value="process"/>流程平台数据
-                    <input class="editTableRadio" onclick="
-                    if (this.checked){
-                        $('text{$.id}dateRangeType_process').setStyle('display', 'none');
-                        $('text{$.id}dateRangeType_cms').setStyle('display', 'block');
-                        $$('.text{$.id}dataPathSelectedProcessArea').setStyle('display', 'none');
-                        $$('.text{$.id}dataPathSelectedCMSArea').setStyle('display', '');
-                     }" name="text{$.id}*type" text{($.type=='cms')?'checked':''} type="radio" value="cms"/>内容管理数据
-                </td>
-            </tr>
-        </table>
-
-        <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
-            <tr>
-                <td class="editTableTitle">权限:</td>
-                <td class="editTableValue">
-                    <input class="editTableRadio" name="text{$.id}*data.where.accessible" text{($.data.where.accessible)?'checked':''} type="radio" value="true"/>带权限
-                    <input class="editTableRadio" name="text{$.id}*data.where.accessible" text{(!$.data.where.accessible)?'checked':''} type="radio" value="false"/>忽略
-                </td>
-            </tr>
-        </table>
-        <div id="text{$.id}dateRangeType_process" style="display: text{($.type!='cms')?'block':'none'}">
-            <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
-                <tr>
-                    <td class="editTableTitle">流转状态:</td>
-                    <td class="editTableValue">
-                        <input class="editTableRadio" name="text{$.id}*data.where.scope" text{($.data.where.scope!='workCompleted' && $.data.where.scope!='all' && $.data.where.scope!='cms_info' && $.data.where.scope!='cms_data')?'checked':''} type="radio" value="work"/>流转中
-                        <input class="editTableRadio" name="text{$.id}*data.where.scope" text{($.data.where.scope=='workCompleted')?'checked':''} type="radio" value="workCompleted"/>已完成
-                        <input class="editTableRadio" name="text{$.id}*data.where.scope" text{($.data.where.scope=='all')?'checked':''} type="radio" value="all"/>全部
-                    </td>
-                </tr>
-                <tr>
-                    <td class="editTableValue" colspan="2">取应用和流程的并集</td>
-                </tr>
-                <tr>
-                    <td class="editTableTitle">选择应用:</td>
-                    <td class="editTableValue">
-                        <div class="MWFSelectApplication" name="data.where.applicationList"></div>
-                    </td>
-                </tr>
-                <tr>
-                    <td class="editTableTitle">选择流程:</td>
-                    <td class="editTableValue">
-                        <div class="MWFSelectProcess" name="data.where.processList"></div>
-                    </td>
-                </tr>
-            </table>
-        </div>
-        <div id="text{$.id}dateRangeType_cms" style="display: text{($.type=='cms')?'block':'none'}">
-            <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
-                <tr>
-                    <td class="editTableTitle">数据类型:</td>
-                    <td class="editTableValue">
-                        <input class="editTableRadio" name="text{$.id}*data.where.scope" text{($.data.where.scope!='cms_data' && $.data.where.scope!='all' && $.data.where.scope!='workCompleted' && $.data.where.scope!='work')?'checked':''} type="radio" value="cms_info"/>信息类
-                        <input class="editTableRadio" name="text{$.id}*data.where.scope" text{($.data.where.scope=='cms_data')?'checked':''} type="radio" value="cms_data"/>数据类
-                        <!--                        <input class="editTableRadio" name="text{$.id}*data.where.scope" text{($.data.where.scope=='all')?'checked':''} type="radio" value="all"/>全部-->
-                    </td>
-                </tr>
-                <tr>
-                    <td class="editTableTitle">返回草稿:</td>
-                    <td class="editTableValue">
-                        <input class="editTableRadio" name="text{$.id}*data.where.draft" text{($.data.where.draft)?'checked':''} type="radio" value="true"/>是
-                        <input class="editTableRadio" name="text{$.id}*data.where.draft" text{(!$.data.where.draft)?'checked':''} type="radio" value="false"/>否
-                    </td>
-                </tr>
-                <tr>
-                    <td class="editTableValue" colspan="2">取栏目和分类的并集:</td>
-                </tr>
-                <tr>
-                    <td class="editTableTitle">选择栏目:</td>
-                    <td class="editTableValue">
-                        <div class="MWFSelectCMSApplication" name="data.where.appInfoList"></div>
-                    </td>
-                </tr>
-                <tr>
-                    <td class="editTableTitle">选择分类:</td>
-                    <td class="editTableValue">
-                        <div class="MWFSelecCMStCategory" name="data.where.categoryInfoList"></div>
-                    </td>
-                </tr>
-            </table>
-        </div>
-        <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
-            <tr>
-                <td class="editTableValue" colspan="2">取组织、人员和身份的并集:</td>
-            </tr>
-            <tr>
-                <td class="editTableTitle">拟稿组织:</td>
-                <td class="editTableValue">
-                    <div class="MWFSelectUnit" name="data.where.creatorUnitList"></div>
-                </td>
-            </tr>
-            <tr>
-                <td class="editTableTitle">拟稿人员:</td>
-                <td class="editTableValue">
-                    <div class="MWFSelectPerson" name="data.where.creatorPersonList"></div>
-                </td>
-            </tr>
-            <tr>
-                <td class="editTableTitle">拟稿身份:</td>
-                <td class="editTableValue">
-                    <div class="MWFSelectIdentity" name="data.where.creatorIdentityList"></div>
-                </td>
-            </tr>
-        </table>
-
-
         <div style="height:24px; text-align: center; line-height: 24px; background-color: #EEE; border-top: 1px solid #999; font-weight: bold">时段</div>
+        <div style="height:24px; line-height: 24px; padding:5px;border-bottom: 1px dashed rgb(204, 204, 204);">注:建议设定时间范围有助于提高效率!</div>
         <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
             <tr><td class="editTableTitle">时段类型:</td><td class="editTableValue">
                 <input class="editTableRadio" name="text{$.id}*data.where.dateRange.dateRangeType"
@@ -425,6 +335,122 @@
                 </tr>
             </table>
         </div>
+
+        <div style="height:24px; text-align: center; line-height: 24px; background-color: #EEE; border-top: 1px solid #999; font-weight: bold">范围</div>
+        <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
+            <tr>
+                <td class="editTableValue" colspan="2" align="center">
+                    <input class="editTableRadio" onclick="
+                    if (this.checked){
+                        $('text{$.id}dateRangeType_process').setStyle('display', 'block');
+                        $('text{$.id}dateRangeType_cms').setStyle('display', 'none');
+                        $$('.text{$.id}dataPathSelectedProcessArea').setStyle('display', '');
+                        $$('.text{$.id}dataPathSelectedCMSArea').setStyle('display', 'none');
+                    }" name="text{$.id}*type" text{($.type!='cms')?'checked':''} type="radio" value="process"/>流程平台数据
+                    <input class="editTableRadio" onclick="
+                    if (this.checked){
+                        $('text{$.id}dateRangeType_process').setStyle('display', 'none');
+                        $('text{$.id}dateRangeType_cms').setStyle('display', 'block');
+                        $$('.text{$.id}dataPathSelectedProcessArea').setStyle('display', 'none');
+                        $$('.text{$.id}dataPathSelectedCMSArea').setStyle('display', '');
+                     }" name="text{$.id}*type" text{($.type=='cms')?'checked':''} type="radio" value="cms"/>内容管理数据
+                </td>
+            </tr>
+        </table>
+
+        <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
+            <tr>
+                <td class="editTableTitle">权限:</td>
+                <td class="editTableValue">
+                    <input class="editTableRadio" name="text{$.id}*data.where.accessible" text{($.data.where.accessible)?'checked':''} type="radio" value="true"/>带权限
+                    <input class="editTableRadio" name="text{$.id}*data.where.accessible" text{(!$.data.where.accessible)?'checked':''} type="radio" value="false"/>忽略
+                </td>
+            </tr>
+        </table>
+        <div id="text{$.id}dateRangeType_process" style="display: text{($.type!='cms')?'block':'none'}">
+            <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
+                <tr>
+                    <td class="editTableTitle">流转状态:</td>
+                    <td class="editTableValue">
+                        <input class="editTableRadio" name="text{$.id}*data.where.scope" text{($.data.where.scope!='workCompleted' && $.data.where.scope!='all' && $.data.where.scope!='cms_info' && $.data.where.scope!='cms_data')?'checked':''} type="radio" value="work"/>流转中
+                        <input class="editTableRadio" name="text{$.id}*data.where.scope" text{($.data.where.scope=='workCompleted')?'checked':''} type="radio" value="workCompleted"/>已完成
+                        <input class="editTableRadio" name="text{$.id}*data.where.scope" text{($.data.where.scope=='all')?'checked':''} type="radio" value="all"/>全部
+                    </td>
+                </tr>
+                <tr>
+                    <td class="editTableValue" colspan="2">取应用和流程的并集:</td>
+                </tr>
+                <tr>
+                    <td class="editTableTitle">选择应用:</td>
+                    <td class="editTableValue">
+                        <div class="MWFSelectApplication" name="data.where.applicationList"></div>
+                    </td>
+                </tr>
+                <tr>
+                    <td class="editTableTitle">选择流程:</td>
+                    <td class="editTableValue">
+                        <div class="MWFSelectProcess" name="data.where.processList"></div>
+                    </td>
+                </tr>
+            </table>
+        </div>
+        <div id="text{$.id}dateRangeType_cms" style="display: text{($.type=='cms')?'block':'none'}">
+            <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
+                <tr>
+                    <td class="editTableTitle">数据类型:</td>
+                    <td class="editTableValue">
+                        <input class="editTableRadio" name="text{$.id}*data.where.scope" text{($.data.where.scope!='cms_data' && $.data.where.scope!='all' && $.data.where.scope!='workCompleted' && $.data.where.scope!='work')?'checked':''} type="radio" value="cms_info"/>信息类
+                        <input class="editTableRadio" name="text{$.id}*data.where.scope" text{($.data.where.scope=='cms_data')?'checked':''} type="radio" value="cms_data"/>数据类
+                        <!--                        <input class="editTableRadio" name="text{$.id}*data.where.scope" text{($.data.where.scope=='all')?'checked':''} type="radio" value="all"/>全部-->
+                    </td>
+                </tr>
+                <tr>
+                    <td class="editTableTitle">返回草稿:</td>
+                    <td class="editTableValue">
+                        <input class="editTableRadio" name="text{$.id}*data.where.draft" text{($.data.where.draft)?'checked':''} type="radio" value="true"/>是
+                        <input class="editTableRadio" name="text{$.id}*data.where.draft" text{(!$.data.where.draft)?'checked':''} type="radio" value="false"/>否
+                    </td>
+                </tr>
+                <tr>
+                    <td class="editTableValue" colspan="2">取栏目和分类的并集:</td>
+                </tr>
+                <tr>
+                    <td class="editTableTitle">选择栏目:</td>
+                    <td class="editTableValue">
+                        <div class="MWFSelectCMSApplication" name="data.where.appInfoList"></div>
+                    </td>
+                </tr>
+                <tr>
+                    <td class="editTableTitle">选择分类:</td>
+                    <td class="editTableValue">
+                        <div class="MWFSelecCMStCategory" name="data.where.categoryInfoList"></div>
+                    </td>
+                </tr>
+            </table>
+        </div>
+        <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
+            <tr>
+                <td class="editTableValue" colspan="2">取组织、人员和身份的并集:</td>
+            </tr>
+            <tr>
+                <td class="editTableTitle">拟稿组织:</td>
+                <td class="editTableValue">
+                    <div class="MWFSelectUnit" name="data.where.creatorUnitList"></div>
+                </td>
+            </tr>
+            <tr>
+                <td class="editTableTitle">拟稿人员:</td>
+                <td class="editTableValue">
+                    <div class="MWFSelectPerson" name="data.where.creatorPersonList"></div>
+                </td>
+            </tr>
+            <tr>
+                <td class="editTableTitle">拟稿身份:</td>
+                <td class="editTableValue">
+                    <div class="MWFSelectIdentity" name="data.where.creatorIdentityList"></div>
+                </td>
+            </tr>
+        </table>
     </div>
 
     <div title="过滤"  class="MWFTab">

+ 5 - 4
o2web/source/x_desktop/js/base.js

@@ -91,9 +91,9 @@ o2.xDesktop.requireApp = function (module, clazz, callback, async) {
     var _openWorkAndroid = function (options) {
         if (window.o2android && window.o2android.openO2Work) {
             if (options.workId) {
-                window.o2android.openO2Work(options.workId, "", options.title || "");
+                window.o2android.openO2Work(options.workId, "", options.title || options.docTitle || "");
             } else if (options.workCompletedId) {
-                window.o2android.openO2Work("", options.workCompletedId, options.title || "");
+                window.o2android.openO2Work("", options.workCompletedId, options.title || options.docTitle || "");
             }
             return true;
         }
@@ -105,13 +105,13 @@ o2.xDesktop.requireApp = function (module, clazz, callback, async) {
                 window.webkit.messageHandlers.openO2Work.postMessage({
                     "work": options.workId,
                     "workCompleted": "",
-                    "title": options.title || ""
+                    "title": options.title || options.docTitle || ""
                 });
             } else if (options.workCompletedId) {
                 window.webkit.messageHandlers.openO2Work.postMessage({
                     "work": "",
                     "workCompleted": options.workCompletedId,
-                    "title": options.title || ""
+                    "title": options.title || options.docTitle || ""
                 });
             }
             return true;
@@ -222,6 +222,7 @@ o2.xDesktop.requireApp = function (module, clazz, callback, async) {
     };
 
     var _openApplicationPC = function (appNames, options, statusObj) {
+        delete options.docTitle;
         var par = "app=" + encodeURIComponent(appNames) + "&status=" + encodeURIComponent((statusObj) ? JSON.encode(statusObj) : "") + "&option=" + encodeURIComponent((options) ? JSON.encode(options) : "");
         switch (appNames) {
             case "process.Work":

File diff suppressed because it is too large
+ 0 - 0
o2web/source/x_desktop/js/base_work_begin.js


Some files were not shown because too many files changed in this diff