Commit c12d4857 by 胡悦

修复角色和商户

1 parent 15c8c86c
...@@ -12,6 +12,11 @@ ...@@ -12,6 +12,11 @@
<link rel="stylesheet" type="text/css" href="/css/commonResetIndex.css" /> <link rel="stylesheet" type="text/css" href="/css/commonResetIndex.css" />
<title>员工管理</title> <title>员工管理</title>
</head> </head>
<style>
xm-select > .xm-body .scroll-body {
width: 300px;
}
</style>
<body> <body>
<div id="app"> <div id="app">
...@@ -31,7 +36,8 @@ ...@@ -31,7 +36,8 @@
<div class="layui-inline merchantNames" pane> <div class="layui-inline merchantNames" pane>
<label class="layui-form-label">商户名称</label> <label class="layui-form-label">商户名称</label>
<div class="layui-input-block"> <div class="layui-input-block">
<select name="merchantId" id="merchantName" lay-verify="required"></select> <!-- <select name="merchantId" id="merchantName" lay-verify="required"></select> -->
<div id="merchantNameSelect" style="width: 300px;" class="xm-select-demo"></div>
</div> </div>
</div> </div>
</div> </div>
...@@ -80,12 +86,13 @@ ...@@ -80,12 +86,13 @@
<script src="https://www.layuicdn.com/layui/layui.js"></script> <script src="https://www.layuicdn.com/layui/layui.js"></script>
<script src="/js/load.js"></script> <script src="/js/load.js"></script>
<script> <script>
layui.use(['table', 'request', 'form', 'helper', 'laypage'], function () { layui.use(['table', 'request', 'form', 'helper', 'laypage', 'xmSelect'], function () {
var request = layui.request var request = layui.request
var table = layui.table var table = layui.table
var form = layui.form var form = layui.form
var helper = layui.helper var helper = layui.helper
var laypage = layui.laypage var laypage = layui.laypage
var xmSelect = layui.xmSelect
var $ = layui.$ var $ = layui.$
// var isDxternal = isAppend() // var isDxternal = isAppend()
// if (isDxternal) { // if (isDxternal) {
...@@ -177,6 +184,17 @@ ...@@ -177,6 +184,17 @@
} }
} }
var merchantNameSelect = xmSelect.render({
el: '#merchantNameSelect',
prop: {
name: 'merchantName',
value: 'id'
},
filterable: true,
radio: true,
data: []
})
// 初始化 // 初始化
init() init()
...@@ -265,6 +283,7 @@ ...@@ -265,6 +283,7 @@
// 查询事件 // 查询事件
$('#employeeSearch').on('click', function () { $('#employeeSearch').on('click', function () {
var searchData = getSearch() var searchData = getSearch()
console.log(searchData)
getTabelList(employeeTable, searchData, true) getTabelList(employeeTable, searchData, true)
}) })
...@@ -317,18 +336,20 @@ ...@@ -317,18 +336,20 @@
employeeTable.reload(options) employeeTable.reload(options)
}) })
} }
// 查询所有商户 // 查询所有商户
function findAllMerchant() { function findAllMerchant() {
var params = { method: 'cn.com.glsx.merchants.menu.findAllMerchant' } var params = { method: 'cn.com.glsx.merchants.menu.findAllMerchant' }
request(params, function (result) { request(params, function (result) {
if (result.code == '0') { if (result.code == '0') {
var list = result.data console.log(result.data)
list.unshift('') merchantNameSelect.update({
$.each(list, function (index, item) { data: result.data,
merchantName.append(new Option(item.merchantName, item.id)) autoRow: true,
paging: result.data.length > 20
}) })
form.render('select')
} }
}) })
} }
...@@ -347,8 +368,12 @@ ...@@ -347,8 +368,12 @@
searchData.staffName = '' searchData.staffName = ''
searchData.staffPhone = '' searchData.staffPhone = ''
} }
if (searchData.select) {
searchData.merchantId = searchData.select
}
delete searchData.type delete searchData.type
delete searchData.keywords delete searchData.keywords
delete searchData.select
return searchData return searchData
} }
......
...@@ -1491,28 +1491,6 @@ ...@@ -1491,28 +1491,6 @@
element.tabChange(name, id) element.tabChange(name, id)
if (name == 'roleAuth') { if (name == 'roleAuth') {
$(`#nomenu${id}`).html('请选择产品') $(`#nomenu${id}`).html('请选择产品')
} else {
const accounttypeId = id.split('_')[1]
const productId = id.split('_')[2]
$(`#nodata${accounttypeId}`).removeClass('show')
$(`#nodata${accounttypeId}`).addClass('hide')
$(`#nomenu${accounttypeId}`).html('暂无可选择的菜单功能')
console.log(menuFunTreeData)
menuFunTreeData.forEach(item => {
if (item.accounttypeId == accounttypeId) {
item.products.forEach(i => {
if (i.productId == productId) {
if (i.merchantProTreeResponses.length == 0) {
$(`#nomenutab_${accounttypeId}_${productId}`).removeClass('hide')
$(`#nomenutab_${accounttypeId}_${productId}`).addClass('show')
} else {
$(`#nomenutab_${accounttypeId}_${productId}`).removeClass('show')
$(`#nomenutab_${accounttypeId}_${productId}`).addClass('hide')
}
}
})
}
})
} }
}, },
/** /**
...@@ -1572,6 +1550,23 @@ ...@@ -1572,6 +1550,23 @@
roleId, roleId,
changeObj.merchantProTreeResponses changeObj.merchantProTreeResponses
) )
$(`#nodata${roleId}`).removeClass('show')
$(`#nodata${roleId}`).addClass('hide')
menuFunTreeData.forEach(item => {
if (item.accounttypeId == roleId) {
item.products.forEach(i => {
if (i.productId == projectId) {
if (i.merchantProTreeResponses.length == 0) {
$(`#nomenutab_${roleId}_${projectId}`).removeClass('hide')
$(`#nomenutab_${roleId}_${projectId}`).addClass('show')
} else {
$(`#nomenutab_${roleId}_${projectId}`).removeClass('show')
$(`#nomenutab_${roleId}_${projectId}`).addClass('hide')
}
}
})
}
})
} else { } else {
// 删除 // 删除
console.log(treeData, Object.keys(treeData).length) console.log(treeData, Object.keys(treeData).length)
......
...@@ -411,21 +411,6 @@ ...@@ -411,21 +411,6 @@
</div> </div>
</div> </div>
</div> </div>
<div class="layui-form-item hide" id="effectiveShowEl">
<label class="layui-form-label required">账户有效期:</label>
<div class="layui-inline">
<div class="layui-input-inline">
<input type="text" id="effectiveStarttime" class="layui-input" name="effectiveStarttime" placeholder="开始时间" />
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline">
<input type="text" id="expireDate" disabled class="layui-input" name="expireDate" placeholder="结束时间" />
</div>
<button id="sevenday" type="button" class="layui-btn btn-no-border">续7天</button>
<button id="oneyear" type="button" class="layui-btn btn-no-border">续1年</button>
<button id="twoyears" type="button" class="layui-btn btn-no-border">续2年</button>
</div>
</div>
<div class="layui-col-md6"> <div class="layui-col-md6">
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label required">登录账户名:</label> <label class="layui-form-label required">登录账户名:</label>
...@@ -460,12 +445,28 @@ ...@@ -460,12 +445,28 @@
</div> </div>
</div> </div>
</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-inline"> <div class="layui-input-inline">
<select id="accountLevelEl" name="merchantAccountLevel" lay-filter="accountLevel" required lay-vertify="required" lay-search></select> <select id="accountLevelEl" name="merchantAccountLevel" lay-filter="accountLevel" required lay-vertify="required" lay-search></select>
</div> </div>
</div> </div>
<div class="layui-form-item hide" id="effectiveShowEl">
<label class="layui-form-label required">账户有效期:</label>
<div class="layui-inline">
<div class="layui-input-inline">
<input type="text" id="effectiveStarttime" class="layui-input" name="effectiveStarttime" placeholder="开始时间" />
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline">
<input type="text" id="expireDate" disabled class="layui-input" name="expireDate" placeholder="结束时间" />
</div>
<button id="sevenday" type="button" class="layui-btn btn-no-border">续7天</button>
<button id="oneyear" type="button" class="layui-btn btn-no-border">续1年</button>
<button id="twoyears" type="button" class="layui-btn btn-no-border">续2年</button>
</div>
</div>
<!-- <div class="layui-form-item" id="effectiveShowEl"> <!-- <div class="layui-form-item" id="effectiveShowEl">
<label class="layui-form-label required">账户有效期:</label> <label class="layui-form-label required">账户有效期:</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
...@@ -612,8 +613,6 @@ ...@@ -612,8 +613,6 @@
min: helper.dateFormat(new Date()), min: helper.dateFormat(new Date()),
done: function (value, date) { done: function (value, date) {
console.log(value, date, helper.dateFormat(new Date())) console.log(value, date, helper.dateFormat(new Date()))
// $('#effectiveStarttime').change()
// effectiveStarttime.config.min = helper.dateFormat(new Date())
date.month = date.month - 1 date.month = date.month - 1
$('#expireDate').val('') $('#expireDate').val('')
expireDate.config.min = date expireDate.config.min = date
...@@ -1510,28 +1509,6 @@ ...@@ -1510,28 +1509,6 @@
element.tabChange(name, id) element.tabChange(name, id)
if (name == 'roleAuth') { if (name == 'roleAuth') {
$(`#nomenu${id}`).html('请选择产品') $(`#nomenu${id}`).html('请选择产品')
} else {
const accounttypeId = id.split('_')[1]
const productId = id.split('_')[2]
$(`#nodata${accounttypeId}`).removeClass('show')
$(`#nodata${accounttypeId}`).addClass('hide')
$(`#nomenu${accounttypeId}`).html('暂无可选择的菜单功能')
console.log(menuFunTreeData)
menuFunTreeData.forEach(item => {
if (item.accounttypeId == accounttypeId) {
item.products.forEach(i => {
if (i.productId == productId) {
if (i.merchantProTreeResponses.length == 0) {
$(`#nomenutab_${accounttypeId}_${productId}`).removeClass('hide')
$(`#nomenutab_${accounttypeId}_${productId}`).addClass('show')
} else {
$(`#nomenutab_${accounttypeId}_${productId}`).removeClass('show')
$(`#nomenutab_${accounttypeId}_${productId}`).addClass('hide')
}
}
})
}
})
} }
}, },
/** /**
...@@ -1591,6 +1568,23 @@ ...@@ -1591,6 +1568,23 @@
roleId, roleId,
changeObj.merchantProTreeResponses changeObj.merchantProTreeResponses
) )
$(`#nodata${roleId}`).removeClass('show')
$(`#nodata${roleId}`).addClass('hide')
menuFunTreeData.forEach(item => {
if (item.accounttypeId == roleId) {
item.products.forEach(i => {
if (i.productId == projectId) {
if (i.merchantProTreeResponses.length == 0) {
$(`#nomenutab_${roleId}_${projectId}`).removeClass('hide')
$(`#nomenutab_${roleId}_${projectId}`).addClass('show')
} else {
$(`#nomenutab_${roleId}_${projectId}`).removeClass('show')
$(`#nomenutab_${roleId}_${projectId}`).addClass('hide')
}
}
})
}
})
} else { } else {
// 删除 // 删除
console.log(treeData, Object.keys(treeData).length) console.log(treeData, Object.keys(treeData).length)
......
...@@ -1457,32 +1457,9 @@ ...@@ -1457,32 +1457,9 @@
}, },
// tab Change // tab Change
tabChange: function (name, id) { tabChange: function (name, id) {
console.log(name, id)
element.tabChange(name, id) element.tabChange(name, id)
if (name == 'roleAuth') { if (name == 'roleAuth') {
$(`#nomenu${id}`).html('请选择产品') $(`#nomenu${id}`).html('请选择产品')
} else {
const accounttypeId = id.split('_')[1]
const productId = id.split('_')[2]
$(`#nodata${accounttypeId}`).removeClass('show')
$(`#nodata${accounttypeId}`).addClass('hide')
$(`#nomenu${accounttypeId}`).html('暂无可选择的菜单功能')
console.log(menuFunTreeData, accounttypeId, productId)
menuFunTreeData.forEach(item => {
if (item.accounttypeId == accounttypeId) {
item.products.forEach(i => {
if (i.productId == productId) {
if (i.merchantProTreeResponses.length == 0) {
$(`#nomenutab_${accounttypeId}_${productId}`).removeClass('hide')
$(`#nomenutab_${accounttypeId}_${productId}`).addClass('show')
} else {
$(`#nomenutab_${accounttypeId}_${productId}`).removeClass('show')
$(`#nomenutab_${accounttypeId}_${productId}`).addClass('hide')
}
}
})
}
})
} }
}, },
/** /**
...@@ -1552,6 +1529,23 @@ ...@@ -1552,6 +1529,23 @@
roleId, roleId,
changeObj.merchantProTreeResponses changeObj.merchantProTreeResponses
) )
$(`#nodata${roleId}`).removeClass('show')
$(`#nodata${roleId}`).addClass('hide')
menuFunTreeData.forEach(item => {
if (item.accounttypeId == roleId) {
item.products.forEach(i => {
if (i.productId == projectId) {
if (i.merchantProTreeResponses.length == 0) {
$(`#nomenutab_${roleId}_${projectId}`).removeClass('hide')
$(`#nomenutab_${roleId}_${projectId}`).addClass('show')
} else {
$(`#nomenutab_${roleId}_${projectId}`).removeClass('show')
$(`#nomenutab_${roleId}_${projectId}`).addClass('hide')
}
}
})
}
})
} else { } else {
// 删除 // 删除
console.log(treeData, Object.keys(treeData).length) console.log(treeData, Object.keys(treeData).length)
......
...@@ -112,25 +112,26 @@ ...@@ -112,25 +112,26 @@
effectiveTime: getQueryString('status') effectiveTime: getQueryString('status')
}) })
} }
var effectiveStarttime = laydate.render({ var effectiveStarttime = laydate.render({
elem: '#effectiveStarttime', elem: '#effectiveStarttime',
format: 'yyyy-MM-dd', format: 'yyyy-MM-dd',
min: '', min: helper.dateFormat(new Date()),
done: function (value, date) { done: function (value, date) {
effectiveStarttime.config.min = helper.dateFormat(new Date()) // effectiveStarttime.config.min = helper.dateFormat(new Date())
console.log(value, date) console.log(value, date)
date.month = date.month - 1 date.month = date.month - 1
expireDate.config.min = date // expireDate.config.min = date
$('#expireDate').val('')
lay('#effectiveStarttime').html(value) lay('#effectiveStarttime').html(value)
} }
}) })
var expireDate = laydate.render({ var expireDate = laydate.render({
elem: '#expireDate', elem: '#expireDate',
format: 'yyyy-MM-dd', format: 'yyyy-MM-dd',
min: $('#effectiveStarttime').val() min: helper.dateFormat(new Date())
}) })
$('#sevenday').on('click', function () { $('#sevenday').on('click', function () {
const startDate = getStartTime(vaildData.expireDate).startDate const startDate = getStartTime(vaildData.expireDate).startDate
......
...@@ -456,6 +456,7 @@ ...@@ -456,6 +456,7 @@
accounttypeId: data.elem.value accounttypeId: data.elem.value
}) })
active.tabAdd(obj) active.tabAdd(obj)
console.log(check_arr)
} else { } else {
for (var i in check_arr) { for (var i in check_arr) {
var id = check_arr[i].accounttypeId var id = check_arr[i].accounttypeId
...@@ -501,6 +502,7 @@ ...@@ -501,6 +502,7 @@
$('#draft').on('click', function() { $('#draft').on('click', function() {
var formVal = form.val('roleForm') var formVal = form.val('roleForm')
if (formVal.roleName || formVal.roleDescription || Object.keys(treeData).length != 0) { if (formVal.roleName || formVal.roleDescription || Object.keys(treeData).length != 0) {
getAuthList()
insert(1, formVal) insert(1, formVal)
} else { } else {
layer.msg('至少填一项') layer.msg('至少填一项')
...@@ -687,74 +689,85 @@ ...@@ -687,74 +689,85 @@
// 获取角色权限数据requestList // 获取角色权限数据requestList
function getAuthList() { function getAuthList() {
requestList = [] requestList = []
console.log(treeData) console.log(treeData, check_arr)
for (var key in treeData) { check_arr.forEach(i => {
var accountObj = treeData[key] for (var key in treeData) {
var productList = [] var accountObj = treeData[key]
if (Object.keys(accountObj).length != 0) { var productList = []
for (var i in accountObj) { console.log(treeData)
var productObj = accountObj[i] if (i.accounttypeId == key) {
var menuIdList = [] if (Object.keys(accountObj).length != 0) {
var functionIdList = [] for (var i in accountObj) {
var functionIdLists = [] var productObj = accountObj[i]
var functionValueIdLists = [] var menuIdList = []
if (productObj.treeObj) { var functionIdList = []
var nodes = productObj.treeObj.getCheckedNodes(true) var functionIdLists = []
$.each(nodes, function(index, item) { var functionValueIdLists = []
if (item.logo == 'function') { if (productObj.treeObj) {
functionIdLists.push(item) var nodes = productObj.treeObj.getCheckedNodes(true)
} else if (item.logo == 'functionValue') { $.each(nodes, function(index, item) {
functionValueIdLists.push(item) if (item.logo == 'function') {
} else { functionIdLists.push(item)
if (item.logo != 'neglect') { } else if (item.logo == 'functionValue') {
menuIdList.push(item.id) functionValueIdLists.push(item)
} } else {
} if (item.logo != 'neglect') {
}) menuIdList.push(item.id)
$.each(functionValueIdLists, function(idx, m) { }
// m.parentId }
var findIdx = -1 })
$.each(functionIdList, function(idn, n) { $.each(functionValueIdLists, function(idx, m) {
if (n.id == m.parentId) { // m.parentId
findIdx = idn var findIdx = -1
} $.each(functionIdList, function(idn, n) {
}) if (n.id == m.parentId) {
if (findIdx != -1) { findIdx = idn
functionIdList[findIdx].functionValue += ';' + m.id + ':' + m.label }
})
if (findIdx != -1) {
functionIdList[findIdx].functionValue += ';' + m.id + ':' + m.label
} else {
functionIdList.push({
id: m.parentId,
menuId: m.superParentId,
functionValue: m.id + ':' + m.label
})
}
})
$.each(functionIdLists, function(idx, m) {
// console.log(m)
functionIdList.push({
id: m.parentId,
menuId: m.superParentId
})
})
productList.push({
productId: productObj.productId,
functionIdList: functionIdList,
menuIdList: menuIdList
})
} else { } else {
functionIdList.push({ productList.push({
id: m.parentId, productId: productObj.productId,
menuId: m.superParentId, functionIdList: [],
functionValue: m.id + ':' + m.label menuIdList: []
}) })
} }
}) }
$.each(functionIdLists, function(idx, m) { requestList.push({
// console.log(m) accountTypeId: key,
functionIdList.push({ productList: productList
id: m.parentId,
menuId: m.superParentId
})
})
productList.push({
productId: productObj.productId,
functionIdList: functionIdList,
menuIdList: menuIdList
})
} else {
productList.push({
productId: productObj.productId,
functionIdList: [],
menuIdList: []
}) })
} }
} else {
requestList.push({
accountTypeId: i.accounttypeId,
productList: []
})
} }
requestList.push({
accountTypeId: key,
productList: productList
})
} }
} })
} }
// 查询所有商户 // 查询所有商户
......
...@@ -80,6 +80,7 @@ ...@@ -80,6 +80,7 @@
var $ = layui.$ var $ = layui.$
// 商户名称列表 // 商户名称列表
var merchantName = $('#merchantName') var merchantName = $('#merchantName')
var accountInfo = helper.store.get('accountInfo')
var cols = [ var cols = [
//表头 //表头
{ field: '', title: '序号', type: 'numbers', width: 60 }, { field: '', title: '序号', type: 'numbers', width: 60 },
...@@ -105,7 +106,7 @@ ...@@ -105,7 +106,7 @@
elem: '#roleTable', elem: '#roleTable',
skin: 'nob', skin: 'nob',
height: 'full-300', height: 'full-300',
cols: gl ? [cols] : [colums] cols: accountInfo && accountInfo.merchantAccountLevel == 4 ? [colums] : [cols]
}) })
// 分页配置 // 分页配置
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!