Browse Source

数据网格

unknown 5 years ago
parent
commit
4573013cd2

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

@@ -328,6 +328,72 @@ MWF.xApplication.process.FormDesigner.Module.Datagrid = MWF.FCDatagrid = new Cla
 				if(opacity)td.setStyle("opacity", opacity);
 				if(opacity)td.setStyle("opacity", opacity);
             }.bind(this));
             }.bind(this));
         }
         }
+        if( ["impexpType","impexpPosition","importActionText","importActionStyles","exportActionText","exportActionStyles"].contains( name ) ){
+			//允许导入
+			var importenable  = this.json.impexpType === "impexp" || this.json.impexpType === "imp";
+			//允许导出
+			var exportenable  = this.json.impexpType === "impexp" || this.json.impexpType === "exp";
+
+			if( !exportenable && !importenable ){
+				if( this.impexpNode )this.impexpNode.destroy();
+				return;
+			}
+
+			var position = ["leftTop","centerTop","rightTop"].contains( this.json.impexpPosition || "" ) ? "top" : "bottom";
+			this.impexpNode = new Element("div").inject(this.node, position);
+
+			var importExportAreaNode = new Element("div").inject( this.impexpNode );
+			if( ["leftTop","leftBottom"].contains( this.json.impexpPosition || "" ) ){
+				importExportAreaNode.setStyles({ "float" : "left" })
+			}else if( ["rightTop","rightBottom"].contains( this.json.impexpPosition || "" ) ){
+				importExportAreaNode.setStyles({ "float" : "right" })
+			}else{
+				importExportAreaNode.setStyles({ "margin" : "0px auto" })
+			}
+
+			var styles;
+			if( exportenable ){
+				var exportActionNode = new Element("div", { text : this.json.exportActionText }).inject( importExportAreaNode );
+				if( this.json.exportActionStyles ){
+					styles = Object.clone(this.json.exportActionStyles)
+				}else{
+					styles = {
+						"color" : "#777",
+						"border-radius": "5px",
+						"border": "1px solid #ccc",
+						"cursor": "pointer",
+						"height": "26px",
+						"float" : "left",
+						"line-height": "26px",
+						"padding": "0px 5px",
+						"background-color": "#efefef",
+						"margin" : "5px"
+					}
+				}
+				exportActionNode.setStyles(styles);
+			}
+
+			if( importenable ){
+				var importActionNode = new Element("div", { text : this.json.importActionText }).inject( importExportAreaNode );
+				if( this.json.importActionStyles ){
+					styles = Object.clone(this.json.importActionStyles);
+				}else{
+					styles = {
+						"color" : "#777",
+						"border-radius": "5px",
+						"border": "1px solid #ccc",
+						"cursor": "pointer",
+						"height": "26px",
+						"float" : "left",
+						"line-height": "26px",
+						"padding": "0px 5px",
+						"background-color": "#efefef",
+						"margin" : "5px"
+					}
+				}
+				importActionNode.setStyles(styles);
+			}
+		}
         //if (name=="sequence") this.checkSequenceShow();
         //if (name=="sequence") this.checkSequenceShow();
 	},
 	},
     setDatagridStyles: function(){
     setDatagridStyles: function(){

+ 36 - 17
o2web/source/x_component_process_FormDesigner/Module/Datagrid/datagrid.html

@@ -65,26 +65,45 @@
             <tr>
             <tr>
                 <td class="editTableTitle">启用:</td>
                 <td class="editTableTitle">启用:</td>
                 <td class="editTableValue">
                 <td class="editTableValue">
-                    <input type="radio" name="impexpType" value="none" text{(!$.impexpType || $.impexpType==='none')?'checked':''}/>禁用
-                    <input type="radio" name="impexpType" value="impexp" text{($.impexpType==='impexp')?'checked':''}/>导出导入
-                    <input type="radio" name="impexpType" value="exp" text{($.impexpType==='exp')?'checked':''}/>仅导出
-                    <input type="radio" name="impexpType" value="imp" text{($.impexpType==='imp')?'checked':''}/>仅导入
-                </td>
-            </tr>
-            <tr>
-                <td class="editTableTitle">按钮位置:</td>
-                <td class="editTableValue">
-                    <input type="radio" name="impexpPosition" value="leftTop" text{(!$.impexpPosition || $.impexpPosition==='leftTop')?'checked':''}/>左上
-                    <input type="radio" name="impexpPosition" value="centerTop" text{($.impexpPosition==='centerTop')?'checked':''}/>中上
-                    <input type="radio" name="impexpPosition" value="rightTop" text{($.impexpPosition==='rightTop')?'checked':''}/>右上
-                    <input type="radio" name="impexpPosition" value="leftBottom" text{($.impexpPosition==='leftBottom')?'checked':''}/>左下
-                    <input type="radio" name="impexpPosition" value="centerBottom" text{($.impexpPosition==='centerBottom')?'checked':''}/>中下
-                    <input type="radio" name="impexpPosition" value="rightBottom" text{($.impexpPosition==='rightBottom')?'checked':''}/>右下
+                    <input type="radio" name="impexpType" value="none" text{(!$.impexpType || $.impexpType==='none')?'checked':''}
+                           onclick="if (this.checked){ $('text{$.pid}impexpArea').setStyle('display', 'none')}" />禁用
+                    <input type="radio" name="impexpType" value="impexp" text{($.impexpType==='impexp')?'checked':''}
+                           onclick="if (this.checked){ $('text{$.pid}impexpArea').setStyle('display', 'block')}" />导出导入
+                    <input type="radio" name="impexpType" value="exp" text{($.impexpType==='exp')?'checked':''}
+                           onclick="if (this.checked){ $('text{$.pid}impexpArea').setStyle('display', 'block')}" />仅导出
+                    <input type="radio" name="impexpType" value="imp" text{($.impexpType==='imp')?'checked':''}
+                           onclick="if (this.checked){ $('text{$.pid}impexpArea').setStyle('display', 'block')}" />仅导入
                 </td>
                 </td>
             </tr>
             </tr>
         </table>
         </table>
-        <div class="MWFMaplist" name="importActionStyles" collapse="true" title="导入按钮样式"></div>
-        <div class="MWFMaplist" name="exportActionStyles" collapse="true" title="导出按钮样式"></div>
+        <div id="text{$.pid}impexpArea" style="display: text{($.impexpType && $.impexpType!=='none')?'block':'none'};">
+            <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
+                <tr>
+                    <td class="editTableTitle">按钮位置:</td>
+                    <td class="editTableValue">
+                        <input type="radio" name="impexpPosition" value="leftTop" text{(!$.impexpPosition || $.impexpPosition==='leftTop')?'checked':''}/>左上
+                        <input type="radio" name="impexpPosition" value="centerTop" text{($.impexpPosition==='centerTop')?'checked':''}/>中上
+                        <input type="radio" name="impexpPosition" value="rightTop" text{($.impexpPosition==='rightTop')?'checked':''}/>右上
+                        <input type="radio" name="impexpPosition" value="leftBottom" text{($.impexpPosition==='leftBottom')?'checked':''}/>左下
+                        <input type="radio" name="impexpPosition" value="centerBottom" text{($.impexpPosition==='centerBottom')?'checked':''}/>中下
+                        <input type="radio" name="impexpPosition" value="rightBottom" text{($.impexpPosition==='rightBottom')?'checked':''}/>右下
+                    </td>
+                </tr>
+                <tr>
+                    <td class="editTableTitle">导入按钮文本:</td>
+                    <td class="editTableValue"><input type="text" name="importActionText" value="text{$.importActionText || '导入Excel'}" class="editTableInput"/></td>
+                </tr>
+            </table>
+            <div class="MWFMaplist" name="importActionStyles" collapse="true" title="导入按钮样式"></div>
+            <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
+                <tr>
+                    <td class="editTableTitle">导出按钮文本:</td>
+                    <td class="editTableValue"><input type="text" name="exportActionText" value="text{$.exportActionText || '导出Excel'}" class="editTableInput"/></td>
+                </tr>
+            </table>
+            <div class="MWFMaplist" name="exportActionStyles" collapse="true" title="导出按钮样式"></div>
+            <div class="MWFFormulaArea" name="excelName" title="导出文件名称"></div>
+        </div>
 
 
         <div class="MWFValidation" name="validationConfig"></div>
         <div class="MWFValidation" name="validationConfig"></div>
         <div class="MWFScriptArea" name="validation" title="校验脚本 (S)"></div>
         <div class="MWFScriptArea" name="validation" title="校验脚本 (S)"></div>

+ 8 - 0
o2web/source/x_component_process_FormDesigner/Module/Datagrid/template.json

@@ -51,6 +51,14 @@
 		  "code": "",
 		  "code": "",
 		  "html": ""
 		  "html": ""
 		},
 		},
+		"export": {
+			"code": "",
+			"html": ""
+		},
+		"import": {
+			"code": "",
+			"html": ""
+		},
 		"click": {
 		"click": {
 			"code": "",
 			"code": "",
 			"html": ""
 			"html": ""

+ 20 - 2
o2web/source/x_component_process_FormDesigner/Module/Form/skin/styles_blue-flat.json

@@ -270,10 +270,28 @@
       "border-bottom": "0px solid #DCDFE6"
       "border-bottom": "0px solid #DCDFE6"
     },
     },
     "importActionStyles" : {
     "importActionStyles" : {
-
+      "color" : "#777",
+      "border-radius": "5px",
+      "border": "1px solid #ccc",
+      "cursor": "pointer",
+      "height": "26px",
+      "float" : "left",
+      "line-height": "26px",
+      "padding": "0px 5px",
+      "background-color": "#efefef",
+      "margin" : "5px"
     },
     },
     "exportActionStyles" : {
     "exportActionStyles" : {
-
+      "color" : "#777",
+      "border-radius": "5px",
+      "border": "1px solid #ccc",
+      "cursor": "pointer",
+      "height": "26px",
+      "float" : "left",
+      "line-height": "26px",
+      "padding": "0px 5px",
+      "background-color": "#efefef",
+      "margin" : "5px"
     },
     },
     "properties": {
     "properties": {
       "border": "0",
       "border": "0",

+ 24 - 0
o2web/source/x_component_process_FormDesigner/Module/Form/skin/styles_blue-simple.json

@@ -244,6 +244,30 @@
       "font-weight": "bold",
       "font-weight": "bold",
       "border-bottom": "0px solid #cccccc"
       "border-bottom": "0px solid #cccccc"
     },
     },
