Commit a710fcda by 胡悦

hebing

2 parents 11b4c883 1030837a
...@@ -287,7 +287,6 @@ ...@@ -287,7 +287,6 @@
radio: true, radio: true,
data: [], data: [],
on: function (data) { on: function (data) {
console.log(data)
merchantId = data.change[0].id merchantId = data.change[0].id
getList(merchantId) getList(merchantId)
} }
...@@ -387,7 +386,6 @@ ...@@ -387,7 +386,6 @@
// 提交表单 // 提交表单
form.on('submit(employeeSubmit)', function (data) { form.on('submit(employeeSubmit)', function (data) {
console.log(data)
if (visibleMerchant.getCheckedNodes(true).length == 0) { if (visibleMerchant.getCheckedNodes(true).length == 0) {
layer.msg('可见商户必选', { layer.msg('可见商户必选', {
icon: 2 icon: 2
...@@ -415,7 +413,6 @@ ...@@ -415,7 +413,6 @@
} }
var params = helper.clone(true, data.field, otherParams) var params = helper.clone(true, data.field, otherParams)
delete params.merhcnatImg delete params.merhcnatImg
console.log(params)
request(params, function (result) { request(params, function (result) {
if (result.code == '0') { if (result.code == '0') {
layer.msg('操作成功', { layer.msg('操作成功', {
...@@ -434,7 +431,6 @@ ...@@ -434,7 +431,6 @@
// select 选择触发 // select 选择触发
form.on('select(merchants)', function (data) { form.on('select(merchants)', function (data) {
console.log(data.value)
merchantId = data.value merchantId = data.value
getList(merchantId) getList(merchantId)
}) })
...@@ -488,7 +484,6 @@ ...@@ -488,7 +484,6 @@
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') {
console.log(result.data)
merchantNameSelect.update({ merchantNameSelect.update({
data: result.data, data: result.data,
autoRow: true, autoRow: true,
...@@ -527,7 +522,6 @@ ...@@ -527,7 +522,6 @@
var params = { id: id, method: 'cn.com.glsx.merchants.staff.staffSearchRequest' } var params = { id: id, method: 'cn.com.glsx.merchants.staff.staffSearchRequest' }
pwd.attr('readonly', true) pwd.attr('readonly', true)
request(params, function (res) { request(params, function (res) {
console.log(res)
if (res.code == '0') { if (res.code == '0') {
var data = res.data var data = res.data
employeeForm = { employeeForm = {
...@@ -556,7 +550,6 @@ ...@@ -556,7 +550,6 @@
// var visibleInferiorMerArr = [32, 38] // var visibleInferiorMerArr = [32, 38]
callback(visibleInferiorMerArr) callback(visibleInferiorMerArr)
} }
console.log(employeeForm, merchantFileRequest)
form.val('employeeForm', employeeForm) form.val('employeeForm', employeeForm)
form.render('select') form.render('select')
}) })
......
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh"> <html lang="zh">
<head>
<meta charset="utf-8" />
<meta content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="广联帐户管理中心-员工管理" />
<meta name="author" content="GLSX Web Team" />
<meta name="keywords" itemprop="keywords" content="广联,帐户管理,员工管理" />
<link rel="stylesheet" type="text/css" href="/css/main.css" />
<title>员工管理</title>
</head>
<style>
.sub-bg-white {
width: 100%;
background-color: #f4f5fa;
padding-top: 8px;
}
.sub-title {
margin-top: 21px;
}
.content-title {
margin-bottom: 20px;
}
.fixed-btn {
position: fixed;
right: 10px;
bottom: 20px;
background-color: #409eff;
border-radius: 20px;
text-align: center;
}
.fixed-btn a {
display: block;
width: 40px;
padding: 5px;
color: #fff;
border-bottom: 1px solid #fff;
}
.fixed-btn a:last-child {
border-bottom: none;
}
.topwrap,
.topmidwrap,
.topbottomwrap,
.bottomwrap {
/* margin: 0 20px 0; */
background-color: #fff;
position: relative;
min-height: 238px;
}
.topwrap, <head>
.topmidwrap { <meta charset="utf-8" />
/* min-height: calc(100vh - 480px); */ <meta content="IE=edge" />
padding-bottom: 10px; <meta name="viewport" content="width=device-width, initial-scale=1.0" />
} <meta name="description" content="广联帐户管理中心-员工管理" />
.topbottomwrap { <meta name="author" content="GLSX Web Team" />
min-height: calc(100vh - 200px); <meta name="keywords" itemprop="keywords" content="广联,帐户管理,员工管理" />
} <link rel="stylesheet" type="text/css" href="/css/main.css" />
.grayLine { <title>员工管理</title>
position: absolute; </head>
left: 0; <style>
top: 48px; .sub-bg-white {
background-color: #d8d8d8; width: 100%;
width: 100%; background-color: #f4f5fa;
height: 1px; padding-top: 8px;
} }
.layui-tab-content {
position: relative;
}
.layui-no-data {
width: 100%;
height: 500px;
}
.layui-no-data .no-data {
position: absolute;
top: 50%;
height: 50%;
width: 100%;
text-align: center;
font-size: 14px;
line-height: 22px;
}
.layui-no-data .no-data div {
margin-top: 12px;
}
.show {
display: inline-block;
}
.hide { .sub-title {
display: none; margin-top: 21px;
} }
.wrapper .employeeDetail .layui-this {
color: #5850ff;
background-color: #f4f6fc;
}
.wrapper,
.detail {
padding-bottom: 100px;
}
</style>
<body>
<div id="app">
<main class="wrapper detail">
<div class="layui-tab layui-tab-brief" lay-filter="editTab">
<ul class="layui-tab-title employeeDetail">
<li lay-id="1" style="padding: 0; width: 90px; margin-right: 20px" class="layui-this">基本信息</li>
<li lay-id="2" style="padding: 0; width: 90px; margin-right: 20px">账户权限</li>
<li lay-id="3" style="padding: 0; width: 90px">修改记录</li>
</ul>
<div class="layui-tab-content">
<div class="layui-tab-item layui-show">
<div class="topwrap">
<div class="grayLine"></div>
<h3 class="content-title sub-title" id="basic">
员工基本信息
<div class="title-right" id="merchantName"></div>
</h3>
<div class="layui-form-item"> .content-title {
<label class="layui-form-label">姓名:</label> margin-bottom: 20px;
<div class="layui-input-block"> }
<div class="layui-form-mid layui-word-aux" id="staffName"></div>
</div> .fixed-btn {
</div> position: fixed;
<div class="layui-form-item"> right: 10px;
<label class="layui-form-label">登录手机号:</label> bottom: 20px;
<div class="layui-input-block"> background-color: #409eff;
<div class="layui-form-mid layui-word-aux" id="staffPhone"></div> border-radius: 20px;
</div> text-align: center;
}
.fixed-btn a {
display: block;
width: 40px;
padding: 5px;
color: #fff;
border-bottom: 1px solid #fff;
}
.fixed-btn a:last-child {
border-bottom: none;
}
.topwrap,
.topmidwrap,
.topbottomwrap,
.bottomwrap {
/* margin: 0 20px 0; */
background-color: #fff;
position: relative;
min-height: 238px;
}
.topwrap,
.topmidwrap {
/* min-height: calc(100vh - 480px); */
padding-bottom: 10px;
}
.topbottomwrap {
min-height: calc(100vh - 200px);
}
.grayLine {
position: absolute;
left: 0;
top: 48px;
background-color: #d8d8d8;
width: 100%;
height: 1px;
}
.layui-tab-content {
position: relative;
}
.layui-no-data {
width: 100%;
height: 500px;
}
.layui-no-data .no-data {
position: absolute;
top: 50%;
height: 50%;
width: 100%;
text-align: center;
font-size: 14px;
line-height: 22px;
}
.layui-no-data .no-data div {
margin-top: 12px;
}
.show {
display: inline-block;
}
.hide {
display: none;
}
.wrapper .employeeDetail .layui-this {
color: #5850ff;
background-color: #f4f6fc;
}
.wrapper,
.detail {
padding-bottom: 100px;
}
</style>
<body>
<div id="app">
<main class="wrapper detail">
<div class="layui-tab layui-tab-brief" lay-filter="editTab">
<ul class="layui-tab-title employeeDetail">
<li lay-id="1" style="padding: 0; width: 90px; margin-right: 20px" class="layui-this">基本信息</li>
<li lay-id="2" style="padding: 0; width: 90px; margin-right: 20px">账户权限</li>
<li lay-id="3" style="padding: 0; width: 90px">修改记录</li>
</ul>
<div class="layui-tab-content">
<div class="layui-tab-item layui-show">
<div class="topwrap">
<div class="grayLine"></div>
<h3 class="content-title sub-title" id="basic">
员工基本信息
<div class="title-right" id="merchantName"></div>
</h3>
<div class="layui-form-item">
<label class="layui-form-label">姓名:</label>
<div class="layui-input-block">
<div class="layui-form-mid layui-word-aux" id="staffName"></div>
</div> </div>
<div class="layui-form-item"> </div>
<label class="layui-form-label">企微号:</label> <div class="layui-form-item">
<div class="layui-input-block"> <label class="layui-form-label">登录手机号:</label>
<div class="layui-form-mid layui-word-aux" id="entmicroName"></div> <div class="layui-input-block">
</div> <div class="layui-form-mid layui-word-aux" id="staffPhone"></div>
</div> </div>
<div class="layui-form-item"> </div>
<label class="layui-form-label">职务:</label> <div class="layui-form-item">
<div class="layui-input-block"> <label class="layui-form-label">企微号:</label>
<div class="layui-form-mid layui-word-aux" id="staffJob"></div> <div class="layui-input-block">
</div> <div class="layui-form-mid layui-word-aux" id="entmicroName"></div>
</div> </div>
<div class="layui-form-item"> </div>
<label class="layui-form-label">角色名称:</label> <div class="layui-form-item">
<div class="layui-input-block"> <label class="layui-form-label">职务:</label>
<div class="layui-form-mid layui-word-aux" id="roleName"></div> <div class="layui-input-block">
</div> <div class="layui-form-mid layui-word-aux" id="staffJob"></div>
</div> </div>
<div class="layui-form-item"> </div>
<label class="layui-form-label">创建人:</label> <div class="layui-form-item">
<div class="layui-input-block"> <label class="layui-form-label">角色名称:</label>
<div class="layui-form-mid layui-word-aux" id="createdAccount"></div> <div class="layui-input-block">
</div> <div class="layui-form-mid layui-word-aux" id="roleName"></div>
</div> </div>
</div> </div>
<div class="topmidwrap"> <div class="layui-form-item">
<div class="grayLine"></div> <label class="layui-form-label">创建人:</label>
<h3 class="content-title sub-title" id="visibleMerchant">可见下级商户</h3>
<!-- <ul id="merchantTree" class="ztree wrapper-tree"></ul> -->
<div class="layui-input-block"> <div class="layui-input-block">
<ul id="visibleInferiorMerName"></ul> <div class="layui-form-mid layui-word-aux" id="createdAccount"></div>
</div> </div>
</div> </div>
</div> </div>
<div class="layui-tab-item"> <div class="topmidwrap">
<div class="topbottomwrap"> <div class="grayLine"></div>
<div class="grayLine"></div> <h3 class="content-title sub-title" id="visibleMerchant">可见下级商户</h3>
<h3 class="content-title sub-title" id="accountAuth">账户权限</h3> <!-- <ul id="merchantTree" class="ztree wrapper-tree"></ul> -->
<div class="layui-tab tabmutiple-content" style="padding: 0 20px 10px; background-color: #fff; margin-bottom: 80px" lay-filter="roleAuth"> <div class="layui-input-block">
<ul class="layui-tab-title"></ul> <ul id="visibleInferiorMerName"></ul>
<div class="layui-tab-content"></div>
</div>
</div> </div>
</div> </div>
<div class="layui-tab-item"> </div>
<div class="bottomwrap" style="margin-bottom: 80px; padding: 0 20px"> <div class="layui-tab-item">
<div class="grayLine"></div> <div class="topbottomwrap">
<h3 class="content-title sub-title" id="record">修改记录</h3> <div class="grayLine"></div>
<div class="layui-tab tabmutiple-content"> <h3 class="content-title sub-title" id="accountAuth">账户权限</h3>
<div class="table-page"> <div class="layui-tab tabmutiple-content"
<table class="layui-table" id="recordTable"></table> style="padding: 0 20px 10px; background-color: #fff; margin-bottom: 80px" lay-filter="roleAuth">
<div id="recordPage" class="align-left"></div> <ul class="layui-tab-title"></ul>
</div> <div class="layui-tab-content"></div>
</div>
</div>
</div>
<div class="layui-tab-item">
<div class="bottomwrap" style="margin-bottom: 80px; padding: 0 20px">
<div class="grayLine"></div>
<h3 class="content-title sub-title" id="record">修改记录</h3>
<div class="layui-tab tabmutiple-content">
<div class="table-page">
<table class="layui-table" id="recordTable"></table>
<div id="recordPage" class="align-left"></div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="sub-bg-white"> </div>
<div class="footer-close"> <div class="sub-bg-white">
<button type="button" class="layui-btn layui-btn-normal" id="return">关闭</button> <div class="footer-close">
</div> <button type="button" class="layui-btn layui-btn-normal" id="return">关闭</button>
<!-- <div class="fixed-btn"> </div>
<!-- <div class="fixed-btn">
<a id="basicBtn">基本信息</a> <a id="basicBtn">基本信息</a>
<a id="accountAuthBtn">账户权限</a> <a id="accountAuthBtn">账户权限</a>
<a id="recordBtn">修改记录</a> <a id="recordBtn">修改记录</a>
</div> --> </div> -->
</div> </div>
</main> </main>
</div> </div>
<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(['request', 'helper', 'treeTab', 'table', 'laypage'], function () { layui.use(['request', 'helper', 'treeTab', 'table', 'laypage'], function () {
/** 变量 */ /** 变量 */
var $ = layui.$ var $ = layui.$
var request = layui.request var request = layui.request
var helper = layui.helper var helper = layui.helper
var id = qs('id') var id = qs('id')
var treeTab = layui.treeTab var treeTab = layui.treeTab
var table = layui.table var table = layui.table
var laypage = layui.laypage var laypage = layui.laypage
var merchantId = qs('merchantId') var merchantId = qs('merchantId')
var basicArr = ['staffName', 'staffPhone', 'entmicroName', 'staffJob', 'roleName', 'roleCode', 'merchantName', 'createdAccount'] var basicArr = ['staffName', 'staffPhone', 'entmicroName', 'staffJob', 'roleName', 'roleCode', 'merchantName', 'createdAccount']
var employeeData = {} var employeeData = {}
var visibleInferiorMerName = $('#visibleInferiorMerName') var visibleInferiorMerName = $('#visibleInferiorMerName')
var recordPage = { var recordPage = {
pageNum: 1, pageNum: 1,
pageSize: 10 pageSize: 10
} }
var recordPageOptions = { var recordPageOptions = {
elem: 'recordPage', elem: 'recordPage',
groups: 5, groups: 5,
layout: ['count', 'page', 'skip'], layout: ['count', 'page', 'skip'],
jump: function (obj, first) { jump: function (obj, first) {
recordPage.pageNum = obj.curr recordPage.pageNum = obj.curr
recordPage.pageSize = obj.limit recordPage.pageSize = obj.limit
//首次不执行 //首次不执行
if (!first) { if (!first) {
//do something //do something
getRecordTable() getRecordTable()
}
} }
} }
}
var recordTable = table.render({ var recordTable = table.render({
elem: '#recordTable', elem: '#recordTable',
page: false, page: false,
skin: 'nob', skin: 'nob',
height: 'full-300', height: 'full-300',
cols: [ cols: [
[ [
{ {
field: 'index', field: 'index',
title: '序号', title: '序号',
align: 'center', align: 'center',
width: 60 width: 60
}, },
{ {
field: 'operator', field: 'operator',
title: '登录账户', title: '登录账户',
align: 'center' align: 'center'
}, },
{ {
field: 'productName', field: 'productName',
title: '登录产品', title: '登录产品',
align: 'center' align: 'center'
}, },
{ {
field: 'ip', field: 'ip',
title: '登录IP', title: '登录IP',
align: 'center' align: 'center'
}, },
{ {
field: 'modifyContent', field: 'modifyContent',
title: '修改内容', title: '修改内容',
align: 'center', align: 'center',
width: 220 width: 220
}, },
{ {
field: 'userName', field: 'userName',
title: '操作人', title: '操作人',
align: 'center', align: 'center',
width: 180 width: 180
}, },
{ {
field: 'createdTime', field: 'createdTime',
title: '操作时间', title: '操作时间',
align: 'center', align: 'center',
width: 200 width: 200
} }
]
] ]
}) ]
})
/** 调用方法 */ /** 调用方法 */
getById() getById()
getRecordTable() getRecordTable()
/** 触发事件 */ /** 触发事件 */
$('#return').on('click', function () { $('#return').on('click', function () {
if (window.location.hash) { if (window.location.hash) {
window.history.back(-1)
window.location.hash = ''
}
window.history.back(-1) window.history.back(-1)
}) window.location.hash = ''
}
window.history.back(-1)
})
$('#basicBtn').on('click', function () { $('#basicBtn').on('click', function () {
document.querySelector('#basic').scrollIntoView(true) document.querySelector('#basic').scrollIntoView(true)
}) })
$('#accountAuthBtn').on('click', function () { $('#accountAuthBtn').on('click', function () {
document.querySelector('#accountAuth').scrollIntoView(true) document.querySelector('#accountAuth').scrollIntoView(true)
}) })
$('#recordBtn').on('click', function () { $('#recordBtn').on('click', function () {
document.querySelector('#record').scrollIntoView(true) document.querySelector('#record').scrollIntoView(true)
}) })
/** 定义方法 */ /** 定义方法 */
// 查询员工详情 // 查询员工详情
function getById() { function getById() {
var params = { id: id, method: 'cn.com.glsx.merchants.staff.staffSearchRequest' } var params = { id: id, method: 'cn.com.glsx.merchants.staff.staffSearchRequest' }
request(params, function (res) { request(params, function (res) {
if (res.code == '0') { if (res.code == '0') {
employeeData = helper.clone(true, res.data) employeeData = helper.clone(true, res.data)
for (var i in basicArr) { for (var i in basicArr) {
$('#' + [basicArr[i]]).text(employeeData[basicArr[i]] ? employeeData[basicArr[i]] : '无') $('#' + [basicArr[i]]).text(employeeData[basicArr[i]] ? employeeData[basicArr[i]] : '无')
}
if (employeeData.visibleInferiorMerName) {
var visibleName = employeeData.visibleInferiorMerName.split(',')
$.each(visibleName, function (idx, i) {
visibleInferiorMerName.append('<li class="visibleMerchant">' + i + '</li>')
})
} else {
visibleInferiorMerName.remove()
}
// 账户权限
var authList = employeeData.accountTypeTreeResponseList
console.log(authList)
if (authList && authList.length != 0) {
$.each(authList, function (index, item) {
treeTab.tabAdd(
{
title: item.accounttypeName,
value: item.accounttypeId
},
true
)
var menuData = []
// for (var i = 0; i < item.products)
if (item.products && item.products.length != 0) {
$.each(item.products, function (idx, m) {
treeTab.treeTabDetail(
{
name: m.productName,
value: m.productId
},
item.accounttypeId,
m.merchantProTreeResponses
)
})
var filterName = 'treeTab' + item.accounttypeId
var productId = 'tab_' + item.accounttypeId + '_' + item.products[0].productId
treeTab.tabChange(filterName, productId)
}
})
console.log(authList)
treeTab.tabChange('roleAuth', authList[0].accounttypeId)
}
} }
}) if (employeeData.visibleInferiorMerName) {
} var visibleName = employeeData.visibleInferiorMerName.split(',')
$.each(visibleName, function (idx, i) {
// 修改记录 visibleInferiorMerName.append('<li class="visibleMerchant">' + i + '</li>')
function getRecordTable(isResetPageNum) { })
var params = { } else {
bussinessId: id, visibleInferiorMerName.remove()
moduleName: '员工模块',
pageNum: recordPage.pageNum,
pageSize: recordPage.pageSize,
method: 'cn.com.glsx.merchants.menu.findLog'
}
request(params, function (res) {
var data = res.data
$.each(data.data, function (index, item) {
item.index = index + 1 + recordPage.pageSize * (recordPage.pageNum - 1)
data.data[index].modifyContent = item.module + '-' + item.action
})
var options = {
data: data.data
} }
recordPageOptions.count = data.count // 账户权限
if (isResetPageNum) { var authList = employeeData.accountTypeTreeResponseList
recordPageOptions.curr = 1 if (authList && authList.length != 0) {
$.each(authList, function (index, item) {
treeTab.tabAdd(
{
title: item.accounttypeName,
value: item.accounttypeId
},
true
)
var menuData = []
// for (var i = 0; i < item.products)
if (item.products && item.products.length != 0) {
$.each(item.products, function (idx, m) {
treeTab.treeTabDetail(
{
name: m.productName,
value: m.productId
},
item.accounttypeId,
m.merchantProTreeResponses
)
})
var filterName = 'treeTab' + item.accounttypeId
var productId = 'tab_' + item.accounttypeId + '_' + item.products[0].productId
treeTab.tabChange(filterName, productId)
}
})
treeTab.tabChange('roleAuth', authList[0].accounttypeId)
} }
laypage.render(recordPageOptions) }
recordTable.reload(options) })
}) }
// 修改记录
function getRecordTable(isResetPageNum) {
var params = {
bussinessId: id,
moduleName: '员工模块',
pageNum: recordPage.pageNum,
pageSize: recordPage.pageSize,
method: 'cn.com.glsx.merchants.menu.findLog'
} }
}) request(params, function (res) {
</script> var data = res.data
</body> $.each(data.data, function (index, item) {
</html> item.index = index + 1 + recordPage.pageSize * (recordPage.pageNum - 1)
data.data[index].modifyContent = item.module + '-' + item.action
})
var options = {
data: data.data
}
recordPageOptions.count = data.count
if (isResetPageNum) {
recordPageOptions.curr = 1
}
laypage.render(recordPageOptions)
recordTable.reload(options)
})
}
})
</script>
</body>
</html>
\ No newline at end of file \ No newline at end of file
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh"> <html lang="zh">
<head>
<meta charset="utf-8" />
<meta content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="广联帐户管理中心-员工管理" />
<meta name="author" content="GLSX Web Team" />
<meta name="keywords" itemprop="keywords" content="广联,帐户管理,员工管理" />
<link rel="stylesheet" type="text/css" href="/css/main.css" />
<link rel="stylesheet" type="text/css" href="/css/employee.css" />
<link rel="stylesheet" type="text/css" href="/css/commonResetIndex.css" />
<title>员工管理</title>
</head>
<style>
xm-select > .xm-body .scroll-body {
width: 300px;
}
xm-select:hover {
border: 1px solid #5850ff !important;
}
.hide {
display: none;
}
.show {
display: inline-block;
}
</style>
<body> <head>
<div id="app"> <meta charset="utf-8" />
<main> <meta content="IE=edge" />
<div> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<div class="search-block"> <meta name="description" content="广联帐户管理中心-员工管理" />
<!-- layui-form-pane --> <meta name="author" content="GLSX Web Team" />
<form action="" class="layui-form" lay-filter="employeeForm"> <meta name="keywords" itemprop="keywords" content="广联,帐户管理,员工管理" />
<div class="layui-form-item"> <link rel="stylesheet" type="text/css" href="/css/main.css" />
<div class="twocol"> <link rel="stylesheet" type="text/css" href="/css/employee.css" />
<div class="layui-inline" pane id="addEl"> <link rel="stylesheet" type="text/css" href="/css/commonResetIndex.css" />
<button type="button" class="layui-btn layui-btn-normal createBtn" id="addEmployee"> <title>员工管理</title>
<i class="layui-icon layui-icon-addition"></i> </head>
<span>创建员工</span> <style>
</button> xm-select>.xm-body .scroll-body {
</div> width: 300px;
<div class="layui-inline merchantNames" pane> }
<label class="layui-form-label">商户名称</label>
<div class="layui-input-block"> xm-select:hover {
<!-- <select name="merchantId" id="merchantName" lay-verify="required"></select> --> border: 1px solid #5850ff !important;
<div id="merchantNameSelect" style="width: 300px" class="xm-select-demo"></div> }
</div>
</div> .hide {
display: none;
}
.show {
display: inline-block;
}
</style>
<body>
<div id="app">
<main>
<div>
<div class="search-block">
<!-- layui-form-pane -->
<form action="" class="layui-form" lay-filter="employeeForm">
<div class="layui-form-item">
<div class="twocol">
<div class="layui-inline" pane id="addEl">
<button type="button" class="layui-btn layui-btn-normal createBtn" id="addEmployee">
<i class="layui-icon layui-icon-addition"></i>
<span>创建员工</span>
</button>
</div> </div>
</div> <div class="layui-inline merchantNames" pane>
<div class="divideLine"></div> <label class="layui-form-label">商户名称</label>
<div class="layui-form-item secondInput">
<div class="layui-inline creater">
<label class="layui-form-label">创建者</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" name="createdName" required lay-verify="required" placeholder="请输入创建者" autocomplete="off" class="layui-input" /> <!-- <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 class="layui-inline roleId hide" pane> </div>
<label class="layui-form-label">角色</label> </div>
<div class="layui-input-block"> <div class="divideLine"></div>
<select name="roleId" id="roleId" lay-verify="required" placeholder="请选择状态"></select> <div class="layui-form-item secondInput">
</div> <div class="layui-inline creater">
<label class="layui-form-label">创建者</label>
<div class="layui-input-block">
<input type="text" name="createdName" required lay-verify="required" placeholder="请输入创建者"
autocomplete="off" class="layui-input" />
</div> </div>
<div class="layui-inline status" pane> </div>
<label class="layui-form-label">状态</label> <div class="layui-inline roleId hide" pane>
<div class="layui-input-block"> <label class="layui-form-label">角色</label>
<select name="status" id="status" lay-verify="required" placeholder="请选择状态"></select> <div class="layui-input-block">
</div> <select name="roleId" id="roleId" lay-verify="required" placeholder="请选择状态"></select>
</div> </div>
<div class="layui-inline" pane> </div>
<div class="layui-input-inline updateSelectAngle" style="width: 100px"> <div class="layui-inline status" pane>
<select name="type" lay-verify="required" placeholder="员工姓名/手机号"> <label class="layui-form-label">状态</label>
<option value="0">员工姓名</option> <div class="layui-input-block">
<option value="1">手机号</option> <select name="status" id="status" lay-verify="required" placeholder="请选择状态"></select>
</select>
</div>
<div class="layui-input-inline" style="width: 250px">
<input type="text" name="keywords" required lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input updateCircleAngle" />
</div>
</div> </div>
</div>
<div class="layui-inline" style="float: right" pane> <div class="layui-inline" pane>
<button type="button" class="layui-btn layui-btn-normal searchInputBtn" id="employeeSearch">查询</button> <div class="layui-input-inline updateSelectAngle" style="width: 100px">
<button type="button" class="layui-btn layui-btn-normal exportInputBtn" id="employeeExport">导出</button> <select name="type" lay-verify="required" placeholder="员工姓名/手机号">
<option value="0">员工姓名</option>
<option value="1">手机号</option>
</select>
</div> </div>
<div class="layui-input-inline" style="width: 250px">
<input type="text" name="keywords" required lay-verify="required" placeholder="请输入" autocomplete="off"
class="layui-input updateCircleAngle" />
</div>
</div>
<div class="layui-inline" style="float: right" pane>
<button type="button" class="layui-btn layui-btn-normal searchInputBtn" id="employeeSearch">查询</button>
<button type="button" class="layui-btn layui-btn-normal exportInputBtn" id="employeeExport">导出</button>
</div> </div>
</form>
<!-- 表格 -->
<div class="table-page">
<table id="employeeTable" lay-filter="employeeTool"></table>
<div id="employeePage" class="align-left"></div>
</div> </div>
</form>
<!-- 表格 -->
<div class="table-page">
<table id="employeeTable" lay-filter="employeeTool"></table>
<div id="employeePage" class="align-left"></div>
</div> </div>
</div> </div>
</main> </div>
</div> </main>
<script src="https://www.layuicdn.com/layui/layui.js"></script> </div>
<script src="/js/load.js"></script> <script src="https://www.layuicdn.com/layui/layui.js"></script>
<script> <script src="/js/load.js"></script>
layui.use(['table', 'request', 'form', 'helper', 'laypage', 'xmSelect'], function () { <script>
var request = layui.request layui.use(['table', 'request', 'form', 'helper', 'laypage', 'xmSelect'], function () {
var table = layui.table var request = layui.request
var form = layui.form var table = layui.table
var helper = layui.helper var form = layui.form
var laypage = layui.laypage var helper = layui.helper
var xmSelect = layui.xmSelect var laypage = layui.laypage
var $ = layui.$ var xmSelect = layui.xmSelect
// var isDxternal = isAppend() var $ = layui.$
// if (isDxternal) { // var isDxternal = isAppend()
// $('#addEl').remove() // if (isDxternal) {
// } // $('#addEl').remove()
var roleId = $('#roleId') // }
var accountInfo = helper.store.get('accountInfo') var roleId = $('#roleId')
console.log('accountInfo', accountInfo) var accountInfo = helper.store.get('accountInfo')
if (accountInfo) { if (accountInfo) {
if(accountInfo.merchantAccountLevel == 4) { if (accountInfo.merchantAccountLevel == 4) {
$('.merchantNames').addClass('hide') $('.merchantNames').addClass('hide')
}
$('.creater').addClass('hide')
$('.roleId').removeClass('hide')
$('.roleId').addClass('show')
} }
// 商户名称列表 $('.creater').addClass('hide')
var merchantName = $('#merchantName') $('.roleId').removeClass('hide')
var status = $('#status') $('.roleId').addClass('show')
var cols = [ }
//表头 // 商户名称列表
{ field: '', title: '序号', type: 'numbers', width: 60 }, var merchantName = $('#merchantName')
{ field: 'staffName', title: '员工姓名', width: 120, align: 'center' }, var status = $('#status')
// { field: 'staffCode', title: '员工号', align: 'center' }, var cols = [
{ field: 'roleName', title: '角色', align: 'center' }, //表头
{ field: 'staffPhone', title: '登录手机号', align: 'center', width: 125 }, { field: '', title: '序号', type: 'numbers', width: 60 },
{ field: 'entmicroName', title: '企微号', align: 'center', width: 125 }, { field: 'staffName', title: '员工姓名', width: 120, align: 'center' },
{ field: 'statusName', title: '状态', align: 'center', width: 80 }, // { field: 'staffCode', title: '员工号', align: 'center' },
{ field: 'createdAccount', title: '创建者', align: 'center' }, { field: 'roleName', title: '角色', align: 'center' },
{ field: 'merchantName', title: '商户名(商户号)', align: 'center', width: 160 }, { field: 'staffPhone', title: '登录手机号', align: 'center', width: 125 },
{ field: 'updatedTime', title: '更新时间', align: 'center', width: 90 }, { field: 'entmicroName', title: '企微号', align: 'center', width: 125 },
{ title: '操作', width: 160, align: 'left', toolbar: '#employeeBar' }, { field: 'statusName', title: '状态', align: 'center', width: 80 },
{ field: 'statusName', title: '启用开关', width: 85, templet: '#switchTpl', unresize: true } { field: 'createdAccount', title: '创建者', align: 'center' },
] { field: 'merchantName', title: '商户名(商户号)', align: 'center', width: 160 },
var colums = [ { field: 'updatedTime', title: '更新时间', align: 'center', width: 90 },
//表头 { title: '操作', width: 160, align: 'left', toolbar: '#employeeBar' },
{ field: '', title: '序号', type: 'numbers', width: 60 }, { field: 'statusName', title: '启用开关', width: 85, templet: '#switchTpl', unresize: true }
{ field: 'staffName', title: '员工姓名', width: 180, align: 'center' }, ]
// { field: 'staffCode', title: '员工号', align: 'center' }, var colums = [
{ field: 'entmicroName', title: '员工企微号', align: 'center', width: 125 }, //表头
{ field: 'roleName', title: '角色', align: 'center' }, { field: '', title: '序号', type: 'numbers', width: 60 },
{ field: 'staffPhone', title: '登录手机号', align: 'center', width: 125 }, { field: 'staffName', title: '员工姓名', width: 180, align: 'center' },
{ field: 'merchantName', title: '所属门店', align: 'center', width: 125, hide: accountInfo && accountInfo.merchantAccountLevel == 4 }, // { field: 'staffCode', title: '员工号', align: 'center' },
{ field: 'belongingEntmicroName', title: '所属企微', align: 'center', width: 125 }, { field: 'entmicroName', title: '员工企微号', align: 'center', width: 125 },
{ field: 'statusName', title: '状态', align: 'center' }, { field: 'roleName', title: '角色', align: 'center' },
{ field: 'updatedTime', title: '更新时间', align: 'center', width: 180 }, { field: 'staffPhone', title: '登录手机号', align: 'center', width: 125 },
{ title: '操作', width: 160, align: 'left', toolbar: '#employeeBar' }, { field: 'merchantName', title: '所属门店', align: 'center', width: 125, hide: accountInfo && accountInfo.merchantAccountLevel == 4 },
{ field: 'statusName', title: '启用开关', width: 85, templet: '#switchTpl', unresize: true } { field: 'belongingEntmicroName', title: '所属企微', align: 'center', width: 125 },
] { field: 'statusName', title: '状态', align: 'center' },
//创建table实例 { field: 'updatedTime', title: '更新时间', align: 'center', width: 180 },
var employeeTable = table.render({ { title: '操作', width: 160, align: 'left', toolbar: '#employeeBar' },
elem: '#employeeTable', { field: 'statusName', title: '启用开关', width: 85, templet: '#switchTpl', unresize: true }
skin: 'nob', ]
height: 'full-300', //创建table实例
cols: accountInfo ? [colums] : [cols], var employeeTable = table.render({
done: function (res, curr, count) { elem: '#employeeTable',
$('.switch').hover( skin: 'nob',
function () { height: 'full-300',
// 鼠标移入 cols: accountInfo ? [colums] : [cols],
layer.tips( done: function (res, curr, count) {
'<span style="color:#333333;font-size: 14px;font-weight: 400;">启用前,你可先为该员工创建角色,配置其所需的功能权限。如下所示:\n\ $('.switch').hover(
function () {
// 鼠标移入
layer.tips(
'<span style="color:#333333;font-size: 14px;font-weight: 400;">启用前,你可先为该员工创建角色,配置其所需的功能权限。如下所示:\n\
1. 角色管理-创建角色;\n\ 1. 角色管理-创建角色;\n\
2. 选择员工账户-修改角色</span>', 2. 选择员工账户-修改角色</span>',
this, this,
{ {
tips: [4, '#fff'] tips: [4, '#fff']
} }
) )
}, },
function () { function () {
// 鼠标移出 // 鼠标移出
} }
) )
}
})
// 分页配置
var page = {
pageNum: 1,
pageSize: 10
} }
})
var pageOptions = { // 分页配置
elem: 'employeePage', var page = {
groups: 5, pageNum: 1,
layout: ['count', 'page', 'skip'], pageSize: 10
jump: function (obj, first) { }
//obj包含了当前分页的所有参数,比如:
console.log(obj.curr) //得到当前页,以便向服务端请求对应页的数据。 var pageOptions = {
console.log(obj.limit) //得到每页显示的条数 elem: 'employeePage',
page.pageNum = obj.curr groups: 5,
page.pageSize = obj.limit layout: ['count', 'page', 'skip'],
//首次不执行 jump: function (obj, first) {
if (!first) { //obj包含了当前分页的所有参数,比如:
getTabelList(employeeTable, getSearch()) page.pageNum = obj.curr
// 移入移出 page.pageSize = obj.limit
} //首次不执行
if (!first) {
getTabelList(employeeTable, getSearch())
// 移入移出
} }
} }
}
var merchantNameSelect = xmSelect.render({ var merchantNameSelect = xmSelect.render({
el: '#merchantNameSelect', el: '#merchantNameSelect',
prop: { prop: {
name: 'merchantName', name: 'merchantName',
value: 'id' value: 'id'
}, },
name: 'merchantId', name: 'merchantId',
clickClose: true, clickClose: true,
filterable: true, filterable: true,
radio: true, radio: true,
data: [], data: [],
on: function(data) { on: function (data) {
console.log(data) if (data.isAdd) {
if (data.isAdd) { var id = data.change[0].id
var id = data.change[0].id findRoleList(id)
findRoleList(id) } else {
} else { roleId.empty()
roleId.empty() form.render('select')
form.render('select')
}
} }
}) }
})
// 初始化 // 初始化
init() init()
/** table工具条事件 */ /** table工具条事件 */
table.on('tool(employeeTool)', function (obj) { table.on('tool(employeeTool)', function (obj) {
var data = obj.data var data = obj.data
var layEvent = obj.event var layEvent = obj.event
var tr = obj.tr var tr = obj.tr
if (layEvent === 'detail') { if (layEvent === 'detail') {
go('employee', 'detail', { id: data.id, merchantId: data.merchantId }) go('employee', 'detail', { id: data.id, merchantId: data.merchantId })
} else if (layEvent === 'edit') { } else if (layEvent === 'edit') {
go('employee', 'add', { id: data.id, merchantId: data.merchantId, merchantName: data.merchantName }) go('employee', 'add', { id: data.id, merchantId: data.merchantId, merchantName: data.merchantName })
} else if (layEvent === 'del') { } else if (layEvent === 'del') {
layer.confirm('是否确认删除该员工?', { title: '', closeBtn: 0 }, function (index) { layer.confirm('是否确认删除该员工?', { title: '', closeBtn: 0 }, function (index) {
// obj.del() //删除对应行(tr)的DOM结构,并更新缓存 // obj.del() //删除对应行(tr)的DOM结构,并更新缓存
var params = { var params = {
method: 'cn.com.glsx.merchants.staff.deleteStaff', method: 'cn.com.glsx.merchants.staff.deleteStaff',
id: data.id id: data.id
}
request(params, function (res) {
if (res.code == '0') {
layer.close(index)
console.log('shanchu')
getTabelList(employeeTable)
}
})
//向服务端发送删除指令
})
} else if (layEvent === 'updateTime') {
console.log(data.id, data.effectiveTime)
layer.open({
type: 2,
title: '',
closeBtn: 0,
area: ['560px', '230px'],
fixed: false, //不固定
// maxmin: true,
btn: ['确定', '取消'],
content: 'validPeriod.html?id=' + data.id + '&effectiveTime=' + data.effectiveTime,
yes: function (index, layero) {
var body = layer.getChildFrame('body', index)
helper.store.set('isRefresh', false)
body.find('#periodVerifyBtn').click()
},
end: function () {
var isRefresh = helper.store.get('isRefresh')
if (isRefresh) {
getTabelList(employeeTable)
layer.msg('修改成功', {
icon: 1
})
}
helper.store.remove('isRefresh')
}
})
}
})
//监听性别操作
form.on('switch(sexDemo)', function (obj) {
console.log(obj, obj.elem.checked)
if (this.value == '-') {
obj.elem.checked = !obj.elem.checked
form.render('checkbox')
layer.msg('您还未给该员工设置“角色”!\n\
设置角色:员工账户管理-修改-角色权限', { time: 2000 })
} else {
const param = {
id: obj.elem.dataset.id,
status: obj.elem.checked ? 0 : 2
} }
var params = helper.clone(false, { method: 'cn.com.glsx.merchants.staff.updateStatus' }, param)
request(params, function (res) { request(params, function (res) {
if (res.code == '0') { if (res.code == '0') {
layer.msg('操作成功', { layer.close(index)
icon: 1 getTabelList(employeeTable)
})
var searchData = getSearch()
getTabelList(employeeTable, searchData, true)
} }
}) })
} //向服务端发送删除指令
})
/** 手动触发事件 */
// 查询事件
$('#employeeSearch').on('click', function () {
var searchData = getSearch()
console.log(searchData)
getTabelList(employeeTable, searchData, true)
})
// 新增点击事件
$('#addEmployee').on('click', function () {
go('employee', 'add')
})
// 导出
$('#employeeExport').on('click', function () {
var searchData = getSearch()
var params = helper.clone(false, { method: 'cn.com.glsx.merchants.staff.exportData' }, searchData)
request(params, function (res) {
if (res.code == '0') {
window.open(res.data)
}
}) })
}) } else if (layEvent === 'updateTime') {
layer.open({
/** 定义方法 */ type: 2,
// 初始化方法 title: '',
function init() { closeBtn: 0,
findAllMerchant() area: ['560px', '230px'],
findAllDictData() fixed: false, //不固定
getTabelList(employeeTable) // maxmin: true,
} btn: ['确定', '取消'],
content: 'validPeriod.html?id=' + data.id + '&effectiveTime=' + data.effectiveTime,
// 获取table列表接口 yes: function (index, layero) {
function getTabelList(table, search, isResetPageNum) { var body = layer.getChildFrame('body', index)
search = search || {} helper.store.set('isRefresh', false)
var params = helper.clone( body.find('#periodVerifyBtn').click()
false,
{
pageNum: page.pageNum,
pageSize: page.pageSize,
method: 'cn.com.glsx.merchants.staff.findStaffByPage'
}, },
search end: function () {
) var isRefresh = helper.store.get('isRefresh')
request(params, function (res) { if (isRefresh) {
var data = helper.formateNullFieldData(res.data) getTabelList(employeeTable)
var options = { layer.msg('修改成功', {
data: data.data icon: 1
} })
pageOptions.count = data.count
if (isResetPageNum) {
pageOptions.curr = 1
}
laypage.render(pageOptions)
employeeTable.reload(options)
})
}
// 查询所有商户
function findAllMerchant() {
var params = { method: 'cn.com.glsx.merchants.menu.findAllMerchant' }
request(params, function (result) {
if (result.code == '0') {
console.log(result.data)
if (accountInfo && accountInfo.merchantAccountLevel == 4) {
console.log(result.data[0].id)
findRoleList(result.data[0].id)
} else {
merchantNameSelect.update({
data: result.data,
autoRow: true,
paging: result.data.length > 20
})
} }
helper.store.remove('isRefresh')
} }
}) })
} }
})
// 查询角色权限列表 //监听性别操作
function findRoleList(merchantId) { form.on('switch(sexDemo)', function (obj) {
var params = { method: 'org.ore.api.role.list', id: merchantId, delFlag: 0 } if (this.value == '-') {
obj.elem.checked = !obj.elem.checked
form.render('checkbox')
layer.msg('您还未给该员工设置“角色”!\n\
设置角色:员工账户管理-修改-角色权限', { time: 2000 })
} else {
const param = {
id: obj.elem.dataset.id,
status: obj.elem.checked ? 0 : 2
}
var params = helper.clone(false, { method: 'cn.com.glsx.merchants.staff.updateStatus' }, param)
request(params, function (res) { request(params, function (res) {
if (res.code == '0') { if (res.code == '0') {
var list = res.data layer.msg('操作成功', {
roleId.empty() icon: 1
list.unshift('')
$.each(list, function (index, item) {
roleId.append(new Option(item.roleName, item.id))
}) })
form.render('select') var searchData = getSearch()
getTabelList(employeeTable, searchData, true)
} }
}) })
} }
})
// 搜索 /** 手动触发事件 */
function getSearch() { // 查询事件
var formVal = form.val('employeeForm') $('#employeeSearch').on('click', function () {
var searchData = helper.clone(false, formVal) var searchData = getSearch()
if (searchData.type == 0) { getTabelList(employeeTable, searchData, true)
searchData.staffName = formVal.keywords })
searchData.staffPhone = ''
} else if (searchData.type == 1) { // 新增点击事件
searchData.staffName = '' $('#addEmployee').on('click', function () {
searchData.staffPhone = formVal.keywords go('employee', 'add')
} else { })
searchData.staffName = ''
searchData.staffPhone = '' // 导出
$('#employeeExport').on('click', function () {
var searchData = getSearch()
var params = helper.clone(false, { method: 'cn.com.glsx.merchants.staff.exportData' }, searchData)
request(params, function (res) {
if (res.code == '0') {
window.open(res.data)
} }
delete searchData.type })
delete searchData.keywords })
return searchData
}
function findAllDictData() { /** 定义方法 */
var params = { // 初始化方法
method: 'cn.com.glsx.merchants.menu.findAllDictData', function init() {
dictType: 'staff_status' findAllMerchant()
findAllDictData()
getTabelList(employeeTable)
}
// 获取table列表接口
function getTabelList(table, search, isResetPageNum) {
search = search || {}
var params = helper.clone(
false,
{
pageNum: page.pageNum,
pageSize: page.pageSize,
method: 'cn.com.glsx.merchants.staff.findStaffByPage'
},
search
)
request(params, function (res) {
var data = helper.formateNullFieldData(res.data)
var options = {
data: data.data
} }
request(params, function (res) { pageOptions.count = data.count
if (res.code == '0') { if (isResetPageNum) {
var list = res.data pageOptions.curr = 1
list.unshift('') }
$.each(list, function (index, item) { laypage.render(pageOptions)
status.append(new Option(item.dictLabel, item.dictValue)) employeeTable.reload(options)
})
}
// 查询所有商户
function findAllMerchant() {
var params = { method: 'cn.com.glsx.merchants.menu.findAllMerchant' }
request(params, function (result) {
if (result.code == '0') {
if (accountInfo && accountInfo.merchantAccountLevel == 4) {
findRoleList(result.data[0].id)
} else {
merchantNameSelect.update({
data: result.data,
autoRow: true,
paging: result.data.length > 20
}) })
form.render('select')
} }
}) }
})
}
// 查询角色权限列表
function findRoleList(merchantId) {
var params = { method: 'org.ore.api.role.list', id: merchantId, delFlag: 0 }
request(params, function (res) {
if (res.code == '0') {
var list = res.data
roleId.empty()
list.unshift('')
$.each(list, function (index, item) {
roleId.append(new Option(item.roleName, item.id))
})
form.render('select')
}
})
}
// 搜索
function getSearch() {
var formVal = form.val('employeeForm')
var searchData = helper.clone(false, formVal)
if (searchData.type == 0) {
searchData.staffName = formVal.keywords
searchData.staffPhone = ''
} else if (searchData.type == 1) {
searchData.staffName = ''
searchData.staffPhone = formVal.keywords
} else {
searchData.staffName = ''
searchData.staffPhone = ''
} }
}) delete searchData.type
</script> delete searchData.keywords
<script type="text/html" id="employeeBar"> return searchData
}
function findAllDictData() {
var params = {
method: 'cn.com.glsx.merchants.menu.findAllDictData',
dictType: 'staff_status'
}
request(params, function (res) {
if (res.code == '0') {
var list = res.data
list.unshift('')
$.each(list, function (index, item) {
status.append(new Option(item.dictLabel, item.dictValue))
})
form.render('select')
}
})
}
})
</script>
<script type="text/html" id="employeeBar">
<div> <div>
<a class="layui-btn-xs" lay-event="detail">查看</a> <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="edit">修改</a>
...@@ -456,11 +452,13 @@ ...@@ -456,11 +452,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"> <script type="text/html" id="switchTpl">
<!-- 这里的 checked 的状态只是演示 --> <!-- 这里的 checked 的状态只是演示 -->
<div class="switch"> <div class="switch">
<input type="checkbox" name="sex" value="{{d.roleName}}" data-id="{{d.id}}" lay-skin="switch" lay-text="开|关" lay-filter="sexDemo" {{ d.status == 0 ? 'checked' : '' }}> <input type="checkbox" name="sex" value="{{d.roleName}}" data-id="{{d.id}}" lay-skin="switch" lay-text="开|关"
</div> lay-filter="sexDemo" {{ d.status==0 ? 'checked' : '' }}>
</script> </div>
</body> </script>
</html> </body>
</html>
\ No newline at end of file \ No newline at end of file
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh"> <html lang="zh">
<head>
<meta charset="utf-8" />
<meta content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="修改有效期" />
<meta name="author" content="GLSX Web Team" />
<meta name="keywords" itemprop="keywords" content="广联,商户管理" />
<link rel="stylesheet" type="text/css" href="/css/main.css" />
<style>
.valid-period {
text-align: center;
padding: 20px 20px;
background-color: #ffffff;
}
</style>
<title>修改有效期</title>
</head>
<body> <head>
<div id="app"> <meta charset="utf-8" />
<main class="valid-period"> <meta content="IE=edge" />
<form class="layui-form" lay-filter="periodFilter"> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<div class="layui-form-item"> <meta name="description" content="修改有效期" />
<div class="layui-form-label required" style="width: 120px">账户有效期:</div> <meta name="author" content="GLSX Web Team" />
<div class="layui-input-inline" style="width: auto"> <meta name="keywords" itemprop="keywords" content="广联,商户管理" />
<select name="effectiveTime" id="periodSelect" required lay-verify="required"> <link rel="stylesheet" type="text/css" href="/css/main.css" />
<option value="">请选择</option> <style>
</select> .valid-period {
<p class="input-downtips">(注:永久有效不超过所属工厂商户的有效期)</p> text-align: center;
</div> padding: 20px 20px;
<button id="periodVerifyBtn" lay-submit lay-filter="periodSubmit" style="display: none"></button> background-color: #ffffff;
<!-- <div class="layui-form-item" style="padding: 40px 20px;"> }
</style>
<title>修改有效期</title>
</head>
<body>
<div id="app">
<main class="valid-period">
<form class="layui-form" lay-filter="periodFilter">
<div class="layui-form-item">
<div class="layui-form-label required" style="width: 120px">账户有效期:</div>
<div class="layui-input-inline" style="width: auto">
<select name="effectiveTime" id="periodSelect" required lay-verify="required">
<option value="">请选择</option>
</select>
<p class="input-downtips">(注:永久有效不超过所属工厂商户的有效期)</p>
</div>
<button id="periodVerifyBtn" lay-submit lay-filter="periodSubmit" style="display: none"></button>
<!-- <div class="layui-form-item" style="padding: 40px 20px;">
<div class="layui-input-inline"> <div class="layui-input-inline">
<button class="layui-btn layui-btn-sm" lay-submit lay-filter="validSubmit">立即提交</button> <button class="layui-btn layui-btn-sm" lay-submit lay-filter="validSubmit">立即提交</button>
<button type="reset" class="layui-btn layui-btn-sm layui-btn-primary">重置</button> <button type="reset" class="layui-btn layui-btn-sm layui-btn-primary">重置</button>
</div> </div>
</div> --> </div> -->
</div> </div>
</form> </form>
</main> </main>
</div> </div>
<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(['form', 'request', 'helper'], function () { layui.use(['form', 'request', 'helper'], function () {
var form = layui.form var form = layui.form
var request = layui.request var request = layui.request
var $ = layui.$ var $ = layui.$
var helper = layui.helper var helper = layui.helper
var currLayerIdx = parent.layer.getFrameIndex(window.name) var currLayerIdx = parent.layer.getFrameIndex(window.name)
var baseData = {} var baseData = {}
var vaildData = { var vaildData = {
id: getQueryString('id'), id: getQueryString('id'),
effectiveTime: getQueryString('effectiveTime') effectiveTime: getQueryString('effectiveTime')
} }
getVaildPeriod() getVaildPeriod()
form.on('submit(periodSubmit)', function (data) { form.on('submit(periodSubmit)', function (data) {
console.log(data.field, vaildData) // 调接口
// 调接口 var params = {
var params = { method: 'cn.com.glsx.merchants.staff.updateValPerByStaffId',
method: 'cn.com.glsx.merchants.staff.updateValPerByStaffId', effectiveTime: data.field.effectiveTime,
effectiveTime: data.field.effectiveTime, id: vaildData.id
id: vaildData.id }
request(params, function (res) {
if (res.code == '0') {
helper.store.set('isRefresh', true)
parent.layer.close(currLayerIdx)
} }
request(params, function (res) {
if (res.code == '0') {
helper.store.set('isRefresh', true)
parent.layer.close(currLayerIdx)
}
})
return false
}) })
return false
})
// 获取参数 // 获取参数
function getQueryString(name) { function getQueryString(name) {
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i') var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i')
var r = window.location.search.substr(1).match(reg) var r = window.location.search.substr(1).match(reg)
if (r != null) { if (r != null) {
return unescape(r[2]) return unescape(r[2])
}
return null
} }
return null
}
// 获取有效期 // 获取有效期
function getVaildPeriod() { function getVaildPeriod() {
request( request(
{ {
method: 'cn.com.glsx.merchants.menu.findAllDictData', method: 'cn.com.glsx.merchants.menu.findAllDictData',
dictType: 'staff_validity_period' dictType: 'staff_validity_period'
}, },
function (res) { function (res) {
if (res.code === '0') { if (res.code === '0') {
baseData.effectiveTimeList = res.data baseData.effectiveTimeList = res.data
var periodSelect = $('#periodSelect') var periodSelect = $('#periodSelect')
$.each(baseData.effectiveTimeList, function (index, item) { $.each(baseData.effectiveTimeList, function (index, item) {
periodSelect.append(new Option(item.dictLabel, item.dictValue)) periodSelect.append(new Option(item.dictLabel, item.dictValue))
}) })
form.val('periodFilter', { form.val('periodFilter', {
effectiveTime: vaildData.effectiveTime effectiveTime: vaildData.effectiveTime
}) })
console.log(vaildData.effectiveTime) form.render('select')
form.render('select')
}
} }
) }
} )
}) }
</script> })
</body> </script>
</html> </body>
</html>
\ No newline at end of file \ No newline at end of file
...@@ -624,7 +624,6 @@ ...@@ -624,7 +624,6 @@
format: 'yyyy-MM-dd', format: 'yyyy-MM-dd',
min: '2021-09-30', min: '2021-09-30',
done: function (value, date) { done: function (value, date) {
console.log(value, date)
expireDate.config.min = date expireDate.config.min = date
lay('#effectiveStarttime').html(value) lay('#effectiveStarttime').html(value)
} }
...@@ -715,7 +714,6 @@ ...@@ -715,7 +714,6 @@
form.on('submit(handleFirstSubmit)', function (data) { form.on('submit(handleFirstSubmit)', function (data) {
// document.querySelector('#basic').scrollIntoView(true) // document.querySelector('#basic').scrollIntoView(true)
console.log(data)
var formData = data.field var formData = data.field
var params = { var params = {
isloginName: 0 isloginName: 0
...@@ -996,7 +994,6 @@ ...@@ -996,7 +994,6 @@
$('#sevenday').on('click', function () { $('#sevenday').on('click', function () {
var startTime = new Date(new Date().setHours(0, 0, 0, 0)) var startTime = new Date(new Date().setHours(0, 0, 0, 0))
var endTime = startTime * 1 + 86400 * 7 * 1000 var endTime = startTime * 1 + 86400 * 7 * 1000
console.log(helper.dateFormat(startTime), endTime)
$('#effectiveStarttime').val(helper.dateFormat(startTime)) $('#effectiveStarttime').val(helper.dateFormat(startTime))
$('#expireDate').val(helper.dateFormat(endTime)) $('#expireDate').val(helper.dateFormat(endTime))
}) })
...@@ -1004,7 +1001,6 @@ ...@@ -1004,7 +1001,6 @@
$('#oneyear').on('click', function () { $('#oneyear').on('click', function () {
var startTime = new Date(new Date().setHours(0, 0, 0, 0)) var startTime = new Date(new Date().setHours(0, 0, 0, 0))
var endTime = startTime.setFullYear(startTime.getFullYear() + 1) var endTime = startTime.setFullYear(startTime.getFullYear() + 1)
console.log(helper.dateFormat(endTime))
$('#effectiveStarttime').val(helper.dateFormat(new Date(new Date().setHours(0, 0, 0, 0)))) $('#effectiveStarttime').val(helper.dateFormat(new Date(new Date().setHours(0, 0, 0, 0))))
$('#expireDate').val(helper.dateFormat(endTime)) $('#expireDate').val(helper.dateFormat(endTime))
}) })
...@@ -1012,7 +1008,6 @@ ...@@ -1012,7 +1008,6 @@
$('#twoyears').on('click', function () { $('#twoyears').on('click', function () {
var startTime = new Date(new Date().setHours(0, 0, 0, 0)) var startTime = new Date(new Date().setHours(0, 0, 0, 0))
var endTime = startTime.setFullYear(startTime.getFullYear() + 2) var endTime = startTime.setFullYear(startTime.getFullYear() + 2)
console.log(helper.dateFormat(endTime))
$('#effectiveStarttime').val(helper.dateFormat(new Date(new Date().setHours(0, 0, 0, 0)))) $('#effectiveStarttime').val(helper.dateFormat(new Date(new Date().setHours(0, 0, 0, 0))))
$('#expireDate').val(helper.dateFormat(endTime)) $('#expireDate').val(helper.dateFormat(endTime))
}) })
...@@ -1504,7 +1499,6 @@ ...@@ -1504,7 +1499,6 @@
}, },
// 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('请选择产品')
...@@ -1547,16 +1541,13 @@ ...@@ -1547,16 +1541,13 @@
// 产品复选框change事件 // 产品复选框change事件
form.on('checkbox(filter)', function (data) { form.on('checkbox(filter)', function (data) {
console.log(data, '33333333333')
var roleId = +data.elem.dataset.id var roleId = +data.elem.dataset.id
var projectId = data.value var projectId = data.value
var isAdd = data.elem.checked var isAdd = data.elem.checked
var filterName = 'treeTab' + roleId var filterName = 'treeTab' + roleId
console.log(roleId, projectId, isAdd)
// merchantProTreeResponses // merchantProTreeResponses
var changeObj = menuFunTreeData.find(item => item.accounttypeId == roleId).products.find(i => i.productId == projectId) var changeObj = menuFunTreeData.find(item => item.accounttypeId == roleId).products.find(i => i.productId == projectId)
var products = menuFunTreeData.find(item => item.accounttypeId == roleId).products var products = menuFunTreeData.find(item => item.accounttypeId == roleId).products
console.log(changeObj, products, roleId, treeData)
if (isAdd) { if (isAdd) {
// 新增 // 新增
active.treeTabAdd( active.treeTabAdd(
...@@ -1586,7 +1577,6 @@ ...@@ -1586,7 +1577,6 @@
}) })
} else { } else {
// 删除 // 删除
console.log(treeData, Object.keys(treeData).length)
var productId = 'tab_' + roleId + '_' + changeObj.productId var productId = 'tab_' + roleId + '_' + changeObj.productId
active.tabDelete(filterName, productId) active.tabDelete(filterName, productId)
if (Object.keys(treeData).length != 0) { if (Object.keys(treeData).length != 0) {
...@@ -1626,38 +1616,17 @@ ...@@ -1626,38 +1616,17 @@
menuFunTreeData = res.data menuFunTreeData = res.data
var accountType = $('#accountType') var accountType = $('#accountType')
accountType.empty() accountType.empty()
console.log(menuFunTreeData)
menuFunTreeData.forEach((item, index) => { menuFunTreeData.forEach((item, index) => {
var str = $('<input lay-filter="switch" type="checkbox" name="accounttypeId" value="' + item.accounttypeId + '" title="' + item.accounttypeName + '" />') var str = $('<input lay-filter="switch" type="checkbox" name="accounttypeId" value="' + item.accounttypeId + '" title="' + item.accounttypeName + '" />')
accountType.append(str) accountType.append(str)
if (merchantId) { if (merchantId) {
console.log(check_arr)
check_arr.forEach(i => { check_arr.forEach(i => {
if (i.accounttypeId == item.accounttypeId) { if (i.accounttypeId == item.accounttypeId) {
var productData = i var productData = i
var id = item.accounttypeId var id = item.accounttypeId
console.log('productData', productData)
str.attr('checked', true) str.attr('checked', true)
var obj = { title: item.accounttypeName, value: item.accounttypeId } var obj = { title: item.accounttypeName, value: item.accounttypeId }
active.tabAdd(obj, productData.products) active.tabAdd(obj, productData.products)
// productData.products.forEach(j => {
// console.log(j, item)
// var products = item.products.find(n => n.productId == j.productId)
// console.log(products)
// active.treeTabAdd(
// {
// name: j.productName,
// value: j.productId
// },
// item.accounttypeId,
// products.merchantProTreeResponses,
// j.menuIds
// )
// })
// var filterName = 'treeTab' + item.accounttypeId
// var productId = 'tab_' + item.accounttypeId + '_' + productData.products[0].productId
// console.log(filterName, productId)
// active.tabChange(filterName, productId)
} }
}) })
} }
...@@ -1697,7 +1666,6 @@ ...@@ -1697,7 +1666,6 @@
for (var key in treeData) { for (var key in treeData) {
var accountObj = treeData[key] var accountObj = treeData[key]
var productList = [] var productList = []
console.log(accountObj)
if (Object.keys(accountObj).length != 0) { if (Object.keys(accountObj).length != 0) {
for (var i in accountObj) { for (var i in accountObj) {
var productObj = accountObj[i] var productObj = accountObj[i]
...@@ -1797,7 +1765,6 @@ ...@@ -1797,7 +1765,6 @@
$('#confirm').on('click', function () { $('#confirm').on('click', function () {
getAuthList() getAuthList()
console.log(requestList)
if (requestList.length != 0) { if (requestList.length != 0) {
var params = { var params = {
merchantId: merchantId, merchantId: merchantId,
......
...@@ -531,7 +531,6 @@ ...@@ -531,7 +531,6 @@
// 1-基本信息;2-权限树 // 1-基本信息;2-权限树
var step = 1 var step = 1
var merchantId = null var merchantId = null
console.log(qs('parentId'))
var parentMerchantId = null var parentMerchantId = null
var accountTypeVisible = false var accountTypeVisible = false
// 是否工厂 // 是否工厂
...@@ -625,7 +624,6 @@ ...@@ -625,7 +624,6 @@
format: 'yyyy-MM-dd', format: 'yyyy-MM-dd',
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()))
date.month = date.month - 1 date.month = date.month - 1
date.date = date.date + 1 date.date = date.date + 1
$('#expireDate').val('') $('#expireDate').val('')
...@@ -721,7 +719,6 @@ ...@@ -721,7 +719,6 @@
// select 选择触发 // select 选择触发
form.on('select(accountLevel)', function (data) { form.on('select(accountLevel)', function (data) {
console.log(data.value, accountInfo)
if (!accountInfo) { if (!accountInfo) {
if (data.value == 4) { if (data.value == 4) {
$('#effectiveShowEl').removeClass('hide') $('#effectiveShowEl').removeClass('hide')
...@@ -729,7 +726,6 @@ ...@@ -729,7 +726,6 @@
$('#effectiveStarttime').attr('lay-verify', 'required') $('#effectiveStarttime').attr('lay-verify', 'required')
$('#expireDate').attr('lay-verify', 'required') $('#expireDate').attr('lay-verify', 'required')
} else { } else {
console.log('jinlai')
$('#effectiveShowEl').removeClass('show') $('#effectiveShowEl').removeClass('show')
$('#effectiveShowEl').addClass('hide') $('#effectiveShowEl').addClass('hide')
$('#effectiveStarttime').removeAttr('lay-verify') $('#effectiveStarttime').removeAttr('lay-verify')
...@@ -739,7 +735,6 @@ ...@@ -739,7 +735,6 @@
}) })
form.on('submit(handleFirstSubmit)', function (data) { form.on('submit(handleFirstSubmit)', function (data) {
// document.querySelector('#basic').scrollIntoView(true) // document.querySelector('#basic').scrollIntoView(true)
console.log(data)
var formData = data.field var formData = data.field
var params = { var params = {
isloginName: 0 isloginName: 0
...@@ -1024,7 +1019,6 @@ ...@@ -1024,7 +1019,6 @@
$('#sevenday').on('click', function () { $('#sevenday').on('click', function () {
var startTime = new Date(new Date().setHours(0, 0, 0, 0)) var startTime = new Date(new Date().setHours(0, 0, 0, 0))
var endTime = startTime * 1 + 86400 * 7 * 1000 var endTime = startTime * 1 + 86400 * 7 * 1000
console.log(helper.dateFormat(startTime), endTime)
$('#effectiveStarttime').val(helper.dateFormat(startTime)) $('#effectiveStarttime').val(helper.dateFormat(startTime))
$('#expireDate').val(helper.dateFormat(endTime)) $('#expireDate').val(helper.dateFormat(endTime))
$('#expireDate').removeAttr('disabled') $('#expireDate').removeAttr('disabled')
...@@ -1033,7 +1027,6 @@ ...@@ -1033,7 +1027,6 @@
$('#oneyear').on('click', function () { $('#oneyear').on('click', function () {
var startTime = new Date(new Date().setHours(0, 0, 0, 0)) var startTime = new Date(new Date().setHours(0, 0, 0, 0))
var endTime = startTime.setFullYear(startTime.getFullYear() + 1) var endTime = startTime.setFullYear(startTime.getFullYear() + 1)
console.log(helper.dateFormat(endTime))
$('#effectiveStarttime').val(helper.dateFormat(new Date(new Date().setHours(0, 0, 0, 0)))) $('#effectiveStarttime').val(helper.dateFormat(new Date(new Date().setHours(0, 0, 0, 0))))
$('#expireDate').val(helper.dateFormat(endTime)) $('#expireDate').val(helper.dateFormat(endTime))
$('#expireDate').removeAttr('disabled') $('#expireDate').removeAttr('disabled')
...@@ -1042,7 +1035,6 @@ ...@@ -1042,7 +1035,6 @@
$('#twoyears').on('click', function () { $('#twoyears').on('click', function () {
var startTime = new Date(new Date().setHours(0, 0, 0, 0)) var startTime = new Date(new Date().setHours(0, 0, 0, 0))
var endTime = startTime.setFullYear(startTime.getFullYear() + 2) var endTime = startTime.setFullYear(startTime.getFullYear() + 2)
console.log(helper.dateFormat(endTime))
$('#effectiveStarttime').val(helper.dateFormat(new Date(new Date().setHours(0, 0, 0, 0)))) $('#effectiveStarttime').val(helper.dateFormat(new Date(new Date().setHours(0, 0, 0, 0))))
$('#expireDate').val(helper.dateFormat(endTime)) $('#expireDate').val(helper.dateFormat(endTime))
$('#expireDate').removeAttr('disabled') $('#expireDate').removeAttr('disabled')
...@@ -1530,7 +1522,6 @@ ...@@ -1530,7 +1522,6 @@
}, },
// 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('请选择产品')
...@@ -1573,16 +1564,13 @@ ...@@ -1573,16 +1564,13 @@
// 产品复选框change事件 // 产品复选框change事件
form.on('checkbox(filter)', function (data) { form.on('checkbox(filter)', function (data) {
console.log(data, '33333333333')
var roleId = +data.elem.dataset.id var roleId = +data.elem.dataset.id
var projectId = data.value var projectId = data.value
var isAdd = data.elem.checked var isAdd = data.elem.checked
var filterName = 'treeTab' + roleId var filterName = 'treeTab' + roleId
console.log(roleId, projectId, isAdd)
// merchantProTreeResponses // merchantProTreeResponses
var changeObj = menuFunTreeData.find(item => item.accounttypeId == roleId).products.find(i => i.productId == projectId) var changeObj = menuFunTreeData.find(item => item.accounttypeId == roleId).products.find(i => i.productId == projectId)
var products = menuFunTreeData.find(item => item.accounttypeId == roleId).products var products = menuFunTreeData.find(item => item.accounttypeId == roleId).products
console.log(changeObj, products, roleId, treeData)
if (isAdd) { if (isAdd) {
// 新增 // 新增
active.treeTabAdd( active.treeTabAdd(
...@@ -1612,7 +1600,6 @@ ...@@ -1612,7 +1600,6 @@
}) })
} else { } else {
// 删除 // 删除
console.log(treeData, Object.keys(treeData).length)
var productId = 'tab_' + roleId + '_' + changeObj.productId var productId = 'tab_' + roleId + '_' + changeObj.productId
active.tabDelete(filterName, productId) active.tabDelete(filterName, productId)
if (Object.keys(treeData).length != 0) { if (Object.keys(treeData).length != 0) {
...@@ -1652,38 +1639,17 @@ ...@@ -1652,38 +1639,17 @@
menuFunTreeData = res.data menuFunTreeData = res.data
var accountType = $('#accountType') var accountType = $('#accountType')
accountType.empty() accountType.empty()
console.log(menuFunTreeData)
menuFunTreeData.forEach((item, index) => { menuFunTreeData.forEach((item, index) => {
var str = $('<input lay-filter="switch" type="checkbox" name="accounttypeId" value="' + item.accounttypeId + '" title="' + item.accounttypeName + '" />') var str = $('<input lay-filter="switch" type="checkbox" name="accounttypeId" value="' + item.accounttypeId + '" title="' + item.accounttypeName + '" />')
accountType.append(str) accountType.append(str)
if (merchantId) { if (merchantId) {
console.log(check_arr)
check_arr.forEach(i => { check_arr.forEach(i => {
if (i.accounttypeId == item.accounttypeId) { if (i.accounttypeId == item.accounttypeId) {
var productData = i var productData = i
var id = item.accounttypeId var id = item.accounttypeId
console.log('productData', productData)
str.attr('checked', true) str.attr('checked', true)
var obj = { title: item.accounttypeName, value: item.accounttypeId } var obj = { title: item.accounttypeName, value: item.accounttypeId }
active.tabAdd(obj, productData.products) active.tabAdd(obj, productData.products)
// productData.products.forEach(j => {
// console.log(j, item)
// var products = item.products.find(n => n.productId == j.productId)
// console.log(products)
// active.treeTabAdd(
// {
// name: j.productName,
// value: j.productId
// },
// item.accounttypeId,
// products.merchantProTreeResponses,
// j.menuIds
// )
// })
// var filterName = 'treeTab' + item.accounttypeId
// var productId = 'tab_' + item.accounttypeId + '_' + productData.products[0].productId
// console.log(filterName, productId)
// active.tabChange(filterName, productId)
} }
}) })
} }
...@@ -1800,7 +1766,6 @@ ...@@ -1800,7 +1766,6 @@
} else { } else {
params.accountTypes = JSON.stringify([]) params.accountTypes = JSON.stringify([])
} }
console.log(requestList, params)
request(params, function (res) { request(params, function (res) {
if (res.code == '0') { if (res.code == '0') {
layer.msg('操作成功', { layer.msg('操作成功', {
......
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh"> <html lang="zh">
<head>
<meta charset="utf-8" />
<meta content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="广联帐户管理中心-员工管理" />
<meta name="author" content="GLSX Web Team" />
<meta name="keywords" itemprop="keywords" content="广联,帐户管理,员工管理" />
<link rel="stylesheet" type="text/css" href="/css/main.css" />
<link rel="stylesheet" type="text/css" href="/css/merchant.css" />
<title>商户管理</title>
<style>
.show {
display: inline-block;
}
.hide {
display: none;
}
.pull-right {
float: right;
}
.merchant-headerMsg { <head>
display: flex; <meta charset="utf-8" />
} <meta content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
.merchant-content #secondmerchantName { <meta name="description" content="广联帐户管理中心-员工管理" />
margin-left: 15px; <meta name="author" content="GLSX Web Team" />
width: 240px; <meta name="keywords" itemprop="keywords" content="广联,帐户管理,员工管理" />
height: 24px; <link rel="stylesheet" type="text/css" href="/css/main.css" />
font-size: 16px; <link rel="stylesheet" type="text/css" href="/css/merchant.css" />
font-weight: 500; <title>商户管理</title>
color: #333333; <style>
line-height: 24px; .show {
overflow: hidden; display: inline-block;
text-overflow: ellipsis; }
white-space: nowrap;
word-break: break-all; .hide {
} display: none;
}
.merchant-content > div:not(:first-child) {
margin-left: 15px; .pull-right {
height: 20px; float: right;
font-size: 12px; }
font-weight: 400;
color: #999999; .merchant-headerMsg {
line-height: 20px; display: flex;
} }
.layui-form { .merchant-content #secondmerchantName {
margin-top: 20px; margin-left: 15px;
} width: 240px;
.wrapper-merchant { height: 24px;
background-color: #f4f5fa; font-size: 16px;
display: flex; font-weight: 500;
} color: #333333;
.merchant-left { line-height: 24px;
padding-top: 15px; overflow: hidden;
min-height: calc(100vh - 200px); text-overflow: ellipsis;
background-color: #fff; white-space: nowrap;
width: 340px; word-break: break-all;
margin-right: 20px; }
box-sizing: border-box;
overflow: auto; .merchant-content>div:not(:first-child) {
} margin-left: 15px;
.ztree .wrapper-tree { height: 20px;
overflow-y: auto; font-size: 12px;
} font-weight: 400;
.wrapper-tree::-webkit-scrollbar { color: #999999;
display: none; line-height: 20px;
} }
.wrapper-tree .node_name {
display: inline-block; .layui-form {
max-width: 235px; margin-top: 20px;
overflow: hidden; }
text-overflow: ellipsis;
white-space: nowrap; .wrapper-merchant {
word-break: break-all; background-color: #f4f5fa;
} display: flex;
.detail .wrapper-tree { }
margin-left: 0;
} .merchant-left {
.merchant-right { padding-top: 15px;
padding-top: 15px; min-height: calc(100vh - 200px);
background-color: #fff;
overflow-x: auto; width: 340px;
/* max-width: calc(100vw - 340px - 20px); */ margin-right: 20px;
background-color: #fff; box-sizing: border-box;
padding-left: 20px; overflow: auto;
padding-right: 20px; }
box-sizing: border-box;
} .ztree .wrapper-tree {
overflow-y: auto;
.merchant-right > div:first-child { }
/* position: relative;
.wrapper-tree::-webkit-scrollbar {
display: none;
}
.wrapper-tree .node_name {
display: inline-block;
max-width: 235px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
word-break: break-all;
}
.detail .wrapper-tree {
margin-left: 0;
}
.merchant-right {
padding-top: 15px;
overflow-x: auto;
/* max-width: calc(100vw - 340px - 20px); */
background-color: #fff;
padding-left: 20px;
padding-right: 20px;
box-sizing: border-box;
}
.merchant-right>div:first-child {
/* position: relative;
height: 40px; height: 40px;
line-height: 40px; */ line-height: 40px; */
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
justify-content: space-between; justify-content: space-between;
} }
.layui-form-label {
width: 130px !important; .layui-form-label {
} width: 130px !important;
.merchant-right .companyName { }
display: inline-block;
max-width: 300px; .merchant-right .companyName {
height: 36px; display: inline-block;
font-size: 16px; max-width: 300px;
height: 36px;
font-weight: 500; font-size: 16px;
color: #333333;
/* line-height: 22px; */ font-weight: 500;
overflow: hidden; color: #333333;
text-overflow: ellipsis; /* line-height: 22px; */
white-space: nowrap; overflow: hidden;
word-break: break-all; text-overflow: ellipsis;
} white-space: nowrap;
.merchant-right .emloyeeListText { word-break: break-all;
display: inline-block; }
height: 36px;
font-size: 16px; .merchant-right .emloyeeListText {
font-weight: 500; display: inline-block;
color: #333333; height: 36px;
/* line-height: 22px; */ font-size: 16px;
} font-weight: 500;
color: #333333;
.merchant-right .layui-btn { /* line-height: 22px; */
/* position: absolute; }
.merchant-right .layui-btn {
/* position: absolute;
right: 0px; */ right: 0px; */
margin-left: 20px; margin-left: 20px;
} }
/* .merchant-right .layui-input-inline { /* .merchant-right .layui-input-inline {
position: absolute; position: absolute;
right: 70px; right: 70px;
} */ } */
.updateRecord { .updateRecord {
text-align: left; text-align: left;
color: #999; color: #999;
background-color: #fff; background-color: #fff;
padding: 0 20px; padding: 0 20px;
} }
.mb21 { .mb21 {
margin-bottom: 21px; margin-bottom: 21px;
} }
/* .tabmutiple-content-wrap { /* .tabmutiple-content-wrap {
background-color: #f4f6fc; background-color: #f4f6fc;
padding-top: 0 0 10px; padding-top: 0 0 10px;
margin: 0 20px; margin: 0 20px;
...@@ -165,735 +177,743 @@ ...@@ -165,735 +177,743 @@
.layui-this { .layui-this {
background-color: #fff; background-color: #fff;
} */ } */
.tabmutiple-content-wrap { .tabmutiple-content-wrap {
background-color: #f4f6fc; background-color: #f4f6fc;
padding: 0 0 1px; padding: 0 0 1px;
margin: 0 20px; margin: 0 20px;
border-radius: 4px; border-radius: 4px;
} }
.tabmutiple-content { .tabmutiple-content {
margin: 0 10px; margin: 0 10px;
/* background-color: #f4f6fc; */ /* background-color: #f4f6fc; */
} }
.layui-tab-title .layui-this {
transform: none; .layui-tab-title .layui-this {
} transform: none;
.layui-tab-title { }
background-color: #f4f6fc;
} .layui-tab-title {
.layui-tab-card > .layui-tab-title li { background-color: #f4f6fc;
margin-left: 0; }
}
.outtitle { .layui-tab-card>.layui-tab-title li {
margin-left: -10px; margin-left: 0;
} }
.powerlimt .layui-tab-content {
background-color: #fff; .outtitle {
} margin-left: -10px;
}
.powerlimt .layui-this {
/* background-color: #fff; */ .powerlimt .layui-tab-content {
border: 2px solid #fff; background-color: #fff;
}
/* border-top-left-radius: 4px;
.powerlimt .layui-this {
/* background-color: #fff; */
border: 2px solid #fff;
/* border-top-left-radius: 4px;
border-top-right-radius: 4px; */ border-top-right-radius: 4px; */
} }
.fixed-btn-block { .fixed-btn-block {
position: fixed; position: fixed;
bottom: 0; bottom: 0;
/* padding: 14px; */ /* padding: 14px; */
width: 100%; width: 100%;
border-top: 1px solid #eee; border-top: 1px solid #eee;
background-color: #ffffff; background-color: #ffffff;
} }
.fixed-btn { .fixed-btn {
/* width: 140px; */ /* width: 140px; */
height: 28px; height: 28px;
line-height: 28px; line-height: 28px;
font-size: 12px; font-size: 12px;
} }
.threeWrap {
background-color: #f4f6fc; .threeWrap {
} background-color: #f4f6fc;
/* 新增样式 */ }
.MsgWrap {
position: relative; /* 新增样式 */
background-color: #fff; .MsgWrap {
margin-bottom: 20px; position: relative;
/* min-height: 300px; */ background-color: #fff;
} margin-bottom: 20px;
.powerlimt { /* min-height: 300px; */
background-color: #fff; }
padding-bottom: 30px;
} .powerlimt {
.grayLine { background-color: #fff;
position: absolute; padding-bottom: 30px;
left: 0; }
top: 48px;
background-color: #d8d8d8; .grayLine {
width: 100%; position: absolute;
height: 1px; left: 0;
} top: 48px;
.companyMsg .layui-word-aux { background-color: #d8d8d8;
color: #999 !important; width: 100%;
padding-left: 20px !important; height: 1px;
padding-right: 5px !important; }
padding-top: 6px;
} .companyMsg .layui-word-aux {
.AccountMsg .layui-word-aux { color: #999 !important;
color: #999 !important; padding-left: 20px !important;
padding-left: 20px !important; padding-right: 5px !important;
padding-right: 5px !important; padding-top: 6px;
padding-top: 6px; }
}
.account-type-span { .AccountMsg .layui-word-aux {
display: inline-block; color: #999 !important;
/* width: 100px; */ padding-left: 20px !important;
/* height: 32px; */ padding-right: 5px !important;
padding: 9px 15px; padding-top: 6px;
background-color: #f3f2ff; }
border-radius: 4px;
color: #5850ff; .account-type-span {
line-height: 14px; display: inline-block;
margin-right: 10px; /* width: 100px; */
margin-bottom: 10px; /* height: 32px; */
} padding: 9px 15px;
.detail-content { background-color: #f3f2ff;
padding: 30px 0; border-radius: 4px;
} color: #5850ff;
.updateRecord .layui-table-view .layui-table { line-height: 14px;
overflow-y: scroll; margin-right: 10px;
} margin-bottom: 10px;
.updateRecord .layui-table-body { }
overflow-y: scroll;
} .detail-content {
</style> padding: 30px 0;
</head> }
<body> .updateRecord .layui-table-view .layui-table {
<div id="app"> overflow-y: scroll;
<main class="bg-white wrapper detail"> }
<div class="layui-tab layui-top-tab layui-tab-brief bg-detail">
<ul class="layui-tab-title"> .updateRecord .layui-table-body {
<li class="layui-this" style="padding: 0; width: 90px; margin-right: 20px">商户信息</li> overflow-y: scroll;
<li style="padding: 0; width: 90px; margin-right: 20px">上级/下级商户</li> }
<li style="padding: 0; width: 90px">修改记录</li> </style>
</ul> </head>
<div class="layui-tab-content clearfix m-t-md">
<div class="layui-tab-item layui-show threeWrap"> <body>
<div class="MsgWrap AccountMsg layui-row"> <div id="app">
<div class="grayLine"></div> <main class="bg-white wrapper detail">
<h3 class="content-title">账户信息</h3> <div class="layui-tab layui-top-tab layui-tab-brief bg-detail">
<div class="detail-content clearfix"> <ul class="layui-tab-title">
<div class="layui-col-md5"> <li class="layui-this" style="padding: 0; width: 90px; margin-right: 20px">商户信息</li>
<div class="layui-form-item"> <li style="padding: 0; width: 90px; margin-right: 20px">上级/下级商户</li>
<label class="layui-form-label">登录账户名:</label> <li style="padding: 0; width: 90px">修改记录</li>
<div class="layui-input-block"> </ul>
<div class="layui-word-aux" id="merchantLoginAccount"></div> <div class="layui-tab-content clearfix m-t-md">
</div> <div class="layui-tab-item layui-show threeWrap">
<div class="MsgWrap AccountMsg layui-row">
<div class="grayLine"></div>
<h3 class="content-title">账户信息</h3>
<div class="detail-content clearfix">
<div class="layui-col-md5">
<div class="layui-form-item">
<label class="layui-form-label">登录账户名:</label>
<div class="layui-input-block">
<div class="layui-word-aux" id="merchantLoginAccount"></div>
</div> </div>
</div> </div>
<div class="layui-col-md5"> </div>
<div class="layui-form-item mb21 layui-col-md5"> <div class="layui-col-md5">
<label class="layui-form-label">账户等级:</label> <div class="layui-form-item mb21 layui-col-md5">
<div class="layui-input-block"> <label class="layui-form-label">账户等级:</label>
<div class="layui-word-aux" id="accountLevelName"></div> <div class="layui-input-block">
</div> <div class="layui-word-aux" id="accountLevelName"></div>
</div> </div>
</div> </div>
<!-- <div class="layui-form-item"> </div>
<!-- <div class="layui-form-item">
<label class="layui-form-label">账户类型:</label> <label class="layui-form-label">账户类型:</label>
<div class="layui-input-block"> <div class="layui-input-block">
<div class="layui-form-mid layui-word-aux" id="accountTypeNames"></div> <div class="layui-form-mid layui-word-aux" id="accountTypeNames"></div>
</div> </div>
</div> --> </div> -->
<div class="layui-col-md5"> <div class="layui-col-md5">
<div class="layui-form-item mb21"> <div class="layui-form-item mb21">
<label class="layui-form-label">开通模式:</label> <label class="layui-form-label">开通模式:</label>
<div class="layui-input-block"> <div class="layui-input-block">
<div class="layui-word-aux" id="merchantModelName"></div> <div class="layui-word-aux" id="merchantModelName"></div>
</div>
</div> </div>
</div> </div>
</div>
<div class="layui-col-md5"> <div class="layui-col-md5">
<div class="layui-form-item mb21"> <div class="layui-form-item mb21">
<label class="layui-form-label">账户状态:</label> <label class="layui-form-label">账户状态:</label>
<div class="layui-input-block"> <div class="layui-input-block">
<div class="layui-word-aux" id="statusName"></div> <div class="layui-word-aux" id="statusName"></div>
</div>
</div> </div>
</div> </div>
</div>
<div class="layui-col-md5"> <div class="layui-col-md5">
<div class="layui-form-item mb21"> <div class="layui-form-item mb21">
<label class="layui-form-label">关联企业微信名:</label> <label class="layui-form-label">关联企业微信名:</label>
<div class="layui-input-block"> <div class="layui-input-block">
<div class="layui-word-aux" id="entmicroName"></div> <div class="layui-word-aux" id="entmicroName"></div>
</div>
</div> </div>
</div> </div>
</div>
<div class="layui-col-md5"> <div class="layui-col-md5">
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">账户有效期:</label> <label class="layui-form-label">账户有效期:</label>
<div class="layui-input-block"> <div class="layui-input-block">
<div class="layui-word-aux" id="effectiveTimeName"></div> <div class="layui-word-aux" id="effectiveTimeName"></div>
</div>
</div> </div>
</div> </div>
<div class="layui-col-md12"> </div>
<div class="layui-form-item"> <div class="layui-col-md12">
<label class="layui-form-label">账户类型:</label> <div class="layui-form-item">
<div class="layui-input-block"> <label class="layui-form-label">账户类型:</label>
<div class="layui-word-aux" id="accountAuth"></div> <div class="layui-input-block">
</div> <div class="layui-word-aux" id="accountAuth"></div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="MsgWrap powerlimt"> </div>
<h3 class="content-title">功能权限</h3> <div class="MsgWrap powerlimt">
<div class="tabmutiple-content-wrap"> <h3 class="content-title">功能权限</h3>
<div class="layui-tab tabmutiple-content" lay-filter="roleAuth"> <div class="tabmutiple-content-wrap">
<ul class="layui-tab-title outtitle"></ul> <div class="layui-tab tabmutiple-content" lay-filter="roleAuth">
<div class="layui-tab-content"></div> <ul class="layui-tab-title outtitle"></ul>
</div> <div class="layui-tab-content"></div>
</div> </div>
</div> </div>
<div class="MsgWrap companyMsg clearfix" style="margin-bottom: 100px"> </div>
<div class="grayLine"></div> <div class="MsgWrap companyMsg clearfix" style="margin-bottom: 100px">
<h3 class="content-title">企业信息</h3> <div class="grayLine"></div>
<div class="detail-content clearfix"> <h3 class="content-title">企业信息</h3>
<div class="layui-col-md5"> <div class="detail-content clearfix">
<div class="layui-form-item"> <div class="layui-col-md5">
<label class="layui-form-label">商户名称:</label> <div class="layui-form-item">
<div class="layui-input-block"> <label class="layui-form-label">商户名称:</label>
<div class="layui-word-aux" id="merchantName"></div> <div class="layui-input-block">
</div> <div class="layui-word-aux" id="merchantName"></div>
</div> </div>
</div> </div>
<div class="layui-col-md5"> </div>
<div class="layui-form-item"> <div class="layui-col-md5">
<label class="layui-form-label">简称:</label> <div class="layui-form-item">
<div class="layui-input-block"> <label class="layui-form-label">简称:</label>
<!-- layui-form-mid --> <div class="layui-input-block">
<div class="layui-word-aux" id="merchantAbbreviation"></div> <!-- layui-form-mid -->
</div> <div class="layui-word-aux" id="merchantAbbreviation"></div>
</div> </div>
</div> </div>
<div class="layui-col-md5"> </div>
<div class="layui-form-item"> <div class="layui-col-md5">
<label class="layui-form-label">商户类型:</label> <div class="layui-form-item">
<div class="layui-input-block"> <label class="layui-form-label">商户类型:</label>
<!-- layui-form-mid --> <div class="layui-input-block">
<div class="layui-word-aux" id="merchantTypeName"></div> <!-- layui-form-mid -->
</div> <div class="layui-word-aux" id="merchantTypeName"></div>
</div> </div>
</div> </div>
</div>
<div class="layui-col-md5"> <div class="layui-col-md5">
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label" id="orgTxt">身份证:</label> <label class="layui-form-label" id="orgTxt">身份证:</label>
<div class="layui-input-block"> <div class="layui-input-block">
<!-- layui-form-mid --> <!-- layui-form-mid -->
<div class="layui-word-aux" id="merchantOrgcode"></div> <div class="layui-word-aux" id="merchantOrgcode"></div>
</div>
</div> </div>
</div> </div>
</div>
<div class="layui-col-md5"> <div class="layui-col-md5">
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">地址:</label> <label class="layui-form-label">地址:</label>
<div class="layui-input-block"> <div class="layui-input-block">
<!-- layui-form-mid --> <!-- layui-form-mid -->
<div class="layui-word-aux" id="merchantAddress"></div> <div class="layui-word-aux" id="merchantAddress"></div>
</div>
</div> </div>
</div> </div>
</div>
<div class="layui-col-md5"> <div class="layui-col-md5">
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">联系人:</label> <label class="layui-form-label">联系人:</label>
<div class="layui-input-block"> <div class="layui-input-block">
<!-- layui-form-mid --> <!-- layui-form-mid -->
<div class="layui-word-aux" id="merchantLegalPerson"></div> <div class="layui-word-aux" id="merchantLegalPerson"></div>
</div>
</div> </div>
</div> </div>
</div>
<div class="layui-col-md5"> <div class="layui-col-md5">
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">联系电话:</label> <label class="layui-form-label">联系电话:</label>
<div class="layui-input-block"> <div class="layui-input-block">
<!-- layui-form-mid --> <!-- layui-form-mid -->
<div class="layui-word-aux" id="merchantLegalPersonPhone"></div> <div class="layui-word-aux" id="merchantLegalPersonPhone"></div>
</div>
</div> </div>
</div> </div>
</div>
<div class="layui-col-md5"> <div class="layui-col-md5">
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">营业范围:</label> <label class="layui-form-label">营业范围:</label>
<div class="layui-input-block"> <div class="layui-input-block">
<!-- layui-form-mid --> <!-- layui-form-mid -->
<div class="layui-word-aux" id="businessScopName"></div> <div class="layui-word-aux" id="businessScopName"></div>
</div>
</div> </div>
</div> </div>
</div>
<div class="layui-col-md5"> <div class="layui-col-md5">
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">主营品牌:</label> <label class="layui-form-label">主营品牌:</label>
<div class="layui-input-block"> <div class="layui-input-block">
<!-- layui-form-mid --> <!-- layui-form-mid -->
<div class="layui-word-aux" id="merchantBrandName"></div> <div class="layui-word-aux" id="merchantBrandName"></div>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="layui-tab-item"> </div>
<div class="wrapper-merchant"> <div class="layui-tab-item">
<div class="merchant-left"> <div class="wrapper-merchant">
<div class="merchant-headerMsg"> <div class="merchant-left">
<div class="merchantImg"><img src="../../css/img/merchantImg.png" alt="" /></div> <div class="merchant-headerMsg">
<div class="merchant-content"> <div class="merchantImg"><img src="../../css/img/merchantImg.png" alt="" /></div>
<div id="secondmerchantName"></div> <div class="merchant-content">
<div> <div id="secondmerchantName"></div>
商户号: <div>
<span id="secondmerchantId"></span> 商户号:
</div> <span id="secondmerchantId"></span>
<div>
您共有
<span id="numberOfSubMerchants"></span>
个子商户,共有
<span id="numberOfStores"></span>
家门店
</div>
</div> </div>
</div> <div>
您共有
<form class="layui-form" action=""> <span id="numberOfSubMerchants"></span>
<div class="layui-inline"> 个子商户,共有
<div class="layui-input-inline" style="width: 232px"> <span id="numberOfStores"></span>
<input class="layui-input" id="treeInput" placeholder="请输入" name="nameVal" /> 家门店
</div>
<button type="button" id="merchantBtn" class="layui-btn">查询</button>
</div> </div>
</form> </div>
<ul id="merchantTree" class="ztree wrapper-tree"></ul>
</div> </div>
<div class="merchant-right">
<div> <form class="layui-form" action="">
<div style="display: flex"> <div class="layui-inline">
<span id="companyName" class="companyName"></span> <div class="layui-input-inline" style="width: 232px">
<span class="emloyeeListText">员工列表</span> <input class="layui-input" id="treeInput" placeholder="请输入" name="nameVal" />
</div> </div>
<button type="button" id="merchantBtn" class="layui-btn">查询</button>
</div>
</form>
<ul id="merchantTree" class="ztree wrapper-tree"></ul>
</div>
<div class="merchant-right">
<div>
<div style="display: flex">
<span id="companyName" class="companyName"></span>
<span class="emloyeeListText">员工列表</span>
</div>
<div> <div>
<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>
<button class="layui-btn" id="tableSearch">查询</button>
</div> </div>
<button class="layui-btn" id="tableSearch">查询</button>
</div> </div>
<table id="subMerchantTable" lay-filter="subMerchantTool"></table>
</div> </div>
<table id="subMerchantTable" lay-filter="subMerchantTool"></table>
</div> </div>
</div> </div>
<div class="layui-tab-item updateRecord">
<table class="layui-table" id="recordTable"></table>
<div id="recordPage" class="align-left" style="padding-left: 20px; margin-top: 20px"></div>
</div>
</div> </div>
<div class="footer-close fixed-btn-block"> <div class="layui-tab-item updateRecord">
<button class="layui-btn layui-btn-normal btn-one" id="closeEl">关闭</button> <table class="layui-table" id="recordTable"></table>
<div id="recordPage" class="align-left" style="padding-left: 20px; margin-top: 20px"></div>
</div> </div>
</div> </div>
</main> <div class="footer-close fixed-btn-block">
</div> <button class="layui-btn layui-btn-normal btn-one" id="closeEl">关闭</button>
<script src="https://www.layuicdn.com/layui/layui.js"></script> </div>
<script src="/js/load.js"></script> </div>
<script> </main>
layui.use(['request', 'gtree', 'helper', 'table', 'form', 'treeTab', 'laypage'], function () { </div>
var $ = layui.$ <script src="https://www.layuicdn.com/layui/layui.js"></script>
var request = layui.request <script src="/js/load.js"></script>
var tree = layui.gtree <script>
var helper = layui.helper layui.use(['request', 'gtree', 'helper', 'table', 'form', 'treeTab', 'laypage'], function () {
var table = layui.table var $ = layui.$
var form = layui.form var request = layui.request
var treeTab = layui.treeTab var tree = layui.gtree
var laypage = layui.laypage var helper = layui.helper
var merchantId = qs('merchantId') var table = layui.table
var parentId = '' var form = layui.form
var merchantForm = {} var treeTab = layui.treeTab
var templateData = {} var laypage = layui.laypage
var treeData = {} var merchantId = qs('merchantId')
var menuFunTreeData = [] var parentId = ''
var basicArr = [ var merchantForm = {}
'merchantLoginAccount', var templateData = {}
'accountTypeNames', var treeData = {}
'accountLevelName', var menuFunTreeData = []
'effectiveTimeName', var basicArr = [
'merchantName', 'merchantLoginAccount',
'merchantAbbreviation', 'accountTypeNames',
'merchantTypeName', 'accountLevelName',
'merchantOrgcode', 'effectiveTimeName',
'merchantAddress', 'merchantName',
'merchantLegalPerson', 'merchantAbbreviation',
'merchantLegalPersonPhone', 'merchantTypeName',
'businessScopName', 'merchantOrgcode',
'merchantBrandName', 'merchantAddress',
'merchantModelName', 'merchantLegalPerson',
'statusName', 'merchantLegalPersonPhone',
'entmicroName' 'businessScopName',
] 'merchantBrandName',
var roleData = {} 'merchantModelName',
var accountAuth = [] 'statusName',
var recordPage = { 'entmicroName'
pageNum: 1, ]
pageSize: 10 var roleData = {}
} var accountAuth = []
var recordPageOptions = { var recordPage = {
elem: 'recordPage', pageNum: 1,
groups: 5, pageSize: 10
layout: ['count', 'page', 'skip'], }
jump: function (obj, first) { var recordPageOptions = {
recordPage.pageNum = obj.curr elem: 'recordPage',
recordPage.pageSize = obj.limit groups: 5,
//首次不执行 layout: ['count', 'page', 'skip'],
if (!first) { jump: function (obj, first) {
//do something recordPage.pageNum = obj.curr
getThirdTable() recordPage.pageSize = obj.limit
} //首次不执行
if (!first) {
//do something
getThirdTable()
} }
} }
}
var recordTable = table.render({ var recordTable = table.render({
elem: '#recordTable', elem: '#recordTable',
page: false, page: false,
skin: 'nob', skin: 'nob',
height: 'full-300', height: 'full-300',
cols: [ cols: [
[ [
{ {
field: 'index', field: 'index',
title: '序号', title: '序号',
align: 'center', align: 'center',
width: 60 width: 60
}, },
{ {
field: 'operator', field: 'operator',
title: '登录账户', title: '登录账户',
align: 'center' align: 'center'
}, },
{ {
field: 'productName', field: 'productName',
title: '登录产品', title: '登录产品',
align: 'center', align: 'center',
width: 180 width: 180
}, },
{ {
field: 'ip', field: 'ip',
title: '登录IP', title: '登录IP',
align: 'center', align: 'center',
width: 180 width: 180
}, },
{ {
field: 'modifyContent', field: 'modifyContent',
title: '修改内容', title: '修改内容',
align: 'center', align: 'center',
width: 180 width: 180
}, },
{ {
field: 'userName', field: 'userName',
title: '操作人', title: '操作人',
align: 'center', align: 'center',
width: 180 width: 180
}, },
{ {
field: 'createdTime', field: 'createdTime',
title: '操作时间', title: '操作时间',
align: 'center', align: 'center',
width: 180 width: 180
} }
]
] ]
}) ]
})
init()
function init() { init()
getFirstInfo()
findMenuFunTreeByMerId() function init() {
getSecondInfo() getFirstInfo()
getSecondTree() findMenuFunTreeByMerId()
getSecondTable() getSecondInfo()
getThirdTable() getSecondTree()
} getSecondTable()
function btnClick() { getThirdTable()
console.log('jjj') }
// 查询角色详情
function getFirstInfo() {
var params = {
id: merchantId,
method: 'cn.com.glsx.merchants.merchant.findMerchantDetail'
} }
// 查询角色详情 request(params, function (res) {
function getFirstInfo() { // businessScopeCustomize
var params = { if (res.code == '0') {
id: merchantId, roleData = helper.clone(true, res.data)
method: 'cn.com.glsx.merchants.merchant.findMerchantDetail' for (var i in basicArr) {
} if (basicArr[i] == 'businessScopName' && roleData.businessScopeCustomize) {
request(params, function (res) { roleData.businessScopName = roleData.businessScopName ? roleData.businessScopName + ',' + roleData.businessScopeCustomize : roleData.businessScopeCustomize
// businessScopeCustomize
if (res.code == '0') {
roleData = helper.clone(true, res.data)
for (var i in basicArr) {
if (basicArr[i] == 'businessScopName' && roleData.businessScopeCustomize) {
roleData.businessScopName = roleData.businessScopName ? roleData.businessScopName + ',' + roleData.businessScopeCustomize : roleData.businessScopeCustomize
}
$('#' + [basicArr[i]]).text(roleData[basicArr[i]] ? roleData[basicArr[i]] : '-')
} }
if (roleData.merchantType == 2) { $('#' + [basicArr[i]]).text(roleData[basicArr[i]] ? roleData[basicArr[i]] : '-')
$('#orgTxt').text('组织机构代码:')
}
// var effectiveTimeNameEl = $('#effectiveTimeName')
// if (roleData.merchantAccountLevel == 4) { // 门店
// if (roleData.status == 1 || roleData.status == 5) {
// effectiveTimeNameEl.text('-')
// } else {
// effectiveTimeNameEl.text(roleData.effectiveTimeName)
// }
// } else { // 工厂省代市代
// if (roleData.status == 1 || roleData.status == 4) {
// effectiveTimeNameEl.text('-')
// } else {
// effectiveTimeNameEl.text(roleData.effectiveTimeName)
// }
// }
// callback(roleData.accountTypes)
} }
}) if (roleData.merchantType == 2) {
} $('#orgTxt').text('组织机构代码:')
// 获取功能权限树
function findMenuFunTreeByMerId() {
const params = {
method: 'cn.com.glsx.merchants.merchant.findMenuFunTreeByMerId',
id: merchantId
}
request(params, function (res) {
if (res.code == '0' && res.data && res.data.length != 0) {
var authList = res.data
console.log(authList)
$.each(authList, function (index, item) {
treeTab.tabAdd(
{
title: item.accounttypeName,
value: item.accounttypeId
},
true
)
accountAuth.push(item.accounttypeName)
$('#accountAuth').append('<span class="account-type-span">' + item.accounttypeName + '</span>')
var menuData = []
if (item.products && item.products.length != 0) {
$.each(item.products, function (idx, m) {
treeTab.treeTabDetail(
{
name: m.productName,
value: m.productId
},
item.accounttypeId,
m.merchantProTreeResponses
)
})
var filterName = 'treeTab' + item.accounttypeId
var productId = 'tab_' + item.accounttypeId + '_' + item.products[0].productId
treeTab.tabChange(filterName, productId)
} else {
}
})
treeTab.tabChange('roleAuth', authList[0].accounttypeId)
} }
}) // var effectiveTimeNameEl = $('#effectiveTimeName')
} // if (roleData.merchantAccountLevel == 4) { // 门店
// if (roleData.status == 1 || roleData.status == 5) {
// effectiveTimeNameEl.text('-')
// } else {
// effectiveTimeNameEl.text(roleData.effectiveTimeName)
// }
// } else { // 工厂省代市代
// if (roleData.status == 1 || roleData.status == 4) {
// effectiveTimeNameEl.text('-')
// } else {
// effectiveTimeNameEl.text(roleData.effectiveTimeName)
// }
// }
// callback(roleData.accountTypes)
}
})
}
// 上下级商户 - 信息 // 获取功能权限树
function getSecondInfo() { function findMenuFunTreeByMerId() {
request( const params = {
{ method: 'cn.com.glsx.merchants.merchant.findMenuFunTreeByMerId',
method: 'cn.com.glsx.merchants.menu.findSubordinateRelationship', id: merchantId
id: merchantId
},
function (res) {
console.log(res.data)
var data = res.data
$('#secondmerchantName').text(data.merchantName ? data.merchantName : '-')
$('#secondmerchantName').attr('title', data.merchantName)
$('#secondmerchantId').text(data.merchantNo ? data.merchantNo : '-')
$('#numberOfSubMerchants').text(data.numberOfSubMerchants > 0 ? data.numberOfSubMerchants : 0)
$('#numberOfStores').text(data.numberOfStores > 0 ? data.numberOfStores : 0)
$('#companyName').html(data.merchantName)
$('#companyName').attr('title', data.merchantName)
}
)
} }
request(params, function (res) {
if (res.code == '0' && res.data && res.data.length != 0) {
var authList = res.data
$.each(authList, function (index, item) {
treeTab.tabAdd(
{
title: item.accounttypeName,
value: item.accounttypeId
},
true
)
accountAuth.push(item.accounttypeName)
$('#accountAuth').append('<span class="account-type-span">' + item.accounttypeName + '</span>')
var menuData = []
if (item.products && item.products.length != 0) {
$.each(item.products, function (idx, m) {
treeTab.treeTabDetail(
{
name: m.productName,
value: m.productId
},
item.accounttypeId,
m.merchantProTreeResponses
)
})
var filterName = 'treeTab' + item.accounttypeId
var productId = 'tab_' + item.accounttypeId + '_' + item.products[0].productId
treeTab.tabChange(filterName, productId)
} else {
}
})
treeTab.tabChange('roleAuth', authList[0].accounttypeId)
}
})
}
var all_nodes = null // 上下级商户 - 信息
var treeObj = null function getSecondInfo() {
// 上下级商户 - 树 request(
function getSecondTree() { {
var treeParams = { method: 'cn.com.glsx.merchants.menu.findSubordinateRelationship',
id: merchantId, id: merchantId
method: 'cn.com.glsx.merchants.merchant.findMerchantTree' },
function (res) {
var data = res.data
$('#secondmerchantName').text(data.merchantName ? data.merchantName : '-')
$('#secondmerchantName').attr('title', data.merchantName)
$('#secondmerchantId').text(data.merchantNo ? data.merchantNo : '-')
$('#numberOfSubMerchants').text(data.numberOfSubMerchants > 0 ? data.numberOfSubMerchants : 0)
$('#numberOfStores').text(data.numberOfStores > 0 ? data.numberOfStores : 0)
$('#companyName').html(data.merchantName)
$('#companyName').attr('title', data.merchantName)
} }
request(treeParams, function (res) { )
console.log(res) }
if (res.code == '0') {
treeObj = tree.create('merchantTree', res.data, null, {
check: {
enable: false
}
})
treeObj.expandAll(true)
all_nodes = treeObj.transformToArray(treeObj.getNodes())
var targetNode = treeObj.getNodeByParam('id', merchantId)
treeObj.selectNode(targetNode)
bindEvent()
}
})
}
function bindEvent() { var all_nodes = null
$('#merchantBtn').on('click', function () { var treeObj = null
var txt = $('#treeInput').val() // 上下级商户 - 树
if (!txt) { function getSecondTree() {
treeObj.showNodes(all_nodes) var treeParams = {
var targetNode = treeObj.getNodeByParam('id', merchantId) id: merchantId,
treeObj.selectNode(all_nodes[0]) method: 'cn.com.glsx.merchants.merchant.findMerchantTree'
} else {
var nodesList = treeObj.getNodesByParamFuzzy('label', txt)
show_nodes = helper.findShowNode(nodesList, all_nodes)
treeObj.hideNodes(all_nodes)
treeObj.showNodes(show_nodes)
treeObj.selectNode(nodesList[0])
}
})
return false
} }
request(treeParams, function (res) {
// 列表配置 if (res.code == '0') {
var subMerchantTable = table.render({ treeObj = tree.create('merchantTree', res.data, null, {
elem: '#subMerchantTable', check: {
page: true, enable: false
height: 'full-300',
cols: [
[
{
field: '',
title: '序号',
type: 'numbers',
width: 60
},
{
field: 'staffName',
title: '员工姓名',
width: 200,
align: 'center'
},
{
field: 'roleName',
title: '角色',
align: 'center',
width: 200
},
{
field: 'staffPhone',
title: '登录账户',
width: 180,
align: 'center'
},
{
field: 'entmicroName',
title: '企微号',
align: 'center'
},
{
field: 'createdTime',
title: '创建时间',
width: 260,
align: 'center'
} }
] })
] treeObj.expandAll(true)
}) all_nodes = treeObj.transformToArray(treeObj.getNodes())
var targetNode = treeObj.getNodeByParam('id', merchantId)
// table搜索 treeObj.selectNode(targetNode)
$('#tableSearch').on('click', function () { bindEvent()
var search = $('#tableSearchForm').val() }
console.log(search)
getSecondTable({
keyword: search
})
return false
}) })
}
$('#closeEl').on('click', function () { function bindEvent() {
go('merchant', 'index') $('#merchantBtn').on('click', function () {
var txt = $('#treeInput').val()
if (!txt) {
treeObj.showNodes(all_nodes)
var targetNode = treeObj.getNodeByParam('id', merchantId)
treeObj.selectNode(all_nodes[0])
} else {
var nodesList = treeObj.getNodesByParamFuzzy('label', txt)
show_nodes = helper.findShowNode(nodesList, all_nodes)
treeObj.hideNodes(all_nodes)
treeObj.showNodes(show_nodes)
treeObj.selectNode(nodesList[0])
}
}) })
return false
}
// 获取table列表接口 // 列表配置
function getSecondTable(search, isResetPageNum) { var subMerchantTable = table.render({
var search = search || {} elem: '#subMerchantTable',
var params = helper.clone( page: true,
false, height: 'full-300',
cols: [
[
{ {
method: 'cn.com.glsx.merchants.staff.findMerchantStaffList', field: '',
merchantId: merchantId title: '序号',
type: 'numbers',
width: 60
}, },
search {
) field: 'staffName',
request(params, function (res) { title: '员工姓名',
// console.log(res) width: 200,
var data = res.data align: 'center'
var options = { },
data: data {
field: 'roleName',
title: '角色',
align: 'center',
width: 200
},
{
field: 'staffPhone',
title: '登录账户',
width: 180,
align: 'center'
},
{
field: 'entmicroName',
title: '企微号',
align: 'center'
},
{
field: 'createdTime',
title: '创建时间',
width: 260,
align: 'center'
} }
subMerchantTable.reload(options) ]
// setTimeout(getTableNewHeight, 3000) ]
}) })
}
// table搜索
$('#tableSearch').on('click', function () {
var search = $('#tableSearchForm').val()
getSecondTable({
keyword: search
})
return false
})
$('#closeEl').on('click', function () {
go('merchant', 'index')
})
// 修改记录 // 获取table列表接口
function getThirdTable(isResetPageNum) { function getSecondTable(search, isResetPageNum) {
var params = { var search = search || {}
bussinessId: merchantId, var params = helper.clone(
moduleName: '商户模块', false,
pageNum: recordPage.pageNum, {
pageSize: recordPage.pageSize, method: 'cn.com.glsx.merchants.staff.findMerchantStaffList',
method: 'cn.com.glsx.merchants.menu.findLog' merchantId: merchantId
},
search
)
request(params, function (res) {
var data = res.data
var options = {
data: data
} }
request(params, function (res) { subMerchantTable.reload(options)
var data = res.data // setTimeout(getTableNewHeight, 3000)
$.each(data.data, function (index, item) { })
item.index = index + 1 + recordPage.pageSize * (recordPage.pageNum - 1) }
data.data[index].modifyContent = item.module + '-' + item.action
}) // 修改记录
var options = { function getThirdTable(isResetPageNum) {
data: data.data var params = {
} bussinessId: merchantId,
recordPageOptions.count = data.count moduleName: '商户模块',
if (isResetPageNum) { pageNum: recordPage.pageNum,
recordPageOptions.curr = 1 pageSize: recordPage.pageSize,
} method: 'cn.com.glsx.merchants.menu.findLog'
laypage.render(recordPageOptions)
recordTable.reload(options)
})
} }
}) request(params, function (res) {
</script> var data = res.data
</body> $.each(data.data, function (index, item) {
</html> item.index = index + 1 + recordPage.pageSize * (recordPage.pageNum - 1)
data.data[index].modifyContent = item.module + '-' + item.action
})
var options = {
data: data.data
}
recordPageOptions.count = data.count
if (isResetPageNum) {
recordPageOptions.curr = 1
}
laypage.render(recordPageOptions)
recordTable.reload(options)
})
}
})
</script>
</body>
</html>
\ No newline at end of file \ No newline at end of file
...@@ -525,7 +525,6 @@ ...@@ -525,7 +525,6 @@
var accountInfo = helper.store.get('accountInfo') var accountInfo = helper.store.get('accountInfo')
var merchantAccountLevel = qs('merchantAccountLevel') var merchantAccountLevel = qs('merchantAccountLevel')
var model = qs('model') var model = qs('model')
console.log(merchantAccountLevel == 4, !accountInfo, qs('status') == 1)
if (merchantAccountLevel == 4 && !accountInfo && qs('status') == 1) { if (merchantAccountLevel == 4 && !accountInfo && qs('status') == 1) {
// 上级是市代,子商户为门店,显示 有效期 // 上级是市代,子商户为门店,显示 有效期
$('#effectiveShowEl').removeClass('hide') $('#effectiveShowEl').removeClass('hide')
...@@ -617,7 +616,6 @@ ...@@ -617,7 +616,6 @@
format: 'yyyy-MM-dd', format: 'yyyy-MM-dd',
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()))
date.month = date.month - 1 date.month = date.month - 1
date.date = date.date + 1 date.date = date.date + 1
$('#expireDate').val('') $('#expireDate').val('')
...@@ -646,7 +644,6 @@ ...@@ -646,7 +644,6 @@
// tab 切换 // tab 切换
element.on('tab(editTab)', function (val) { element.on('tab(editTab)', function (val) {
console.log('-------', val)
}) })
// 校验 // 校验
...@@ -683,7 +680,6 @@ ...@@ -683,7 +680,6 @@
} }
}, },
hasModify: function (value) { hasModify: function (value) {
console.log(value, '=================----------===========')
}, },
otherReq: function (value, item) { otherReq: function (value, item) {
var verifyName = $(item).attr('name'), var verifyName = $(item).attr('name'),
...@@ -718,7 +714,6 @@ ...@@ -718,7 +714,6 @@
}) })
form.on('submit(handleFirstSubmit)', function (data) { form.on('submit(handleFirstSubmit)', function (data) {
console.log(data)
var formData = data.field var formData = data.field
basicSubmited = true basicSubmited = true
var params = { var params = {
...@@ -840,7 +835,6 @@ ...@@ -840,7 +835,6 @@
} else { } else {
params.status = 1 params.status = 1
} }
console.log(params)
request(params, function (res) { request(params, function (res) {
if (res.code == '0') { if (res.code == '0') {
// if (editLevel == 3) { // if (editLevel == 3) {
...@@ -1012,13 +1006,11 @@ ...@@ -1012,13 +1006,11 @@
layer.close(index) layer.close(index)
}, },
function () { function () {
console.log('11111')
element.tabChange('editTab', 1) element.tabChange('editTab', 1)
step = 1 step = 1
} }
) )
} else { } else {
console.log('fou')
element.tabChange('editTab', 1) element.tabChange('editTab', 1)
step = 1 step = 1
init() init()
...@@ -1031,7 +1023,6 @@ ...@@ -1031,7 +1023,6 @@
$('#sevenday').on('click', function () { $('#sevenday').on('click', function () {
var startTime = new Date(new Date().setHours(0, 0, 0, 0)) var startTime = new Date(new Date().setHours(0, 0, 0, 0))
var endTime = startTime * 1 + 86400 * 7 * 1000 var endTime = startTime * 1 + 86400 * 7 * 1000
console.log(helper.dateFormat(startTime), endTime)
$('#effectiveStarttime').val(helper.dateFormat(startTime)) $('#effectiveStarttime').val(helper.dateFormat(startTime))
$('#expireDate').val(helper.dateFormat(endTime)) $('#expireDate').val(helper.dateFormat(endTime))
}) })
...@@ -1039,7 +1030,6 @@ ...@@ -1039,7 +1030,6 @@
$('#oneyear').on('click', function () { $('#oneyear').on('click', function () {
var startTime = new Date(new Date().setHours(0, 0, 0, 0)) var startTime = new Date(new Date().setHours(0, 0, 0, 0))
var endTime = startTime.setFullYear(startTime.getFullYear() + 1) var endTime = startTime.setFullYear(startTime.getFullYear() + 1)
console.log(helper.dateFormat(endTime))
$('#effectiveStarttime').val(helper.dateFormat(new Date(new Date().setHours(0, 0, 0, 0)))) $('#effectiveStarttime').val(helper.dateFormat(new Date(new Date().setHours(0, 0, 0, 0))))
$('#expireDate').val(helper.dateFormat(endTime)) $('#expireDate').val(helper.dateFormat(endTime))
}) })
...@@ -1047,7 +1037,6 @@ ...@@ -1047,7 +1037,6 @@
$('#twoyears').on('click', function () { $('#twoyears').on('click', function () {
var startTime = new Date(new Date().setHours(0, 0, 0, 0)) var startTime = new Date(new Date().setHours(0, 0, 0, 0))
var endTime = startTime.setFullYear(startTime.getFullYear() + 2) var endTime = startTime.setFullYear(startTime.getFullYear() + 2)
console.log(helper.dateFormat(endTime))
$('#effectiveStarttime').val(helper.dateFormat(new Date(new Date().setHours(0, 0, 0, 0)))) $('#effectiveStarttime').val(helper.dateFormat(new Date(new Date().setHours(0, 0, 0, 0))))
$('#expireDate').val(helper.dateFormat(endTime)) $('#expireDate').val(helper.dateFormat(endTime))
}) })
...@@ -1150,11 +1139,6 @@ ...@@ -1150,11 +1139,6 @@
// baseIsShow(false) // baseIsShow(false)
// treeIsShow(true) // treeIsShow(true)
} }
console.log(model)
// if (qs('status') == 1 && !helper.store.get('accountInfo') && isFactory) {
// $('#merchantModel').removeClass('hide')
// $('#merchantModel').addClass('show')
// }
if (!accountInfo && isFactory) { if (!accountInfo && isFactory) {
if (qs('status') == 1) { if (qs('status') == 1) {
$('#merchantModel').removeClass('hide') $('#merchantModel').removeClass('hide')
...@@ -1284,7 +1268,6 @@ ...@@ -1284,7 +1268,6 @@
getMerchantApi(merchantId, function (res) { getMerchantApi(merchantId, function (res) {
form.val('merchantForm', res.data) form.val('merchantForm', res.data)
merchantForm = res.data merchantForm = res.data
console.log(merchantForm)
if (!isFactory) { if (!isFactory) {
merchantForm.channelId = parentInfo.channelId merchantForm.channelId = parentInfo.channelId
} }
...@@ -1635,16 +1618,13 @@ ...@@ -1635,16 +1618,13 @@
// 产品复选框change事件 // 产品复选框change事件
form.on('checkbox(filter)', function (data) { form.on('checkbox(filter)', function (data) {
console.log(data, '33333333333')
var roleId = +data.elem.dataset.id var roleId = +data.elem.dataset.id
var projectId = data.value var projectId = data.value
var isAdd = data.elem.checked var isAdd = data.elem.checked
var filterName = 'treeTab' + roleId var filterName = 'treeTab' + roleId
console.log(roleId, projectId, isAdd)
// merchantProTreeResponses // merchantProTreeResponses
var changeObj = menuFunTreeData.find(item => item.accounttypeId == roleId).products.find(i => i.productId == projectId) var changeObj = menuFunTreeData.find(item => item.accounttypeId == roleId).products.find(i => i.productId == projectId)
var products = menuFunTreeData.find(item => item.accounttypeId == roleId).products var products = menuFunTreeData.find(item => item.accounttypeId == roleId).products
console.log(changeObj, products, roleId, treeData)
if (isAdd) { if (isAdd) {
// 新增 // 新增
active.treeTabAdd( active.treeTabAdd(
...@@ -1674,7 +1654,6 @@ ...@@ -1674,7 +1654,6 @@
}) })
} else { } else {
// 删除 // 删除
console.log(treeData, Object.keys(treeData).length)
var productId = 'tab_' + roleId + '_' + changeObj.productId var productId = 'tab_' + roleId + '_' + changeObj.productId
active.tabDelete(filterName, productId) active.tabDelete(filterName, productId)
if (Object.keys(treeData).length != 0) { if (Object.keys(treeData).length != 0) {
...@@ -1714,24 +1693,20 @@ ...@@ -1714,24 +1693,20 @@
menuFunTreeData = res.data menuFunTreeData = res.data
var accountType = $('#accountType') var accountType = $('#accountType')
accountType.empty() accountType.empty()
console.log(menuFunTreeData)
menuFunTreeData.forEach((item, index) => { menuFunTreeData.forEach((item, index) => {
var str = $('<input lay-filter="switch" type="checkbox" name="accounttypeId" value="' + item.accounttypeId + '" title="' + item.accounttypeName + '" />') var str = $('<input lay-filter="switch" type="checkbox" name="accounttypeId" value="' + item.accounttypeId + '" title="' + item.accounttypeName + '" />')
accountType.append(str) accountType.append(str)
if (merchantId) { if (merchantId) {
console.log(check_arr)
check_arr.forEach(i => { check_arr.forEach(i => {
if (i.accounttypeId == item.accounttypeId) { if (i.accounttypeId == item.accounttypeId) {
var productData = i var productData = i
var id = item.accounttypeId var id = item.accounttypeId
console.log('productData', productData)
str.attr('checked', true) str.attr('checked', true)
var obj = { title: item.accounttypeName, value: item.accounttypeId } var obj = { title: item.accounttypeName, value: item.accounttypeId }
active.tabAdd(obj, productData.products) active.tabAdd(obj, productData.products)
if (productData.products && productData.products.length != 0) { if (productData.products && productData.products.length != 0) {
productData.products.forEach(j => { productData.products.forEach(j => {
var products = item.products.find(n => n.productId == j.productId) var products = item.products.find(n => n.productId == j.productId)
console.log(products)
if (products) { if (products) {
active.treeTabAdd( active.treeTabAdd(
{ {
...@@ -1753,7 +1728,6 @@ ...@@ -1753,7 +1728,6 @@
}) })
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
console.log(filterName, productId)
active.tabChange(filterName, productId) active.tabChange(filterName, productId)
} }
} }
...@@ -1792,11 +1766,9 @@ ...@@ -1792,11 +1766,9 @@
// 获取角色权限数据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 = []
console.log(accountObj) // 判断是否为空
if (Object.keys(accountObj).length != 0) { if (Object.keys(accountObj).length != 0) {
for (var i in accountObj) { for (var i in accountObj) {
var productObj = accountObj[i] var productObj = accountObj[i]
...@@ -1896,7 +1868,7 @@ ...@@ -1896,7 +1868,7 @@
}) })
function submitAuth() { function submitAuth() {
if (!accountInfo && merchantAccountLevel == 4 && !merchantForm.effectiveStarttime ) { if (!accountInfo && merchantAccountLevel == 4 && !merchantForm.effectiveStarttime) {
layer.msg('请去“修改基本信息”填写账户有效期', { layer.msg('请去“修改基本信息”填写账户有效期', {
icon: 2 icon: 2
}) })
...@@ -1915,7 +1887,6 @@ ...@@ -1915,7 +1887,6 @@
} else { } else {
params.status = merchantForm.status params.status = merchantForm.status
} }
console.log(params)
request(params, function (res) { request(params, function (res) {
if (res.code == '0') { if (res.code == '0') {
layer.msg('操作成功', { layer.msg('操作成功', {
......
...@@ -169,16 +169,16 @@ ...@@ -169,16 +169,16 @@
</div> </div>
</div> </div>
<!-- <div id="model"> --> <!-- <div id="model"> -->
<div id="model" class="layui-inline accountType"> <div id="model" class="layui-inline">
<label class="input-before-name">账户类型:</label> <label class="layui-form-label">账户类型:</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<select name="accounttypeId" id="accountTypeIdEl"> <select name="accounttypeId" id="accountTypeIdEl">
<option value="">全部</option> <option value="">全部</option>
</select> </select>
</div> </div>
</div> </div>
<div class="layui-inline mode"> <div class="layui-inline">
<label class="input-before-name">模式:</label> <label class="layui-form-label">模式:</label>
<div class="layui-input-inline" style="width: 246px"> <div class="layui-input-inline" style="width: 246px">
<select name="merchantModel" id="searchModelEl"> <select name="merchantModel" id="searchModelEl">
<option value="">全部</option> <option value="">全部</option>
...@@ -191,7 +191,7 @@ ...@@ -191,7 +191,7 @@
<input <input
class="layui-input" class="layui-input"
type="text" type="text"
style="width: 365px; margin-left: 45px;" style="width: 367px; margin-left: 40px;"
name="merchantName" name="merchantName"
placeholder="请输入商户名称/关联的企业微信名" placeholder="请输入商户名称/关联的企业微信名"
onkeydown="if (event.keyCode == 13) {event.keyCode = 0;event.returnValue = false;}" onkeydown="if (event.keyCode == 13) {event.keyCode = 0;event.returnValue = false;}"
...@@ -255,7 +255,6 @@ ...@@ -255,7 +255,6 @@
var $ = layui.$ var $ = layui.$
var helper = layui.helper var helper = layui.helper
var accountInfo = helper.store.get('accountInfo') var accountInfo = helper.store.get('accountInfo')
console.log('accountInfo', accountInfo)
window.isDxternal = accountInfo ? 1 : 2 // 1 SCRM, default 运营平台 window.isDxternal = accountInfo ? 1 : 2 // 1 SCRM, default 运营平台
var baseData = { var baseData = {
statusList: [], statusList: [],
...@@ -501,7 +500,6 @@ ...@@ -501,7 +500,6 @@
table.on('tool(merchant-table-filter)', function(obj) { table.on('tool(merchant-table-filter)', function(obj) {
var eventName = obj.event var eventName = obj.event
var row = obj.data var row = obj.data
console.log(row.merchantAccountLevel)
switch (eventName) { switch (eventName) {
// 查看 // 查看
case 'handleDetail': case 'handleDetail':
...@@ -559,7 +557,6 @@ ...@@ -559,7 +557,6 @@
break break
// 修改账户有效期 // 修改账户有效期
case 'handleVaildPeriod': case 'handleVaildPeriod':
// console.log(row)
var area = ['560px', '230px'] var area = ['560px', '230px']
if (row.merchantAccountLevel == 4) { if (row.merchantAccountLevel == 4) {
area = ['750px', '450px'] area = ['750px', '450px']
...@@ -638,7 +635,6 @@ ...@@ -638,7 +635,6 @@
method: 'cn.com.glsx.merchants.menu.findMerchantByPage' method: 'cn.com.glsx.merchants.menu.findMerchantByPage'
} }
var searchData = $('#searchForm [name]').serializeArray() var searchData = $('#searchForm [name]').serializeArray()
// console.log(searchData)
$.each(searchData, function() { $.each(searchData, function() {
if (this.name == 'merchantLoginAccount') { if (this.name == 'merchantLoginAccount') {
var attrName = params.accountOrPhone == '0' ? 'merchantLoginAccount' : 'merchantLegalPersonPhone' var attrName = params.accountOrPhone == '0' ? 'merchantLoginAccount' : 'merchantLegalPersonPhone'
...@@ -647,7 +643,6 @@ ...@@ -647,7 +643,6 @@
params[this.name] = this.value params[this.name] = this.value
} }
}) })
// console.log(params)
request(params, function(res) { request(params, function(res) {
var data = helper.formateNullFieldData(res.data) var data = helper.formateNullFieldData(res.data)
$.each(data.data, function(index, item) { $.each(data.data, function(index, item) {
...@@ -679,7 +674,6 @@ ...@@ -679,7 +674,6 @@
} }
} else { } else {
// 下级商户 // 下级商户
// console.log(item)
item.btn.edit = true item.btn.edit = true
item.btn.editPeriod = true item.btn.editPeriod = true
// 直属门店 // 直属门店
......
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh"> <html lang="zh">
<head>
<meta charset="utf-8" /> <head>
<meta content="IE=edge" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta content="IE=edge" />
<meta name="description" content="修改有效期" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="author" content="GLSX Web Team" /> <meta name="description" content="修改有效期" />
<meta name="keywords" itemprop="keywords" content="广联,商户管理" /> <meta name="author" content="GLSX Web Team" />
<link rel="stylesheet" type="text/css" href="/css/main.css" /> <meta name="keywords" itemprop="keywords" content="广联,商户管理" />
<style> <link rel="stylesheet" type="text/css" href="/css/main.css" />
#app { <style>
padding: 0; #app {
} padding: 0;
.valid-period { }
/* width: 560px;
.valid-period {
/* width: 560px;
height: 230px; */ height: 230px; */
text-align: center; text-align: center;
/* padding: 20px 20px; */ /* padding: 20px 20px; */
background-color: #ffffff; background-color: #ffffff;
} }
.layui-form-label {
width: 120px; .layui-form-label {
} width: 120px;
.hide { }
display: none;
} .hide {
</style> display: none;
<title>修改有效期</title> }
</head> </style>
<title>修改有效期</title>
<body> </head>
<div id="app">
<main class="valid-period"> <body>
<form class="layui-form" lay-filter="periodFilter"> <div id="app">
<div id="merchantEl"> <main class="valid-period">
<div class="layui-form-item"> <form class="layui-form" lay-filter="periodFilter">
<label class="layui-form-label">账户有效期:</label> <div id="merchantEl">
<div class="layui-input-inline"> <div class="layui-form-item">
<input type="radio" name="effectiveTime" lay-filter="radio" value="2" title="启用" /> <label class="layui-form-label">账户有效期:</label>
<input type="radio" name="effectiveTime" lay-filter="radio" value="4" title="禁用" /> <div class="layui-input-inline">
</div> <input type="radio" name="effectiveTime" lay-filter="radio" value="2" title="启用" />
<button id="periodVerifyBtn" lay-submit lay-filter="periodSubmit" style="display: none"></button> <input type="radio" name="effectiveTime" lay-filter="radio" value="4" title="禁用" />
</div>
<div class="layui-form-item">
<p class="input-downtips" id="tips"></p>
</div> </div>
<button id="periodVerifyBtn" lay-submit lay-filter="periodSubmit" style="display: none"></button>
</div> </div>
<div id="storeEl" class="layui-form-item hide"> <div class="layui-form-item">
<label class="layui-form-label">账户有效期:</label> <p class="input-downtips" id="tips"></p>
<div class="layui-inline"> </div>
<div class="layui-input-inline"> </div>
<input type="text" id="effectiveStarttime" disabled class="layui-input" name="effectiveStarttime" placeholder="开始时间" /> <div id="storeEl" class="layui-form-item hide">
</div> <label class="layui-form-label">账户有效期:</label>
<div class="layui-form-mid">-</div> <div class="layui-inline">
<div class="layui-input-inline"> <div class="layui-input-inline">
<input type="text" id="expireDate" class="layui-input" name="expireDate" placeholder="结束时间" /> <input type="text" id="effectiveStarttime" disabled class="layui-input" name="effectiveStarttime"
</div> placeholder="开始时间" />
</div> </div>
<div> <div class="layui-form-mid">-</div>
<button id="sevenday" type="button" class="layui-btn btn-no-border">续7天</button> <div class="layui-input-inline">
<button id="oneyear" type="button" class="layui-btn btn-no-border">续1年</button> <input type="text" id="expireDate" class="layui-input" name="expireDate" placeholder="结束时间" />
<button id="twoyears" type="button" class="layui-btn btn-no-border">续2年</button>
</div> </div>
</div> </div>
</form> <div>
</main> <button id="sevenday" type="button" class="layui-btn btn-no-border">续7天</button>
</div> <button id="oneyear" type="button" class="layui-btn btn-no-border">续1年</button>
<script src="https://www.layuicdn.com/layui/layui.js"></script> <button id="twoyears" type="button" class="layui-btn btn-no-border">续2年</button>
<script src="/js/load.js"></script> </div>
<script> </div>
layui.use(['form', 'helper', 'request', 'laydate'], function () { </form>
var form = layui.form </main>
var request = layui.request </div>
var laydate = layui.laydate <script src="https://www.layuicdn.com/layui/layui.js"></script>
var $ = layui.$ <script src="/js/load.js"></script>
var helper = layui.helper <script>
var currLayerIdx = parent.layer.getFrameIndex(window.name) layui.use(['form', 'helper', 'request', 'laydate'], function () {
var baseData = {} var form = layui.form
var merchantAccountLevel = getQueryString('merchantAccountLevel') var request = layui.request
var vaildData = { var laydate = layui.laydate
id: getQueryString('id') var $ = layui.$
} var helper = layui.helper
var storeEl = $('#storeEl') var currLayerIdx = parent.layer.getFrameIndex(window.name)
var merchantEl = $('#merchantEl') var baseData = {}
var expireDateEl = $('#expireDate') var merchantAccountLevel = getQueryString('merchantAccountLevel')
var effectiveStarttimeEl = $('#effectiveStarttime') var vaildData = {
var overdue = false id: getQueryString('id')
if (merchantAccountLevel == 4) { }
storeEl.show() var storeEl = $('#storeEl')
merchantEl.hide() var merchantEl = $('#merchantEl')
if (getQueryString('expireDate') != '-' && getQueryString('effectiveStarttime') != '-') { var expireDateEl = $('#expireDate')
vaildData.expireDate = getQueryString('expireDate') var effectiveStarttimeEl = $('#effectiveStarttime')
vaildData.effectiveStarttime = getQueryString('effectiveStarttime') var overdue = false
console.log(111111111111, getQueryString('expireDate')) if (merchantAccountLevel == 4) {
overdue = getStartTime(vaildData.expireDate).overdue storeEl.show()
if (overdue) { merchantEl.hide()
$('#effectiveStarttime').removeAttr('disabled') if (getQueryString('expireDate') != '-' && getQueryString('effectiveStarttime') != '-') {
} vaildData.expireDate = getQueryString('expireDate')
form.val('periodFilter', { vaildData.effectiveStarttime = getQueryString('effectiveStarttime')
expireDate: getQueryString('expireDate'), overdue = getStartTime(vaildData.expireDate).overdue
effectiveStarttime: getQueryString('effectiveStarttime') if (overdue) {
})
} else {
$('#effectiveStarttime').removeAttr('disabled') $('#effectiveStarttime').removeAttr('disabled')
} }
} else {
setText(2)
console.log(getQueryString('status'))
vaildData.effectiveTime = getQueryString('status')
form.val('periodFilter', { form.val('periodFilter', {
effectiveTime: getQueryString('status') expireDate: getQueryString('expireDate'),
effectiveStarttime: getQueryString('effectiveStarttime')
}) })
} else {
$('#effectiveStarttime').removeAttr('disabled')
} }
} else {
var effectiveStarttime = laydate.render({ setText(2)
elem: '#effectiveStarttime', vaildData.effectiveTime = getQueryString('status')
format: 'yyyy-MM-dd', form.val('periodFilter', {
min: helper.dateFormat(new Date()), effectiveTime: getQueryString('status')
done: function (value, date) {
// effectiveStarttime.config.min = helper.dateFormat(new Date())
console.log(value, date)
date.month = date.month - 1
date.date = date.date + 1
expireDate.config.min = date
$('#expireDate').val('')
lay('#effectiveStarttime').html(value)
}
})
var expireDate = laydate.render({
elem: '#expireDate',
format: 'yyyy-MM-dd',
btns: ['clear', 'confirm'],
min: `${new Date().getFullYear()}-${new Date().getMonth()+1}-${new Date().getDate() + 1}`
})
$('#sevenday').on('click', function () {
const startDate = getStartTime(vaildData.expireDate).startDate
const overdue = getStartTime(vaildData.expireDate).overdue
var startTime = new Date(startDate.setHours(0, 0, 0, 0))
var endTime = startTime * 1 + 86400 * 7 * 1000
console.log(helper.dateFormat(startTime), endTime)
if (overdue) effectiveStarttimeEl.val(helper.dateFormat(startTime))
expireDateEl.val(helper.dateFormat(endTime))
}) })
}
$('#oneyear').on('click', function () { var effectiveStarttime = laydate.render({
const startDate = getStartTime(vaildData.expireDate).startDate elem: '#effectiveStarttime',
const overdue = getStartTime(vaildData.expireDate).overdue format: 'yyyy-MM-dd',
var startTime = new Date(startDate.setHours(0, 0, 0, 0)) min: helper.dateFormat(new Date()),
var endTime = startTime.setFullYear(startTime.getFullYear() + 1) done: function (value, date) {
console.log(helper.dateFormat(endTime)) // effectiveStarttime.config.min = helper.dateFormat(new Date())
if (overdue) effectiveStarttimeEl.val(helper.dateFormat(new Date(new Date().setHours(0, 0, 0, 0)))) date.month = date.month - 1
expireDateEl.val(helper.dateFormat(endTime)) date.date = date.date + 1
}) expireDate.config.min = date
$('#expireDate').val('')
lay('#effectiveStarttime').html(value)
}
})
var expireDate = laydate.render({
elem: '#expireDate',
format: 'yyyy-MM-dd',
btns: ['clear', 'confirm'],
min: `${new Date().getFullYear()}-${new Date().getMonth() + 1}-${new Date().getDate() + 1}`
})
$('#twoyears').on('click', function () {
const startDate = getStartTime(vaildData.expireDate).startDate
const overdue = getStartTime(vaildData.expireDate).overdue
var startTime = new Date(startDate.setHours(0, 0, 0, 0))
var endTime = startTime.setFullYear(startTime.getFullYear() + 2)
console.log(helper.dateFormat(endTime))
if (overdue) effectiveStarttimeEl.val(helper.dateFormat(new Date(new Date().setHours(0, 0, 0, 0))))
expireDateEl.val(helper.dateFormat(endTime))
})
// 1-草稿;2-正常;3-注销;4-过期 $('#sevenday').on('click', function () {
form.on('submit(periodSubmit)', function (data) { const startDate = getStartTime(vaildData.expireDate).startDate
if (merchantAccountLevel == 4) { const overdue = getStartTime(vaildData.expireDate).overdue
if (data.field.effectiveStarttime && data.field.expireDate) { var startTime = new Date(startDate.setHours(0, 0, 0, 0))
var params = { var endTime = startTime * 1 + 86400 * 7 * 1000
method: 'cn.com.glsx.merchants.merchant.updateValPerByMerId', if (overdue) effectiveStarttimeEl.val(helper.dateFormat(startTime))
id: vaildData.id, expireDateEl.val(helper.dateFormat(endTime))
effectiveStarttime: new Date(data.field.effectiveStarttime), })
expireDate: new Date(data.field.expireDate)
} $('#oneyear').on('click', function () {
request(params, function (res) { const startDate = getStartTime(vaildData.expireDate).startDate
if (res.code == '0') { const overdue = getStartTime(vaildData.expireDate).overdue
helper.store.set('isRefresh', true) var startTime = new Date(startDate.setHours(0, 0, 0, 0))
parent.layer.close(currLayerIdx) var endTime = startTime.setFullYear(startTime.getFullYear() + 1)
} if (overdue) effectiveStarttimeEl.val(helper.dateFormat(new Date(new Date().setHours(0, 0, 0, 0))))
}) expireDateEl.val(helper.dateFormat(endTime))
} else { })
layer.msg('请选择账户有效期', {
icon: 5, $('#twoyears').on('click', function () {
anim: 6 const startDate = getStartTime(vaildData.expireDate).startDate
}) const overdue = getStartTime(vaildData.expireDate).overdue
var startTime = new Date(startDate.setHours(0, 0, 0, 0))
var endTime = startTime.setFullYear(startTime.getFullYear() + 2)
if (overdue) effectiveStarttimeEl.val(helper.dateFormat(new Date(new Date().setHours(0, 0, 0, 0))))
expireDateEl.val(helper.dateFormat(endTime))
})
// 1-草稿;2-正常;3-注销;4-过期
form.on('submit(periodSubmit)', function (data) {
if (merchantAccountLevel == 4) {
if (data.field.effectiveStarttime && data.field.expireDate) {
var params = {
method: 'cn.com.glsx.merchants.merchant.updateValPerByMerId',
id: vaildData.id,
effectiveStarttime: new Date(data.field.effectiveStarttime),
expireDate: new Date(data.field.expireDate)
} }
} else { request(params, function (res) {
if (data.field.effectiveTime) { if (res.code == '0') {
var params = { helper.store.set('isRefresh', true)
method: 'cn.com.glsx.merchants.merchant.updateValPerByMerId', parent.layer.close(currLayerIdx)
id: vaildData.id,
effectiveTime: data.field.effectiveTime
} }
request(params, function (res) { })
if (res.code == '0') { } else {
helper.store.set('isRefresh', true) layer.msg('请选择账户有效期', {
parent.layer.close(currLayerIdx) icon: 5,
} anim: 6
}) })
} else { }
layer.msg('请选择账户有效期', { } else {
icon: 5, if (data.field.effectiveTime) {
anim: 6 var params = {
}) method: 'cn.com.glsx.merchants.merchant.updateValPerByMerId',
id: vaildData.id,
effectiveTime: data.field.effectiveTime
} }
request(params, function (res) {
if (res.code == '0') {
helper.store.set('isRefresh', true)
parent.layer.close(currLayerIdx)
}
})
} else {
layer.msg('请选择账户有效期', {
icon: 5,
anim: 6
})
} }
}
return false return false
}) })
// 触发单选框 // 触发单选框
form.on('radio(radio)', function (data) { form.on('radio(radio)', function (data) {
setText(data.value) setText(data.value)
}) })
function setText(value) { function setText(value) {
if (value == 2) { if (value == 2) {
$('#tips').text('启用商户,其下级商户也会启用,但门店账户由门店本身的有效期控制。') $('#tips').text('启用商户,其下级商户也会启用,但门店账户由门店本身的有效期控制。')
} else if (value == 4) { } else if (value == 4) {
$('#tips').text('禁用商户,其下级商户及门店全部禁止登录。') $('#tips').text('禁用商户,其下级商户及门店全部禁止登录。')
}
} }
}
function getStartTime(time) { function getStartTime(time) {
var expireDate = new Date(time) var expireDate = new Date(time)
var currentDate = new Date() var currentDate = new Date()
if (expireDate.getTime() > currentDate.getTime()) { if (expireDate.getTime() > currentDate.getTime()) {
return { return {
startDate: expireDate, startDate: expireDate,
overdue: false overdue: false
} }
} else { } else {
return { return {
startDate: currentDate, startDate: currentDate,
overdue: true overdue: true
}
} }
} }
}
// 获取参数 // 获取参数
function getQueryString(name) { function getQueryString(name) {
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i') var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i')
var r = window.location.search.substr(1).match(reg) var r = window.location.search.substr(1).match(reg)
if (r != null) { if (r != null) {
return unescape(r[2]) return unescape(r[2])
}
return null
} }
}) return null
</script> }
</body> })
</html> </script>
</body>
</html>
\ No newline at end of file \ No newline at end of file
...@@ -234,7 +234,6 @@ ...@@ -234,7 +234,6 @@
clickClose: true, clickClose: true,
data: [], data: [],
on: function (data) { on: function (data) {
console.log(data)
merchantId = data.change[0].id merchantId = data.change[0].id
findMenuFunTreeByMerId(merchantId) findMenuFunTreeByMerId(merchantId)
} }
...@@ -321,11 +320,7 @@ ...@@ -321,11 +320,7 @@
laytpl(getTpl).render(templateData, function (html) { laytpl(getTpl).render(templateData, function (html) {
view.innerHTML = html view.innerHTML = html
}) })
// var productList = []
// var products = []
console.log(productList)
var products = menuFunTreeData.find(item => item.accounttypeId == id).products var products = menuFunTreeData.find(item => item.accounttypeId == id).products
console.log(products)
products.forEach(i => { products.forEach(i => {
var str = $('<input lay-filter="filter" data-id="' + id + '" type="checkbox" name="check[' + id + ']" value="' + i.productId + '" title="' + i.productName + '" lay-skin="primary" />') var str = $('<input lay-filter="filter" data-id="' + id + '" type="checkbox" name="check[' + id + ']" value="' + i.productId + '" title="' + i.productName + '" lay-skin="primary" />')
$('#project' + id).append(str) $('#project' + id).append(str)
...@@ -380,7 +375,6 @@ ...@@ -380,7 +375,6 @@
}, },
// 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('请选择产品')
...@@ -390,7 +384,6 @@ ...@@ -390,7 +384,6 @@
$(`#nodata${accounttypeId}`).removeClass('show') $(`#nodata${accounttypeId}`).removeClass('show')
$(`#nodata${accounttypeId}`).addClass('hide') $(`#nodata${accounttypeId}`).addClass('hide')
$(`#nomenu${accounttypeId}`).html('暂无可选择的菜单功能') $(`#nomenu${accounttypeId}`).html('暂无可选择的菜单功能')
console.log(menuFunTreeData)
menuFunTreeData.forEach(item => { menuFunTreeData.forEach(item => {
if (item.accounttypeId == accounttypeId) { if (item.accounttypeId == accounttypeId) {
item.products.forEach(i => { item.products.forEach(i => {
...@@ -419,7 +412,6 @@ ...@@ -419,7 +412,6 @@
* defaultList:编辑时传入,默认勾选中的数组。(举例:[1,2,3]) * defaultList:编辑时传入,默认勾选中的数组。(举例:[1,2,3])
*/ */
treeTabAdd: function (item, id, treeListData, defaultList) { treeTabAdd: function (item, id, treeListData, defaultList) {
console.log(item, id, treeListData, defaultList)
var productId = 'tab_' + id + '_' + item.value var productId = 'tab_' + id + '_' + item.value
var filterName = 'treeTab' + id // 过滤器的名称 lay-filter var filterName = 'treeTab' + id // 过滤器的名称 lay-filter
element.tabAdd(filterName, { element.tabAdd(filterName, {
...@@ -434,7 +426,6 @@ ...@@ -434,7 +426,6 @@
treeData[id][item.value].id = productId // 渲染模版的数据 treeData[id][item.value].id = productId // 渲染模版的数据
treeData[id][item.value].productId = item.value treeData[id][item.value].productId = item.value
laytpl(getTreeTpl).render(treeData[id][item.value], function (html) { laytpl(getTreeTpl).render(treeData[id][item.value], function (html) {
console.log(treeView)
treeView.innerHTML = html treeView.innerHTML = html
}) })
// var treeListData = [] // var treeListData = []
...@@ -466,16 +457,13 @@ ...@@ -466,16 +457,13 @@
} }
// 产品复选框change事件 // 产品复选框change事件
form.on('checkbox(filter)', function (data) { form.on('checkbox(filter)', function (data) {
console.log(data, '33333333333')
var roleId = +data.elem.dataset.id var roleId = +data.elem.dataset.id
var projectId = data.value var projectId = data.value
var isAdd = data.elem.checked var isAdd = data.elem.checked
var filterName = 'treeTab' + roleId var filterName = 'treeTab' + roleId
console.log(roleId, projectId, isAdd)
// merchantProTreeResponses // merchantProTreeResponses
var changeObj = menuFunTreeData.find(item => item.accounttypeId == roleId).products.find(i => i.productId == projectId) var changeObj = menuFunTreeData.find(item => item.accounttypeId == roleId).products.find(i => i.productId == projectId)
var products = menuFunTreeData.find(item => item.accounttypeId == roleId).products var products = menuFunTreeData.find(item => item.accounttypeId == roleId).products
console.log(changeObj, products, roleId, treeData)
if (isAdd) { if (isAdd) {
// 新增 // 新增
active.treeTabAdd( active.treeTabAdd(
...@@ -488,7 +476,6 @@ ...@@ -488,7 +476,6 @@
) )
} else { } else {
// 删除 // 删除
console.log(treeData, Object.keys(treeData).length)
var productId = 'tab_' + roleId + '_' + changeObj.productId var productId = 'tab_' + roleId + '_' + changeObj.productId
active.tabDelete(filterName, productId) active.tabDelete(filterName, productId)
if (Object.keys(treeData).length != 0) { if (Object.keys(treeData).length != 0) {
...@@ -507,17 +494,14 @@ ...@@ -507,17 +494,14 @@
// 复选框的change事件 // 复选框的change事件
form.on('checkbox(switch)', function (data) { form.on('checkbox(switch)', function (data) {
console.log(data, '111111111', treeData)
if (data.elem.checked) { if (data.elem.checked) {
var obj = { title: data.elem.title, value: data.elem.value } var obj = { title: data.elem.title, value: data.elem.value }
check_arr.push({ check_arr.push({
accounttypeId: data.elem.value accounttypeId: data.elem.value
}) })
active.tabAdd(obj) active.tabAdd(obj)
console.log(check_arr)
treeData[+data.elem.value] = {} treeData[+data.elem.value] = {}
} else { } else {
console.log(11222)
for (var i in check_arr) { for (var i in check_arr) {
var id = check_arr[i].accounttypeId var id = check_arr[i].accounttypeId
if (check_arr[i].accounttypeId == data.elem.value) { if (check_arr[i].accounttypeId == data.elem.value) {
...@@ -527,7 +511,6 @@ ...@@ -527,7 +511,6 @@
} }
delete treeData[data.elem.value] delete treeData[data.elem.value]
} }
console.log(treeData)
if (check_arr.length != 0) { if (check_arr.length != 0) {
active.tabChange('roleAuth', check_arr[0].accounttypeId) active.tabChange('roleAuth', check_arr[0].accounttypeId)
} }
...@@ -536,7 +519,6 @@ ...@@ -536,7 +519,6 @@
// 表单提交 // 表单提交
form.on('submit(roleSubmit)', function (data) { form.on('submit(roleSubmit)', function (data) {
console.log(data.value, check_arr, treeData)
if (check_arr.length == 0) { if (check_arr.length == 0) {
layer.msg('请选择角色权限', { layer.msg('请选择角色权限', {
icon: 2 icon: 2
...@@ -550,7 +532,6 @@ ...@@ -550,7 +532,6 @@
// select 选择触发 // select 选择触发
form.on('select(merchants)', function (data) { form.on('select(merchants)', function (data) {
console.log(data.value, check_arr, treeData)
check_arr.forEach(item => { check_arr.forEach(item => {
active.tabDelete('roleAuth', item.accounttypeId) active.tabDelete('roleAuth', item.accounttypeId)
}) })
...@@ -563,7 +544,6 @@ ...@@ -563,7 +544,6 @@
// 存草稿 // 存草稿
$('#draft').on('click', function () { $('#draft').on('click', function () {
var formVal = form.val('roleForm') var formVal = form.val('roleForm')
console.log(formVal)
if (!formVal.merchantId) { if (!formVal.merchantId) {
layer.msg('请选择所属商户', { layer.msg('请选择所属商户', {
icon: 2 icon: 2
...@@ -592,7 +572,6 @@ ...@@ -592,7 +572,6 @@
merchantId: merchantId, merchantId: merchantId,
delFlag: delFlag delFlag: delFlag
} }
console.log(requestList)
let hasProduct = requestList.some(item => item.productList.length != 0) let hasProduct = requestList.some(item => item.productList.length != 0)
// 找这个数组里面是否有空值,然后判断是否为草稿, // 找这个数组里面是否有空值,然后判断是否为草稿,
if (delFlag == 1) { // 草稿 if (delFlag == 1) { // 草稿
...@@ -633,7 +612,6 @@ ...@@ -633,7 +612,6 @@
} }
var params = helper.clone(true, formVal, otherParams) var params = helper.clone(true, formVal, otherParams)
delete params.select delete params.select
console.log(params)
request(params, function (res) { request(params, function (res) {
if (res.code == '0') { if (res.code == '0') {
layer.msg('操作成功', { layer.msg('操作成功', {
...@@ -654,28 +632,22 @@ ...@@ -654,28 +632,22 @@
if (res.code == '0') { if (res.code == '0') {
// callback(res.data) // callback(res.data)
menuFunTreeData = res.data menuFunTreeData = res.data
console.log(res.data)
var accountType = $('#accountType') var accountType = $('#accountType')
accountType.empty() accountType.empty()
menuFunTreeData.forEach((item, index) => { menuFunTreeData.forEach((item, index) => {
var str = $('<input lay-filter="switch" type="checkbox" name="accounttypeId" value="' + item.accounttypeId + '" title="' + item.accounttypeName + '" />') var str = $('<input lay-filter="switch" type="checkbox" name="accounttypeId" value="' + item.accounttypeId + '" title="' + item.accounttypeName + '" />')
accountType.append(str) accountType.append(str)
if (roleid) { if (roleid) {
console.log(check_arr)
check_arr.forEach(i => { check_arr.forEach(i => {
if (i.accounttypeId == item.accounttypeId) { if (i.accounttypeId == item.accounttypeId) {
var productData = i var productData = i
var id = item.accounttypeId var id = item.accounttypeId
console.log('productData', productData)
str.attr('checked', true) str.attr('checked', true)
var obj = { title: item.accounttypeName, value: item.accounttypeId } var obj = { title: item.accounttypeName, value: item.accounttypeId }
active.tabAdd(obj, productData.productList) active.tabAdd(obj, productData.productList)
console.log(productData.productList)
if (productData.productList && productData.productList.length != 0) { if (productData.productList && productData.productList.length != 0) {
productData.productList.forEach(j => { productData.productList.forEach(j => {
console.log(j, item)
var products = item.products.find(n => n.productId == j.productId) var products = item.products.find(n => n.productId == j.productId)
console.log(products)
active.treeTabAdd( active.treeTabAdd(
{ {
name: j.productName, name: j.productName,
...@@ -695,7 +667,6 @@ ...@@ -695,7 +667,6 @@
}) })
var filterName = 'treeTab' + item.accounttypeId var filterName = 'treeTab' + item.accounttypeId
var productId = 'tab_' + item.accounttypeId + '_' + productData.productList[0].productId var productId = 'tab_' + item.accounttypeId + '_' + productData.productList[0].productId
console.log(filterName, productId)
active.tabChange(filterName, productId) active.tabChange(filterName, productId)
} else { } else {
treeData[productData.accounttypeId] = {} treeData[productData.accounttypeId] = {}
...@@ -777,12 +748,10 @@ ...@@ -777,12 +748,10 @@
// 获取角色权限数据requestList // 获取角色权限数据requestList
function getAuthList() { function getAuthList() {
requestList = [] requestList = []
console.log(treeData, check_arr)
// check_arr.forEach(i => { // check_arr.forEach(i => {
for (var key in treeData) { for (var key in treeData) {
var accountObj = treeData[key] var accountObj = treeData[key]
var productList = [] var productList = []
console.log(treeData)
// if (i.accounttypeId == key) { // if (i.accounttypeId == key) {
// if (Object.keys(accountObj).length != 0) { // if (Object.keys(accountObj).length != 0) {
for (var i in accountObj) { for (var i in accountObj) {
...@@ -823,7 +792,6 @@ ...@@ -823,7 +792,6 @@
} }
}) })
$.each(functionIdLists, function (idx, m) { $.each(functionIdLists, function (idx, m) {
// console.log(m)
functionIdList.push({ functionIdList.push({
id: m.parentId, id: m.parentId,
menuId: m.superParentId menuId: m.superParentId
...@@ -863,7 +831,6 @@ ...@@ -863,7 +831,6 @@
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') {
console.log(result)
merchantNameSelect.update({ merchantNameSelect.update({
data: result.data, data: result.data,
autoRow: true, autoRow: true,
......
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh"> <html lang="zh">
<head>
<meta charset="utf-8" /> <head>
<meta content="IE=edge" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta content="IE=edge" />
<meta name="description" content="广联帐户管理中心-员工管理" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="author" content="GLSX Web Team" /> <meta name="description" content="广联帐户管理中心-员工管理" />
<meta name="keywords" itemprop="keywords" content="广联,帐户管理,员工管理" /> <meta name="author" content="GLSX Web Team" />
<link rel="stylesheet" type="text/css" href="/css/main.css" /> <meta name="keywords" itemprop="keywords" content="广联,帐户管理,员工管理" />
<title>角色管理</title> <link rel="stylesheet" type="text/css" href="/css/main.css" />
</head> <title>角色管理</title>
<style> </head>
.sub-bg-white { <style>
background-color: #f4f5fa; .sub-bg-white {
padding-top: 8px; background-color: #f4f5fa;
/* height: 100%; */ padding-top: 8px;
padding-bottom: 100px; /* height: 100%; */
} padding-bottom: 100px;
.tabmutiple-content-wrap { }
background-color: #f4f6fc;
padding: 0 0 1px; .tabmutiple-content-wrap {
margin: 0 20px; background-color: #f4f6fc;
} padding: 0 0 1px;
margin: 0 20px;
.tabmutiple-content { }
margin: 0 10px;
background-color: #f4f6fc; .tabmutiple-content {
} margin: 0 10px;
.layui-tab-content { background-color: #f4f6fc;
background-color: #fff; }
}
.layui-tab-title { .layui-tab-content {
background-color: #f4f6fc; background-color: #fff;
} }
.outtitle { .layui-tab-title {
margin-left: -10px; background-color: #f4f6fc;
} }
.layui-this {
background-color: #fff; .outtitle {
border: 2px solid #fff; margin-left: -10px;
} }
.layui-tab-title .layui-this {
transform: none; .layui-this {
} background-color: #fff;
.layui-tab-card > .layui-tab-title li { border: 2px solid #fff;
margin-left: 0; }
}
.topwrap { .layui-tab-title .layui-this {
margin: 0 20px 0; transform: none;
background-color: #fff; }
position: relative;
} .layui-tab-card>.layui-tab-title li {
.topwrap .grayLine { margin-left: 0;
position: absolute; }
left: 0;
top: 48px; .topwrap {
background-color: #d8d8d8; margin: 0 20px 0;
width: 100%; background-color: #fff;
height: 1px; position: relative;
} }
.bottomwrap {
margin: 20px 20px 0; .topwrap .grayLine {
background-color: #fff; position: absolute;
/* height: 100%; */ left: 0;
padding-bottom: 30px; top: 48px;
} background-color: #d8d8d8;
.show { width: 100%;
display: inline-block; height: 1px;
} }
.hide { .bottomwrap {
display: none; margin: 20px 20px 0;
} background-color: #fff;
</style> /* height: 100%; */
<body> padding-bottom: 30px;
<div id="app"> }
<main class="bg-white wrapper detail">
<div class="sub-bg-white"> .show {
<div class="topwrap"> display: inline-block;
<div class="grayLine"></div> }
<div class="content-title">
<span>角色基本信息</span> .hide {
<div class="title-right" id="merchantName"></div> display: none;
</div> }
<div class="layui-form-item"> </style>
<label class="layui-form-label">角色名称:</label>
<div class="layui-input-block"> <body>
<div class="layui-form-mid layui-word-aux" id="roleName"></div> <div id="app">
</div> <main class="bg-white wrapper detail">
<div class="sub-bg-white">
<div class="topwrap">
<div class="grayLine"></div>
<div class="content-title">
<span>角色基本信息</span>
<div class="title-right" id="merchantName"></div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">角色名称:</label>
<div class="layui-input-block">
<div class="layui-form-mid layui-word-aux" id="roleName"></div>
</div> </div>
<div class="layui-form-item"> </div>
<label class="layui-form-label">角色号:</label> <div class="layui-form-item">
<div class="layui-input-block"> <label class="layui-form-label">角色号:</label>
<div class="layui-form-mid layui-word-aux" id="roleCode"></div> <div class="layui-input-block">
</div> <div class="layui-form-mid layui-word-aux" id="roleCode"></div>
</div> </div>
<div class="layui-form-item"> </div>
<label class="layui-form-label">角色说明:</label> <div class="layui-form-item">
<div class="layui-input-block"> <label class="layui-form-label">角色说明:</label>
<div class="layui-form-mid layui-word-aux" id="roleDescription"></div> <div class="layui-input-block">
</div> <div class="layui-form-mid layui-word-aux" id="roleDescription"></div>
</div> </div>
</div> </div>
</div>
<div class="bottomwrap"> <div class="bottomwrap">
<h3 class="content-title layui-form"> <h3 class="content-title layui-form">
角色权限 角色权限
<!-- <select id="accountType" name="accountType" lay-filter="accountSelect"> <!-- <select id="accountType" name="accountType" lay-filter="accountSelect">
</select> --> </select> -->
</h3> </h3>
<div class="tabmutiple-content-wrap"> <div class="tabmutiple-content-wrap">
<div class="layui-tab tabmutiple-content" lay-filter="roleAuth"> <div class="layui-tab tabmutiple-content" lay-filter="roleAuth">
<ul class="layui-tab-title outtitle"></ul> <ul class="layui-tab-title outtitle"></ul>
<div class="layui-tab-content"></div> <div class="layui-tab-content"></div>
</div>
</div> </div>
</div> </div>
<div class="footer-close">
<button type="button" class="layui-btn layui-btn-normal btn-one" id="return">关闭</button>
</div>
</div> </div>
</main> <div class="footer-close">
</div> <button type="button" class="layui-btn layui-btn-normal btn-one" id="return">关闭</button>
<script src="https://www.layuicdn.com/layui/layui.js"></script> </div>
<script src="/js/load.js"></script> </div>
<script> </main>
layui.use(['request', 'helper', 'form', 'treeTab'], function () { </div>
var request = layui.request <script src="https://www.layuicdn.com/layui/layui.js"></script>
var helper = layui.helper <script src="/js/load.js"></script>
var form = layui.form <script>
var xmSelect = layui.xmSelect layui.use(['request', 'helper', 'form', 'treeTab'], function () {
var $ = layui.$ var request = layui.request
var treeTab = layui.treeTab var helper = layui.helper
var roleid = qs('id') var form = layui.form
var merchantId = qs('merchantId') var xmSelect = layui.xmSelect
var basicArr = ['roleName', 'roleCode', 'roleDescription', 'merchantName'] var $ = layui.$
var roleData = {} var treeTab = layui.treeTab
var menuFunTreeData = [] var roleid = qs('id')
var templateData = {} var merchantId = qs('merchantId')
var treeData = {} var basicArr = ['roleName', 'roleCode', 'roleDescription', 'merchantName']
// 查询角色详情 var roleData = {}
getById() var menuFunTreeData = []
findMenuFunTreeByRoleId() var templateData = {}
var treeData = {}
$('#return').on('click', function () { // 查询角色详情
window.history.back() getById()
}) findMenuFunTreeByRoleId()
function getById() { $('#return').on('click', function () {
var params = { id: roleid, method: 'org.ore.api.role.getById' } window.history.back()
request(params, function (res) { })
if (res.code == '0') {
console.log(roleData)
roleData = helper.clone(true, res.data)
for (var i in basicArr) {
$('#' + [basicArr[i]]).text(roleData[basicArr[i]] || '无')
}
// callback(roleData.responseList)
}
})
}
function findMenuFunTreeByRoleId() { function getById() {
var params = { var params = { id: roleid, method: 'org.ore.api.role.getById' }
method: 'cn.com.glsx.merchants.merchant.findMenuFunTreeByRoleId', request(params, function (res) {
id: roleid if (res.code == '0') {
} roleData = helper.clone(true, res.data)
request(params, function (res) { for (var i in basicArr) {
if (res.code == '0' && res.data && res.data.length != 0) { $('#' + [basicArr[i]]).text(roleData[basicArr[i]] || '无')
var authList = res.data
$.each(authList, function (index, item) {
treeTab.tabAdd(
{
title: item.accounttypeName,
value: item.accounttypeId
},
true
)
var menuData = []
if (item.products && item.products.length != 0) {
$.each(item.products, function (idx, m) {
treeTab.treeTabDetail(
{
name: m.productName,
value: m.productId
},
item.accounttypeId,
m.merchantProTreeResponses
)
})
var filterName = 'treeTab' + item.accounttypeId
var productId = 'tab_' + item.accounttypeId + '_' + item.products[0].productId
treeTab.tabChange(filterName, productId)
}
})
console.log(authList)
treeTab.tabChange('roleAuth', authList[0].accounttypeId)
} }
}) // callback(roleData.responseList)
}
})
}
function findMenuFunTreeByRoleId() {
var params = {
method: 'cn.com.glsx.merchants.merchant.findMenuFunTreeByRoleId',
id: roleid
} }
}) request(params, function (res) {
</script> if (res.code == '0' && res.data && res.data.length != 0) {
<!-- <script type="text/html" id="treeAuth"> var authList = res.data
$.each(authList, function (index, item) {
treeTab.tabAdd(
{
title: item.accounttypeName,
value: item.accounttypeId
},
true
)
var menuData = []
if (item.products && item.products.length != 0) {
$.each(item.products, function (idx, m) {
treeTab.treeTabDetail(
{
name: m.productName,
value: m.productId
},
item.accounttypeId,
m.merchantProTreeResponses
)
})
var filterName = 'treeTab' + item.accounttypeId
var productId = 'tab_' + item.accounttypeId + '_' + item.products[0].productId
treeTab.tabChange(filterName, productId)
}
})
treeTab.tabChange('roleAuth', authList[0].accounttypeId)
}
})
}
})
</script>
<!-- <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="layui-no-data show" id="nomenu{{d.id}}">
<div class="no-data"> <div class="no-data">
...@@ -212,5 +222,6 @@ ...@@ -212,5 +222,6 @@
</div> </div>
</div> </div>
</script> --> </script> -->
</body> </body>
</html>
</html>
\ No newline at end of file \ No newline at end of file
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh"> <html lang="zh">
<head>
<meta charset="utf-8" />
<meta content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="广联帐户管理中心-员工管理" />
<meta name="author" content="GLSX Web Team" />
<meta name="keywords" itemprop="keywords" content="广联,帐户管理,员工管理" />
<link rel="stylesheet" type="text/css" href="/css/main.css" />
<link rel="stylesheet" type="text/css" href="/css/commonResetIndex.css" />
<title>角色管理</title>
</head>
<style>
xm-select > .xm-body .scroll-body {
width: 300px;
}
xm-select:hover {
border: 1px solid #5850ff !important;
}
.hide { <head>
display: none; <meta charset="utf-8" />
} <meta content="IE=edge" />
.show { <meta name="viewport" content="width=device-width, initial-scale=1.0" />
display: inline-block; <meta name="description" content="广联帐户管理中心-员工管理" />
} <meta name="author" content="GLSX Web Team" />
</style> <meta name="keywords" itemprop="keywords" content="广联,帐户管理,员工管理" />
<body> <link rel="stylesheet" type="text/css" href="/css/main.css" />
<div id="app"> <link rel="stylesheet" type="text/css" href="/css/commonResetIndex.css" />
<main class="bg-white"> <title>角色管理</title>
<div> </head>
<div class="search-block"> <style>
<form action="" class="layui-form" lay-filter="roleForm"> xm-select>.xm-body .scroll-body {
<div class="layui-form-item"> width: 300px;
<div class="twocol"> }
<div class="layui-inline" pane id="addEl">
<button type="button" class="layui-btn layui-btn-normal createBtn" id="addRole"> xm-select:hover {
<i class="layui-icon layui-icon-addition" style="vertical-align: top"></i> border: 1px solid #5850ff !important;
<span>创建角色</span> }
</button>
</div> .hide {
<div class="layui-inline companyName" pane> display: none;
<label class="layui-form-label">商户名称</label> }
<div class="layui-input-block">
<!-- <select name="merchantId" id="merchantName" lay-verify="required"></select> --> .show {
<div id="merchantNameSelect" style="width: 300px" class="xm-select-demo"></div> display: inline-block;
</div> }
</style>
<body>
<div id="app">
<main class="bg-white">
<div>
<div class="search-block">
<form action="" class="layui-form" lay-filter="roleForm">
<div class="layui-form-item">
<div class="twocol">
<div class="layui-inline" pane id="addEl">
<button type="button" class="layui-btn layui-btn-normal createBtn" id="addRole">
<i class="layui-icon layui-icon-addition" style="vertical-align: top"></i>
<span>创建角色</span>
</button>
</div>
<div class="layui-inline companyName" pane>
<label class="layui-form-label">商户名称</label>
<div class="layui-input-block">
<!-- <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>
</div>
<div class="divideLine"></div> <div class="divideLine"></div>
<div class="layui-form-item secondInput"> <div class="layui-form-item secondInput">
<div class="layui-inline"> <div class="layui-inline">
<!-- <label class="layui-form-label">状态</label> --> <!-- <label class="layui-form-label">状态</label> -->
<label class="layui-form-label">状态</label> <label class="layui-form-label">状态</label>
<div class="layui-input-inline" style="margin-left: 0"> <div class="layui-input-inline" style="margin-left: 0">
<select name="delFlag" id="status" lay-verify="required"> <select name="delFlag" id="status" lay-verify="required">
<option value="">全部</option> <option value="">全部</option>
<option value="1">草稿</option> <option value="1">草稿</option>
<option value="0">正常</option> <option value="0">正常</option>
</select> </select>
</div>
</div> </div>
<div class="layui-inline"> </div>
<label class="layui-form-label">角色名称</label> <div class="layui-inline">
<div class="layui-input-inline"> <label class="layui-form-label">角色名称</label>
<input type="text" name="roleName" placeholder="请输入角色名称" autocomplete="off" class="layui-input" /> <div class="layui-input-inline">
</div> <input type="text" name="roleName" placeholder="请输入角色名称" autocomplete="off" class="layui-input" />
</div> </div>
</div>
<div class="layui-inline" style="float: right" pane> <div class="layui-inline" style="float: right" 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> </div>
</form>
<div class="table-page">
<table id="roleTable" lay-filter="roleTool"></table>
<div id="rolePage" class="align-left"></div>
</div> </div>
</form>
<div class="table-page">
<table id="roleTable" lay-filter="roleTool"></table>
<div id="rolePage" class="align-left"></div>
</div> </div>
</div> </div>
</main> </div>
</div> </main>
<script src="https://www.layuicdn.com/layui/layui.js"></script> </div>
<script src="/js/load.js"></script> <script src="https://www.layuicdn.com/layui/layui.js"></script>
<script> <script src="/js/load.js"></script>
layui.use(['table', 'form', 'request', 'helper', 'laypage', 'xmSelect'], function () { <script>
var request = layui.request layui.use(['table', 'form', 'request', 'helper', 'laypage', 'xmSelect'], function () {
var table = layui.table var request = layui.request
var form = layui.form var table = layui.table
var helper = layui.helper var form = layui.form
var laypage = layui.laypage var helper = layui.helper
var xmSelect = layui.xmSelect var laypage = layui.laypage
var $ = layui.$ var xmSelect = layui.xmSelect
// 商户名称列表 var $ = layui.$
var merchantName = $('#merchantName') // 商户名称列表
var accountInfo = helper.store.get('accountInfo') var merchantName = $('#merchantName')
if (accountInfo && accountInfo.merchantAccountLevel == 4) { var accountInfo = helper.store.get('accountInfo')
$('.companyName').addClass('hide') if (accountInfo && accountInfo.merchantAccountLevel == 4) {
} $('.companyName').addClass('hide')
var cols = [ }
//表头 var cols = [
{ field: '', title: '序号', type: 'numbers', width: 60 }, //表头
{ field: 'roleName', title: '角色名称', align: 'center' }, { field: '', title: '序号', type: 'numbers', width: 60 },
{ field: 'roleCode', title: '角色号', align: 'center' }, { field: 'roleName', title: '角色名称', align: 'center' },
{ field: 'merchantName', title: '所属商户名', align: 'center' }, { field: 'roleCode', title: '角色号', align: 'center' },
{ field: 'statusName', title: '状态', align: 'center', width: 100 }, { field: 'merchantName', title: '所属商户名', align: 'center' },
{ field: 'updatedTime', title: '更新时间', align: 'center' }, { field: 'statusName', title: '状态', align: 'center', width: 100 },
{ fixed: 'right', title: '操作', minWidth: 160, align: 'center', toolbar: '#roleBar' } { field: 'updatedTime', title: '更新时间', align: 'center' },
] { fixed: 'right', title: '操作', minWidth: 160, align: 'center', toolbar: '#roleBar' }
var colums = [ ]
{ field: '', title: '序号', type: 'numbers', width: 60 }, var colums = [
{ field: 'roleName', title: '角色名称', align: 'center' }, { field: '', title: '序号', type: 'numbers', width: 60 },
{ field: 'roleCode', title: '角色号', align: 'center' }, { field: 'roleName', title: '角色名称', align: 'center' },
{ field: 'statusName', title: '状态', align: 'center' }, { field: 'roleCode', title: '角色号', align: 'center' },
{ field: 'createdTime', title: '创建时间', align: 'center' }, { field: 'statusName', title: '状态', align: 'center' },
{ field: 'updatedTime', title: '更新时间', align: 'center' }, { field: 'createdTime', title: '创建时间', align: 'center' },
{ fixed: 'right', title: '操作', width: 160, align: 'center', toolbar: '#roleBar' } { field: 'updatedTime', title: '更新时间', align: 'center' },
] { fixed: 'right', title: '操作', width: 160, align: 'center', toolbar: '#roleBar' }
//创建table实例 ]
var roleTable = table.render({ //创建table实例
elem: '#roleTable', var roleTable = table.render({
skin: 'nob', elem: '#roleTable',
height: 'full-300', skin: 'nob',
cols: accountInfo && accountInfo.merchantAccountLevel == 4 ? [colums] : [cols] height: 'full-300',
}) cols: accountInfo && accountInfo.merchantAccountLevel == 4 ? [colums] : [cols]
})
// 分页配置 // 分页配置
var page = { var page = {
pageNum: 1, pageNum: 1,
pageSize: 10 pageSize: 10
} }
var pageOptions = { var pageOptions = {
elem: 'rolePage', elem: 'rolePage',
groups: 5, groups: 5,
layout: ['count', 'page', 'skip'], layout: ['count', 'page', 'skip'],
jump: function (obj, first) { jump: function (obj, first) {
//obj包含了当前分页的所有参数,比如: //obj包含了当前分页的所有参数,比如:
console.log(obj.curr) //得到当前页,以便向服务端请求对应页的数据。 page.pageNum = obj.curr
console.log(obj.limit) //得到每页显示的条数 page.pageSize = obj.limit
page.pageNum = obj.curr //首次不执行
page.pageSize = obj.limit if (!first) {
//首次不执行 //do something
if (!first) { getTabelList(roleTable, form.val('roleForm'))
//do something
getTabelList(roleTable, form.val('roleForm'))
}
} }
} }
}
var merchantNameSelect = xmSelect.render({
el: '#merchantNameSelect',
prop: {
name: 'merchantName',
value: 'id'
},
name: 'merchantId',
filterable: true,
clickClose: true,
radio: true,
data: []
})
var merchantNameSelect = xmSelect.render({ init()
el: '#merchantNameSelect', function init() {
prop: { findAllMerchant()
name: 'merchantName', getTabelList(roleTable)
value: 'id' }
// 获取table列表接口
function getTabelList(table, search, isResetPageNum) {
var params = helper.clone(
false,
{
pageNum: page.pageNum,
pageSize: page.pageSize,
method: 'org.ore.api.role.page'
}, },
name: 'merchantId', search
filterable: true, )
clickClose: true, request(params, function (res) {
radio: true, // var data = res.data
data: [] var data = helper.formateNullFieldData(res.data)
var options = {
data: data.data
}
pageOptions.count = data.count
if (isResetPageNum) {
pageOptions.curr = 1
}
laypage.render(pageOptions)
roleTable.reload(options)
}) })
}
init() // 查询所有商户
function init() { function findAllMerchant() {
findAllMerchant() var params = { method: 'cn.com.glsx.merchants.menu.findAllMerchant' }
getTabelList(roleTable) request(params, function (result) {
} if (result.code == '0') {
// 获取table列表接口 merchantNameSelect.update({
function getTabelList(table, search, isResetPageNum) { data: result.data,
var params = helper.clone( autoRow: true,
false, paging: result.data.length > 20
{
pageNum: page.pageNum,
pageSize: page.pageSize,
method: 'org.ore.api.role.page'
},
search
)
request(params, function (res) {
console.log(res)
// var data = res.data
var data = helper.formateNullFieldData(res.data)
var options = {
data: data.data
}
pageOptions.count = data.count
if (isResetPageNum) {
pageOptions.curr = 1
}
laypage.render(pageOptions)
roleTable.reload(options)
})
}
// 查询所有商户
function findAllMerchant() {
var params = { method: 'cn.com.glsx.merchants.menu.findAllMerchant' }
request(params, function (result) {
if (result.code == '0') {
console.log(result)
merchantNameSelect.update({
data: result.data,
autoRow: true,
paging: result.data.length > 20
})
// var list = result.data
// list.unshift('')
// $.each(list, function (index, item) {
// merchantName.append(new Option(item.merchantName, item.id))
// })
// form.render('select')
}
})
}
// table工具条事件
table.on('tool(roleTool)', function (obj) {
var data = obj.data
var layEvent = obj.event
var tr = obj.tr
if (layEvent === 'detail') {
go('role', 'detail', { id: data.id, merchantId: data.merchantId })
} else if (layEvent === 'edit') {
var params = { id: data.id, merchantId: data.merchantId, merchantName: data.merchantName }
go('role', 'add', params)
} else if (layEvent === 'del') {
layer.confirm('是否确认删除该角色?', function (index) {
// obj.del() //删除对应行(tr)的DOM结构,并更新缓存
var params = {
method: 'org.ore.api.role.deleteById',
id: data.id
}
request(params, function (res) {
if (res.code == '0') {
layer.close(index)
console.log('shanchu')
getTabelList(roleTable)
}
})
}) })
// var list = result.data
// list.unshift('')
// $.each(list, function (index, item) {
// merchantName.append(new Option(item.merchantName, item.id))
// })
// form.render('select')
} }
}) })
// 新增点击事件 }
$('#addRole').on('click', function () { // table工具条事件
go('role', 'add') table.on('tool(roleTool)', function (obj) {
}) var data = obj.data
// 查询事件 var layEvent = obj.event
$('#roleSearch').on('click', function () { var tr = obj.tr
var searchData = form.val('roleForm') if (layEvent === 'detail') {
console.log(searchData) go('role', 'detail', { id: data.id, merchantId: data.merchantId })
getTabelList(roleTable, searchData, true) } else if (layEvent === 'edit') {
}) var params = { id: data.id, merchantId: data.merchantId, merchantName: data.merchantName }
go('role', 'add', params)
} else if (layEvent === 'del') {
layer.confirm('是否确认删除该角色?', function (index) {
// obj.del() //删除对应行(tr)的DOM结构,并更新缓存
var params = {
method: 'org.ore.api.role.deleteById',
id: data.id
}
request(params, function (res) {
if (res.code == '0') {
layer.close(index)
getTabelList(roleTable)
}
})
})
}
}) })
</script> // 新增点击事件
<script type="text/html" id="roleBar"> $('#addRole').on('click', function () {
go('role', 'add')
})
// 查询事件
$('#roleSearch').on('click', function () {
var searchData = form.val('roleForm')
getTabelList(roleTable, searchData, true)
})
})
</script>
<script type="text/html" id="roleBar">
<a class="layui-btn-xs" lay-event="detail">查看</a> <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="edit">修改</a>
{{# if(d.delFlag == 1){ }} {{# if(d.delFlag == 1){ }}
<a class="layui-btn-xs" lay-event="del">删除</a> <a class="layui-btn-xs" lay-event="del">删除</a>
{{# } }} {{# } }}
</script> </script>
</body> </body>
</html>
</html>
\ No newline at end of file \ No newline at end of file
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh"> <html lang="zh">
<head>
<meta charset="utf-8" />
<meta content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="修改有效期" />
<meta name="author" content="GLSX Web Team" />
<meta name="keywords" itemprop="keywords" content="广联,商户管理" />
<link rel="stylesheet" type="text/css" href="/css/main.css" />
<style>
.valid-period {
text-align: center;
padding: 20px 20px;
background-color: #ffffff;
}
</style>
<title>tree</title>
</head>
<body> <head>
<div id="app"> <meta charset="utf-8" />
<main>fdasfda</main> <meta content="IE=edge" />
</div> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="https://www.layuicdn.com/layui/layui.js"></script> <meta name="description" content="修改有效期" />
<script src="/js/load.js"></script> <meta name="author" content="GLSX Web Team" />
<script> <meta name="keywords" itemprop="keywords" content="广联,商户管理" />
console.log(qs('id')) <link rel="stylesheet" type="text/css" href="/css/main.css" />
</script> <style>
</body> .valid-period {
</html> text-align: center;
padding: 20px 20px;
background-color: #ffffff;
}
</style>
<title>tree</title>
</head>
<body>
<div id="app">
<main>fdasfda</main>
</div>
<script src="https://www.layuicdn.com/layui/layui.js"></script>
<script src="/js/load.js"></script>
<script>
</script>
</body>
</html>
\ No newline at end of file \ No newline at end of file
...@@ -28,8 +28,7 @@ layui.define(['ztree'], function (exports) { ...@@ -28,8 +28,7 @@ layui.define(['ztree'], function (exports) {
} }
} }
function zTreeOnExpand(event, treeId, treeNode) { function zTreeOnExpand(event, treeId, treeNode) {
console.log(treeNode) treeNode.check = true
treeNode.check=true
} }
var setting = { var setting = {
view: { view: {
...@@ -63,8 +62,8 @@ layui.define(['ztree'], function (exports) { ...@@ -63,8 +62,8 @@ layui.define(['ztree'], function (exports) {
if (selfSetting) Object.assign(setting, selfSetting) if (selfSetting) Object.assign(setting, selfSetting)
inst = tree.init($treeDom, setting, nodes) inst = tree.init($treeDom, setting, nodes)
inst.expandAll(true) inst.expandAll(true)
inst.checkNodes = function(checked){ inst.checkNodes = function (checked) {
var nodesLevel1 = this.getNodes() var nodesLevel1 = this.getNodes()
var nodesAll = this.transformToArray(nodesLevel1) var nodesAll = this.transformToArray(nodesLevel1)
for (var i = 0; i <= nodesAll.length; i++) { for (var i = 0; i <= nodesAll.length; i++) {
......
...@@ -128,7 +128,6 @@ layui.define(['store'], function (exports) { ...@@ -128,7 +128,6 @@ layui.define(['store'], function (exports) {
} }
function dateFormat(time, fmt = 'YYYY-mm-dd') { function dateFormat(time, fmt = 'YYYY-mm-dd') {
console.log(time, '============')
var time = new Date(time) var time = new Date(time)
let ret; let ret;
const opt = { const opt = {
...@@ -141,10 +140,10 @@ layui.define(['store'], function (exports) { ...@@ -141,10 +140,10 @@ layui.define(['store'], function (exports) {
// 有其他格式化字符需求可以继续添加,必须转化成字符串 // 有其他格式化字符需求可以继续添加,必须转化成字符串
}; };
for (let k in opt) { for (let k in opt) {
ret = new RegExp("(" + k + ")").exec(fmt); ret = new RegExp("(" + k + ")").exec(fmt);
if (ret) { if (ret) {
fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0"))) fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
}; };
}; };
return fmt; return fmt;
} }
......
...@@ -97,7 +97,6 @@ layui.define(['element', 'laytpl', 'gtree', 'xmSelect'], function (exports) { ...@@ -97,7 +97,6 @@ layui.define(['element', 'laytpl', 'gtree', 'xmSelect'], function (exports) {
// tab Change // tab Change
tabChange: function (name, id) { tabChange: function (name, id) {
element.tabChange(name, id) element.tabChange(name, id)
console.log(name, id)
if (name == 'roleAuth') { if (name == 'roleAuth') {
$(`#nomenu${id}`).html('暂无数据') $(`#nomenu${id}`).html('暂无数据')
} else { } else {
...@@ -105,7 +104,6 @@ layui.define(['element', 'laytpl', 'gtree', 'xmSelect'], function (exports) { ...@@ -105,7 +104,6 @@ layui.define(['element', 'laytpl', 'gtree', 'xmSelect'], function (exports) {
const productId = id.split('_')[2] const productId = id.split('_')[2]
$(`#nodata${accounttypeId}`).removeClass('show') $(`#nodata${accounttypeId}`).removeClass('show')
$(`#nodata${accounttypeId}`).addClass('hide') $(`#nodata${accounttypeId}`).addClass('hide')
console.log(menuFunTreeData)
menuFunTreeData.forEach(item => { menuFunTreeData.forEach(item => {
if (item.accounttypeId == accounttypeId) { if (item.accounttypeId == accounttypeId) {
item.products.forEach(i => { item.products.forEach(i => {
...@@ -134,7 +132,6 @@ layui.define(['element', 'laytpl', 'gtree', 'xmSelect'], function (exports) { ...@@ -134,7 +132,6 @@ layui.define(['element', 'laytpl', 'gtree', 'xmSelect'], function (exports) {
* defaultList:编辑时传入,默认勾选中的数组。(举例:[1,2,3]) * defaultList:编辑时传入,默认勾选中的数组。(举例:[1,2,3])
*/ */
treeTabAdd: function (item, id, products, defaultList) { treeTabAdd: function (item, id, products, defaultList) {
console.log(defaultList)
var productId = 'tab_' + id + '_' + item.value var productId = 'tab_' + id + '_' + item.value
var filterName = 'treeTab' + id // 过滤器的名称 lay-filter var filterName = 'treeTab' + id // 过滤器的名称 lay-filter
element.tabAdd(filterName, { element.tabAdd(filterName, {
...@@ -164,10 +161,9 @@ layui.define(['element', 'laytpl', 'gtree', 'xmSelect'], function (exports) { ...@@ -164,10 +161,9 @@ layui.define(['element', 'laytpl', 'gtree', 'xmSelect'], function (exports) {
treeListData = i.merchantProTreeResponses treeListData = i.merchantProTreeResponses
} }
}) })
console.log('treeListData', treeListData)
var treedom = 'tree_' + productId var treedom = 'tree_' + productId
treeData[id][item.value].treeObj = tree.create(treedom, treeListData, { chkDisabled: true }) treeData[id][item.value].treeObj = tree.create(treedom, treeListData, { chkDisabled: true })
}, },
treeTabDetail: function (item, id, productTreeList) { treeTabDetail: function (item, id, productTreeList) {
var productId = 'tab_' + id + '_' + item.value var productId = 'tab_' + id + '_' + item.value
...@@ -199,13 +195,12 @@ layui.define(['element', 'laytpl', 'gtree', 'xmSelect'], function (exports) { ...@@ -199,13 +195,12 @@ layui.define(['element', 'laytpl', 'gtree', 'xmSelect'], function (exports) {
enable: false enable: false
} }
}) })
console.log(productTreeList)
if (productTreeList && productTreeList.length != 0) { if (productTreeList && productTreeList.length != 0) {
$(`#nomenu${productId}`).removeClass('show') $(`#nomenu${productId}`).removeClass('show')
$(`#nomenu${productId}`).addClass('hide') $(`#nomenu${productId}`).addClass('hide')
// } else { // } else {
// $(`#nodata${id}`).removeClass('hide') // $(`#nodata${id}`).removeClass('hide')
// $(`#nodata${id}`).addClass('show') // $(`#nodata${id}`).addClass('show')
} }
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!