Commit 465195c7 by 胡悦

员工添加角色

1 parent c3c27f40
......@@ -59,6 +59,12 @@
<input type="text" name="createdName" required lay-verify="required" placeholder="请输入创建者" autocomplete="off" class="layui-input" />
</div>
</div>
<div class="layui-inline roleId hide" pane>
<label class="layui-form-label">角色</label>
<div class="layui-input-block">
<select name="roleId" id="roleId" lay-verify="required" placeholder="请选择状态"></select>
</div>
</div>
<div class="layui-inline status" pane>
<label class="layui-form-label">状态</label>
<div class="layui-input-block">
......@@ -107,10 +113,16 @@
// if (isDxternal) {
// $('#addEl').remove()
// }
var roleId = $('#roleId')
var accountInfo = helper.store.get('accountInfo')
console.log('accountInfo', accountInfo)
if (accountInfo && accountInfo.merchantAccountLevel == 4) {
$('.merchantNames').addClass('hide')
if (accountInfo) {
if(accountInfo.merchantAccountLevel == 4) {
$('.merchantNames').addClass('hide')
}
$('.creater').addClass('hide')
$('.roleId').removeClass('hide')
$('.roleId').addClass('show')
}
// 商户名称列表
var merchantName = $('#merchantName')
......@@ -206,7 +218,12 @@
clickClose: true,
filterable: true,
radio: true,
data: []
data: [],
on: function(data) {
console.log(data)
var id = data.change[0].id
findRoleList(id)
}
})
// 初始化
......@@ -357,11 +374,32 @@
request(params, function (result) {
if (result.code == '0') {
console.log(result.data)
merchantNameSelect.update({
if (accountInfo && accountInfo.merchantAccountLevel == 4) {
console.log(result.data[0].id)
findRoleList(result.data[0].id)
} else {
merchantNameSelect.update({
data: result.data,
autoRow: true,
paging: result.data.length > 20
})
}
}
})
}
// 查询角色权限列表
function findRoleList(merchantId) {
var params = { method: 'org.ore.api.role.list', id: merchantId, delFlag: 0 }
request(params, function (res) {
if (res.code == '0') {
var list = res.data
roleId.empty()
list.unshift('')
$.each(list, function (index, item) {
roleId.append(new Option(item.roleName, item.id))
})
form.render('select')
}
})
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!