diff --git a/application/admin/view/public/base.html b/application/admin/view/public/base.html index 0c8a950..8a36048 100644 --- a/application/admin/view/public/base.html +++ b/application/admin/view/public/base.html @@ -600,48 +600,14 @@ - + {block name="myScript"}{/block} diff --git a/public/admin/static/js/template.js b/public/admin/static/js/template.js index 51dc604..3dde890 100644 --- a/public/admin/static/js/template.js +++ b/public/admin/static/js/template.js @@ -79,3 +79,43 @@ }); })(jQuery); + +var refresh = function(url) { + $.ajax({ + type: "GET", + url: url, + success: function(data){ + if( data.code == 200 ){ + if( data.data.tempType == 'table' ){ + if( $.buildTable ){ + $('#content').html($.buildTable(data.data)); + $('#tableBox').hide().fadeIn(800); + }else{ + $.getScript(JS_PATH + '/template/table.js', function (){ + $('#content').html($.buildTable(data.data)); + $('#tableBox').hide().fadeIn(800); + }); + } + } + if( data.data.tempType == 'form' ){ + if( $.buildForm ){ + $('#content').html($.buildForm(data.data)); + $('#tableBox').hide().fadeIn(800); + }else{ + $.getScript(JS_PATH + '/template/form.js', function (){ + $('#content').html($.buildForm(data.data)); + $('#formBox').hide().fadeIn(800); + }); + } + } + }else{ + $.alertMsg(data.msg); + setTimeout(function() { + if (data.url) { + location.href = data.url; + } + }, 1000*data.wait); + } + } + }); +}; diff --git a/public/admin/static/js/template/table.js b/public/admin/static/js/template/table.js index 2839710..9f0c324 100644 --- a/public/admin/static/js/template/table.js +++ b/public/admin/static/js/template/table.js @@ -11,7 +11,7 @@ * @returns {string} */ $.buildTable = function ( tableObj ) { - var tableHtml = '
'; + var tableHtml = '
'; if( tableObj.rightButton && tableObj.rightButton.length ){ tableObj.header.push({field:"action",info:"操作"}); }