提交 d3a15b06 编写于 作者: 蔡祥熠

Merge branch 'fix/ImportModel' into 'wrdp'

Merge of fix/ImportModel 导入模型修改 to wrdp

See merge request o2oa/o2oa!4166
......@@ -128,6 +128,9 @@ MWF.xApplication.query.ImporterDesigner.Importer = new Class({
this.data.data = JSON.parse(this.data.data);
}
this.json = this.data;
if (!this.json.data )this.json.data = {};
if (!this.json.data.calculateFieldList) this.json.data.calculateFieldList = [];
if (!this.json.data.columnList) this.json.data.columnList = [];
if( !this.json.data.events ){
var url = "../x_component_query_ImporterDesigner/$Importer/importer.json";
MWF.getJSON(url, {
......@@ -219,7 +222,6 @@ MWF.xApplication.query.ImporterDesigner.Importer = new Class({
"id": id,
"displayName": this.designer.lp.unnamed,
};
if (!this.json.data.calculateFieldList) this.json.data.calculateFieldList = [];
this.json.data.calculateFieldList.push(json);
var field = new MWF.xApplication.query.ImporterDesigner.Importer.CalculateField(json, this, null);
......@@ -238,7 +240,6 @@ MWF.xApplication.query.ImporterDesigner.Importer = new Class({
"id": id,
"displayName": this.designer.lp.unnamed,
};
if (!this.json.data.columnList) this.json.data.columnList = [];
var column;
if( !addToLeft || this.json.data.columnList.length === 0 ){
......
......@@ -155,9 +155,9 @@ MWF.xApplication.query.Query.Importer = MWF.QImporter = new Class({
},
doImportData: function(){
//创建数据
this.rowList.each( function( row, i ){
row.createData();
}.bind(this));
// this.rowList.each( function( row, i ){
// row.createData();
// }.bind(this));
//再次校验数据(计算的内容)
var flag = true;
......@@ -275,20 +275,9 @@ MWF.xApplication.query.Query.Importer = MWF.QImporter = new Class({
checkNecessaryImportedData: function(){
var flag = true;
if( this.json.type === "cms" ){
this.rowList.each( function(row, index){
if( !row.checkCMS() )flag = false;
}.bind(this));
}else if( this.json.type === "process" ){
this.rowList.each( function(row, index){
if( !row.checkProcess() )flag = false;
}.bind(this));
}
this.rowList.each( function(row, index){
if( !row.checkNecessary() )flag = false;
}.bind(this));
var arg = {
validted : flag,
......@@ -531,11 +520,6 @@ MWF.xApplication.query.Query.Importer = MWF.QImporter = new Class({
}
},
openRecord: function( recordId ){
var record = new MWF.xApplication.query.Query.Importer.Record( this, recordId );
record.load();
},
downloadTemplate: function(fileName, callback){
if( !this.excelUtils ){
this.excelUtils = new MWF.xApplication.query.Query.Importer.ExcelUtils( this );
......@@ -792,6 +776,74 @@ MWF.xApplication.query.Query.Importer.Row = new Class({
return true;
},
checkNecessary: function(){
var lp = this.lp;
var columnText = lp.importValidationColumnText;
var columnTextExcel = lp.importValidationColumnTextExcel;
var errorTextList = [];
var errorTextListExcel = [];
this.importer.json.data.columnList.each( function (columnJson, i) {
var colInfor = columnText.replace( "{n}", i+1 );
var colInforExcel = columnTextExcel.replace( "{n}", this.importer.excelUtils.index2ColName( i ) );
var value = this.importedData[i] || "";
var dataType = this.importer.json.type === "dynamicTable" ? columnJson.dataType_Querytable : columnJson.dataType_CMSProcess;
if( columnJson.validFieldType !== false && value ){
switch ( dataType ) {
case "json":
case "stringMap":
value = value.replace(/
/g,"");
try{
var d = JSON.parse(value);
}catch (e) {
errorTextList.push(colInfor + value + lp.notValidJson + lp.fullstop );
errorTextListExcel.push( colInforExcel + value + lp.notValidJson + lp.fullstop );
}
break;
default:
break;
}
}
}.bind(this));
this.errorTextList = this.errorTextList.concat( errorTextList );
this.errorTextListExcel = this.errorTextListExcel.concat( errorTextListExcel );
if(this.errorTextList.length>0){
return false;
}
this.createData();
if( this.importer.json.type === "cms" ){
this.checkCMS();
}else if( this.importer.json.type === "process" ){
this.checkProcess();
}
if(this.errorTextList.length>0){
return false;
}
return true;
// var flag = true;
// if( this.importer.json.type === "cms" ){
// if( !this.checkCMS() )flag = false;
// }else if( this.importer.json.type === "process" ){
// if( !this.checkProcess() )flag = false;
// }
// return flag;
},
getCol: function(key, isExcel){
var lp = this.lp;
if( this.pathIndexMap && typeOf(this.pathIndexMap[key]) === "number"){
......@@ -807,6 +859,7 @@ MWF.xApplication.query.Query.Importer.Row = new Class({
return ""
},
checkCMS : function( notCheckName ){
var lp = this.lp;
var errorTextList = [];
......@@ -856,6 +909,7 @@ MWF.xApplication.query.Query.Importer.Row = new Class({
return true;
},
checkProcess : function( notCheckName ){
var lp = this.lp;
var json = this.importer.json;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册