perf: 优化查看任务附件菜单

This commit is contained in:
kuaifan 2024-05-11 23:45:04 +09:00
parent 7bf5805714
commit 186d3b0d79
5 changed files with 85 additions and 92 deletions

View File

@ -54,7 +54,6 @@
仅限项目或任务负责人操作 仅限项目或任务负责人操作
仅限项目或任务负责人添加 仅限项目或任务负责人添加
任务列表不存在或已被删除 任务列表不存在或已被删除
你确定要删除这个文件吗?
密码错误,请输入正确密码 密码错误,请输入正确密码
开放:所有人都可以发言。 开放:所有人都可以发言。
强大易用的协同创作云文档 强大易用的协同创作云文档
@ -1600,3 +1599,4 @@ License Key
长按语音消息可转换成文字。 长按语音消息可转换成文字。
需要在应用中开启 ChatGPT AI 机器人 需要在应用中开启 ChatGPT AI 机器人
关闭语音转文字功能。 关闭语音转文字功能。
你确定要删除文件【(*)】吗?

View File

@ -14,7 +14,7 @@
<div v-else class="edit-header"> <div v-else class="edit-header">
<div class="header-title"> <div class="header-title">
<EPopover v-if="!equalContent" v-model="unsaveTip" class="file-unsave-tip"> <EPopover v-if="!equalContent" v-model="unsaveTip" class="file-unsave-tip">
<div class="task-detail-delete-file-popover"> <div class="confirm-popover">
<p>{{$L('未保存当前修改内容?')}}</p> <p>{{$L('未保存当前修改内容?')}}</p>
<div class="buttons"> <div class="buttons">
<Button size="small" type="text" @click="unSaveGive">{{$L('放弃')}}</Button> <Button size="small" type="text" @click="unSaveGive">{{$L('放弃')}}</Button>

View File

