Commit 4e4076e9 by 胡悦

Merge branch 'master' of 192.168.3.233:h5/account

2 parents 7de4d61a c37b9679
......@@ -193,7 +193,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>
......@@ -283,6 +283,7 @@
var editData = {}
var scopeIdx = 1
var treeObj = null
var all_nodes = []
// 1-创建新商户;2-创建子商户;3-修改
var editLevel = 1
var id = null
......@@ -585,6 +586,34 @@
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
}
var list = []
if (layui._isArray(checkedStr)) {
list = checkedStr
} else {
list = checkedStr.split(',')
}
console.log(list)
$.each(list, function (index, item) {
$('input[class=' + attr + ']').attr("checked", true)
})
}
// 获取商户信息
......@@ -617,6 +646,8 @@
}, 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(',')
......@@ -633,7 +664,6 @@
// }
})
}
// 获取字典数据
function getDictData(dictType, fn) {
request({
......
......@@ -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
})
})
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!