detail.html
12.6 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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<meta content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="广联帐户管理中心-员工管理" />
<meta name="author" content="GLSX Web Team" />
<meta name="keywords" itemprop="keywords" content="广联,帐户管理,员工管理" />
<link rel="stylesheet" type="text/css" href="/css/main.css" />
<title>员工管理</title>
</head>
<style>
.sub-bg-white {
width: 100%;
background-color: #f4f5fa;
padding-top: 8px;
}
.sub-title {
margin-top: 21px;
}
.content-title {
margin-bottom: 20px;
}
.fixed-btn {
position: fixed;
right: 10px;
bottom: 20px;
background-color: #409eff;
border-radius: 20px;
text-align: center;
}
.fixed-btn a {
display: block;
width: 40px;
padding: 5px;
color: #fff;
border-bottom: 1px solid #fff;
}
.fixed-btn a:last-child {
border-bottom: none;
}
.topwrap,
.topmidwrap,
.topbottomwrap,
.bottomwrap {
/* margin: 0 20px 0; */
background-color: #fff;
position: relative;
min-height: 238px;
}
.topwrap,
.topmidwrap {
/* min-height: calc(100vh - 480px); */
padding-bottom: 10px;
}
.topbottomwrap {
min-height: calc(100vh - 200px);
}
.grayLine {
position: absolute;
left: 0;
top: 48px;
background-color: #d8d8d8;
width: 100%;
height: 1px;
}
.layui-tab-content {
position: relative;
}
.layui-no-data {
width: 100%;
height: 500px;
}
.layui-no-data .no-data {
position: absolute;
top: 50%;
height: 50%;
width: 100%;
text-align: center;
font-size: 14px;
line-height: 22px;
}
.layui-no-data .no-data div {
margin-top: 12px;
}
.show {
display: inline-block;
}
.hide {
display: none;
}
.wrapper .employeeDetail .layui-this {
color: #5850ff;
background-color: #f4f6fc;
}
.wrapper,
.detail {
padding-bottom: 100px;
}
</style>
<body>
<div id="app">
<main class="wrapper detail">
<div class="layui-tab layui-tab-brief" lay-filter="editTab">
<ul class="layui-tab-title employeeDetail">
<li lay-id="1" style="padding: 0; width: 90px; margin-right: 20px" class="layui-this">基本信息</li>
<li lay-id="2" style="padding: 0; width: 90px; margin-right: 20px">账户权限</li>
<li lay-id="3" style="padding: 0; width: 90px">修改记录</li>
</ul>
<div class="layui-tab-content">
<div class="layui-tab-item layui-show">
<div class="topwrap">
<div class="grayLine"></div>
<h3 class="content-title sub-title" id="basic">
员工基本信息
<div class="title-right" id="merchantName"></div>
</h3>
<div class="layui-form-item">
<label class="layui-form-label">姓名:</label>
<div class="layui-input-block">
<div class="layui-form-mid layui-word-aux" id="staffName"></div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">登录手机号:</label>
<div class="layui-input-block">
<div class="layui-form-mid layui-word-aux" id="staffPhone"></div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">企微号:</label>
<div class="layui-input-block">
<div class="layui-form-mid layui-word-aux" id="entmicroName"></div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">职务:</label>
<div class="layui-input-block">
<div class="layui-form-mid layui-word-aux" id="staffJob"></div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">角色名称:</label>
<div class="layui-input-block">
<div class="layui-form-mid layui-word-aux" id="roleName"></div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">创建人:</label>
<div class="layui-input-block">
<div class="layui-form-mid layui-word-aux" id="createdAccount"></div>
</div>
</div>
</div>
<div class="topmidwrap">
<div class="grayLine"></div>
<h3 class="content-title sub-title" id="visibleMerchant">可见下级商户</h3>
<!-- <ul id="merchantTree" class="ztree wrapper-tree"></ul> -->
<div class="layui-input-block">
<ul id="visibleInferiorMerName"></ul>
</div>
</div>
</div>
<div class="layui-tab-item">
<div class="topbottomwrap">
<div class="grayLine"></div>
<h3 class="content-title sub-title" id="accountAuth">账户权限</h3>
<div class="layui-tab tabmutiple-content"
style="padding: 0 20px 10px; background-color: #fff; margin-bottom: 80px" lay-filter="roleAuth">
<ul class="layui-tab-title"></ul>
<div class="layui-tab-content"></div>
</div>
</div>
</div>
<div class="layui-tab-item">
<div class="bottomwrap" style="margin-bottom: 80px; padding: 0 20px">
<div class="grayLine"></div>
<h3 class="content-title sub-title" id="record">修改记录</h3>
<div class="layui-tab tabmutiple-content">
<div class="table-page">
<table class="layui-table" id="recordTable"></table>
<div id="recordPage" class="align-left"></div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="sub-bg-white">
<div class="footer-close">
<button type="button" class="layui-btn layui-btn-normal" id="return">关闭</button>
</div>
<!-- <div class="fixed-btn">
<a id="basicBtn">基本信息</a>
<a id="accountAuthBtn">账户权限</a>
<a id="recordBtn">修改记录</a>
</div> -->
</div>
</main>
</div>
<script src="https://img02.glsx.com.cn/layui/layui.js"></script>
<script src="/js/load.js"></script>
<script>
layui.use(['request', 'helper', 'treeTab', 'table', 'laypage'], function () {
/** 变量 */
var $ = layui.$
var request = layui.request
var helper = layui.helper
var id = qs('id')
var treeTab = layui.treeTab
var table = layui.table
var laypage = layui.laypage
var merchantId = qs('merchantId')
var basicArr = ['staffName', 'staffPhone', 'entmicroName', 'staffJob', 'roleName', 'roleCode', 'merchantName', 'createdAccount']
var employeeData = {}
var visibleInferiorMerName = $('#visibleInferiorMerName')
var recordPage = {
pageNum: 1,
pageSize: 10
}
var recordPageOptions = {
elem: 'recordPage',
groups: 5,
layout: ['count', 'page', 'skip'],
jump: function (obj, first) {
recordPage.pageNum = obj.curr
recordPage.pageSize = obj.limit
//首次不执行
if (!first) {
//do something
getRecordTable()
}
}
}
var recordTable = table.render({
elem: '#recordTable',
page: false,
skin: 'nob',
height: 'full-300',
cols: [
[
{
field: 'index',
title: '序号',
align: 'center',
width: 60
},
{
field: 'operator',
title: '登录账户',
align: 'center'
},
{
field: 'productName',
title: '登录产品',
align: 'center'
},
{
field: 'ip',
title: '登录IP',
align: 'center'
},
{
field: 'modifyContent',
title: '修改内容',
align: 'center',
width: 220
},
{
field: 'userName',
title: '操作人',
align: 'center',
width: 180
},
{
field: 'createdTime',
title: '操作时间',
align: 'center',
width: 200
}
]
]
})
/** 调用方法 */
getById()
getRecordTable()
/** 触发事件 */
$('#return').on('click', function () {
if (window.location.hash) {
window.history.back(-1)
window.location.hash = ''
}
window.history.back(-1)
})
$('#basicBtn').on('click', function () {
document.querySelector('#basic').scrollIntoView(true)
})
$('#accountAuthBtn').on('click', function () {
document.querySelector('#accountAuth').scrollIntoView(true)
})
$('#recordBtn').on('click', function () {
document.querySelector('#record').scrollIntoView(true)
})
/** 定义方法 */
// 查询员工详情
function getById() {
var params = { id: id, method: 'merchants.api.staff.staffSearchRequest' }
request(params, function (res) {
if (res.code == '0') {
employeeData = helper.clone(true, res.data)
for (var i in basicArr) {
$('#' + [basicArr[i]]).text(employeeData[basicArr[i]] ? employeeData[basicArr[i]] : '无')
}
if (employeeData.visibleInferiorMerName) {
var visibleName = employeeData.visibleInferiorMerName.split(',')
$.each(visibleName, function (idx, i) {
if (employeeData.merchantName.indexOf(i) != -1) {
visibleInferiorMerName.append('<li class="visibleMerchant">' + i + '(本商户)' + '</li>')
} else {
visibleInferiorMerName.append('<li class="visibleMerchant">' + i + '</li>')
}
})
} else {
visibleInferiorMerName.remove()
}
// 账户权限
var authList = employeeData.accountTypeTreeResponseList
if (authList && authList.length != 0) {
$.each(authList, function (index, item) {
treeTab.tabAdd(
{
title: item.accounttypeName,
value: item.accounttypeId
},
true
)
var menuData = []
// for (var i = 0; i < item.products)
if (item.products && item.products.length != 0) {
$.each(item.products, function (idx, m) {
treeTab.treeTabDetail(
{
name: m.productName,
value: m.productId
},
item.accounttypeId,
m.merchantProTreeResponses
)
})
var filterName = 'treeTab' + item.accounttypeId
var productId = 'tab_' + item.accounttypeId + '_' + item.products[0].productId
treeTab.tabChange(filterName, productId)
}
})
treeTab.tabChange('roleAuth', authList[0].accounttypeId)
}
}
})
}
// 修改记录
function getRecordTable(isResetPageNum) {
var params = {
bussinessId: id,
moduleName: '员工模块',
pageNum: recordPage.pageNum,
pageSize: recordPage.pageSize,
method: 'merchants.api.menu.findLog'
}
request(params, function (res) {
var data = res.data
$.each(data.data, function (index, item) {
item.index = index + 1 + recordPage.pageSize * (recordPage.pageNum - 1)
data.data[index].modifyContent = item.module + '-' + item.action
})
var options = {
data: data.data
}
recordPageOptions.count = data.count
if (isResetPageNum) {
recordPageOptions.curr = 1
}
laypage.render(recordPageOptions)
recordTable.reload(options)
})
}
})
</script>
</body>
</html>