@ -277,25 +277,11 @@
</div> </div>
<ul class="item-content file"> <ul class="item-content file">
<li v-if="taskDetail.file_num > 50" class="tip">{{$L(`${taskDetail.file_num}个文件仅显示最新50个`)}}</li> <li v-if="taskDetail.file_num > 50" class="tip">{{$L(`${taskDetail.file_num}个文件仅显示最新50个`)}}</li>
<li v-for="file in fileList"> <li v-for="file in fileList" @click="showFileDropdown(file, $event)">
<img v-if="file.id" class="file-ext" :src="file.thumb"/> <img v-if="file.id" class="file-ext" :src="file.thumb"/>
<Loading v-else class="file-load"/> <Loading v-else class="file-load"/>
<div class="file-name">{{file.name}}</div> <div class="file-name">{{file.name}}</div>
<div class="file-size">{{$A.bytesToSize(file.size)}}</div> <div class="file-size">{{$A.bytesToSize(file.size)}}</div>
<div class="file-menu" :class="{show:file._show_menu}">
<Icon @click="viewFile(file)" type="md-eye" />
<Icon @click="downFile(file)" type="md-arrow-round-down" />
<EPopover v-model="file._show_menu" class="file-delete">
<div class="task-detail-delete-file-popover">
<p>{{$L('你确定要删除这个文件吗?')}}</p>
<div class="buttons">
<Button size="small" type="text" @click="file._show_menu=false">{{$L('取消')}}</Button>
<Button size="small" type="primary" @click="deleteFile(file)">{{$L('确定')}}</Button>
</div>
</div>
<i slot="reference" class="taskfont del">&#xe6ea;</i>
</EPopover>
</div>
</li> </li>
</ul> </ul>
<ul class="item-content"> <ul class="item-content">
@ -365,21 +351,21 @@
<div class="calculate-content"></div> <div class="calculate-content"></div>
<EDropdownMenu slot="dropdown"> <EDropdownMenu slot="dropdown">
<EDropdownItem :command="1"> <EDropdownItem :command="1">
<div class="task-menu-icon" > <div class="task-menu-icon">
<Icon v-if="taskDetail.visibility == 1" class="completed" :type="'md-checkmark-circle'"/> <Icon v-if="taskDetail.visibility == 1" class="completed" :type="'md-checkmark-circle'"/>
<Icon v-else class="uncomplete" :type="'md-radio-button-off'"/> <Icon v-else class="uncomplete" :type="'md-radio-button-off'"/>
{{$L('项目人员')}} {{$L('项目人员')}}
</div> </div>
</EDropdownItem> </EDropdownItem>
<EDropdownItem :command="2"> <EDropdownItem :command="2">
<div class="task-menu-icon" > <div class="task-menu-icon">
<Icon v-if="taskDetail.visibility == 2" class="completed" :type="'md-checkmark-circle'"/> <Icon v-if="taskDetail.visibility == 2" class="completed" :type="'md-checkmark-circle'"/>
<Icon v-else class="uncomplete" :type="'md-radio-button-off'"/> <Icon v-else class="uncomplete" :type="'md-radio-button-off'"/>
{{$L('任务人员')}} {{$L('任务人员')}}
</div> </div>
</EDropdownItem> </EDropdownItem>
<EDropdownItem :command="3"> <EDropdownItem :command="3">
<div class="task-menu-icon" > <div class="task-menu-icon">
<Icon v-if="taskDetail.visibility == 3" class="completed" :type="'md-checkmark-circle'"/> <Icon v-if="taskDetail.visibility == 3" class="completed" :type="'md-checkmark-circle'"/>
<Icon v-else class="uncomplete" :type="'md-radio-button-off'"/> <Icon v-else class="uncomplete" :type="'md-radio-button-off'"/>
{{$L('指定成员')}} {{$L('指定成员')}}
@ -391,14 +377,24 @@
<div class="calculate-content"></div> <div class="calculate-content"></div>
<EDropdownMenu slot="dropdown"> <EDropdownMenu slot="dropdown">
<EDropdownItem :command="1"> <EDropdownItem :command="1">
<div class="task-menu-icon" > {{$L('任务延期')}}
{{$L('任务延期')}}
</div>
</EDropdownItem> </EDropdownItem>
<EDropdownItem :command="2"> <EDropdownItem :command="2">
<div class="task-menu-icon" > {{$L('修改时间')}}
{{$L('修改时间')}} </EDropdownItem>
</div> </EDropdownMenu>
</EDropdown>
<EDropdown ref="eFileRef" class="calculate-dropdown" trigger="click" placement="bottom" @command="dropFile">
<div class="calculate-content"></div>
<EDropdownMenu slot="dropdown">
<EDropdownItem :command="1">
{{$L('查看附件')}}
</EDropdownItem>
<EDropdownItem :command="2">
{{$L('下载附件')}}
</EDropdownItem>
<EDropdownItem :command="3" class="task-calc-warn-text">
{{$L('删除附件')}}
</EDropdownItem> </EDropdownItem>
</EDropdownMenu> </EDropdownMenu>
</EDropdown> </EDropdown>
@ -1679,6 +1675,22 @@ export default {
}); });
}, },
showDropdown(ref, eRect){
const boxRect = this.$refs.scroller.$el.getBoundingClientRect()
const refEl = ref.$el
refEl.style.top = (eRect.top - boxRect.top) + 'px'
refEl.style.left = (eRect.left - boxRect.left) + 'px'
refEl.style.width = eRect.width + 'px'
refEl.style.height = eRect.height + 'px'
//
if (ref.visible) {
ref.hide()
}
setTimeout(() => {
ref.show()
}, 0)
},
showCisibleDropdown(e){ showCisibleDropdown(e){
let eRect = null let eRect = null
if (e === null) { if (e === null) {
@ -1689,37 +1701,12 @@ export default {
if (eRect === null) { if (eRect === null) {
return return
} }
const boxRect = this.$refs.scroller.$el.getBoundingClientRect() this.showDropdown(this.$refs.eDropdownRef, eRect)
const refEl = this.$refs.eDropdownRef.$el
refEl.style.top = (eRect.top - boxRect.top) + 'px'
refEl.style.left = (eRect.left - boxRect.left) + 'px'
refEl.style.width = eRect.width + 'px'
refEl.style.height = eRect.height + 'px'
//
if (this.$refs.eDropdownRef.visible) {
this.$refs.eDropdownRef.hide()
}
setTimeout(() => {
this.$refs.eDropdownRef.show()
}, 0)
}, },
showAtDropdown({target}){ showAtDropdown({target}){
this.timeOpen = false this.timeOpen = false
const eRect = target.getBoundingClientRect() this.showDropdown(this.$refs.eDeadlineRef, target.getBoundingClientRect())
const boxRect = this.$refs.scroller.$el.getBoundingClientRect()
const refEl = this.$refs.eDeadlineRef.$el
refEl.style.top = (eRect.top - boxRect.top) + 'px'
refEl.style.left = (eRect.left - boxRect.left) + 'px'
refEl.style.width = eRect.width + 'px'
refEl.style.height = eRect.height + 'px'
//
if (this.$refs.eDeadlineRef.visible) {
this.$refs.eDeadlineRef.hide()
}
setTimeout(() => {
this.$refs.eDeadlineRef.show()
}, 0)
}, },
visibleUserSelectShowChange(isShow){ visibleUserSelectShowChange(isShow){
@ -1794,6 +1781,31 @@ export default {
}) })
}, },
showFileDropdown(file, {target}){
this.operationFile = file
this.showDropdown(this.$refs.eFileRef, target.getBoundingClientRect())
},
dropFile(command) {
switch (command) {
case 1:
this.viewFile(this.operationFile)
break;
case 2:
this.downFile(this.operationFile)
break;
case 3:
$A.modalConfirm({
title: '删除文件',
content: `你确定要删除文件【${this.operationFile.name}】吗?`,
onOk: () => {
this.deleteFile(this.operationFile)
}
});
break;
}
},
updateVisible() { updateVisible() {
this.updateData(['visibility', 'visibility_appointor']) this.updateData(['visibility', 'visibility_appointor'])
} }

