add.html
5.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<!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>