From 21cc5142f2a1476064c271adc5ec0b6bb40b73f0 Mon Sep 17 00:00:00 2001 From: zhaoxiang <756958008@qq.com> Date: Wed, 9 Nov 2016 22:57:13 +0800 Subject: [PATCH 1/5] =?UTF-8?q?added=20=E6=96=B0=E5=A2=9E=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC=E7=9A=84icon=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/admin/static/js/template/table.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/public/admin/static/js/template/table.js b/public/admin/static/js/template/table.js index c0f7ea9..f4e349d 100644 --- a/public/admin/static/js/template/table.js +++ b/public/admin/static/js/template/table.js @@ -101,6 +101,14 @@ case 'date': dataListHtml += '
'+msg+'
', closeButton: false @@ -45,7 +46,8 @@ * @param url * @param urlData */ - $.refresh = function ( url, urlData = '' ) { + $.refresh = function ( url, urlData ) { + urlData = urlData ? urlData : ''; $.ajax({ type: "GET", url: url, @@ -98,7 +100,7 @@ }; /** - * Ajax Post 表单提交(增) + * Ajax Post 表单提交(增) * */ bodyDom.on('click', '.ajax-post', function() { var message,query,form,target; @@ -139,7 +141,7 @@ }); /** - * Ajax Put 表单提交(改) + * Ajax Put 表单提交(改) * */ bodyDom.on('click', '.ajax-put', function() { var message,query,form,target; @@ -162,18 +164,11 @@ $.alertMsg(message); setTimeout(function() { if (data.url) { - location.href = data.url; - } else { - location.reload(); + $.refresh(data.url); } }, wait); } else { $.alertMsg(data.msg); - setTimeout(function() { - if (data.url) { - location.href = data.url; - } - }, wait); } }); return false; diff --git a/public/admin/static/js/template/form.js b/public/admin/static/js/template/form.js index df161ed..aa7afb2 100644 --- a/public/admin/static/js/template/form.js +++ b/public/admin/static/js/template/form.js @@ -8,7 +8,7 @@ * @returns {string} */ $.buildAddForm = function ( formObj ) { - return buildForm(formObj, 'box-success'); + return buildForm(formObj, 'box-success', 'ajax-post'); }; /** @@ -17,16 +17,17 @@ * @returns {string} */ $.buildEditForm = function ( formObj ) { - return buildForm(formObj, 'box-warning'); + return buildForm(formObj, 'box-warning', 'ajax-put'); }; /** * 根据规则创建表单 * @param formObj 表单数据对象 * @param boxType box样式 + * @param method 数据提交方式 * @returns {string} */ - function buildForm( formObj, boxType ) { + function buildForm( formObj, boxType, method ) { var formHtml = '