更新日报相关功能
This commit is contained in:
1 parent
51fd90fc51
commit
68cdaf38fa
23 files changed
+2313
-1056
No files matched your search
@@ -69,15 +69,51 @@
|
||||
</div>
|
||||
|
||||
<section class="detail-section">
|
||||
<h4>今日完成</h4>
|
||||
<h4 class="section-title">
|
||||
<span>今日完成</span>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
size="small"
|
||||
:icon="CopyDocument"
|
||||
:disabled="!detail.report.today_done?.trim()"
|
||||
@click="copySection('今日完成', detail.report.today_done)"
|
||||
>
|
||||
复制
|
||||
</el-button>
|
||||
</h4>
|
||||
<div class="section-text">{{ detail.report.today_done || '—' }}</div>
|
||||
</section>
|
||||
<section class="detail-section">
|
||||
<h4>明日计划</h4>
|
||||
<h4 class="section-title">
|
||||
<span>明日计划</span>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
size="small"
|
||||
:icon="CopyDocument"
|
||||
:disabled="!detail.report.tomorrow_plan?.trim()"
|
||||
@click="copySection('明日计划', detail.report.tomorrow_plan)"
|
||||
>
|
||||
复制
|
||||
</el-button>
|
||||
</h4>
|
||||
<div class="section-text">{{ detail.report.tomorrow_plan || '—' }}</div>
|
||||
</section>
|
||||
<section class="detail-section">
|
||||
<h4>问题与建议</h4>
|
||||
<h4 class="section-title">
|
||||
<span>问题与建议</span>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
size="small"
|
||||
:icon="CopyDocument"
|
||||
:disabled="!detail.report.issues?.trim()"
|
||||
@click="copySection('问题与建议', detail.report.issues)"
|
||||
>
|
||||
复制
|
||||
</el-button>
|
||||
</h4>
|
||||
<div class="section-text">{{ detail.report.issues || '—' }}</div>
|
||||
</section>
|
||||
|
||||
@@ -200,7 +236,7 @@
|
||||
<script setup>
|
||||
import { ref, watch } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { Paperclip } from '@element-plus/icons-vue'
|
||||
import { CopyDocument, Paperclip } from '@element-plus/icons-vue'
|
||||
import {
|
||||
getDailyReportDetail,
|
||||
saveDailyReport,
|
||||
@@ -373,6 +409,32 @@ async function handleDeleteReport() {
|
||||
}
|
||||
}
|
||||
|
||||
// 一键复制单个板块的内容,非 HTTPS 环境回退到 textarea 复制。
|
||||
async function copySection(label, text) {
|
||||
const content = (text || '').trim()
|
||||
if (!content) {
|
||||
ElMessage.warning(`「${label}」暂无内容可复制`)
|
||||
return
|
||||
}
|
||||
try {
|
||||
if (navigator.clipboard && window.isSecureContext) {
|
||||
await navigator.clipboard.writeText(content)
|
||||
} else {
|
||||
const textarea = document.createElement('textarea')
|
||||
textarea.value = content
|
||||
textarea.style.position = 'fixed'
|
||||
textarea.style.top = '-9999px'
|
||||
document.body.appendChild(textarea)
|
||||
textarea.select()
|
||||
document.execCommand('copy')
|
||||
document.body.removeChild(textarea)
|
||||
}
|
||||
ElMessage.success(`「${label}」已复制到剪贴板`)
|
||||
} catch {
|
||||
ElMessage.error('复制失败,请手动选择内容复制')
|
||||
}
|
||||
}
|
||||
|
||||
function formatSize(size) {
|
||||
const n = Number(size) || 0
|
||||
if (n < 1024) return `${n} B`
|
||||
@@ -484,6 +546,13 @@ function formatSize(size) {
|
||||
margin: 0 0 8px;
|
||||
font-size: 14px;
|
||||
color: #606266;
|
||||
|
||||
&.section-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -547,9 +547,11 @@ function cellClass(cell) {
|
||||
return cell.isFuture ? 'is-future' : 'is-none'
|
||||
}
|
||||
|
||||
// 补写窗口内、尚未写日报的日期:格子上标注「补」,提示可直接补写
|
||||
// 补写窗口内、往日尚未写日报的日期:格子上标注「补」,提示可直接补写
|
||||
// 今天属于正常填写,未写时不标「补」
|
||||
function cellBackfill(cell) {
|
||||
if (!cell || cell.isFuture || cell.record) return false
|
||||
if (cell.date === todayStr()) return false
|
||||
return inWindow(cell.date)
|
||||
}
|
||||
|
||||
@@ -557,6 +559,7 @@ function cellTooltip(cell) {
|
||||
if (!cell) return ''
|
||||
if (!cell.record) {
|
||||
if (cell.isFuture) return `${cell.date}(未到)`
|
||||
if (cell.date === todayStr()) return `${cell.date}(今日未填写,点击填写)`
|
||||
if (cellBackfill(cell)) return `${cell.date}(可补写,点击填写)`
|
||||
return `${cell.date}(未填写)`
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user