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 276d0a3f
authored
Nov 10, 2023
by
前端
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修复bug
1 parent
4ba63d13
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
166 additions
and
85 deletions
html/merchant/add.html
html/merchant/addSubMerchant.html
html/merchant/edit.html
html/merchant/add.html
View file @
276d0a3
...
@@ -1445,23 +1445,72 @@
...
@@ -1445,23 +1445,72 @@
}
}
}
}
// function bindEvent() {
// $('#brand').on(
// 'input',
// helper.debounce(function () {
// var txt = $(this).val()
// if (!txt) {
// treeObj.showNodes(all_nodes)
// } else {
// var nodesList = treeObj.getNodesByParamFuzzy('label', txt)
// show_nodes = helper.findShowNode(nodesList, all_nodes)
// treeObj.hideNodes(all_nodes)
// treeObj.showNodes(show_nodes)
// }
// }, 500)
// )
// }
function
bindEvent
()
{
function
bindEvent
()
{
$
(
'#brand'
).
on
(
$
(
'#brand'
).
on
(
'input'
,
'input'
,
helper
.
debounce
(
function
()
{
helper
.
debounce
(
function
()
{
var
txt
=
$
(
this
).
val
()
var
txt
=
$
(
this
).
val
();
if
(
!
txt
)
{
if
(
!
txt
)
{
treeObj
.
showNodes
(
all_nodes
)
treeObj
.
showNodes
(
all_nodes
);
}
else
{
}
else
{
var
nodesList
=
treeObj
.
getNodesByParamFuzzy
(
'label'
,
txt
)
var
nodesList
=
treeObj
.
getNodesByParamFuzzy
(
'label'
,
txt
);
show_nodes
=
helper
.
findShowNode
(
nodesList
,
all_nodes
)
treeObj
.
hideNodes
(
all_nodes
)
var
showNodes
=
[];
treeObj
.
showNodes
(
show_nodes
)
nodesList
.
forEach
(
function
(
node
)
{
showNodes
.
push
(
node
);
// 把当前匹配的节点加入显示列表
// 如果匹配的节点有父节点,也将其父节点加入显示列表
var
parentNode
=
node
.
getParentNode
();
if
(
parentNode
&&
showNodes
.
indexOf
(
parentNode
)
===
-
1
)
{
showNodes
.
push
(
parentNode
);
}
// 如果匹配的是一级菜单节点,同时把它的所有子节点加入显示列表
if
(
!
parentNode
&&
node
.
children
)
{
showNodes
=
showNodes
.
concat
(
node
.
children
);
}
});
// 去除重复节点
showNodes
=
uniqueNodes
(
showNodes
);
// 先隐藏所有节点,再显示匹配的节点及其相关的父或子节点
treeObj
.
hideNodes
(
all_nodes
);
treeObj
.
showNodes
(
showNodes
);
}
}
},
500
)
},
500
)
)
);
}
// unique 方法用于确保没有重复的节点
function
uniqueNodes
(
nodes
)
{
var
uniqueNodes
=
[];
var
uniqueKeys
=
{};
nodes
.
forEach
(
function
(
node
)
{
if
(
!
uniqueKeys
[
node
.
tId
])
{
uniqueKeys
[
node
.
tId
]
=
true
;
uniqueNodes
.
push
(
node
);
}
}
});
return
uniqueNodes
;
};
function
setCheckbox
(
checkedStr
,
attr
)
{
function
setCheckbox
(
checkedStr
,
attr
)
{
if
(
!
checkedStr
||
!
checkedStr
.
length
)
{
if
(
!
checkedStr
||
!
checkedStr
.
length
)
{
return
false
return
false
...
...
html/merchant/addSubMerchant.html
View file @
276d0a3
...
@@ -1444,22 +1444,71 @@
...
@@ -1444,22 +1444,71 @@
}
}
}
}
// function bindEvent() {
// $('#brand').on(
// 'input',
// helper.debounce(function () {
// var txt = $(this).val()
// if (!txt) {
// treeObj.showNodes(all_nodes)
// } else {
// var nodesList = treeObj.getNodesByParamFuzzy('label', txt)
// show_nodes = helper.findShowNode(nodesList, all_nodes)
// treeObj.hideNodes(all_nodes)
// treeObj.showNodes(show_nodes)
// }
// }, 500)
// )
// }
function
bindEvent
()
{
function
bindEvent
()
{
$
(
'#brand'
).
on
(
$
(
'#brand'
).
on
(
'input'
,
'input'
,
helper
.
debounce
(
function
()
{
helper
.
debounce
(
function
()
{
var
txt
=
$
(
this
).
val
()
var
txt
=
$
(
this
).
val
();
if
(
!
txt
)
{
if
(
!
txt
)
{
treeObj
.
showNodes
(
all_nodes
)
treeObj
.
showNodes
(
all_nodes
);
}
else
{
}
else
{
var
nodesList
=
treeObj
.
getNodesByParamFuzzy
(
'label'
,
txt
)
var
nodesList
=
treeObj
.
getNodesByParamFuzzy
(
'label'
,
txt
);
show_nodes
=
helper
.
findShowNode
(
nodesList
,
all_nodes
)
treeObj
.
hideNodes
(
all_nodes
)
var
showNodes
=
[];
treeObj
.
showNodes
(
show_nodes
)
nodesList
.
forEach
(
function
(
node
)
{
showNodes
.
push
(
node
);
// 把当前匹配的节点加入显示列表
// 如果匹配的节点有父节点,也将其父节点加入显示列表
var
parentNode
=
node
.
getParentNode
();
if
(
parentNode
&&
showNodes
.
indexOf
(
parentNode
)
===
-
1
)
{
showNodes
.
push
(
parentNode
);
}
// 如果匹配的是一级菜单节点,同时把它的所有子节点加入显示列表
if
(
!
parentNode
&&
node
.
children
)
{
showNodes
=
showNodes
.
concat
(
node
.
children
);
}
});
// 去除重复节点
showNodes
=
uniqueNodes
(
showNodes
);
// 先隐藏所有节点,再显示匹配的节点及其相关的父或子节点
treeObj
.
hideNodes
(
all_nodes
);
treeObj
.
showNodes
(
showNodes
);
}
}
},
500
)
},
500
)
)
);
}
// unique 方法用于确保没有重复的节点
function
uniqueNodes
(
nodes
)
{
var
uniqueNodes
=
[];
var
uniqueKeys
=
{};
nodes
.
forEach
(
function
(
node
)
{
if
(
!
uniqueKeys
[
node
.
tId
])
{
uniqueKeys
[
node
.
tId
]
=
true
;
uniqueNodes
.
push
(
node
);
}
}
});
return
uniqueNodes
;
};
function
setCheckbox
(
checkedStr
,
attr
)
{
function
setCheckbox
(
checkedStr
,
attr
)
{
if
(
!
checkedStr
||
!
checkedStr
.
length
)
{
if
(
!
checkedStr
||
!
checkedStr
.
length
)
{
...
...
html/merchant/edit.html
View file @
276d0a3
...
@@ -1426,90 +1426,73 @@
...
@@ -1426,90 +1426,73 @@
}
}
}
}
// function bindEvent() {
// $('#brand').on(
// 'input',
// helper.debounce(function () {
// var txt = $(this).val()
// if (!txt) {
// treeObj.showNodes(all_nodes)
// } else {
// var nodesList = treeObj.getNodesByParamFuzzy('label', txt)
// show_nodes = helper.findShowNode(nodesList, all_nodes)
// console.log(show_nodes)
// treeObj.hideNodes(all_nodes)
// treeObj.showNodes(show_nodes)
// }
// }, 500)
// )
// }
function
bindEvent
()
{
function
bindEvent
()
{
$
(
'#brand'
).
on
(
$
(
'#brand'
).
on
(
'input'
,
'input'
,
helper
.
debounce
(
function
()
{
helper
.
debounce
(
function
()
{
var
txt
=
$
(
this
).
val
()
var
txt
=
$
(
this
).
val
();
if
(
!
txt
)
{
if
(
!
txt
)
{
treeObj
.
showNodes
(
all_nodes
)
treeObj
.
showNodes
(
all_nodes
);
}
else
{
}
else
{
var
nodesList
=
treeObj
.
getNodesByParamFuzzy
(
'label'
,
txt
)
var
nodesList
=
treeObj
.
getNodesByParamFuzzy
(
'label'
,
txt
);
show_nodes
=
helper
.
findShowNode
(
nodesList
,
all_nodes
)
console
.
log
(
show_nodes
)
var
showNodes
=
[];
treeObj
.
hideNodes
(
all_nodes
)
nodesList
.
forEach
(
function
(
node
)
{
treeObj
.
showNodes
(
show_nodes
)
showNodes
.
push
(
node
);
// 把当前匹配的节点加入显示列表
// 如果匹配的节点有父节点,也将其父节点加入显示列表
var
parentNode
=
node
.
getParentNode
();
if
(
parentNode
&&
showNodes
.
indexOf
(
parentNode
)
===
-
1
)
{
showNodes
.
push
(
parentNode
);
}
}
},
500
)
// 如果匹配的是一级菜单节点,同时把它的所有子节点加入显示列表
)
if
(
!
parentNode
&&
node
.
children
)
{
showNodes
=
showNodes
.
concat
(
node
.
children
);
}
}
});
// function bindEvent() {
// 去除重复节点
// $('#brand').on(
showNodes
=
uniqueNodes
(
showNodes
);
// 'input',
// helper.debounce(function () {
// var txt = $(this).val();
// if (!txt) {
// treeObj.showNodes(all_nodes);
// } else {
// var nodesList = treeObj.getNodesByParamFuzzy('label', txt);
// var showNodes = [];
// nodesList.forEach(function(node) {
// showNodes.push(node); // 把当前匹配的节点加入显示列表
// // 如果匹配的节点有父节点,也将其父节点加入显示列表
// var parentNode = node.getParentNode();
// if (parentNode && showNodes.indexOf(parentNode) === -1) {
// showNodes.push(parentNode);
// }
// // 如果匹配的是一级菜单节点,同时把它的所有子节点加入显示列表
// if (!parentNode && node.children) {
// showNodes = showNodes.concat(node.children);
// }
// });
// // 去除重复节点
// showNodes = uniqueNodes(showNodes);
// // 先隐藏所有节点,再显示匹配的节点及其相关的父或子节点
// treeObj.hideNodes(all_nodes);
// treeObj.showNodes(showNodes);
// }
// }, 500)
// );
// }
// unique 方法用于确保没有重复的节点
// function uniqueNodes(nodes) {
// var uniqueNodes = [];
// var uniqueKeys = {};
// nodes.forEach(function(node) {
// if (!uniqueKeys[node.tId]) {
// uniqueKeys[node.tId] = true;
// uniqueNodes.push(node);
// }
// });
// return uniqueNodes;
// };
// helper.unique 方法需要确保节点不重复
// 先隐藏所有节点,再显示匹配的节点及其相关的父或子节点
// helper.unique = function(nodes) {
treeObj
.
hideNodes
(
all_nodes
);
// var uniqueNodes = [];
treeObj
.
showNodes
(
showNodes
);
// var uniqueKeys = {};
}
},
500
)
);
}
// nodes.forEach(function(node) {
// unique 方法用于确保没有重复的节点
// if (!uniqueKeys[node.tId]) {
function
uniqueNodes
(
nodes
)
{
// uniqueKeys[node.tId] = true;
var
uniqueNodes
=
[];
// uniqueNodes.push(node);
var
uniqueKeys
=
{};
// }
// });
// return uniqueNodes;
nodes
.
forEach
(
function
(
node
)
{
// };
if
(
!
uniqueKeys
[
node
.
tId
])
{
uniqueKeys
[
node
.
tId
]
=
true
;
uniqueNodes
.
push
(
node
);
}
});
return
uniqueNodes
;
};
function
setCheckbox
(
checkedStr
,
attr
)
{
function
setCheckbox
(
checkedStr
,
attr
)
{
if
(
!
checkedStr
||
!
checkedStr
.
length
)
{
if
(
!
checkedStr
||
!
checkedStr
.
length
)
{
...
...
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