200 lines
7.7 KiB
HTML
200 lines
7.7 KiB
HTML
|
<!doctype html>
|
||
|
<html xmlns:th="http://www.thymeleaf.org">
|
||
|
<head>
|
||
|
<base th:href="${#request.getContextPath() + '/'}">
|
||
|
<meta charset="utf-8">
|
||
|
<meta name="renderer" content="webkit">
|
||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||
|
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||
|
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||
|
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||
|
<style>
|
||
|
.type1{
|
||
|
background-color: rgba(153, 153, 153, 0.4);
|
||
|
}
|
||
|
.type2{
|
||
|
background-color: rgba(255, 87, 34, 0.4);
|
||
|
}
|
||
|
.type3{
|
||
|
background-color: rgba(95, 184, 120, 0.4);
|
||
|
}
|
||
|
.type4{
|
||
|
background-color: rgba(30, 144, 255, 0.4);
|
||
|
}
|
||
|
.type5{
|
||
|
background-color: rgba(250, 212, 0, 0.4);
|
||
|
}
|
||
|
.type6{
|
||
|
background-color: #ef5619;
|
||
|
}
|
||
|
.type7{
|
||
|
background-color: #ef9919;
|
||
|
}
|
||
|
.module1{
|
||
|
text-align: center;
|
||
|
line-height: 100px;
|
||
|
color: #FFF;
|
||
|
float:left;
|
||
|
}
|
||
|
</style>
|
||
|
</head>
|
||
|
<body>
|
||
|
<div style="width:100%;height:30px;text-align: right">
|
||
|
<button type="button" class="saveEvent layui-btn layui-btn-sm" lay-event="saveEvent">
|
||
|
<i class="fa fa-lg fa-save"></i> 保存布局配置
|
||
|
</button>
|
||
|
</div>
|
||
|
<div id="container">
|
||
|
</div>
|
||
|
<div class="layui-collapse" lay-accordion style="display: none" id="widthChange">
|
||
|
<div class="layui-input-block">
|
||
|
<div style="margin-left:-35px;padding-top: 50px;width:250px;" id="widthChangeDiv"></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||
|
<script type="text/javascript" src="assets/js/vendor/ueditor/third-party/jquery-1.10.2.min.js"></script>
|
||
|
<script type="text/javascript" src="assets/js/vendor/sortable/moduleSet.js"></script>
|
||
|
<script type="text/javascript" src="assets/js/vendor/sortable/Sortable.min.js"></script>
|
||
|
<script>
|
||
|
layui.config({
|
||
|
base: 'assets/layuiadmin/' //静态资源所在路径
|
||
|
}).extend({
|
||
|
index: 'lib/index' //主入口模块
|
||
|
}).use(['index', 'form', 'laydate', 'slider','laytpl'], function(){
|
||
|
var $ = layui.$;
|
||
|
var form = layui.form;
|
||
|
var slider = layui.slider;
|
||
|
var laytpl = layui.laytpl;
|
||
|
var laydate = layui.laydate;
|
||
|
var wangEditor = window.wangEditor;
|
||
|
var wangEditorObj = {};
|
||
|
var viewerObj = {};
|
||
|
var configTableId = top.restAjax.params(window.location.href).configTableId;
|
||
|
|
||
|
function closeBox() {
|
||
|
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||
|
}
|
||
|
|
||
|
$('.saveEvent').on('click', function() {
|
||
|
var orderArray = new Array();
|
||
|
$("#container .module1").each(function(v, e) {
|
||
|
/**
|
||
|
* 保存宽度比 / 保存排序 / 保存行
|
||
|
*/
|
||
|
orderArray.push({"configTableFieldId": e.id , "configTableFieldRowCol": Number($(e).data("configTableFieldRowCol")) , "configTableFieldOrder" : v + 1 })
|
||
|
});
|
||
|
var loadLayerIndex;
|
||
|
top.restAjax.put(top.restAjax.path('api/configtablefield/updateorder/{configTableId}', [configTableId]), orderArray, null, function(code, data) {
|
||
|
top.layer.msg("保存布局设置成功");
|
||
|
}, function(code, data) {
|
||
|
top.dialog.msg(data.msg);
|
||
|
}, function() {
|
||
|
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
|
||
|
}, function() {
|
||
|
top.dialog.close(loadLayerIndex);
|
||
|
});
|
||
|
});
|
||
|
|
||
|
// 十六进制颜色随机
|
||
|
function color16(){
|
||
|
var rgb='rgb('+Math.floor(Math.random()*255)+','
|
||
|
+Math.floor(Math.random()*255)+','
|
||
|
+Math.floor(Math.random()*255)+')';
|
||
|
return rgb;
|
||
|
}
|
||
|
|
||
|
function widthChange(id) {
|
||
|
slider.render({
|
||
|
elem: '#widthChangeDiv'
|
||
|
,setTips: function(value){ //自定义提示文本
|
||
|
return value + '%';
|
||
|
},
|
||
|
value:$("#" + id).data("configTableFieldRowCol"),
|
||
|
min:10,
|
||
|
max:100,
|
||
|
change: function(value){
|
||
|
$("#" + id).css("width", value);
|
||
|
$("#" + id).data("configTableFieldRowCol", value.replace("%", ""));
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function addItem() {
|
||
|
top.layer.open({
|
||
|
type: 2,
|
||
|
title: false,
|
||
|
closeBtn: 0,
|
||
|
area: ['800px', '95%'],
|
||
|
shadeClose: true,
|
||
|
anim: 2,
|
||
|
content: top.restAjax.path('route/columnmngitem/save.html?columnId=' + columnId, []),
|
||
|
end: function() {
|
||
|
initData();
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function createDiv(data) {
|
||
|
$("#container").append('<div id="' + data.configTableFieldId + '" class="module1 js_module_' + data.configTableFieldId + '" data-config-table-field-row-col="' + data.configTableFieldRowCol + '" style="background-color:' + color16() + ';width:' + data.configTableFieldRowCol + '%;height:100px;">' + data.configTableFieldName + '</div>');
|
||
|
$(".js_module_" + data.configTableFieldId).moduleSet({
|
||
|
button:[
|
||
|
{text:'调整宽度',value:data.configTableFieldId,callback:function(data){
|
||
|
console.log(data.value);
|
||
|
layer.open({
|
||
|
type: 1,
|
||
|
title: false,
|
||
|
closeBtn: 0,
|
||
|
area: ["400px" , "100px"],
|
||
|
shadeClose: true,
|
||
|
anim: 2,
|
||
|
content: $("#widthChange"),
|
||
|
end: function() {
|
||
|
},success:function() {
|
||
|
widthChange(data.value);
|
||
|
}
|
||
|
});
|
||
|
},iconfont:''}
|
||
|
],
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// 初始化内容
|
||
|
function initData() {
|
||
|
var loadLayerIndex;
|
||
|
top.restAjax.get(top.restAjax.path('api/configtablefield/list?configTableId={configTableId}', [configTableId]), {}, null, function(code, data) {
|
||
|
$("#container").empty();
|
||
|
for(var i = 0; i < data.length; i++) {
|
||
|
createDiv(data[i]);
|
||
|
}
|
||
|
// 排序
|
||
|
var container = document.getElementById("container");
|
||
|
var sort = Sortable.create(container, {
|
||
|
animation: 30, // ms, animation speed moving items when sorting, `0` — without animation
|
||
|
handle: ".module1", // Restricts sort start click/touch to the specified element
|
||
|
draggable: ".module1", // Specifies which items inside the element should be sortable
|
||
|
onUpdate: function (evt){
|
||
|
}
|
||
|
});
|
||
|
}, function(code, data) {
|
||
|
top.dialog.msg(data.msg);
|
||
|
}, function() {
|
||
|
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
|
||
|
}, function() {
|
||
|
top.dialog.close(loadLayerIndex);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
initData();
|
||
|
|
||
|
$('.close').on('click', function() {
|
||
|
closeBox();
|
||
|
});
|
||
|
|
||
|
// 校验
|
||
|
form.verify({
|
||
|
});
|
||
|
});
|
||
|
</script>
|
||
|
</body>
|
||
|
</html>
|