Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
h5
/
account
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 8fde78b2
authored
Sep 26, 2021
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改角色和员工列表页
1 parent
9b05ed52
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1748 additions
and
48 deletions
html/employee/add.html
html/employee/index.html
html/merchant/add.html
html/merchant/index.html
html/role/index.html
js/load.js
html/employee/add.html
View file @
8fde78b
...
@@ -135,8 +135,12 @@
...
@@ -135,8 +135,12 @@
</div>
</div>
<div
class=
"layui-form-item"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label required"
>
角色权限:
</label>
<label
class=
"layui-form-label required"
>
角色权限:
</label>
<div
class=
"layui-input-block"
>
<div
class=
"layui-input-block"
style=
"position: relative"
>
<select
name=
"roleIds"
id=
"roleAuth"
lay-verify=
"required"
></select>
<select
name=
"roleIds"
id=
"roleAuth"
lay-verify=
"required"
></select>
<div
id=
"btnGroup"
class=
"layui-btn-group hide"
style=
"position: absolute; top: 0; right: -170px;"
>
<button
type=
"button"
class=
"layui-btn"
id=
"refresh"
>
刷新
</button>
<button
type=
"button"
class=
"layui-btn"
id=
"addRole"
>
创建角色
</button>
</div>
</div>
</div>
</div>
</div>
<div
class=
"layui-form-item"
>
<div
class=
"layui-form-item"
>
...
@@ -205,7 +209,11 @@
...
@@ -205,7 +209,11 @@
var
merchantId
=
''
var
merchantId
=
''
var
visibleMerchant
=
{}
var
visibleMerchant
=
{}
pwd
.
attr
(
'readonly'
,
false
)
pwd
.
attr
(
'readonly'
,
false
)
var
user
=
helper
.
store
.
get
(
'user'
)
console
.
log
(
user
)
if
(
user
.
accountLevel
==
4
)
{
$
(
'#btnGroup'
).
addClass
(
'show'
)
}
// 判断是从商户过来还是员工
// 判断是从商户过来还是员工
if
(
qs
(
'channel'
))
{
if
(
qs
(
'channel'
))
{
getList
(
qs
(
'merchantId'
))
getList
(
qs
(
'merchantId'
))
...
@@ -275,6 +283,20 @@
...
@@ -275,6 +283,20 @@
pwd
.
val
(
''
)
pwd
.
val
(
''
)
})
})
// 刷新
$
(
'#refresh'
).
on
(
'click'
,
function
()
{
if
(
!
merchantId
)
{
layer
.
msg
(
'请选择所属商户!'
)
}
else
{
findRoleList
(
merchantId
)
}
})
// 创建角色
$
(
'#addRole'
).
on
(
'click'
,
function
()
{
go
(
'role'
,
'add'
,
null
,
true
)
})
// 提交表单
// 提交表单
form
.
on
(
'submit(employeeSubmit)'
,
function
(
data
)
{
form
.
on
(
'submit(employeeSubmit)'
,
function
(
data
)
{
if
(
visibleMerchant
.
getCheckedNodes
(
true
).
length
==
0
)
{
if
(
visibleMerchant
.
getCheckedNodes
(
true
).
length
==
0
)
{
...
@@ -389,6 +411,7 @@
...
@@ -389,6 +411,7 @@
request
(
params
,
function
(
res
)
{
request
(
params
,
function
(
res
)
{
if
(
res
.
code
==
'0'
)
{
if
(
res
.
code
==
'0'
)
{
var
list
=
res
.
data
var
list
=
res
.
data
roleAuth
.
empty
()
list
.
unshift
(
''
)
list
.
unshift
(
''
)
$
.
each
(
list
,
function
(
index
,
item
)
{
$
.
each
(
list
,
function
(
index
,
item
)
{
roleAuth
.
append
(
new
Option
(
item
.
roleName
,
item
.
id
))
roleAuth
.
append
(
new
Option
(
item
.
roleName
,
item
.
id
))
...
...
html/employee/index.html
View file @
8fde78b
...
@@ -23,6 +23,9 @@
...
@@ -23,6 +23,9 @@
.selector
{
.selector
{
width
:
110px
;
width
:
110px
;
}
}
.layui-layer-content
{
white-space
:
pre-line
;
}
</style>
</style>
<body>
<body>
...
@@ -102,26 +105,52 @@
...
@@ -102,26 +105,52 @@
// 商户名称列表
// 商户名称列表
var
merchantName
=
$
(
"#merchantName"
)
var
merchantName
=
$
(
"#merchantName"
)
var
status
=
$
(
'#status'
)
var
status
=
$
(
'#status'
)
var
cols
=
[
//创建table实例
var
employeeTable
=
table
.
render
({
elem
:
'#employeeTable'
,
skin
:
'nob'
,
cols
:
[
[
//表头
//表头
{
field
:
''
,
title
:
'序号'
,
type
:
'numbers'
,
width
:
80
},
{
field
:
''
,
title
:
'序号'
,
type
:
'numbers'
,
width
:
80
},
{
field
:
'staffName'
,
title
:
'员工姓名'
,
width
:
120
,
align
:
'center'
},
{
field
:
'staffName'
,
title
:
'员工姓名'
,
width
:
120
,
align
:
'center'
},
{
field
:
'staffCode'
,
title
:
'员工号'
,
align
:
'center'
},
//
{ field: 'staffCode', title: '员工号', align: 'center' },
{
field
:
'roleName'
,
title
:
'角色'
,
align
:
'center'
},
{
field
:
'roleName'
,
title
:
'角色'
,
align
:
'center'
},
{
field
:
'staffPhone'
,
title
:
'登录手机号'
,
align
:
'center'
,
width
:
125
},
{
field
:
'staffPhone'
,
title
:
'登录手机号'
,
align
:
'center'
,
width
:
125
},
{
field
:
'entmicroName'
,
title
:
'企微号'
,
align
:
'center'
,
width
:
125
},
{
field
:
'statusName'
,
title
:
'状态'
,
align
:
'center'
},
{
field
:
'statusName'
,
title
:
'状态'
,
align
:
'center'
},
{
field
:
'createdAccount'
,
title
:
'创建者'
,
align
:
'center'
},
{
field
:
'createdAccount'
,
title
:
'创建者'
,
align
:
'center'
},
{
field
:
'merchantName'
,
title
:
'商户名(商户号)'
,
align
:
'center'
,
width
:
160
},
{
field
:
'merchantName'
,
title
:
'商户名(商户号)'
,
align
:
'center'
,
width
:
160
},
{
field
:
'updatedTime'
,
title
:
'更新时间'
,
align
:
'center'
,
width
:
112
},
{
field
:
'updatedTime'
,
title
:
'更新时间'
,
align
:
'center'
,
width
:
112
},
{
fixed
:
'right'
,
title
:
'操作'
,
width
:
220
,
align
:
'left'
,
toolbar
:
'#employeeBar'
}
{
fixed
:
'right'
,
title
:
'操作'
,
width
:
220
,
align
:
'left'
,
toolbar
:
'#employeeBar'
},
{
field
:
'statusName'
,
title
:
'启用开关'
,
width
:
85
,
templet
:
'#switchTpl'
,
unresize
:
true
}
]
]
var
colums
=
[
//表头
{
field
:
''
,
title
:
'序号'
,
type
:
'numbers'
,
width
:
80
},
{
field
:
'staffName'
,
title
:
'员工姓名'
,
width
:
120
,
align
:
'center'
},
// { field: 'staffCode', title: '员工号', align: 'center' },
{
field
:
'entmicroName'
,
title
:
'员工企微号'
,
align
:
'center'
,
width
:
125
},
{
field
:
'roleName'
,
title
:
'角色'
,
align
:
'center'
},
{
field
:
'staffPhone'
,
title
:
'登录手机号'
,
align
:
'center'
,
width
:
125
},
{
field
:
'entmicroName'
,
title
:
'所属门店'
,
align
:
'center'
,
width
:
125
},
{
field
:
'entmicroName'
,
title
:
'所属企微'
,
align
:
'center'
,
width
:
125
},
{
field
:
'statusName'
,
title
:
'状态'
,
align
:
'center'
},
{
field
:
'updatedTime'
,
title
:
'更新时间'
,
align
:
'center'
,
width
:
112
},
{
fixed
:
'right'
,
title
:
'操作'
,
width
:
220
,
align
:
'left'
,
toolbar
:
'#employeeBar'
},
{
field
:
'statusName'
,
title
:
'启用开关'
,
width
:
85
,
templet
:
'#switchTpl'
,
unresize
:
true
}
]
]
var
gl
=
false
//创建table实例
var
employeeTable
=
table
.
render
({
elem
:
'#employeeTable'
,
skin
:
'nob'
,
cols
:
gl
?
[
cols
]
:
[
colums
],
done
:
function
(
res
,
curr
,
count
)
{
$
(
'.switch'
).
hover
(
function
()
{
// 鼠标移入
layer
.
tips
(
'启用前,你可先为该员工创建角色,配置其所需的功能权限。如下所示:\n\
1. 角色管理-创建角色;\n\
2. 选择员工账户-修改角色'
,
this
,
{
tips
:
[
4
,
'#666'
]});
},
function
()
{
// 鼠标移出
})
}
})
})
// 分页配置
// 分页配置
...
@@ -143,6 +172,7 @@
...
@@ -143,6 +172,7 @@
//首次不执行
//首次不执行
if
(
!
first
)
{
if
(
!
first
)
{
getTabelList
(
employeeTable
,
getSearch
())
getTabelList
(
employeeTable
,
getSearch
())
// 移入移出
}
}
}
}
}
}
...
@@ -203,6 +233,17 @@
...
@@ -203,6 +233,17 @@
})
})
}
}
})
})
//监听性别操作
form
.
on
(
'switch(sexDemo)'
,
function
(
obj
){
if
(
this
.
value
==
'-'
)
{
obj
.
elem
.
checked
=
false
form
.
render
(
'checkbox'
)
layer
.
msg
(
'您还未给该员工设置“角色”!\n\
设置角色:员工账户管理-修改-角色权限'
,
{
time
:
2000
})
}
})
/** 手动触发事件 */
/** 手动触发事件 */
// 查询事件
// 查询事件
$
(
'#employeeSearch'
).
on
(
'click'
,
function
()
{
$
(
'#employeeSearch'
).
on
(
'click'
,
function
()
{
...
@@ -213,12 +254,6 @@
...
@@ -213,12 +254,6 @@
// 新增点击事件
// 新增点击事件
$
(
'#addEmployee'
).
on
(
'click'
,
function
()
{
$
(
'#addEmployee'
).
on
(
'click'
,
function
()
{
go
(
'employee'
,
'add'
)
go
(
'employee'
,
'add'
)
// var value = merchantName.val()
// if (value) {
// go('employee', 'add', { merchantId: value })
// } else {
// layer.msg('请选择商户')
// }
})
})
// 导出
// 导出
...
@@ -232,6 +267,7 @@
...
@@ -232,6 +267,7 @@
})
})
})
})
/** 定义方法 */
/** 定义方法 */
// 初始化方法
// 初始化方法
function
init
()
{
function
init
()
{
...
@@ -326,6 +362,13 @@
...
@@ -326,6 +362,13 @@
<
a
class
=
"layui-btn-xs"
lay
-
event
=
"updateTime"
>
修改账户有效期
<
/a
>
<
a
class
=
"layui-btn-xs"
lay
-
event
=
"updateTime"
>
修改账户有效期
<
/a
>
<
/div
>
<
/div
>
</script>
</script>
<script
type=
"text/html"
id=
"switchTpl"
>
<!--
这里的
checked
的状态只是演示
-->
<
div
class
=
"switch"
>
<
input
type
=
"checkbox"
name
=
"sex"
value
=
"{{d.roleName}}"
lay
-
skin
=
"switch"
lay
-
text
=
"开|关"
lay
-
filter
=
"sexDemo"
{{
d
.
statusName
==
'1'
?
'checked'
:
''
}}
>
<
/div
>
</script>
</body>
</body>
</html>
</html>
\ No newline at end of file
\ No newline at end of file
html/merchant/add.html
0 → 100644
View file @
8fde78b
<!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"
/>
<style>
.edit-box
{
width
:
1046px
;
padding
:
20px
20px
;
color
:
#333333
;
background-color
:
#ffffff
;
margin
:
15px
auto
;
}
.edit-title
{
height
:
48px
;
line-height
:
48px
;
padding
:
0
10px
;
margin-bottom
:
15px
;
font-size
:
16px
;
font-weight
:
600
;
background
:
#F7F7F7
;
}
.edit-box
.layui-form-label
{
width
:
130px
;
}
.edit-box
.layui-form-item
.layui-input-inline
{
width
:
320px
;
}
.edit-box
.layui-form-item
.layui-input-inline.w-70
{
width
:
70%
;
}
.edit-box
.btn-no-border
{
border
:
none
;
}
.edit-box
.upload-img-box
{
position
:
relative
;
color
:
#999999
;
border
:
1px
dashed
#d9d9d9
;
cursor
:
pointer
;
}
.edit-box
.upload-img-box
.upload-img
{
position
:
absolute
;
top
:
0
;
left
:
0
;
}
.edit-box
.icon-add
{
position
:
absolute
;
top
:
45%
;
font-size
:
40px
;
left
:
50%
;
transform
:
translate3d
(
-50%
,
-50%
,
0
);
}
.edit-box
.m-t-10
{
margin-top
:
10px
;
}
.edit-box
.upload-img-wh
{
width
:
120px
!important
;
height
:
80px
;
}
.show
{
display
:
inline-block
;
}
.hide
{
display
:
none
;
}
.option-btns
{
height
:
38px
;
}
.wrap-add-signal
{
margin-top
:
11px
;
background-color
:
#1989FA
;
color
:
#fff
;
height
:
16px
;
line-height
:
16px
;
text-align
:
center
;
width
:
16px
;
border-radius
:
50%
;
}
.tips
{
display
:
inline-block
;
font-size
:
14px
;
color
:
#999
;
margin-left
:
160px
;
}
.form-right
{
position
:
absolute
;
right
:
0
;
top
:
0
;
transform
:
translateX
(
110%
);
}
.edit-box
#accountTypeEl
.layui-form-checked
span
,
#accountTypeEl
.layui-form-checked
:hover
span
{
background-color
:
#1989FA
!important
;
}
.edit-box
#accountTypeEl
.layui-form-checked
i
,
#accountTypeEl
.layui-form-checked
:hover
i
{
color
:
#1989FA
!important
;
}
</style>
<title>
商户编辑
</title>
</head>
<body>
<div
id=
"app"
>
<main>
<div
class=
"edit-box"
>
<!-- 基本信息 -->
<div
id=
"basicForm"
>
<form
class=
"layui-form"
lay-filter=
"merchantForm"
>
<div
class=
"layui-form-item edit-title"
style=
"position: relative;"
>
<div
class=
"layui-input-inline"
>
企业基本信息
</div>
<div
id=
"createMerchantEl"
class=
"layui-input-item hide"
style=
"position: absolute; right: 0; top: 5px; font-size: normal;"
>
<label
class=
"layui-form-label"
>
渠道:
</label>
<div
class=
"layui-input-inline"
>
<select
id=
"channelEl"
name=
"channelId"
lay-verify=
"channelId"
>
<option
value=
""
>
请选择
</option>
</select>
</div>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label required"
>
选择开通模式:
</label>
<div
class=
"layui-input-inline"
>
<input
type=
"radio"
name=
"sex"
value=
"男"
title=
"单店企微版"
><span>
(一个门店一个企微账户授权)
</span>
<input
type=
"radio"
name=
"sex"
value=
"女"
title=
"集团企微版"
><span>
(集团多个企微共用一个企微账户授权)
</span>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label required"
>
商户名称:
</label>
<div
class=
"layui-input-inline"
>
<input
class=
"layui-input"
maxlength=
"50"
name=
"merchantName"
required
lay-verify=
"required"
placeholder=
"请输入商户名称"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
商户简称:
</label>
<div
class=
"layui-input-inline"
>
<input
class=
"layui-input"
maxlength=
"15"
name=
"merchantAbbreviation"
placeholder=
"请输入商户简称"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
商户类型:
</label>
<div
class=
"layui-input-inline"
style=
"width: 100px; margin: 0;"
>
<select
name=
"merchantType"
id=
"merchantTypeEl"
lay-filter=
"merchantTypeFilter"
>
<option
value=
"1"
>
个人
</option>
<option
value=
"2"
>
企业
</option>
</select>
</div>
<div
class=
"layui-input-inline"
style=
"width: 220px;"
>
<input
class=
"layui-input"
maxlength=
"50"
lay-verify=
"merchantOrgcode"
name=
"merchantOrgcode"
id=
"merchantOrgcodeEl"
placeholder=
"请输入身份证号码"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
商户地址:
</label>
<div
class=
"layui-input-inline w-70"
>
<!-- <input style="color: #333333 !important;" name="merchantAddress" disabled
class="layui-input layui-btn-disabled" id="addrEl" placeholder="请选择商户地址"> -->
<div
class=
"m-t-10"
id=
"addrEl"
>
请选择商户地址
</div>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
></label>
<div
class=
"layui-input-inline"
>
<button
type=
"button"
class=
"layui-btn"
data-type=
"handleSelectAddr"
>
选择地址
</button>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
联系人:
</label>
<div
class=
"layui-input-inline"
>
<input
class=
"layui-input"
maxlength=
"15"
name=
"merchantLegalPerson"
placeholder=
"请输入联系人姓名"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label required"
>
联系电话:
</label>
<div
class=
"layui-input-inline"
>
<input
class=
"layui-input"
name=
"merchantLegalPersonPhone"
maxlength=
"11"
required
lay-verify=
"required|phone"
placeholder=
"请输入联系电话"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
></label>
<div
class=
"layui-input-inline"
>
<input
type=
"checkbox"
name=
"isloginName"
lay-filter=
"encrypt"
lay-skin=
"primary"
title=
"联系电话同时作为登录账户名"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
驻店联系人:
</label>
<div
class=
"layui-input-inline"
>
<input
class=
"layui-input"
name=
"residentContact"
maxlength=
"15"
placeholder=
"请输入驻店联系人"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
驻店电话:
</label>
<div
class=
"layui-input-inline"
>
<input
class=
"layui-input"
name=
"residentPhone"
maxlength=
"11"
placeholder=
"请输入驻店电话"
lay-verify=
"residentPhone"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
营业时间:
</label>
<div
class=
"layui-inline"
>
<div
class=
"layui-input-inline"
>
<input
type=
"text"
id=
"startDate"
class=
"layui-input"
name=
"bussinessBegintime"
placeholder=
"开始时间"
>
</div>
<div
class=
"layui-form-mid"
>
-
</div>
<div
class=
"layui-input-inline"
>
<input
type=
"text"
id=
"endDate"
class=
"layui-input"
name=
"bussinessEndtime"
placeholder=
"结束时间"
>
</div>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
营业范围:
</label>
<div
class=
"layui-input-inline"
id=
"busiScopeEl"
>
</div>
</div>
<div
class=
"layui-form-item"
id=
"custom-scope"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
></label>
<div>
<div
class=
"layui-input-inline"
>
<input
id=
"scopeCus"
class=
"layui-input business-scope-cust"
maxlength=
"15"
placeholder=
"请自定义营业范围,建议不超过10个"
>
</div>
<div
class=
"layui-input-inline option-btns"
>
<button
type=
"button"
class=
"layui-btn btn-no-border"
data-type=
"handleAddScope"
>
<i
class=
"layui-icon layui-icon-add-circle scope-btn"
></i>
</button>
<!-- <div class="wrap-add-signal" data-type="handleAddScope">
<i class="layui-icon"></i>
</div> -->
</div>
</div>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
主营品牌:
</label>
<div
class=
"layui-input-inline"
>
<input
class=
"layui-input"
placeholder=
"车型品牌"
id=
"brand"
>
<div
id=
"carBrandTree"
style=
"width: 300px; height: 200px; overflow-y: scroll;"
></div>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
门店照片:
</label>
<div
class=
"layui-input-inline upload-img-wh"
>
<div
class=
"upload-img-box"
>
<div
class=
"icon-add img-add0 show"
>
+
</div>
<img
class=
"upload-img upload-img-wh hide"
id=
"img0"
src=
""
>
<input
type=
"file"
id=
"upload0"
name=
'merhcnatImg0'
ref=
"file"
class=
"upload upload-img-box upload-img-wh"
accept=
"image/png, image/jpeg, image/gif, image/jpg"
data-idx=
"0"
style=
"opacity: 0;"
>
</div>
</div>
<div
class=
"layui-input-inline upload-img-wh"
>
<div
class=
"upload-img-box"
>
<div
class=
"icon-add img-add1 show"
>
+
</div>
<img
class=
"upload-img upload-img-wh hide"
id=
"img1"
src=
""
>
<input
type=
"file"
id=
"upload1"
name=
'merhcnatImg1'
ref=
"file"
class=
"upload upload-img-box upload-img-wh"
accept=
"image/png, image/jpeg, image/gif, image/jpg"
data-idx=
"1"
style=
"opacity: 0;"
>
</div>
</div>
<div
class=
"layui-input-inline upload-img-wh"
>
<div
class=
"upload-img-box"
>
<div
class=
"icon-add img-add2 show"
>
+
</div>
<img
class=
"upload-img upload-img-wh hide"
id=
"img2"
src=
""
>
<input
type=
"file"
id=
"upload2"
name=
'merhcnatImg2'
ref=
"file"
class=
"upload upload-img-box upload-img-wh"
accept=
"image/png, image/jpeg, image/gif, image/jpg"
data-idx=
"2"
style=
"opacity: 0;"
>
</div>
</div>
</div>
<div
class=
"layui-form-item"
>
<span
class=
"tips"
>
图片格式仅支持JPG,PNG格式,大小1M以内
</span>
</div>
<p
class=
"edit-title"
>
账户基本信息
</p>
<div
id=
"subMerchantEl"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label required"
>
上级商户:
</label>
<div
class=
"layui-input-inline w-70"
>
<!-- <input class="layui-input layui-btn-disabled" name="parentName" placeholder="请输入上级商户" disabled> -->
<div
class=
"m-t-10"
id=
"parentName"
></div>
</div>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label required"
>
登录账户名:
</label>
<div
class=
"layui-input-inline"
>
<input
class=
"layui-input"
id=
"merchantLoginAccountEl"
name=
"merchantLoginAccount"
maxlength=
"15"
placeholder=
"请输入登录账户名"
required
lay-verify=
"required|merchantLoginAccount"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label required"
>
登录密码:
</label>
<div
class=
"layui-input-inline"
>
<input
class=
"layui-input"
type=
"password"
id=
"password"
name=
"merchantLoginPassword"
maxlength=
"15"
placeholder=
"请输入登录密码"
required
lay-verify=
"required|merchantLoginPassword"
>
<button
type=
"button"
class=
"layui-btn form-right hide"
id=
"resetpsw"
>
重置密码
</button>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label required"
>
账户等级:
</label>
<div
class=
"layui-input-inline"
>
<select
id=
"accountLevelEl"
name=
"merchantAccountLevel"
required
lay-vertify=
"required"
lay-search
>
</select>
</div>
</div>
<div
class=
"layui-form-item"
id=
"effectiveShowEl"
>
<label
class=
"layui-form-label required"
>
账户有效期:
</label>
<div
class=
"layui-input-inline"
>
<select
id=
"validPeriodEl"
name=
"effectiveTime"
required
lay-vertify=
"required"
lay-search
>
</select>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label required"
>
账户类型:
</label>
<div
class=
"layui-input-inline w-70"
id=
"accountTypeEl"
>
</div>
</div>
<div
class=
"layui-form-item"
style=
"text-align: center;"
>
<button
id=
"firstBtn"
class=
"layui-btn"
lay-submit
lay-filter=
"handleFirstSubmit"
>
下一步
</button>
<button
type=
"reset"
class=
"layui-btn"
data-type=
"handleCancel"
>
取消
</button>
</div>
</form>
</div>
<!-- 权限树 -->
<div
id=
"authorityTree"
>
<!-- 树 -->
<!-- <div class="layui-form-item">
<label class="layui-form-label required">角色权限:</label>
<div class="layui-input-block" id="accountType"> -->
<!-- <input lay-filter="switch" type="checkbox" name="merchantId" value="1" title="引流渠道商" />
<input lay-filter="switch" type="checkbox" name="merchantId" value="2" title="服务商/合作商" /> -->
<!-- </div>
</div> -->
<div
class=
"layui-tab"
lay-filter=
"roleAuth"
>
<ul
class=
"layui-tab-title"
></ul>
<div
class=
"layui-tab-content"
></div>
</div>
<button
id=
"draft"
class=
"layui-btn"
>
存草稿
</button>
<button
id=
"preStep"
class=
"layui-btn"
>
上一步
</button>
<button
id=
"confirm"
class=
"layui-btn"
>
确定
</button>
<button
class=
"layui-btn"
data-type=
"handleCancel"
>
取消
</button>
</div>
</div>
</main>
</div>
<script
src=
"https://www.layuicdn.com/layui/layui.js"
></script>
<script
src=
"/js/load.js"
></script>
<script
src=
"/js/validator.js"
></script>
<script>
layui
.
use
([
'gtree'
,
'request'
,
'helper'
,
'layer'
,
'laydate'
,
'element'
,
'xmSelect'
,
'laytpl'
,
'validator'
],
function
()
{
var
tree
=
layui
.
gtree
var
request
=
layui
.
request
var
form
=
layui
.
form
var
laydate
=
layui
.
laydate
var
$
=
layui
.
$
var
validator
=
layui
.
validator
var
helper
=
layui
.
helper
var
element
=
layui
.
element
var
editData
=
{}
var
treeObj
=
null
var
all_nodes
=
[]
// 1-创建新商户;2-创建子商户;3-修改
var
editLevel
=
1
// 1-基本信息;2-权限树
var
step
=
1
var
merchantId
=
null
var
parentMerchantId
=
null
var
accountTypeVisible
=
false
// 是否工厂
var
isFactory
=
true
var
parentInfo
=
{}
var
isFreshSecond
=
true
var
scopeNum
=
1
var
merchantForm
=
{
channelId
:
''
,
merchantName
:
''
,
merchantAbbreviation
:
''
,
merchantType
:
''
,
merchantOrgcode
:
''
,
merchantLegalPerson
:
''
,
merchantLegalPersonPhone
:
''
,
isloginName
:
0
,
residentContact
:
''
,
residentPhone
:
''
,
bussinessBegintime
:
''
,
bussinessEndtime
:
''
,
lat
:
''
,
lng
:
''
,
merchantAddress
:
''
,
businessScope
:
''
,
merchantFiles
:
[]
}
var
baseData
=
{
channelList
:
[],
carBrandTreeList
:
[],
accountLevelList
:
[],
validPeriodList
:
[],
busiScopeList
:
[],
accountTypeList
:
[]
}
var
startDate
=
laydate
.
render
({
elem
:
'#startDate'
,
//指定元素
type
:
'time'
,
format
:
'HH:mm:ss'
,
done
:
function
(
value
,
date
)
{
//监听日期被切换
if
(
value
!=
""
)
{
date
.
month
=
date
.
month
-
1
endDate
.
config
.
min
=
date
}
else
{
endDate
.
config
.
min
=
startDate
.
config
.
min
}
lay
(
'#startDate'
).
html
(
value
)
}
})
var
endDate
=
laydate
.
render
({
elem
:
'#endDate'
,
//指定元素
type
:
'time'
,
format
:
'HH:mm:ss'
,
done
:
function
(
value
,
date
)
{
//监听日期被切换
if
(
value
!=
""
)
{
date
.
month
=
date
.
month
-
1
startDate
.
config
.
max
=
date
}
else
{
startDate
.
config
.
max
=
endDate
.
config
.
max
}
lay
(
'#endDate'
).
html
(
value
)
}
})
editLevel
=
qs
(
'editLevel'
)
isFactory
=
(
qs
(
'isFactory'
)
==
'true'
)
step
=
qs
(
'step'
)
var
pwd
=
$
(
'#password'
)
// 密码输入框
var
resetpsw
=
$
(
'#resetpsw'
)
// pwd.attr('readonly', false)
// 重置密码
resetpsw
.
on
(
'click'
,
function
()
{
pwd
.
attr
(
'readonly'
,
false
)
pwd
.
val
(
''
)
})
init
()
// 校验
form
.
verify
({
channelId
:
function
(
value
)
{
if
(
editLevel
==
1
&&
!
value
)
{
return
'必填项不能为空'
}
},
merchantOrgcode
:
function
(
value
)
{
var
merchantType
=
$
(
'#merchantTypeEl option:selected'
).
val
()
if
(
value
)
{
if
((
merchantType
==
1
)
&&
!
validator
.
checkIdCard
(
value
))
{
return
'请填入正确的身份证'
}
if
(
value
&&
validator
.
ISCHINESE2
.
test
(
value
))
{
return
'只能输入数字、字母和符号'
}
}
},
merchantLoginAccount
:
function
(
value
)
{
if
(
value
&&
value
.
length
<
3
)
{
return
'登录账户名请填入3-15位字符'
}
},
merchantLoginPassword
:
function
(
value
)
{
if
(
value
&&
value
.
length
<
6
)
{
return
'登录密码请填入6-15位字符'
}
},
residentPhone
:
function
(
value
)
{
if
(
value
&&
!
validator
.
checkPhoneNumber
(
value
))
{
return
'请填入正确的驻店电话'
}
}
})
form
.
on
(
'select(merchantTypeFilter)'
,
function
(
data
)
{
if
(
data
.
value
==
1
)
{
$
(
'#merchantOrgcodeEl'
).
attr
(
'placeholder'
,
'请输入身份证号码'
)
}
else
{
$
(
'#merchantOrgcodeEl'
).
attr
(
'placeholder'
,
'请输入组织机构号码'
)
}
})
form
.
on
(
'submit(handleFirstSubmit)'
,
function
(
data
)
{
var
formData
=
data
.
field
var
params
=
{
isloginName
:
0
}
var
fieldToFormNameList
=
[
'merchantName'
,
'merchantAbbreviation'
,
'merchantType'
,
'merchantOrgcode'
,
'merchantLegalPerson'
,
'merchantLegalPersonPhone'
,
'residentContact'
,
'residentPhone'
,
'merchantLoginAccount'
,
'merchantLoginPassword'
,
'merchantAccountLevel'
,
'effectiveTime'
]
if
(
formData
.
isloginName
==
'on'
)
{
params
.
isloginName
=
1
}
if
(
formData
.
bussinessBegintime
)
{
merchantForm
.
bussinessBegintime
=
formData
.
bussinessBegintime
params
.
bussinessBegintime
=
formData
.
bussinessBegintime
}
if
(
formData
.
bussinessEndtime
)
{
merchantForm
.
bussinessEndtime
=
formData
.
bussinessEndtime
params
.
bussinessEndtime
=
formData
.
bussinessEndtime
}
if
(
merchantForm
.
lat
)
{
params
.
lat
=
merchantForm
.
lat
params
.
lng
=
merchantForm
.
lng
params
.
merchantAddress
=
merchantForm
.
merchantAddress
}
$
.
each
(
fieldToFormNameList
,
function
(
index
,
item
)
{
merchantForm
[
item
]
=
formData
[
item
]
||
''
params
[
item
]
=
formData
[
item
]
||
''
})
if
(
merchantId
)
{
params
.
effectiveTime
=
merchantForm
.
effectiveTime
}
if
(
editLevel
==
1
)
{
merchantForm
.
channelId
=
formData
.
channelId
params
.
channelId
=
formData
.
channelId
}
else
{
params
.
channelId
=
merchantForm
.
channelId
}
var
checkClassNameList
=
[{
attr
:
'businessScope'
,
toString
:
','
},
{
attr
:
'accounttypeId'
,
toString
:
','
}]
$
.
each
(
checkClassNameList
,
function
(
index
,
item
)
{
var
checkedArr
=
[]
$
(
'input[class='
+
item
.
attr
+
']:checked'
).
each
(
function
()
{
checkedArr
.
push
(
$
(
this
).
val
())
})
if
(
checkedArr
.
length
)
{
if
(
item
.
toString
)
{
merchantForm
[
item
.
attr
]
=
checkedArr
.
join
(
item
.
toString
)
params
[
item
.
attr
]
=
checkedArr
.
join
(
item
.
toString
)
}
}
})
if
(
!
params
.
accounttypeId
)
{
layer
.
msg
(
'账户类型不能为空'
,
{
icon
:
5
,
anim
:
6
})
return
false
}
var
elList
=
$
(
'.business-scope-cust'
)
var
tempList
=
[]
$
.
each
(
elList
,
function
(
index
,
item
)
{
if
(
item
.
value
)
{
tempList
.
push
(
item
.
value
)
}
})
merchantForm
.
businessScopeCustomize
=
tempList
.
join
(
','
)
params
.
businessScopeCustomize
=
tempList
.
join
(
','
)
merchantForm
.
merchantBrand
=
treeObj
.
getCheckedNodes
(
true
)
params
.
merchantBrand
=
findId
(
merchantForm
.
merchantBrand
).
join
(
','
)
if
(
merchantForm
.
merchantFiles
.
length
)
{
params
.
merchantFiles
=
JSON
.
stringify
(
merchantForm
.
merchantFiles
)
}
if
(
merchantId
)
{
params
.
id
=
merchantId
if
(
!
isFactory
)
{
params
.
parentId
=
parentInfo
.
parentId
}
params
.
method
=
'cn.com.glsx.merchants.merchant.updateMerchant'
}
else
if
(
editLevel
==
1
)
{
params
.
method
=
'cn.com.glsx.merchants.merchant.saveMerchant'
}
else
if
(
editLevel
==
2
)
{
if
(
!
isFactory
)
{
params
.
parentId
=
parentInfo
.
parentId
}
params
.
method
=
'cn.com.glsx.merchants.merchant.saveMerchant'
}
// 保存状态 1.草稿 2.发布 3.注销 4.过期
if
(
merchantForm
.
status
)
{
params
.
status
=
merchantForm
.
status
}
else
{
params
.
status
=
1
}
request
(
params
,
function
(
res
)
{
if
(
res
.
code
==
'0'
)
{
if
(
editLevel
==
3
)
{
layer
.
msg
(
'操作成功'
,
{
icon
:
1
})
go
(
'merchant'
,
'index'
)
}
else
{
if
(
!
merchantId
)
{
merchantId
=
res
.
data
}
merchantForm
.
merchantAccountLevel
=
parseInt
(
merchantForm
.
merchantAccountLevel
)
getMerchantApi
(
merchantId
,
function
(
respone
)
{
form
.
val
(
'merchantForm'
,
respone
.
data
)
merchantForm
=
respone
.
data
if
(
merchantForm
.
merchantAddress
)
{
$
(
'#addrEl'
).
text
(
merchantForm
.
merchantAddress
)
}
accountTypeVisible
=
true
var
el
=
$
(
'#accountTypeEl'
)
el
.
empty
()
recoveryFile
()
getAccountType
()
baseIsShow
(
false
)
treeIsShow
(
true
)
if
(
isFreshSecond
)
{
getById
()
isFreshSecond
=
false
}
})
}
}
})
return
false
})
function
findId
(
nodeList
)
{
var
idList
=
[]
$
.
each
(
nodeList
,
function
(
index
,
item
)
{
idList
.
push
(
item
.
id
)
})
return
idList
}
// 按钮事件绑定
var
btnHandle
=
{
// 选择地址
handleSelectAddr
:
function
()
{
helper
.
store
.
set
(
'merchantMapObj'
,
merchantForm
)
layer
.
open
({
type
:
2
,
title
:
'选择地址'
,
area
:
[
'900px'
,
'600px'
],
btn
:
[
'确定'
,
'取消'
],
content
:
'map.html'
,
yes
:
function
(
index
,
layero
)
{
var
body
=
layer
.
getChildFrame
(
'body'
,
index
)
body
.
find
(
'#mapBtn'
).
click
()
var
res
=
helper
.
store
.
get
(
'merchantMapObj'
)
if
(
res
.
lat
&&
res
.
merchantAddress
)
{
merchantForm
.
lat
=
res
.
lat
merchantForm
.
lng
=
res
.
lng
merchantForm
.
merchantAddress
=
res
.
merchantAddress
$
(
'#addrEl'
).
text
(
merchantForm
.
merchantAddress
)
layer
.
close
(
index
)
}
else
{
layer
.
msg
(
'请选择地址'
,
{
icon
:
5
})
}
},
end
:
function
()
{
helper
.
store
.
remove
(
'merchantMapObj'
)
}
})
},
// 添加范围
handleAddScope
:
function
(
txt
)
{
if
(
scopeNum
<
10
)
{
scopeNum
=
scopeNum
+
1
var
parent
=
$
(
'#custom-scope'
)
var
subParent
=
$
(
'<div class="layui-form-item"><label class="layui-form-label"></label></div>'
)
var
child1
=
$
(
'<div class="layui-input-inline"></div>'
)
var
inputEl
=
$
(
'<input class="layui-input business-scope-cust" maxlength="15" placeholder="请自定义营业范围,建议不超过10个">'
)
var
child2
=
$
(
'<div class="layui-input-inline"></div>'
)
var
addBtn
=
$
(
'<button type="button" class="layui-btn btn-no-border"><i class="layui-icon layui-icon-add-circle"></i></button>'
)
var
deleteBtn
=
$
(
'<button type="button" class="layui-btn btn-no-border"><i class="layui-icon layui-icon-reduce-circle"></i></button>'
)
if
(
txt
)
{
inputEl
.
val
(
txt
)
}
addBtn
.
bind
(
'click'
,
function
(
e
)
{
btnHandle
.
handleAddScope
()
})
deleteBtn
.
bind
(
'click'
,
function
(
e
)
{
scopeNum
=
scopeNum
-
1
var
el
=
$
(
this
).
parent
().
parent
()
el
.
remove
()
})
child1
.
append
(
inputEl
)
child2
.
append
(
addBtn
)
child2
.
append
(
deleteBtn
)
subParent
.
append
(
child1
)
subParent
.
append
(
child2
)
parent
.
append
(
subParent
)
}
},
handleCancel
:
function
()
{
go
(
'merchant'
,
'index'
)
return
false
}
}
$
(
'.layui-btn'
).
on
(
'click'
,
function
()
{
var
type
=
$
(
this
).
data
(
'type'
)
if
(
btnHandle
[
type
])
{
btnHandle
[
type
]()
}
})
$
(
'.upload'
).
on
(
'change'
,
function
(
e
)
{
var
idx
=
$
(
this
).
data
(
'idx'
)
var
imgEl
=
$
(
'#img'
+
idx
)
var
el
=
$
(
'#upload'
+
idx
)
var
addEl
=
$
(
'.img-add'
+
idx
)
var
reader
=
new
FileReader
()
var
fileInfo
=
el
[
0
].
files
[
0
]
reader
.
readAsDataURL
(
fileInfo
)
reader
.
onload
=
function
(
e
)
{
if
(
e
)
{
var
imgFile
=
e
.
target
.
result
var
base64
=
fileInfo
.
name
.
split
(
'.'
)[
1
]
+
'@'
+
imgFile
.
split
(
','
)[
1
]
var
params
=
{
method
:
'glsx.accounts.biz.common.pictureUpload'
,
file
:
base64
}
request
(
params
,
function
(
result
)
{
merchantForm
.
merchantFiles
[
idx
]
=
{
fileUrl
:
result
.
data
,
fileName
:
''
}
imgEl
.
attr
(
'src'
,
result
.
data
)
imgEl
.
removeClass
(
'hide'
)
imgEl
.
addClass
(
'show'
)
addEl
.
removeClass
(
'show'
)
addEl
.
addClass
(
'hide'
)
},
{},
[
'file'
],
true
)
}
}
reader
.
onload
()
})
function
baseIsShow
(
isShow
)
{
if
(
isShow
)
{
$
(
'#basicForm'
).
show
()
}
else
{
$
(
'#basicForm'
).
hide
()
}
}
function
treeIsShow
(
isShow
)
{
if
(
isShow
)
{
$
(
'#authorityTree'
).
show
()
}
else
{
$
(
'#authorityTree'
).
hide
()
}
}
function
init
()
{
// var index = layer.load(2, {
// shade: true,
// time: 10 * 1000
// }); //又换了种风格,并且设定最长等待10秒
//关闭
// layer.close(index);
if
(
step
==
1
)
{
getPeriod
()
baseIsShow
(
true
)
treeIsShow
(
false
)
if
(
merchantId
)
{
resetpsw
.
removeClass
(
'hide'
)
resetpsw
.
addClass
(
'show'
)
}
if
(
isFactory
)
{
$
(
'#subMerchantEl'
).
hide
()
}
}
else
{
baseIsShow
(
false
)
treeIsShow
(
true
)
}
// 创建商户
if
(
editLevel
==
1
)
{
if
(
!
merchantId
)
{
getChannel
()
$
(
'#accountLevelEl'
).
attr
(
'disabled'
,
true
)
$
(
'#createMerchantEl'
).
removeClass
(
'hide'
)
$
(
'#createMerchantEl'
).
addClass
(
'show'
)
getBusiScope
()
getCarBrandTree
()
getAccountLevel
()
getAccountType
()
}
else
{
$
(
'#validPeriodEl'
).
attr
(
'disabled'
,
true
)
$
(
'#merchantLoginAccountEl'
).
attr
(
'disabled'
,
true
)
$
(
'#createMerchantEl'
).
removeClass
(
'show'
)
$
(
'#createMerchantEl'
).
addClass
(
'hide'
)
$
(
'#channelEl'
).
attr
(
'required'
)
// $('#channelEl').attr('disabled', true)
}
}
else
{
if
(
!
merchantId
)
{
merchantId
=
qs
(
'id'
)
}
if
(
merchantId
)
{
resetpsw
.
removeClass
(
'hide'
)
resetpsw
.
addClass
(
'show'
)
}
if
(
editLevel
==
3
)
{
$
(
'#firstBtn'
).
text
(
'确定'
)
$
(
'#preStep'
).
remove
()
if
(
step
==
1
)
{
$
(
'#validPeriodEl'
).
attr
(
'disabled'
,
true
)
$
(
'#merchantLoginAccountEl'
).
attr
(
'disabled'
,
true
)
accountTypeVisible
=
true
$
(
'#accountLevelEl'
).
attr
(
'disabled'
,
true
)
}
}
else
{
if
(
!
merchantId
&&
step
==
1
)
{
getBusiScope
()
getCarBrandTree
()
}
}
if
(
isFactory
)
{
getAccountLevel
()
getMerchantInfo
()
}
else
{
// 创建/编辑子商户
if
(
!
parentMerchantId
)
{
parentMerchantId
=
qs
(
'parentId'
)
}
$
(
'#validPeriodEl'
).
attr
(
'disabled'
,
true
)
$
(
'#effectiveShowEl'
).
addClass
(
'hide'
)
// $('#channelEl').attr('disabled', true)
if
(
editLevel
==
3
||
(
editLevel
==
2
&&
!
merchantId
))
{
getParentInfo
()
}
else
{
$
(
'#merchantLoginAccountEl'
).
attr
(
'disabled'
,
true
)
$
(
'#accountLevelEl'
).
attr
(
'disabled'
,
true
)
}
}
}
}
function
bindEvent
()
{
$
(
'#brand'
).
on
(
'input'
,
helper
.
debounce
(
function
()
{
var
txt
=
$
(
this
).
val
()
if
(
!
txt
)
{
treeObj
.
showNodes
(
all_nodes
)
}
else
{
var
nodesList
=
treeObj
.
getNodesByParamFuzzy
(
'label'
,
txt
)
show_nodes
=
helper
.
findShowNode
(
nodesList
,
all_nodes
)
treeObj
.
hideNodes
(
all_nodes
)
treeObj
.
showNodes
(
show_nodes
)
}
},
500
))
}
function
setCheckbox
(
checkedStr
,
attr
)
{
if
(
!
checkedStr
||
!
checkedStr
.
length
)
{
return
false
}
var
list
=
[]
if
(
layui
.
_isArray
(
checkedStr
))
{
list
=
checkedStr
}
else
{
list
=
checkedStr
.
split
(
','
)
}
$
.
each
(
list
,
function
(
index
,
item
)
{
$
(
'input[class='
+
attr
+
']'
).
attr
(
"checked"
,
true
)
})
}
function
getMerchantApi
(
id
,
fn
)
{
var
params
=
{
method
:
'cn.com.glsx.merchants.merchant.findMerchantDetail'
,
id
:
id
}
request
(
params
,
function
(
res
)
{
fn
&&
fn
(
res
)
})
}
// 子商户 - 获取父商户信息
function
getParentInfo
()
{
getMerchantApi
(
parentMerchantId
,
function
(
res
)
{
var
data
=
res
.
data
parentInfo
=
{
parentId
:
data
.
id
,
parentName
:
data
.
merchantName
+
'('
+
data
.
merchantNo
+
')'
,
parentAccountType
:
data
.
accountType
,
parentMerchantAccountLevel
:
data
.
merchantAccountLevel
,
channelId
:
data
.
channelId
,
effectiveTime
:
data
.
effectiveTime
}
merchantForm
.
channelId
=
parentInfo
.
channelId
var
attrList
=
[
'parentName'
]
$
.
each
(
attrList
,
function
(
index
,
item
)
{
$
(
'#'
+
item
).
text
(
parentInfo
[
item
])
})
form
.
val
(
'merchantForm'
,
parentInfo
)
if
(
editLevel
==
3
)
{
getMerchantInfo
()
$
(
'#accountLevelEl'
).
attr
(
'disabled'
,
true
)
}
else
{
if
(
step
==
1
)
{
getAccountType
()
}
}
if
(
step
==
1
)
{
getAccountLevel
()
}
})
}
// 获取商户信息
function
getMerchantInfo
()
{
getMerchantApi
(
merchantId
,
function
(
res
)
{
form
.
val
(
'merchantForm'
,
res
.
data
)
merchantForm
=
res
.
data
if
(
!
isFactory
)
{
merchantForm
.
channelId
=
parentInfo
.
channelId
}
if
(
merchantForm
.
merchantAddress
)
{
$
(
'#addrEl'
).
text
(
merchantForm
.
merchantAddress
)
}
if
(
merchantForm
.
status
!=
1
)
{
$
(
'#draft'
).
remove
()
}
if
(
merchantForm
.
merchantType
==
2
)
{
$
(
'#merchantOrgcodeEl'
).
attr
(
'placeholder'
,
'请输入组织机构号码'
)
}
if
(
step
==
1
)
{
getBusiScope
()
getCarBrandTree
()
getAccountType
()
recoveryBusiScopeCus
()
recoveryFile
()
}
else
{
getById
()
}
})
}
// 渠道
function
getChannel
()
{
getDictData
(
'channel'
,
function
(
res
)
{
baseData
.
channelList
=
res
.
data
setSelectOption
(
'#channelEl'
,
'channelList'
,
'dictValue'
,
'dictLabel'
)
})
}
// 品牌
function
getCarBrandTree
()
{
var
params
=
{
method
:
'cn.com.glsx.merchants.merchantCommon.getCarbrandTree'
}
request
(
params
,
function
(
res
)
{
baseData
.
carBrandTreeList
=
res
.
data
var
checkedList
=
[]
if
(
editLevel
==
3
&&
merchantForm
.
merchantBrand
)
{
checkedList
=
merchantForm
.
merchantBrand
.
split
(
','
)
$
.
each
(
checkedList
,
function
(
index
,
item
)
{
checkedList
[
index
]
=
parseInt
(
item
)
})
}
treeObj
=
tree
.
create
(
'carBrandTree'
,
res
.
data
,
{
checkedList
:
checkedList
})
if
(
checkedList
)
{
treeObj
.
checkNodes
(
checkedList
)
}
all_nodes
=
treeObj
.
transformToArray
(
treeObj
.
getNodes
())
bindEvent
()
})
}
// 获取字典数据
function
getDictData
(
dictType
,
fn
)
{
var
params
=
{
method
:
'cn.com.glsx.merchants.menu.findAllDictData'
,
dictType
:
dictType
}
request
(
params
,
function
(
res
)
{
fn
&&
fn
(
res
)
})
}
// 设置option
function
setSelectOption
(
elName
,
listName
,
optionId
,
optionLabel
)
{
var
el
=
$
(
elName
)
$
.
each
(
baseData
[
listName
],
function
(
index
,
item
)
{
el
.
append
(
new
Option
(
item
[
optionLabel
],
item
[
optionId
]))
})
form
.
render
(
'select'
)
}
// 设置input值
function
setInput
(
elName
,
value
)
{
$
(
elName
).
val
(
value
)
}
// 账户等级
function
getAccountLevel
()
{
getDictData
(
'account_level'
,
function
(
res
)
{
baseData
.
accountLevelList
=
res
.
data
if
(
!
isFactory
)
{
var
tempList
=
[]
$
.
each
(
baseData
.
accountLevelList
,
function
(
index
,
item
)
{
if
(
item
.
dictValue
>
parentInfo
.
parentMerchantAccountLevel
)
{
if
(
parentInfo
.
parentMerchantAccountLevel
==
1
&&
item
.
dictValue
==
3
)
{
}
else
{
tempList
.
push
(
baseData
.
accountLevelList
[
index
])
}
}
})
baseData
.
accountLevelList
=
tempList
}
setSelectOption
(
'#accountLevelEl'
,
'accountLevelList'
,
'dictValue'
,
'dictLabel'
)
})
}
// 有效期
function
getPeriod
()
{
getDictData
(
'account_validity_period'
,
function
(
res
)
{
baseData
.
validPeriodList
=
res
.
data
setSelectOption
(
'#validPeriodEl'
,
'validPeriodList'
,
'dictValue'
,
'dictLabel'
)
})
}
// 营业范围
function
getBusiScope
()
{
getDictData
(
'business_scope'
,
function
(
res
)
{
baseData
.
busiScopeList
=
res
.
data
var
checkedList
=
[]
if
(
editLevel
==
3
&&
merchantForm
.
businessScope
)
{
checkedList
=
merchantForm
.
businessScope
.
split
(
','
)
}
var
el
=
$
(
'#busiScopeEl'
)
$
.
each
(
baseData
.
busiScopeList
,
function
(
index
,
item
)
{
var
optionEl
=
$
(
'<input type="checkbox" class="businessScope" name="businessScope['
+
item
.
dictValue
+
']" title='
+
item
.
dictLabel
+
' value="'
+
item
.
dictValue
+
'" lay-skin="primary">'
)
// 修改-回显
if
(
editLevel
==
3
)
{
for
(
var
i
=
0
;
i
<=
checkedList
.
length
;
i
++
)
{
if
(
checkedList
[
i
]
==
item
.
dictValue
)
{
optionEl
.
attr
(
"checked"
,
true
)
break
}
}
}
el
.
append
(
optionEl
)
form
.
render
(
'checkbox'
)
})
})
}
// 恢复自定义营业范围
function
recoveryBusiScopeCus
()
{
if
(
merchantForm
.
businessScopeCustomize
)
{
var
scopeCusList
=
merchantForm
.
businessScopeCustomize
.
split
(
','
)
$
.
each
(
scopeCusList
,
function
(
index
,
item
)
{
if
(
index
!=
0
)
{
btnHandle
.
handleAddScope
(
item
)
}
else
{
$
(
'#scopeCus'
).
val
(
item
)
}
})
scopeNum
=
scopeCusList
.
length
}
}
// 恢复图片
function
recoveryFile
()
{
merchantForm
.
merchantFiles
=
[]
$
.
each
(
merchantForm
.
merchantFileResponses
,
function
(
index
,
item
)
{
var
imgEl
=
$
(
'#img'
+
index
)
var
el
=
$
(
'#upload'
+
index
)
var
addEl
=
$
(
'.img-add'
+
index
)
merchantForm
.
merchantFiles
[
index
]
=
{
fileUrl
:
item
.
fileUrl
,
fileName
:
item
.
fileName
}
imgEl
.
attr
(
'src'
,
item
.
fileUrl
)
imgEl
.
removeClass
(
'hide'
)
imgEl
.
addClass
(
'show'
)
addEl
.
removeClass
(
'show'
)
addEl
.
addClass
(
'hide'
)
})
}
// 账户类型
function
getAccountType
()
{
getDictData
(
'account_type'
,
function
(
res
)
{
baseData
.
accountTypeList
=
res
.
data
var
checkedList
=
[]
if
(
merchantId
&&
merchantForm
.
accountType
)
{
checkedList
=
merchantForm
.
accountType
.
split
(
','
)
}
var
el
=
$
(
'#accountTypeEl'
)
$
.
each
(
baseData
.
accountTypeList
,
function
(
index
,
item
)
{
if
(
parentMerchantId
)
{
var
parentLevelList
=
parentInfo
.
parentAccountType
.
split
(
','
)
for
(
var
k
=
0
;
k
<=
parentLevelList
.
length
;
k
++
)
{
if
(
item
.
dictValue
==
parseInt
(
parentLevelList
[
k
]))
{
var
optionEl
=
$
(
'<input type="checkbox" class="accounttypeId" name="accountType['
+
item
.
dictValue
+
']" title='
+
item
.
dictLabel
+
' value="'
+
item
.
dictValue
+
'">'
)
if
(
accountTypeVisible
)
{
optionEl
.
attr
(
'disabled'
,
true
)
}
// 修改-回显
if
(
merchantId
)
{
for
(
var
i
=
0
;
i
<=
checkedList
.
length
;
i
++
)
{
if
(
checkedList
[
i
]
==
item
.
dictValue
)
{
optionEl
.
attr
(
"checked"
,
true
)
break
}
}
}
el
.
append
(
optionEl
)
form
.
render
(
'checkbox'
)
break
}
}
}
else
{
var
optionEl
=
$
(
'<input type="checkbox" class="accounttypeId" name="accountType['
+
item
.
dictValue
+
']" title='
+
item
.
dictLabel
+
' value="'
+
item
.
dictValue
+
'">'
)
if
(
accountTypeVisible
)
{
optionEl
.
attr
(
'disabled'
,
true
)
}
// 修改-回显
if
(
merchantId
)
{
for
(
var
i
=
0
;
i
<=
checkedList
.
length
;
i
++
)
{
if
(
checkedList
[
i
]
==
item
.
dictValue
)
{
optionEl
.
attr
(
"checked"
,
true
)
break
}
}
}
el
.
append
(
optionEl
)
form
.
render
(
'checkbox'
)
}
})
})
}
// 数 - start
var
laytpl
=
layui
.
laytpl
var
xmSelect
=
layui
.
xmSelect
var
check_arr
=
[]
var
requestList
=
[]
var
templateData
=
{}
var
selectEl
=
{}
var
treeData
=
{}
var
menuFunTreeData
=
[]
// 商户的菜单权限树数据
var
active
=
{
/**
* 第一级tab添加
* item: {name: 选项卡名称, value: 选项卡值}
* roleAuth: 选项卡过滤器的名称 lay-filter绑定的名字
* content: 一个放置模板的视图容器,用于呈现渲染结果 带有id的div
* id:选项卡标题的lay-id属性值
* 需要引入laytpl 模块
* rolesAuth:模板的id
* view 放置模板的视图容器的dom
* templateData:用于渲染模板的数据
* productList:复选下拉框的list,修改过的数据{name: '', value: ''}
* products:对应的菜单下的产品list,包含了对应的权限树,原始数据,需作为参数传入treeTabAdd中,在实例化tree时传入的数据使用
*/
tabAdd
:
function
(
item
)
{
// 渠道的id,一层选项卡的id
var
id
=
item
.
value
// roleAuth 一层选项卡过滤器的名称
element
.
tabAdd
(
'roleAuth'
,
{
title
:
item
.
title
,
// 放置模板视图的上一级div
content
:
'<div id="role'
+
id
+
'"></div>'
,
// 选项卡标题的lay-id属性值
id
:
id
})
var
getTpl
=
'<div id="select{{d.id}}"></div> <div class="layui-tab layui-tab-brief" lay-filter="treeTab{{d.id}}"><ul class="layui-tab-title"></ul> <div class="layui-tab-content"></div></div>'
// var getTpl = tpl//rolesAuth.innerHTML, // 模板内容
view
=
document
.
getElementById
(
'role'
+
id
)
templateData
.
id
=
id
// 渲染模版的数据
laytpl
(
getTpl
).
render
(
templateData
,
function
(
html
)
{
view
.
innerHTML
=
html
})
var
productList
=
[]
var
products
=
[]
$
.
each
(
menuFunTreeData
,
function
(
index
,
item
)
{
if
(
item
.
accounttypeId
==
id
)
{
products
=
item
.
products
$
.
each
(
item
.
products
,
function
(
idx
,
i
)
{
productList
.
push
({
name
:
i
.
productName
,
value
:
i
.
productId
})
})
}
})
selectEl
[
id
]
=
xmSelect
.
render
({
el
:
'#select'
+
id
,
data
:
productList
,
on
:
function
(
data
)
{
//arr: 当前多选已选中的数据
var
arr
=
data
.
arr
//change, 此次选择变化的数据,数组
var
change
=
data
.
change
//isAdd, 此次操作是新增还是删除
var
isAdd
=
data
.
isAdd
var
filterName
=
'treeTab'
+
id
if
(
isAdd
)
{
active
.
treeTabAdd
(
change
[
0
],
id
,
products
)
}
else
{
var
productId
=
'tab_'
+
id
+
'_'
+
change
[
0
].
value
delete
treeData
[
id
][
change
[
0
].
value
]
active
.
tabDelete
(
filterName
,
productId
)
}
if
(
arr
.
length
!=
0
)
{
var
productId
=
'tab_'
+
id
+
'_'
+
arr
[
0
].
value
active
.
tabChange
(
filterName
,
productId
)
}
}
})
},
// tab删除
tabDelete
:
function
(
name
,
id
)
{
element
.
tabDelete
(
name
,
id
)
},
// tab Change
tabChange
:
function
(
name
,
id
)
{
element
.
tabChange
(
name
,
id
)
},
/**
* 第二级选项卡
* treeTabAdd 产品的权限添加
* item: {name: 选项卡名称, value: 选项卡值}
* id 第一级选项卡的item.value
* filterName: 过滤器的名称 lay-filter绑定的值
* treeData:渲染模板的数据,和用来存放对应树实例的对象,
* products:产品list数组
* defaultList:编辑时传入,默认勾选中的数组。(举例:[1,2,3])
*/
treeTabAdd
:
function
(
item
,
id
,
products
,
defaultList
)
{
var
productId
=
'tab_'
+
id
+
'_'
+
item
.
value
var
filterName
=
'treeTab'
+
id
// 过滤器的名称 lay-filter
element
.
tabAdd
(
filterName
,
{
title
:
item
.
name
,
content
:
'<div id="treeTab'
+
productId
+
'"></div>'
,
// 放置模板视图的div
id
:
productId
})
var
getTreeTpl
=
treeAuth
.
innerHTML
,
// 获取的模板的id的内容
treeView
=
document
.
getElementById
(
'treeTab'
+
productId
)
// 放置模板视图的div
treeData
[
id
]
=
treeData
[
id
]
||
{}
treeData
[
id
][
item
.
value
]
=
treeData
[
id
][
item
.
value
]
||
{}
treeData
[
id
][
item
.
value
].
id
=
productId
// 渲染模版的数据
treeData
[
id
][
item
.
value
].
productId
=
item
.
value
laytpl
(
getTreeTpl
).
render
(
treeData
[
id
][
item
.
value
],
function
(
html
)
{
treeView
.
innerHTML
=
html
})
var
treeListData
=
[]
$
.
each
(
products
,
function
(
index
,
i
)
{
if
(
item
.
value
==
i
.
productId
)
{
treeListData
=
i
.
merchantProTreeResponses
}
})
var
treedom
=
'tree_'
+
productId
// if (!merchantId) {
if
(
editLevel
==
1
||
editLevel
==
2
)
{
treeData
[
id
][
item
.
value
].
treeObj
=
tree
.
create
(
treedom
,
treeListData
)
treeData
[
id
][
item
.
value
].
treeObj
.
checkAllNodes
(
true
)
}
else
{
treeData
[
id
][
item
.
value
].
treeObj
=
tree
.
create
(
treedom
,
treeListData
,
{
checkedList
:
defaultList
})
if
(
defaultList
)
treeData
[
id
][
item
.
value
].
treeObj
.
checkNodes
(
defaultList
)
}
}
}
// 查询商户的菜单权限树
function
findMenuFunTreeByMerId
()
{
var
params
=
{}
if
(
parentMerchantId
)
{
params
=
{
method
:
'cn.com.glsx.merchants.merchant.findMenuFunTreeByMerId'
,
id
:
merchantId
,
parentId
:
parentMerchantId
,
accountlevel
:
merchantForm
.
merchantAccountLevel
}
}
else
{
params
=
{
method
:
'cn.com.glsx.merchants.merchant.accountTypeSearchRequest'
,
ids
:
merchantForm
.
accountType
,
merchantId
:
merchantId
,
accountLevel
:
merchantForm
.
merchantAccountLevel
}
}
request
(
params
,
function
(
res
)
{
if
(
res
.
code
==
'0'
)
{
menuFunTreeData
=
res
.
data
var
accountType
=
$
(
'#accountType'
)
$
.
each
(
menuFunTreeData
,
function
(
index
,
item
)
{
var
str
=
$
(
'<input lay-filter="switch" type="checkbox" name="accounttypeId" value="'
+
item
.
accounttypeId
+
'" title="'
+
item
.
accounttypeName
+
'" />'
)
accountType
.
append
(
str
)
if
(
merchantId
)
{
// 角色权限的check
for
(
var
i
=
0
;
i
<
check_arr
.
length
;
i
++
)
{
if
(
check_arr
[
i
].
accounttypeId
==
item
.
accounttypeId
)
{
var
productData
=
check_arr
[
i
]
str
.
attr
(
"checked"
,
true
)
var
obj
=
{
title
:
item
.
accounttypeName
,
value
:
item
.
accounttypeId
}
active
.
tabAdd
(
obj
)
var
selectArr
=
[]
var
menuData
=
[]
for
(
var
j
=
0
;
j
<
productData
.
products
.
length
;
j
++
)
{
menuData
=
productData
.
products
[
j
]
selectArr
.
push
(
menuData
.
productId
)
var
idList
=
''
if
(
menuData
.
menuIds
)
{
idList
=
menuData
.
menuIds
.
concat
(
menuData
.
functionIds
)
}
else
{
idList
=
menuData
.
functionIds
}
active
.
treeTabAdd
({
name
:
menuData
.
productName
,
value
:
menuData
.
productId
},
item
.
accounttypeId
,
item
.
products
,
idList
)
}
// // 产品的回显
selectEl
[
item
.
accounttypeId
].
setValue
(
selectArr
)
var
filterName
=
'treeTab'
+
item
.
accounttypeId
var
productId
=
'tab_'
+
item
.
accounttypeId
+
'_'
+
item
.
products
[
0
].
productId
active
.
tabChange
(
filterName
,
productId
)
// 树的回显
}
}
if
(
check_arr
.
length
!=
0
)
{
active
.
tabChange
(
'roleAuth'
,
check_arr
[
0
].
accounttypeId
)
}
}
})
form
.
render
(
'checkbox'
)
}
})
}
// 根据id获取角色详情
function
getById
()
{
var
params
=
{
method
:
'cn.com.glsx.merchants.merchant.findPermissionsByMerId'
,
id
:
merchantId
}
request
(
params
,
function
(
res
)
{
if
(
res
.
code
==
'0'
)
{
var
accounttypeId
=
''
if
(
res
.
data
)
{
check_arr
=
res
.
data
}
findMenuFunTreeByMerId
()
form
.
val
(
'roleForm'
,
{
roleName
:
res
.
data
.
roleName
,
roleDescription
:
res
.
data
.
roleDescription
})
}
})
}
// 获取角色权限数据requestList
function
getAuthList
()
{
requestList
=
[]
for
(
var
key
in
treeData
)
{
var
accountObj
=
treeData
[
key
]
var
productList
=
[]
for
(
var
i
in
accountObj
)
{
var
productObj
=
accountObj
[
i
]
var
menuIds
=
[]
var
functionIds
=
[]
var
functionIdLists
=
[]
var
functionValueIdLists
=
[]
var
nodes
=
productObj
.
treeObj
.
getCheckedNodes
(
true
)
$
.
each
(
nodes
,
function
(
index
,
item
)
{
if
(
item
.
logo
==
'function'
)
{
functionIdLists
.
push
(
item
)
}
else
if
(
item
.
logo
==
'functionValue'
)
{
functionValueIdLists
.
push
(
item
)
}
else
{
if
(
item
.
logo
!=
'neglect'
)
{
menuIds
.
push
(
item
.
id
)
}
}
})
$
.
each
(
functionValueIdLists
,
function
(
idx
,
m
)
{
var
findIdx
=
-
1
$
.
each
(
functionIds
,
function
(
idn
,
n
)
{
if
(
n
.
functionId
==
m
.
parentId
)
{
findIdx
=
idn
}
})
if
(
findIdx
!=
-
1
)
{
functionIds
[
findIdx
].
functionValue
+=
';'
+
m
.
id
+
':'
+
m
.
label
}
else
{
functionIds
.
push
({
functionId
:
m
.
parentId
,
mendId
:
m
.
superParentId
,
functionValue
:
m
.
id
+
':'
+
m
.
label
})
}
})
$
.
each
(
functionIdLists
,
function
(
idx
,
m
)
{
functionIds
.
push
({
functionId
:
m
.
parentId
,
mendId
:
m
.
superParentId
})
})
productList
.
push
({
productId
:
productObj
.
productId
,
functionIds
:
functionIds
,
menuIds
:
menuIds
})
}
requestList
.
push
({
accountTypeId
:
key
,
products
:
productList
})
}
}
$
(
'#draft'
).
on
(
'click'
,
function
()
{
getAuthList
()
var
params
=
{
merchantId
:
merchantId
,
accountTypes
:
JSON
.
stringify
(
requestList
),
method
:
'cn.com.glsx.merchants.merchant.updatePermissions'
,
status
:
merchantForm
.
status
}
request
(
params
,
function
(
res
)
{
if
(
res
.
code
==
'0'
)
{
layer
.
msg
(
'操作成功'
,
{
icon
:
1
})
go
(
'merchant'
,
'index'
)
}
})
return
false
})
$
(
'#preStep'
).
on
(
'click'
,
function
()
{
step
=
1
init
()
})
$
(
'#confirm'
).
on
(
'click'
,
function
()
{
getAuthList
()
var
params
=
{
merchantId
:
merchantId
,
accountTypes
:
JSON
.
stringify
(
requestList
)
}
params
.
method
=
'cn.com.glsx.merchants.merchant.updatePermissions'
// 草稿
if
(
merchantForm
.
status
==
1
)
{
params
.
status
=
2
}
else
{
params
.
status
=
merchantForm
.
status
}
request
(
params
,
function
(
res
)
{
if
(
res
.
code
==
'0'
)
{
layer
.
msg
(
'操作成功'
,
{
icon
:
1
})
go
(
'merchant'
,
'index'
)
}
})
return
false
})
})
</script>
<script
type=
"text/html"
id=
"rolesAuth"
>
<
div
id
=
"select{{d.id}}"
><
/div
>
<
div
class
=
"layui-tab layui-tab-brief"
lay
-
filter
=
"treeTab{{d.id}}"
>
<
ul
class
=
"layui-tab-title"
>
<
/ul
>
<
div
class
=
"layui-tab-content"
>
<
/div
>
<
/div
>
</script>
<script
type=
"text/html"
id=
"treeAuth"
>
<!--
<
button
class
=
"layui-btn"
data
-
type
=
"d.id"
id
=
"checkedAll"
>
全选
<
/button
>
<
button
class
=
"layui-btn"
id
=
"cancelCheckedAll"
>
取消全选
<
/button> --
>
<
ul
id
=
"tree_{{d.id}}"
class
=
"ztree wrapper-tree"
><
/ul
>
</script>
</body>
</html>
\ No newline at end of file
\ No newline at end of file
html/merchant/index.html
View file @
8fde78b
...
@@ -129,17 +129,18 @@
...
@@ -129,17 +129,18 @@
<
div
>
<
div
>
<
a
class
=
"layui-btn-xs"
lay
-
event
=
"handleDetail"
>
查看
<
/a
>
<
a
class
=
"layui-btn-xs"
lay
-
event
=
"handleDetail"
>
查看
<
/a
>
{{
#
if
((
d
.
btn
.
edit
)){
}}
{{
#
if
((
d
.
btn
.
edit
)){
}}
<
a
class
=
"layui-btn-xs"
lay
-
event
=
"handleEdit"
>
修改基本信息
<
/a
>
<!--
<
a
class
=
"layui-btn-xs"
lay
-
event
=
"handleEdit"
>
修改基本信息
<
/a> --
>
<
a
class
=
"layui-btn-xs"
lay
-
event
=
"handleEdit"
>
修改
<
/a
>
{{
#
}
}}
{{
#
}
}}
<
/div
>
<
/div
>
<
div
>
<
!--
<
div
>
{{
#
if
((
d
.
btn
.
edit
)){
}}
{{
#
if
((
d
.
btn
.
edit
)){
}}
<
a
class
=
"layui-btn-xs"
lay
-
event
=
"handleAuthority"
>
修改权限
<
/a
>
<
a
class
=
"layui-btn-xs"
lay
-
event
=
"handleAuthority"
>
修改权限
<
/a
>
{{
#
}
}}
{{
#
}
}}
{{
#
if
((
d
.
btn
.
editPeriod
)){
}}
{{
#
if
((
d
.
btn
.
editPeriod
)){
}}
<
a
class
=
"layui-btn-xs"
lay
-
event
=
"handleVaildPeriod"
>
修改账户有效期
<
/a
>
<
a
class
=
"layui-btn-xs"
lay
-
event
=
"handleVaildPeriod"
>
修改账户有效期
<
/a
>
{{
#
}
}}
{{
#
}
}}
<
/div
>
<
/div>
--
>
<
div
>
<
div
>
{{
#
if
((
d
.
btn
.
createStaff
)){
}}
{{
#
if
((
d
.
btn
.
createStaff
)){
}}
<
a
class
=
"layui-btn-xs"
lay
-
event
=
"handleAddStaff"
>
创建员工
<
/a
>
<
a
class
=
"layui-btn-xs"
lay
-
event
=
"handleAddStaff"
>
创建员工
<
/a
>
...
@@ -149,6 +150,10 @@
...
@@ -149,6 +150,10 @@
{{
#
}
}}
{{
#
}
}}
<
/div
>
<
/div
>
</script>
</script>
<script
type=
"text/html"
id=
"vaildPeriod"
>
{{
#
if
((
d
.
btn
.
editPeriod
)){
}}
<
a
class
=
"layui-btn-xs"
lay
-
event
=
"handleVaildPeriod"
>
修改账户有效期
<
/a
>
{{
#
}
}}
</script>
<script>
<script>
layui
.
use
([
'gtree'
,
'request'
,
'helper'
,
'table'
,
'laypage'
,
'layer'
],
function
()
{
layui
.
use
([
'gtree'
,
'request'
,
'helper'
,
'table'
,
'laypage'
,
'layer'
],
function
()
{
var
tree
=
layui
.
gtree
var
tree
=
layui
.
gtree
...
@@ -189,13 +194,7 @@
...
@@ -189,13 +194,7 @@
}
}
}
}
}
}
var
cols
=
[{
var
merchantTable
=
table
.
render
({
elem
:
'#merchantTable'
,
page
:
false
,
skin
:
'nob'
,
cols
:
[
[{
field
:
'index'
,
field
:
'index'
,
title
:
'序号'
,
title
:
'序号'
,
align
:
'center'
,
align
:
'center'
,
...
@@ -209,6 +208,10 @@
...
@@ -209,6 +208,10 @@
title
:
'商户名称'
,
title
:
'商户名称'
,
align
:
'center'
align
:
'center'
},
{
},
{
field
:
'merchantName'
,
title
:
'模式'
,
align
:
'center'
},
{
field
:
'accountTypeNames'
,
field
:
'accountTypeNames'
,
title
:
'账户类型'
,
title
:
'账户类型'
,
align
:
'left'
,
align
:
'left'
,
...
@@ -241,10 +244,68 @@
...
@@ -241,10 +244,68 @@
align
:
'center'
,
align
:
'center'
,
width
:
120
width
:
120
},
{
},
{
field
:
'merchantAddress'
,
field
:
'merchantLegalPersonPhone'
,
title
:
'商户地址'
,
title
:
'关联的企业微信'
,
align
:
'center'
,
width
:
120
// }, {
// field: 'merchantAddress',
// title: '商户地址',
// align: 'center',
// width: 160
},
{
field
:
'updatedTime'
,
title
:
'更新时间'
,
align
:
'center'
,
width
:
112
},
{
align
:
'left'
,
title
:
'操作'
,
toolbar
:
'#merchantBtns'
,
width
:
220
// fixed: 'right'
}]
var
colums
=
[{
field
:
'index'
,
title
:
'序号'
,
align
:
'center'
,
width
:
60
},
{
field
:
'merchantName'
,
title
:
'商户名称'
,
align
:
'center'
},
{
field
:
'accountTypeNames'
,
title
:
'账户类型'
,
align
:
'left'
,
width
:
100
,
templet
:
'#accountTypeTpl'
},
{
field
:
'merchantLoginAccount'
,
title
:
'登录账户'
,
align
:
'center'
,
width
:
108
},
{
field
:
'accountLevelName'
,
title
:
'账户等级'
,
align
:
'center'
},
{
field
:
'parentMerchant'
,
title
:
'上级商户'
,
align
:
'center'
},
{
field
:
'statusName'
,
title
:
'账户状态'
,
align
:
'center'
},
{
field
:
'merchantLegalPerson'
,
title
:
'联系人'
,
align
:
'center'
},
{
field
:
'merchantLegalPersonPhone'
,
title
:
'手机号'
,
align
:
'center'
,
align
:
'center'
,
width
:
16
0
width
:
12
0
},
{
},
{
field
:
'updatedTime'
,
field
:
'updatedTime'
,
title
:
'更新时间'
,
title
:
'更新时间'
,
...
@@ -256,8 +317,20 @@
...
@@ -256,8 +317,20 @@
toolbar
:
'#merchantBtns'
,
toolbar
:
'#merchantBtns'
,
width
:
220
width
:
220
// fixed: 'right'
// fixed: 'right'
},
{
align
:
'left'
,
title
:
'账户开关'
,
toolbar
:
'#vaildPeriod'
,
width
:
150
// fixed: 'right'
}]
}]
]
var
gl
=
false
var
merchantTable
=
table
.
render
({
elem
:
'#merchantTable'
,
page
:
false
,
skin
:
'nob'
,
cols
:
gl
?
[
cols
]
:
[
colums
]
})
})
table
.
on
(
'tool(merchant-table-filter)'
,
function
(
obj
)
{
table
.
on
(
'tool(merchant-table-filter)'
,
function
(
obj
)
{
...
@@ -300,7 +373,7 @@
...
@@ -300,7 +373,7 @@
// 创建子商户/门店
// 创建子商户/门店
case
'handleAddMerchant'
:
case
'handleAddMerchant'
:
// 1-创建新商户;2-创建子商户;3-修改
// 1-创建新商户;2-创建子商户;3-修改
go
(
'merchant'
,
'
edit
'
,
{
go
(
'merchant'
,
'
add
'
,
{
editLevel
:
2
,
editLevel
:
2
,
parentId
:
row
.
id
,
parentId
:
row
.
id
,
isFactory
:
'false'
,
isFactory
:
'false'
,
...
@@ -351,7 +424,7 @@
...
@@ -351,7 +424,7 @@
$
(
'#addBtn'
).
on
(
'click'
,
function
()
{
$
(
'#addBtn'
).
on
(
'click'
,
function
()
{
// 1-创建新商户;2-创建子商户;3-修改
// 1-创建新商户;2-创建子商户;3-修改
go
(
'merchant'
,
'
edit
'
,
{
go
(
'merchant'
,
'
add
'
,
{
editLevel
:
1
,
editLevel
:
1
,
step
:
1
,
step
:
1
,
isFactory
:
'true'
isFactory
:
'true'
...
@@ -516,7 +589,7 @@
...
@@ -516,7 +589,7 @@
// 功能点按需出现
// 功能点按需出现
function
elRemove
()
{
function
elRemove
()
{
$
(
'#operateEl'
).
remove
()
//
$('#operateEl').remove()
}
}
function
init
()
{
function
init
()
{
...
...
html/role/index.html
View file @
8fde78b
...
@@ -35,11 +35,22 @@
...
@@ -35,11 +35,22 @@
</div>
</div>
</div>
</div>
<div
class=
"layui-inline"
>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
状态
</label>
<div
class=
"layui-input-block"
>
<select
name=
"status"
id=
"status"
lay-verify=
"required"
>
<option
value=
""
>
全部
</option>
<option
value=
"0"
>
草稿
</option>
<option
value=
"1"
>
启用
</option>
</select>
</div>
</div>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
角色名称
</label>
<label
class=
"layui-form-label"
>
角色名称
</label>
<div
class=
"layui-input-block"
>
<div
class=
"layui-input-block"
>
<input
type=
"text"
name=
"roleName"
placeholder=
"请输入角色名称"
autocomplete=
"off"
class=
"layui-input"
/>
<input
type=
"text"
name=
"roleName"
placeholder=
"请输入角色名称"
autocomplete=
"off"
class=
"layui-input"
/>
</div>
</div>
</div>
</div>
<div
class=
"layui-inline searchBtn"
pane
>
<div
class=
"layui-inline searchBtn"
pane
>
<button
type=
"button"
class=
"layui-btn layui-btn-normal"
id=
"roleSearch"
>
查询
</button>
<button
type=
"button"
class=
"layui-btn layui-btn-normal"
id=
"roleSearch"
>
查询
</button>
</div>
</div>
...
@@ -65,12 +76,7 @@
...
@@ -65,12 +76,7 @@
var
$
=
layui
.
$
var
$
=
layui
.
$
// 商户名称列表
// 商户名称列表
var
merchantName
=
$
(
"#merchantName"
)
var
merchantName
=
$
(
"#merchantName"
)
//创建table实例
var
cols
=
[
var
roleTable
=
table
.
render
({
elem
:
'#roleTable'
,
skin
:
'nob'
,
cols
:
[
[
//表头
//表头
{
field
:
''
,
title
:
'序号'
,
type
:
'numbers'
,
width
:
80
},
{
field
:
''
,
title
:
'序号'
,
type
:
'numbers'
,
width
:
80
},
{
field
:
'roleName'
,
title
:
'角色名称'
,
align
:
'center'
},
{
field
:
'roleName'
,
title
:
'角色名称'
,
align
:
'center'
},
...
@@ -80,7 +86,21 @@
...
@@ -80,7 +86,21 @@
{
field
:
'updatedTime'
,
title
:
'更新时间'
,
align
:
'center'
,
width
:
112
},
{
field
:
'updatedTime'
,
title
:
'更新时间'
,
align
:
'center'
,
width
:
112
},
{
fixed
:
'right'
,
title
:
'操作'
,
width
:
160
,
align
:
'center'
,
toolbar
:
'#roleBar'
}
{
fixed
:
'right'
,
title
:
'操作'
,
width
:
160
,
align
:
'center'
,
toolbar
:
'#roleBar'
}
]
]
var
colums
=
[
{
field
:
''
,
title
:
'序号'
,
type
:
'numbers'
,
width
:
80
},
{
field
:
'roleName'
,
title
:
'角色名称'
,
align
:
'center'
},
{
field
:
'roleCode'
,
title
:
'角色号'
,
align
:
'center'
},
{
field
:
'statusName'
,
title
:
'状态'
,
align
:
'center'
},
{
field
:
'createdTime'
,
title
:
'创建时间'
,
align
:
'center'
},
{
field
:
'updatedTime'
,
title
:
'更新时间'
,
align
:
'center'
,
width
:
112
},
{
fixed
:
'right'
,
title
:
'操作'
,
width
:
160
,
align
:
'center'
,
toolbar
:
'#roleBar'
}
]
]
var
gl
=
false
//创建table实例
var
roleTable
=
table
.
render
({
elem
:
'#roleTable'
,
skin
:
'nob'
,
cols
:
gl
?
[
cols
]
:
[
colums
]
})
})
// 分页配置
// 分页配置
...
@@ -179,13 +199,6 @@
...
@@ -179,13 +199,6 @@
// 新增点击事件
// 新增点击事件
$
(
'#addRole'
).
on
(
'click'
,
function
()
{
$
(
'#addRole'
).
on
(
'click'
,
function
()
{
go
(
'role'
,
'add'
)
go
(
'role'
,
'add'
)
// var value = merchantName.val()
// var params = { merchantId: value }
// if (value) {
// go('role', 'add', params)
// } else {
// layer.msg('请选择商户')
// }
})
})
// 查询事件
// 查询事件
$
(
'#roleSearch'
).
on
(
'click'
,
function
()
{
$
(
'#roleSearch'
).
on
(
'click'
,
function
()
{
...
...
js/load.js
View file @
8fde78b
...
@@ -15,10 +15,15 @@
...
@@ -15,10 +15,15 @@
/**
/**
* 跳转方法 TODO
* 跳转方法 TODO
*/
*/
function
go
(
module
,
page
,
params
)
{
function
go
(
module
,
page
,
params
,
blank
)
{
var
_p
=
(
!
params
||
layui
.
$
.
isEmptyObject
(
params
))
?
''
:
genurl
(
params
)
var
_p
=
(
!
params
||
layui
.
$
.
isEmptyObject
(
params
))
?
''
:
genurl
(
params
)
var
href
=
'/html/'
+
module
+
'/'
+
page
+
'.html'
var
href
=
'/html/'
+
module
+
'/'
+
page
+
'.html'
if
(
blank
)
{
window
.
open
(
href
,
'_blank'
)
}
else
{
window
.
location
.
href
=
_p
?
href
+
'?'
+
_p
:
href
window
.
location
.
href
=
_p
?
href
+
'?'
+
_p
:
href
}
}
}
function
loadLayConfig
()
{
function
loadLayConfig
()
{
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment