Commit b68230a6 by 李长胜

2021-08-06 样式修改

2 parents 973ce8f3 4e4076e9
......@@ -35,7 +35,8 @@
var _href = '/html/' + _path
$('.header-nav-item').each(function (i, e) {
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')
return false
}
......
......@@ -103,21 +103,18 @@
<div class="layui-input-block">
<div class="upload-img-box">
<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"
class="upload upload-img-box upload-img-wh" accept="image/png, image/jpeg, image/gif, image/jpg"
data-idx="0" style="opacity: 0;">
</div>
<span class="tips">图片格式仅支持JPG,PNG格式,大小1M以内</span>
<!-- <div class="layui-upload-img" id="uploadImg">
<i class="layui-icon">&#xe624;</i>
</div> -->
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">邮箱:</label>
<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>
......@@ -142,7 +139,9 @@
//Demo
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 upload = layui.upload
var tree = layui.gtree
......@@ -150,18 +149,14 @@
var helper = layui.helper
var $ = layui.$
var merchantFileRequest = {}
var id = null
var employeeForm = {}
var pwd = $('#password') // 密码输入框
var resetpsw = $('#resetpsw')
pwd.attr('readonly', false)
if (qs('id')) {
id = qs('id')
if (id) {
resetpsw.removeClass('hide')
resetpsw.addClass('show')
} else {
// resetpsw.addClass('hide')
}
// 重置密码
resetpsw.on('click', function() {
......@@ -173,7 +168,7 @@
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) {
if (res.code == '0') {
var list = res.data
......@@ -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 = {}
request(visibleMerchantParams, function(res) {
if (res.code == '0') {
if (id) {
getById(function(p) {
visibleMerchant = tree.create('visibleInferiorMerTree', res.data, { onNodeCreated: function(event, treeId, treeNode) {
if (p.indexOf(treeNode.id+'') != -1) {
treeNode.checked = true
visibleMerchant.updateNode(treeNode);
}
}})
visibleMerchant.expandAll(true)
getById(function(checkedList) {
visibleMerchant = tree.create('visibleInferiorMerTree', res.data, {checkedList: checkedList}
// { onNodeCreated: function(event, treeId, treeNode) {
// if (p.indexOf(treeNode.id+'') != -1) {
// treeNode.checked = true
// visibleMerchant.updateNode(treeNode);
// }
// }}
)
})
} else {
visibleMerchant = tree.create('visibleInferiorMerTree', res.data)
visibleMerchant.expandAll(true)
}
}
})
......@@ -221,11 +216,13 @@
staffPhone: data.staffPhone,
password: data.password,
// visibleInferiorMer: "1",
roleIds: data.roleIds.join(''),
roleIds: +data.roleIds.join(''),
staffEmail: data.staffEmail,
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 addEl = $('.img-add')
imgEl.attr('src', merchantFileRequest.fileUrl)
......@@ -233,8 +230,8 @@
imgEl.addClass('show')
addEl.removeClass('show')
addEl.addClass('hide')
// var visibleInferiorMerArr = data.visibleInferiorMer.split(',')
var visibleInferiorMerArr = "34,38".split(',')
var visibleInferiorMerArr = data.visibleInferiorMer.split(',')
// var visibleInferiorMerArr = [32, 38]
callback(visibleInferiorMerArr)
}
console.log(employeeForm)
......@@ -282,12 +279,22 @@
}).join(',')
var otherParams = {
visibleInferiorMer: visibleInferiorMer,
merchantFileRequest: JSON.stringify(merchantFileRequest)
// merchantFileRequest: JSON.stringify(merchantFileRequest),
merchantId: merchantId
}
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, { method: 'cn.com.glsx.merchants.staff.saveStaff', merchantId: 31 }, data.field, otherParams)
var params = helper.clone(true, data.field, otherParams)
request(params, function (result) {
if (result.code == '0') {
window.history.back()
// window.history.back()
layer.msg('操作成功', {
icon: 1
})
......
<!DOCTYPE html>
<html lang="zh">
<<<<<<< HEAD
<head>
<meta charset="utf-8" />
......@@ -39,6 +40,43 @@
<i class="layui-icon layui-icon-add-circle"></i>
创建员工
</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>
<label class="layui-form-label">商户名称</label>
<div class="layui-input-block">
<select name="merchantId" id="merchantName" lay-verify="required">
</select>
</div>
</div>
</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="请输入创建者" autocomplete="off" class="layui-input" />
</div>
</div>
>>>>>>> 4e4076e9661f54b986fc5b70d941ec0e9eaa1bf3
<div class="layui-inline" pane>
<label class="layui-form-label">商户名称</label>
<div class="layui-input-block">
......@@ -46,12 +84,26 @@
</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="请输入创建者"
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 class="layui-inline" pane>
......@@ -64,6 +116,7 @@
<option value="2">已注销</option>
</select>
</div>
<<<<<<< HEAD
</div>
<div class="layui-inline" pane>
<div class="layui-input-inline">
......@@ -141,6 +194,69 @@
if (isResetPageNum) {
options.page = {
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)
......@@ -178,13 +294,34 @@
method: 'cn.com.glsx.merchants.staff.deleteStaff',
id: data.id
}
<<<<<<< HEAD
request(params, function (res) {
if (res.code == '0') {
layer.close(index)
console.log('shanchu')
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') {
......@@ -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 () {
......
......@@ -26,7 +26,7 @@
<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="validPeriod" id="periodSelect" required lay-verify="required">
<select name="effectiveTime" id="periodSelect" required lay-verify="required">
<option value="">请选择</option>
</select>
<p>(注:永久有效不超过所属工厂商户的有效期)</p>
......@@ -40,21 +40,22 @@
</div> -->
</div>
</form>
<input type="text" id="isValid" name="isValid" value="no" style="display: none;" class="layui-input">
</main>
</div>
<script src="https://www.layuicdn.com/layui/layui.js"></script>
<script src="/js/load.js"></script>
<script>
layui.use(['form', 'request'], function () {
layui.use(['form', 'request', 'helper'], function () {
var form = layui.form
var request = layui.request
var $ = layui.$
var helper = layui.helper
var currLayerIdx = parent.layer.getFrameIndex(window.name)
var baseData = {}
var vaildData = {
id: getQueryString('id')
id: getQueryString('id'),
effectiveTime: getQueryString('effectiveTime')
}
......@@ -64,28 +65,17 @@
// 调接口
var params = {
method: 'cn.com.glsx.merchants.staff.updateValPerByStaffId',
effectiveTime: data.field.validPeriod,
effectiveTime: data.field.effectiveTime,
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) {
if (res.code == '0') {
callback(true)
helper.store.set('isRefresh', true)
parent.layer.close(currLayerIdx)
}
})
}
// function callbackdata() {
// return vaildData
// }
return false
})
// 获取参数
function getQueryString(name) {
......@@ -104,13 +94,13 @@
dictType: 'staff_validity_period'
}, function (res) {
if (res.code === '0') {
baseData.validPeriodList = res.data
baseData.effectiveTimeList = res.data
var periodSelect = $('#periodSelect')
$.each(baseData.validPeriodList, function (index, item) {
$.each(baseData.effectiveTimeList, function (index, item) {
periodSelect.append(new Option(item.dictLabel, item.dictValue))
})
form.val('periodFilter', {
validPeriod: vaildData.validPeriod
effectiveTime: vaildData.effectiveTime
})
form.render('select')
}
......
......@@ -210,7 +210,7 @@
<div class="layui-form-item">
<label class="layui-form-label">主营品牌:</label>
<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>
</div>
......@@ -300,6 +300,7 @@
var editData = {}
var scopeIdx = 1
var treeObj = null
var all_nodes = []
// 1-创建新商户;2-创建子商户;3-修改
var editLevel = 1
var id = null
......@@ -370,6 +371,7 @@
helper.store.set('merchantMapObj', merchantForm)
form.on('submit(handleSubmit)', function (data) {
console.log(editLevel)
// console.log(data.field)
var formData = data.field
var params = {
......@@ -382,7 +384,7 @@
'merchantAccountLevel', 'effectiveTime'
]
if (formData.isloginName == 'on') {
formData.isloginName = 1
params.isloginName = 1
}
if (formData.bussinessBegintime) {
merchantForm.bussinessBegintime = new Date(formData.bussinessBegintime)
......@@ -409,8 +411,6 @@
}, {
attr: 'accounttypeId',
toString: ','
// toString: false,
// toArray: true
}]
$.each(checkClassNameList, function (index, item) {
var checkedArr = []
......@@ -422,10 +422,6 @@
merchantForm[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')
......@@ -436,13 +432,16 @@
merchantForm.businessScopeCustomize = tempList.join(',')
params.businessScopeCustomize = tempList.join(',')
merchantForm.merchantBrand = treeObj.getCheckedNodes(true)
params.merchantBrand = findId(merchantForm.merchantBrand, []).join(',')
params.merchantFiles = JSON.stringify(merchantForm.merchantFiles)
params.merchantBrand = findId(merchantForm.merchantBrand).join(',')
if (merchantForm.merchantFiles.length) {
params.merchantFiles = JSON.stringify(merchantForm.merchantFiles)
}
if (editLevel == 1) {
params.method = 'cn.com.glsx.merchants.merchant.saveMerchant'
} else if (editLevel == 2) {
params.method = 'cn.com.glsx.merchants.merchant.saveMerchant'
} else if (editLevel == 3) {
params.id = id
params.method = 'cn.com.glsx.merchants.merchant.updateMerchant'
}
// 保存状态 1.草稿 2.发布 3.注销 4.过期
......@@ -455,18 +454,18 @@
console.log(params)
request(params, function (res) {
console.log(res)
layer.msg('操作成功', {
icon: 1
})
// go('merchant', 'index')
})
return false
})
function findId(nodeList, idList) {
// var idList = []
function findId(nodeList) {
var idList = []
$.each(nodeList, function (index, item) {
if (item.children) {
findId(item.children, idList)
} else {
idList.push(item.id)
}
idList.push(item.id)
})
return idList
}
......@@ -500,7 +499,7 @@
var body = layer.getChildFrame('body', index)
body.find('#mapBtn').click()
var res = helper.store.get('merchantMapObj')
console.log(res)
// console.log(res)
merchantForm.lat = res.lat
merchantForm.lng = res.lng
merchantForm.merchantAddress = res.merchantAddress
......@@ -604,8 +603,20 @@
getChannel()
getAccountLevel()
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) {
if (!checkedStr || !checkedStr.length) {
return false
......@@ -616,6 +627,7 @@
} else {
list = checkedStr.split(',')
}
console.log(list)
$.each(list, function (index, item) {
$('input[class=' + attr + ']').attr("checked", true)
})
......@@ -633,9 +645,6 @@
getBusiScope()
getCarBrandTree()
getAccountType()
// if (merchantForm.accountTypes.length) {
// setCheckbox(merchantForm.accountTypes, 'accounttypeId')
// }
})
}
......@@ -652,11 +661,26 @@
request({
method: 'cn.com.glsx.merchants.merchantCommon.getCarbrandTree'
}, function (res) {
// console.log(res.data)
baseData.carBrandTreeList = 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) {
request({
......@@ -701,17 +725,26 @@
function getBusiScope() {
getDictData('business_scope', function (res) {
baseData.busiScopeList = res.data
var checkedList = []
if (editLevel == 3) {
checkedList = merchantForm.businessScope.split(',')
}
var el = $('#busiScopeEl')
$.each(baseData.busiScopeList, function (index, item) {
var optionEl = $('<input type="checkbox" class="businessScope" name="businessScope[' + item
.dictValue + ']" title=' +
item.dictLabel + ' value="' + item.dictValue + '" lay-skin="primary">')
el.append(optionEl)
form.render('checkbox')
// 修改-回显
if (editLevel == 3 && merchantForm.businessScopName) {
setCheckbox(merchantForm.businessScopName, 'businessScope')
if (editLevel == 3) {
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 @@
getDictData('account_type', function (res) {
// console.log(res.data)
baseData.accountTypeList = res.data
var checkedList = []
if (editLevel == 3) {
checkedList = merchantForm.accountType.split(',')
}
var el = $('#accountTypeEl')
$.each(baseData.accountTypeList, function (index, item) {
var optionEl = $('<input type="checkbox" class="accounttypeId" name="accountType[' + item
.dictValue + ']" title=' +
item.dictLabel + ' value="' + item.dictValue + '">')
el.append(optionEl)
form.render('checkbox')
// 修改-回显
if (editLevel == 3 && merchantForm.accountTypes.length) {
setCheckbox(merchantForm.accountTypes, 'accounttypeId')
if (editLevel == 3) {
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 @@
<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="validPeriod" id="periodSelect" required lay-verify="required">
<select name="effectiveTime" id="periodSelect" required lay-verify="required">
<option value="">请选择</option>
</select>
<p>(注:永久有效不超过所属工厂商户的有效期)</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">
<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>
</form>
<input type="text" id="isValid" name="isValid" value="no" style="display: none;" class="layui-input">
</main>
</div>
<script src="https://www.layuicdn.com/layui/layui.js"></script>
<script src="/js/load.js"></script>
<script>
layui.use(['form', 'request'], function () {
layui.use(['form', 'helper', 'request'], function () {
var form = layui.form
var request = layui.request
var $ = layui.$
var helper = layui.helper
var currLayerIdx = parent.layer.getFrameIndex(window.name)
var baseData = {}
var vaildData = {
id: getQueryString('id'),
validPeriod: getQueryString('validPeriod')
effectiveTime: getQueryString('effectiveTime')
}
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) {
// console.log(data)
// console.log('点击啦---')
// 调接口
$('#isValid').attr('value', 'yes')
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)
}
})
return false
})
// function callbackdata() {
// return vaildData
// }
// 获取参数
function getQueryString(name) {
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i')
......@@ -100,13 +86,13 @@
dictType: 'account_validity_period'
}, function (res) {
if (res.code === '0') {
baseData.validPeriodList = res.data
baseData.effectiveTimeList = res.data
var periodSelect = $('#periodSelect')
$.each(baseData.validPeriodList, function (index, item) {
$.each(baseData.effectiveTimeList, function (index, item) {
periodSelect.append(new Option(item.dictLabel, item.dictValue))
})
form.val('periodFilter', {
validPeriod: vaildData.validPeriod
effectiveTime: vaildData.effectiveTime
})
form.render('select')
}
......
......@@ -16,23 +16,28 @@
<div>
<h3 class="content-title">员工基本信息</h3>
<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-form-mid layui-word-aux" id="roleName"></div>
</div>
</div>
<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-form-mid layui-word-aux" id="id"></div>
</div>
</div>
<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-form-mid layui-word-aux" id="roleDescription "></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>
</main>
</div>
......
......@@ -65,9 +65,9 @@
{ field: 'roleName', title: '角色名称' },
{ field: 'id', title: '角色号' },
{ field: 'merchantName', title: '所属商户名' },
{ field: 'delFlag', title: '状态' },
{ field: 'statusName', 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 @@
var params = helper.clone(false, {
pageNum: table.config.index,
pageSize: table.config.limit,
method: 'org.ore.api.role.page',
merchantId: 31
method: 'org.ore.api.role.page'
}, search)
request(params,
function(res) {
......@@ -117,23 +116,36 @@
var layEvent = obj.event
var tr = obj.tr
if (layEvent === 'detail') {
go('merchant', 'detail', {id: data.id})
go('role', 'detail', {id: data.id})
} 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') {
layer.confirm('真的删除行么', function(index) {
// obj.del() //删除对应行(tr)的DOM结构,并更新缓存
layer.close(index)
console.log('shanchu')
getTabelList(employeeTable)
//向服务端发送删除指令
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)
}
})
})
}
})
// 新增点击事件
$(document).on('click', '#addRole', function() {
console.log('创建')
go('role', 'add')
$('#addRole').on('click', function() {
var value = merchantName.val()
var params = { merchantId: value }
if (value) {
go('role', 'add', params)
} else {
layer.msg('请选择商户')
}
})
// 查询事件
$(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) {
var $ = layui.$
var tree = layui.ztree
function onNodeCreated(event, treeId, treeNode) {
if (treeNode.logo == 'PR') {
if (treeNode.logo == 'function') {
var tId = treeNode.getParentNode().tId
var $parentUl = $('#' + tId + '_ul')
if (!$parentUl.hasClass('pr-parent-ul')) {
......@@ -21,8 +21,14 @@ layui.define(['ztree'], function (exports) {
$switchs.not(':eq(0)').addClass('op0')
}
}
if (gtree.opt && gtree.opt.onNodeCreated) {
gtree.opt.onNodeCreated(event, treeId, treeNode)
if (gtree.opt && gtree.opt.checkedList) {
var p = gtree.opt.checkedList
if (p.indexOf(treeNode.id) != -1) {
treeNode.checked = true
if (inst) {
inst.updateNode(treeNode)
}
}
}
}
var setting = {
......@@ -53,6 +59,7 @@ layui.define(['ztree'], function (exports) {
$treeDom.addClass('ztree')
if (check == 0) setting.check.enable = false
inst = tree.init($treeDom, setting, nodes)
inst.expandAll(true)
return inst
}
}
......
......@@ -4,7 +4,7 @@
* @Author: limin
* @Date: 2021-07-21 17:20:56
* @LastEditors: limin
* @LastEditTime: 2021-07-22 16:52:46
* @LastEditTime: 2021-08-06 16:47:13
* @FilePath: \account\js\helper.js
*/
layui.define(['store'], function (exports) {
......@@ -39,8 +39,22 @@ layui.define(['store'], function (exports) {
}
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', {
clone: clone,
store: layui.store
store: layui.store,
debounce: debounce
})
})
......@@ -27,6 +27,8 @@ function goLogin() {
function loadLayConfig() {
layui.config({
base: '/js/'
}).extend({
xmSelect: 'xm-select'
})
}
function loadHeaderFooter() {
......@@ -44,6 +46,11 @@ function append() {
function isAppend() {
var _href = location.href.split('/')
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
}
......
......@@ -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 || {}
config = config || {}
var common = store.getEx('external')
var settings = helper.clone(true, defaultSettings)
if (isOtherUrl) {
delete settings.beforeSend
}
var data = helper.clone(true, {
timestamp: new Date().getTime()
}, common.params, params)
......@@ -86,12 +90,15 @@ layui.define(['sha1', 'md5', 'helper'], function (exports) {
return $.ajax(settings)
}
function sign(params, secret, noSignAttr = [], isMd5 = false) {
function sign(params, secret, noSignAttr, isMd5) {
noSignAttr = noSignAttr || []
if (!params || $.isEmptyObject(params)) {
return ''
}
delete params.sign
var arr = []
var secretArr = []
for (var key in params) {
var isPush = false
$.each(noSignAttr, function (index, item) {
......@@ -100,12 +107,17 @@ layui.define(['sha1', 'md5', 'helper'], function (exports) {
}
})
if (!isPush) {
arr.push(key + params[key])
arr.push(key)
}
}
var str = arr.sort().join('')
arr.sort()
for (var key in arr) {
var val = arr[key]
secretArr.push(val + params[val])
}
var str = secretArr.join('')
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) {
......
......@@ -66,6 +66,7 @@
if (result.code == '0') {
var sessionId = result.data.sessionId
helper.store.set('token', sessionId)
helper.store.set('user', result.data)
go('merchant', 'index')
}
})
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!