From 4bad6a36cd2dc58305b92b8283106934909ff8a7 Mon Sep 17 00:00:00 2001 From: Li Jianxuan Date: Sat, 31 Jan 2015 14:40:21 +0000 Subject: [PATCH] add error catch function --- .../admin/views/scripts/data/dataimport-target.phtml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/application/admin/views/scripts/data/dataimport-target.phtml b/application/admin/views/scripts/data/dataimport-target.phtml index ca2a6830..8b2d8f53 100644 --- a/application/admin/views/scripts/data/dataimport-target.phtml +++ b/application/admin/views/scripts/data/dataimport-target.phtml @@ -162,6 +162,7 @@ $this->headTitle()->setSeparator(' - '); 'url':'/admin/data/dataimport/ac/checktables', 'data':$('#schema-form').serialize(), 'success':function(data){ + if (data!=true) { if(!$.isEmptyObject(data)) @@ -188,8 +189,11 @@ $this->headTitle()->setSeparator(' - '); }, 'complete' : function(){ $('#error-loading').hide(); + }, + 'error' : function(){ + $(".error-alerts").show(); + $("#errors").html("数据表字段检测失败,请检查导入得文件是否于数据表中得字段对应"); } - }); }, getFields : function (){ @@ -204,8 +208,6 @@ $this->headTitle()->setSeparator(' - '); return true; } - console.log(data); - $(".error-alerts").show(); var html = new Array(); @@ -225,7 +227,7 @@ $this->headTitle()->setSeparator(' - '); }, 'timeout': 30000, 'beforeSend' : function(){ - $('#error-loading').html("正在校验数据是否可以导入......"); + $('#error-loading').html("正在获取数据表信息......"); $('#error-loading').show(); }, 'complete' : function(){