|
@@ -19,6 +19,7 @@
|
|
|
<el-select v-model="formInline[item.name]" placeholder="请选择菜单" v-if="item.name == 'bind'">
|
|
|
<el-option v-for="item in menus" :key="item.code" :label="item.name" :value="item.code"></el-option>
|
|
|
</el-select>
|
|
|
+ <el-input v-if="item.name == 'search'" v-model="formInline[item.name]" placeholder="请输入关键字" clearable></el-input>
|
|
|
</template>
|
|
|
</filterList>
|
|
|
</div>
|
|
@@ -95,7 +96,8 @@ export default {
|
|
|
title: '',
|
|
|
visibleSync: false,
|
|
|
filed: [
|
|
|
- { name: 'title', label: '标题', filter: true },
|
|
|
+ { name: 'title', label: '标题' },
|
|
|
+ { name: 'search', label: '关键字查询', formater: 'slot', filter: true, isshow: false },
|
|
|
{ name: 'recommend', label: '是否查询推荐', formater: 'slot', filter: true, isshow: false },
|
|
|
{ name: 'visit', label: '访问量', width: '150' }
|
|
|
],
|
|
@@ -168,7 +170,7 @@ export default {
|
|
|
await this.sourceQuery();
|
|
|
},
|
|
|
methods: {
|
|
|
- ...mapActions(['contentsQuery', 'contentsCreate', 'contentsUpdate', 'contentsDelete', 'contentsQuery', 'contentsFetch', 'menusQuery', 'userQuery', 'sourceQuery']),
|
|
|
+ ...mapActions(['contentsQuery', 'contentsCreate', 'contentsUpdate', 'contentsDelete', 'contentsFetch', 'menusQuery', 'userQuery', 'sourceQuery', 'search']),
|
|
|
// 查询字典函数
|
|
|
async querySearchAsync(queryString, cb) {
|
|
|
await this.sourceQuery();
|
|
@@ -177,9 +179,14 @@ export default {
|
|
|
// 作者查询函数
|
|
|
async authorSelect(queryString, cb) {
|
|
|
const authorList = localStorage.getItem('author');
|
|
|
- let list = authorList.split(',');
|
|
|
- list = list.map(e => ({ name: e }));
|
|
|
- cb(list);
|
|
|
+ if (authorList && authorList !== null && authorList !== '') {
|
|
|
+ let list = authorList.split(',');
|
|
|
+ list = list.map(e => ({ name: e }));
|
|
|
+ cb(list);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // eslint-disable-next-line standard/no-callback-literal
|
|
|
+ cb([]);
|
|
|
},
|
|
|
// 选择建议
|
|
|
handleSelect(item) {
|
|
@@ -214,6 +221,11 @@ export default {
|
|
|
},
|
|
|
// 查询
|
|
|
async filterQuery ({ filter = {}, paging = { page: 0, size: 10 } } = {}) {
|
|
|
+ console.log(filter);
|
|
|
+ if (filter.search) {
|
|
|
+ await this.search({ ...filter });
|
|
|
+ return;
|
|
|
+ }
|
|
|
this.page = paging.page;
|
|
|
if (this.types !== null) filter.bind = this.types;
|
|
|
await this.contentsQuery({ filter, paging });
|
|
@@ -244,10 +256,14 @@ export default {
|
|
|
this.$refs.filterList.resetPage(-1);
|
|
|
}
|
|
|
const author = localStorage.getItem('author');
|
|
|
- if (!this.handleAuthor) localStorage.setItem('author', `${author}, ${e.author}`);
|
|
|
+ if (!this.handleAuthor) {
|
|
|
+ if (author) {
|
|
|
+ if (!author.includes(e.author)) localStorage.setItem('author', `${author}, ${e.author}`);
|
|
|
+ } else {
|
|
|
+ localStorage.setItem('author', e.author);
|
|
|
+ }
|
|
|
+ }
|
|
|
this.$resChange(res, msg);
|
|
|
- // const filter = { bind: this.types };
|
|
|
- // this.filterQuery({ filter, paging });
|
|
|
this.visibleSync = false;
|
|
|
this.fileList = [];
|
|
|
this.handleAuthor = false;
|