upload.html 6.1 KB
<!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-integrity-edit" th:object="${creditGovernmentIntegrity}">
            <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="firstIndex" th:field="*{firstIndex}" 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="secondIndex" th:field="*{secondIndex}" 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="score" id="score" th:field="*{score}" 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">
                    <select name="fileType" id="fileType" class="form-control m-b" th:with="type=${@dict.getType('eit_government_file_type')}" disabled>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{fileType}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">主要监测内容:</label>
                <div class="col-sm-8">
                    <textarea name="monitorContent" class="form-control" disabled>[[*{monitorContent}]]</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">
                    <textarea name="fileRequest" class="form-control" disabled>[[*{fileRequest}]]</textarea>
                </div>
            </div>

            <div class="form-group" id="fileUpload">
                <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/integrity";
        $("#form-integrity-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            $.operate.save(ctx+ "business/score/add", {"id":$("#id").val(),"score":$("#score").val()}, function (result){
                $.modal.close();
            });
        }

        var fileRespList = [[${creditGovernmentIntegrity.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;

            console.log(fileRespList);
            // 多图上传
            $("#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: "affairs_integrity"},
                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('filedeleted', function (event, data, previewId, index) {
                for (var i = 0; i < fileRespList.length; i++) {
                    if (fileRespList[i].id == data) {
                        delete fileRespList[i];
                    }
                }
            })
        });
    </script>
</body>
</html>