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 4e759fe7
authored
Nov 23, 2023
by
前端
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
员工部门信息
1 parent
fe5222e1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
824 additions
and
2 deletions
html/employee/add.html
html/employee/add.html
View file @
4e759fe
...
@@ -254,11 +254,11 @@
...
@@ -254,11 +254,11 @@
<label
class=
"layui-form-label"
>
所属部门:
</label>
<label
class=
"layui-form-label"
>
所属部门:
</label>
<div
class=
"layui-input-block"
>
<div
class=
"layui-input-block"
>
<select
name=
"department"
id=
"departmentAuth"
>
<select
name=
"department"
id=
"departmentAuth"
>
<option
value=
"0"
>
其他
</option>
<
!-- <
option value="0">其他</option>
<option value="1">销售部</option>
<option value="1">销售部</option>
<option value="2">售后部</option>
<option value="2">售后部</option>
<option value="3">客服部</option>
<option value="3">客服部</option>
<option
value=
"4"
>
续保部
</option>
<option value="4">续保部</option>
-->
</select>
</select>
</div>
</div>
</div>
</div>
...
@@ -322,6 +322,7 @@
...
@@ -322,6 +322,7 @@
var
pwd
=
$
(
'#password'
)
// 密码输入框
var
pwd
=
$
(
'#password'
)
// 密码输入框
var
resetpsw
=
$
(
'#resetpsw'
)
var
resetpsw
=
$
(
'#resetpsw'
)
var
roleAuth
=
$
(
'#roleAuth'
)
var
roleAuth
=
$
(
'#roleAuth'
)
var
departmentSelect
=
$
(
'#departmentAuth'
)
var
wechatNick
=
$
(
'#wechatNick'
)
var
wechatNick
=
$
(
'#wechatNick'
)
var
wechatPhone
=
$
(
'#wechatPhone'
)
var
wechatPhone
=
$
(
'#wechatPhone'
)
var
wechatId
=
$
(
'#wechatId'
)
var
wechatId
=
$
(
'#wechatId'
)
...
@@ -547,6 +548,808 @@
...
@@ -547,6 +548,808 @@
})
})
return
false
return
false
}
}
var
visibleInferiorMer
=
''
if
(
specialVisible
==
'-1'
)
{
visibleInferiorMer
=
'-1'
}
else
{
visibleInferiorMer
=
visibleMerchant
.
getCheckedNodes
(
true
)
.
map
(
function
(
i
)
{
return
i
.
id
})
.
join
(
','
)
}
var
otherParams
=
{
visibleInferiorMer
:
visibleInferiorMer
,
merchantId
:
merchantId
}
if
(
merchantFileRequest
.
fileName
)
{
otherParams
.
merchantFileRequest
=
JSON
.
stringify
(
merchantFileRequest
)
}
if
(
id
)
{
otherParams
.
id
=
id
otherParams
.
method
=
'merchants.api.staff.updateStaff'
}
else
{
otherParams
.
method
=
'merchants.api.staff.saveStaff'
}
var
params
=
helper
.
clone
(
true
,
data
.
field
,
otherParams
)
params
.
mesVerifyFlag
=
params
.
mesVerifyFlag
==
'on'
?
1
:
0
delete
params
.
merhcnatImg
params
.
createdSource
=
1
request
(
params
,
function
(
result
)
{
if
(
result
.
code
==
'0'
)
{
layer
.
msg
(
'操作成功'
,
{
icon
:
1
})
window
.
history
.
back
()
}
})
return
false
})
// 表单验证
form
.
verify
({
merchantLoginPassword
:
function
(
value
)
{
if
(
value
)
{
if
(
value
.
length
<
6
||
value
.
length
>
20
)
{
return
'登录密码请填入6-20位字符'
}
if
(
!
/^
(?=
.*
\d)(?=
.*
[
a-zA-Z
])[\s\S]{6,20}
$/
.
test
(
value
))
{
return
'您输入的密码格式不正确,必须同时包含字母、数字。'
}
}
}
})
// select 选择触发
form
.
on
(
'select(merchants)'
,
function
(
data
)
{
merchantId
=
data
.
value
getList
(
merchantId
)
})
/** 定义方法 */
function
getList
(
merchantId
)
{
getVisibleMerchant
(
merchantId
)
findRoleList
(
merchantId
)
findAllDepartment
()
}
// 可见商户
function
getVisibleMerchant
(
merchantId
)
{
var
visibleMerchantParams
=
{
id
:
merchantId
,
method
:
'merchants.api.merchant.findMerchantTree'
}
request
(
visibleMerchantParams
,
function
(
res
)
{
if
(
res
.
code
==
'0'
)
{
const
data
=
res
.
data
if
(
id
)
{
findAllMerchant
(
function
(
result
)
{
if
(
result
)
{
getById
(
function
(
checkedList
)
{
if
(
data
.
length
==
1
&&
data
[
0
].
id
==
-
1
)
{
$
(
'#allMerchant'
).
removeClass
(
'hide'
)
specialVisible
=
data
[
0
].
id
// createMerchant(data[0].id, data)
$
(
'#otherMerchant'
).
addClass
(
'hide'
)
}
else
{
createMerchant
(
checkedList
,
res
.
data
)
}
})
}
})
}
else
{
if
(
data
.
length
==
1
&&
data
[
0
].
id
==
-
1
)
{
$
(
'#allMerchant'
).
removeClass
(
'hide'
)
specialVisible
=
data
[
0
].
id
// createMerchant(data[0].id, data)
$
(
'#otherMerchant'
).
addClass
(
'hide'
)
}
else
{
const
arr
=
[]
arr
.
push
(
+
merchantId
)
createMerchant
(
arr
,
res
.
data
)
specialVisible
=
''
$
(
'#otherMerchant'
).
removeClass
(
'hide'
)
$
(
'#allMerchant'
).
addClass
(
'hide'
)
}
}
}
})
}
function
createMerchant
(
arr
,
data
)
{
visibleMerchant
=
tree
.
create
(
'visibleInferiorMerTree'
,
data
,
null
,
{
check
:
{
enable
:
true
,
chkboxType
:
{
Y
:
''
,
N
:
''
}
}
})
visibleMerchant
.
checkNodes
(
arr
)
all_nodes
=
visibleMerchant
.
transformToArray
(
visibleMerchant
.
getNodes
())
bindEvent
()
}
// 查询所属部门
function
findAllDepartment
(){
var
params
=
{
dictType
:
'staff_department'
,
method
:
'merchants.api.menu.findAllDictData'
}
request
(
params
,
function
(
res
)
{
console
.
log
(
res
)
if
(
res
.
code
==
'0'
)
{
var
list
=
res
.
data
departmentSelect
.
empty
()
list
.
unshift
(
''
)
$
.
each
(
list
,
function
(
index
,
item
)
{
departmentSelect
.
append
(
new
Option
(
item
.
dictLabel
,
item
.
dictValue
))
})
form
.
render
(
'select'
)
}
})
}
// 查询所有商户
function
findAllMerchant
(
callback
)
{
var
params
=
{
method
:
'merchants.api.menu.findAllMerchant'
}
request
(
params
,
function
(
result
)
{
if
(
result
.
code
==
'0'
)
{
merchantNameSelect
.
update
({
data
:
result
.
data
,
autoRow
:
true
,
paging
:
result
.
data
.
length
>
20
})
// merchantNameSelect.setValue([merchantId])
// var list = result.data
// list.unshift('')
// $.each(list, function (index, item) {
// merchantName.append(new Option(item.merchantName, item.id))
// })
// form.render('select')
callback
(
result
.
data
)
}
})
}
// 查询角色权限列表
function
findRoleList
(
merchantId
)
{
var
params
=
{
method
:
'merchants.api.role.list'
,
id
:
merchantId
,
delFlag
:
0
}
request
(
params
,
function
(
res
)
{
if
(
res
.
code
==
'0'
)
{
var
list
=
res
.
data
roleAuth
.
empty
()
list
.
unshift
(
''
)
$
.
each
(
list
,
function
(
index
,
item
)
{
roleAuth
.
append
(
new
Option
(
item
.
roleName
,
item
.
id
))
})
form
.
render
(
'select'
)
}
})
}
function
getById
(
callback
)
{
// 查询员工详情
var
params
=
{
id
:
id
,
method
:
'merchants.api.staff.staffSearchRequest'
}
pwd
.
attr
(
'readonly'
,
true
)
request
(
params
,
function
(
res
)
{
if
(
res
.
code
==
'0'
)
{
var
data
=
res
.
data
employeeForm
=
{
id
:
8
,
merchantId
:
data
.
merchantId
,
staffName
:
data
.
staffName
,
staffPhone
:
data
.
staffPhone
,
password
:
data
.
password
,
mesVerifyFlag
:
data
.
mesVerifyFlag
,
// visibleInferiorMer: "1",
roleIds
:
data
.
roleIds
?
+
data
.
roleIds
.
join
(
''
)
:
''
,
staffEmail
:
data
.
staffEmail
,
staffJob
:
data
.
staffJob
,
department
:
data
.
department
,
weChatNickName
:
data
.
weChatNickName
,
weChatPhone
:
data
.
weChatPhone
,
weChatOpenId
:
data
.
weChatOpenId
}
if
(
data
.
staffLabel
)
{
var
item
=
data
.
staffLabel
.
split
(
','
.
toString
())
tagAuth
.
setValue
(
item
)
}
if
(
data
.
merchantFileResponse
)
{
merchantFileRequest
=
{
fileName
:
data
.
merchantFileResponse
.
fileName
,
fileUrl
:
data
.
merchantFileResponse
.
fileUrl
}
$
(
'#img'
).
attr
(
'src'
,
merchantFileRequest
.
fileUrl
)
$
(
'#img'
).
removeClass
(
'hide'
)
$
(
'#img'
).
addClass
(
'show'
)
$
(
'.img-add'
).
removeClass
(
'show'
)
$
(
'.img-add'
).
addClass
(
'hide'
)
}
var
visibleInferiorMerArr
=
data
.
visibleInferiorMer
?
data
.
visibleInferiorMer
.
split
(
','
)
:
[]
$
.
each
(
visibleInferiorMerArr
,
function
(
index
,
item
)
{
visibleInferiorMerArr
[
index
]
=
+
item
})
// var visibleInferiorMerArr = [32, 38]
callback
(
visibleInferiorMerArr
)
}
form
.
val
(
'employeeForm'
,
employeeForm
)
form
.
render
(
'select'
)
if
(
!
$
(
'#staffPhone'
).
val
())
{
$
(
'#staffPhone'
).
removeAttr
(
'disabled'
)
}
})
}
function
bindEvent
()
{
$
(
'#searchMerchant'
).
on
(
'input'
,
helper
.
debounce
(
function
()
{
var
txt
=
$
(
this
).
val
()
if
(
!
txt
)
{
visibleMerchant
.
showNodes
(
all_nodes
)
}
else
{
var
nodesList
=
visibleMerchant
.
getNodesByParamFuzzy
(
'label'
,
txt
)
show_nodes
=
helper
.
findShowNode
(
nodesList
,
all_nodes
)
visibleMerchant
.
hideNodes
(
all_nodes
)
visibleMerchant
.
showNodes
(
show_nodes
)
}
},
500
)
)
}
})
</script>
</body>
</html>
<!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>
<style>
.upload-img-box
{
position
:
relative
;
width
:
80px
;
height
:
80px
;
color
:
#999999
;
border
:
1px
dashed
#d9d9d9
;
cursor
:
pointer
;
}
.upload-img-box
.upload-img
{
position
:
absolute
;
width
:
80px
;
top
:
0
;
left
:
0
;
}
.icon-add
{
position
:
absolute
;
top
:
50%
;
font-size
:
40px
;
left
:
50%
;
transform
:
translate3d
(
-50%
,
-50%
,
0
);
}
.upload-img-wh
{
width
:
80px
!important
;
height
:
80px
;
}
.show
{
display
:
inline-block
;
/* width: 360px; */
}
.hide
{
display
:
none
;
}
.tips
{
font-size
:
14px
;
color
:
#999
;
}
.form-right
{
position
:
absolute
;
right
:
0
;
top
:
0
;
transform
:
translateX
(
110%
);
}
.sub-bg-white
{
background-color
:
#fff
;
}
.edit-box
{
padding
:
0
20px
20px
;
box-sizing
:
border-box
;
color
:
#333333
;
background-color
:
#ffffff
;
margin
:
15px
auto
;
position
:
relative
;
margin-bottom
:
100px
;
}
.edit-box
.grayLine
{
position
:
absolute
;
left
:
0
;
top
:
48px
;
background-color
:
#d8d8d8
;
width
:
100%
;
height
:
1px
;
}
.edit-title
{
height
:
48px
;
line-height
:
48px
;
padding
:
0
20px
;
margin-bottom
:
15px
;
font-size
:
16px
;
color
:
#333333
;
font-weight
:
600
;
}
.hide
{
display
:
none
;
}
.show
{
display
:
block
;
}
.pageTitle
{
background-color
:
#fff
;
height
:
78px
;
font-size
:
20px
;
font-weight
:
bold
;
color
:
#333333
;
line-height
:
78px
;
padding-left
:
20px
;
}
.Wrap
{
margin
:
8px
20px
0
;
/* height: 100%; */
}
.xm-select-demo
,
xm-select
>
.xm-body
.scroll-body
{
width
:
360px
;
}
xm-select
:hover
{
border
:
1px
solid
#5850ff
!important
;
}
</style>
</head>
<body>
<div
id=
"app"
>
<main>
<div
class=
"Wrap"
>
<div
class=
"pageTitle"
>
<span
id=
"addUpdateTitle"
>
新增员工
</span>
</div>
<div
class=
"sub-bg-white edit-box"
>
<div
class=
"grayLine"
></div>
<form
class=
"layui-form add"
lay-filter=
"employeeForm"
action=
""
>
<div
class=
"layui-form-item edit-title"
style=
"position: relative"
>
<div
class=
"layui-input-inline"
>
员工基本信息
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label required"
>
所属商户:
</label>
<div
class=
"layui-input-block"
id=
"merchantBox"
>
<!-- <div id="merchantSelect" class="hide"> -->
<!-- <select id="merchantName" name="merchantId" lay-filter="merchants" lay-verify="required" autocomplete="off" placeholder="请选择商户名称" required></select> -->
<div
id=
"merchantNameSelect"
class=
"xm-select-demo"
></div>
<!-- </div> -->
<div
class=
"hide"
id=
"merchantIdText"
style=
"line-height: 32px"
></div>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label required"
>
员工姓名:
</label>
<div
class=
"layui-input-block"
>
<input
type=
"text"
name=
"staffName"
maxlength=
"15"
required
lay-verify=
"required"
placeholder=
"请输入员工姓名"
autocomplete=
"off"
class=
"layui-input"
/>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label required"
>
登录手机号:
</label>
<div
class=
"layui-input-block"
>
<input
id=
"staffPhone"
type=
"text"
name=
"staffPhone"
maxlength=
"11"
required
lay-verify=
"required|phone"
placeholder=
"请输入您有效的手机号作为登录账户"
autocomplete=
"off"
class=
"layui-input"
/>
<div>
<input
id=
"mesVerifyFlag"
type=
"checkbox"
name=
"mesVerifyFlag"
lay-filter=
"encrypt"
lay-skin=
"primary"
title=
"开启短信验证登录"
/>
</div>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label required"
>
登录密码:
</label>
<div
class=
"layui-input-block"
style=
"position: relative"
>
<input
type=
"password"
name=
"password"
id=
"password"
maxlength=
"20"
required
lay-verify=
"required|merchantLoginPassword"
placeholder=
"请输入密码(必须包含6-20个字母+数字)"
autocomplete=
"off"
class=
"layui-input"
/>
<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=
"hide"
id=
"allMerchant"
style=
"line-height: 32px"
>
全部商户
</div>
<div
class=
"layui-input-block"
id=
"otherMerchant"
>
<input
class=
"layui-input"
placeholder=
"可见商户"
id=
"searchMerchant"
/>
<div
style=
"position: absolute; top: 0; left: 380px"
>
<button
type=
"button"
class=
"layui-btn"
id=
"checkAll"
>
全选
</button>
</div>
<ul
id=
"visibleInferiorMerTree"
style=
"max-height: 200px; overflow-y: auto"
class=
"ztree wrapper-tree"
></ul>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label required"
>
角色权限:
</label>
<div
class=
"layui-input-block"
style=
"position: relative"
>
<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
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
头像:
</label>
<div
class=
"layui-input-block"
>
<div
class=
"upload-img-box"
>
<div
class=
"icon-add img-add show"
>
+
</div>
<img
class=
"upload-img upload-img-wh hide"
id=
"img"
/>
<input
type=
"file"
id=
"upload"
name=
"merhcnatImg"
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>
<span
class=
"tips"
>
图片格式仅支持JPG,PNG格式,大小1M以内
</span>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
邮箱:
</label>
<div
class=
"layui-input-block"
>
<input
type=
"text"
name=
"staffEmail"
maxlength=
"30"
lay-verify=
""
placeholder=
"请输入邮箱"
autocomplete=
"off"
class=
"layui-input"
/>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
主要职务:
</label>
<div
class=
"layui-input-block"
>
<input
type=
"text"
name=
"staffJob"
maxlength=
"10"
placeholder=
"请输入主要职务"
autocomplete=
"off"
class=
"layui-input"
/>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
所属部门:
</label>
<div
class=
"layui-input-block"
>
<select
name=
"department"
id=
"departmentAuth"
>
<!-- <option value="0">其他</option>
<option value="1">销售部</option>
<option value="2">售后部</option>
<option value="3">客服部</option>
<option value="4">续保部</option> -->
</select>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
员工标签:
</label>
<div
class=
"layui-input-block"
>
<div
id=
"tagAuth"
name=
"staffLabel"
class=
"xm-select-demo"
></div>
<!-- <select name="staffLabel" id="tagAuth" xm-select="selectId">
<option value="0">1.0新车权益销售</option>
<option value="1">1.1次新车精品升级</option>
<option value="2">1.2次新车线上转化</option>
<option value="3">1.3存量用户众筹</option>
</select> -->
</div>
</div>
<div
class=
"layui-form-item hide"
id=
"wechatNick"
>
<label
class=
"layui-form-label"
>
微信昵称:
</label>
<div
class=
"layui-input-block"
>
<input
type=
"text"
name=
"weChatNickName"
readonly
class=
"layui-input"
/>
</div>
</div>
<div
class=
"layui-form-item hide"
id=
"wechatPhone"
>
<label
class=
"layui-form-label"
>
微信手机号:
</label>
<div
class=
"layui-input-block"
>
<input
type=
"text"
name=
"weChatPhone"
readonly
class=
"layui-input"
/>
</div>
</div>
<div
class=
"layui-form-item hide"
id=
"wechatId"
>
<label
class=
"layui-form-label"
>
微信openid:
</label>
<div
class=
"layui-input-block"
>
<input
type=
"text"
name=
"weChatOpenId"
readonly
class=
"layui-input"
/>
</div>
</div>
<div
class=
"footer-close"
>
<button
class=
"layui-btn"
lay-submit
lay-filter=
"employeeSubmit"
>
确定
</button>
<button
type=
"reset"
class=
"layui-btn"
id=
"return"
>
取消
</button>
</div>
</form>
</div>
</div>
</main>
</div>
<script
src=
"https://img02.glsx.com.cn/layui/layui.js"
></script>
<script
src=
"/js/load.js"
></script>
<script>
//Demo
layui
.
use
([
'form'
,
'upload'
,
'gtree'
,
'request'
,
'helper'
,
'xmSelect'
],
function
()
{
var
id
=
qs
(
'id'
)
var
form
=
layui
.
form
var
upload
=
layui
.
upload
var
tree
=
layui
.
gtree
var
request
=
layui
.
request
var
helper
=
layui
.
helper
var
$
=
layui
.
$
var
xmSelect
=
layui
.
xmSelect
var
merchantFileRequest
=
{}
var
all_nodes
=
[]
var
employeeForm
=
{}
var
pwd
=
$
(
'#password'
)
// 密码输入框
var
resetpsw
=
$
(
'#resetpsw'
)
var
roleAuth
=
$
(
'#roleAuth'
)
var
departmentSelect
=
$
(
'#departmentAuth'
)
var
wechatNick
=
$
(
'#wechatNick'
)
var
wechatPhone
=
$
(
'#wechatPhone'
)
var
wechatId
=
$
(
'#wechatId'
)
var
merchantName
=
$
(
'#merchantName'
)
var
merchantId
=
''
var
visibleMerchant
=
{}
pwd
.
attr
(
'readonly'
,
false
)
var
accountInfo
=
helper
.
store
.
get
(
'accountInfo'
)
// 是否是特殊商户
var
specialVisible
=
''
// 禁用所有input框的回车事件
var
inputs
=
document
.
getElementsByTagName
(
'input'
)
for
(
let
i
=
0
;
i
<
inputs
.
length
;
i
++
)
{
var
input
=
inputs
[
i
]
input
.
onkeydown
=
function
(
event
)
{
if
(
event
.
keyCode
==
13
)
{
event
.
keyCode
=
0
event
.
returnValue
=
false
}
}
}
// 员工标签
var
tagAuth
=
xmSelect
.
render
({
el
:
'#tagAuth'
,
prop
:
{
name
:
'name'
,
value
:
'value'
},
// layVerify: `${qs('channel') ? '' : 'required'}`,
// model: {
// label: {
// type: 'text',
// text: {}
// }
// },
name
:
'staffLabel'
,
selected
:
true
,
data
:
[
{
name
:
'精品升级(太阳膜)'
,
value
:
'1'
},
{
name
:
'次新车转化(车衣、改色膜)'
,
value
:
'4'
},
{
name
:
'售后众筹活动'
,
value
:
'3'
},
{
name
:
'会员权益/升级'
,
value
:
'0'
},
{
name
:
'膨胀金活动'
,
value
:
'2'
},
{
name
:
'送修线索'
,
value
:
'5'
}
],
on
:
function
(
data
)
{
staffLabel
=
data
.
change
[
0
].
value
}
})
var
merchantNameSelect
=
xmSelect
.
render
({
el
:
'#merchantNameSelect'
,
prop
:
{
name
:
'merchantName'
,
value
:
'id'
},
layVerify
:
`
${
qs
(
'channel'
)
?
''
:
'required'
}
`
,
model
:
{
label
:
{
type
:
'text'
,
text
:
{}
}
},
name
:
'merchantId'
,
filterable
:
true
,
clickClose
:
true
,
radio
:
true
,
data
:
[],
on
:
function
(
data
)
{
merchantId
=
data
.
change
[
0
].
id
getList
(
merchantId
)
}
})
if
(
accountInfo
&&
!
id
)
{
$
(
'#btnGroup'
).
addClass
(
'show'
)
}
// 判断是从商户过来还是员工
if
(
qs
(
'channel'
))
{
getList
(
qs
(
'merchantId'
))
merchantId
=
qs
(
'merchantId'
)
$
(
'#merchantIdText'
).
text
(
decodeURIComponent
(
qs
(
'merchantName'
)))
$
(
'#merchantIdText'
).
removeClass
(
'hide'
)
$
(
'#merchantIdText'
).
addClass
(
'show'
)
$
(
'#merchantNameSelect'
).
addClass
(
'hide'
)
$
(
'#staffPhone'
).
removeAttr
(
'disabled'
)
}
else
{
if
(
qs
(
'id'
))
{
// 判断是否是编辑
resetpsw
.
removeClass
(
'hide'
)
resetpsw
.
addClass
(
'show'
)
wechatNick
.
removeClass
(
'hide'
)
wechatNick
.
addClass
(
'show'
)
wechatPhone
.
removeClass
(
'hide'
)
wechatPhone
.
addClass
(
'show'
)
wechatId
.
removeClass
(
'hide'
)
wechatId
.
addClass
(
'show'
)
merchantId
=
encodeURI
(
qs
(
'merchantId'
))
$
(
'#merchantIdText'
).
text
(
decodeURIComponent
(
qs
(
'merchantName'
)))
$
(
'#merchantIdText'
).
removeClass
(
'hide'
)
$
(
'#merchantIdText'
).
addClass
(
'show'
)
$
(
'#staffPhone'
).
attr
(
'disabled'
,
true
)
getList
(
qs
(
'merchantId'
))
$
(
'#addUpdateTitle'
).
text
(
'修改员工'
)
$
(
'#merchantNameSelect'
).
remove
()
}
findAllMerchant
(
function
(
result
)
{
if
(
accountInfo
&&
accountInfo
.
merchantAccountLevel
==
4
)
{
const
merchantName
=
result
[
0
].
merchantName
$
(
'#merchantIdText'
).
text
(
merchantName
)
merchantId
=
result
[
0
].
id
form
.
render
()
$
(
'#merchantIdText'
).
removeClass
(
'hide'
)
$
(
'#merchantIdText'
).
addClass
(
'show'
)
$
(
'#merchantNameSelect'
).
remove
()
getList
(
merchantId
)
}
})
}
/** 手动触发事件 */
// 上传图片
$
(
'.upload'
).
on
(
'change'
,
function
(
e
)
{
var
el
=
$
(
'#upload'
)
var
imgEl
=
$
(
'#img'
)
var
addEl
=
$
(
'.img-add'
)
var
reader
=
new
FileReader
()
var
fileInfo
=
el
[
0
].
files
[
0
]
merchantFileRequest
.
fileName
=
fileInfo
.
name
reader
.
readAsDataURL
(
fileInfo
)
reader
.
onload
=
function
(
e
)
{
if
(
e
)
{
const
imgFile
=
e
.
target
.
result
const
base64
=
fileInfo
.
name
.
split
(
'.'
)[
1
]
+
'@'
+
imgFile
.
split
(
','
)[
1
]
request
(
{
method
:
'glsx.accounts.biz.common.pictureUpload'
,
file
:
base64
},
function
(
result
)
{
merchantFileRequest
.
fileUrl
=
result
.
data
imgEl
.
attr
(
'src'
,
result
.
data
)
imgEl
.
removeClass
(
'hide'
)
imgEl
.
addClass
(
'show'
)
addEl
.
removeClass
(
'show'
)
addEl
.
addClass
(
'hide'
)
},
{},
[
'file'
],
true
)
}
}
reader
.
onload
()
})
// 返回上个页面
$
(
'#return'
).
on
(
'click'
,
function
()
{
window
.
history
.
back
()
})
// 重置密码
resetpsw
.
on
(
'click'
,
function
()
{
pwd
.
attr
(
'readonly'
,
false
)
pwd
.
val
(
''
)
})
var
checkAll
=
false
var
checkBtn
=
$
(
'#checkAll'
)
// 全选可见商户
checkBtn
.
on
(
'click'
,
function
()
{
if
(
!
merchantId
)
{
layer
.
msg
(
'请选择所属商户!'
)
}
else
{
checkAll
=
!
checkAll
visibleMerchant
.
checkAllNodes
(
checkAll
)
if
(
checkAll
)
{
checkBtn
.
html
(
'全不选'
)
}
else
{
checkBtn
.
html
(
'全选'
)
}
}
})
// 刷新
$
(
'#refresh'
).
on
(
'click'
,
function
()
{
if
(
!
merchantId
)
{
layer
.
msg
(
'请选择所属商户!'
)
}
else
{
findRoleList
(
merchantId
)
}
})
// 创建角色
$
(
'#addRole'
).
on
(
'click'
,
function
()
{
go
(
'role'
,
'add'
)
// $messenger.emit('route-to', { path: '/settings/role/add' })
})
// 提交表单
form
.
on
(
'submit(employeeSubmit)'
,
function
(
data
)
{
if
(
specialVisible
!=
'-1'
&&
visibleMerchant
.
getCheckedNodes
(
true
).
length
==
0
)
{
layer
.
msg
(
'可见商户必选'
,
{
icon
:
2
})
return
false
}
var
visibleInferiorMer
=
''
var
visibleInferiorMer
=
''
if
(
specialVisible
==
'-1'
)
{
if
(
specialVisible
==
'-1'
)
{
visibleInferiorMer
=
'-1'
visibleInferiorMer
=
'-1'
...
@@ -612,6 +1415,7 @@
...
@@ -612,6 +1415,7 @@
function
getList
(
merchantId
)
{
function
getList
(
merchantId
)
{
getVisibleMerchant
(
merchantId
)
getVisibleMerchant
(
merchantId
)
findRoleList
(
merchantId
)
findRoleList
(
merchantId
)
findAllDepartment
()
}
}
// 可见商户
// 可见商户
...
@@ -669,6 +1473,24 @@
...
@@ -669,6 +1473,24 @@
bindEvent
()
bindEvent
()
}
}
// 查询所属部门
function
findAllDepartment
(){
var
params
=
{
dictType
:
'staff_department'
,
method
:
'merchants.api.menu.findAllDictData'
}
request
(
params
,
function
(
res
)
{
console
.
log
(
res
)
if
(
res
.
code
==
'0'
)
{
var
list
=
res
.
data
departmentSelect
.
empty
()
list
.
unshift
(
''
)
$
.
each
(
list
,
function
(
index
,
item
)
{
departmentSelect
.
append
(
new
Option
(
item
.
dictLabel
,
item
.
dictValue
))
})
form
.
render
(
'select'
)
}
})
}
// 查询所有商户
// 查询所有商户
function
findAllMerchant
(
callback
)
{
function
findAllMerchant
(
callback
)
{
var
params
=
{
method
:
'merchants.api.menu.findAllMerchant'
}
var
params
=
{
method
:
'merchants.api.menu.findAllMerchant'
}
...
...
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