Commit 95ea0eb4 by 李长胜

Merge branch 'master' of http://192.168.3.233:8090/h5/account

2 parents 56e52a5b 8760ffbd
...@@ -1487,7 +1487,33 @@ ...@@ -1487,7 +1487,33 @@
}, },
// 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') {
$(`#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')
}
}
})
}
})
}
}, },
/** /**
* 第二级选项卡 * 第二级选项卡
...@@ -1520,11 +1546,6 @@ ...@@ -1520,11 +1546,6 @@
if (treeListData && treeListData.length != 0) { if (treeListData && treeListData.length != 0) {
treeData[id][item.value].treeObj = tree.create(treedom, treeListData) treeData[id][item.value].treeObj = tree.create(treedom, treeListData)
treeData[id][item.value].treeObj.checkAllNodes(true) treeData[id][item.value].treeObj.checkAllNodes(true)
$(`#nodata${id}`).removeClass('show')
$(`#nodata${id}`).addClass('hide')
} else {
$(`#nodata${id}`).removeClass('hide')
$(`#nodata${id}`).addClass('show')
} }
} }
} }
...@@ -1664,82 +1685,95 @@ ...@@ -1664,82 +1685,95 @@
for (var key in treeData) { for (var key in treeData) {
var accountObj = treeData[key] var accountObj = treeData[key]
var productList = [] var productList = []
for (var i in accountObj) { console.log(accountObj)
var productObj = accountObj[i] if (Object.keys(accountObj).length != 0) {
var menuIds = [] for (var i in accountObj) {
var functionIds = [] var productObj = accountObj[i]
var functionIdLists = [] var menuIds = []
var functionValueIdLists = [] var functionIds = []
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') {
menuIds.push(item.id) functionValueIdLists.push(item)
} } else {
} if (item.logo != 'neglect') {
}) menuIds.push(item.id)
$.each(functionValueIdLists, function (idx, m) { }
var findIdx = -1 }
$.each(functionIds, function (idn, n) { })
if (n.functionId == m.parentId) { $.each(functionValueIdLists, function (idx, m) {
findIdx = idn var findIdx = -1
} $.each(functionIds, function (idn, n) {
}) if (n.functionId == m.parentId) {
if (findIdx != -1) { findIdx = idn
functionIds[findIdx].functionValue += ';' + m.id + ':' + m.label }
})
if (findIdx != -1) {
functionIds[findIdx].functionValue += ';' + m.id + ':' + m.label
} else {
functionIds.push({
functionId: m.parentId,
mendId: m.superParentId,
functionValue: m.id + ':' + m.label
})
}
})
$.each(functionIdLists, function (idx, m) {
functionIds.push({
functionId: m.parentId,
mendId: m.superParentId
})
})
productList.push({
productId: productObj.productId,
functionIds: functionIds,
menuIds: menuIds
})
} else { } else {
functionIds.push({ productList.push({
functionId: m.parentId, productId: productObj.productId,
mendId: m.superParentId, functionIdList: [],
functionValue: m.id + ':' + m.label menuIdList: []
}) })
} }
}) }
$.each(functionIdLists, function (idx, m) { requestList.push({
functionIds.push({ accountTypeId: key,
functionId: m.parentId, products: productList
mendId: m.superParentId
})
})
productList.push({
productId: productObj.productId,
functionIds: functionIds,
menuIds: menuIds
}) })
} }
requestList.push({
accountTypeId: key,
products: productList
})
} }
} }
$('#draft').on('click', function () { $('#draft').on('click', function () {
getAuthList() getAuthList()
var params = {
merchantId: merchantId,
// accountTypes: JSON.stringify(requestList),
method: 'cn.com.glsx.merchants.merchant.updatePermissions',
status: merchantForm.status
}
if (requestList.length != 0) { if (requestList.length != 0) {
var params = { params.accountTypes = JSON.stringify(requestList)
merchantId: merchantId,
accountTypes: JSON.stringify(requestList),
method: 'cn.com.glsx.merchants.merchant.updatePermissions',
status: merchantForm.status
}
request(params, function (res) {
if (res.code == '0') {
layer.msg('操作成功', {
icon: 1
})
go('merchant', 'index')
}
})
} else { } else {
layer.msg('请选择产品', { params.accountTypes = JSON.stringify([])
icon: 5
})
} }
request(params, function (res) {
if (res.code == '0') {
layer.msg('操作成功', {
icon: 1
})
go('merchant', 'index')
}
})
// layer.msg('请选择产品', {
// icon: 5
// })
return false return false
}) })
...@@ -1784,6 +1818,12 @@ ...@@ -1784,6 +1818,12 @@
<!-- <button class="layui-btn" data-type="d.id" id="checkedAll">全选</button> <!-- <button class="layui-btn" data-type="d.id" id="checkedAll">全选</button>
<button class="layui-btn" id="cancelCheckedAll">取消全选</button> --> <button class="layui-btn" id="cancelCheckedAll">取消全选</button> -->
<ul id="tree_{{d.id}}" class="ztree wrapper-tree"></ul> <ul id="tree_{{d.id}}" class="ztree wrapper-tree"></ul>
<div class="layui-no-data show" id="nomenu{{d.id}}">
<div class="no-data">
<img src="../../css/img/no-data.png" />
<div>暂无可选择的菜单功能</div>
</div>
</div>
</script> </script>
</body> </body>
</html> </html>
...@@ -737,8 +737,8 @@ ...@@ -737,8 +737,8 @@
'merchantLoginPassword', 'merchantLoginPassword',
'merchantAccountLevel', 'merchantAccountLevel',
'effectiveTime', 'effectiveTime',
'effectiveStarttime', // 'effectiveStarttime',
'expireDate' // 'expireDate'
] ]
if (formData.isloginName == 'on') { if (formData.isloginName == 'on') {
params.isloginName = 1 params.isloginName = 1
...@@ -760,8 +760,8 @@ ...@@ -760,8 +760,8 @@
merchantForm[item] = formData[item] || '' merchantForm[item] = formData[item] || ''
params[item] = formData[item] || '' params[item] = formData[item] || ''
}) })
params.effectiveStarttime = new Date(params.effectiveStarttime ) if (formData.effectiveStarttime) params.effectiveStarttime = new Date(formData.effectiveStarttime )
params.expireDate = new Date(params.expireDate ) if (formData.expireDate) params.expireDate = new Date(formData.expireDate )
if (merchantId) { if (merchantId) {
params.effectiveTime = merchantForm.effectiveTime params.effectiveTime = merchantForm.effectiveTime
} }
...@@ -1501,7 +1501,33 @@ ...@@ -1501,7 +1501,33 @@
}, },
// 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') {
$(`#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')
}
}
})
}
})
}
}, },
/** /**
* 第二级选项卡 * 第二级选项卡
...@@ -1534,11 +1560,6 @@ ...@@ -1534,11 +1560,6 @@
if (treeListData && treeListData.length != 0) { if (treeListData && treeListData.length != 0) {
treeData[id][item.value].treeObj = tree.create(treedom, treeListData) treeData[id][item.value].treeObj = tree.create(treedom, treeListData)
treeData[id][item.value].treeObj.checkAllNodes(true) treeData[id][item.value].treeObj.checkAllNodes(true)
$(`#nodata${id}`).removeClass('show')
$(`#nodata${id}`).addClass('hide')
} else {
$(`#nodata${id}`).removeClass('hide')
$(`#nodata${id}`).addClass('show')
} }
} }
} }
...@@ -1678,57 +1699,67 @@ ...@@ -1678,57 +1699,67 @@
for (var key in treeData) { for (var key in treeData) {
var accountObj = treeData[key] var accountObj = treeData[key]
var productList = [] var productList = []
for (var i in accountObj) { if (Object.keys(accountObj).length != 0) {
var productObj = accountObj[i] for (var i in accountObj) {
var menuIds = [] var productObj = accountObj[i]
var functionIds = [] var menuIds = []
var functionIdLists = [] var functionIds = []
var functionValueIdLists = [] var functionIdLists = []
var nodes = productObj.treeObj.getCheckedNodes(true) var functionValueIdLists = []
$.each(nodes, function (index, item) { if (productObj.treeObj) {
if (item.logo == 'function') { var nodes = productObj.treeObj.getCheckedNodes(true)
functionIdLists.push(item) $.each(nodes, function (index, item) {
} else if (item.logo == 'functionValue') { if (item.logo == 'function') {
functionValueIdLists.push(item) functionIdLists.push(item)
} else { } else if (item.logo == 'functionValue') {
if (item.logo != 'neglect') { functionValueIdLists.push(item)
menuIds.push(item.id) } else {
} if (item.logo != 'neglect') {
} menuIds.push(item.id)
}) }
$.each(functionValueIdLists, function (idx, m) { }
var findIdx = -1 })
$.each(functionIds, function (idn, n) { $.each(functionValueIdLists, function (idx, m) {
if (n.functionId == m.parentId) { var findIdx = -1
findIdx = idn $.each(functionIds, function (idn, n) {
} if (n.functionId == m.parentId) {
}) findIdx = idn
if (findIdx != -1) { }
functionIds[findIdx].functionValue += ';' + m.id + ':' + m.label })
if (findIdx != -1) {
functionIds[findIdx].functionValue += ';' + m.id + ':' + m.label
} else {
functionIds.push({
functionId: m.parentId,
mendId: m.superParentId,
functionValue: m.id + ':' + m.label
})
}
})
$.each(functionIdLists, function (idx, m) {
functionIds.push({
functionId: m.parentId,
mendId: m.superParentId
})
})
productList.push({
productId: productObj.productId,
functionIds: functionIds,
menuIds: menuIds
})
} else { } else {
functionIds.push({ productList.push({
functionId: m.parentId, productId: productObj.productId,
mendId: m.superParentId, functionIdList: [],
functionValue: m.id + ':' + m.label menuIdList: []
}) })
} }
}) }
$.each(functionIdLists, function (idx, m) { requestList.push({
functionIds.push({ accountTypeId: key,
functionId: m.parentId, products: productList
mendId: m.superParentId
})
})
productList.push({
productId: productObj.productId,
functionIds: functionIds,
menuIds: menuIds
}) })
} }
requestList.push({
accountTypeId: key,
products: productList
})
} }
} }
...@@ -1736,10 +1767,15 @@ ...@@ -1736,10 +1767,15 @@
getAuthList() getAuthList()
var params = { var params = {
merchantId: merchantId, merchantId: merchantId,
accountTypes: JSON.stringify(requestList), // accountTypes: JSON.stringify(requestList),
method: 'cn.com.glsx.merchants.merchant.updatePermissions', method: 'cn.com.glsx.merchants.merchant.updatePermissions',
status: merchantForm.status status: merchantForm.status
} }
if (requestList.length != 0) {
params.accountTypes = JSON.stringify(requestList)
} else {
params.accountTypes = JSON.stringify([])
}
request(params, function (res) { request(params, function (res) {
if (res.code == '0') { if (res.code == '0') {
layer.msg('操作成功', { layer.msg('操作成功', {
...@@ -1758,25 +1794,31 @@ ...@@ -1758,25 +1794,31 @@
$('#confirm').on('click', function () { $('#confirm').on('click', function () {
getAuthList() getAuthList()
var params = { if (requestList.length != 0) {
merchantId: merchantId, var params = {
accountTypes: JSON.stringify(requestList) merchantId: merchantId,
} accountTypes: JSON.stringify(requestList)
params.method = 'cn.com.glsx.merchants.merchant.updatePermissions' }
// 草稿 params.method = 'cn.com.glsx.merchants.merchant.updatePermissions'
if (merchantForm.status == 1) { // 草稿
params.status = 2 if (merchantForm.status == 1) {
params.status = 2
} else {
params.status = merchantForm.status
}
request(params, function (res) {
if (res.code == '0') {
layer.msg('操作成功', {
icon: 1
})
go('merchant', 'index')
}
})
} else { } else {
params.status = merchantForm.status layer.msg('请选择产品', {
icon: 5
})
} }
request(params, function (res) {
if (res.code == '0') {
layer.msg('操作成功', {
icon: 1
})
go('merchant', 'index')
}
})
return false return false
}) })
}) })
...@@ -1785,6 +1827,12 @@ ...@@ -1785,6 +1827,12 @@
<!-- <button class="layui-btn" data-type="d.id" id="checkedAll">全选</button> <!-- <button class="layui-btn" data-type="d.id" id="checkedAll">全选</button>
<button class="layui-btn" id="cancelCheckedAll">取消全选</button> --> <button class="layui-btn" id="cancelCheckedAll">取消全选</button> -->
<ul id="tree_{{d.id}}" class="ztree wrapper-tree"></ul> <ul id="tree_{{d.id}}" class="ztree wrapper-tree"></ul>
<div class="layui-no-data show" id="nomenu{{d.id}}">
<div class="no-data">
<img src="../../css/img/no-data.png" />
<div>暂无可选择的菜单功能</div>
</div>
</div>
</script> </script>
</body> </body>
</html> </html>
...@@ -466,7 +466,7 @@ ...@@ -466,7 +466,7 @@
</div> </div>
<div class="merchant-right"> <div class="merchant-right">
<div> <div>
<span class="companyName">员工列表</span> <span id="companyName" class="companyName"></span>
<div class="layui-input-inline"> <div class="layui-input-inline">
<input class="layui-input" placeholder="请输入员工姓名/手机号" id="tableSearchForm" /> <input class="layui-input" placeholder="请输入员工姓名/手机号" id="tableSearchForm" />
</div> </div>
...@@ -692,6 +692,7 @@ ...@@ -692,6 +692,7 @@
$('#secondmerchantId').text(data.merchantNo) $('#secondmerchantId').text(data.merchantNo)
$('#numberOfSubMerchants').text(data.numberOfSubMerchants) $('#numberOfSubMerchants').text(data.numberOfSubMerchants)
$('#numberOfStores').text(data.numberOfStores) $('#numberOfStores').text(data.numberOfStores)
$('#companyName').html(data.merchantName)
} }
) )
} }
......
...@@ -1457,7 +1457,33 @@ ...@@ -1457,7 +1457,33 @@
}, },
// 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') {
$(`#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')
}
}
})
}
})
}
}, },
/** /**
* 第二级选项卡 * 第二级选项卡
...@@ -1499,11 +1525,6 @@ ...@@ -1499,11 +1525,6 @@
} else { } else {
treeData[id][item.value].treeObj.checkAllNodes(true) treeData[id][item.value].treeObj.checkAllNodes(true)
} }
$(`#nodata${id}`).removeClass('show')
$(`#nodata${id}`).addClass('hide')
} else {
$(`#nodata${id}`).removeClass('hide')
$(`#nodata${id}`).addClass('show')
} }
// } // }
} }
...@@ -1600,6 +1621,13 @@ ...@@ -1600,6 +1621,13 @@
products.merchantProTreeResponses, products.merchantProTreeResponses,
j.menuIds j.menuIds
) )
if (products.merchantProTreeResponses.length == 0) {
$(`#nomenutab_${id}_${j.productId}`).removeClass('hide')
$(`#nomenutab_${id}_${j.productId}`).addClass('show')
} else {
$(`#nomenutab_${id}_${j.productId}`).removeClass('show')
$(`#nomenutab_${id}_${j.productId}`).addClass('hide')
}
}) })
var filterName = 'treeTab' + item.accounttypeId var filterName = 'treeTab' + item.accounttypeId
var productId = 'tab_' + item.accounttypeId + '_' + productData.products[0].productId var productId = 'tab_' + item.accounttypeId + '_' + productData.products[0].productId
...@@ -1642,79 +1670,97 @@ ...@@ -1642,79 +1670,97 @@
// 获取角色权限数据requestList // 获取角色权限数据requestList
function getAuthList() { function getAuthList() {
requestList = [] requestList = []
console.log(treeData)
for (var key in treeData) { for (var key in treeData) {
var accountObj = treeData[key] var accountObj = treeData[key]
var productList = [] var productList = []
for (var i in accountObj) { console.log(accountObj) // 判断是否为空
var productObj = accountObj[i] if (Object.keys(accountObj).length != 0) {
var menuIds = [] for (var i in accountObj) {
var functionIds = [] var productObj = accountObj[i]
var functionIdLists = [] var menuIds = []
var functionValueIdLists = [] var functionIds = []
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') {
menuIds.push(item.id) functionValueIdLists.push(item)
} } else {
} if (item.logo != 'neglect') {
}) menuIds.push(item.id)
$.each(functionValueIdLists, function (idx, m) { }
var findIdx = -1 }
$.each(functionIds, function (idn, n) { })
if (n.functionId == m.parentId) { $.each(functionValueIdLists, function (idx, m) {
findIdx = idn var findIdx = -1
} $.each(functionIds, function (idn, n) {
}) if (n.functionId == m.parentId) {
if (findIdx != -1) { findIdx = idn
functionIds[findIdx].functionValue += ';' + m.id + ':' + m.label }
})
if (findIdx != -1) {
functionIds[findIdx].functionValue += ';' + m.id + ':' + m.label
} else {
functionIds.push({
functionId: m.parentId,
mendId: m.superParentId,
functionValue: m.id + ':' + m.label
})
}
})
$.each(functionIdLists, function (idx, m) {
functionIds.push({
functionId: m.parentId,
mendId: m.superParentId
})
})
productList.push({
productId: productObj.productId,
functionIds: functionIds,
menuIds: menuIds
})
} else { } else {
functionIds.push({ productList.push({
functionId: m.parentId, productId: productObj.productId,
mendId: m.superParentId, functionIdList: [],
functionValue: m.id + ':' + m.label menuIdList: []
}) })
} }
}) }
$.each(functionIdLists, function (idx, m) { requestList.push({
functionIds.push({ accountTypeId: key,
functionId: m.parentId, products: productList
mendId: m.superParentId
})
})
productList.push({
productId: productObj.productId,
functionIds: functionIds,
menuIds: menuIds
}) })
} }
requestList.push({
accountTypeId: key,
products: productList
})
} }
} }
$('#draft').on('click', function () { $('#draft').on('click', function () {
getAuthList() getAuthList()
var params = { if (requestList.length != 0) {
merchantId: merchantId, var params = {
accountTypes: JSON.stringify(requestList), merchantId: merchantId,
method: 'cn.com.glsx.merchants.merchant.updatePermissions', accountTypes: JSON.stringify(requestList),
status: merchantForm.status method: 'cn.com.glsx.merchants.merchant.updatePermissions',
} status: merchantForm.status
request(params, function (res) {
if (res.code == '0') {
layer.msg('操作成功', {
icon: 1
})
go('merchant', 'index')
} }
}) request(params, function (res) {
if (res.code == '0') {
layer.msg('操作成功', {
icon: 1
})
go('merchant', 'index')
}
})
} else {
layer.msg('请选择产品', {
icon: 2
})
}
return false return false
}) })
...@@ -1764,6 +1810,12 @@ ...@@ -1764,6 +1810,12 @@
</script> </script>
<script type="text/html" id="treeAuth"> <script type="text/html" id="treeAuth">
<ul id="tree_{{d.id}}" class="ztree wrapper-tree"></ul> <ul id="tree_{{d.id}}" class="ztree wrapper-tree"></ul>
<div class="layui-no-data show" id="nomenu{{d.id}}">
<div class="no-data">
<img src="../../css/img/no-data.png" />
<div>暂无可选择的菜单功能</div>
</div>
</div>
</script> </script>
</body> </body>
</html> </html>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!