<!DOCTYPE html>
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
<head>
|
<th:block th:include="include :: header('新增法律法规政策文章')" />
|
<th:block th:include="include :: summernote-css" />
|
<th:block th:include="include :: layui-css"/>
|
</head>
|
<body class="white-bg">
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
<form class="form-horizontal m" id="form-articleRegulation-add">
|
<div class="form-group">
|
<label class="col-sm-3 control-label is-required">文章标题:</label>
|
<div class="col-sm-8">
|
<input name="regulationTitle" class="form-control" type="text" required>
|
</div>
|
</div>
|
<div class="form-group">
|
<label class="col-sm-3 control-label is-required">文章类型:</label>
|
<div class="col-sm-8">
|
<select name="regulationType" class="form-control m-b" th:with="type=${@dict.getType('tr_article_regulation_type')}" required>
|
<option value="">--请选择--</option>
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
</select>
|
</div>
|
</div>
|
<div class="form-group">
|
<label class="col-sm-3 control-label">文章内容:</label>
|
<div class="col-sm-8">
|
<!-- <input name="regulationContent" class="form-control" type="text">-->
|
<input id="regulationContent" name="regulationContent" type="hidden">
|
<div class="summernote"></div>
|
</div>
|
</div>
|
<div class="form-group">
|
<label class="col-sm-3 control-label">备注信息:</label>
|
<div class="col-sm-8">
|
<input id="remark" name="remark" class="form-control" type="text">
|
</div>
|
</div>
|
|
<div class="form-group">
|
<label class="col-sm-2 control-label">所属文件:
|
</label>
|
|
<div class="col-sm-10" >
|
<button type="button" class="layui-btn layui-btn-normal" id="testList">选择多文件</button>
|
</div>
|
</div>
|
<div class="form-group">
|
<label class="col-sm-2 control-label">
|
</label>
|
|
<div class="col-sm-10" >
|
<div class="layui-upload-list">
|
<table class="layui-table">
|
<thead>
|
<tr><th>文件名</th>
|
<th>状态</th>
|
<th>操作</th>
|
</tr></thead>
|
<tbody id="demoList"></tbody>
|
</table>
|
</div>
|
<button type="button" class="layui-btn" id="testListAction">开始上传</button>
|
</div>
|
</div>
|
</form>
|
</div>
|
<th:block th:include="include :: footer" />
|
<th:block th:include="include :: summernote-js" />
|
<th:block th:include="include :: layui-js"/>
|
<!-- 封装layui上传方法 -->
|
<script src="/js/common/fileUpload.js"></script>
|
|
<script type="text/javascript">
|
|
var prefix = ctx + "tr/articleRegulation";
|
|
//存放已上传的附件的数组
|
var attachmentListArray = new Array();
|
|
$(function() {
|
fileUpload("#testList","#testListAction","#demoList",attachmentListArray);
|
});
|
|
$('.summernote').summernote({
|
placeholder: '请输入文章内容',
|
height : 192,
|
lang : 'zh-CN',
|
followingToolbar: false,
|
callbacks: {
|
onImageUpload: function (files) {
|
sendFile(files[0], this);
|
}
|
}
|
});
|
// 上传文件
|
function sendFile(file, obj) {
|
var data = new FormData();
|
data.append("file", file);
|
$.ajax({
|
type: "POST",
|
url: ctx + "common/upload",
|
data: data,
|
cache: false,
|
contentType: false,
|
processData: false,
|
dataType: 'json',
|
success: function(result) {
|
if (result.code == web_status.SUCCESS) {
|
$(obj).summernote('editor.insertImage', result.url, result.fileName);
|
} else {
|
$.modal.alertError(result.msg);
|
}
|
},
|
error: function(error) {
|
$.modal.alertWarning("图片上传失败。");
|
}
|
});
|
}
|
|
|
$("#form-articleRegulation-add").validate({
|
focusCleanup: true
|
});
|
|
function submitHandler() {
|
if ($.validate.form()) {
|
var sHTML = $('.summernote').summernote('code');
|
$("#regulationContent").val(sHTML);
|
|
var data = $('#form-articleRegulation-add').serializeArray();
|
data.push({"name": "ownedFile", "value": JSON.stringify(attachmentListArray)});
|
|
$.operate.save(prefix + "/add", data);
|
}
|
}
|
</script>
|
</body>
|
</html>
|