Commit b68230a6 by 李长胜

2021-08-06 样式修改

2 parents 973ce8f3 4e4076e9
...@@ -35,7 +35,8 @@ ...@@ -35,7 +35,8 @@
var _href = '/html/' + _path var _href = '/html/' + _path
$('.header-nav-item').each(function (i, e) { $('.header-nav-item').each(function (i, e) {
var _hr = $(e).find('a').attr('href') var _hr = $(e).find('a').attr('href')
if (_hr.startsWith(_href)) { if (_hr.indexOf(_href) !== -1) {
// if (_hr.startsWith(_href)) {
$(e).addClass('active').siblings().removeClass('active') $(e).addClass('active').siblings().removeClass('active')
return false return false
} }
......
...@@ -103,21 +103,18 @@ ...@@ -103,21 +103,18 @@
<div class="layui-input-block"> <div class="layui-input-block">
<div class="upload-img-box"> <div class="upload-img-box">
<div class="icon-add img-add show">+</div> <div class="icon-add img-add show">+</div>
<img class="upload-img upload-img-wh hide" id="img" src=""> <img class="upload-img upload-img-wh hide" id="img">
<input type="file" id="upload" name="merhcnatImg" ref="file" <input type="file" id="upload" name="merhcnatImg" ref="file"
class="upload upload-img-box upload-img-wh" accept="image/png, image/jpeg, image/gif, image/jpg" class="upload upload-img-box upload-img-wh" accept="image/png, image/jpeg, image/gif, image/jpg"
data-idx="0" style="opacity: 0;"> data-idx="0" style="opacity: 0;">
</div> </div>
<span class="tips">图片格式仅支持JPG,PNG格式,大小1M以内</span> <span class="tips">图片格式仅支持JPG,PNG格式,大小1M以内</span>
<!-- <div class="layui-upload-img" id="uploadImg">
<i class="layui-icon">&#xe624;</i>
</div> -->
</div> </div>
</div> </div>
<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">
<input type="text" name="staffEmail" lay-verify="email" placeholder="请输入邮箱" autocomplete="off" class="layui-input" /> <input type="text" name="staffEmail" lay-verify="" placeholder="请输入邮箱" autocomplete="off" class="layui-input" />
</div> </div>
</div> </div>
...@@ -142,7 +139,9 @@ ...@@ -142,7 +139,9 @@
//Demo //Demo
layui.use(['form', 'upload', 'gtree', 'request', 'helper'], function() { layui.use(['form', 'upload', 'gtree', 'request', 'helper'], function() {
console.log(qs('id')) console.log(qs('merchantId'))
var merchantId = qs('merchantId')
var id = qs('id')
var form = layui.form var form = layui.form
var upload = layui.upload var upload = layui.upload
var tree = layui.gtree var tree = layui.gtree
...@@ -150,18 +149,14 @@ ...@@ -150,18 +149,14 @@
var helper = layui.helper var helper = layui.helper
var $ = layui.$ var $ = layui.$
var merchantFileRequest = {} var merchantFileRequest = {}
var id = null
var employeeForm = {} var employeeForm = {}
var pwd = $('#password') // 密码输入框 var pwd = $('#password') // 密码输入框
var resetpsw = $('#resetpsw') var resetpsw = $('#resetpsw')
pwd.attr('readonly', false) pwd.attr('readonly', false)
if (qs('id')) { if (id) {
id = qs('id')
resetpsw.removeClass('hide') resetpsw.removeClass('hide')
resetpsw.addClass('show') resetpsw.addClass('show')
} else {
// resetpsw.addClass('hide')
} }
// 重置密码 // 重置密码
resetpsw.on('click', function() { resetpsw.on('click', function() {
...@@ -173,7 +168,7 @@ ...@@ -173,7 +168,7 @@
findRoleList() findRoleList()
// 查询角色权限列表 // 查询角色权限列表
function findRoleList() { function findRoleList() {
var params = { method: 'org.ore.api.role.list', id: 31 } var params = { method: 'org.ore.api.role.list', id: merchantId }
request(params, function(res) { request(params, function(res) {
if (res.code == '0') { if (res.code == '0') {
var list = res.data var list = res.data
...@@ -187,23 +182,23 @@ ...@@ -187,23 +182,23 @@
} }
// 可见商户 // 可见商户
var visibleMerchantParams = { id: 31, method: 'cn.com.glsx.merchants.merchant.findMerchantTree' } var visibleMerchantParams = { id: merchantId, method: 'cn.com.glsx.merchants.merchant.findMerchantTree' }
var visibleMerchant = {} var visibleMerchant = {}
request(visibleMerchantParams, function(res) { request(visibleMerchantParams, function(res) {
if (res.code == '0') { if (res.code == '0') {
if (id) { if (id) {
getById(function(p) { getById(function(checkedList) {
visibleMerchant = tree.create('visibleInferiorMerTree', res.data, { onNodeCreated: function(event, treeId, treeNode) { visibleMerchant = tree.create('visibleInferiorMerTree', res.data, {checkedList: checkedList}
if (p.indexOf(treeNode.id+'') != -1) { // { onNodeCreated: function(event, treeId, treeNode) {
treeNode.checked = true // if (p.indexOf(treeNode.id+'') != -1) {
visibleMerchant.updateNode(treeNode); // treeNode.checked = true
} // visibleMerchant.updateNode(treeNode);
}}) // }
visibleMerchant.expandAll(true) // }}
)
}) })
} else { } else {
visibleMerchant = tree.create('visibleInferiorMerTree', res.data) visibleMerchant = tree.create('visibleInferiorMerTree', res.data)
visibleMerchant.expandAll(true)
} }
} }
}) })
...@@ -221,11 +216,13 @@ ...@@ -221,11 +216,13 @@
staffPhone: data.staffPhone, staffPhone: data.staffPhone,
password: data.password, password: data.password,
// visibleInferiorMer: "1", // visibleInferiorMer: "1",
roleIds: data.roleIds.join(''), roleIds: +data.roleIds.join(''),
staffEmail: data.staffEmail, staffEmail: data.staffEmail,
staffJob: data.staffJob, staffJob: data.staffJob,
} }
merchantFileRequest = {fileName: data.merchantFileResponse.fileName, fileUrl: data.merchantFileResponse.fileUrl} if (data.merchantFileResponse) {
merchantFileRequest = { fileName: data.merchantFileResponse.fileName, fileUrl: data.merchantFileResponse.fileUrl }
}
var imgEl = $('#img') var imgEl = $('#img')
var addEl = $('.img-add') var addEl = $('.img-add')
imgEl.attr('src', merchantFileRequest.fileUrl) imgEl.attr('src', merchantFileRequest.fileUrl)
...@@ -233,8 +230,8 @@ ...@@ -233,8 +230,8 @@
imgEl.addClass('show') imgEl.addClass('show')
addEl.removeClass('show') addEl.removeClass('show')
addEl.addClass('hide') addEl.addClass('hide')
// var visibleInferiorMerArr = data.visibleInferiorMer.split(',') var visibleInferiorMerArr = data.visibleInferiorMer.split(',')
var visibleInferiorMerArr = "34,38".split(',') // var visibleInferiorMerArr = [32, 38]
callback(visibleInferiorMerArr) callback(visibleInferiorMerArr)
} }
console.log(employeeForm) console.log(employeeForm)
...@@ -282,12 +279,22 @@ ...@@ -282,12 +279,22 @@
}).join(',') }).join(',')
var otherParams = { var otherParams = {
visibleInferiorMer: visibleInferiorMer, visibleInferiorMer: visibleInferiorMer,
merchantFileRequest: JSON.stringify(merchantFileRequest) // merchantFileRequest: JSON.stringify(merchantFileRequest),
merchantId: merchantId
} }
var params = helper.clone(true, { method: 'cn.com.glsx.merchants.staff.saveStaff', merchantId: 31 }, data.field, otherParams) if (merchantFileRequest.fileName) {
otherParams.merchantFileRequest = JSON.stringify(merchantFileRequest)
} else
if (id) {
otherParams.id = id
otherParams.method = 'cn.com.glsx.merchants.staff.updateStaff'
} else {
otherParams.method = 'cn.com.glsx.merchants.staff.saveStaff'
}
var params = helper.clone(true, data.field, otherParams)
request(params, function (result) { request(params, function (result) {
if (result.code == '0') { if (result.code == '0') {
window.history.back() // window.history.back()
layer.msg('操作成功', { layer.msg('操作成功', {
icon: 1 icon: 1
}) })
......
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh"> <html lang="zh">
<<<<<<< HEAD
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
...@@ -39,6 +40,28 @@ ...@@ -39,6 +40,28 @@
<i class="layui-icon layui-icon-add-circle"></i> <i class="layui-icon layui-icon-add-circle"></i>
创建员工 创建员工
</button> </button>
=======
<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" />
<title>员工管理</title>
</head>
<body>
<div id="app">
<main>
<div class="bg-white">
<form action="" class="layui-form layui-form-pane" lay-filter="employeeForm">
<div class="layui-form-item" pane>
<button type="button" class="layui-btn layui-btn-normal" id="addEmployee">
<i class="layui-icon">&#xe654;</i>
创建员工
</button>
<div class="layui-inline" pane> <div class="layui-inline" pane>
<label class="layui-form-label">商户名称</label> <label class="layui-form-label">商户名称</label>
<div class="layui-input-block"> <div class="layui-input-block">
...@@ -50,8 +73,37 @@ ...@@ -50,8 +73,37 @@
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label">创建者</label> <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" />
</div>
</div>
>>>>>>> 4e4076e9661f54b986fc5b70d941ec0e9eaa1bf3
<div class="layui-inline" pane>
<label class="layui-form-label">商户名称</label>
<div class="layui-input-block">
<select name="merchantId" id="merchantName" lay-verify="required">
</select>
</div>
</div>
<<<<<<< HEAD
</div>
<div class="layui-inline">
<label class="layui-form-label">创建者</label>
<div class="layui-input-block">
<input type="text" name="createdName" required lay-verify="required" placeholder="请输入创建者" <input type="text" name="createdName" required lay-verify="required" placeholder="请输入创建者"
autocomplete="off" class="layui-input" /> autocomplete="off" class="layui-input" />
=======
<div class="layui-inline" pane>
<div class="layui-input-inline">
<select name="type" lay-verify="required">
<option value=""></option>
<option value="0">员工姓名</option>
<option value="1">手机号</option>
</select>
</div>
<div class="layui-input-inline">
<input type="text" name="keywords" required lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input" />
</div>
>>>>>>> 4e4076e9661f54b986fc5b70d941ec0e9eaa1bf3
</div> </div>
</div> </div>
<div class="layui-inline" pane> <div class="layui-inline" pane>
...@@ -64,6 +116,7 @@ ...@@ -64,6 +116,7 @@
<option value="2">已注销</option> <option value="2">已注销</option>
</select> </select>
</div> </div>
<<<<<<< HEAD
</div> </div>
<div class="layui-inline" pane> <div class="layui-inline" pane>
<div class="layui-input-inline"> <div class="layui-input-inline">
...@@ -141,6 +194,69 @@ ...@@ -141,6 +194,69 @@
if (isResetPageNum) { if (isResetPageNum) {
options.page = { options.page = {
curr: 1 curr: 1
=======
</form>
<table id="employeeTable" lay-filter="employeeTool"></table>
</div>
</main>
</div>
<script src="https://www.layuicdn.com/layui/layui.js"></script>
<script src="/js/load.js"></script>
<script>
layui.use(['table', 'request', 'form', 'helper'], function() {
var request = layui.request
var table = layui.table
var form = layui.form
var helper = layui.helper
var $ = layui.$
// 商户名称列表
var merchantName = $("#merchantName")
findAllMerchant()
//创建table实例
var employeeTable = table.render({
elem: '#employeeTable',
page: true,
cols: [
[
//表头
{ field: '', title: '序号', type: 'numbers', width: 80, fixed: 'left' },
{ field: 'staffName', title: '员工姓名', width: 120 },
{ field: 'staffCode', title: '员工号' },
{ field: 'roleName', title: '角色' },
{ field: 'staffPhone', title: '登录手机号', width: 125 },
{ field: 'password', title: '登录密码' },
{ field: 'statusName', title: '状态' },
{ field: 'createdAccount', title: '创建者' },
{ field: 'merchantName', title: '商户名(商户号)', width: 160 },
{ field: 'createdTime', title: '更新时间', width: 160 },
{ fixed: 'right', title: '操作', width: 240, align: 'center', toolbar: '#employeeBar' }
]
]
})
getTabelList(employeeTable)
// 获取table列表接口
function getTabelList(table, search, isResetPageNum) {
search = search || {}
var params = helper.clone(false, {
pageNum: table.config.index,
pageSize: table.config.limit,
method: 'cn.com.glsx.merchants.staff.findStaffByPage'
}, search)
request(params,
function(res) {
console.log(res)
// table.reload('testReload', {
// data: res.data.data
// })
var data = res.data
var options = {
data: data.data
}
if (isResetPageNum) {
options.page = {
curr: 1
}
>>>>>>> 4e4076e9661f54b986fc5b70d941ec0e9eaa1bf3
} }
} }
table.reload(options) table.reload(options)
...@@ -178,13 +294,34 @@ ...@@ -178,13 +294,34 @@
method: 'cn.com.glsx.merchants.staff.deleteStaff', method: 'cn.com.glsx.merchants.staff.deleteStaff',
id: data.id id: data.id
} }
<<<<<<< HEAD
request(params, function (res) { request(params, function (res) {
if (res.code == '0') { if (res.code == '0') {
layer.close(index) layer.close(index)
console.log('shanchu') console.log('shanchu')
getTabelList(employeeTable) getTabelList(employeeTable)
=======
})
}
// table工具条事件
table.on('tool(employeeTool)', function(obj) {
var data = obj.data
var layEvent = obj.event
var tr = obj.tr
if (layEvent === 'detail') {
go('employee', 'detail', {id: data.id})
} else if (layEvent === 'edit') {
go('employee', 'add', {id: data.id, merchantId: data.merchantId})
} else if (layEvent === 'del') {
layer.confirm('真的删除行么', function(index) {
// obj.del() //删除对应行(tr)的DOM结构,并更新缓存
var params = {
method: 'cn.com.glsx.merchants.staff.deleteStaff',
id: data.id
>>>>>>> 4e4076e9661f54b986fc5b70d941ec0e9eaa1bf3
} }
}) })
<<<<<<< HEAD
//向服务端发送删除指令 //向服务端发送删除指令
}) })
} else if (layEvent === 'updateTime') { } else if (layEvent === 'updateTime') {
...@@ -217,6 +354,64 @@ ...@@ -217,6 +354,64 @@
} }
}) })
} }
=======
} else if (layEvent === 'updateTime') {
layer.open({
type: 2,
title: '修改账户的有效期',
area: ['600px', '320px'],
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')
},
})
}
})
// 新增点击事件
$('#addEmployee').on('click', function() {
var value = merchantName.val()
if (value) {
go('employee', 'add', {merchantId: value})
} else {
layer.msg('请选择商户')
}
})
// 查询事件
$('#employeeSearch').on('click', function() {
var formVal = form.val('employeeForm')
var searchData = helper.clone(false, formVal)
console.log(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
delete searchData.keywords
console.log(searchData)
getTabelList(employeeTable, searchData)
})
>>>>>>> 4e4076e9661f54b986fc5b70d941ec0e9eaa1bf3
}) })
// 新增点击事件 // 新增点击事件
$(document).on('click', '#addEmployee', function () { $(document).on('click', '#addEmployee', function () {
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<div class="layui-form-item"> <div class="layui-form-item">
<div class="layui-form-label required" style="width: 120px;">账户有效期:</div> <div class="layui-form-label required" style="width: 120px;">账户有效期:</div>
<div class="layui-input-inline" style="width: auto;"> <div class="layui-input-inline" style="width: auto;">
<select name="validPeriod" id="periodSelect" required lay-verify="required"> <select name="effectiveTime" id="periodSelect" required lay-verify="required">
<option value="">请选择</option> <option value="">请选择</option>
</select> </select>
<p>(注:永久有效不超过所属工厂商户的有效期)</p> <p>(注:永久有效不超过所属工厂商户的有效期)</p>
...@@ -40,21 +40,22 @@ ...@@ -40,21 +40,22 @@
</div> --> </div> -->
</div> </div>
</form> </form>
<input type="text" id="isValid" name="isValid" value="no" style="display: none;" class="layui-input">
</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'], 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 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')
} }
...@@ -64,28 +65,17 @@ ...@@ -64,28 +65,17 @@
// 调接口 // 调接口
var params = { var params = {
method: 'cn.com.glsx.merchants.staff.updateValPerByStaffId', method: 'cn.com.glsx.merchants.staff.updateValPerByStaffId',
effectiveTime: data.field.validPeriod, effectiveTime: data.field.effectiveTime,
id: vaildData.id id: vaildData.id
} }
updateVal(params, function(e) {
console.log(e, '============kkkkk')
if (e) {
$('#isValid').attr('value', 'yes')
}
})
return false
})
function updateVal(params, callback) {
request(params, function (res) { request(params, function (res) {
if (res.code == '0') { if (res.code == '0') {
callback(true) helper.store.set('isRefresh', true)
parent.layer.close(currLayerIdx)
} }
}) })
} return false
})
// function callbackdata() {
// return vaildData
// }
// 获取参数 // 获取参数
function getQueryString(name) { function getQueryString(name) {
...@@ -104,13 +94,13 @@ ...@@ -104,13 +94,13 @@
dictType: 'staff_validity_period' dictType: 'staff_validity_period'
}, function (res) { }, function (res) {
if (res.code === '0') { if (res.code === '0') {
baseData.validPeriodList = res.data baseData.effectiveTimeList = res.data
var periodSelect = $('#periodSelect') var periodSelect = $('#periodSelect')
$.each(baseData.validPeriodList, 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', {
validPeriod: vaildData.validPeriod effectiveTime: vaildData.effectiveTime
}) })
form.render('select') form.render('select')
} }
......
...@@ -210,7 +210,7 @@ ...@@ -210,7 +210,7 @@
<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-inline"> <div class="layui-input-inline">
<input class="layui-input" placeholder="车型品牌"> <input class="layui-input" placeholder="车型品牌" id="brand">
<div id="carBrandTree" style="width: 300px; height: 200px; overflow-y: scroll;"></div> <div id="carBrandTree" style="width: 300px; height: 200px; overflow-y: scroll;"></div>
</div> </div>
</div> </div>
...@@ -300,6 +300,7 @@ ...@@ -300,6 +300,7 @@
var editData = {} var editData = {}
var scopeIdx = 1 var scopeIdx = 1
var treeObj = null var treeObj = null
var all_nodes = []
// 1-创建新商户;2-创建子商户;3-修改 // 1-创建新商户;2-创建子商户;3-修改
var editLevel = 1 var editLevel = 1
var id = null var id = null
...@@ -370,6 +371,7 @@ ...@@ -370,6 +371,7 @@
helper.store.set('merchantMapObj', merchantForm) helper.store.set('merchantMapObj', merchantForm)
form.on('submit(handleSubmit)', function (data) { form.on('submit(handleSubmit)', function (data) {
console.log(editLevel)
// console.log(data.field) // console.log(data.field)
var formData = data.field var formData = data.field
var params = { var params = {
...@@ -382,7 +384,7 @@ ...@@ -382,7 +384,7 @@
'merchantAccountLevel', 'effectiveTime' 'merchantAccountLevel', 'effectiveTime'
] ]
if (formData.isloginName == 'on') { if (formData.isloginName == 'on') {
formData.isloginName = 1 params.isloginName = 1
} }
if (formData.bussinessBegintime) { if (formData.bussinessBegintime) {
merchantForm.bussinessBegintime = new Date(formData.bussinessBegintime) merchantForm.bussinessBegintime = new Date(formData.bussinessBegintime)
...@@ -409,8 +411,6 @@ ...@@ -409,8 +411,6 @@
}, { }, {
attr: 'accounttypeId', attr: 'accounttypeId',
toString: ',' toString: ','
// toString: false,
// toArray: true
}] }]
$.each(checkClassNameList, function (index, item) { $.each(checkClassNameList, function (index, item) {
var checkedArr = [] var checkedArr = []
...@@ -422,10 +422,6 @@ ...@@ -422,10 +422,6 @@
merchantForm[item.attr] = checkedArr.join(item.toString) merchantForm[item.attr] = checkedArr.join(item.toString)
params[item.attr] = checkedArr.join(item.toString) params[item.attr] = checkedArr.join(item.toString)
} }
// else if (item.toArray) {
// merchantForm[item.attr] = checkedArr
// params[item.attr] = JSON.stringify(checkedArr)
// }
} }
}) })
var elList = $('.business-scope-cust') var elList = $('.business-scope-cust')
...@@ -436,13 +432,16 @@ ...@@ -436,13 +432,16 @@
merchantForm.businessScopeCustomize = tempList.join(',') merchantForm.businessScopeCustomize = tempList.join(',')
params.businessScopeCustomize = tempList.join(',') params.businessScopeCustomize = tempList.join(',')
merchantForm.merchantBrand = treeObj.getCheckedNodes(true) merchantForm.merchantBrand = treeObj.getCheckedNodes(true)
params.merchantBrand = findId(merchantForm.merchantBrand, []).join(',') params.merchantBrand = findId(merchantForm.merchantBrand).join(',')
if (merchantForm.merchantFiles.length) {
params.merchantFiles = JSON.stringify(merchantForm.merchantFiles) params.merchantFiles = JSON.stringify(merchantForm.merchantFiles)
}
if (editLevel == 1) { if (editLevel == 1) {
params.method = 'cn.com.glsx.merchants.merchant.saveMerchant' params.method = 'cn.com.glsx.merchants.merchant.saveMerchant'
} else if (editLevel == 2) { } else if (editLevel == 2) {
params.method = 'cn.com.glsx.merchants.merchant.saveMerchant' params.method = 'cn.com.glsx.merchants.merchant.saveMerchant'
} else if (editLevel == 3) { } else if (editLevel == 3) {
params.id = id
params.method = 'cn.com.glsx.merchants.merchant.updateMerchant' params.method = 'cn.com.glsx.merchants.merchant.updateMerchant'
} }
// 保存状态 1.草稿 2.发布 3.注销 4.过期 // 保存状态 1.草稿 2.发布 3.注销 4.过期
...@@ -455,18 +454,18 @@ ...@@ -455,18 +454,18 @@
console.log(params) console.log(params)
request(params, function (res) { request(params, function (res) {
console.log(res) console.log(res)
layer.msg('操作成功', {
icon: 1
})
// go('merchant', 'index')
}) })
return false return false
}) })
function findId(nodeList, idList) { function findId(nodeList) {
// var idList = [] var idList = []
$.each(nodeList, function (index, item) { $.each(nodeList, function (index, item) {
if (item.children) {
findId(item.children, idList)
} else {
idList.push(item.id) idList.push(item.id)
}
}) })
return idList return idList
} }
...@@ -500,7 +499,7 @@ ...@@ -500,7 +499,7 @@
var body = layer.getChildFrame('body', index) var body = layer.getChildFrame('body', index)
body.find('#mapBtn').click() body.find('#mapBtn').click()
var res = helper.store.get('merchantMapObj') var res = helper.store.get('merchantMapObj')
console.log(res) // console.log(res)
merchantForm.lat = res.lat merchantForm.lat = res.lat
merchantForm.lng = res.lng merchantForm.lng = res.lng
merchantForm.merchantAddress = res.merchantAddress merchantForm.merchantAddress = res.merchantAddress
...@@ -604,8 +603,20 @@ ...@@ -604,8 +603,20 @@
getChannel() getChannel()
getAccountLevel() getAccountLevel()
getPeriod() getPeriod()
bindEvent()
}
function bindEvent(){
$('#brand').on('input',helper.debounce(function(){
var txt = $(this).val()
if(!txt){
treeObj.showNodes(all_nodes)
}else{
var show_nodes = treeObj.getNodesByParamFuzzy('label',txt)
treeObj.hideNodes(all_nodes)
treeObj.showNodes(show_nodes)
}
},500))
} }
function setCheckbox(checkedStr, attr) { function setCheckbox(checkedStr, attr) {
if (!checkedStr || !checkedStr.length) { if (!checkedStr || !checkedStr.length) {
return false return false
...@@ -616,6 +627,7 @@ ...@@ -616,6 +627,7 @@
} else { } else {
list = checkedStr.split(',') list = checkedStr.split(',')
} }
console.log(list)
$.each(list, function (index, item) { $.each(list, function (index, item) {
$('input[class=' + attr + ']').attr("checked", true) $('input[class=' + attr + ']').attr("checked", true)
}) })
...@@ -633,9 +645,6 @@ ...@@ -633,9 +645,6 @@
getBusiScope() getBusiScope()
getCarBrandTree() getCarBrandTree()
getAccountType() getAccountType()
// if (merchantForm.accountTypes.length) {
// setCheckbox(merchantForm.accountTypes, 'accounttypeId')
// }
}) })
} }
...@@ -652,11 +661,26 @@ ...@@ -652,11 +661,26 @@
request({ request({
method: 'cn.com.glsx.merchants.merchantCommon.getCarbrandTree' method: 'cn.com.glsx.merchants.merchantCommon.getCarbrandTree'
}, function (res) { }, function (res) {
// console.log(res.data)
baseData.carBrandTreeList = res.data baseData.carBrandTreeList = res.data
treeObj = tree.create('carBrandTree', res.data) treeObj = tree.create('carBrandTree', res.data)
all_nodes = treeObj.getNodes()
var checkedList = []
if (editLevel == 3) {
checkedList = merchantForm.merchantBrand.split(',')
}
treeObj = tree.create('carBrandTree', res.data, {
checkedList: checkedList
})
// 修改-回显
// if (editLevel == 3) {
// checkedList = merchantForm.merchantBrand.split(',')
// for (var i = 0; i <= checkedList.length; i++) {
// treeObj.checkNode(treeObj.getNodeByParam("id", checkedList[i]), true)
// }
// }
}) })
} }
// 获取字典数据 // 获取字典数据
function getDictData(dictType, fn) { function getDictData(dictType, fn) {
request({ request({
...@@ -701,17 +725,26 @@ ...@@ -701,17 +725,26 @@
function getBusiScope() { function getBusiScope() {
getDictData('business_scope', function (res) { getDictData('business_scope', function (res) {
baseData.busiScopeList = res.data baseData.busiScopeList = res.data
var checkedList = []
if (editLevel == 3) {
checkedList = merchantForm.businessScope.split(',')
}
var el = $('#busiScopeEl') var el = $('#busiScopeEl')
$.each(baseData.busiScopeList, function (index, item) { $.each(baseData.busiScopeList, function (index, item) {
var optionEl = $('<input type="checkbox" class="businessScope" name="businessScope[' + item var optionEl = $('<input type="checkbox" class="businessScope" name="businessScope[' + item
.dictValue + ']" title=' + .dictValue + ']" title=' +
item.dictLabel + ' value="' + item.dictValue + '" lay-skin="primary">') item.dictLabel + ' value="' + item.dictValue + '" lay-skin="primary">')
el.append(optionEl)
form.render('checkbox')
// 修改-回显 // 修改-回显
if (editLevel == 3 && merchantForm.businessScopName) { if (editLevel == 3) {
setCheckbox(merchantForm.businessScopName, 'businessScope') for (var i = 0; i <= checkedList.length; i++) {
if (checkedList[i] == item.dictValue) {
optionEl.attr("checked", true)
break
} }
}
}
el.append(optionEl)
form.render('checkbox')
}) })
}) })
} }
...@@ -721,17 +754,26 @@ ...@@ -721,17 +754,26 @@
getDictData('account_type', function (res) { getDictData('account_type', function (res) {
// console.log(res.data) // console.log(res.data)
baseData.accountTypeList = res.data baseData.accountTypeList = res.data
var checkedList = []
if (editLevel == 3) {
checkedList = merchantForm.accountType.split(',')
}
var el = $('#accountTypeEl') var el = $('#accountTypeEl')
$.each(baseData.accountTypeList, function (index, item) { $.each(baseData.accountTypeList, function (index, item) {
var optionEl = $('<input type="checkbox" class="accounttypeId" name="accountType[' + item var optionEl = $('<input type="checkbox" class="accounttypeId" name="accountType[' + item
.dictValue + ']" title=' + .dictValue + ']" title=' +
item.dictLabel + ' value="' + item.dictValue + '">') item.dictLabel + ' value="' + item.dictValue + '">')
el.append(optionEl)
form.render('checkbox')
// 修改-回显 // 修改-回显
if (editLevel == 3 && merchantForm.accountTypes.length) { if (editLevel == 3) {
setCheckbox(merchantForm.accountTypes, 'accounttypeId') for (var i = 0; i <= checkedList.length; i++) {
if (checkedList[i] == item.dictValue) {
optionEl.attr("checked", true)
break
} }
}
}
el.append(optionEl)
form.render('checkbox')
}) })
}) })
} }
......
...@@ -26,63 +26,49 @@ ...@@ -26,63 +26,49 @@
<div class="layui-form-item"> <div class="layui-form-item">
<div class="layui-form-label required" style="width: 120px;">账户有效期:</div> <div class="layui-form-label required" style="width: 120px;">账户有效期:</div>
<div class="layui-input-inline" style="width: auto;"> <div class="layui-input-inline" style="width: auto;">
<select name="validPeriod" id="periodSelect" required lay-verify="required"> <select name="effectiveTime" id="periodSelect" required lay-verify="required">
<option value="">请选择</option> <option value="">请选择</option>
</select> </select>
<p>(注:永久有效不超过所属工厂商户的有效期)</p> <p>(注:永久有效不超过所属工厂商户的有效期)</p>
</div> </div>
<button id="periodVerifyBtn" lay-submit lay-filter="periodSubmit" style="display: none;"></button> <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">
<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>
</div>
</div> -->
</div> </div>
</form> </form>
<input type="text" id="isValid" name="isValid" value="no" style="display: none;" class="layui-input">
</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'], function () { layui.use(['form', 'helper', 'request'], 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 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'),
validPeriod: getQueryString('validPeriod') effectiveTime: getQueryString('effectiveTime')
} }
getVaildPeriod() getVaildPeriod()
// form.on('submit(validSubmit)', function (data) {
// var params = {
// id: vaildData.id,
// validPeriod: data.field.validPeriod
// }
// console.log(params)
// // layer.msg('操作成功', { time: 2000 })
// parent.layer.close(currLayerIdx)
// return false
// })
form.on('submit(periodSubmit)', function (data) { form.on('submit(periodSubmit)', function (data) {
// console.log(data) var params = {
// console.log('点击啦---') method: 'cn.com.glsx.merchants.merchant.updateValPerByMerId',
// 调接口 id: vaildData.id,
$('#isValid').attr('value', 'yes') effectiveTime: data.field.effectiveTime
}
request(params, function (res) {
if (res.code == '0') {
helper.store.set('isRefresh', true)
parent.layer.close(currLayerIdx)
}
})
return false return false
}) })
// function callbackdata() {
// return vaildData
// }
// 获取参数 // 获取参数
function getQueryString(name) { function getQueryString(name) {
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i') var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i')
...@@ -100,13 +86,13 @@ ...@@ -100,13 +86,13 @@
dictType: 'account_validity_period' dictType: 'account_validity_period'
}, function (res) { }, function (res) {
if (res.code === '0') { if (res.code === '0') {
baseData.validPeriodList = res.data baseData.effectiveTimeList = res.data
var periodSelect = $('#periodSelect') var periodSelect = $('#periodSelect')
$.each(baseData.validPeriodList, 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', {
validPeriod: vaildData.validPeriod effectiveTime: vaildData.effectiveTime
}) })
form.render('select') form.render('select')
} }
......
...@@ -16,23 +16,28 @@ ...@@ -16,23 +16,28 @@
<div> <div>
<h3 class="content-title">员工基本信息</h3> <h3 class="content-title">员工基本信息</h3>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label required">角色名称:</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="roleName"></div> <div class="layui-form-mid layui-word-aux" id="roleName"></div>
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label required">角色号:</label> <label class="layui-form-label">角色号:</label>
<div class="layui-input-block"> <div class="layui-input-block">
<div class="layui-form-mid layui-word-aux" id="id"></div> <div class="layui-form-mid layui-word-aux" id="id"></div>
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label required">角色说明:</label> <label class="layui-form-label">角色说明:</label>
<div class="layui-input-block"> <div class="layui-input-block">
<div class="layui-form-mid layui-word-aux" id="roleDescription "></div> <div class="layui-form-mid layui-word-aux" id="roleDescription "></div>
</div> </div>
</div> </div>
<h3 class="content-title">角色权限</h3>
<div class="layui-tab" lay-filter="roleAuth">
<ul class="layui-tab-title"></ul>
<div class="layui-tab-content"></div>
</div>
</div> </div>
</main> </main>
</div> </div>
......
...@@ -65,9 +65,9 @@ ...@@ -65,9 +65,9 @@
{ field: 'roleName', title: '角色名称' }, { field: 'roleName', title: '角色名称' },
{ field: 'id', title: '角色号' }, { field: 'id', title: '角色号' },
{ field: 'merchantName', title: '所属商户名' }, { field: 'merchantName', title: '所属商户名' },
{ field: 'delFlag', title: '状态' }, { field: 'statusName', title: '状态' },
{ field: 'createdTime', title: '更新时间' }, { field: 'createdTime', title: '更新时间' },
{ fixed: 'right', title: '操作', width: 280, align: 'center', toolbar: '#roleBar' } { fixed: 'right', title: '操作', width: 160, align: 'center', toolbar: '#roleBar' }
] ]
] ]
}) })
...@@ -77,8 +77,7 @@ ...@@ -77,8 +77,7 @@
var params = helper.clone(false, { var params = helper.clone(false, {
pageNum: table.config.index, pageNum: table.config.index,
pageSize: table.config.limit, pageSize: table.config.limit,
method: 'org.ore.api.role.page', method: 'org.ore.api.role.page'
merchantId: 31
}, search) }, search)
request(params, request(params,
function(res) { function(res) {
...@@ -117,23 +116,36 @@ ...@@ -117,23 +116,36 @@
var layEvent = obj.event var layEvent = obj.event
var tr = obj.tr var tr = obj.tr
if (layEvent === 'detail') { if (layEvent === 'detail') {
go('merchant', 'detail', {id: data.id}) go('role', 'detail', {id: data.id})
} else if (layEvent === 'edit') { } else if (layEvent === 'edit') {
go('role', 'add', {id: 1}) var params = { id: data.id, merchantId: data.merchantId }
go('role', 'add', params)
} else if (layEvent === 'del') { } else if (layEvent === 'del') {
layer.confirm('真的删除行么', function(index) { layer.confirm('真的删除行么', function(index) {
// obj.del() //删除对应行(tr)的DOM结构,并更新缓存 // 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) layer.close(index)
console.log('shanchu') console.log('shanchu')
getTabelList(employeeTable) getTabelList(roleTable)
//向服务端发送删除指令 }
})
}) })
} }
}) })
// 新增点击事件 // 新增点击事件
$(document).on('click', '#addRole', function() { $('#addRole').on('click', function() {
console.log('创建') var value = merchantName.val()
go('role', 'add') var params = { merchantId: value }
if (value) {
go('role', 'add', params)
} else {
layer.msg('请选择商户')
}
}) })
// 查询事件 // 查询事件
$(document).on('click', '#roleSearch', function() { $(document).on('click', '#roleSearch', function() {
......
<!DOCTYPE html>
<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>
<div id="app">
<main>fdasfda</main>
</div>
<script src="https://www.layuicdn.com/layui/layui.js"></script>
<script src="/js/load.js"></script>
<script>
console.log(qs('id'))
</script>
</body>
</html>
...@@ -11,7 +11,7 @@ layui.define(['ztree'], function (exports) { ...@@ -11,7 +11,7 @@ layui.define(['ztree'], function (exports) {
var $ = layui.$ var $ = layui.$
var tree = layui.ztree var tree = layui.ztree
function onNodeCreated(event, treeId, treeNode) { function onNodeCreated(event, treeId, treeNode) {
if (treeNode.logo == 'PR') { if (treeNode.logo == 'function') {
var tId = treeNode.getParentNode().tId var tId = treeNode.getParentNode().tId
var $parentUl = $('#' + tId + '_ul') var $parentUl = $('#' + tId + '_ul')
if (!$parentUl.hasClass('pr-parent-ul')) { if (!$parentUl.hasClass('pr-parent-ul')) {
...@@ -21,8 +21,14 @@ layui.define(['ztree'], function (exports) { ...@@ -21,8 +21,14 @@ layui.define(['ztree'], function (exports) {
$switchs.not(':eq(0)').addClass('op0') $switchs.not(':eq(0)').addClass('op0')
} }
} }
if (gtree.opt && gtree.opt.onNodeCreated) { if (gtree.opt && gtree.opt.checkedList) {
gtree.opt.onNodeCreated(event, treeId, treeNode) var p = gtree.opt.checkedList
if (p.indexOf(treeNode.id) != -1) {
treeNode.checked = true
if (inst) {
inst.updateNode(treeNode)
}
}
} }
} }
var setting = { var setting = {
...@@ -53,6 +59,7 @@ layui.define(['ztree'], function (exports) { ...@@ -53,6 +59,7 @@ layui.define(['ztree'], function (exports) {
$treeDom.addClass('ztree') $treeDom.addClass('ztree')
if (check == 0) setting.check.enable = false if (check == 0) setting.check.enable = false
inst = tree.init($treeDom, setting, nodes) inst = tree.init($treeDom, setting, nodes)
inst.expandAll(true)
return inst return inst
} }
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @Author: limin * @Author: limin
* @Date: 2021-07-21 17:20:56 * @Date: 2021-07-21 17:20:56
* @LastEditors: limin * @LastEditors: limin
* @LastEditTime: 2021-07-22 16:52:46 * @LastEditTime: 2021-08-06 16:47:13
* @FilePath: \account\js\helper.js * @FilePath: \account\js\helper.js
*/ */
layui.define(['store'], function (exports) { layui.define(['store'], function (exports) {
...@@ -39,8 +39,22 @@ layui.define(['store'], function (exports) { ...@@ -39,8 +39,22 @@ layui.define(['store'], function (exports) {
} }
return extended return extended
} }
function debounce(fun, delay) {
return function (args) {
//获取函数的作用域和变量
let that = this
let _args = args
//每次事件被触发,都会清除当前的timeer,然后重写设置超时调用
clearTimeout(fun.id)
fun.id = setTimeout(function () {
fun.call(that, _args)
}, delay)
}
}
exports('helper', { exports('helper', {
clone: clone, clone: clone,
store: layui.store store: layui.store,
debounce: debounce
}) })
}) })
...@@ -27,6 +27,8 @@ function goLogin() { ...@@ -27,6 +27,8 @@ function goLogin() {
function loadLayConfig() { function loadLayConfig() {
layui.config({ layui.config({
base: '/js/' base: '/js/'
}).extend({
xmSelect: 'xm-select'
}) })
} }
function loadHeaderFooter() { function loadHeaderFooter() {
...@@ -44,6 +46,11 @@ function append() { ...@@ -44,6 +46,11 @@ function append() {
function isAppend() { function isAppend() {
var _href = location.href.split('/') var _href = location.href.split('/')
var _path = _href.slice(_href.length - 1, _href.length).toString() var _path = _href.slice(_href.length - 1, _href.length).toString()
layui.use(['store'], function () {
var store = layui.store
// isDxternal: true - 外部独立系统;false - 运营平台
store.set('isDxternal', _path.split('?')[0] !== 'login.html' && self == top)
})
return _path.split('?')[0] !== 'login.html' && self == top return _path.split('?')[0] !== 'login.html' && self == top
} }
......
...@@ -52,11 +52,15 @@ layui.define(['sha1', 'md5', 'helper'], function (exports) { ...@@ -52,11 +52,15 @@ layui.define(['sha1', 'md5', 'helper'], function (exports) {
} }
} }
function request(params, success, config, noSignAttr = [], isOtherUrl = false) { function request(params, success, config, noSignAttr, isOtherUrl) {
noSignAttr = noSignAttr || []
params = params || {} params = params || {}
config = config || {} config = config || {}
var common = store.getEx('external') var common = store.getEx('external')
var settings = helper.clone(true, defaultSettings) var settings = helper.clone(true, defaultSettings)
if (isOtherUrl) {
delete settings.beforeSend
}
var data = helper.clone(true, { var data = helper.clone(true, {
timestamp: new Date().getTime() timestamp: new Date().getTime()
}, common.params, params) }, common.params, params)
...@@ -86,12 +90,15 @@ layui.define(['sha1', 'md5', 'helper'], function (exports) { ...@@ -86,12 +90,15 @@ layui.define(['sha1', 'md5', 'helper'], function (exports) {
return $.ajax(settings) return $.ajax(settings)
} }
function sign(params, secret, noSignAttr = [], isMd5 = false) { function sign(params, secret, noSignAttr, isMd5) {
noSignAttr = noSignAttr || []
if (!params || $.isEmptyObject(params)) { if (!params || $.isEmptyObject(params)) {
return '' return ''
} }
delete params.sign delete params.sign
var arr = [] var arr = []
var secretArr = []
for (var key in params) { for (var key in params) {
var isPush = false var isPush = false
$.each(noSignAttr, function (index, item) { $.each(noSignAttr, function (index, item) {
...@@ -100,12 +107,17 @@ layui.define(['sha1', 'md5', 'helper'], function (exports) { ...@@ -100,12 +107,17 @@ layui.define(['sha1', 'md5', 'helper'], function (exports) {
} }
}) })
if (!isPush) { if (!isPush) {
arr.push(key + params[key]) arr.push(key)
}
} }
arr.sort()
for (var key in arr) {
var val = arr[key]
secretArr.push(val + params[val])
} }
var str = arr.sort().join('') var str = secretArr.join('')
return isMd5 ? md5(secret + str + secret).toUpperCase() : SHA1(secret + str + secret).toUpperCase() return isMd5 ? md5(secret + str + secret).toUpperCase() : SHA1(secret + str + secret).toUpperCase()
return SHA1(secret + str + secret).toUpperCase() // return SHA1(secret + str + secret).toUpperCase()
} }
function msg(msg) { function msg(msg) {
......
...@@ -66,6 +66,7 @@ ...@@ -66,6 +66,7 @@
if (result.code == '0') { if (result.code == '0') {
var sessionId = result.data.sessionId var sessionId = result.data.sessionId
helper.store.set('token', sessionId) helper.store.set('token', sessionId)
helper.store.set('user', result.data)
go('merchant', 'index') go('merchant', 'index')
} }
}) })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!