frontDept.html
7.49 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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('部门列表')" />
<th:block th:include="include :: bootstrap-fileinput-css" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="dept-form">
<div class="select-list">
<ul>
<li>
部门名称:<input type="text" name="deptName"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.treeTable.search()"><i class="fa fa-search"></i> 搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="addHead(1)" >
<i class="fa fa-plus"></i> 新增公司
</a>
<!-- <a class="btn btn-success" onclick="$.operate.add(1)" shiro:hasPermission="business:frontDept:add">-->
<!-- <i class="fa fa-plus"></i> 新增分公司-->
<!-- </a>-->
<a class="btn btn-primary" onclick="$.operate.edit()" shiro:hasPermission="business:frontDept:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-info" id="expandAllBtn">
<i class="fa fa-exchange"></i> 展开/折叠
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-tree-table" data-mobile-responsive="true"></table>
</div>
<div class="modal inmodal" id="myModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content animated bounceInRight">
<div class="modal-body">
<p>上传报告价格</p>
<div class="form-group">
<div class="file-loading">
<input class="file" type="file" multiple data-min-file-count="1" data-theme="fas">
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
<button type="button" class="btn btn-primary" @click="saveComReportPrice()">保存</button>
</div>
</div>
</div>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: bootstrap-fileinput-js" />
<script th:inline="javascript">
var addFlag = [[${@permission.hasPermi('business:frontDept:add')}]];
var editFlag = [[${@permission.hasPermi('business:frontDept:edit')}]];
var removeFlag = [[${@permission.hasPermi('business:frontDept:remove')}]];
var datas = [[${@dict.getType('sys_normal_disable')}]];
var addTemplateFlag = [[${@permission.hasPermi('business:templateConfiguration:add')}]];
var prefix = ctx + "business/frontDept"
var template = ctx + "business/templateConfiguration";
var id=null;
$(function() {
var options = {
code: "id",
parentCode: "parentId",
uniqueId: "id",
url: prefix + "/list",
createUrl: prefix + "/add/{id}",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/removeById/{id}",
modalName: "部门",
columns: [{
field: 'selectItem',
radio: true
},
{
field: 'deptName',
title: '部门名称',
align: "left"
},
{
field: 'bizTypes',
title: '业务类型',
align: "left"
},
{
field: 'createTime',
title: '创建时间',
align: "left"
},
{
title: '操作',
align: 'left',
formatter: function(value, row, index) {
// if (row.parentId != 0) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-info btn-xs ' + addFlag + '" href="javascript:void(0)" onclick="$.operate.add(\'' + row.id + '\')"><i class="fa fa-plus"></i>新增</a> ');
// if (row.parentId === 0){
// actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="updateServiceType(\'' + row.id + '\',\'' + row.contractNum + '\')"><i class="fa fa-edit"></i>更新业务类型</a> ');
// }
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-trash"></i>删除</a> ');
actions.push('<a class="btn btn-info btn-xs ' + addTemplateFlag + '" href="javascript:void(0)" onclick="openTableForUpdate(\'' + row.id + '\')"><i class="fa fa-user"></i>配置业务类型</a>');
actions.push('<a class="btn btn-success btn-xs " data-toggle="modal" data-target="#myModal" ' +
// ' onclick="saveComReportPrice(\'' + row.id + '\')">' +
'<i class="fa fa-user"></i>上传价格</a>');
if(row.parentId==0){
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="updateMon(\'' + row.id + '\')"><i class="fa fa-user"></i>更新监控企业有效期</a>');
}
return actions.join('');
// } else {
// return "";
// }
}
}]
};
$.treeTable.init(options);
});
function openTableForUpdate(id){
this.id=id;
}
function saveComReportPrice() {
var formData = new FormData();
if ($('#filePath')[0].files[0] == null) {
$.modal.alertWarning("请先选择文件路径");
return false;
}
formData.append('fileName', $("input[name='fileName']").val());
formData.append('file', $('#filePath')[0].files[0]);
formData.append('id', this.id);
$.ajax({
url: prefix + "/saveComReportPrice/"+this.id,
type: 'post',
cache: false,
data: formData,
processData: false,
contentType: false,
dataType: "json",
success: function(result) {
$.operate.successCallback(result);
}
});
}
function updateServiceType(id,contractNum) {
var contractNum = contractNum;
var id = id;
$.ajax({
type: "post",
url: prefix + "/updateServiceType",
data: {
"id": id,
"contractNum": contractNum
},
success: function(r) {
if (r.code == 2000) {
$.modal.alert("更新成功");
console.log(r);
// location.href = ctx + 'index';
}else {
$.model.alertWarning("系统错误,请联系管理员");
}
}
});
}
function addHead() {
$.modal.open("添加总公司、分公司", prefix+"/addHead");
}
/* 角色管理-分配用户 */
function addTemplate(orgId) {
var url = template + '/addVue/' + orgId;
$.modal.open("配置业务类型", url, 1000);
}
function updateMon(id) {
$.ajax({
type: "post",
url: prefix + "/updateMon",
data: {
"id": id
},
success: function(r) {
if (r.code == 2000) {
$.modal.alert("更新成功");
console.log(r);
// location.href = ctx + 'index';
}else {
$.model.alertWarning("系统错误,请联系管理员");
}
}
});
}
</script>
</body>
</html>