Procházet zdrojové kódy

数据网格增加excel导入导出

unknown před 5 roky
rodič
revize
b32f364519

+ 26 - 0
o2web/source/x_component_process_FormDesigner/Module/Datagrid/datagrid.html

@@ -60,6 +60,32 @@
         </table>
         <div class="MWFScriptArea" name="editableScript" title="是否可编辑(S)"></div>
 
+        <div style="height:24px; text-align: center; line-height: 24px; background-color: #EEE; 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 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':''}/>右下
+                </td>
+            </tr>
+        </table>
+        <div class="MWFMaplist" name="impStyles" collapse="true" title="导入按钮样式"></div>
+        <div class="MWFMaplist" name="expStyles" collapse="true" title="导出按钮样式"></div>
+
         <div class="MWFValidation" name="validationConfig"></div>
         <div class="MWFScriptArea" name="validation" title="校验脚本 (S)"></div>
     </div>

+ 3 - 0
o2web/source/x_component_process_Xform/$Form/default/css.wcss

@@ -425,6 +425,9 @@
         "border": "1px solid #CCCCCC",
         "border-radius": "5px",
         "text-align": "center"
+    },
+    "gridImpExpAreaNode" : {
+
     },
     "mobileGridHelpNode": {
         "width": "30px",

+ 18 - 1
o2web/source/x_component_process_Xform/DatagridPC.js

@@ -80,7 +80,7 @@ MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
  */
 MWF.xApplication.process.Xform.DatagridPC = new Class(
 	/** @lends MWF.xApplication.process.Xform.DatagridPC# */
-	{
+{
 	Implements: [Events],
 	Extends: MWF.APP$Module,
 	isEdit: false,
@@ -135,6 +135,11 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
 		this.deleteable = this.json.deleteable !== "no";
 		this.addable = this.json.addable !== "no";
 
+		//允许导出
+		this.importenable  = this.editable && (this.json.impexpType === "impexp" || this.json.impexpType === "imp");
+		//允许导入
+		this.exportenable  = this.json.impexpType === "impexp" || this.json.impexpType === "exp";
+
 		this.gridData = this._getValue();
 
 		this.totalModules = [];
@@ -145,6 +150,7 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
 			this._addTitleActionColumn();
 
 			this._loadEditDatagrid(function(){
+				this._loadImportExportAction();
 				this.fireEvent("postLoad");
 				this.fireEvent("load");
 			}.bind(this));
@@ -154,6 +160,7 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
 			this._getDatagridEditorTr();
 			this._loadReadDatagrid(function(){
 				if(this.editorTr)this.editorTr.setStyle("display", "none");
+				this._loadImportExportAction();
 				this.fireEvent("postLoad");
 				this.fireEvent("load");
 			}.bind(this));
@@ -1038,6 +1045,16 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
 		if (callback) callback();
 	},
 
+	_loadImportExportAction: function(){
+		if( this.exportenable ){
+
+		}
+
+		if( this.importenable ){
+
+		}
+	},
+
 	_loadDatagridStyle: function(){
 		//var ths = this.titleTr.getElements("th");
 		//ths.setStyles(this.form.css.datagridTitle);