View File

@ -834,3 +834,13 @@ body.window-portrait {
.block-setting-space { .block-setting-space {
height: 8px; height: 8px;
} }
.confirm-popover {
max-width: 200px;
.buttons {
text-align: right;
margin-top: 12px;
.ivu-btn-small {
font-size: 12px
}
}
}

View File

@ -251,6 +251,7 @@
&.file { &.file {
margin-bottom: -3px; margin-bottom: -3px;
> li { > li {
cursor: pointer;
margin-bottom: 2px; margin-bottom: 2px;
&.tip { &.tip {
color: #999; color: #999;
@ -281,38 +282,12 @@
font-size: 12px; font-size: 12px;
color: #bbbbbb; color: #bbbbbb;
} }
.file-menu {
display: flex;
align-items: center;
opacity: 0;
transition: all 0.3s;
padding-left: 12px;
&.show {
opacity: 1;
}
i {
font-size: 14px;
color: #aaaaaa;
transition: color 0.3s;
cursor: pointer;
padding: 0 4px;
&:hover {
color: #777777;
}
&.del {
font-size: 13px;
&:hover {
color: #ff0000;
}
}
}
}
&:hover { &:hover {
.file-name { .file-name {
color: $primary-title-color; color: $primary-title-color;
} }
.file-menu { .file-size {
opacity: 1; color: $primary-text-color;
} }
} }
} }
@ -528,6 +503,9 @@
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.calculate-text {
color: $flow-status-start-color;
}
} }
} }
.upload { .upload {
@ -855,23 +833,16 @@
} }
} }
.task-detail-delete-file-popover {
max-width: 200px;
.buttons {
text-align: right;
margin-top: 12px;
.ivu-btn-small {
font-size: 12px
}
}
}
.task-detail-loop { .task-detail-loop {
> li { > li {
text-align: center; text-align: center;
} }
} }
.task-calc-warn-text {
color: $flow-status-start-color !important;
}
body.window-portrait { body.window-portrait {
.task-detail { .task-detail {
.task-info { .task-info {