add.html 2.99 KB
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('新增报告目录')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-reportDirectoryData-add">
			<div class="form-group">	
				<label class="col-sm-3 control-label">报告类型:</label>
				<div class="col-sm-8">
					<select  class="form-control" id="reportType" name="reportType"  th:with="type=${@dict.getType('autoMakeReportType')}">
					<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">目录名称:</label>
				<div class="col-sm-8">
					<input id="rdName" name="rdName" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">排序编号:</label>
				<div class="col-sm-8">
					<input id="sortNum" name="sortNum"  class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">数据源:</label>
				<div class="col-sm-8">
				<input type="text" class="form-control" id="dsSelectName" disabled  >
				<input type="text" class="form-control" id="suggest-demo-1"   name="dsId" >
					<div class="input-group-btn">
						<button type="button" class="btn btn-white dropdown-toggle" data-toggle="dropdown">
							<span class="caret"></span>
						</button>
						<ul class="dropdown-menu dropdown-menu-right" role="menu">
						</ul>
					</div>
				</div>
			</div>
		</form>
	</div>
    <div th:include="include::footer"></div>
	<th:block th:include="include :: bootstrap-suggest-js" />
	<th:block th:include="include :: bootstrap-typeahead-js" />
    <script type="text/javascript">
		var prefix = ctx + "business/reportDirectoryData"
		function getDataSource(){
			var reportType=$("#reportType").val()
			if ($.common.isEmpty(reportType)){
				alert("请选择报告类型");
				return ;
			}
			$.get(prefix+"/getDataSource?id="+reportType,(data)=>{

			})
		}
		$("#form-reportDirectoryData-add").validate({
			rules:{
				xxxx:{
					required:true,
				},
			},
			focusCleanup: true
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	            $.operate.save(prefix + "/add", $('#form-reportDirectoryData-add').serialize());
	        }
	    }
		var testBsSuggest = $("#suggest-demo-1").bsSuggest({
			url: ctx + "business/reportDataSource/list2",
			idField: "id",
			keyField: "dsName"
		}).on('onDataRequestSuccess', function (e, result) {
			console.log('onDataRequestSuccess: ', result);
		}).on('onSetSelectValue', function (e, keyword) {
			$("#suggest-demo-1").val(keyword.id)
			$("#dsSelectName").val(keyword.key)
			console.log('onSetSelectValue: ', keyword);
		}).on('onUnsetSelectValue', function (e) {
			console.log("onUnsetSelectValue");
		});
	</script>
</body>
</html>