info.html 4.15 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-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>