完善web一些功能
This commit is contained in:
@@ -15,7 +15,9 @@
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container">
|
||||
<button class="layui-btn layui-btn-sm" onclick="createRoom()">添加新房间</button>
|
||||
<button class="layui-btn layui-btn-sm" lay-event="getCheckData">获取选中行数据</button>
|
||||
<button class="layui-btn layui-btn-sm" lay-event="editArray">批量编辑</button>
|
||||
<button class="layui-btn layui-btn-sm" lay-event="deleteArray">批量删除</button>
|
||||
<button class="layui-btn layui-btn-sm layui-bg-red" lay-event="deleteAll">全部删除</button>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="toolDemo">
|
||||
@@ -46,6 +48,15 @@
|
||||
|
||||
});
|
||||
}
|
||||
function editArrayRoom(array) {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: "批量编辑",
|
||||
area: ['600px', '500px'],
|
||||
content: '/html/ui/createConfig.html?array=' + array
|
||||
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
layui.use(['table', 'dropdown'], function () {
|
||||
@@ -105,10 +116,56 @@
|
||||
var id = obj.config.id;
|
||||
var checkStatus = table.checkStatus(id);
|
||||
var othis = lay(this);
|
||||
var data = checkStatus.data;
|
||||
var array = data.map(function (item) {
|
||||
return item.live_room_id
|
||||
})
|
||||
var arrayName = data.map(function (item) {
|
||||
return item.anchorName
|
||||
})
|
||||
switch (obj.event) {
|
||||
case 'getCheckData':
|
||||
var data = checkStatus.data;
|
||||
layer.alert(layui.util.escape(JSON.stringify(data)));
|
||||
case 'deleteArray':
|
||||
if (array.length === 0) {
|
||||
layer.msg('没有数据', { icon: 2 })
|
||||
return
|
||||
}
|
||||
layer.confirm('确定删除 ' + arrayName + "?", { icon: 3 }, function () {
|
||||
var loadIndex = showLoadingDialog();
|
||||
deleteArrayRoomConfig(array)
|
||||
.then(json => {
|
||||
layer.close(loadIndex)
|
||||
layer.msg(json.data, { icon: 1 });
|
||||
table.reloadData('roomList', {}, false)
|
||||
})
|
||||
|
||||
}, function () {
|
||||
|
||||
});
|
||||
break;
|
||||
case 'editArray':
|
||||
if (array.length === 0) {
|
||||
layer.msg('没有数据', { icon: 2 })
|
||||
return
|
||||
}
|
||||
editArrayRoom(array)
|
||||
break;
|
||||
case 'deleteAll':
|
||||
layer.confirm('确定删除所有配置?', { icon: 3 }, function () {
|
||||
var loadIndex = showLoadingDialog();
|
||||
deleteAllRoomConfig()
|
||||
.then(json => {
|
||||
layer.close(loadIndex)
|
||||
if (json.status === -1) {
|
||||
layer.msg(json.message, { icon: 2 });
|
||||
} else {
|
||||
layer.msg(json.data, { icon: 1 });
|
||||
}
|
||||
table.reloadData('roomList', {}, false)
|
||||
})
|
||||
|
||||
}, function () {
|
||||
|
||||
});
|
||||
break;
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user