Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
h5
/
account
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit ba909778
authored
Aug 06, 2021
by
limin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
新增树过滤
1 parent
789635c5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
5 deletions
html/merchant/edit.html
js/helper.js
js/ztree.js
html/merchant/edit.html
View file @
ba90977
...
...
@@ -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
...
...
@@ -582,8 +583,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
...
...
@@ -633,9 +646,9 @@
},
function
(
res
)
{
baseData
.
carBrandTreeList
=
res
.
data
treeObj
=
tree
.
create
(
'carBrandTree'
,
res
.
data
)
all_nodes
=
treeObj
.
getNodes
()
})
}
// 获取字典数据
function
getDictData
(
dictType
,
fn
)
{
request
({
...
...
js/helper.js
View file @
ba90977
...
...
@@ -4,7 +4,7 @@
* @Author: limin
* @Date: 2021-07-21 17:20:56
* @LastEditors: limin
* @LastEditTime: 2021-0
7-22 16:52:46
* @LastEditTime: 2021-0
8-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
})
})
js/ztree.js
View file @
ba90977
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment