info.html
4.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改参数')" />
<th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-config-edit" th:object="${configData}">
<input id="configId" name="configId" th:field="*{configId}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label is-required">参数名称:</label>
<div class="col-sm-8">
<input id="configName" name="configName" th:field="*{configName}" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">参数键名:</label>
<div class="col-sm-8">
<input id="configKey" name="configKey" th:field="*{configKey}" class="form-control" type="text" disabled>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">附件:</label>
<div class="col-sm-8">
<input type="hidden" name="configValue" th:field="*{configValue}">
<div class="file-loading">
<input class="form-control file-upload" id="configValue" name="file" type="file">
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">版本年份:</label>
<div class="col-sm-8">
<input id="remark" name="remark" th:field="*{remark}" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: bootstrap-fileinput-js"/>
<th:block th:include="include :: file-upload-parse" />
<script th:inline="javascript">
var prefix = ctx + "business/discipline/config";
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-config-edit').serialize());
}
}
var fileRespList = [[${configData.fileRespList}]];
var deleteFileUrl = ctx + "business/common/cloud/upload/delete";
var parseResult = parseUpload(fileRespList, deleteFileUrl);
var initialPreview = parseResult.initialPreview;
var initialPreviewConfig = parseResult.initialPreviewConfig;
$(".file-upload").each(function (i) {
$(this).fileinput({
uploadUrl: ctx + 'business/common/cloud/upload',
deleteUrl: deleteFileUrl,
uploadAsync: false,
allowedFileExtensions:['xls','xlsx'],
maxFileCount: 1,
autoReplace: true,
showClose: false, //隐藏右上角叉
showRemove: false, //隐藏清除按钮
maxFileSize: 25600,
uploadExtraData:{bid:$("#configId").val(), bType: "credit_discipline"},
initialPreview: initialPreview,
initialPreviewConfig: initialPreviewConfig,
initialPreviewAsData: true, // defaults markup
fileSizeGetter:true,
overwriteInitial:false
}).on('filebatchuploadsuccess', function (event, data, previewId, index) {
if (data.response.data) {
var rdata = data.response.data;
$("input[name='" + event.currentTarget.id + "']").val(rdata.ids);
}
}).on('filesuccessremove', function (event, id, index) {
$("input[name='" + event.currentTarget.id + "']").val('');
for (var i = 0; i < fileRespList.length; i++) {
if (fileRespList[i].id == data) {
delete fileRespList[i];
}
}
})
$(this).fileinput('_initFileActions');
});
</script>
</body>
</html>