Toggle navigation
Toggle navigation
This project
Loading...
Sign in
OPENTECH
/
yoho-node-ci
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
2
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
shijian
8 years ago
Commit
f4d6e274eead6d3bbabf6eacde75d57f507caf3a
1 parent
96f448ed
联想词
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
0 deletions
apps/web/actions/keywords.js
apps/web/views/action/keywords.hbs
apps/web/actions/keywords.js
View file @
f4d6e27
...
...
@@ -73,6 +73,12 @@ const editDataValues = async(value, oldValue)=>{
}
}
//搜索
const
searchDataValues
=
async
(
value
)
=>
{
let
key
=
`
keywords_mana
:
*
$
{
value
}
*
`
;
multi
.
KEYS
(
key
);
return
multiAsync
();
}
r
.
get
(
'/'
,
async
(
ctx
)
=>
{
await
ctx
.
render
(
'action/keywords'
);
...
...
@@ -147,4 +153,18 @@ r.get('/editKeywords', async(ctx) => {
};
}
});
r
.
get
(
'/searchKeywords'
,
async
(
ctx
)
=>
{
let
q
=
ctx
.
request
.
query
;
let
key
=
q
[
'association'
];
let
r
=
await
searchDataValues
(
key
);
let
result
=
[];
if
(
r
[
0
].
length
)
result
=
await
getDataValues
(
r
[
0
]);
ctx
.
body
=
{
code
:
200
,
message
:
'success'
,
data
:
result
,
total
:
1
};
});
module
.
exports
=
r
;
...
...
apps/web/views/action/keywords.hbs
View file @
f4d6e27
...
...
@@ -20,6 +20,10 @@
<label
style=
"margin-right:20px;"
><input
id=
"allSelected"
type=
"checkbox"
style=
"margin-right:5px;"
>
全选
</label>
<a
data-toggle=
"modal"
href=
"#pop"
class=
"btn btn-default"
style=
"margin-right:10px;"
>
增加
</a>
<a
class=
"btn btn-default deleteAll"
>
删除
</a>
<button
class=
"btn btn-default search"
style=
"float:right;"
>
搜索
</button>
<div
class=
"col-sm-3"
style=
"float:right;"
>
<input
type=
"text"
class=
"form-control"
id=
"firstname"
placeholder=
"请输入关键词"
>
</div>
</div>
</div>
</div>
...
...
@@ -191,4 +195,19 @@
function
tableHtml
(
item
,
index
){
return
'<tr><td><label><input type="checkbox">'
+
index
+
'</label></td><td><input class="values" value="'
+
item
+
'" disabled></td><td><button class="btn btn-default nostyle edit">编辑</button><button class="btn btn-default nostyle delete">删除</button></td></tr>'
;
}
//搜索
$
(
'.search'
).
on
(
'click'
,
function
(){
if
(
!
$
(
'#firstname'
).
val
())
return
;
$
.
get
(
'/keywords/searchKeywords'
,
{
association
:
$
(
'#firstname'
).
val
()},
function
(
data
){
var
html
=
''
;
let
datas
=
data
.
data
;
if
(
data
.
code
===
200
){
datas
.
forEach
(
function
(
item
,
index
){
html
+=
tableHtml
(
item
,
index
);
});
$
(
'#table-oper-log'
).
html
(
tabHead
+
html
);
pageTotal
=
Math
.
ceil
(
data
.
total
/
pageCount
);
}
});
});
</script>
\ No newline at end of file
...
...
Please
register
or
login
to post a comment