Commit 8fde78b2 by 胡悦

修改角色和员工列表页

1 parent 9b05ed52
...@@ -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))
......
...@@ -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
...@@ -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: 160 width: 120
}, { }, {
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() {
......
...@@ -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() {
......
...@@ -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() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!