+    "importActionStyles" : {
+      "color" : "#777",
+      "border-radius": "5px",
+      "border": "1px solid #ccc",
+      "cursor": "pointer",
+      "height": "26px",
+      "float" : "left",
+      "line-height": "26px",
+      "padding": "0px 5px",
+      "background-color": "#efefef",
+      "margin" : "5px"
+    },
+    "exportActionStyles" : {
+      "color" : "#777",
+      "border-radius": "5px",
+      "border": "1px solid #ccc",
+      "cursor": "pointer",
+      "height": "26px",
+      "float" : "left",
+      "line-height": "26px",
+      "padding": "0px 5px",
+      "background-color": "#efefef",
+      "margin" : "5px"
+    },
     "properties": {
     "properties": {
       "border": "0",
       "border": "0",
       "cellpadding": "3",
       "cellpadding": "3",

+ 24 - 0
o2web/source/x_component_process_FormDesigner/Module/Form/skin/styles_cmcc.json

@@ -252,6 +252,30 @@
       "font-weight": "bold",
       "font-weight": "bold",
       "border-bottom": "0px solid #cccccc"
       "border-bottom": "0px solid #cccccc"
     },
     },
+    "importActionStyles" : {
+      "color" : "#777",
+      "border-radius": "5px",
+      "border": "1px solid #ccc",
+      "cursor": "pointer",
+      "height": "26px",
+      "float" : "left",
+      "line-height": "26px",
+      "padding": "0px 5px",
+      "background-color": "#efefef",
+      "margin" : "5px"
+    },
+    "exportActionStyles" : {
+      "color" : "#777",
+      "border-radius": "5px",
+      "border": "1px solid #ccc",
+      "cursor": "pointer",
+      "height": "26px",
+      "float" : "left",
+      "line-height": "26px",
+      "padding": "0px 5px",
+      "background-color": "#efefef",
+      "margin" : "5px"
+    },
     "properties": {
     "properties": {
       "border": "0",
       "border": "0",
       "cellpadding": "3",
       "cellpadding": "3",

+ 24 - 0
o2web/source/x_component_process_FormDesigner/Module/Form/skin/styles_default.json

@@ -249,6 +249,30 @@
       "font-weight": "bold",
       "font-weight": "bold",
       "border-bottom": "0px solid #cccccc"
       "border-bottom": "0px solid #cccccc"
     },
     },
