Commit 8fde78b2 by 胡悦

修改角色和员工列表页

1 parent 9b05ed52
......@@ -135,8 +135,12 @@
</div>
<div class="layui-form-item">
<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>
<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">
......@@ -205,7 +209,11 @@
var merchantId = ''
var visibleMerchant = {}
pwd.attr('readonly', false)
var user = helper.store.get('user')
console.log(user)
if (user.accountLevel == 4) {
$('#btnGroup').addClass('show')
}
// 判断是从商户过来还是员工
if (qs('channel')) {
getList(qs('merchantId'))
......@@ -275,6 +283,20 @@
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) {
if (visibleMerchant.getCheckedNodes(true).length == 0) {
......@@ -389,6 +411,7 @@
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))
......
......@@ -23,6 +23,9 @@
.selector{
width: 110px;
}
.layui-layer-content {
white-space: pre-line;
}
</style>
<body>
......@@ -102,26 +105,52 @@
// 商户名称列表
var merchantName = $("#merchantName")
var status = $('#status')
var cols = [
//表头
{ field: '', title: '序号', type: 'numbers', width: 80 },
{ field: 'staffName', title: '员工姓名', width: 120, align: 'center' },
// { field: 'staffCode', title: '员工号', align: 'center' },
{ field: 'roleName', title: '角色', align: 'center' },
{ field: 'staffPhone', title: '登录手机号', align: 'center', width: 125 },
{ field: 'entmicroName', title: '企微号', align: 'center', width: 125 },
{ field: 'statusName', title: '状态', align: 'center' },
{ field: 'createdAccount', title: '创建者', align: 'center' },
{ field: 'merchantName', title: '商户名(商户号)', align: 'center', width: 160 },
{ 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 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: [
[
//表头
{ field: '', title: '序号', type: 'numbers', width: 80 },
{ field: 'staffName', title: '员工姓名', width: 120, align: 'center' },
{ field: 'staffCode', title: '员工号', align: 'center' },
{ field: 'roleName', title: '角色', align: 'center' },
{ field: 'staffPhone', title: '登录手机号', align: 'center', width: 125 },
{ field: 'statusName', title: '状态', align: 'center' },
{ field: 'createdAccount', title: '创建者', align: 'center' },
{ field: 'merchantName', title: '商户名(商户号)', align: 'center', width: 160 },
{ field: 'updatedTime', title: '更新时间', align: 'center', width: 112 },
{ fixed: 'right', title: '操作', width: 220, align: 'left', toolbar: '#employeeBar' }
]
]
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 @@
//首次不执行
if (!first) {
getTabelList(employeeTable, getSearch())
// 移入移出
}
}
}
......@@ -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 () {
......@@ -213,12 +254,6 @@
// 新增点击事件
$('#addEmployee').on('click', function () {
go('employee', 'add')
// var value = merchantName.val()
// if (value) {
// go('employee', 'add', { merchantId: value })
// } else {
// layer.msg('请选择商户')
// }
})
// 导出
......@@ -232,6 +267,7 @@
})
})
/** 定义方法 */
// 初始化方法
function init() {
......@@ -317,15 +353,22 @@
})
</script>
<script type="text/html" id="employeeBar">
<div>
<a class="layui-btn-xs" lay-event="detail">查看</a>
<a class="layui-btn-xs" lay-event="edit">修改</a>
<a class="layui-btn-xs" lay-event="del">删除</a>
</div>
<div>
<a class="layui-btn-xs" lay-event="updateTime">修改账户有效期</a>
</div>
</script>
<div>
<a class="layui-btn-xs" lay-event="detail">查看</a>
<a class="layui-btn-xs" lay-event="edit">修改</a>
<a class="layui-btn-xs" lay-event="del">删除</a>
</div>
<div>
<a class="layui-btn-xs" lay-event="updateTime">修改账户有效期</a>
</div>
</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>
</html>
\ No newline at end of file
......@@ -45,7 +45,7 @@
<form class="layui-form layui-form-pane" lay-filter="searchFilter" id="searchForm">
<div class="layui-inline" id="operateEl">
<button class="layui-btn" id="addBtn">
<i class="layui-icon layui-icon-add-circle"></i> 创建商户</button>
<i class="layui-icon layui-icon-add-circle"></i> 创建商户</button>
<div class="layui-inline channel" pane>
<label class="layui-form-label">渠道:</label>
<div class="layui-input-inline">
......@@ -129,17 +129,18 @@
<div>
<a class="layui-btn-xs" lay-event="handleDetail">查看</a>
{{# 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>
{{# if((d.btn.edit)){ }}
<a class="layui-btn-xs" lay-event="handleAuthority">修改权限</a>
{{# } }}
{{# if((d.btn.editPeriod)){ }}
<a class="layui-btn-xs" lay-event="handleVaildPeriod">修改账户有效期</a>
{{# } }}
</div>
</div> -->
<div>
{{# if((d.btn.createStaff)){ }}
<a class="layui-btn-xs" lay-event="handleAddStaff">创建员工</a>
......@@ -149,6 +150,10 @@
{{# } }}
</div>
</script>
<script type="text/html" id="vaildPeriod">
{{# if((d.btn.editPeriod)){ }}
<a class="layui-btn-xs" lay-event="handleVaildPeriod">修改账户有效期</a>
{{# } }}</script>
<script>
layui.use(['gtree', 'request', 'helper', 'table', 'laypage', 'layer'], function () {
var tree = layui.gtree
......@@ -189,75 +194,143 @@
}
}
}
var cols = [{
field: 'index',
title: '序号',
align: 'center',
width: 60
}, {
field: 'merchantNo',
title: '商户号',
align: 'center'
}, {
field: 'merchantName',
title: '商户名称',
align: 'center'
}, {
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',
width: 120
}, {
field: 'merchantLegalPersonPhone',
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',
width: 120
}, {
field: 'updatedTime',
title: '更新时间',
align: 'center',
width: 112
}, {
align: 'left',
title: '操作',
toolbar: '#merchantBtns',
width: 220
// 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: [
[{
field: 'index',
title: '序号',
align: 'center',
width: 60
}, {
field: 'merchantNo',
title: '商户号',
align: 'center'
}, {
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',
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'
}]
]
cols: gl ? [cols] : [colums]
})
table.on('tool(merchant-table-filter)', function (obj) {
......@@ -300,7 +373,7 @@
// 创建子商户/门店
case 'handleAddMerchant':
// 1-创建新商户;2-创建子商户;3-修改
go('merchant', 'edit', {
go('merchant', 'add', {
editLevel: 2,
parentId: row.id,
isFactory: 'false',
......@@ -351,7 +424,7 @@
$('#addBtn').on('click', function () {
// 1-创建新商户;2-创建子商户;3-修改
go('merchant', 'edit', {
go('merchant', 'add', {
editLevel: 1,
step: 1,
isFactory: 'true'
......@@ -516,7 +589,7 @@
// 功能点按需出现
function elRemove() {
$('#operateEl').remove()
// $('#operateEl').remove()
}
function init() {
......
......@@ -35,11 +35,22 @@
</div>
</div>
<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>
<div class="layui-input-block">
<input type="text" name="roleName" placeholder="请输入角色名称" autocomplete="off" class="layui-input" />
</div>
</div>
<div class="layui-inline searchBtn" pane >
<button type="button" class="layui-btn layui-btn-normal" id="roleSearch">查询</button>
</div>
......@@ -65,22 +76,31 @@
var $ = layui.$
// 商户名称列表
var merchantName = $("#merchantName")
var cols = [
//表头
{ field: '', title: '序号', type: 'numbers', width: 80 },
{ field: 'roleName', title: '角色名称', align: 'center' },
{ field: 'roleCode', title: '角色号', align: 'center' },
{ field: 'merchantName', title: '所属商户名', align: 'center' },
{ field: 'statusName', title: '状态', align: 'center' },
{ field: 'updatedTime', title: '更新时间', align: 'center' ,width: 112},
{ 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: [
[
//表头
{ field: '', title: '序号', type: 'numbers', width: 80 },
{ field: 'roleName', title: '角色名称', align: 'center' },
{ field: 'roleCode', title: '角色号', align: 'center' },
{ field: 'merchantName', title: '所属商户名', align: 'center' },
{ field: 'statusName', title: '状态', align: 'center' },
{ field: 'updatedTime', title: '更新时间', align: 'center' ,width: 112},
{ fixed: 'right', title: '操作', width: 160, align: 'center', toolbar: '#roleBar' }
]
]
cols: gl ? [cols] : [colums]
})
// 分页配置
......@@ -179,13 +199,6 @@
// 新增点击事件
$('#addRole').on('click', function() {
go('role', 'add')
// var value = merchantName.val()
// var params = { merchantId: value }
// if (value) {
// go('role', 'add', params)
// } else {
// layer.msg('请选择商户')
// }
})
// 查询事件
$('#roleSearch').on('click', function() {
......
......@@ -15,10 +15,15 @@
/**
* 跳转方法 TODO
*/
function go(module, page, params) {
function go(module, page, params, blank) {
var _p = (!params || layui.$.isEmptyObject(params)) ? '' : genurl(params)
var href = '/html/' + module + '/' + page + '.html'
window.location.href = _p ? href + '?' + _p : href
if (blank) {
window.open(href, '_blank')
} else {
window.location.href = _p ? href + '?' + _p : href
}
}
function loadLayConfig() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!