upload.html
5.5 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<!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-model-edit" th:object="${creditCityModel}">
<input name="id" id="id" th:field="*{id}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label is-required">序号:</label>
<div class="col-sm-8">
<input name="serialNumber" th:field="*{serialNumber}" class="form-control" type="text" disabled>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">基础指标:</label>
<div class="col-sm-8">
<input name="basicIndex" th:field="*{basicIndex}" class="form-control" type="text" disabled>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">指标说明:</label>
<div class="col-sm-8">
<textarea name="indexContent" class="form-control" disabled>[[*{indexContent}]]</textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">评分标准:</label>
<div class="col-sm-8">
<textarea name="scoreStandard" class="form-control" disabled>[[*{scoreStandard}]]</textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">层级归属:</label>
<div class="col-sm-8">
<input name="layerBelong" th:field="*{layerBelong}" class="form-control" type="text" disabled>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">材料类别:</label>
<div class="col-sm-8">
<textarea name="contentType" class="form-control" disabled>[[*{contentType}]]</textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">责任单位:</label>
<div class="col-sm-8">
<input name="responsibleUnit" th:field="*{responsibleUnit}" type="hidden" id="treeId">
<textarea name="responsibleName" onclick="selectDeptTree()" class="form-control" id="treeName" disabled>[[*{responsibleName}]]</textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">多附件上传</label>
<div class="col-sm-7">
<input type="hidden" name="fileIdList"/>
<div class="file-loading">
<input id="fileIdList" name="files" type="file" multiple>
</div>
</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/city/model";
$("#form-model-edit").validate({
focusCleanup: true
});
function submitHandler() {
$.modal.close();
}
var fileRespList = [[${creditCityModel.fileRespList}]];
$(function (){
if(fileRespList == null){
fileRespList = [];
}
var deleteFileUrl = ctx + "business/common/cloud/upload/delete";
var parseResult = parseUpload(fileRespList, deleteFileUrl);
var initialPreview = parseResult.initialPreview;
var initialPreviewConfig = parseResult.initialPreviewConfig;
// 多图上传
$("#fileIdList").fileinput({
uploadUrl: ctx + 'business/common/cloud/uploads',
deleteUrl: deleteFileUrl,
uploadAsync: false,
allowedFileExtensions:['image', 'doc', 'docx', 'video', 'png', 'jpg', 'pdf'],//允许上传的文件类型,错误会给出提示
maxFileCount: 10,
autoReplace: true,
showClose: false, //隐藏右上角叉
showRemove: false, //隐藏清除按钮
uploadExtraData: {bid:$("#id").val(), bType: "city_model"},
initialPreview: initialPreview,
initialPreviewConfig: initialPreviewConfig,
initialPreviewAsData: true, // defaults markup
fileSizeGetter:true,
overwriteInitial:false
}).on('filebatchuploadsuccess', function (event, data, previewId, index) {
var rsp = data.response;
$("input[name='" + event.currentTarget.id + "']").val(rsp.data.ids)
}).on('filesuccessremove', function (event, data, previewId, index) {
for (var i = 0; i < fileRespList.length; i++) {
if (fileRespList[i].id == data) {
delete fileRespList[i];
}
}
})
});
</script>
</body>
</html>