+    "importActionStyles" : {
+      "color" : "#777",
+      "border-radius": "5px",
+      "border": "1px solid #ccc",
+      "cursor": "pointer",
+      "height": "26px",
+      "float" : "left",
+      "line-height": "26px",
+      "padding": "0px 5px",
+      "background-color": "#efefef",
+      "margin" : "5px"
+    },
+    "exportActionStyles" : {
+      "color" : "#777",
+      "border-radius": "5px",
+      "border": "1px solid #ccc",
+      "cursor": "pointer",
+      "height": "26px",
+      "float" : "left",
+      "line-height": "26px",
+      "padding": "0px 5px",
+      "background-color": "#efefef",
+      "margin" : "5px"
+    },
     "properties": {
     "properties": {
       "width": "100%",
       "width": "100%",
       "border": "0",
       "border": "0",

+ 24 - 0
o2web/source/x_component_process_FormDesigner/Module/Form/skin/styles_defaultMobile.json

@@ -232,6 +232,30 @@
       "font-weight": "bold",
       "font-weight": "bold",
       "border-bottom": "0px solid #cccccc"
       "border-bottom": "0px solid #cccccc"
     },
     },
+    "importActionStyles" : {
+      "color" : "#777",
+      "border-radius": "5px",
+      "border": "1px solid #ccc",
+      "cursor": "pointer",
+      "height": "26px",
+      "float" : "left",
+      "line-height": "26px",
+      "padding": "0px 5px",
+      "background-color": "#efefef",
+      "margin" : "5px"
+    },
+    "exportActionStyles" : {
+      "color" : "#777",
+      "border-radius": "5px",
+      "border": "1px solid #ccc",
+      "cursor": "pointer",
+      "height": "26px",
+      "float" : "left",
+      "line-height": "26px",
+      "padding": "0px 5px",
+      "background-color": "#efefef",
+      "margin" : "5px"
+    },
     "properties": {
     "properties": {
       "border": "0",
       "border": "0",
       "cellpadding": "5",
       "cellpadding": "5",

+ 24 - 0
o2web/source/x_component_process_FormDesigner/Module/Form/skin/styles_mobile-blue-flat.json

@@ -302,6 +302,30 @@
       "margin-bottom" : "10px",
       "margin-bottom" : "10px",
       "margin-top" : "10px"
       "margin-top" : "10px"
     },
     },
+    "importActionStyles" : {
+      "color" : "#777",
+      "border-radius": "5px",
+      "border": "1px solid #ccc",
+      "cursor": "pointer",
+      "height": "26px",
+      "float" : "left",
+      "line-height": "26px",
+      "padding": "0px 5px",
+      "background-color": "#efefef",
+      "margin" : "5px"
+    },
+    "exportActionStyles" : {
+      "color" : "#777",
+      "border-radius": "5px",
+      "border": "1px solid #ccc",
+      "cursor": "pointer",
+      "height": "26px",
+      "float" : "left",
+      "line-height": "26px",
+      "padding": "0px 5px",
+      "background-color": "#efefef",
+      "margin" : "5px"
+    },
     "properties": {
     "properties": {
       "width": "100%",
       "width": "100%",
       "border": "0",
       "border": "0",

+ 2 - 0
o2web/source/x_component_process_FormDesigner/Module/Form/skin/styles_none.json

@@ -126,6 +126,8 @@
     "editStyles": {},
     "editStyles": {},
     "amountStyles": {},
     "amountStyles": {},
     "itemTitleStyles": {},
     "itemTitleStyles": {},
+    "importActionStyles" : {},
+    "exportActionStyles" : {},
     "properties": {}
     "properties": {}
   },
   },
   "datagrid$Title": {
   "datagrid$Title": {

+ 24 - 0
o2web/source/x_component_process_FormDesigner/Module/Form/skin/styles_official.json

@@ -264,6 +264,30 @@
       "font-weight": "bold",
       "font-weight": "bold",
       "border-bottom": "0px solid #cccccc"
       "border-bottom": "0px solid #cccccc"
     },
     },
