1
0
mirror of https://github.com/chatopera/cosin.git synced 2025-08-01 16:38:02 +08:00

#70 调整 机器人编辑窗口

This commit is contained in:
mukaiu 2018-09-25 15:25:19 +08:00
parent e580345063
commit 4e6cd93cbd
2 changed files with 22 additions and 10 deletions

View File

@ -9,11 +9,6 @@
width: 400px; width: 400px;
} }
</style> </style>
<div class="row">
<div class="col-lg-12">
<h1>机器人列表</h1>
</div>
</div>
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
<div id="create"> <div id="create">
@ -129,7 +124,9 @@
title: '提示' title: '提示'
, content: '保存成功' , content: '保存成功'
}); });
location.href = '/apps/chatbot/index.html'; parent.init();
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
} }
} }

View File

@ -67,7 +67,15 @@
function query(p, ps) { function query(p, ps) {
request('chatbot?p=' + (p || 1) + '&ps=' + (ps || 10), { ops: 'fetch' }).then(function (rows) { request('chatbot?p=' + (p || 1) + '&ps=' + (ps || 10), { ops: 'fetch' }).then(function (rows) {
var tds = $.map(rows, function (r) { var tds = $.map(rows, function (r) {
var edit = $('<a href="edit.html?id=' + r.id + '" data-width="550" data-height="300"><i class="layui-icon"></i>编辑</a>'); var edit = $('<a href="#" data-width="550" data-height="300"><i class="layui-icon"></i>编辑</a>');
edit.click(function () {
layer.open({
title: '编辑机器人',
type: 2,
area: ['800px', '450px'],
content: 'edit.html?id=' + r.id
})
});
var remove = $('<a style="margin-left:10px;"><i class="layui-icon" style="color:red;"></i>删除</a>').click(function () { var remove = $('<a style="margin-left:10px;"><i class="layui-icon" style="color:red;"></i>删除</a>').click(function () {
var lindex = layer.confirm('请确认是否删除?', { var lindex = layer.confirm('请确认是否删除?', {
@ -75,7 +83,7 @@
}, function () { }, function () {
console.log('ok', r.id) console.log('ok', r.id)
window.remove(r.id); window.remove(r.id);
window.init();
layer.close(lindex); layer.close(lindex);
}, function () { }, function () {
console.log('cancel', r.id) console.log('cancel', r.id)
@ -105,7 +113,9 @@
} }
function remove(id) { 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) { function change(id, isEnabled) {
@ -113,7 +123,12 @@
} }
function showCreate() { function showCreate() {
location.href = '/apps/chatbot/edit.html'; layer.open({
title: '新建机器人',
type: 2,
area: ['800px', '450px'],
content: 'edit.html'
})
} }
function init() { function init() {