web_toolset/web/html/body/nas/oss.html

108 lines
3.4 KiB
HTML
Raw Normal View History

2021-06-10 18:28:38 +08:00
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>NAS</title>
<link rel="stylesheet" href="/layui/css/layui.css">
</head>
<body>
<div class="layui-layout layui-layout-admin">
<div id="header"></div>
<div class="layui-body" style="left: 200px;">
<div id="side"></div>
<table id="oss" lay-filter="myOssFilter"></table>
<div id="footer"></div>
</div>
</div>
<script type="text/html" id="topTools">
<div>
<a class="layui-btn layui-btn-xs" lay-event="addAddress">新增路径</a>
</div>
</script>
<script type="text/html" id="listTools">
<div class="layui-btn-container">
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</div>
</script>
<script src="/js/jquery-3.2.1.js"></script>
<script src="/layui/layui.js"></script>
<script>
layui.use(['table'], function () {
let table = layui.table;
console.log(2)
let ta=table.render({
elem: "#oss",
url: "/nas/depot/list.do",
page: false,
toolbar: '#topTools',
parseData: function (json) {
let item = [];
for (let i in json.data) {
2021-06-18 15:44:40 +08:00
item[i] =JSON.parse(json.data[i])
2021-06-10 18:28:38 +08:00
}
return {
"code": 0,
"msg": json.msg,
"data": item
}
},
cols: [[
2021-06-18 15:44:40 +08:00
{field: 'path', title: '地址', width: 400,sort: true},
{field: 'type', title: '类型',width: 150, sort: true},
2021-06-10 18:28:38 +08:00
{ field: "right", width: 200, toolbar: '#listTools' }
]],
done:function (){
table.on('tool(myOssFilter)', function (obj) {
2021-06-18 15:44:40 +08:00
console.log(obj.data)
2021-06-10 18:28:38 +08:00
if (obj.event === 'del') {
layer.msg(obj.data.item)
2021-06-18 15:44:40 +08:00
$.post('/nas/depot/remove.do',{'path':JSON.stringify(obj.data)},function (json) {
2021-06-10 18:28:38 +08:00
layer.msg(json.msg)
});
}
})
table.on('toolbar(myOssFilter)', function (obj) {
console.log('add')
if (obj.event === 'addAddress') {
layer.prompt({
formType: 2,
value: '/media/yutou/4t/public/',
title: '请输入地址',
2021-06-18 15:44:40 +08:00
}, function(path, index, elem){
layer.prompt({
formType: 2,
value: 'depot/photo/music',
title: '请选择类型',
},function (type,index,elem) {
$.post('/nas/depot/add.do',{'path':path,'type':type},function (json) {
layer.msg(json.msg)
});
layer.close(index);
})
2021-06-10 18:28:38 +08:00
layer.close(index);
});
}
});
}
})
});
$('#header').load("/html/header.html");
$('#footer').load("/html/footer.html");
2021-06-10 18:28:38 +08:00
</script>
</body>
</html>