+    "importActionStyles" : {
+      "color" : "#777",
+      "border-radius": "5px",
+      "border": "1px solid #ccc",
+      "cursor": "pointer",
+      "height": "26px",
+      "float" : "left",
+      "line-height": "26px",
+      "padding": "0px 5px",
+      "background-color": "#efefef",
+      "margin" : "5px"
+    },
+    "exportActionStyles" : {
+      "color" : "#777",
+      "border-radius": "5px",
+      "border": "1px solid #ccc",
+      "cursor": "pointer",
+      "height": "26px",
+      "float" : "left",
+      "line-height": "26px",
+      "padding": "0px 5px",
+      "background-color": "#efefef",
+      "margin" : "5px"
+    },
     "properties": {
     "properties": {
       "width": "90%",
       "width": "90%",
       "border": "0",
       "border": "0",

+ 24 - 0
o2web/source/x_component_process_FormDesigner/Module/Form/skin/styles_red-simple.json

@@ -244,6 +244,30 @@
       "font-weight": "bold",
       "font-weight": "bold",
       "border-bottom": "0px solid #cccccc"
       "border-bottom": "0px solid #cccccc"
     },
     },
+    "importActionStyles" : {
+      "color" : "#777",
+      "border-radius": "5px",
+      "border": "1px solid #ccc",
+      "cursor": "pointer",
+      "height": "26px",
+      "float" : "left",
+      "line-height": "26px",
+      "padding": "0px 5px",
+      "background-color": "#efefef",
+      "margin" : "5px"
+    },
+    "exportActionStyles" : {
+      "color" : "#777",
+      "border-radius": "5px",
+      "border": "1px solid #ccc",
+      "cursor": "pointer",
+      "height": "26px",
+      "float" : "left",
+      "line-height": "26px",
+      "padding": "0px 5px",
+      "background-color": "#efefef",
+      "margin" : "5px"
+    },
     "properties": {
     "properties": {
       "width": "90%",
       "width": "90%",
       "border": "0",
       "border": "0",

+ 133 - 16
o2web/source/x_component_process_Xform/DatagridPC.js

@@ -110,7 +110,17 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
 		 * @event MWF.xApplication.process.Xform.DatagridPC#editLine
 		 * @event MWF.xApplication.process.Xform.DatagridPC#editLine
 		 * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
 		 * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
 		 */
 		 */
-		"moduleEvents": ["queryLoad","postLoad","load","completeLineEdit", "addLine", "deleteLine", "afterDeleteLine","editLine"]
+		/**
+		 * 导出excel的时候触发,this.event指向导出的数据。
+		 * @event MWF.xApplication.process.Xform.DatagridPC#export
+		 * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
+		 */
+		/**
+		 * 导入excel的时候触发,this.event指向导入的数据。
+		 * @event MWF.xApplication.process.Xform.DatagridPC#import
+		 * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
+		 */
+		"moduleEvents": ["queryLoad","postLoad","load","completeLineEdit", "addLine", "deleteLine", "afterDeleteLine","editLine", "export", "import"]
 	},
 	},
 
 
 	initialize: function(node, json, form, options){
 	initialize: function(node, json, form, options){
@@ -137,9 +147,9 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
 		this.deleteable = this.json.deleteable !== "no";
 		this.deleteable = this.json.deleteable !== "no";
 		this.addable = this.json.addable !== "no";
 		this.addable = this.json.addable !== "no";
 
 
-		//允许导出
-		this.importenable  = this.editable && (this.json.impexpType === "impexp" || this.json.impexpType === "imp");
 		//允许导入
 		//允许导入
+		this.importenable  = this.editable && (this.json.impexpType === "impexp" || this.json.impexpType === "imp");
+		//允许导出
 		this.exportenable  = this.json.impexpType === "impexp" || this.json.impexpType === "exp";
 		this.exportenable  = this.json.impexpType === "impexp" || this.json.impexpType === "exp";
 
 
 		this.gridData = this._getValue();
 		this.gridData = this._getValue();
@@ -1065,7 +1075,7 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
 
 
 		if( this.exportenable ){
 		if( this.exportenable ){
 			this.exportActionNode = new Element("div", {
 			this.exportActionNode = new Element("div", {
-				text : MWF.xApplication.process.Xform.LP.datagridExport
+				text : this.json.exportActionText || MWF.xApplication.process.Xform.LP.datagridExport
 			}).inject(this.importExportAreaNode);
 			}).inject(this.importExportAreaNode);
 			var styles = this.form.css.gridExportActionStyles;
 			var styles = this.form.css.gridExportActionStyles;
 			if( this.json.exportActionStyles ){
 			if( this.json.exportActionStyles ){
@@ -1080,7 +1090,7 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
 
 
 		if( this.importenable ){
 		if( this.importenable ){
 			this.importActionNode = new Element("div", {
 			this.importActionNode = new Element("div", {
-				text : MWF.xApplication.process.Xform.LP.datagridImport
+				text : this.json.importActionText || MWF.xApplication.process.Xform.LP.datagridImport
 			}).inject(this.importExportAreaNode);
 			}).inject(this.importExportAreaNode);
 			var styles = this.form.css.gridImportActionStyles;
 			var styles = this.form.css.gridImportActionStyles;
 			if( this.json.importActionStyles ){
 			if( this.json.importActionStyles ){
@@ -1657,6 +1667,113 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
 	getAttachmentRandomSite: function(){
 	getAttachmentRandomSite: function(){
 		var i = (new Date()).getTime();
 		var i = (new Date()).getTime();
 		return this.json.id+i;
 		return this.json.id+i;
+	},
+
+	exportToExcel : function () {
+		debugger;
+		var titleThs = this.titleTr.getElements("th");
+		// var editorTds = this.editorTr.getElements("td");
+
+		var resultArr = [];
+
+		var titleArr = [];
+		titleThs.each(function(th, index){
+			var thJson = this.form._getDomjson( th );
+			if (index==0){
+			}else if (index == titleThs.length-1){
+			}else{
+				var module = this.editModules[index-1];
+				if( thJson && thJson.isShow === false ){
+				}else if( module && module.json.type == "ImageClipper" ){
+				}else if( module && (module.json.type == "Attachment" || module.json.type == "AttachmentDg") ){
+				}else{
+					titleArr.push( th.get("text") );
+				}
+			}
+		}.bind(this));
+		resultArr.push( titleArr );
+
+		if (this.gridData.data){
+			this.gridData.data.each(function(data, idx){
+				var array = [];
+
+				titleThs.each(function(th, index){
+
+					var module = this.editModules[index-1];
+					var cellData = data[th.get("id")];
+					var text = "";
+
+					if( typeOf( cellData ) !== "array" ){
+						for (key in cellData){
+							var value = cellData[key];
+							if( module && (module.json.type == "Org" || module.json.type == "Reader" || module.json.type == "Author") ){
+								if (typeOf(value)==="array"){
+									var textArray = [];
+									value.each( function( item ){
+										if (typeOf(item)==="object"){
+											textArray.push( item.distinguishedName );
+										}else{
+											textArray.push(item);
+										}
+									}.bind(this));
+									text = textArray.join(", ");
+								}else if (typeOf(value)==="object"){
+									text = value.distinguishedName ;
+								}else{
+									text = value;
+								}
+							}else {
+								text = this._getValueText(index - 1, value);
+							}
+							break;
+						}
+					}
+
+
+
+
+					var thJson = this.form._getDomjson( th );
+					if (index==0){
+					}else if (index == titleThs.length-1){
+					}else{
+						if( thJson && thJson.isShow === false ){
+						}else if( module && module.json.type == "ImageClipper" ){
+						}else if( module && (module.json.type == "Attachment" || module.json.type == "AttachmentDg") ){
+						}else{
+							array.push( text );
+							// if( module && module.json.type == "Textarea" ){
+							// 	cell.set("html", text);
+							// }else{
+							// 	cell.set("text", text);
+							// }
+						}
+					}
+
+				}.bind(this));
+
+				resultArr.push( array );
+
+			}.bind(this));
+		}
+
+		var title;
+		if( this.json.excelName && this.json.excelName.code ){
+			title = this.form.Macro.exec(this.json.excelName.code, this);
+		}else{
+			title = MWF.xApplication.process.Xform.LP.exportDefaultName;
+		}
+		var titleA = title.split(".");
+		if( ["xls","xlst"].contains( titleA[titleA.length-1].toLowerCase() ) ){
+			titleA.splice( titleA.length-1 );
+		}
+		title = titleA.join(".");
+
+		this.fireEvent("export", [resultArr]);
+
+		new MWF.xApplication.process.Xform.DatagridPC.ExcelUtils().export( resultArr, title );
+	},
+	importFromExcel : function () {
+
 	}
 	}
 
 
 });
 });
@@ -1722,7 +1839,7 @@ MWF.xApplication.process.Xform.DatagridPC$Data =  new Class({
 	}
 	}
 });
 });
 
 
-MWF.xApplication.process.Xform.ExcelUtils = new Class({
+MWF.xApplication.process.Xform.DatagridPC.ExcelUtils = new Class({
 	initialize: function(){
 	initialize: function(){
 		if (!FileReader.prototype.readAsBinaryString) {
 		if (!FileReader.prototype.readAsBinaryString) {
 			FileReader.prototype.readAsBinaryString = function (fileData) {
 			FileReader.prototype.readAsBinaryString = function (fileData) {
@@ -1744,7 +1861,7 @@ MWF.xApplication.process.Xform.ExcelUtils = new Class({
 		}
 		}
 	},
 	},
 	_loadResource : function( callback ){
 	_loadResource : function( callback ){
-		if( !XLSX || !xlsxUtils ){
+		if( !window.XLSX || !window.xlsxUtils ){
 			var uri = "/x_component_Template/framework/xlsx/xlsx.full.js";
 			var uri = "/x_component_Template/framework/xlsx/xlsx.full.js";
 			var uri2 = "/x_component_Template/framework/xlsx/xlsxUtils.js";
 			var uri2 = "/x_component_Template/framework/xlsx/xlsxUtils.js";
 			COMMON.AjaxModule.load(uri, function(){
 			COMMON.AjaxModule.load(uri, function(){
@@ -1816,8 +1933,8 @@ MWF.xApplication.process.Xform.ExcelUtils = new Class({
 		// array.push([ "李四","男","大学专科","数学","1998-1-2","2018-9-2" ]);
 		// array.push([ "李四","男","大学专科","数学","1998-1-2","2018-9-2" ]);
 		// this.export(array, "导出数据"+(new Date).format("db"));
 		// this.export(array, "导出数据"+(new Date).format("db"));
 		this._loadResource( function(){
 		this._loadResource( function(){
-			var data = xlsxUtils.format2Sheet(array, 0, 0, null);//偏移3行按keyMap顺序转换
-			var wb = xlsxUtils.format2WB(data, "sheet1", undefined);
+			var data = window.xlsxUtils.format2Sheet(array, 0, 0, null);//偏移3行按keyMap顺序转换
+			var wb = window.xlsxUtils.format2WB(data, "sheet1", undefined);
 			var wopts = { bookType: 'xlsx', bookSST: false, type: 'binary' };
 			var wopts = { bookType: 'xlsx', bookSST: false, type: 'binary' };
 			var dataInfo = wb.Sheets[wb.SheetNames[0]];
 			var dataInfo = wb.Sheets[wb.SheetNames[0]];
 
 
@@ -1847,8 +1964,8 @@ MWF.xApplication.process.Xform.ExcelUtils = new Class({
 			}.bind(this));
 			}.bind(this));
 			dataInfo['!cols'] = widthArray;
 			dataInfo['!cols'] = widthArray;
 
 
-			this._openDownloadDialog(xlsxUtils.format2Blob(wb), fileName +".xlsx");
-		})
+			this._openDownloadDialog(window.xlsxUtils.format2Blob(wb), fileName +".xlsx");
+		}.bind(this))
 	},
 	},
 	import : function( file, callback, dateColArray ){
 	import : function( file, callback, dateColArray ){
 		this._loadResource( function(){
 		this._loadResource( function(){
@@ -1861,7 +1978,7 @@ MWF.xApplication.process.Xform.ExcelUtils = new Class({
 				}else {
 				}else {
 					data = e.target.result;
 					data = e.target.result;
 				}
 				}
-				workbook = XLSX.read(data, { type: 'binary' });
+				workbook = window.XLSX.read(data, { type: 'binary' });
 				//wb.SheetNames[0]是获取Sheets中第一个Sheet的名字
 				//wb.SheetNames[0]是获取Sheets中第一个Sheet的名字
 				//wb.Sheets[Sheet名]获取第一个Sheet的数据
 				//wb.Sheets[Sheet名]获取第一个Sheet的数据
 				var sheet = workbook.SheetNames[0];
 				var sheet = workbook.SheetNames[0];
@@ -1879,14 +1996,14 @@ MWF.xApplication.process.Xform.ExcelUtils = new Class({
 								if( cell ){
 								if( cell ){
 									delete cell.w; // remove old formatted text
 									delete cell.w; // remove old formatted text
 									cell.z = 'yyyy-mm-dd'; // set cell format
 									cell.z = 'yyyy-mm-dd'; // set cell format
-									XLSX.utils.format_cell(cell); // this refreshes the formatted text.
+									window.XLSX.utils.format_cell(cell); // this refreshes the formatted text.
 								}
 								}
 							}
 							}
 						}
 						}
 					}
 					}
 
 
-					var json = XLSX.utils.sheet_to_json( worksheet );
-					//var data = XLSX.utils.sheet_to_row_object_array(workbook.Sheets[sheet], {dateNF:'YYYY-MM-DD'});
+					var json = window.XLSX.utils.sheet_to_json( worksheet );
+					//var data = window.XLSX.utils.sheet_to_row_object_array(workbook.Sheets[sheet], {dateNF:'YYYY-MM-DD'});
 					if(callback)callback(json);
 					if(callback)callback(json);
 					// console.log(JSON.stringify(json));
 					// console.log(JSON.stringify(json));
 					// break; // 如果只取第一张表,就取消注释这行
 					// break; // 如果只取第一张表,就取消注释这行
@@ -1895,7 +2012,7 @@ MWF.xApplication.process.Xform.ExcelUtils = new Class({
 				//     if (workbook.Sheets.hasOwnProperty(sheet)) {
 				//     if (workbook.Sheets.hasOwnProperty(sheet)) {
 				//         fromTo = workbook.Sheets[sheet]['!ref'];
 				//         fromTo = workbook.Sheets[sheet]['!ref'];
 				//         console.log(fromTo);
 				//         console.log(fromTo);
-				//         var json = XLSX.utils.sheet_to_json(workbook.Sheets[sheet]);
+				//         var json = window.XLSX.utils.sheet_to_json(workbook.Sheets[sheet]);
 				//         console.log(JSON.stringify(json));
 				//         console.log(JSON.stringify(json));
 				//         // break; // 如果只取第一张表,就取消注释这行
 				//         // break; // 如果只取第一张表,就取消注释这行
 				//     }
 				//     }

+ 1 - 0
o2web/source/x_component_process_Xform/lp/zh-cn.js

@@ -10,6 +10,7 @@ MWF.xApplication.process.Xform.LP = {
 
 
     "datagridImport" : "导入Excel",
     "datagridImport" : "导入Excel",
     "datagridExport" : "导出Excel",
     "datagridExport" : "导出Excel",
+    "exportDefaultName" : "数据网格",
 
 
     "browserNotActiveX": "您的浏览器不支持ActiveX控件,不能加载Office控件,请使用IE浏览器",
     "browserNotActiveX": "您的浏览器不支持ActiveX控件,不能加载Office控件,请使用IE浏览器",