Selaa lähdekoodia

数据网格导入导出

unknown 5 vuotta sitten
vanhempi
commit
71b78c25d7

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

@@ -2042,7 +2042,7 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
 			this.fireEvent("import", [data] );
 			this.fireEvent("import", [data] );
 
 
 			this.setData( data );
 			this.setData( data );
-			this.form.notice("导入成功!");
+			this.form.notice( MWF.xApplication.process.Xform.LP.importSuccess );
 
 
 		},
 		},
 		openImportedErrorDlg : function( columnList, tableData ){
 		openImportedErrorDlg : function( columnList, tableData ){
@@ -2067,7 +2067,7 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
 			columnList.each( function (obj, i) {
 			columnList.each( function (obj, i) {
 				htmlArray.push( "<th style='"+titleStyle+"'>"+obj.text+"</th>" );
 				htmlArray.push( "<th style='"+titleStyle+"'>"+obj.text+"</th>" );
 			});
 			});
-			htmlArray.push( "<th style='"+titleStyle+"'>校验信息</th>" );
+			htmlArray.push( "<th style='"+titleStyle+"'> "+MWF.xApplication.process.Xform.LP.validationInfor +"</th>" );
 			htmlArray.push( "</tr>" );
 			htmlArray.push( "</tr>" );
 
 
 
 
@@ -2087,7 +2087,7 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
 			var div = new Element("div", { style : "padding:10px;", html : htmlArray.join("") });
 			var div = new Element("div", { style : "padding:10px;", html : htmlArray.join("") });
 			var dlg = o2.DL.open({
 			var dlg = o2.DL.open({
 				"style" : this.form.json.dialogStyle || "user",
 				"style" : this.form.json.dialogStyle || "user",
-				"title": "导入失败",
+				"title": MWF.xApplication.process.Xform.LP.importFail,
 				"content": div,
 				"content": div,
 				"offset": {"y": 0},
 				"offset": {"y": 0},
 				"isMax": false,
 				"isMax": false,
@@ -2108,6 +2108,10 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
 		},
 		},
 		checkImportedData : function( columnList, tableData ){
 		checkImportedData : function( columnList, tableData ){
 			var flag = true;
 			var flag = true;
+
+			var lp = MWF.xApplication.process.Xform.LP;
+			var columnText =  lp.importValidationColumnText;
+
 			tableData.each( function(lineData, lineIndex){
 			tableData.each( function(lineData, lineIndex){
 
 
 				var errorTextList = [];
 				var errorTextList = [];
@@ -2117,6 +2121,8 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
 					var thJson = obj.thJson;
 					var thJson = obj.thJson;
 					var text = obj.text;
 					var text = obj.text;
 
 
+					var colInfor = columnText.replace( "{n}", index );
+
 					var d = lineData[text] || "";
 					var d = lineData[text] || "";
 
 
 					switch (module.json.type) {
 					switch (module.json.type) {
@@ -2128,14 +2134,14 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
 							var arr = d.split(/\s*,\s*/g ); //空格,空格
 							var arr = d.split(/\s*,\s*/g ); //空格,空格
 							arr.each( function(d, idx){
 							arr.each( function(d, idx){
 								var obj = this.getImportOrgData( d );
 								var obj = this.getImportOrgData( d );
-								if( obj.errorText )errorTextList.push( "第"+index +"列:" + obj.errorText + "。" );
+								if( obj.errorText )errorTextList.push( colInfor + obj.errorText + + lp.fullstop );
 							}.bind(this));
 							}.bind(this));
 							break;
 							break;
 						case "Number":
 						case "Number":
-							if (parseFloat(d).toString() === "NaN")errorTextList.push( "第"+index +"列:" + d+"不是数字。" );
+							if (parseFloat(d).toString() === "NaN")errorTextList.push( colInfor + d + lp.notValidNumber + lp.fullstop );
 							break;
 							break;
 						case "Calendar":
 						case "Calendar":
-							if( !( isNaN(d) && !isNaN(Date.parse(d) )))errorTextList.push("第"+index +"列:" +d+"不是日期格式。");
+							if( !( isNaN(d) && !isNaN(Date.parse(d) )))errorTextList.push(colInfor + d + lp.notValidDate + lp.fullstop );
 							break;
 							break;
 						default:
 						default:
 							break;
 							break;
@@ -2144,7 +2150,7 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
 						module.setData();
 						module.setData();
 						module.validationMode();
 						module.validationMode();
 						if (!module.validation()){
 						if (!module.validation()){
-							errorTextList.push("第"+index +"列:" + module.errNode.get("text"));
+							errorTextList.push(colInfor + module.errNode.get("text"));
 							module.errNode.destroy();
 							module.errNode.destroy();
 						}
 						}
 					}
 					}
@@ -2172,19 +2178,19 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
 			var flag = str.substr(str.length-2, 2);
 			var flag = str.substr(str.length-2, 2);
 			switch (flag.toLowerCase()){
 			switch (flag.toLowerCase()){
 				case "@i":
 				case "@i":
-					return this.identityMapImported[str] || {"errorText": str + "在系统中不存在"};
+					return this.identityMapImported[str] || {"errorText": str + MWF.xApplication.process.Xform.LP.notExistInSystem };
 				case "@p":
 				case "@p":
-					return this.personMapImported[str] || {"errorText":  str + "在系统中不存在"};
+					return this.personMapImported[str] || {"errorText":  str + MWF.xApplication.process.Xform.LP.notExistInSystem };
 				case "@u":
 				case "@u":
-					return this.unitMapImported[str] ||  {"errorText":  str + "在系统中不存在"};
+					return this.unitMapImported[str] ||  {"errorText":  str + MWF.xApplication.process.Xform.LP.notExistInSystem };
 				case "@g":
 				case "@g":
-					return this.groupMapImported[str] ||  {"errorText":  str + "在系统中不存在"};
+					return this.groupMapImported[str] ||  {"errorText":  str + MWF.xApplication.process.Xform.LP.notExistInSystem };
 				default:
 				default:
 					return this.identityMapImported[str] ||
 					return this.identityMapImported[str] ||
 						this.personMapImported[str] ||
 						this.personMapImported[str] ||
 						this.unitMapImported[str] ||
 						this.unitMapImported[str] ||
 						this.groupMapImported[str] ||
 						this.groupMapImported[str] ||
-						{"errorText":  str + "在系统中不存在"};
+						{"errorText":  str + MWF.xApplication.process.Xform.LP.notExistInSystem };
 
 
 			}
 			}
 		},
 		},
@@ -2437,7 +2443,7 @@ MWF.xApplication.process.Xform.DatagridPC.ExcelUtils = new Class({
 			if (files.length) {
 			if (files.length) {
 				var file = files.item(0);
 				var file = files.item(0);
 				if( file.name.indexOf(" ") > -1 ){
 				if( file.name.indexOf(" ") > -1 ){
-					this.form.notice("上传的文件不能带空格", "error");
+					this.form.notice( MWF.xApplication.process.Xform.LP.uploadedFilesCannotHaveSpaces, "error");
 					return false;
 					return false;
 				}
 				}
 
 

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

@@ -11,6 +11,15 @@ MWF.xApplication.process.Xform.LP = {
     "datagridImport" : "导入Excel",
     "datagridImport" : "导入Excel",
     "datagridExport" : "导出Excel",
     "datagridExport" : "导出Excel",
     "exportDefaultName" : "数据网格",
     "exportDefaultName" : "数据网格",
+    "importSuccess" : "导入成功!",
+    "validationInfor" : "校验信息",
+    "importFail" : "导入失败",
+    "importValidationColumnText" : "第{n}列:",
+    "notValidNumber" : "不是数字",
+    "notValidDate" : "不是日期格式",
+    "fullstop" : "。",
+    "notExistInSystem" : "在系统中不存在",
+    "uploadedFilesCannotHaveSpaces" : "上传的文件不能带空格",
 
 
     "browserNotActiveX": "您的浏览器不支持ActiveX控件,不能加载Office控件,请使用IE浏览器",
     "browserNotActiveX": "您的浏览器不支持ActiveX控件,不能加载Office控件,请使用IE浏览器",