diff --git a/resources/assets/js/components/SearchBox.vue b/resources/assets/js/components/SearchBox.vue index efee8e555..f020af1cc 100755 --- a/resources/assets/js/components/SearchBox.vue +++ b/resources/assets/js/components/SearchBox.vue @@ -36,11 +36,12 @@
  • {{typeLabel(type)}}
  • - +
    +
    @@ -54,7 +55,7 @@
    {{tag.name}} @@ -84,6 +85,7 @@ export default { loadIng: 0, searchKey: '', searchResults: [], + searchTimer: null, showModal: false, } @@ -129,14 +131,13 @@ export default { list({searchKey, searchResults}) { const items = searchResults.filter(item => item.key === searchKey) const groups = {} - items.some(item => { + items.forEach(item => { if (!groups[item.type]) { groups[item.type] = [] } - if (groups[item.type].length > 10) { - return true + if (groups[item.type].length < 10) { + groups[item.type].push(item) } - groups[item.type].push(item) }) return groups }, @@ -197,9 +198,21 @@ export default { onSearch() { this.searchTask(this.searchKey) + this.searchProject(this.searchKey) this.searchMessage(this.searchKey) this.searchContact(this.searchKey) - // todo searchFile、searchProject + this.searchFile(this.searchKey) + }, + + pushResults(items) { + items.forEach(item => { + const index = this.searchResults.findIndex(({id, type}) => id === item.id && type === item.type) + if (index > -1) { + this.searchResults.splice(index, 1, item) + } else { + this.searchResults.push(item) + } + }) }, searchTask(key) { @@ -218,17 +231,17 @@ export default { if (item.complete_at) { tags.push({ name: this.$L('已完成'), - style: 'background-color:#666;color:#ddd', + style: 'background-color:#ccc', }) } else if (item.overdue) { tags.push({ name: this.$L('超期'), - style: 'background-color:#f00;color:#ddd', + style: 'background-color:#f00', }) } else if ($A.dayjs(item.end_at).unix() - nowTime < 86400) { tags.push({ name: this.$L('即将到期'), - style: 'background-color:#f80;color:#ddd', + style: 'background-color:#f80', }) } return { @@ -245,14 +258,53 @@ export default { rawData: item, }; }); - items.forEach(item => { - const index = this.searchResults.findIndex(it => it.id === item.id && it.type === 'task') - if (index > -1) { - this.searchResults.splice(index, 1, item) - } else { - this.searchResults.push(item) + this.pushResults(items) + }).finally(_ => { + this.loadIng--; + }) + }, + + searchProject(key) { + this.loadIng++; + this.$store.dispatch("call", { + url: 'project/lists', + data: { + keys: { + name: key + }, + archived: 'all', + pagesize: 10, + }, + }).then(({data}) => { + const items = data.data.map(item => { + const tags = []; + if (item.owner) { + tags.push({ + name: this.$L('负责人'), + style: 'background-color:#0bc037', + }) } + if (item.archived_at) { + tags.push({ + name: this.$L('已归档'), + style: 'background-color:#ccc', + }) + } + return { + key, + type: 'project', + icons: ['project', null], + tags, + + id: item.id, + title: item.name, + desc: item.desc || '', + activity: item.updated_at, + + rawData: item, + }; }) + this.pushResults(items) }).finally(_ => { this.loadIng--; }) @@ -301,14 +353,7 @@ export default { rawData: item, }; }) - items.forEach(item => { - const index = this.searchResults.findIndex(it => it.id === item.id && it.type === 'task') - if (index > -1) { - this.searchResults.splice(index, 1, item) - } else { - this.searchResults.push(item) - } - }) + this.pushResults(items) }).finally(_ => { this.loadIng--; }) @@ -332,24 +377,51 @@ export default { id: item.userid, title: item.nickname, - desc: item?.profession || '', + desc: item.profession || '', activity: item.line_at, rawData: item, }; }) - items.forEach(item => { - const index = this.searchResults.findIndex(it => it.id === item.id && it.type === 'contact') - if (index > -1) { - this.searchResults.splice(index, 1, item) - } else { - this.searchResults.push(item) - } - }) + this.pushResults(items) }).finally(_ => { this.loadIng--; }) }, + + searchFile(key) { + this.loadIng++; + this.$store.dispatch("call", { + url: 'file/search', + data: {key}, + }).then(({data}) => { + const items = data.map(item => { + const tags = []; + if (item.share) { + tags.push({ + name: this.$L(item.userid == this.userId ? '已共享' : '共享'), + style: 'background-color:#0bc037', + }) + } + return { + key, + type: 'file', + icons: ['file', item.type], + tags, + + id: item.id, + title: item.name, + desc: item.type === 'folder' ? '' : $A.bytesToSize(item.size), + activity: item.updated_at, + + rawData: item, + }; + }) + this.pushResults(items) + }).finally(_ => { + this.loadIng--; + }) + } } }; diff --git a/resources/assets/js/pages/manage.vue b/resources/assets/js/pages/manage.vue index ea7c50e9d..26c04a741 100644 --- a/resources/assets/js/pages/manage.vue +++ b/resources/assets/js/pages/manage.vue @@ -976,6 +976,11 @@ export default { this.onAddShow() break; + case 70: // F - 搜索 + e.preventDefault(); + this.$refs.searchBox.onShow(); + break; + case 75: case 78: // K/N - 新建任务 e.preventDefault(); diff --git a/resources/assets/js/pages/manage/dashboard.vue b/resources/assets/js/pages/manage/dashboard.vue index cf38ef591..c1fddb3f7 100644 --- a/resources/assets/js/pages/manage/dashboard.vue +++ b/resources/assets/js/pages/manage/dashboard.vue @@ -7,8 +7,9 @@

    {{dashboardHello}}

    -
    @@ -121,6 +122,8 @@ export default { loadIng: 0, dashboard: 'today', + mateName: /macintosh|mac os x/i.test(navigator.userAgent) ? '⌘' : 'Ctrl', + warningMsg: '', hiddenColumns: hiddenCaches, diff --git a/resources/assets/sass/components/search-box.scss b/resources/assets/sass/components/search-box.scss index 1133e017e..8280a3bfb 100755 --- a/resources/assets/sass/components/search-box.scss +++ b/resources/assets/sass/components/search-box.scss @@ -159,6 +159,7 @@ background-color: #ffffff !important; } + .file-icon, .img-avatar, .user-avatar, .icon-avatar { @@ -169,6 +170,14 @@ flex-shrink: 0; } + .file-icon { + display: flex; + &:before { + width: 100%; + height: 100%; + } + } + .img-avatar { display: flex; align-items: center; @@ -243,8 +252,8 @@ border-radius: 4px; font-size: 12px; margin-right: 6px; - background-color: #f0f0f0; - color: #303133; + background-color: #cccccc; + color: #ffffff; word-break: keep-all; } diff --git a/resources/assets/sass/dark.scss b/resources/assets/sass/dark.scss index 27a9e6468..05520db82 100644 --- a/resources/assets/sass/dark.scss +++ b/resources/assets/sass/dark.scss @@ -641,6 +641,13 @@ body.dark-mode-reverse { .icon-avatar { color: #1c1917; } + .item-content { + .item-desc { + .desc-tag { + color: #1c1917; + } + } + } } } } diff --git a/resources/assets/sass/pages/page-dashboard.scss b/resources/assets/sass/pages/page-dashboard.scss index 85340fb05..d8ae25d14 100644 --- a/resources/assets/sass/pages/page-dashboard.scss +++ b/resources/assets/sass/pages/page-dashboard.scss @@ -44,7 +44,7 @@ align-items: center; justify-content: space-between; > h2 { - flex: 3; + flex: 1; color: $primary-title-color; font-size: 24px; font-weight: 600; @@ -54,28 +54,44 @@ word-wrap: break-word; } .dashboard-search { - flex: 1; + flex-shrink: 0; display: flex; - max-width: 180px; + min-width: 120px; + max-width: 220px; + margin-left: 24px; height: 34px; align-items: center; - justify-content: center; - padding: 0 2px 0 24px; + justify-content: flex-start; + padding: 0 12px; border-radius: 8px; color: #515a6e; - background-color: #fff; + background-color: #F4F5F7; background-image: none; cursor: pointer; opacity: 0.8; transition: opacity 0.3s; - flex: none; > i { - font-size: 20px; + font-size: 22px; + cursor: pointer; + } + > span { + padding: 0 4px 0 8px; cursor: pointer; } &:hover { opacity: 1; } + &.min-search { + min-width: auto; + background-color: transparent; + opacity: 1; + > i { + font-size: 24px; + } + > span { + display: none; + } + } } } .dashboard-time,