20 changed files with 3170 additions and 0 deletions
@ -0,0 +1,227 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="zh" xmlns:th="http://www.thymeleaf.org"> |
|||
<head> |
|||
<th:block th:include="zdxtInclude :: header('新增')"/> |
|||
<th:block th:include="zdxtInclude :: bootstrap-fileinput-css"/> |
|||
</head> |
|||
<body class="white-bg"> |
|||
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
|||
<form class="form-horizontal m" enctype="multipart/form-data" id="form-medal-add" type="text/template"> |
|||
<input name="parentId" type="text" hidden> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label is-required">名称:</label> |
|||
<div class="col-sm-8"> |
|||
<input class="form-control" type="text" name="name" id="name" required> |
|||
</div> |
|||
</div> |
|||
<div class="form-group" id="fileTitle"> |
|||
<label class="col-sm-3 control-label is-required">图标:</label> |
|||
<div id="fileIn" class="col-sm-8"> |
|||
<div class="file-loading"> |
|||
<input id="fileInput" name="file" type="file" multiple> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label is-required">隐藏:</label> |
|||
<div class="col-sm-8"> |
|||
<select name="hide" class="form-control"> |
|||
<option value="1">否</option> |
|||
<option value="0">是</option> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
<th:block th:include="zdxtInclude :: footer"/> |
|||
<th:block th:include="zdxtInclude :: bootstrap-fileinput-js"/> |
|||
<script type="text/javascript" th:inline="javascript"> |
|||
var prefix = ctx + "small/project/medal" |
|||
|
|||
$("#form-medal-add").validate({ |
|||
focusCleanup: true |
|||
}); |
|||
|
|||
$(function () { |
|||
// 渲染文件要素信息 |
|||
renderVersionAtt(); |
|||
}) |
|||
|
|||
function submitHandler() { |
|||
if ($.validate.form()) { |
|||
$('#fileInput').fileinput('upload'); |
|||
} |
|||
} |
|||
|
|||
/** 附件相关 */ |
|||
|
|||
/** 渲染附件信息 */ |
|||
function renderVersionAtt() { |
|||
$("#fileIn").show(); |
|||
$("#fileOut").hide(); |
|||
uploadFiles(); |
|||
$("#fileInput").fileinput('clear') |
|||
} |
|||
|
|||
/** 上传附件 */ |
|||
function uploadFiles() { |
|||
var filePreview = {fileList: null, previewRespDTOS: null} |
|||
initFile("fileInput", prefix + "/add", filePreview); |
|||
} |
|||
|
|||
/** 初始化文件 */ |
|||
function initFile(elementId, url, filePreview) { |
|||
var preview = filePreview.previewRespDTOS; |
|||
|
|||
if (preview != null) { |
|||
for (var i = 0; i < preview.length; i++) { |
|||
// 图片删除的地址 |
|||
preview[i].url = prefix + "/removeFile" |
|||
} |
|||
} |
|||
|
|||
$("#" + elementId).fileinput({ |
|||
'theme': 'explorer', |
|||
initialPreviewAsData: true, |
|||
dropZoneEnabled: true, |
|||
dropZoneTitle: "上传图片或视频", |
|||
uploadUrl: url, |
|||
uploadAsync: false,//异步上传 |
|||
enctype: 'multipart/form-data', |
|||
showClose: false, |
|||
showPreview: true, |
|||
showUpload: false, |
|||
uploadExtraData: function () { |
|||
var formData = $("#form-medal-add").serialize(); |
|||
formData = decodeURIComponent(formData, true); |
|||
var arr = formData.split("&"); |
|||
var data = {}; |
|||
for (var i = 0; i < arr.length; i++) { |
|||
var item = arr[i].split('='); |
|||
var value = item[1].replace("+", " "); |
|||
data[item[0]] = value; |
|||
} |
|||
//选项 |
|||
var optionList = new Array(); |
|||
var j = 0; |
|||
$('input[name="identify"]').each(function () { |
|||
if (j !== 0) { |
|||
let option = {} |
|||
option.identify = $(this).val(); |
|||
option.content = $(this).parent().next().children().val(); |
|||
optionList.push(option); |
|||
} |
|||
j++; |
|||
}); |
|||
data.option = JSON.stringify(optionList); |
|||
data.parentId = [[${parentId}]]; |
|||
return data; |
|||
}, |
|||
// showBrowse: false, |
|||
previewFileIcon: '<i class="fas fa-file"></i>', |
|||
preferIconicPreview: true, |
|||
previewFileIconSettings: { // configure your icon file extensions |
|||
'doc': '<i class="fa fa-file-word-o text-primary"></i>', |
|||
'xls': '<i class="fa fa-file-excel-o text-success"></i>', |
|||
'ppt': '<i class="fa fa-file-powerpoint-o text-danger"></i>', |
|||
'pdf': '<i class="fa fa-file-pdf-o text-danger"></i>', |
|||
'txt': '<i class="fa fa-file-text-o text-info"></i>', |
|||
'zip': '<i class="fa fa-file-archive-o text-muted"></i>', |
|||
'htm': '<i class="fa fa-file-code-o text-info"></i>', |
|||
'mov': '<i class="fa fa-file-movie-o text-warning"></i>', |
|||
'mp3': '<i class="fa fa-file-audio-o text-warning"></i>' |
|||
}, |
|||
previewFileExtSettings: { |
|||
'doc': function (ext) { |
|||
return ext.match(/(doc|docx)$/i); |
|||
}, |
|||
'xls': function (ext) { |
|||
return ext.match(/(xls|xlsx)$/i); |
|||
}, |
|||
'ppt': function (ext) { |
|||
return ext.match(/(ppt|pptx)$/i); |
|||
}, |
|||
'zip': function (ext) { |
|||
return ext.match(/(zip|rar|tar|gzip|gz|7z)$/i); |
|||
}, |
|||
'htm': function (ext) { |
|||
return ext.match(/(htm|html)$/i); |
|||
}, |
|||
'mov': function (ext) { |
|||
return ext.match(/(avi|mpg|mkv|mov|mp4|3gp|webm|wmv)$/i); |
|||
}, |
|||
'mp3': function (ext) { |
|||
return ext.match(/(mp3|wav)$/i); |
|||
}, |
|||
'txt': function (ext) { |
|||
return ext.match(/(txt|ini|csv|java|php|js|css)$/i); |
|||
} |
|||
}, |
|||
layoutTemplates: { |
|||
// actionDelete: ''//去掉删除按钮 |
|||
actionUpload: '' // 去掉上传按钮 |
|||
}, |
|||
initialPreview: filePreview.fileList == null ? [] : filePreview.fileList, |
|||
initialPreviewConfig: preview == null ? [] : preview |
|||
}); |
|||
|
|||
// 同步上传成功回调 |
|||
$("#fileInput").on("filebatchuploadsuccess", function (event, data, previewId, index) { |
|||
fileUploadCallBack(data.response); |
|||
}) |
|||
}; |
|||
|
|||
/** 文件上传回调 */ |
|||
function fileUploadCallBack(result) { |
|||
var parent = window.parent; |
|||
if (result.success) { |
|||
parent.$.modal.msgSuccess(result.message); |
|||
} else { |
|||
$.modal.alertError(result.message); |
|||
} |
|||
$.modal.close(); |
|||
parent.$.table.refresh(); |
|||
} |
|||
|
|||
/** 动态表格 */ |
|||
$(function () { |
|||
var show_count = 8; //要显示的条数 |
|||
var count = 1; //递增的开始值,这里是你的ID |
|||
$("#btn_addtr").click(function () { |
|||
|
|||
var length = $("#dynamicTable tbody tr").length; |
|||
//alert(length); |
|||
if (length < show_count) //点击时候,如果当前的数字小于递增结束的条件 |
|||
{ |
|||
$("#tab11 tbody tr").clone().appendTo("#dynamicTable tbody"); //在表格后面添加一行 |
|||
changeIndex();//更新行号 |
|||
} |
|||
}); |
|||
|
|||
|
|||
}); |
|||
|
|||
function changeIndex() { |
|||
var c = ['0', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'] |
|||
var i = 1; |
|||
$("#dynamicTable tbody tr").each(function () { //循环tab tbody下的tr |
|||
// console.log(i) |
|||
$(this).find("input[name='NO']").val(i);//更新行号 |
|||
$(this).find("input[name='identify']").val(c[i]);//更新标号 |
|||
i++; |
|||
}); |
|||
} |
|||
|
|||
function deltr(opp) { |
|||
var length = $("#dynamicTable tbody tr").length; |
|||
//alert(length); |
|||
if (length <= 1) { |
|||
alert("至少保留一行"); |
|||
} else { |
|||
$(opp).parent().parent().remove();//移除当前行 |
|||
changeIndex(); |
|||
} |
|||
} |
|||
</script> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,216 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > |
|||
<head> |
|||
<th:block th:include="zdxtInclude :: header('编辑')" /> |
|||
<th:block th:include="zdxtInclude :: bootstrap-fileinput-css"/> |
|||
</head> |
|||
<body class="white-bg"> |
|||
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
|||
<form class="form-horizontal m" id="form-medal-edit" th:object="${sceneMedal}"> |
|||
<input name="guid" th:field="*{guid}" type="hidden"> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">名称:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="name" th:field="*{name}" class="form-control" type="text"> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">是否隐藏:</label> |
|||
<div class="col-sm-8"> |
|||
<select name="hide" class="form-control"> |
|||
<option value="1">否</option> |
|||
<option value="0">是</option> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
<div class="form-group" id="fileTitle"> |
|||
<label class="col-sm-3 control-label">图标:</label> |
|||
<div id="fileIn" class="col-sm-8" readonly> |
|||
<div class="file-loading"> |
|||
<input id="fileInput" name="file" type="file" multiple> |
|||
</div> |
|||
</div> |
|||
<div id="fileOut" class="col-sm-8" style="display: none" readonly> |
|||
<div class="file-loading"> |
|||
<input id="fileOutput" name="file" type="file" multiple> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
<th:block th:include="zdxtInclude :: footer" /> |
|||
<th:block th:include="zdxtInclude :: bootstrap-fileinput-js"/> |
|||
<script type="text/javascript" th:inline="javascript"> |
|||
var prefix = ctx + "small/project/medal" |
|||
$("#form-medal-edit").validate({ |
|||
focusCleanup: true |
|||
}); |
|||
|
|||
var isFlieIn = true; |
|||
|
|||
$(function() { |
|||
// 渲染要素信息 |
|||
renderVersionAtt(); |
|||
}) |
|||
|
|||
function submitHandler() { |
|||
if (isFlieIn) { |
|||
$('#fileInput').fileinput('upload'); |
|||
} else { |
|||
$('#fileOutput').fileinput('upload'); |
|||
} |
|||
} |
|||
/** 附件相关 */ |
|||
|
|||
/** 渲染附件信息 */ |
|||
function renderVersionAtt() { |
|||
var key = $("[name='guid']").val(); |
|||
|
|||
$.getJSON(prefix + "/queryFiles/" + key, function (result) { |
|||
if (result.data != null) { |
|||
$("#fileIn").hide(); |
|||
$("#fileOut").show(); |
|||
// 重置文件预览框 |
|||
$("#fileOut").html("<div class=\"file-loading\"><input id=\"fileOutput\" name=\"file\" type=\"file\" multiple></div>"); |
|||
queryFiles(key); |
|||
isFlieIn = false; |
|||
} else { |
|||
$("#fileIn").show(); |
|||
$("#fileOut").hide(); |
|||
uploadFiles(); |
|||
isFlieIn = true; |
|||
$("#fileInput").fileinput('clear') |
|||
} |
|||
}); |
|||
} |
|||
|
|||
/** 预览附件 */ |
|||
function queryFiles(key) { |
|||
$.ajax({ |
|||
type: "POST", |
|||
url: prefix + "/queryFilesPost", |
|||
data: {"key": key}, |
|||
dataType: 'json', |
|||
success: function (result) { |
|||
if (result.success == true) { |
|||
initFile("fileOutput", prefix + "/edit", result.data.filePreview); |
|||
} |
|||
}, |
|||
error: function (error) { |
|||
$.modal.alertWarning("附件预览失败!"); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
/** 上传附件 */ |
|||
function uploadFiles() { |
|||
var filePreview = { fileList: null, previewRespDTOS: null } |
|||
initFile("fileInput", prefix + "/edit", filePreview); |
|||
} |
|||
|
|||
/** 初始化文件 */ |
|||
function initFile(elementId, url, filePreview) { |
|||
var preview = filePreview.previewRespDTOS; |
|||
|
|||
if (preview != null) { |
|||
for (var i = 0; i < preview.length; i++) { |
|||
// 图片删除的地址 |
|||
preview[i].url = prefix + "/removeFile" |
|||
} |
|||
} |
|||
|
|||
$("#" + elementId).fileinput({ |
|||
'theme': 'explorer', |
|||
initialPreviewAsData: true, |
|||
dropZoneEnabled: true, |
|||
dropZoneTitle: "上传图片或视频", |
|||
uploadUrl: url, |
|||
uploadAsync: false,//异步上传 |
|||
enctype: 'multipart/form-data', |
|||
showClose: false, |
|||
showPreview: true, |
|||
showUpload: false, |
|||
uploadExtraData: function () { |
|||
var formData = $("#form-medal-edit").serialize(); |
|||
formData = decodeURIComponent(formData, true); |
|||
var arr = formData.split("&"); |
|||
var data = {}; |
|||
for (var i=0; i<arr.length; i++) { |
|||
var item = arr[i].split('='); |
|||
var value = item[1].replace("+", " "); |
|||
data[item[0]] = value; |
|||
} |
|||
return data; |
|||
}, |
|||
// showBrowse: false, |
|||
previewFileIcon: '<i class="fas fa-file"></i>', |
|||
preferIconicPreview: true, |
|||
previewFileIconSettings: { // configure your icon file extensions |
|||
'doc': '<i class="fa fa-file-word-o text-primary"></i>', |
|||
'xls': '<i class="fa fa-file-excel-o text-success"></i>', |
|||
'ppt': '<i class="fa fa-file-powerpoint-o text-danger"></i>', |
|||
'pdf': '<i class="fa fa-file-pdf-o text-danger"></i>', |
|||
'txt': '<i class="fa fa-file-text-o text-info"></i>', |
|||
'zip': '<i class="fa fa-file-archive-o text-muted"></i>', |
|||
'htm': '<i class="fa fa-file-code-o text-info"></i>', |
|||
'mov': '<i class="fa fa-file-movie-o text-warning"></i>', |
|||
'mp3': '<i class="fa fa-file-audio-o text-warning"></i>' |
|||
}, |
|||
previewFileExtSettings: { |
|||
'doc': function (ext) { |
|||
return ext.match(/(doc|docx)$/i); |
|||
}, |
|||
'xls': function (ext) { |
|||
return ext.match(/(xls|xlsx)$/i); |
|||
}, |
|||
'ppt': function (ext) { |
|||
return ext.match(/(ppt|pptx)$/i); |
|||
}, |
|||
'zip': function (ext) { |
|||
return ext.match(/(zip|rar|tar|gzip|gz|7z)$/i); |
|||
}, |
|||
'htm': function (ext) { |
|||
return ext.match(/(htm|html)$/i); |
|||
}, |
|||
'mov': function (ext) { |
|||
return ext.match(/(avi|mpg|mkv|mov|mp4|3gp|webm|wmv)$/i); |
|||
}, |
|||
'mp3': function (ext) { |
|||
return ext.match(/(mp3|wav)$/i); |
|||
}, |
|||
'txt': function (ext) { |
|||
return ext.match(/(txt|ini|csv|java|php|js|css)$/i); |
|||
} |
|||
}, |
|||
layoutTemplates: { |
|||
// actionDelete: ''//去掉删除按钮 |
|||
actionUpload: '' // 去掉上传按钮 |
|||
}, |
|||
initialPreview: filePreview.fileList == null ? [] : filePreview.fileList, |
|||
initialPreviewConfig: preview == null ? [] : preview |
|||
}); |
|||
|
|||
// 同步上传成功回调 |
|||
$("#fileInput").on("filebatchuploadsuccess", function (event, data, previewId, index) { |
|||
fileUploadCallBack(data.response); |
|||
}) |
|||
// 同步上传成功回调 |
|||
$("#fileOutput").on("filebatchuploadsuccess", function (event, data, previewId, index) { |
|||
fileUploadCallBack(data.response); |
|||
}) |
|||
}; |
|||
|
|||
function fileUploadCallBack(result) { |
|||
var parent = window.parent; |
|||
if (result.success) { |
|||
parent.$.modal.msgSuccess(result.message); |
|||
} else { |
|||
$.modal.alertError(result.message); |
|||
} |
|||
$.modal.close(); |
|||
parent.$.table.refresh(); |
|||
} |
|||
|
|||
</script> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,117 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> |
|||
<head> |
|||
<th:block th:include="zdxtInclude :: header('奖章配置')"/> |
|||
</head> |
|||
<body class="gray-bg"> |
|||
<div class="container-div"> |
|||
<div class="row"> |
|||
<div class="col-sm-12 search-collapse"> |
|||
<form id="formId"> |
|||
<div class="select-list"> |
|||
<ul> |
|||
<li> |
|||
<p>名称:</p> |
|||
<input type="text" name="name"/> |
|||
</li> |
|||
<li> |
|||
<a class="btn btn-success btn-rounded btn-sm" onclick="$.table.search()"><i |
|||
class="fa fa-search"></i> 搜索</a> |
|||
<a class="btn btn-reset btn-rounded btn-sm" onclick="reset()"><i |
|||
class="fa fa-refresh"></i> 重置</a> |
|||
</li> |
|||
</ul> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
|
|||
<div class="btn-group-sm" id="toolbar" role="group"> |
|||
<a class="btn btn-success" onclick="add()" shiro:hasPermission="system:medal:add"> |
|||
<i class="fa fa-plus"></i> 新增 |
|||
</a> |
|||
</div> |
|||
<div class="col-sm-12 select-table table-striped"> |
|||
<table id="bootstrap-table"></table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<th:block th:include="zdxtInclude :: footer"/> |
|||
<script th:inline="javascript"> |
|||
var editFlag = [[${@permission.hasPermi('project:medal:edit')}]]; |
|||
var removeFlag = [[${@permission.hasPermi('project:medal:remove')}]]; |
|||
var detailFlag = [[${@permission.hasPermi('project:medal:detail')}]]; |
|||
var prefix = ctx + "small/project/medal"; |
|||
|
|||
$(function () { |
|||
var options = { |
|||
url: prefix + "/list", |
|||
createUrl: prefix + "/add/{}", |
|||
updateUrl: prefix + "/edit/{id}", |
|||
removeUrl: prefix + "/remove", |
|||
exportUrl: prefix + "/export", |
|||
detailUrl: prefix + "/detail/{guid}", |
|||
modalName: "主页", |
|||
columns: [{ |
|||
checkbox: true |
|||
}, |
|||
{ |
|||
field: 'name', |
|||
title: '名称' |
|||
}, |
|||
// { |
|||
// field: 'hide', |
|||
// title: '隐藏', |
|||
// formatter: function (value, index) { |
|||
// return value === 0 ? "是" : "否"; |
|||
// } |
|||
// }, |
|||
{ |
|||
field: 'creator', |
|||
title: '创建人' |
|||
}, |
|||
{ |
|||
field: 'createTime', |
|||
title: '创建时间' |
|||
}, |
|||
{ |
|||
title: '操作', |
|||
align: 'center', |
|||
formatter: function (value, row, index) { |
|||
var actions = []; |
|||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.guid + '\')"><i class="fa fa-edit"></i>编辑</a> '); |
|||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.guid + '\')"><i class="fa fa-remove"></i>删除</a>'); |
|||
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="sort(\'' + row.guid + '\')"><i class="fa fa-eject"></i>上移</a>'); |
|||
return actions.join(''); |
|||
} |
|||
}] |
|||
}; |
|||
$.table.init(options); |
|||
}); |
|||
|
|||
function detail(id, width, height) { |
|||
$.modal.open("查看", ctx + "small/project/medal/detail/" + id, width, height); |
|||
} |
|||
|
|||
function add() { |
|||
$.modal.open("新增", ctx + "small/project/medal/add", 800, 450); |
|||
} |
|||
|
|||
function sort(id) { |
|||
$.get(ctx + "small/project/medal/sort/" + id, null, function (res) { |
|||
if (res.success) { |
|||
// |
|||
$.table.refresh(); |
|||
$.modal.alertSuccess(res.message); |
|||
} else { |
|||
$.modal.alertWarning(res.message); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
function reset() { |
|||
$("[name='name']").val(""); |
|||
$.table.search() |
|||
} |
|||
</script> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,244 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="zh" xmlns:th="http://www.thymeleaf.org"> |
|||
<head> |
|||
<th:block th:include="zdxtInclude :: header('新增')"/> |
|||
<th:block th:include="zdxtInclude :: bootstrap-fileinput-css"/> |
|||
</head> |
|||
<body class="white-bg"> |
|||
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
|||
<form class="form-horizontal m" enctype="multipart/form-data" id="form-tab-add" type="text/template"> |
|||
<input name="parentId" type="text" hidden> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label is-required">名称:</label> |
|||
<div class="col-sm-8"> |
|||
<input class="form-control" type="text" name="title" id="title" required> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label is-required">跳转的页面:</label> |
|||
<div class="col-sm-8"> |
|||
<select name="pagePath" class="form-control"> |
|||
<option value="pages/index/index">首页</option> |
|||
<option value="pages/scan/scan">扫一扫</option> |
|||
<option value="pages/knowledge/knowledge">我的</option> |
|||
<option value="pages/my/my">动态</option> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label is-required">选中时颜色:</label> |
|||
<div class="col-sm-8"> |
|||
<input class="form-control" type="text" name="selectedColor" required> |
|||
</div> |
|||
</div> |
|||
<div class="form-group" id="fileTitle"> |
|||
<label class="col-sm-3 control-label is-required">图标:</label> |
|||
<div id="fileIn" class="col-sm-8"> |
|||
<div class="file-loading"> |
|||
<input id="fileInput" name="file" type="file" multiple> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label is-required">隐藏:</label> |
|||
<div class="col-sm-8"> |
|||
<select name="hide" class="form-control"> |
|||
<option value="1">否</option> |
|||
<option value="0">是</option> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
<th:block th:include="zdxtInclude :: footer"/> |
|||
<th:block th:include="zdxtInclude :: bootstrap-fileinput-js"/> |
|||
<script type="text/javascript" th:inline="javascript"> |
|||
var prefix = ctx + "small/project/tab" |
|||
|
|||
$("#form-tab-add").validate({ |
|||
focusCleanup: true |
|||
}); |
|||
|
|||
$(function () { |
|||
// 渲染文件要素信息 |
|||
renderVersionAtt(); |
|||
}) |
|||
|
|||
function submitHandler() { |
|||
if ($.validate.form()) { |
|||
$('#fileInput').fileinput('upload'); |
|||
} |
|||
} |
|||
|
|||
/** 附件相关 */ |
|||
|
|||
/** 渲染附件信息 */ |
|||
function renderVersionAtt() { |
|||
$("#fileIn").show(); |
|||
$("#fileOut").hide(); |
|||
uploadFiles(); |
|||
$("#fileInput").fileinput('clear') |
|||
} |
|||
|
|||
/** 上传附件 */ |
|||
function uploadFiles() { |
|||
var filePreview = {fileList: null, previewRespDTOS: null} |
|||
initFile("fileInput", prefix + "/add", filePreview); |
|||
} |
|||
|
|||
/** 初始化文件 */ |
|||
function initFile(elementId, url, filePreview) { |
|||
var preview = filePreview.previewRespDTOS; |
|||
|
|||
if (preview != null) { |
|||
for (var i = 0; i < preview.length; i++) { |
|||
// 图片删除的地址 |
|||
preview[i].url = prefix + "/removeFile" |
|||
} |
|||
} |
|||
|
|||
$("#" + elementId).fileinput({ |
|||
'theme': 'explorer', |
|||
initialPreviewAsData: true, |
|||
dropZoneEnabled: true, |
|||
dropZoneTitle: "上传图片或视频", |
|||
uploadUrl: url, |
|||
uploadAsync: false,//异步上传 |
|||
enctype: 'multipart/form-data', |
|||
showClose: false, |
|||
showPreview: true, |
|||
showUpload: false, |
|||
uploadExtraData: function () { |
|||
var formData = $("#form-tab-add").serialize(); |
|||
formData = decodeURIComponent(formData, true); |
|||
var arr = formData.split("&"); |
|||
var data = {}; |
|||
for (var i = 0; i < arr.length; i++) { |
|||
var item = arr[i].split('='); |
|||
var value = item[1].replace("+", " "); |
|||
data[item[0]] = value; |
|||
} |
|||
//选项 |
|||
var optionList = new Array(); |
|||
var j = 0; |
|||
$('input[name="identify"]').each(function () { |
|||
if (j !== 0) { |
|||
let option = {} |
|||
option.identify = $(this).val(); |
|||
option.content = $(this).parent().next().children().val(); |
|||
optionList.push(option); |
|||
} |
|||
j++; |
|||
}); |
|||
data.option = JSON.stringify(optionList); |
|||
data.parentId = [[${parentId}]]; |
|||
return data; |
|||
}, |
|||
// showBrowse: false, |
|||
previewFileIcon: '<i class="fas fa-file"></i>', |
|||
preferIconicPreview: true, |
|||
previewFileIconSettings: { // configure your icon file extensions |
|||
'doc': '<i class="fa fa-file-word-o text-primary"></i>', |
|||
'xls': '<i class="fa fa-file-excel-o text-success"></i>', |
|||
'ppt': '<i class="fa fa-file-powerpoint-o text-danger"></i>', |
|||
'pdf': '<i class="fa fa-file-pdf-o text-danger"></i>', |
|||
'txt': '<i class="fa fa-file-text-o text-info"></i>', |
|||
'zip': '<i class="fa fa-file-archive-o text-muted"></i>', |
|||
'htm': '<i class="fa fa-file-code-o text-info"></i>', |
|||
'mov': '<i class="fa fa-file-movie-o text-warning"></i>', |
|||
'mp3': '<i class="fa fa-file-audio-o text-warning"></i>' |
|||
}, |
|||
previewFileExtSettings: { |
|||
'doc': function (ext) { |
|||
return ext.match(/(doc|docx)$/i); |
|||
}, |
|||
'xls': function (ext) { |
|||
return ext.match(/(xls|xlsx)$/i); |
|||
}, |
|||
'ppt': function (ext) { |
|||
return ext.match(/(ppt|pptx)$/i); |
|||
}, |
|||
'zip': function (ext) { |
|||
return ext.match(/(zip|rar|tar|gzip|gz|7z)$/i); |
|||
}, |
|||
'htm': function (ext) { |
|||
return ext.match(/(htm|html)$/i); |
|||
}, |
|||
'mov': function (ext) { |
|||
return ext.match(/(avi|mpg|mkv|mov|mp4|3gp|webm|wmv)$/i); |
|||
}, |
|||
'mp3': function (ext) { |
|||
return ext.match(/(mp3|wav)$/i); |
|||
}, |
|||
'txt': function (ext) { |
|||
return ext.match(/(txt|ini|csv|java|php|js|css)$/i); |
|||
} |
|||
}, |
|||
layoutTemplates: { |
|||
// actionDelete: ''//去掉删除按钮 |
|||
actionUpload: '' // 去掉上传按钮 |
|||
}, |
|||
initialPreview: filePreview.fileList == null ? [] : filePreview.fileList, |
|||
initialPreviewConfig: preview == null ? [] : preview |
|||
}); |
|||
|
|||
// 同步上传成功回调 |
|||
$("#fileInput").on("filebatchuploadsuccess", function (event, data, previewId, index) { |
|||
fileUploadCallBack(data.response); |
|||
}) |
|||
}; |
|||
|
|||
/** 文件上传回调 */ |
|||
function fileUploadCallBack(result) { |
|||
var parent = window.parent; |
|||
if (result.success) { |
|||
parent.$.modal.msgSuccess(result.message); |
|||
} else { |
|||
$.modal.alertError(result.message); |
|||
} |
|||
$.modal.close(); |
|||
parent.$.table.refresh(); |
|||
} |
|||
|
|||
/** 动态表格 */ |
|||
$(function () { |
|||
var show_count = 8; //要显示的条数 |
|||
var count = 1; //递增的开始值,这里是你的ID |
|||
$("#btn_addtr").click(function () { |
|||
|
|||
var length = $("#dynamicTable tbody tr").length; |
|||
//alert(length); |
|||
if (length < show_count) //点击时候,如果当前的数字小于递增结束的条件 |
|||
{ |
|||
$("#tab11 tbody tr").clone().appendTo("#dynamicTable tbody"); //在表格后面添加一行 |
|||
changeIndex();//更新行号 |
|||
} |
|||
}); |
|||
|
|||
|
|||
}); |
|||
|
|||
function changeIndex() { |
|||
var c = ['0', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'] |
|||
var i = 1; |
|||
$("#dynamicTable tbody tr").each(function () { //循环tab tbody下的tr |
|||
// console.log(i) |
|||
$(this).find("input[name='NO']").val(i);//更新行号 |
|||
$(this).find("input[name='identify']").val(c[i]);//更新标号 |
|||
i++; |
|||
}); |
|||
} |
|||
|
|||
function deltr(opp) { |
|||
var length = $("#dynamicTable tbody tr").length; |
|||
//alert(length); |
|||
if (length <= 1) { |
|||
alert("至少保留一行"); |
|||
} else { |
|||
$(opp).parent().parent().remove();//移除当前行 |
|||
changeIndex(); |
|||
} |
|||
} |
|||
</script> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,232 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="zh" xmlns:th="http://www.thymeleaf.org"> |
|||
<head> |
|||
<th:block th:include="zdxtInclude :: header('详情')"/> |
|||
<th:block th:include="zdxtInclude :: bootstrap-fileinput-css"/> |
|||
</head> |
|||
<body class="white-bg"> |
|||
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
|||
<form class="form-horizontal m" id="form-manage-detail" th:object="${sceneTab}"> |
|||
<input name="guid" th:field="*{guid}" type="hidden"> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">名称:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="name" th:field="*{title}" class="form-control" type="text"> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label is-required">跳转的页面:</label> |
|||
<div class="col-sm-8"> |
|||
<select name="pagePath" class="form-control" th:field="*{pagePath}"> |
|||
<option value="pages/index/index">首页</option> |
|||
<option value="pages/scan/scan">扫一扫</option> |
|||
<option value="pages/knowledge/knowledge">我的</option> |
|||
<option value="pages/my/my">动态</option> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label is-required">选中时颜色:</label> |
|||
<div class="col-sm-8"> |
|||
<input class="form-control" type="text" name="selectedColor" th:field="*{selectedColor}" required> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">是否隐藏:</label> |
|||
<div class="col-sm-8"> |
|||
<select name="hide" class="form-control" th:field="*{hide}"> |
|||
<option value="1">否</option> |
|||
<option value="0">是</option> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">创建人:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="creator" th:field="*{creator}" class="form-control" type="text"> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">创建时间:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="createTime" th:field="*{createTime}" class="form-control" type="text"> |
|||
</div> |
|||
</div> |
|||
<div class="form-group" id="fileTitle"> |
|||
<label class="col-sm-3 control-label">图标:</label> |
|||
<div id="fileIn" class="col-sm-8" readonly> |
|||
<div class="file-loading"> |
|||
<input id="fileInput" name="file" type="file" multiple> |
|||
</div> |
|||
</div> |
|||
<div id="fileOut" class="col-sm-8" style="display: none" readonly> |
|||
<div class="file-loading"> |
|||
<input id="fileOutput" name="file" type="file" multiple> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
<th:block th:include="zdxtInclude :: footer"/> |
|||
<th:block th:include="zdxtInclude :: bootstrap-fileinput-js"/> |
|||
<script type="text/javascript" th:inline="javascript"> |
|||
var prefix = ctx + "small/project/tab" |
|||
|
|||
$(function () { |
|||
// 渲染文件要素信息 |
|||
renderVersionAtt(); |
|||
}) |
|||
|
|||
/** 附件相关 */ |
|||
var isFlieIn = true; |
|||
/** 渲染附件信息 */ |
|||
function renderVersionAtt() { |
|||
var key = $("[name='guid']").val(); |
|||
|
|||
$.getJSON(prefix + "/queryFiles/" + key, function (result) { |
|||
if (result.data != null) { |
|||
$("#fileIn").hide(); |
|||
$("#fileOut").show(); |
|||
// 重置文件预览框 |
|||
$("#fileOut").html("<div class=\"file-loading\"><input id=\"fileOutput\" name=\"file\" type=\"file\" multiple></div>"); |
|||
queryFiles(key); |
|||
isFlieIn = false; |
|||
} else { |
|||
$("#fileIn").show(); |
|||
$("#fileOut").hide(); |
|||
uploadFiles(); |
|||
isFlieIn = true; |
|||
$("#fileInput").fileinput('clear') |
|||
} |
|||
}); |
|||
} |
|||
|
|||
/** 预览附件 */ |
|||
function queryFiles(key) { |
|||
$.ajax({ |
|||
type: "POST", |
|||
url: prefix + "/queryFilesPost", |
|||
data: {"key": key}, |
|||
dataType: 'json', |
|||
success: function (result) { |
|||
if (result.success == true) { |
|||
initFile("fileOutput", prefix + "/edit", result.data.filePreview); |
|||
} |
|||
}, |
|||
error: function (error) { |
|||
$.modal.alertWarning("附件预览失败!"); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
/** 上传附件 */ |
|||
function uploadFiles() { |
|||
var filePreview = {fileList: null, previewRespDTOS: null} |
|||
initFile("fileInput", prefix + "/edit", filePreview); |
|||
} |
|||
|
|||
/** 初始化文件 */ |
|||
function initFile(elementId, url, filePreview) { |
|||
var preview = filePreview.previewRespDTOS; |
|||
|
|||
if (preview != null) { |
|||
for (var i = 0; i < preview.length; i++) { |
|||
// 图片删除的地址 |
|||
preview[i].url = prefix + "/removeFile" |
|||
} |
|||
} |
|||
|
|||
$("#" + elementId).fileinput({ |
|||
'theme': 'explorer', |
|||
initialPreviewAsData: true, |
|||
dropZoneEnabled: true, |
|||
dropZoneTitle: "上传图片或视频", |
|||
uploadUrl: url, |
|||
uploadAsync: false,//异步上传 |
|||
enctype: 'multipart/form-data', |
|||
showClose: false, |
|||
showPreview: true, |
|||
showUpload: false, |
|||
uploadExtraData: function () { |
|||
var formData = $("#form-manage-detail").serialize(); |
|||
formData = decodeURIComponent(formData, true); |
|||
var arr = formData.split("&"); |
|||
var data = {}; |
|||
for (var i = 0; i < arr.length; i++) { |
|||
var item = arr[i].split('='); |
|||
var value = item[1].replace("+", " "); |
|||
data[item[0]] = value; |
|||
} |
|||
return data; |
|||
}, |
|||
// showBrowse: false, |
|||
previewFileIcon: '<i class="fas fa-file"></i>', |
|||
preferIconicPreview: true, |
|||
previewFileIconSettings: { // configure your icon file extensions |
|||
'doc': '<i class="fa fa-file-word-o text-primary"></i>', |
|||
'xls': '<i class="fa fa-file-excel-o text-success"></i>', |
|||
'ppt': '<i class="fa fa-file-powerpoint-o text-danger"></i>', |
|||
'pdf': '<i class="fa fa-file-pdf-o text-danger"></i>', |
|||
'txt': '<i class="fa fa-file-text-o text-info"></i>', |
|||
'zip': '<i class="fa fa-file-archive-o text-muted"></i>', |
|||
'htm': '<i class="fa fa-file-code-o text-info"></i>', |
|||
'mov': '<i class="fa fa-file-movie-o text-warning"></i>', |
|||
'mp3': '<i class="fa fa-file-audio-o text-warning"></i>' |
|||
}, |
|||
previewFileExtSettings: { |
|||
'doc': function (ext) { |
|||
return ext.match(/(doc|docx)$/i); |
|||
}, |
|||
'xls': function (ext) { |
|||
return ext.match(/(xls|xlsx)$/i); |
|||
}, |
|||
'ppt': function (ext) { |
|||
return ext.match(/(ppt|pptx)$/i); |
|||
}, |
|||
'zip': function (ext) { |
|||
return ext.match(/(zip|rar|tar|gzip|gz|7z)$/i); |
|||
}, |
|||
'htm': function (ext) { |
|||
return ext.match(/(htm|html)$/i); |
|||
}, |
|||
'mov': function (ext) { |
|||
return ext.match(/(avi|mpg|mkv|mov|mp4|3gp|webm|wmv)$/i); |
|||
}, |
|||
'mp3': function (ext) { |
|||
return ext.match(/(mp3|wav)$/i); |
|||
}, |
|||
'txt': function (ext) { |
|||
return ext.match(/(txt|ini|csv|java|php|js|css)$/i); |
|||
} |
|||
}, |
|||
layoutTemplates: { |
|||
actionDelete: '',//去掉删除按钮 |
|||
actionUpload: '' // 去掉上传按钮 |
|||
}, |
|||
initialPreview: filePreview.fileList == null ? [] : filePreview.fileList, |
|||
initialPreviewConfig: preview == null ? [] : preview |
|||
}); |
|||
|
|||
// 同步上传成功回调 |
|||
$("#fileInput").on("filebatchuploadsuccess", function (event, data, previewId, index) { |
|||
fileUploadCallBack(data.response); |
|||
}) |
|||
// 同步上传成功回调 |
|||
$("#fileOutput").on("filebatchuploadsuccess", function (event, data, previewId, index) { |
|||
fileUploadCallBack(data.response); |
|||
}) |
|||
}; |
|||
|
|||
function fileUploadCallBack(result) { |
|||
var parent = window.parent; |
|||
if (result.success) { |
|||
parent.$.modal.msgSuccess(result.message); |
|||
} else { |
|||
$.modal.alertError(result.message); |
|||
} |
|||
$.modal.close(); |
|||
parent.$.table.refresh(); |
|||
} |
|||
</script> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,233 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > |
|||
<head> |
|||
<th:block th:include="zdxtInclude :: header('编辑')" /> |
|||
<th:block th:include="zdxtInclude :: bootstrap-fileinput-css"/> |
|||
</head> |
|||
<body class="white-bg"> |
|||
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
|||
<form class="form-horizontal m" id="form-tab-edit" th:object="${sceneTab}"> |
|||
<input name="guid" th:field="*{guid}" type="hidden"> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">名称:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="title" th:field="*{title}" class="form-control" type="text"> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label is-required">跳转的页面:</label> |
|||
<div class="col-sm-8"> |
|||
<select name="pagePath" class="form-control" th:field="*{pagePath}"> |
|||
<option value="pages/index/index">首页</option> |
|||
<option value="pages/scan/scan">扫一扫</option> |
|||
<option value="pages/knowledge/knowledge">我的</option> |
|||
<option value="pages/my/my">动态</option> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label is-required" >选中时颜色:</label> |
|||
<div class="col-sm-8"> |
|||
<input class="form-control" type="text" name="selectedColor"th:field="*{selectedColor}" required> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">是否隐藏:</label> |
|||
<div class="col-sm-8"> |
|||
<select name="hide" class="form-control" th:field="*{hide}"> |
|||
<option value="1">否</option> |
|||
<option value="0">是</option> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
<div class="form-group" id="fileTitle"> |
|||
<label class="col-sm-3 control-label">图标:</label> |
|||
<div id="fileIn" class="col-sm-8" readonly> |
|||
<div class="file-loading"> |
|||
<input id="fileInput" name="file" type="file" multiple> |
|||
</div> |
|||
</div> |
|||
<div id="fileOut" class="col-sm-8" style="display: none" readonly> |
|||
<div class="file-loading"> |
|||
<input id="fileOutput" name="file" type="file" multiple> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
<th:block th:include="zdxtInclude :: footer" /> |
|||
<th:block th:include="zdxtInclude :: bootstrap-fileinput-js"/> |
|||
<script type="text/javascript" th:inline="javascript"> |
|||
var prefix = ctx + "small/project/tab" |
|||
$("#form-tab-edit").validate({ |
|||
focusCleanup: true |
|||
}); |
|||
|
|||
var isFlieIn = true; |
|||
|
|||
$(function() { |
|||
// 渲染要素信息 |
|||
renderVersionAtt(); |
|||
}) |
|||
|
|||
function submitHandler() { |
|||
if (isFlieIn) { |
|||
$('#fileInput').fileinput('upload'); |
|||
} else { |
|||
$('#fileOutput').fileinput('upload'); |
|||
} |
|||
} |
|||
/** 附件相关 */ |
|||
|
|||
/** 渲染附件信息 */ |
|||
function renderVersionAtt() { |
|||
var key = $("[name='guid']").val(); |
|||
|
|||
$.getJSON(prefix + "/queryFiles/" + key, function (result) { |
|||
if (result.data != null) { |
|||
$("#fileIn").hide(); |
|||
$("#fileOut").show(); |
|||
// 重置文件预览框 |
|||
$("#fileOut").html("<div class=\"file-loading\"><input id=\"fileOutput\" name=\"file\" type=\"file\" multiple></div>"); |
|||
queryFiles(key); |
|||
isFlieIn = false; |
|||
} else { |
|||
$("#fileIn").show(); |
|||
$("#fileOut").hide(); |
|||
uploadFiles(); |
|||
isFlieIn = true; |
|||
$("#fileInput").fileinput('clear') |
|||
} |
|||
}); |
|||
} |
|||
|
|||
/** 预览附件 */ |
|||
function queryFiles(key) { |
|||
$.ajax({ |
|||
type: "POST", |
|||
url: prefix + "/queryFilesPost", |
|||
data: {"key": key}, |
|||
dataType: 'json', |
|||
success: function (result) { |
|||
if (result.success == true) { |
|||
initFile("fileOutput", prefix + "/edit", result.data.filePreview); |
|||
} |
|||
}, |
|||
error: function (error) { |
|||
$.modal.alertWarning("附件预览失败!"); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
/** 上传附件 */ |
|||
function uploadFiles() { |
|||
var filePreview = { fileList: null, previewRespDTOS: null } |
|||
initFile("fileInput", prefix + "/edit", filePreview); |
|||
} |
|||
|
|||
/** 初始化文件 */ |
|||
function initFile(elementId, url, filePreview) { |
|||
var preview = filePreview.previewRespDTOS; |
|||
|
|||
if (preview != null) { |
|||
for (var i = 0; i < preview.length; i++) { |
|||
// 图片删除的地址 |
|||
preview[i].url = prefix + "/removeFile" |
|||
} |
|||
} |
|||
|
|||
$("#" + elementId).fileinput({ |
|||
'theme': 'explorer', |
|||
initialPreviewAsData: true, |
|||
dropZoneEnabled: true, |
|||
dropZoneTitle: "上传图片或视频", |
|||
uploadUrl: url, |
|||
uploadAsync: false,//异步上传 |
|||
enctype: 'multipart/form-data', |
|||
showClose: false, |
|||
showPreview: true, |
|||
showUpload: false, |
|||
uploadExtraData: function () { |
|||
var formData = $("#form-tab-edit").serialize(); |
|||
formData = decodeURIComponent(formData, true); |
|||
var arr = formData.split("&"); |
|||
var data = {}; |
|||
for (var i=0; i<arr.length; i++) { |
|||
var item = arr[i].split('='); |
|||
var value = item[1].replace("+", " "); |
|||
data[item[0]] = value; |
|||
} |
|||
return data; |
|||
}, |
|||
// showBrowse: false, |
|||
previewFileIcon: '<i class="fas fa-file"></i>', |
|||
preferIconicPreview: true, |
|||
previewFileIconSettings: { // configure your icon file extensions |
|||
'doc': '<i class="fa fa-file-word-o text-primary"></i>', |
|||
'xls': '<i class="fa fa-file-excel-o text-success"></i>', |
|||
'ppt': '<i class="fa fa-file-powerpoint-o text-danger"></i>', |
|||
'pdf': '<i class="fa fa-file-pdf-o text-danger"></i>', |
|||
'txt': '<i class="fa fa-file-text-o text-info"></i>', |
|||
'zip': '<i class="fa fa-file-archive-o text-muted"></i>', |
|||
'htm': '<i class="fa fa-file-code-o text-info"></i>', |
|||
'mov': '<i class="fa fa-file-movie-o text-warning"></i>', |
|||
'mp3': '<i class="fa fa-file-audio-o text-warning"></i>' |
|||
}, |
|||
previewFileExtSettings: { |
|||
'doc': function (ext) { |
|||
return ext.match(/(doc|docx)$/i); |
|||
}, |
|||
'xls': function (ext) { |
|||
return ext.match(/(xls|xlsx)$/i); |
|||
}, |
|||
'ppt': function (ext) { |
|||
return ext.match(/(ppt|pptx)$/i); |
|||
}, |
|||
'zip': function (ext) { |
|||
return ext.match(/(zip|rar|tar|gzip|gz|7z)$/i); |
|||
}, |
|||
'htm': function (ext) { |
|||
return ext.match(/(htm|html)$/i); |
|||
}, |
|||
'mov': function (ext) { |
|||
return ext.match(/(avi|mpg|mkv|mov|mp4|3gp|webm|wmv)$/i); |
|||
}, |
|||
'mp3': function (ext) { |
|||
return ext.match(/(mp3|wav)$/i); |
|||
}, |
|||
'txt': function (ext) { |
|||
return ext.match(/(txt|ini|csv|java|php|js|css)$/i); |
|||
} |
|||
}, |
|||
layoutTemplates: { |
|||
// actionDelete: ''//去掉删除按钮 |
|||
actionUpload: '' // 去掉上传按钮 |
|||
}, |
|||
initialPreview: filePreview.fileList == null ? [] : filePreview.fileList, |
|||
initialPreviewConfig: preview == null ? [] : preview |
|||
}); |
|||
|
|||
// 同步上传成功回调 |
|||
$("#fileInput").on("filebatchuploadsuccess", function (event, data, previewId, index) { |
|||
fileUploadCallBack(data.response); |
|||
}) |
|||
// 同步上传成功回调 |
|||
$("#fileOutput").on("filebatchuploadsuccess", function (event, data, previewId, index) { |
|||
fileUploadCallBack(data.response); |
|||
}) |
|||
}; |
|||
|
|||
function fileUploadCallBack(result) { |
|||
var parent = window.parent; |
|||
if (result.success) { |
|||
parent.$.modal.msgSuccess(result.message); |
|||
} else { |
|||
$.modal.alertError(result.message); |
|||
} |
|||
$.modal.close(); |
|||
parent.$.table.refresh(); |
|||
} |
|||
|
|||
</script> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,201 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > |
|||
<head> |
|||
<th:block th:include="zdxtInclude :: header('编辑')" /> |
|||
<th:block th:include="zdxtInclude :: bootstrap-fileinput-css"/> |
|||
</head> |
|||
<body class="white-bg"> |
|||
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
|||
<form class="form-horizontal m" id="form-tab-edit" th:object="${sceneTab}"> |
|||
<input name="guid" th:field="*{guid}" type="hidden"> |
|||
<div class="form-group" id="fileTitle"> |
|||
<label class="col-sm-3 control-label">选中时图标:</label> |
|||
<div id="fileIn" class="col-sm-8" readonly> |
|||
<div class="file-loading"> |
|||
<input id="fileInput" name="file" type="file" multiple> |
|||
</div> |
|||
</div> |
|||
<div id="fileOut" class="col-sm-8" style="display: none" readonly> |
|||
<div class="file-loading"> |
|||
<input id="fileOutput" name="file" type="file" multiple> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
<th:block th:include="zdxtInclude :: footer" /> |
|||
<th:block th:include="zdxtInclude :: bootstrap-fileinput-js"/> |
|||
<script type="text/javascript" th:inline="javascript"> |
|||
var prefix = ctx + "small/project/tab" |
|||
$("#form-tab-edit").validate({ |
|||
focusCleanup: true |
|||
}); |
|||
|
|||
var isFlieIn = true; |
|||
|
|||
$(function() { |
|||
// 渲染要素信息 |
|||
renderVersionAtt(); |
|||
}) |
|||
|
|||
function submitHandler() { |
|||
if (isFlieIn) { |
|||
$('#fileInput').fileinput('upload'); |
|||
} else { |
|||
$('#fileOutput').fileinput('upload'); |
|||
} |
|||
} |
|||
/** 附件相关 */ |
|||
|
|||
/** 渲染附件信息 */ |
|||
function renderVersionAtt() { |
|||
var key = $("[name='guid']").val() + "0000"; |
|||
|
|||
$.getJSON(prefix + "/queryFiles/" + key, function (result) { |
|||
if (result.data != null) { |
|||
$("#fileIn").hide(); |
|||
$("#fileOut").show(); |
|||
// 重置文件预览框 |
|||
$("#fileOut").html("<div class=\"file-loading\"><input id=\"fileOutput\" name=\"file\" type=\"file\" multiple></div>"); |
|||
queryFiles(key); |
|||
isFlieIn = false; |
|||
} else { |
|||
$("#fileIn").show(); |
|||
$("#fileOut").hide(); |
|||
uploadFiles(); |
|||
isFlieIn = true; |
|||
$("#fileInput").fileinput('clear') |
|||
} |
|||
}); |
|||
} |
|||
|
|||
/** 预览附件 */ |
|||
function queryFiles(key) { |
|||
$.ajax({ |
|||
type: "POST", |
|||
url: prefix + "/queryFilesPost", |
|||
data: {"key": key}, |
|||
dataType: 'json', |
|||
success: function (result) { |
|||
if (result.success == true) { |
|||
initFile("fileOutput", prefix + "/selected", result.data.filePreview); |
|||
} |
|||
}, |
|||
error: function (error) { |
|||
$.modal.alertWarning("附件预览失败!"); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
/** 上传附件 */ |
|||
function uploadFiles() { |
|||
var filePreview = { fileList: null, previewRespDTOS: null } |
|||
initFile("fileInput", prefix + "/selected", filePreview); |
|||
} |
|||
|
|||
/** 初始化文件 */ |
|||
function initFile(elementId, url, filePreview) { |
|||
var preview = filePreview.previewRespDTOS; |
|||
|
|||
if (preview != null) { |
|||
for (var i = 0; i < preview.length; i++) { |
|||
// 图片删除的地址 |
|||
preview[i].url = prefix + "/removeFile" |
|||
} |
|||
} |
|||
|
|||
$("#" + elementId).fileinput({ |
|||
'theme': 'explorer', |
|||
initialPreviewAsData: true, |
|||
dropZoneEnabled: true, |
|||
dropZoneTitle: "上传图片或视频", |
|||
uploadUrl: url, |
|||
uploadAsync: false,//异步上传 |
|||
enctype: 'multipart/form-data', |
|||
showClose: false, |
|||
showPreview: true, |
|||
showUpload: false, |
|||
uploadExtraData: function () { |
|||
var formData = $("#form-tab-edit").serialize(); |
|||
formData = decodeURIComponent(formData, true); |
|||
var arr = formData.split("&"); |
|||
var data = {}; |
|||
for (var i=0; i<arr.length; i++) { |
|||
var item = arr[i].split('='); |
|||
var value = item[1].replace("+", " "); |
|||
data[item[0]] = value; |
|||
} |
|||
return data; |
|||
}, |
|||
// showBrowse: false, |
|||
previewFileIcon: '<i class="fas fa-file"></i>', |
|||
preferIconicPreview: true, |
|||
previewFileIconSettings: { // configure your icon file extensions |
|||
'doc': '<i class="fa fa-file-word-o text-primary"></i>', |
|||
'xls': '<i class="fa fa-file-excel-o text-success"></i>', |
|||
'ppt': '<i class="fa fa-file-powerpoint-o text-danger"></i>', |
|||
'pdf': '<i class="fa fa-file-pdf-o text-danger"></i>', |
|||
'txt': '<i class="fa fa-file-text-o text-info"></i>', |
|||
'zip': '<i class="fa fa-file-archive-o text-muted"></i>', |
|||
'htm': '<i class="fa fa-file-code-o text-info"></i>', |
|||
'mov': '<i class="fa fa-file-movie-o text-warning"></i>', |
|||
'mp3': '<i class="fa fa-file-audio-o text-warning"></i>' |
|||
}, |
|||
previewFileExtSettings: { |
|||
'doc': function (ext) { |
|||
return ext.match(/(doc|docx)$/i); |
|||
}, |
|||
'xls': function (ext) { |
|||
return ext.match(/(xls|xlsx)$/i); |
|||
}, |
|||
'ppt': function (ext) { |
|||
return ext.match(/(ppt|pptx)$/i); |
|||
}, |
|||
'zip': function (ext) { |
|||
return ext.match(/(zip|rar|tar|gzip|gz|7z)$/i); |
|||
}, |
|||
'htm': function (ext) { |
|||
return ext.match(/(htm|html)$/i); |
|||
}, |
|||
'mov': function (ext) { |
|||
return ext.match(/(avi|mpg|mkv|mov|mp4|3gp|webm|wmv)$/i); |
|||
}, |
|||
'mp3': function (ext) { |
|||
return ext.match(/(mp3|wav)$/i); |
|||
}, |
|||
'txt': function (ext) { |
|||
return ext.match(/(txt|ini|csv|java|php|js|css)$/i); |
|||
} |
|||
}, |
|||
layoutTemplates: { |
|||
// actionDelete: ''//去掉删除按钮 |
|||
actionUpload: '' // 去掉上传按钮 |
|||
}, |
|||
initialPreview: filePreview.fileList == null ? [] : filePreview.fileList, |
|||
initialPreviewConfig: preview == null ? [] : preview |
|||
}); |
|||
|
|||
// 同步上传成功回调 |
|||
$("#fileInput").on("filebatchuploadsuccess", function (event, data, previewId, index) { |
|||
fileUploadCallBack(data.response); |
|||
}) |
|||
// 同步上传成功回调 |
|||
$("#fileOutput").on("filebatchuploadsuccess", function (event, data, previewId, index) { |
|||
fileUploadCallBack(data.response); |
|||
}) |
|||
}; |
|||
|
|||
function fileUploadCallBack(result) { |
|||
var parent = window.parent; |
|||
if (result.success) { |
|||
parent.$.modal.msgSuccess(result.message); |
|||
} else { |
|||
$.modal.alertError(result.message); |
|||
} |
|||
$.modal.close(); |
|||
parent.$.table.refresh(); |
|||
} |
|||
|
|||
</script> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,148 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> |
|||
<head> |
|||
<th:block th:include="zdxtInclude :: header('tabbar配置')"/> |
|||
</head> |
|||
<body class="gray-bg"> |
|||
<div class="container-div"> |
|||
<div class="row"> |
|||
<div class="col-sm-12 search-collapse"> |
|||
<form id="formId"> |
|||
<div class="select-list"> |
|||
<ul> |
|||
<li> |
|||
<p>名称:</p> |
|||
<input type="text" name="title"/> |
|||
</li> |
|||
<li> |
|||
<a class="btn btn-success btn-rounded btn-sm" onclick="$.table.search()"><i |
|||
class="fa fa-search"></i> 搜索</a> |
|||
<a class="btn btn-reset btn-rounded btn-sm" onclick="reset()"><i |
|||
class="fa fa-refresh"></i> 重置</a> |
|||
</li> |
|||
</ul> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
|
|||
<div class="btn-group-sm" id="toolbar" role="group"> |
|||
<a class="btn btn-success" onclick="add()" shiro:hasPermission="system:tab:add"> |
|||
<i class="fa fa-plus"></i> 新增 |
|||
</a> |
|||
</div> |
|||
<div class="col-sm-12 select-table table-striped"> |
|||
<table id="bootstrap-table"></table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<th:block th:include="zdxtInclude :: footer"/> |
|||
<script th:inline="javascript"> |
|||
var editFlag = [[${@permission.hasPermi('project:tab:edit')}]]; |
|||
var removeFlag = [[${@permission.hasPermi('project:tab:remove')}]]; |
|||
var detailFlag = [[${@permission.hasPermi('project:tab:detail')}]]; |
|||
var prefix = ctx + "small/project/tab"; |
|||
|
|||
$(function () { |
|||
var options = { |
|||
url: prefix + "/list", |
|||
createUrl: prefix + "/add/{}", |
|||
updateUrl: prefix + "/edit/{id}", |
|||
removeUrl: prefix + "/remove", |
|||
exportUrl: prefix + "/export", |
|||
detailUrl: prefix + "/detail/{guid}", |
|||
modalName: "主页", |
|||
columns: [{ |
|||
checkbox: true |
|||
}, |
|||
{ |
|||
field: 'title', |
|||
title: '名称' |
|||
}, |
|||
{ |
|||
field: 'pagePath', |
|||
title: '跳转页面' |
|||
}, |
|||
{ |
|||
field: 'selectedColor', |
|||
title: '选中颜色' |
|||
}, |
|||
{ |
|||
field: 'hide', |
|||
title: '隐藏', |
|||
formatter: function (value, index) { |
|||
return value === 0 ? "是" : "否"; |
|||
} |
|||
}, |
|||
{ |
|||
field: 'creator', |
|||
title: '创建人' |
|||
}, |
|||
{ |
|||
field: 'createTime', |
|||
title: '创建时间' |
|||
}, |
|||
{ |
|||
title: '操作', |
|||
align: 'center', |
|||
formatter: function (value, row, index) { |
|||
var actions = []; |
|||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.guid + '\')"><i class="fa fa-edit"></i>编辑</a> '); |
|||
actions.push('<a class="btn btn-primary btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="detailFull(\'' + row.guid + '\')"><i class="fa fa-eye"></i>查看</a> '); |
|||
actions.push('<a class="btn btn-primary btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="selected(\'' + row.guid + '\')"><i class="fa fa-eye"></i>选中</a> '); |
|||
//actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.guid + '\')"><i class="fa fa-remove"></i>删除</a>'); |
|||
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="sort(\'' + row.guid + '\')"><i class="fa fa-eject"></i>上移</a>'); |
|||
return actions.join(''); |
|||
} |
|||
}] |
|||
}; |
|||
$.table.init(options); |
|||
}); |
|||
|
|||
function detail(id, width, height) { |
|||
$.modal.open("查看", ctx + "small/project/tab/detail/" + id, width, height); |
|||
} |
|||
|
|||
function add() { |
|||
$.modal.open("新增", ctx + "small/project/tab/add", 800, 450); |
|||
} |
|||
|
|||
function sort(id) { |
|||
$.get(ctx + "small/project/tab/sort/" + id, null, function (res) { |
|||
if (res.success) { |
|||
// |
|||
$.table.refresh(); |
|||
$.modal.alertSuccess(res.message); |
|||
} else { |
|||
$.modal.alertWarning(res.message); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
function detailFull(id) { |
|||
table.set(); |
|||
var url = "/404.html"; |
|||
if ($.common.isNotEmpty(id)) { |
|||
url = table.options.detailUrl.replace("{guid}", id); |
|||
} else { |
|||
var row = $.common.isEmpty(table.options.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns(table.options.uniqueId); |
|||
url = table.options.detailUrl.replace("{guid}", row); |
|||
} |
|||
$.modal.openFull("详情", url); |
|||
} |
|||
|
|||
function selected(id) { |
|||
var selectedUrl = prefix + "/selected/{guid}"; |
|||
var url = "/404.html"; |
|||
if ($.common.isNotEmpty(id)) { |
|||
url = selectedUrl.replace("{guid}", id); |
|||
} |
|||
$.modal.open("编辑", url); |
|||
} |
|||
|
|||
function reset() { |
|||
$("[name='name']").val(""); |
|||
$.table.search() |
|||
} |
|||
</script> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,168 @@ |
|||
package com.zdxt.knowledge.controller; |
|||
|
|||
import com.zdxt.common.ZDResponse; |
|||
import com.zdxt.common.controller.BaseController; |
|||
import com.zdxt.common.util.TableDataInfo; |
|||
import com.zdxt.knowledge.domain.SceneMedal; |
|||
import com.zdxt.knowledge.service.ISceneMedalService; |
|||
import org.apache.shiro.authz.annotation.RequiresPermissions; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Controller; |
|||
import org.springframework.ui.ModelMap; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
|
|||
|
|||
/** |
|||
* 【请填写功能名称】Controller |
|||
* |
|||
* @author ruoyi |
|||
* @date 2023-01-22 |
|||
*/ |
|||
@Controller |
|||
@RequestMapping("/small/project/medal") |
|||
public class SceneMedalController extends BaseController { |
|||
private String prefix = "project/medal"; |
|||
|
|||
@Autowired |
|||
private ISceneMedalService sceneMedalService; |
|||
|
|||
@RequiresPermissions("project:medal:view") |
|||
@GetMapping("/view") |
|||
public String manage() { |
|||
return prefix + "/view"; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 查询 |
|||
*/ |
|||
@RequiresPermissions("project:medal:list") |
|||
@PostMapping("/list") |
|||
@ResponseBody |
|||
public TableDataInfo list(SceneMedal sceneMedal) { |
|||
startPage(); |
|||
List<SceneMedal> list = sceneMedalService.selectSceneMedalList(sceneMedal); |
|||
return getDataTable(list); |
|||
} |
|||
|
|||
/** |
|||
* 查询 |
|||
*/ |
|||
@PostMapping("/listAll") |
|||
@ResponseBody |
|||
public ZDResponse listAll(@RequestBody SceneMedal sceneMedal) { |
|||
List<SceneMedal> list = sceneMedalService.selectSceneMedalListAll(sceneMedal); |
|||
return ZDResponse.success("成功", list); |
|||
} |
|||
|
|||
/** |
|||
* 查看详情 |
|||
*/ |
|||
@RequiresPermissions("project:medal:detail") |
|||
@GetMapping("/detail/{guid}") |
|||
public String detail(@PathVariable("guid") String guid, ModelMap mmap) { |
|||
SceneMedal sceneMedal = sceneMedalService.selectSceneMedalById(guid); |
|||
mmap.put("sceneMedal", sceneMedal); |
|||
return prefix + "/detail"; |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
*/ |
|||
@GetMapping("/add") |
|||
public String add() { |
|||
return prefix + "/add"; |
|||
} |
|||
|
|||
/** |
|||
* 新增保存 |
|||
*/ |
|||
@RequiresPermissions("project:medal:add") |
|||
@PostMapping("/add") |
|||
@ResponseBody |
|||
public ZDResponse addSave(@RequestParam("file") MultipartFile[] files, SceneMedal sceneMedal) { |
|||
return sceneMedalService.insertSceneMedal(files, sceneMedal) > 0 |
|||
? ZDResponse.success() : ZDResponse.error("新增失败"); |
|||
} |
|||
|
|||
/** |
|||
* 修改 |
|||
*/ |
|||
@GetMapping("/edit/{guid}") |
|||
public String edit(@PathVariable("guid") String guid, ModelMap mmap) { |
|||
SceneMedal sceneMedal = sceneMedalService.selectSceneMedalById(guid); |
|||
mmap.put("sceneMedal", sceneMedal); |
|||
return prefix + "/edit"; |
|||
} |
|||
|
|||
/** |
|||
* 修改保存 |
|||
*/ |
|||
@RequiresPermissions("project:medal:edit") |
|||
@PostMapping("/edit") |
|||
@ResponseBody |
|||
public ZDResponse editSave(@RequestParam("file") MultipartFile[] files, SceneMedal sceneMedal) { |
|||
return sceneMedalService.updateSceneMedal(files, sceneMedal) > 0 |
|||
? ZDResponse.success() : ZDResponse.error("编辑失败"); |
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
*/ |
|||
@RequiresPermissions("project:medal:remove") |
|||
@PostMapping("/remove") |
|||
@ResponseBody |
|||
public ZDResponse remove(String ids) { |
|||
return sceneMedalService.deleteSceneMedalByIds(ids) > 0 |
|||
? ZDResponse.success() : ZDResponse.error("删除失败"); |
|||
} |
|||
|
|||
/** |
|||
* 查询附件信息 |
|||
* |
|||
* @param key |
|||
* @return |
|||
*/ |
|||
@GetMapping("/queryFiles/{key}") |
|||
@ResponseBody |
|||
public ZDResponse queryFiles(@PathVariable String key) { |
|||
HashMap<String, Object> map = new HashMap<>(); |
|||
map.put("filePreview", sceneMedalService.queryFiles(key)); |
|||
return ZDResponse.success("获取成功", map); |
|||
} |
|||
|
|||
/** |
|||
* 查询附件信息 |
|||
* |
|||
* @param key |
|||
* @return |
|||
*/ |
|||
@PostMapping("/queryFilesPost") |
|||
@ResponseBody |
|||
public ZDResponse queryFilesPost(String key) { |
|||
HashMap<String, Object> map = new HashMap<>(); |
|||
map.put("filePreview", sceneMedalService.queryFiles(key)); |
|||
return ZDResponse.success("获取成功", map); |
|||
} |
|||
|
|||
/** |
|||
* 删除案例要素附件 |
|||
* |
|||
* @param key |
|||
* @return |
|||
*/ |
|||
@PostMapping("/removeFile") |
|||
@ResponseBody |
|||
public ZDResponse removeFile(String key) { |
|||
if (sceneMedalService.removeFile(key) > 0) { |
|||
return ZDResponse.success("操作成功"); |
|||
} else { |
|||
return ZDResponse.error("操作失败"); |
|||
} |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,199 @@ |
|||
package com.zdxt.knowledge.controller; |
|||
|
|||
import com.zdxt.common.ZDResponse; |
|||
import com.zdxt.common.controller.BaseController; |
|||
import com.zdxt.common.util.TableDataInfo; |
|||
import com.zdxt.knowledge.domain.SceneTab; |
|||
import com.zdxt.knowledge.service.ISceneTabService; |
|||
import org.apache.shiro.authz.annotation.RequiresPermissions; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Controller; |
|||
import org.springframework.ui.ModelMap; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
|
|||
|
|||
/** |
|||
* 【请填写功能名称】Controller |
|||
* |
|||
* @author ruoyi |
|||
* @date 2023-01-22 |
|||
*/ |
|||
@Controller |
|||
@RequestMapping("/small/project/tab") |
|||
public class SceneTabController extends BaseController { |
|||
private String prefix = "project/tab"; |
|||
|
|||
@Autowired |
|||
private ISceneTabService sceneTabService; |
|||
|
|||
@RequiresPermissions("project:tab:view") |
|||
@GetMapping("/view") |
|||
public String manage() { |
|||
return prefix + "/view"; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 查询 |
|||
*/ |
|||
@RequiresPermissions("project:tab:list") |
|||
@PostMapping("/list") |
|||
@ResponseBody |
|||
public TableDataInfo list(SceneTab sceneTab) { |
|||
startPage(); |
|||
List<SceneTab> list = sceneTabService.selectSceneTabList(sceneTab); |
|||
return getDataTable(list); |
|||
} |
|||
|
|||
/** |
|||
* 查询 |
|||
*/ |
|||
@PostMapping("/listAll") |
|||
@ResponseBody |
|||
public ZDResponse listAll(@RequestBody SceneTab sceneTab) { |
|||
List<SceneTab> list = sceneTabService.selectSceneTabListAll(sceneTab); |
|||
return ZDResponse.success("成功", list); |
|||
} |
|||
|
|||
/** |
|||
* 查看详情 |
|||
*/ |
|||
@RequiresPermissions("project:tab:detail") |
|||
@GetMapping("/detail/{guid}") |
|||
public String detail(@PathVariable("guid") String guid, ModelMap mmap) { |
|||
SceneTab sceneTab = sceneTabService.selectSceneTabById(guid); |
|||
mmap.put("sceneTab", sceneTab); |
|||
return prefix + "/detail"; |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
*/ |
|||
@GetMapping("/add") |
|||
public String add() { |
|||
return prefix + "/add"; |
|||
} |
|||
|
|||
/** |
|||
* 新增保存 |
|||
*/ |
|||
@RequiresPermissions("project:tab:add") |
|||
@PostMapping("/add") |
|||
@ResponseBody |
|||
public ZDResponse addSave(@RequestParam("file") MultipartFile[] files, SceneTab sceneTab) { |
|||
return sceneTabService.insertSceneTab(files, sceneTab) > 0 |
|||
? ZDResponse.success() : ZDResponse.error("新增失败"); |
|||
} |
|||
|
|||
/** |
|||
* 修改 |
|||
*/ |
|||
@GetMapping("/edit/{guid}") |
|||
public String edit(@PathVariable("guid") String guid, ModelMap mmap) { |
|||
SceneTab sceneTab = sceneTabService.selectSceneTabById(guid); |
|||
mmap.put("sceneTab", sceneTab); |
|||
return prefix + "/edit"; |
|||
} |
|||
|
|||
/** |
|||
* 选中 |
|||
*/ |
|||
@GetMapping("/selected/{guid}") |
|||
public String selected(@PathVariable("guid") String guid, ModelMap mmap) { |
|||
SceneTab sceneTab = sceneTabService.selectSceneTabById(guid); |
|||
mmap.put("sceneTab", sceneTab); |
|||
return prefix + "/selected"; |
|||
} |
|||
|
|||
/** |
|||
* 修改保存 |
|||
*/ |
|||
@RequiresPermissions("project:tab:edit") |
|||
@PostMapping("/selected") |
|||
@ResponseBody |
|||
public ZDResponse selectedSave(@RequestParam("file") MultipartFile[] files, SceneTab sceneTab) { |
|||
return sceneTabService.selected(files, sceneTab) > 0 |
|||
? ZDResponse.success() : ZDResponse.error("编辑失败"); |
|||
} |
|||
|
|||
/** |
|||
* 修改保存 |
|||
*/ |
|||
@RequiresPermissions("project:tab:edit") |
|||
@PostMapping("/edit") |
|||
@ResponseBody |
|||
public ZDResponse editSave(@RequestParam("file") MultipartFile[] files, SceneTab sceneTab) { |
|||
return sceneTabService.updateSceneTab(files, sceneTab) > 0 |
|||
? ZDResponse.success() : ZDResponse.error("编辑失败"); |
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
*/ |
|||
@RequiresPermissions("project:tab:remove") |
|||
@PostMapping("/remove") |
|||
@ResponseBody |
|||
public ZDResponse remove(String ids) { |
|||
return sceneTabService.deleteSceneTabByIds(ids) > 0 |
|||
? ZDResponse.success() : ZDResponse.error("删除失败"); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 排序上移 |
|||
*/ |
|||
@GetMapping("/sort/{guid}") |
|||
@ResponseBody |
|||
public ZDResponse sort(@PathVariable("guid") String guid) { |
|||
return sceneTabService.sort(guid); |
|||
} |
|||
|
|||
/** |
|||
* 查询附件信息 |
|||
* |
|||
* @param key |
|||
* @return |
|||
*/ |
|||
@GetMapping("/queryFiles/{key}") |
|||
@ResponseBody |
|||
public ZDResponse queryFiles(@PathVariable String key) { |
|||
HashMap<String, Object> map = new HashMap<>(); |
|||
map.put("filePreview", sceneTabService.queryFiles(key)); |
|||
return ZDResponse.success("获取成功", map); |
|||
} |
|||
|
|||
/** |
|||
* 查询附件信息 |
|||
* |
|||
* @param key |
|||
* @return |
|||
*/ |
|||
@PostMapping("/queryFilesPost") |
|||
@ResponseBody |
|||
public ZDResponse queryFilesPost(String key) { |
|||
HashMap<String, Object> map = new HashMap<>(); |
|||
map.put("filePreview", sceneTabService.queryFiles(key)); |
|||
return ZDResponse.success("获取成功", map); |
|||
} |
|||
|
|||
/** |
|||
* 删除案例要素附件 |
|||
* |
|||
* @param key |
|||
* @return |
|||
*/ |
|||
@PostMapping("/removeFile") |
|||
@ResponseBody |
|||
public ZDResponse removeFile(String key) { |
|||
if (sceneTabService.removeFile(key) > 0) { |
|||
return ZDResponse.success("操作成功"); |
|||
} else { |
|||
return ZDResponse.error("操作失败"); |
|||
} |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,128 @@ |
|||
package com.zdxt.knowledge.domain; |
|||
|
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 场景题目对象 scene_medal |
|||
* |
|||
* @author ruoyi |
|||
* @date 2023-12-26 |
|||
*/ |
|||
public class SceneMedal implements Serializable { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String guid; |
|||
|
|||
/** |
|||
* 名称 |
|||
*/ |
|||
private String name; |
|||
|
|||
/** |
|||
* 默认图标 |
|||
*/ |
|||
private String iconPath; |
|||
|
|||
/** |
|||
* 获取时展示的图标 |
|||
*/ |
|||
private String earnIconPath; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String creator; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
private Date createTime; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String updateBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
private Date updateTime; |
|||
|
|||
/** |
|||
* 请求参数 |
|||
*/ |
|||
private Map<String, Object> params; |
|||
|
|||
public String getGuid() { |
|||
return guid; |
|||
} |
|||
|
|||
public void setGuid(String guid) { |
|||
this.guid = guid; |
|||
} |
|||
|
|||
public String getName() { |
|||
return name; |
|||
} |
|||
|
|||
public void setName(String name) { |
|||
this.name = name; |
|||
} |
|||
|
|||
public String getIconPath() { |
|||
return iconPath; |
|||
} |
|||
|
|||
public void setIconPath(String iconPath) { |
|||
this.iconPath = iconPath; |
|||
} |
|||
|
|||
public String getEarnIconPath() { |
|||
return earnIconPath; |
|||
} |
|||
|
|||
public void setEarnIconPath(String earnIconPath) { |
|||
this.earnIconPath = earnIconPath; |
|||
} |
|||
|
|||
public String getCreator() { |
|||
return creator; |
|||
} |
|||
|
|||
public void setCreator(String creator) { |
|||
this.creator = creator; |
|||
} |
|||
|
|||
public Date getCreateTime() { |
|||
return createTime; |
|||
} |
|||
|
|||
public void setCreateTime(Date createTime) { |
|||
this.createTime = createTime; |
|||
} |
|||
|
|||
public String getUpdateBy() { |
|||
return updateBy; |
|||
} |
|||
|
|||
public void setUpdateBy(String updateBy) { |
|||
this.updateBy = updateBy; |
|||
} |
|||
|
|||
public Date getUpdateTime() { |
|||
return updateTime; |
|||
} |
|||
|
|||
public void setUpdateTime(Date updateTime) { |
|||
this.updateTime = updateTime; |
|||
} |
|||
} |
|||
@ -0,0 +1,201 @@ |
|||
package com.zdxt.knowledge.domain; |
|||
|
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 场景题目对象 scene_tab |
|||
* |
|||
* @author ruoyi |
|||
* @date 2023-12-26 |
|||
*/ |
|||
public class SceneTab implements Serializable { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String guid; |
|||
|
|||
/** |
|||
* 名称 |
|||
*/ |
|||
private String title; |
|||
|
|||
/** |
|||
* 跳转页面 |
|||
*/ |
|||
private String pagePath; |
|||
|
|||
/** |
|||
* 选中时的颜色 |
|||
*/ |
|||
private String selectedColor; |
|||
|
|||
/** |
|||
* 默认图标 |
|||
*/ |
|||
private String iconPath; |
|||
|
|||
/** |
|||
* 选中时展示的图标 |
|||
*/ |
|||
private String selectedIconPath; |
|||
|
|||
/** |
|||
* 类型 |
|||
*/ |
|||
private String type; |
|||
|
|||
/** |
|||
* 隐藏0是1否 |
|||
*/ |
|||
private Integer hide; |
|||
|
|||
/** |
|||
* 排序 |
|||
*/ |
|||
private Integer sort; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String creator; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
private Date createTime; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String updateBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
private Date updateTime; |
|||
|
|||
/** |
|||
* 请求参数 |
|||
*/ |
|||
private Map<String, Object> params; |
|||
|
|||
public String getTitle() { |
|||
return title; |
|||
} |
|||
|
|||
public void setTitle(String title) { |
|||
this.title = title; |
|||
} |
|||
|
|||
public String getPagePath() { |
|||
return pagePath; |
|||
} |
|||
|
|||
public void setPagePath(String pagePath) { |
|||
this.pagePath = pagePath; |
|||
} |
|||
|
|||
public String getSelectedColor() { |
|||
return selectedColor; |
|||
} |
|||
|
|||
public void setSelectedColor(String selectedColor) { |
|||
this.selectedColor = selectedColor; |
|||
} |
|||
|
|||
public String getIconPath() { |
|||
return iconPath; |
|||
} |
|||
|
|||
public void setIconPath(String iconPath) { |
|||
this.iconPath = iconPath; |
|||
} |
|||
|
|||
public String getSelectedIconPath() { |
|||
return selectedIconPath; |
|||
} |
|||
|
|||
public void setSelectedIconPath(String selectedIconPath) { |
|||
this.selectedIconPath = selectedIconPath; |
|||
} |
|||
|
|||
public String getType() { |
|||
return type; |
|||
} |
|||
|
|||
public void setType(String type) { |
|||
this.type = type; |
|||
} |
|||
|
|||
public Integer getHide() { |
|||
return hide; |
|||
} |
|||
|
|||
public void setHide(Integer hide) { |
|||
this.hide = hide; |
|||
} |
|||
|
|||
public String getCreator() { |
|||
return creator; |
|||
} |
|||
|
|||
public void setCreator(String creator) { |
|||
this.creator = creator; |
|||
} |
|||
|
|||
public Date getCreateTime() { |
|||
return createTime; |
|||
} |
|||
|
|||
public void setCreateTime(Date createTime) { |
|||
this.createTime = createTime; |
|||
} |
|||
|
|||
public String getUpdateBy() { |
|||
return updateBy; |
|||
} |
|||
|
|||
public void setUpdateBy(String updateBy) { |
|||
this.updateBy = updateBy; |
|||
} |
|||
|
|||
public Date getUpdateTime() { |
|||
return updateTime; |
|||
} |
|||
|
|||
public void setUpdateTime(Date updateTime) { |
|||
this.updateTime = updateTime; |
|||
} |
|||
|
|||
public Map<String, Object> getParams() { |
|||
return params; |
|||
} |
|||
|
|||
public void setParams(Map<String, Object> params) { |
|||
this.params = params; |
|||
} |
|||
|
|||
public String getGuid() { |
|||
return guid; |
|||
} |
|||
|
|||
public void setGuid(String guid) { |
|||
this.guid = guid; |
|||
} |
|||
|
|||
public Integer getSort() { |
|||
return sort; |
|||
} |
|||
|
|||
public void setSort(Integer sort) { |
|||
this.sort = sort; |
|||
} |
|||
} |
|||
@ -0,0 +1,56 @@ |
|||
package com.zdxt.knowledge.mapper; |
|||
|
|||
import com.zdxt.knowledge.domain.SceneMedal; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* Mapper接口 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2023-12-26 |
|||
*/ |
|||
public interface SceneMedalMapper { |
|||
/** |
|||
* 查询 |
|||
* |
|||
* @param guid ID |
|||
* @return |
|||
*/ |
|||
public SceneMedal selectSceneMedalById(String guid); |
|||
|
|||
/** |
|||
* 查询列表 |
|||
* |
|||
* @param sceneMedal |
|||
* @return 集合 |
|||
*/ |
|||
public List<SceneMedal> selectSceneMedalList(SceneMedal sceneMedal); |
|||
|
|||
public List<SceneMedal> selectSceneMedalListAll(SceneMedal sceneMedal); |
|||
|
|||
/** |
|||
* 新增 |
|||
* |
|||
* @param sceneMedal |
|||
* @return 结果 |
|||
*/ |
|||
public int insertSceneMedal(SceneMedal sceneMedal); |
|||
|
|||
/** |
|||
* 修改 |
|||
* |
|||
* @param sceneMedal |
|||
* @return 结果 |
|||
*/ |
|||
public int updateSceneMedal(SceneMedal sceneMedal); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param guids 需要删除的数据ID |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteSceneMedalByIds(String[] guids); |
|||
|
|||
} |
|||
@ -0,0 +1,63 @@ |
|||
package com.zdxt.knowledge.mapper; |
|||
|
|||
import com.zdxt.knowledge.domain.SceneTab; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* Mapper接口 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2023-12-26 |
|||
*/ |
|||
public interface SceneTabMapper { |
|||
/** |
|||
* 查询 |
|||
* |
|||
* @param guid ID |
|||
* @return |
|||
*/ |
|||
public SceneTab selectSceneTabById(String guid); |
|||
|
|||
/** |
|||
* 查询列表 |
|||
* |
|||
* @param sceneTab |
|||
* @return 集合 |
|||
*/ |
|||
public List<SceneTab> selectSceneTabList(SceneTab sceneTab); |
|||
|
|||
public List<SceneTab> selectSceneTabListAll(SceneTab sceneTab); |
|||
|
|||
/** |
|||
* 新增 |
|||
* |
|||
* @param sceneTab |
|||
* @return 结果 |
|||
*/ |
|||
public int insertSceneTab(SceneTab sceneTab); |
|||
|
|||
/** |
|||
* 修改 |
|||
* |
|||
* @param sceneTab |
|||
* @return 结果 |
|||
*/ |
|||
public int updateSceneTab(SceneTab sceneTab); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param guids 需要删除的数据ID |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteSceneTabByIds(String[] guids); |
|||
|
|||
/** |
|||
* 获取排序【请填写功能名称】 |
|||
* |
|||
* @return 结果 |
|||
*/ |
|||
public SceneTab selectLastSort(Integer sort); |
|||
|
|||
} |
|||
@ -0,0 +1,74 @@ |
|||
package com.zdxt.knowledge.service; |
|||
|
|||
import com.zdxt.common.zdxtFile.AttFileRespDTO; |
|||
import com.zdxt.knowledge.domain.SceneMedal; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* Service接口 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2023-12-26 |
|||
*/ |
|||
public interface ISceneMedalService { |
|||
/** |
|||
* 查询 |
|||
* |
|||
* @param guid ID |
|||
* @return |
|||
*/ |
|||
public SceneMedal selectSceneMedalById(String guid); |
|||
|
|||
/** |
|||
* 查询列表 |
|||
* |
|||
* @param sceneMedal |
|||
* @return 集合 |
|||
*/ |
|||
public List<SceneMedal> selectSceneMedalList(SceneMedal sceneMedal); |
|||
|
|||
public List<SceneMedal> selectSceneMedalListAll(SceneMedal sceneMedal); |
|||
|
|||
/** |
|||
* 新增 |
|||
* |
|||
* @param sceneMedal |
|||
* @return 结果 |
|||
*/ |
|||
public int insertSceneMedal(MultipartFile[] files, SceneMedal sceneMedal); |
|||
|
|||
|
|||
/** |
|||
* 修改 |
|||
* |
|||
* @param sceneMedal |
|||
* @return 结果 |
|||
*/ |
|||
public int updateSceneMedal(MultipartFile[] files, SceneMedal sceneMedal); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param guids 需要删除的数据ID |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteSceneMedalByIds(String guids); |
|||
|
|||
/** |
|||
* 查询附件 |
|||
* |
|||
* @param key |
|||
* @return |
|||
*/ |
|||
AttFileRespDTO queryFiles(String key); |
|||
|
|||
/** |
|||
* 删除案例要素图片 |
|||
* |
|||
* @param key 图片id |
|||
* @return |
|||
*/ |
|||
public int removeFile(String key); |
|||
} |
|||
@ -0,0 +1,90 @@ |
|||
package com.zdxt.knowledge.service; |
|||
|
|||
import com.zdxt.common.ZDResponse; |
|||
import com.zdxt.common.zdxtFile.AttFileRespDTO; |
|||
import com.zdxt.knowledge.domain.SceneTab; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* Service接口 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2023-12-26 |
|||
*/ |
|||
public interface ISceneTabService { |
|||
/** |
|||
* 查询 |
|||
* |
|||
* @param guid ID |
|||
* @return |
|||
*/ |
|||
public SceneTab selectSceneTabById(String guid); |
|||
|
|||
/** |
|||
* 查询列表 |
|||
* |
|||
* @param sceneTab |
|||
* @return 集合 |
|||
*/ |
|||
public List<SceneTab> selectSceneTabList(SceneTab sceneTab); |
|||
|
|||
public List<SceneTab> selectSceneTabListAll(SceneTab sceneTab); |
|||
|
|||
/** |
|||
* 新增 |
|||
* |
|||
* @param sceneTab |
|||
* @return 结果 |
|||
*/ |
|||
public int insertSceneTab(MultipartFile[] files, SceneTab sceneTab); |
|||
|
|||
/** |
|||
* 选中 |
|||
* |
|||
* @param sceneTab |
|||
* @return 结果 |
|||
*/ |
|||
public int selected(MultipartFile[] files, SceneTab sceneTab); |
|||
|
|||
/** |
|||
* 修改 |
|||
* |
|||
* @param sceneTab |
|||
* @return 结果 |
|||
*/ |
|||
public int updateSceneTab(MultipartFile[] files, SceneTab sceneTab); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param guids 需要删除的数据ID |
|||
* @return 结果 |
|||
*/ |
|||
public int deleteSceneTabByIds(String guids); |
|||
|
|||
/** |
|||
* 排序上移【请填写功能名称】 |
|||
* |
|||
* @param guid |
|||
* @return 结果 |
|||
*/ |
|||
public ZDResponse sort(String guid); |
|||
|
|||
/** |
|||
* 查询附件 |
|||
* |
|||
* @param key |
|||
* @return |
|||
*/ |
|||
AttFileRespDTO queryFiles(String key); |
|||
|
|||
/** |
|||
* 删除案例要素图片 |
|||
* |
|||
* @param key 图片id |
|||
* @return |
|||
*/ |
|||
public int removeFile(String key); |
|||
} |
|||
@ -0,0 +1,147 @@ |
|||
package com.zdxt.knowledge.service.impl; |
|||
|
|||
import cn.hutool.core.bean.BeanUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.zdxt.auth.dto.UserBean; |
|||
import com.zdxt.auth.dto.ZdxtFileBean; |
|||
import com.zdxt.auth.feign.FileUploadApi; |
|||
import com.zdxt.auth.feign.UserApi; |
|||
import com.zdxt.auth.feign.ZdxtFileCommonApi; |
|||
import com.zdxt.common.util.Convert; |
|||
import com.zdxt.common.util.DateUtils; |
|||
import com.zdxt.common.util.StringUtils; |
|||
import com.zdxt.common.zdxtFile.AttFileRespDTO; |
|||
import com.zdxt.common.zdxtFile.FilePreviewUtilBean; |
|||
import com.zdxt.common.zdxtFile.ZdxtFileCommon; |
|||
import com.zdxt.knowledge.domain.SceneMedal; |
|||
import com.zdxt.knowledge.mapper.SceneMedalMapper; |
|||
import com.zdxt.knowledge.service.ISceneMedalService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.Objects; |
|||
|
|||
/** |
|||
* Service业务层处理 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2023-12-26 |
|||
*/ |
|||
@Service |
|||
public class SceneMedalServiceImpl implements ISceneMedalService { |
|||
@Autowired |
|||
private SceneMedalMapper sceneMedalMapper; |
|||
@Autowired |
|||
private UserApi userApi; |
|||
@Autowired |
|||
private FileUploadApi fileUploadApi; |
|||
@Autowired |
|||
private ZdxtFileCommonApi zdxtFileCommonApi; |
|||
|
|||
/** |
|||
* 查询 |
|||
* |
|||
* @param guid ID |
|||
* @return |
|||
*/ |
|||
@Override |
|||
public SceneMedal selectSceneMedalById(String guid) { |
|||
return sceneMedalMapper.selectSceneMedalById(guid); |
|||
} |
|||
|
|||
/** |
|||
* 查询列表 |
|||
* |
|||
* @param sceneMedal |
|||
* @return |
|||
*/ |
|||
@Override |
|||
public List<SceneMedal> selectSceneMedalList(SceneMedal sceneMedal) { |
|||
return sceneMedalMapper.selectSceneMedalList(sceneMedal); |
|||
} |
|||
|
|||
@Override |
|||
public List<SceneMedal> selectSceneMedalListAll(SceneMedal sceneMedal) { |
|||
return sceneMedalMapper.selectSceneMedalListAll(sceneMedal); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
* |
|||
* @param sceneMedal |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int insertSceneMedal(MultipartFile[] files, SceneMedal sceneMedal) { |
|||
UserBean userBean = userApi.getCurrentUser(); |
|||
if (Objects.nonNull(userBean)) { |
|||
sceneMedal.setCreator(userBean.getUserName()); |
|||
sceneMedal.setCreateTime(DateUtils.getNowDate()); |
|||
} |
|||
sceneMedal.setGuid(StringUtils.getUUID()); |
|||
int result = sceneMedalMapper.insertSceneMedal(sceneMedal); |
|||
// 上传文件,并在附件表中添加记录
|
|||
if (result > 0 && ObjectUtil.isNotEmpty(files)) { |
|||
for (MultipartFile file : files) { |
|||
zdxtFileCommonApi.insertZdxtFile(file, sceneMedal.getGuid() + "", fileUploadApi.upload(file)); |
|||
} |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
/** |
|||
* 修改 |
|||
* |
|||
* @param sceneMedal |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int updateSceneMedal(MultipartFile[] files, SceneMedal sceneMedal) { |
|||
int result = sceneMedalMapper.updateSceneMedal(sceneMedal); |
|||
// 上传文件,并在附件表中添加记录
|
|||
if (result > 0 && ObjectUtil.isNotEmpty(files)) { |
|||
zdxtFileCommonApi.deleteZdxtFileByIds(sceneMedal.getGuid()); |
|||
for (MultipartFile file : files) { |
|||
zdxtFileCommonApi.insertZdxtFile(file, sceneMedal.getGuid() + "", fileUploadApi.upload(file)); |
|||
} |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
/** |
|||
* 删除对象 |
|||
* |
|||
* @param guids 需要删除的数据ID |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int deleteSceneMedalByIds(String guids) { |
|||
return sceneMedalMapper.deleteSceneMedalByIds(Convert.toStrArray(guids)); |
|||
} |
|||
|
|||
@Override |
|||
public AttFileRespDTO queryFiles(String key) { |
|||
ZdxtFileBean zdxtFileBeanCondition = new ZdxtFileBean(); |
|||
zdxtFileBeanCondition.setBusinessId(key); |
|||
List<ZdxtFileBean> fileBeanList = zdxtFileCommonApi.selectZdxtFileList(zdxtFileBeanCondition); |
|||
|
|||
ArrayList<ZdxtFileCommon> fileList = new ArrayList<>(); |
|||
for (ZdxtFileBean fileBean : fileBeanList) { |
|||
ZdxtFileCommon zdxtFileCommon = new ZdxtFileCommon(); |
|||
BeanUtil.copyProperties(fileBean, zdxtFileCommon); |
|||
fileList.add(zdxtFileCommon); |
|||
} |
|||
|
|||
FilePreviewUtilBean filePreviewUtilBean = new FilePreviewUtilBean(); |
|||
return filePreviewUtilBean.attachementToAttFileRespDTO(fileList); |
|||
} |
|||
|
|||
@Override |
|||
public int removeFile(String key) { |
|||
return zdxtFileCommonApi.deleteZdxtFileById(key); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,186 @@ |
|||
package com.zdxt.knowledge.service.impl; |
|||
|
|||
import cn.hutool.core.bean.BeanUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.zdxt.auth.dto.UserBean; |
|||
import com.zdxt.auth.dto.ZdxtFileBean; |
|||
import com.zdxt.auth.feign.FileUploadApi; |
|||
import com.zdxt.auth.feign.UserApi; |
|||
import com.zdxt.auth.feign.ZdxtFileCommonApi; |
|||
import com.zdxt.common.ZDResponse; |
|||
import com.zdxt.common.util.Convert; |
|||
import com.zdxt.common.util.DateUtils; |
|||
import com.zdxt.common.util.StringUtils; |
|||
import com.zdxt.common.zdxtFile.AttFileRespDTO; |
|||
import com.zdxt.common.zdxtFile.FilePreviewUtilBean; |
|||
import com.zdxt.common.zdxtFile.ZdxtFileCommon; |
|||
import com.zdxt.knowledge.domain.SceneTab; |
|||
import com.zdxt.knowledge.mapper.SceneTabMapper; |
|||
import com.zdxt.knowledge.service.ISceneTabService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.Objects; |
|||
|
|||
/** |
|||
* Service业务层处理 |
|||
* |
|||
* @author ruoyi |
|||
* @date 2023-12-26 |
|||
*/ |
|||
@Service |
|||
public class SceneTabServiceImpl implements ISceneTabService { |
|||
@Autowired |
|||
private SceneTabMapper sceneTabMapper; |
|||
@Autowired |
|||
private UserApi userApi; |
|||
@Autowired |
|||
private FileUploadApi fileUploadApi; |
|||
@Autowired |
|||
private ZdxtFileCommonApi zdxtFileCommonApi; |
|||
|
|||
/** |
|||
* 查询 |
|||
* |
|||
* @param guid ID |
|||
* @return |
|||
*/ |
|||
@Override |
|||
public SceneTab selectSceneTabById(String guid) { |
|||
return sceneTabMapper.selectSceneTabById(guid); |
|||
} |
|||
|
|||
/** |
|||
* 查询列表 |
|||
* |
|||
* @param sceneTab |
|||
* @return |
|||
*/ |
|||
@Override |
|||
public List<SceneTab> selectSceneTabList(SceneTab sceneTab) { |
|||
return sceneTabMapper.selectSceneTabList(sceneTab); |
|||
} |
|||
|
|||
@Override |
|||
public List<SceneTab> selectSceneTabListAll(SceneTab sceneTab) { |
|||
return sceneTabMapper.selectSceneTabListAll(sceneTab); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
* |
|||
* @param sceneTab |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int insertSceneTab(MultipartFile[] files, SceneTab sceneTab) { |
|||
UserBean userBean = userApi.getCurrentUser(); |
|||
if (Objects.nonNull(userBean)) { |
|||
sceneTab.setCreator(userBean.getUserName()); |
|||
sceneTab.setCreateTime(DateUtils.getNowDate()); |
|||
} |
|||
sceneTab.setGuid(StringUtils.getUUID()); |
|||
int result = sceneTabMapper.insertSceneTab(sceneTab); |
|||
// 上传文件,并在附件表中添加记录
|
|||
if (result > 0 && ObjectUtil.isNotEmpty(files)) { |
|||
for (MultipartFile file : files) { |
|||
zdxtFileCommonApi.insertZdxtFile(file, sceneTab.getGuid() + "", fileUploadApi.upload(file)); |
|||
} |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
/** |
|||
* 选中 |
|||
* |
|||
* @param sceneTab |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int selected(MultipartFile[] files, SceneTab sceneTab) { |
|||
int result = 0 ; |
|||
// 上传文件,并在附件表中添加记录
|
|||
if (ObjectUtil.isNotEmpty(files)) { |
|||
zdxtFileCommonApi.deleteZdxtFileByIds(sceneTab.getGuid() + "0000"); |
|||
for (MultipartFile file : files) { |
|||
result = zdxtFileCommonApi.insertZdxtFile(file, sceneTab.getGuid() + "0000", fileUploadApi.upload(file)); |
|||
} |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
/** |
|||
* 修改 |
|||
* |
|||
* @param sceneTab |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int updateSceneTab(MultipartFile[] files, SceneTab sceneTab) { |
|||
int result = sceneTabMapper.updateSceneTab(sceneTab); |
|||
// 上传文件,并在附件表中添加记录
|
|||
if (result > 0 && ObjectUtil.isNotEmpty(files)) { |
|||
zdxtFileCommonApi.deleteZdxtFileByIds(sceneTab.getGuid()); |
|||
for (MultipartFile file : files) { |
|||
zdxtFileCommonApi.insertZdxtFile(file, sceneTab.getGuid() + "", fileUploadApi.upload(file)); |
|||
} |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
/** |
|||
* 删除对象 |
|||
* |
|||
* @param guids 需要删除的数据ID |
|||
* @return 结果 |
|||
*/ |
|||
@Override |
|||
public int deleteSceneTabByIds(String guids) { |
|||
return sceneTabMapper.deleteSceneTabByIds(Convert.toStrArray(guids)); |
|||
} |
|||
|
|||
@Override |
|||
public ZDResponse sort(String guid) { |
|||
SceneTab sceneTab = sceneTabMapper.selectSceneTabById(guid); |
|||
if (Objects.isNull(sceneTab)) { |
|||
return ZDResponse.error("未找到相关数据"); |
|||
} |
|||
SceneTab lastSceneTab = sceneTabMapper.selectLastSort(sceneTab.getSort()); |
|||
if (Objects.isNull(lastSceneTab)) { |
|||
return ZDResponse.error("上移达到最大限制"); |
|||
} |
|||
|
|||
Integer lastSceneTabSort = lastSceneTab.getSort(); |
|||
lastSceneTab.setSort(sceneTab.getSort()); |
|||
sceneTabMapper.updateSceneTab(lastSceneTab); |
|||
sceneTab.setSort(lastSceneTabSort); |
|||
sceneTabMapper.updateSceneTab(sceneTab); |
|||
return ZDResponse.success("上移成功"); |
|||
} |
|||
|
|||
@Override |
|||
public AttFileRespDTO queryFiles(String key) { |
|||
ZdxtFileBean zdxtFileBeanCondition = new ZdxtFileBean(); |
|||
zdxtFileBeanCondition.setBusinessId(key); |
|||
List<ZdxtFileBean> fileBeanList = zdxtFileCommonApi.selectZdxtFileList(zdxtFileBeanCondition); |
|||
|
|||
ArrayList<ZdxtFileCommon> fileList = new ArrayList<>(); |
|||
for (ZdxtFileBean fileBean : fileBeanList) { |
|||
ZdxtFileCommon zdxtFileCommon = new ZdxtFileCommon(); |
|||
BeanUtil.copyProperties(fileBean, zdxtFileCommon); |
|||
fileList.add(zdxtFileCommon); |
|||
} |
|||
|
|||
FilePreviewUtilBean filePreviewUtilBean = new FilePreviewUtilBean(); |
|||
return filePreviewUtilBean.attachementToAttFileRespDTO(fileList); |
|||
} |
|||
|
|||
@Override |
|||
public int removeFile(String key) { |
|||
return zdxtFileCommonApi.deleteZdxtFileById(key); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,102 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.zdxt.knowledge.mapper.SceneMedalMapper"> |
|||
|
|||
<resultMap type="com.zdxt.knowledge.domain.SceneMedal" id="SceneMedalResult"> |
|||
<result property="guid" column="guid"/> |
|||
<result property="name" column="name"/> |
|||
<result property="iconPath" column="icon_path"/> |
|||
<result property="earnIconPath" column="earn_icon_path"/> |
|||
<result property="creator" column="creator"/> |
|||
<result property="createTime" column="create_time"/> |
|||
<result property="updateBy" column="update_by"/> |
|||
<result property="updateTime" column="update_time"/> |
|||
</resultMap> |
|||
|
|||
<sql id="selectSceneMedalVo"> |
|||
select guid, |
|||
name, |
|||
icon_path, |
|||
earn_icon_path, |
|||
creator, |
|||
create_time, |
|||
update_by, |
|||
update_time |
|||
from scene_medal |
|||
</sql> |
|||
|
|||
<select id="selectSceneMedalList" parameterType="SceneMedal" resultMap="SceneMedalResult"> |
|||
<include refid="selectSceneMedalVo"/> |
|||
<where> |
|||
<if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if> |
|||
<if test="creator != null and creator != ''">and creator = #{creator}</if> |
|||
</where> |
|||
order by sort ASC |
|||
</select> |
|||
|
|||
<select id="selectSceneMedalById" parameterType="String" resultMap="SceneMedalResult"> |
|||
<include refid="selectSceneMedalVo"/> |
|||
where guid = #{guid} |
|||
</select> |
|||
|
|||
<insert id="insertSceneMedal" parameterType="SceneMedal"> |
|||
insert into scene_medal |
|||
<trim prefix="(" suffix=")" suffixOverrides=","> |
|||
<if test="guid != null ">guid,</if> |
|||
<if test="name != null and name != ''">`name`,</if> |
|||
<if test="iconPath != null and iconPath != ''">icon_path,</if> |
|||
<if test="earnIconPath != null and earnIconPath != ''">earn_icon_path,</if> |
|||
<if test="creator != null and creator != ''">creator,</if> |
|||
<if test="createTime != null ">create_time,</if> |
|||
<if test="updateBy != null and updateBy != ''">update_by,</if> |
|||
<if test="updateTime != null ">create_time,</if> |
|||
</trim> |
|||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
|||
<if test="guid != null ">#{guid},</if> |
|||
<if test="name != null and name != ''">#{name},</if> |
|||
<if test="iconPath != null and iconPath != ''">#{iconPath},</if> |
|||
<if test="earnIconPath != null and earnIconPath != ''">#{earnIconPath},</if> |
|||
<if test="creator != null and creator != ''">#{creator},</if> |
|||
<if test="createTime != null ">#{createTime},</if> |
|||
<if test="updateBy != null and updateBy != ''">#{updateBy},</if> |
|||
<if test="updateTime != null ">#{updateTime},</if> |
|||
</trim> |
|||
</insert> |
|||
|
|||
<update id="updateSceneMedal" parameterType="SceneMedal"> |
|||
update scene_medal |
|||
<trim prefix="SET" suffixOverrides=","> |
|||
<if test="name != null and name != ''">name = #{name},</if> |
|||
<if test="iconPath != null and iconPath != ''">icon_path = #{iconPath},</if> |
|||
<if test="earnIconPath != null and earnIconPath != ''">earn_icon_path = #{earnIconPath},</if> |
|||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
|||
<if test="updateTime != null ">update_time = #{updateTime},</if> |
|||
</trim> |
|||
where guid = #{guid} |
|||
</update> |
|||
|
|||
<delete id="deleteSceneMedalById" parameterType="String"> |
|||
delete |
|||
from scene_medal |
|||
where guid = #{guid} |
|||
</delete> |
|||
|
|||
<delete id="deleteSceneMedalByIds" parameterType="String"> |
|||
delete from scene_medal where guid in |
|||
<foreach item="guid" collection="array" open="(" separator="," close=")"> |
|||
#{guid} |
|||
</foreach> |
|||
</delete> |
|||
|
|||
|
|||
<select id="selectSceneMedalListAll" parameterType="SceneMedal" resultMap="SceneMedalResult"> |
|||
select cu.guid, cu.name, zd.upload_path |
|||
from scene_medal as cu |
|||
inner join zdxt_file as zd |
|||
on cu.guid = zd.business_id |
|||
where cu.hide = 1 |
|||
order by cu.sort ASC |
|||
</select> |
|||
|
|||
</mapper> |
|||
@ -0,0 +1,138 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.zdxt.knowledge.mapper.SceneTabMapper"> |
|||
|
|||
<resultMap type="com.zdxt.knowledge.domain.SceneTab" id="SceneTabResult"> |
|||
<result property="guid" column="guid"/> |
|||
<result property="title" column="title"/> |
|||
<result property="pagePath" column="page_path"/> |
|||
<result property="selectedColor" column="selected_color"/> |
|||
<result property="type" column="type"/> |
|||
<result property="sort" column="sort"/> |
|||
<result property="hide" column="hide"/> |
|||
<result property="iconPath" column="icon_path"/> |
|||
<result property="selectedIconPath" column="selected_icon_path"/> |
|||
<result property="creator" column="creator"/> |
|||
<result property="createTime" column="create_time"/> |
|||
<result property="updateBy" column="update_by"/> |
|||
<result property="updateTime" column="update_time"/> |
|||
</resultMap> |
|||
|
|||
<sql id="selectSceneTabVo"> |
|||
select guid, |
|||
title, |
|||
page_path, |
|||
selected_color, |
|||
type, |
|||
sort, |
|||
hide, |
|||
icon_path, |
|||
selected_icon_path, |
|||
creator, |
|||
create_time, |
|||
update_by, |
|||
update_time |
|||
from scene_tab |
|||
</sql> |
|||
|
|||
<select id="selectSceneTabList" parameterType="SceneTab" resultMap="SceneTabResult"> |
|||
<include refid="selectSceneTabVo"/> |
|||
<where> |
|||
<if test="title != null and title != ''">and `title` like concat('%', #{title}, '%')</if> |
|||
<if test="creator != null and creator != ''">and creator = #{creator}</if> |
|||
</where> |
|||
order by sort ASC |
|||
</select> |
|||
|
|||
<select id="selectSceneTabById" parameterType="String" resultMap="SceneTabResult"> |
|||
<include refid="selectSceneTabVo"/> |
|||
where guid = #{guid} |
|||
</select> |
|||
|
|||
<insert id="insertSceneTab" parameterType="SceneTab"> |
|||
insert into scene_tab |
|||
<trim prefix="(" suffix=")" suffixOverrides=","> |
|||
<if test="guid != null ">guid,</if> |
|||
<if test="title != null and title != ''">`title`,</if> |
|||
<if test="pagePath != null and pagePath != ''">page_path,</if> |
|||
<if test="selectedColor != null and selectedColor != ''">selected_color,</if> |
|||
<if test="iconPath != null and iconPath != ''">icon_path,</if> |
|||
<if test="selectedIconPath != null and selectedIconPath != ''">selected_icon_path,</if> |
|||
<if test="sort != null ">sort,</if> |
|||
<if test="hide != null and hide != ''">`hide`,</if> |
|||
<if test="type != null and type != ''">`type`,</if> |
|||
<if test="creator != null and creator != ''">creator,</if> |
|||
<if test="createTime != null ">create_time,</if> |
|||
<if test="updateBy != null and updateBy != ''">update_by,</if> |
|||
<if test="updateTime != null ">create_time,</if> |
|||
</trim> |
|||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
|||
<if test="guid != null ">#{guid},</if> |
|||
<if test="title != null and title != ''">#{title},</if> |
|||
<if test="pagePath != null and pagePath != ''">#{pagePath},</if> |
|||
<if test="selectedColor != null and selectedColor != ''">#{selectedColor},</if> |
|||
<if test="iconPath != null and iconPath != ''">#{iconPath},</if> |
|||
<if test="selectedIconPath != null and selectedIconPath != ''">#{selectedIconPath},</if> |
|||
<if test="sort != null ">#{sort},</if> |
|||
<if test="hide != null and hide != ''">#{hide},</if> |
|||
<if test="type != null and type != ''">#{type},</if> |
|||
<if test="creator != null and creator != ''">#{creator},</if> |
|||
<if test="createTime != null ">#{createTime},</if> |
|||
<if test="updateBy != null and updateBy != ''">#{updateBy},</if> |
|||
<if test="updateTime != null ">#{updateTime},</if> |
|||
</trim> |
|||
</insert> |
|||
|
|||
<update id="updateSceneTab" parameterType="SceneTab"> |
|||
update scene_tab |
|||
<trim prefix="SET" suffixOverrides=","> |
|||
<if test="title != null and title != ''">title = #{title},</if> |
|||
<if test="pagePath != null and pagePath != ''">page_path = #{pagePath},</if> |
|||
<if test="selectedColor != null and selectedColor != ''">selected_color = #{selectedColor},</if> |
|||
<if test="iconPath != null and iconPath != ''">icon_path = #{iconPath},</if> |
|||
<if test="selectedIconPath != null and selectedIconPath != ''">selected_icon_path = #{selectedIconPath}, |
|||
</if> |
|||
<if test="sort != null ">sort = #{sort},</if> |
|||
<if test="hide != null ">hide = #{hide},</if> |
|||
<if test="type != null ">`type` = #{type},</if> |
|||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
|||
<if test="updateTime != null ">update_time = #{updateTime},</if> |
|||
</trim> |
|||
where guid = #{guid} |
|||
</update> |
|||
|
|||
<delete id="deleteSceneTabById" parameterType="String"> |
|||
delete |
|||
from scene_tab |
|||
where guid = #{guid} |
|||
</delete> |
|||
|
|||
<delete id="deleteSceneTabByIds" parameterType="String"> |
|||
delete from scene_tab where guid in |
|||
<foreach item="guid" collection="array" open="(" separator="," close=")"> |
|||
#{guid} |
|||
</foreach> |
|||
</delete> |
|||
|
|||
<select id="selectMinSort" resultType="INTEGER"> |
|||
select MAX(sort) as sort |
|||
from scene_Tab |
|||
</select> |
|||
|
|||
<select id="selectLastSort" parameterType="INTEGER" resultMap="SceneTabResult"> |
|||
SELECT guid, sort |
|||
FROM scene_Tab |
|||
WHERE sort = (SELECT MAX(sort) FROM scene_tab where sort < #{sort}); |
|||
</select> |
|||
|
|||
<select id="selectSceneTabListAll" parameterType="SceneTab" resultMap="SceneTabResult"> |
|||
select cu.guid, cu.name, zd.upload_path |
|||
from scene_tab as cu |
|||
inner join zdxt_file as zd |
|||
on cu.guid = zd.business_id |
|||
where cu.hide = 1 |
|||
order by cu.sort ASC |
|||
</select> |
|||
|
|||
</mapper> |
|||
Loading…
Reference in new issue