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 4e4076e9
authored
Aug 06, 2021
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'master' of 192.168.3.233:h5/account
2 parents
7de4d61a
c37b9679
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
4 deletions
html/merchant/edit.html
js/helper.js
js/ztree.js
html/merchant/edit.html
View file @
4e4076e
...
...
@@ -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
({
...
...
js/helper.js
View file @
4e4076e
...
...
@@ -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 @
4e4076e
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