You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
182 lines
7.4 KiB
182 lines
7.4 KiB
<!DOCTYPE html>
|
|
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>layui</title>
|
|
<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, maximum-scale=1">
|
|
<link rel="stylesheet" href="/static/lib/layui-v2.6.3/css/layui.css" media="all">
|
|
<link rel="stylesheet" href="/static/css/public.css" media="all">
|
|
<link rel="stylesheet" href="/static/css/inputTag.css">
|
|
|
|
</head>
|
|
<body>
|
|
<style>
|
|
.inputdiv {
|
|
display: flex;
|
|
background-color: #fff;
|
|
height: 38px;
|
|
line-height: 38px;
|
|
border: 1px solid rgb(238, 238, 238);
|
|
}
|
|
|
|
|
|
</style>
|
|
|
|
<div class="layuimini-container">
|
|
<div class="layuimini-main">
|
|
<fieldset class="layui-elem-field">
|
|
<legend style="font-size: 30px;padding-top: 20px;text-align: center">公告发布</legend>
|
|
<div class="layui-fluid">
|
|
<div class="layui-card-body" style="padding: 0">
|
|
<div class="layui-form" style="margin-top: 30px">
|
|
<input style="display:none;" name="id" th:value="${record.getId()}">
|
|
<div class="layui-form-item" >
|
|
<label class="layui-form-label" style="height: 40px;">可见范围:</label>
|
|
<div class="layui-input-block">
|
|
<div class="fairy-tag-container" style="border-style: none">
|
|
<div class="inputdiv">
|
|
<input type="text" id="viewRange" style="display: none" th:value="${record.getViewRangeName()}"/>
|
|
<i class="layui-icon layui-icon-search"
|
|
style="display: inline;right: 0;position: absolute;"
|
|
onclick="selectDepartment()"></i>
|
|
<input type="text" id="viewRangeId"
|
|
name="viewRangeId"
|
|
class="layui-input" style="display: none"
|
|
th:value="${record.getViewRangeId()}"
|
|
lay-verify="required"/>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label">公告标题:</label>
|
|
<div class="layui-input-block">
|
|
<input name="title" type="text" placeholder="请输入公告标题..." class="layui-input" th:value="${record.getTitle()}"
|
|
lay-verify="required"/>
|
|
</div>
|
|
</div>
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label">公告内容:</label>
|
|
<div class="layui-input-block">
|
|
<textarea name="content" style="height: 30em" placeholder="请填写公告内容..." th:text="${record.getContent()}"
|
|
class="layui-textarea" lay-verify="required"></textarea>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="layui-form-item" style="margin-top: 20px">
|
|
<div class="layui-input-block " style="text-align: center">
|
|
<button class="layui-btn layui-btn-lg " style="width: 150px" lay-submit
|
|
lay-filter="noticeBtn">修改公告
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
|
|
<script src="/static/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
|
|
<script>
|
|
function selectDepartment(){
|
|
|
|
}
|
|
// 用于标志是否为第一次提交
|
|
let flagForForm = false;
|
|
layui.use(['form', 'layer', 'laydate', 'inputTag'], function () {
|
|
var form = layui.form,
|
|
layer = layui.layer,
|
|
inputTag = layui.inputTag,
|
|
laydate = layui.laydate,
|
|
$ = layui.$;
|
|
|
|
//日期
|
|
laydate.render({
|
|
elem: '#date'
|
|
});
|
|
|
|
//监听提交
|
|
form.on('submit(noticeBtn)', function (data) {
|
|
if(!flagForForm){
|
|
flagForForm = true;
|
|
$.ajax({
|
|
url: "/notice/noticeEdit",
|
|
data: JSON.stringify(data.field),
|
|
type: "post",
|
|
dataType: 'json',
|
|
contentType: "application/json;charset=utf-8",
|
|
success: function (data) {
|
|
if (data.status >= 300) {
|
|
layer.msg(data.statusInfo.message);//失败的表情
|
|
} else {
|
|
layer.msg("公告修改成功", {
|
|
icon: 6,//成功的表情
|
|
time: 1000 //1秒关闭(如果不配置,默认是3秒)
|
|
}, function () {
|
|
window.location = "/notice_out"
|
|
});
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
return false;
|
|
});
|
|
|
|
let tagData = [];
|
|
let tempData = $("#viewRange").val().split(",");
|
|
$.each(tempData, function (index, item) {
|
|
if (item !== "") {
|
|
tagData.push(item)
|
|
}
|
|
});
|
|
$("#viewRange").val("");
|
|
|
|
let tagLabel = inputTag.render({
|
|
elem: '#viewRange',
|
|
data: tagData,//初始值
|
|
removeKeyNum: 8,//删除按键编号 默认,BackSpace 键
|
|
createKeyNum: 13,//创建按键编号 默认,Enter 键
|
|
onChange: function (data, value, type, index) {
|
|
if (type === "remove") {
|
|
let viewRange = $("#viewRangeId");
|
|
let split = viewRange.val().split(",");
|
|
split.splice(index, 1);
|
|
viewRange.val(split.toString());
|
|
}
|
|
}
|
|
});
|
|
|
|
selectDepartment = function () {
|
|
layer.open({
|
|
type: 2,
|
|
title: '弹窗内容',
|
|
skin: 'layui-layer-rim',
|
|
maxmin: true,
|
|
shadeClose: true, //点击遮罩关闭层
|
|
area: ['70%', '70%'],
|
|
move : '.layui-layer-title',
|
|
fixed:false,
|
|
content: '/selectDepartment',
|
|
success: function(layero, index){
|
|
var children = layero.children();
|
|
var content = $(children[1]);
|
|
var iframeChildren = $(content.children());
|
|
content.css('height','100%');
|
|
iframeChildren.css('height','100%');
|
|
},
|
|
end:function () {
|
|
tagLabel.createItem();
|
|
}
|
|
});
|
|
}
|
|
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|