Browse Source

【新项目】【看板项目】【请求改为相对路径】

sunyj 8 years ago
parent
commit
ae890dd70c

+ 25 - 4
kanban-console/src/main/webapp/resources/app/view/plugin/tplgridcontextmenu.js

@@ -89,7 +89,6 @@ Ext.define('erp.view.plugin.tplgridcontextmenu', {
 	},
 	deleteNode:function(view,record){
 		var me = this;
-		console.log(record);
 		Ext.Msg.confirm('提示','是否删除该模板?',function(btn){
 			if(btn=='yes'){
 				Ext.Ajax.request({
@@ -209,7 +208,11 @@ Ext.define('erp.view.plugin.tplgridcontextmenu', {
 		var me = this;
 		var values = form.getForm().getValues();
 		if(!values.dataSourceCode){
-			values.dataSourceCode = '520A4965B13';
+			var dataSource = me.getDatasource();
+			if(dataSource.length<=0){
+				Ext.Msg.alert('提示','未找到数据源,请先联系管理员进行设置!');
+			}
+			values.dataSourceCode = dataSource[0].code;
 		}
 		var type;
 		if(values){
@@ -228,11 +231,10 @@ Ext.define('erp.view.plugin.tplgridcontextmenu', {
 				delete values.globalParameterCodes;
 			}
 			var data = Ext.encode(values);	
-			console.log(data);
 			Ext.Ajax.request({
 				url:'template/' + type,
 				method:'post',
-				aysnc:false,
+				async:false,
 				params:{
 					json:data
 				},
@@ -253,6 +255,25 @@ Ext.define('erp.view.plugin.tplgridcontextmenu', {
 		}
 		return false;
 	},
+	getDatasource:function(){
+		var datasource = null;
+		Ext.Ajax.request({
+			url:'datasource/get',
+			method:'GET',
+			async:false,
+			callback:function(options,success,response){
+				var res = Ext.decode(response.responseText);
+				if(res){
+					if(typeof(res.success)!=='undefined'&&!res.success){
+						Ext.Msg.alert('警告',res.message);
+					}else{
+						datasource =  res.content;							
+					}
+				} 
+			}
+		});
+		return datasource;
+	},
 	refreshTree:function(){
 		var tree = Ext.getCmp('templatetree');
 		tree.getStore().reload();