tenlion-module/module-config-table/src/main/resources/templates/configtableoperation/update.html

235 lines
12 KiB
HTML
Raw Normal View History

2021-08-26 11:20:52 +08:00
<!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">
<link rel="stylesheet" type="text/css" href="assets/js/vendor/viewer/viewer.min.css">
<style>
.mustField {
color: red;
}
</style>
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein" id="viewer">
<div class="layui-card" >
<div class="layui-card-header">
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
<a class="close" href="javascript:void(0);">上级列表</a><span lay-separator="">/</span>
<a href="javascript:void(0);"><cite>查看审核内容</cite></a>
</span>
</div>
<div class="layui-card-body" style="padding: 15px;">
<form class="layui-form layui-form-pane" lay-filter="dataForm">
<div id="fieldTemplateDiv"></div>
<script id="fieldTemplate" type="text/html">
{{# for(var i = 0 ; i < d.length; i++) { }}
{{# var map = d[i]; }}
{{# if(map.dataType == 1) { }}
<div class=" layui-form-item " >
<div >
<label class="layui-form-label" >{{ map.comment }}{{ map.must == 1 ? '<span class="mustField">*</span>' : '' }}</label>
<div class="layui-input-block">
<input type="text" class="layui-input" value="{{ map.value }}" placeholder="{{ map.placeholder }}" maxlength="500">
</div>
</div>
</div>
{{# } }}
{{# if(map.dataType == 2) { }}
{{# var mapValue = map.value }}
{{# var imageArray = mapValue.split("@")[0].split(","); }}
<div class=" layui-form-item layui-form-text " >
<div>
<label class="layui-form-label" >{{ map.comment }}{{ map.must == 1 ? '<span class="mustField">*</span>' : '' }}</label>
<div class="layui-input-block">
<div class="upload-image-box">
{{# for(var j = 0 ; j < imageArray.length; j++) { }}
<span class="upload-image-span">
<img src="route/file/download/false/{{ imageArray[j] }}" align="加载失败">
</span>
{{# } }}
</div>
</div>
</div>
</div>
{{# } }}
{{# if(map.dataType == 3) { }}
{{# var mapValue = map.value; }}
{{# var audioArray = mapValue.split(","); }}
<div class=" layui-form-item layui-form-text " >
<div>
<label class="layui-form-label" >{{ map.comment }}{{ map.must == 1 ? '<span class="mustField">*</span>' : '' }}</label>
<div class="layui-input-block">
<div class="upload-audio-box" style="width: auto; height: auto; padding-left: 35px; padding-top: 35px;">
{{# for(var j = 0 ; j < audioArray.length; j++) { }}
{{# var audio = audioArray[j].split("&")[0]; }}
<audio src="route/file/download/false/{{audio }}" controls="controls">您的浏览器不支持 audio 标签。</audio>
{{# } }}
</div>
</div>
</div>
</div>
{{# } }}
{{# if(map.dataType == 4) { }}
{{# var mapValue = map.value }}
{{# var videoArray = mapValue.split(","); }}
<div class=" layui-form-item layui-form-text " >
<div>
<label class="layui-form-label" >{{ map.comment }}{{ map.must == 1 ? '<span class="mustField">*</span>' : '' }}</label>
<div class="layui-input-block">
<div class="upload-video-box" style="width: auto; height: auto; padding-left: 25px; padding-top: 25px;">
{{# for(var j = 0 ; j < audioArray.length; j++) { }}
{{# var video = videoArray[j].split("&")[0]; }}
<div id="{{map.name}}{{j}}" style="width:300px; height:180px;"></div>
{{# } }}
</div>
</div>
</div>
</div>
{{# } }}
{{# if(map.dataType == 7) { }}
<div class=" layui-form-item layui-form-text ">
<div >
<label class="layui-form-label" >{{ map.comment }}{{ map.must == 1 ? '<span class="mustField">*</span>' : '' }}</label>
<div class="layui-input-block layui-text">
<textarea class="layui-textarea" placeholder="{{ map.placeholder }}">{{ map.value }}</textarea>
</div>
</div>
</div>
{{# } }}
{{# } }}
</script>
<div class="layui-form-item layui-layout-admin">
<div class="layui-input-block">
<div class="layui-footer" style="left: 0;">
<button type="button" class="layui-btn" lay-submit lay-filter="submitForm">提交审核</button>
<button type="button" class="layui-btn layui-btn-primary close">返回上级</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<script src="assets/js/vendor/wangEditor/wangEditor.min.js"></script>
<script src="assets/js/vendor/ckplayer/ckplayer/ckplayer.js"></script>
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script>
layui.config({
base: 'assets/layuiadmin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
var $ = layui.$;
var form = layui.form;
var laytpl = layui.laytpl;
var laydate = layui.laydate;
var uid = top.restAjax.params(window.location.href).uid;
var configTableId = top.restAjax.params(window.location.href).configTableId;
function closeBox() {
parent.layer.close(parent.layer.getFrameIndex(window.name));
}
var dataList;
// 初始化内容
function initData() {
var loadLayerIndex;
top.restAjax.get(top.restAjax.path('api/configtableoperation/get/{configTableId}/{uid}', [configTableId,uid]), {}, null, function(code, data) {
var dataFormData = {};
for(var i in data) {
dataFormData[i] = data[i] +'';
}
dataList = data.list;
laytpl(document.getElementById('fieldTemplate').innerHTML).render(data.list, function(html) {
document.getElementById('fieldTemplateDiv').innerHTML = html;
form.val('dataForm', {});
form.render(null, 'dataForm');
for (var i = 0 ; i < dataList.length; i++) {
if(dataList[i].dataType == "2") {
setTimeout(function() {
new Viewer(document.getElementById("viewer"),{
loop:true
});
}, 150);
}
if(dataList[i].dataType == "4") {
var videoArray = dataList[i].value.split(",");
for (var j = 0 ; j < videoArray.length; j++) {
var video = videoArray[j].split("&")[0];
var image = videoArray[j].split("&")[1];
var player = new ckplayer({
container: '#'+ dataList[i].name + j,
variable: 'player',
flashplayer: false,
poster:'route/file/download/true/'+ image,
video: {
file: 'route/file/download/true/'+ video,
type: 'video/mp4'
}
});
}
}
}
form.render(null, 'dataForm');
});
}, 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();
// 提交表单
form.on('submit(submitForm)', function(formData) {
//询问框
top.layer.confirm('', {
title:'保存审核',
btn: ['审核通过','审核不通过','取消'] //按钮
}, function(la){
subMit("2", "审核通过");
}, function(la){
top.layer.prompt({title: '输入不通过的原因', formType: 2}, function(text, index){
top.layer.close(index);
subMit("0", text);
});
}, function(la){
top.layer.close(la);
});
});
function subMit(checkStatus, checkRemark) {
var loadLayerIndex;
var updateData = {checkStatus:checkStatus, checkRemark:checkRemark, configTableId:configTableId, uid: uid};
top.restAjax.put(top.restAjax.path('api/configtableoperation/check', []), updateData, null, function(code, data) {
closeBox();
}, 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);
});
}
$('.close').on('click', function() {
closeBox();
});
// 校验
form.verify({
});
});
</script>
</body>
</html>