From d3091a140ffc06f04d594991029deddb3e28b048 Mon Sep 17 00:00:00 2001 From: zhaoxiang <756958008@qq.com> Date: Wed, 9 Nov 2016 11:00:00 +0800 Subject: [PATCH] =?UTF-8?q?modified=20=E7=BB=86=E8=8A=82=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/view/public/base.html | 46 ++++-------------------- public/admin/static/js/template.js | 40 +++++++++++++++++++++ public/admin/static/js/template/table.js | 2 +- 3 files changed, 47 insertions(+), 41 deletions(-) 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:"操作"}); }