perf: 添加全局搜索功能

This commit is contained in:
kuaifan 2025-03-03 08:20:17 +08:00
parent 1c4c4fe3fb
commit f03600bd65
4 changed files with 50 additions and 6 deletions

View File

@ -157,14 +157,14 @@ export default {
switch (type) { switch (type) {
case 'task': case 'task':
return this.$L('任务') return this.$L('任务')
case 'project':
return this.$L('项目')
case 'message': case 'message':
return this.$L('消息') return this.$L('消息')
case 'contact': case 'contact':
return this.$L('联系人') return this.$L('联系人')
case 'file': case 'file':
return this.$L('文件') return this.$L('文件')
case 'project':
return this.$L('项目')
} }
return type; return type;
}, },
@ -182,7 +182,45 @@ export default {
}, },
onClick(item) { onClick(item) {
console.log(item); switch (item.type) {
case 'task':
this.$store.dispatch('openTask', item.rawData)
this.onHide()
break;
case 'project':
this.goForward({name: 'manage-project', params: {projectId: item.id}})
this.onHide()
break;
case 'message':
this.$store.dispatch("openDialog", item.id).then(() => {
this.onHide()
this.goForward({name: 'manage-messenger', params: {dialogAction: 'dialog'}})
this.$store.state.dialogSearchMsgId = /^\d+$/.test(item.rawData.search_msg_id) ? item.rawData.search_msg_id : 0
}).catch(({msg}) => {
$A.modalError(msg || this.$L('打开会话失败'))
})
break;
case 'contact':
this.$store.dispatch("openDialogUserid", item.id).then(_ => {
this.onHide()
this.goForward({name: 'manage-messenger', params: {dialogAction: 'dialog'}})
}).catch(({msg}) => {
$A.modalError(msg || this.$L('打开会话失败'))
});
break;
case 'file':
this.goForward({name: 'manage-file', params: {folderId: item.rawData.pid, fileId: null, shakeId: item.id}})
this.$store.state.fileShakeId = item.id
setTimeout(() => {
this.$store.state.fileShakeId = 0
}, 1000)
this.onHide()
break;
}
}, },
onShow() { onShow() {

View File

@ -976,13 +976,14 @@ export default {
this.onAddShow() this.onAddShow()
break; break;
case 70: // F - case 70:
case 191: // F/ -
e.preventDefault(); e.preventDefault();
this.$refs.searchBox.onShow(); this.$refs.searchBox.onShow();
break; break;
case 75: case 75:
case 78: // K/N - case 78: // KN -
e.preventDefault(); e.preventDefault();
this.onAddMenu('task') this.onAddMenu('task')
break; break;

View File

@ -761,7 +761,7 @@ export default {
}, },
computed: { computed: {
...mapState(['systemConfig', 'userIsAdmin', 'userInfo', 'fileLists', 'wsOpenNum', 'windowWidth', 'filePackLists']), ...mapState(['systemConfig', 'userIsAdmin', 'userInfo', 'fileLists', 'wsOpenNum', 'windowWidth', 'filePackLists', 'fileShakeId']),
pid() { pid() {
const {folderId} = this.$route.params; const {folderId} = this.$route.params;
@ -959,6 +959,10 @@ export default {
}, },
deep: true deep: true
}, },
fileShakeId(shakeId) {
shakeId && this.shakeFile(shakeId)
}
}, },
methods: { methods: {

View File

@ -138,6 +138,7 @@ export default {
fileLists: [], fileLists: [],
fileLinks: [], fileLinks: [],
filePackLists: [], filePackLists: [],
fileShakeId: 0,
// 项目任务 // 项目任务
projectId: 0, projectId: 0,