From 4e6cd93cbdb0277304a2c60536a48d08d4307b3b Mon Sep 17 00:00:00 2001 From: mukaiu Date: Tue, 25 Sep 2018 15:25:19 +0800 Subject: [PATCH] =?UTF-8?q?#70=20=E8=B0=83=E6=95=B4=20=E6=9C=BA=E5=99=A8?= =?UTF-8?q?=E4=BA=BA=E7=BC=96=E8=BE=91=E7=AA=97=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/apps/chatbot/edit.html | 9 +++----- .../templates/apps/chatbot/index.html | 23 +++++++++++++++---- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/contact-center/app/src/main/resources/templates/apps/chatbot/edit.html b/contact-center/app/src/main/resources/templates/apps/chatbot/edit.html index 6d57dcdb..22a9a8d5 100644 --- a/contact-center/app/src/main/resources/templates/apps/chatbot/edit.html +++ b/contact-center/app/src/main/resources/templates/apps/chatbot/edit.html @@ -9,11 +9,6 @@ width: 400px; } -
-
-

机器人列表

-
-
@@ -129,7 +124,9 @@ title: '提示' , content: '保存成功' }); - location.href = '/apps/chatbot/index.html'; + parent.init(); + var index = parent.layer.getFrameIndex(window.name); + parent.layer.close(index); } } diff --git a/contact-center/app/src/main/resources/templates/apps/chatbot/index.html b/contact-center/app/src/main/resources/templates/apps/chatbot/index.html index 34d17d5d..c36e9904 100644 --- a/contact-center/app/src/main/resources/templates/apps/chatbot/index.html +++ b/contact-center/app/src/main/resources/templates/apps/chatbot/index.html @@ -67,7 +67,15 @@ function query(p, ps) { request('chatbot?p=' + (p || 1) + '&ps=' + (ps || 10), { ops: 'fetch' }).then(function (rows) { var tds = $.map(rows, function (r) { - var edit = $('编辑'); + var edit = $('编辑'); + edit.click(function () { + layer.open({ + title: '编辑机器人', + type: 2, + area: ['800px', '450px'], + content: 'edit.html?id=' + r.id + }) + }); var remove = $('删除').click(function () { var lindex = layer.confirm('请确认是否删除?', { @@ -75,7 +83,7 @@ }, function () { console.log('ok', r.id) window.remove(r.id); - window.init(); + layer.close(lindex); }, function () { console.log('cancel', r.id) @@ -105,7 +113,9 @@ } function remove(id) { - return request('chatbot', { ops: 'delete', id: id }) + return request('chatbot', { ops: 'delete', id: id }).then(function () { + window.init(); + }) } function change(id, isEnabled) { @@ -113,7 +123,12 @@ } function showCreate() { - location.href = '/apps/chatbot/edit.html'; + layer.open({ + title: '新建机器人', + type: 2, + area: ['800px', '450px'], + content: 'edit.html' + }) } function init() {