Commit 4ee53324 by cwq0219

商户详情

1 parent f9e168cc
......@@ -130,17 +130,17 @@
<div class="merchant-right">
<div>
<span id="merchantNameTable"></span>员工列表
<div class="layui-input-inline">
<input class="layui-input" placeholder="请输入员工姓名/手机号" id="tableSearchForm" />
</div>
<button class="layui-btn" id="tableSearch">查询</button>
<div class="layui-input-inline">
<input class="layui-input" placeholder="请输入员工姓名/手机号" id="tableSearchForm" />
</div>
<button class="layui-btn" id="tableSearch">查询</button>
</div>
<table id="subMerchantTable" lay-filter="subMerchantTool"></table>
</div>
</div>
</div>
<div class="layui-tab-item">
<ul class="layui-timeline">
<!-- <ul class="layui-timeline">
<li class="layui-timeline-item">
<i class="layui-icon layui-timeline-axis">&#xe63f;</i>
<div class="layui-timeline-content layui-text">
......@@ -193,11 +193,12 @@
<div class="layui-timeline-title">过去</div>
</div>
</li>
</ul>
</ul> -->
</div>
</div>
<div class="footer-close">
<button class="layui-btn" id="closeEl">关闭</button></div>
</div>
<div></div>
</main>
</div>
<script src="https://www.layuicdn.com/layui/layui.js"></script>
......@@ -213,7 +214,8 @@
var laytpl = layui.laytpl
var element = layui.element
var merchantId = qs('merchantId')
var merchantInfo = {}
var parentId = ''
var merchantForm = {}
var templateData = {}
var treeData = {}
var menuFunTreeData = []
......@@ -243,8 +245,6 @@
getSecondTable(subMerchantTable)
}
// 查询角色详情
function getFirstInfo(callback) {
var params = {
......@@ -262,20 +262,38 @@
}
})
}
// 获取功能权限基础数据
function findMenuFunTreeByMerId() {
var params = {
method: 'cn.com.glsx.merchants.merchant.findMenuFunTreeByMerId',
request({
method: 'cn.com.glsx.merchants.merchant.findMerchantDetail',
id: merchantId
}
request(params, function(res) {
if (res.code == '0') {
menuFunTreeData = res.data
getFirstInfo(function(responseList) {
console.log('responseList:', responseList)
if (responseList && responseList.length != 0) {
$.each(menuFunTreeData, function(index, item) {
}, function (res) {
merchantForm = res.data
parentId = merchantForm.parentId
var params = {}
if (parentId) {
params = {
method: 'cn.com.glsx.merchants.merchant.findMenuFunTreeByMerId',
id: merchantId,
parentId: parentId,
accountLevel: merchantForm.merchantAccountLevel
}
} else {
params = {
method: 'cn.com.glsx.merchants.merchant.accountTypeSearchRequest',
ids: merchantForm.accountType,
merchantId: merchantId,
accountLevel: merchantForm.merchantAccountLevel
}
}
request(params, function (res) {
if (res.code == '0') {
menuFunTreeData = res.data
getFirstInfo(function (responseList) {
console.log('responseList:', responseList)
if (responseList && responseList.length != 0) {
$.each(menuFunTreeData, function (index, item) {
for (var i = 0; i < responseList.length; i++) {
var productData = responseList[i]
if (item.accounttypeId == productData.accounttypeId) {
......@@ -284,7 +302,7 @@
value: item.accounttypeId
})
var menuData = []
for(var j = 0; j < productData.products.length; j++) {
for (var j = 0; j < productData.products.length; j++) {
menuData = productData.products[j]
var idList = menuData.menuIds.concat(menuData.functionIds)
active.treeTabAdd({
......@@ -293,15 +311,17 @@
}, item.accounttypeId, item.products, idList)
}
var filterName = 'treeTab' + item.accounttypeId
var productId = 'tab_' + item.accounttypeId + '_' + item.products[0].productId
var productId = 'tab_' + item.accounttypeId + '_' + item.products[0]
.productId
active.tabChange(filterName, productId)
}
}
})
active.tabChange('roleAuth', responseList[0].accounttypeId)
}
})
}
})
active.tabChange('roleAuth', responseList[0].accounttypeId)
}
})
}
})
})
}
......@@ -382,110 +402,119 @@
})
// table搜索
$('#tableSearch').on('click', function() {
$('#tableSearch').on('click', function () {
var search = $('#tableSearchForm').val()
console.log(search)
getSecondTable(subMerchantTable, { keyword: search })
getSecondTable(subMerchantTable, {
keyword: search
})
})
$('#closeEl').on('click', function() {
go('merchant', 'index')
})
// 获取table列表接口
function getSecondTable(table, search, isResetPageNum = false) {
var search = search || {}
var params = helper.clone(false, {
method: 'cn.com.glsx.merchants.staff.findMerchantStaffList',
merchantId: merchantId
}, search)
method: 'cn.com.glsx.merchants.staff.findMerchantStaffList',
merchantId: merchantId
}, search)
request(params, function (res) {
console.log(res)
var data = res.data
var options = {
data: data
}
subMerchantTable.reload(options)
console.log(res)
var data = res.data
var options = {
data: data
}
)
subMerchantTable.reload(options)
})
}
var active = {
/**
* 第一级tab添加
* item: {name: 选项卡名称, value: 选项卡值}
* roleAuth: 选项卡过滤器的名称 lay-filter绑定的名字
* content: 一个放置模板的视图容器,用于呈现渲染结果 带有id的div
* id:选项卡标题的lay-id属性值
* 需要引入laytpl 模块
* rolesAuth:模板的id
* view 放置模板的视图容器的dom
* templateData:用于渲染模板的数据
* productList:复选下拉框的list,修改过的数据{name: '', value: ''}
* products:对应的菜单下的产品list,包含了对应的权限树,原始数据,需作为参数传入treeTabAdd中,在实例化tree时传入的数据使用
*/
tabAdd: function(item) {
// 渠道的id,一层选项卡的id
var id = item.value
// roleAuth 一层选项卡过滤器的名称
element.tabAdd('roleAuth', {
title: item.title,
// 放置模板视图的上一级div
content: '<div id="role' + id + '"></div>',
// 选项卡标题的lay-id属性值
id: id
})
var getTpl ='<div id="select{{d.id}}"></div> <div class="layui-tab layui-tab-brief" lay-filter="treeTab{{d.id}}"><ul class="layui-tab-title"></ul> <div class="layui-tab-content"></div></div>'
// var getTpl = tpl//rolesAuth.innerHTML, // 模板内容
view = document.getElementById('role' + id)
templateData.id = id // 渲染模版的数据
laytpl(getTpl).render(templateData, function(html) {
view.innerHTML = html
})
},
// tab删除
tabDelete: function(name, id) {
element.tabDelete(name, id)
},
// tab Change
tabChange: function(name, id) {
element.tabChange(name, id)
},
/**
* 第二级选项卡
* treeTabAdd 产品的权限添加
* item: {name: 选项卡名称, value: 选项卡值}
* id 第一级选项卡的item.value
* filterName: 过滤器的名称 lay-filter绑定的值
* treeData:渲染模板的数据,和用来存放对应树实例的对象,
* products:产品list数组
* defaultList:编辑时传入,默认勾选中的数组。(举例:[1,2,3])
*/
treeTabAdd: function(item, id, products, defaultList) {
console.log(defaultList)
var productId = 'tab_' + id + '_' + item.value
var filterName = 'treeTab' + id // 过滤器的名称 lay-filter
element.tabAdd(filterName, {
title: item.name,
content: '<div id="treeTab' + productId + '"></div>', // 放置模板视图的div
id: productId
})
// var getTreeTpl = treeAuth.innerHTML, // 获取的模板的id的内容
var getTreeTpl = '<ul id="tree_{{d.id}}" class="ztree wrapper-tree"></ul>'
treeView = document.getElementById('treeTab' + productId) // 放置模板视图的div
treeData[id] = treeData[id] || {}
treeData[id][item.value] = treeData[id][item.value] || {}
treeData[id][item.value].id = productId // 渲染模版的数据
treeData[id][item.value].productId = item.value
laytpl(getTreeTpl).render(treeData[id][item.value], function(html) {
treeView.innerHTML = html
})
var treeListData = []
$.each(products, function(index, i) {
if (item.value == i.productId) {
treeListData = i.merchantProTreeResponses
}
})
var treedom = 'tree_' + productId
treeData[id][item.value].treeObj = tree.create(treedom, treeListData, {checkedList: defaultList, chkDisabled: true})
}
/**
* 第一级tab添加
* item: {name: 选项卡名称, value: 选项卡值}
* roleAuth: 选项卡过滤器的名称 lay-filter绑定的名字
* content: 一个放置模板的视图容器,用于呈现渲染结果 带有id的div
* id:选项卡标题的lay-id属性值
* 需要引入laytpl 模块
* rolesAuth:模板的id
* view 放置模板的视图容器的dom
* templateData:用于渲染模板的数据
* productList:复选下拉框的list,修改过的数据{name: '', value: ''}
* products:对应的菜单下的产品list,包含了对应的权限树,原始数据,需作为参数传入treeTabAdd中,在实例化tree时传入的数据使用
*/
tabAdd: function (item) {
// 渠道的id,一层选项卡的id
var id = item.value
// roleAuth 一层选项卡过滤器的名称
element.tabAdd('roleAuth', {
title: item.title,
// 放置模板视图的上一级div
content: '<div id="role' + id + '"></div>',
// 选项卡标题的lay-id属性值
id: id
})
var getTpl =
'<div id="select{{d.id}}"></div> <div class="layui-tab layui-tab-brief" lay-filter="treeTab{{d.id}}"><ul class="layui-tab-title"></ul> <div class="layui-tab-content"></div></div>'
// var getTpl = tpl//rolesAuth.innerHTML, // 模板内容
view = document.getElementById('role' + id)
templateData.id = id // 渲染模版的数据
laytpl(getTpl).render(templateData, function (html) {
view.innerHTML = html
})
},
// tab删除
tabDelete: function (name, id) {
element.tabDelete(name, id)
},
// tab Change
tabChange: function (name, id) {
element.tabChange(name, id)
},
/**
* 第二级选项卡
* treeTabAdd 产品的权限添加
* item: {name: 选项卡名称, value: 选项卡值}
* id 第一级选项卡的item.value
* filterName: 过滤器的名称 lay-filter绑定的值
* treeData:渲染模板的数据,和用来存放对应树实例的对象,
* products:产品list数组
* defaultList:编辑时传入,默认勾选中的数组。(举例:[1,2,3])
*/
treeTabAdd: function (item, id, products, defaultList) {
console.log(defaultList)
var productId = 'tab_' + id + '_' + item.value
var filterName = 'treeTab' + id // 过滤器的名称 lay-filter
element.tabAdd(filterName, {
title: item.name,
content: '<div id="treeTab' + productId + '"></div>', // 放置模板视图的div
id: productId
})
// var getTreeTpl = treeAuth.innerHTML, // 获取的模板的id的内容
var getTreeTpl = '<ul id="tree_{{d.id}}" class="ztree wrapper-tree"></ul>'
treeView = document.getElementById('treeTab' + productId) // 放置模板视图的div
treeData[id] = treeData[id] || {}
treeData[id][item.value] = treeData[id][item.value] || {}
treeData[id][item.value].id = productId // 渲染模版的数据
treeData[id][item.value].productId = item.value
laytpl(getTreeTpl).render(treeData[id][item.value], function (html) {
treeView.innerHTML = html
})
var treeListData = []
$.each(products, function (index, i) {
if (item.value == i.productId) {
treeListData = i.merchantProTreeResponses
}
})
var treedom = 'tree_' + productId
treeData[id][item.value].treeObj = tree.create(treedom, treeListData, {
checkedList: defaultList,
chkDisabled: true
})
}
}
})
</script>
</body>
......
......@@ -621,7 +621,6 @@
parent.append(subParent)
},
handleFirstCancel() {
console.log('??????????')
go('merchant', 'index')
return false
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!