11 changed files with 481 additions and 45 deletions
@ -0,0 +1,94 @@ |
|||
<!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="dictLabel"/> |
|||
<input type="text" name="dictType" value="medal_type" hidden/> |
|||
</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="col-sm-12 select-table table-bordered"> |
|||
<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 types = [[${@dict.getType('medal_type')}]]; |
|||
var prefix = ctx + "system/dict/data"; |
|||
|
|||
$(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: 'dictLabel', |
|||
title: '勋章类型' |
|||
}, |
|||
// { |
|||
// field : 'type', |
|||
// title : '类型', |
|||
// formatter : function (value, row, index) { |
|||
// return $.table.selectDictLabel(types, value); |
|||
// } |
|||
// }, |
|||
{ |
|||
field: 'createBy', |
|||
title: '创建人' |
|||
}, |
|||
{ |
|||
field: 'createTime', |
|||
title: '创建时间' |
|||
}, |
|||
{ |
|||
title: '操作', |
|||
align: 'center', |
|||
formatter: function (value, row, index) { |
|||
var actions = []; |
|||
actions.push('<a class="btn btn-danger btn-xs" href="/small/project/medal/view/'+row.dictValue+'"><i class="fa fa-eject"></i>列表</a>'); |
|||
return actions.join(''); |
|||
} |
|||
}] |
|||
}; |
|||
$.table.init(options); |
|||
}); |
|||
|
|||
|
|||
|
|||
function reset() { |
|||
$("[name='dictLabel']").val(""); |
|||
$.table.search() |
|||
} |
|||
</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="${sceneMedal}"> |
|||
<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/medal" |
|||
$("#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> |
|||
Loading…
Reference in new issue