add.html 5.3 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-frontDept-add">
			<div class="form-group">	
				<label class="col-sm-3 control-label">公司名称:</label>
				<div class="col-sm-8">
					<input id="deptName" name="deptName" 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="contractNum" name="contractNum" class="form-control" type="text">
				</div>
			</div>
		</form>
	</div>
	<!--新增下属分公司-->
<!--	<div class="container-div">-->
<!--		<div class="btn-group-sm" id="toolbar" role="group">-->
<!--			<a class="btn btn-success" onclick="insertRow()">-->
<!--				<i class="fa fa-plus"></i> 新增下属分公司-->
<!--			</a>-->
<!--			<a class="btn btn-danger btn-del disabled" onclick="removeRow()">-->
<!--				<i class="fa fa-remove"></i> 删除选择行-->
<!--			</a>-->
<!--		</div>-->
<!--		<div class="row">-->
<!--			<div class="col-sm-12 select-table table-striped">-->
<!--				<table id="bootstrap-table" data-mobile-responsive="true"></table>-->
<!--			</div>-->
<!--		</div>-->
<!--	</div>-->

	<!--新增部门-->
	<div class="container-div">
		<div class="btn-group-sm" id="toolbarDept" role="group">
			<a class="btn btn-success" onclick="insertRowDept()">
				<i class="fa fa-plus"></i> 新增部门
			</a>
			<a class="btn btn-danger btn-del disabled" onclick="removeRowDept()">
				<i class="fa fa-remove"></i> 删除选择行
			</a>
		</div>
		<div class="row">
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true" class="dept"></table>
			</div>
		</div>
	</div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		//  var prefix = ctx + "business/frontDept"
		// $("#form-frontDept-add").validate({
		// 	rules:{
		// 		xxxx:{
		// 			required:true,
		// 		},
		// 	},
		// 	focusCleanup: true
		// });
		//
		// function submitHandler() {
		//     if ($.validate.form()) {
		//         $.operate.save(prefix + "/add", $('#form-frontDept-add').serialize());
		//     }
		// }

		$(function() {
			// var options = {
			// 	showSearch: false,
			// 	showRefresh: false,
			// 	showToggle: false,
			// 	showColumns: false,
			// 	pagination: false,
			// 	uniqueId: "id",
			// 	height: 400,
			// 	columns: [{
			// 		checkbox: true
			// 	}, {
			// 			field : 'id',
			// 			title : '序号'
			// 		},
			// 		{
			// 			field : 'contractType',
			// 			title : '合同类型'
			// 		},
			// 		{
			// 			field : 'signingMethod',
			// 			title : '签署方式'
			// 		},
			// 		{
			// 			field : 'deptName',
			// 			title : '分公司名称'
			// 		}]
			// };
			// $.table.init(options);

			var deptOptions = {
				showSearch: false,
				showRefresh: false,
				showToggle: false,
				showColumns: false,
				pagination: false,
				uniqueId: "did",
				height: 400,
				columns: [{
					checkbox: true
				}, {
					field : 'did',
					title : '序号'
				},
					{
						field : 'deptName',
						title : '部门名称'
					},
					{
						field : 'cname',
						title : '所属公司'
					}]
			};
			$.table.init(deptOptions);
		});


		/* 新增表格行 */
		var randomId=1;
		function insertRow(){
			$("#bootstrap-table").bootstrapTable('insertRow', {
				index: randomId, // 你想插入到哪,0表示第一行
				row: {
					id:randomId++,
					contractType:  '<select class="form-control"> <option value="">--请选择--</option> <option value="0">正式合同</option> <option value="1">虚拟合同</option> </select>',
					signingMethod:'<select class="form-control"> <option value="">--请选择--</option> <option value="0">总公司签署</option> <option value="1">分公司单独签署</option> </select>',
					deptName:'<input id="deptName" name="deptName" class="form-control" type="text">'
				}
			})
		}

		/* 删除指定表格行 */
		function removeRow(){
			var ids = $("#bootstrap-table").selectColumns("id");
			if (ids.length == 0) {
				$.modal.alertWarning("请至少选择一条记录");
				return;
			}
			$("#bootstrap-table").bootstrapTable('remove', {
				field: 'id',
				values: ids
			})
		}

		/* 删除所有表格行 */
		function removeRowAll(){
			$("#bootstrap-table").bootstrapTable('removeAll')
		}

		/* 新增表格行 */
		var deptRandomId=1;
		function insertRowDept(){
			$(".dept").bootstrapTable('insertRow', {
				index: deptRandomId, // 你想插入到哪,0表示第一行
				row: {
					did:deptRandomId++,
					deptName:'<input id="deptName" name="deptName" class="form-control" type="text">',
					cName:'<input id="cName" name="cName" class="form-control" type="text">'
				}
			})
		}

		/* 删除指定表格行 */
		function removeRowDept(){
			var ids = $(".dept").selectColumns("did");
			if (ids.length == 0) {
				$.modal.alertWarning("请至少选择一条记录");
				return;
			}
			$(".dept").bootstrapTable('remove', {
				field: 'did',
				values: ids
			})
		}

		/* 删除所有表格行 */
		function removeRowAllDept(){
			$(".dept").bootstrapTable('removeAll')
		}



	</script>
</body>
</html>