upload.html 5.5 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-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>