提交
This commit is contained in:
1 parent
8248e5ef15
commit
b9b4cc2673
57 files changed
+42800
-30473
No files matched your search
@@ -332,12 +332,18 @@ export function fetchOaInstanceDetail(id: string) {
|
||||
}
|
||||
|
||||
export type OaCommentAttachmentRef = {
|
||||
fieldKey: string
|
||||
source?: 'form' | 'upload' | string
|
||||
fieldKey?: string
|
||||
fieldLabel?: string
|
||||
url: string
|
||||
fileName: string
|
||||
}
|
||||
|
||||
export type OaCommentMention = {
|
||||
userId: string
|
||||
userName: string
|
||||
}
|
||||
|
||||
export type OaInstanceComment = {
|
||||
id: string
|
||||
instanceId?: string
|
||||
@@ -349,6 +355,7 @@ export type OaInstanceComment = {
|
||||
createByName?: string
|
||||
createTime: string
|
||||
canRevoke?: boolean
|
||||
mentions?: OaCommentMention[]
|
||||
}
|
||||
|
||||
export function fetchOaFormAttachments(instanceId: string) {
|
||||
@@ -365,7 +372,11 @@ export function fetchOaInstanceComments(instanceId: string) {
|
||||
|
||||
export function fetchCreateOaComment(
|
||||
instanceId: string,
|
||||
data: { content: string; attachmentRefs?: OaCommentAttachmentRef[] }
|
||||
data: {
|
||||
content?: string
|
||||
attachmentRefs?: OaCommentAttachmentRef[]
|
||||
mentionUserIds?: string[]
|
||||
}
|
||||
) {
|
||||
return request.post<OaInstanceComment>({
|
||||
url: `${BASE}/instances/${instanceId}/comments`,
|
||||
@@ -380,7 +391,7 @@ export function fetchRevokeOaComment(instanceId: string, commentId: string) {
|
||||
}
|
||||
|
||||
export function fetchOaTasks(
|
||||
kind: 'pending' | 'done' | 'mine' | 'cc',
|
||||
kind: 'pending' | 'done' | 'mine' | 'cc' | 'mention',
|
||||
params?: {
|
||||
readStatus?: 'unread' | 'read' | 'all'
|
||||
appName?: string
|
||||
|
||||
@@ -1331,6 +1331,44 @@ body {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.search-bar {
|
||||
background: var(--mint-surface);
|
||||
border: 1px solid var(--mint-border);
|
||||
border-radius: var(--mint-radius);
|
||||
box-shadow: var(--mint-shadow);
|
||||
}
|
||||
|
||||
.detail-hero {
|
||||
margin-bottom: 14px;
|
||||
padding: 14px 16px;
|
||||
border: 1px solid var(--mint-border);
|
||||
border-radius: var(--mint-radius);
|
||||
background: var(--mint-primary-bg);
|
||||
}
|
||||
|
||||
.detail-hero-title {
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
color: var(--mint-text);
|
||||
}
|
||||
|
||||
.detail-hero-meta {
|
||||
margin-top: 6px;
|
||||
color: var(--mint-text-muted);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.detail-section {
|
||||
border-radius: var(--mint-radius);
|
||||
overflow: hidden;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 主列表页 + append-to-body 弹窗内嵌列表共用(OpenSpec:弹窗内列表风格一致) */
|
||||
.page-container,
|
||||
.console-container,
|
||||
.el-dialog {
|
||||
.list-toolbar,
|
||||
.toolbar {
|
||||
padding: 0;
|
||||
@@ -1402,39 +1440,6 @@ body {
|
||||
border-top: 1px solid var(--mint-border);
|
||||
background: var(--mint-surface);
|
||||
}
|
||||
|
||||
.search-bar {
|
||||
background: var(--mint-surface);
|
||||
border: 1px solid var(--mint-border);
|
||||
border-radius: var(--mint-radius);
|
||||
box-shadow: var(--mint-shadow);
|
||||
}
|
||||
|
||||
.detail-hero {
|
||||
margin-bottom: 14px;
|
||||
padding: 14px 16px;
|
||||
border: 1px solid var(--mint-border);
|
||||
border-radius: var(--mint-radius);
|
||||
background: var(--mint-primary-bg);
|
||||
}
|
||||
|
||||
.detail-hero-title {
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
color: var(--mint-text);
|
||||
}
|
||||
|
||||
.detail-hero-meta {
|
||||
margin-top: 6px;
|
||||
color: var(--mint-text-muted);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.detail-section {
|
||||
border-radius: var(--mint-radius);
|
||||
overflow: hidden;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1100px) {
|
||||
|
||||
@@ -606,20 +606,25 @@ body .el-table thead {
|
||||
// 约定:列表操作列保持 fixed="right",并通过以下规则确保按钮完整展示
|
||||
.page-container .el-table td.el-table__cell:has(.btn-op-item),
|
||||
.console-container .el-table td.el-table__cell:has(.btn-op-item),
|
||||
.el-dialog .el-table td.el-table__cell:has(.btn-op-item),
|
||||
.page-container .el-table td.el-table-fixed-column--right:has(.btn-op-item),
|
||||
.console-container .el-table td.el-table-fixed-column--right:has(.btn-op-item) {
|
||||
.console-container .el-table td.el-table-fixed-column--right:has(.btn-op-item),
|
||||
.el-dialog .el-table td.el-table-fixed-column--right:has(.btn-op-item) {
|
||||
min-width: 260px !important;
|
||||
}
|
||||
|
||||
.page-container .el-table th.el-table-fixed-column--right,
|
||||
.console-container .el-table th.el-table-fixed-column--right {
|
||||
.console-container .el-table th.el-table-fixed-column--right,
|
||||
.el-dialog .el-table th.el-table-fixed-column--right {
|
||||
min-width: 260px !important;
|
||||
}
|
||||
|
||||
.page-container .el-table td.el-table__cell:has(.btn-op-item) > .cell,
|
||||
.console-container .el-table td.el-table__cell:has(.btn-op-item) > .cell,
|
||||
.el-dialog .el-table td.el-table__cell:has(.btn-op-item) > .cell,
|
||||
.page-container .el-table td.el-table-fixed-column--right:has(.btn-op-item) > .cell,
|
||||
.console-container .el-table td.el-table-fixed-column--right:has(.btn-op-item) > .cell {
|
||||
.console-container .el-table td.el-table-fixed-column--right:has(.btn-op-item) > .cell,
|
||||
.el-dialog .el-table td.el-table-fixed-column--right:has(.btn-op-item) > .cell {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
@@ -722,7 +727,8 @@ body .el-table thead {
|
||||
}
|
||||
|
||||
.page-container .el-table,
|
||||
.console-container .el-table {
|
||||
.console-container .el-table,
|
||||
.el-dialog .el-table {
|
||||
--el-table-header-bg-color: var(--mint-table-head);
|
||||
--el-table-border-color: var(--mint-border);
|
||||
--el-table-row-hover-bg-color: var(--mint-row-hover);
|
||||
@@ -732,14 +738,16 @@ body .el-table thead {
|
||||
}
|
||||
|
||||
.page-container .el-table th.el-table__cell,
|
||||
.console-container .el-table th.el-table__cell {
|
||||
.console-container .el-table th.el-table__cell,
|
||||
.el-dialog .el-table th.el-table__cell {
|
||||
color: var(--mint-text-muted);
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.page-container .el-table td.el-table__cell,
|
||||
.console-container .el-table td.el-table__cell {
|
||||
.console-container .el-table td.el-table__cell,
|
||||
.el-dialog .el-table td.el-table__cell {
|
||||
color: var(--mint-text);
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
@@ -747,7 +755,8 @@ body .el-table thead {
|
||||
|
||||
// 无操作列主列表:保持与含 btn-op-item 操作列相同的行高;须保留溢出省略(勿用 inline-flex)
|
||||
.page-container .list-table.list-table--no-action-col td.el-table__cell > .cell,
|
||||
.console-container .list-table.list-table--no-action-col td.el-table__cell > .cell {
|
||||
.console-container .list-table.list-table--no-action-col td.el-table__cell > .cell,
|
||||
.el-dialog .list-table.list-table--no-action-col td.el-table__cell > .cell {
|
||||
min-height: 28px;
|
||||
line-height: 28px;
|
||||
overflow: hidden;
|
||||
@@ -1001,7 +1010,8 @@ body .el-table thead {
|
||||
}
|
||||
|
||||
.page-container .btn-op-item.el-button,
|
||||
.console-container .btn-op-item.el-button {
|
||||
.console-container .btn-op-item.el-button,
|
||||
.el-dialog .btn-op-item.el-button {
|
||||
height: 28px;
|
||||
padding: 0 8px;
|
||||
border-radius: 6px;
|
||||
@@ -1011,14 +1021,16 @@ body .el-table thead {
|
||||
}
|
||||
|
||||
.page-container .el-button:not(.is-circle):not(.el-button--text),
|
||||
.console-container .el-button:not(.is-circle):not(.el-button--text) {
|
||||
.console-container .el-button:not(.is-circle):not(.el-button--text),
|
||||
.el-dialog .el-button:not(.is-circle):not(.el-button--text) {
|
||||
height: 36px;
|
||||
border-radius: 8px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.page-container .btn-op-item.el-button > span,
|
||||
.console-container .btn-op-item.el-button > span {
|
||||
.console-container .btn-op-item.el-button > span,
|
||||
.el-dialog .btn-op-item.el-button > span {
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
@@ -1048,7 +1060,8 @@ body .el-table thead {
|
||||
}
|
||||
|
||||
.page-container .btn-op-item.primary.el-button,
|
||||
.console-container .btn-op-item.primary.el-button {
|
||||
.console-container .btn-op-item.primary.el-button,
|
||||
.el-dialog .btn-op-item.primary.el-button {
|
||||
color: #fff;
|
||||
border-color: var(--mint-primary);
|
||||
background: var(--mint-primary);
|
||||
@@ -1056,8 +1069,10 @@ body .el-table thead {
|
||||
|
||||
.page-container .list-toolbar-row > .el-button:not(.el-button--text):not(.el-button--link),
|
||||
.console-container .list-toolbar-row > .el-button:not(.el-button--text):not(.el-button--link),
|
||||
.el-dialog .list-toolbar-row > .el-button:not(.el-button--text):not(.el-button--link),
|
||||
.page-container .toolbar-right > .el-button:not(.el-button--text):not(.el-button--link),
|
||||
.console-container .toolbar-right > .el-button:not(.el-button--text):not(.el-button--link) {
|
||||
.console-container .toolbar-right > .el-button:not(.el-button--text):not(.el-button--link),
|
||||
.el-dialog .toolbar-right > .el-button:not(.el-button--text):not(.el-button--link) {
|
||||
color: var(--mint-text);
|
||||
border-color: var(--mint-border);
|
||||
background: var(--mint-surface);
|
||||
@@ -1069,10 +1084,16 @@ body .el-table thead {
|
||||
.console-container
|
||||
.list-toolbar-row
|
||||
> .el-button:not(.el-button--text):not(.el-button--link):first-of-type,
|
||||
.el-dialog
|
||||
.list-toolbar-row
|
||||
> .el-button:not(.el-button--text):not(.el-button--link):first-of-type,
|
||||
.page-container
|
||||
.toolbar-right
|
||||
> .el-button:not(.el-button--text):not(.el-button--link):first-of-type,
|
||||
.console-container
|
||||
.toolbar-right
|
||||
> .el-button:not(.el-button--text):not(.el-button--link):first-of-type,
|
||||
.el-dialog
|
||||
.toolbar-right
|
||||
> .el-button:not(.el-button--text):not(.el-button--link):first-of-type {
|
||||
color: #fff;
|
||||
@@ -1081,7 +1102,8 @@ body .el-table thead {
|
||||
}
|
||||
|
||||
.page-container .el-table__cell .btn-op-item.el-button,
|
||||
.console-container .el-table__cell .btn-op-item.el-button {
|
||||
.console-container .el-table__cell .btn-op-item.el-button,
|
||||
.el-dialog .el-table__cell .btn-op-item.el-button {
|
||||
color: var(--mint-text);
|
||||
border-color: var(--mint-border);
|
||||
background: var(--mint-surface);
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
<!-- 评论附件缩略图:文字区分「引用 / 上传」;预览/下载/移除为图标 -->
|
||||
<template>
|
||||
<div class="oa-cmt-files">
|
||||
<div v-for="(f, idx) in files" :key="`${f.url}-${idx}`" class="oa-cmt-files__item">
|
||||
<div class="oa-cmt-files__thumb" :title="f.fileName || '附件'">
|
||||
<img v-if="isImage(f)" :src="fullUrl(f.url)" :alt="f.fileName || '附件'" />
|
||||
<el-icon v-else-if="isVideo(f)" :size="16"><VideoPlay /></el-icon>
|
||||
<el-icon v-else :size="16"><Document /></el-icon>
|
||||
<span class="oa-cmt-files__badge">{{ sourceLabel(f) }}</span>
|
||||
<span class="oa-cmt-files__actions">
|
||||
<button type="button" title="预览" aria-label="预览" @click.stop="preview(f)">
|
||||
<el-icon :size="14"><ZoomIn /></el-icon>
|
||||
</button>
|
||||
<button type="button" title="下载" aria-label="下载" @click.stop="download(f)">
|
||||
<el-icon :size="14"><Download /></el-icon>
|
||||
</button>
|
||||
<button
|
||||
v-if="removable"
|
||||
type="button"
|
||||
title="移除"
|
||||
aria-label="移除"
|
||||
@click.stop="emit('remove', idx)"
|
||||
>
|
||||
<el-icon :size="14"><Delete /></el-icon>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
<div class="oa-cmt-files__name" :title="f.fileName || '附件'">{{ f.fileName || '附件' }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<el-dialog
|
||||
v-model="previewOpen"
|
||||
title="预览"
|
||||
width="720px"
|
||||
append-to-body
|
||||
align-center
|
||||
modal-class="protocol-dialog-mask"
|
||||
>
|
||||
<img v-if="previewImage" class="oa-cmt-files__preview" :src="previewImage" alt="" />
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Delete, Document, Download, VideoPlay, ZoomIn } from '@element-plus/icons-vue'
|
||||
import type { OaCommentAttachmentRef } from '@/api/oaApproval'
|
||||
import { attachmentFullUrl } from '@/composables/useAttachmentActions'
|
||||
import { downloadAttachmentFile } from '@/utils/download-attachment'
|
||||
import { isOaUploadImageFile, isOaUploadVideoFile } from '@/utils/oa-upload-file-type'
|
||||
|
||||
defineOptions({ name: 'OaCommentFileCards' })
|
||||
|
||||
defineProps<{
|
||||
files: OaCommentAttachmentRef[]
|
||||
removable?: boolean
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{ remove: [index: number] }>()
|
||||
|
||||
const previewOpen = ref(false)
|
||||
const previewImage = ref('')
|
||||
|
||||
function asFile(f: OaCommentAttachmentRef) {
|
||||
return { name: f.fileName, url: f.url }
|
||||
}
|
||||
|
||||
function isImage(f: OaCommentAttachmentRef) {
|
||||
return isOaUploadImageFile(asFile(f))
|
||||
}
|
||||
|
||||
function isVideo(f: OaCommentAttachmentRef) {
|
||||
return isOaUploadVideoFile(asFile(f))
|
||||
}
|
||||
|
||||
function fullUrl(url: string) {
|
||||
return attachmentFullUrl(url) || url
|
||||
}
|
||||
|
||||
function sourceLabel(f: OaCommentAttachmentRef) {
|
||||
return f.source === 'upload' ? '上传' : '引用'
|
||||
}
|
||||
|
||||
function preview(f: OaCommentAttachmentRef) {
|
||||
const url = fullUrl(f.url)
|
||||
if (!url) return
|
||||
if (isImage(f)) {
|
||||
previewImage.value = url
|
||||
previewOpen.value = true
|
||||
return
|
||||
}
|
||||
window.open(url, '_blank')
|
||||
}
|
||||
|
||||
function download(f: OaCommentAttachmentRef) {
|
||||
void downloadAttachmentFile(
|
||||
{ fileUrl: f.url, fileName: f.fileName },
|
||||
{ fullFileUrl: (u) => attachmentFullUrl(u) }
|
||||
)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.oa-cmt-files {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.oa-cmt-files__item {
|
||||
width: 88px;
|
||||
}
|
||||
|
||||
.oa-cmt-files__thumb {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 88px;
|
||||
height: 64px;
|
||||
overflow: hidden;
|
||||
color: #64748b;
|
||||
background: #f8fafc;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 8px;
|
||||
|
||||
img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
&:hover .oa-cmt-files__actions {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.oa-cmt-files__badge {
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
left: 2px;
|
||||
z-index: 1;
|
||||
padding: 0 4px;
|
||||
color: #334155;
|
||||
font-size: 10px;
|
||||
line-height: 16px;
|
||||
background: rgb(255 255 255 / 92%);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.oa-cmt-files__actions {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 4px;
|
||||
background: rgb(15 23 42 / 45%);
|
||||
opacity: 0;
|
||||
transition: opacity 0.15s;
|
||||
|
||||
button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
padding: 0;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
background: rgb(255 255 255 / 18%);
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
|
||||
&:hover {
|
||||
background: var(--primary, #10b981);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.oa-cmt-files__name {
|
||||
margin-top: 4px;
|
||||
color: var(--mint-text, #334155);
|
||||
font-size: 12px;
|
||||
line-height: 1.35;
|
||||
word-break: break-all;
|
||||
overflow-wrap: anywhere;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.oa-cmt-files__preview {
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -1,89 +1,81 @@
|
||||
<!-- OA 审批详情 · 实例讨论评论(≠ 审批意见) -->
|
||||
<!-- OA 审批详情 · 评论输入(列表已并入审批进度时间线) -->
|
||||
<template>
|
||||
<section class="oa-comment-panel">
|
||||
<h3 class="oa-comment-panel__title">
|
||||
<el-icon class="oa-comment-panel__title-icon"><ChatDotRound /></el-icon>
|
||||
评论
|
||||
</h3>
|
||||
|
||||
<div v-if="!comments.length" class="oa-comment-panel__empty">暂无评论</div>
|
||||
<ul v-else class="oa-comment-panel__list">
|
||||
<li v-for="c in comments" :key="c.id" class="oa-comment-panel__item">
|
||||
<template v-if="c.status === 'revoked'">
|
||||
<span class="oa-comment-panel__revoked">
|
||||
{{ c.createByName || c.createBy }} 撤回了一条评论
|
||||
<span v-if="c.revokedTime" class="oa-comment-panel__time">{{ c.revokedTime }}</span>
|
||||
</span>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="oa-comment-panel__meta">
|
||||
<strong>{{ c.createByName || c.createBy }}</strong>
|
||||
<span class="oa-comment-panel__time">{{ c.createTime }}</span>
|
||||
<el-button
|
||||
v-if="c.canRevoke"
|
||||
link
|
||||
type="danger"
|
||||
:loading="revokingId === c.id"
|
||||
@click="onRevoke(c)"
|
||||
>
|
||||
<el-icon><RefreshLeft /></el-icon>
|
||||
撤回
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="oa-comment-panel__content">{{ c.content }}</div>
|
||||
<div v-if="c.attachmentRefs?.length" class="oa-comment-panel__refs">
|
||||
<el-tag
|
||||
v-for="(f, idx) in c.attachmentRefs"
|
||||
:key="`${c.id}-${idx}-${f.url}`"
|
||||
class="oa-comment-panel__ref"
|
||||
size="small"
|
||||
effect="plain"
|
||||
@click="openUrl(f.url)"
|
||||
>
|
||||
{{ f.fileName || f.url }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</template>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div v-if="instanceStatus === 'running'" class="oa-comment-panel__composer">
|
||||
<el-input
|
||||
v-model="draft"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
maxlength="1024"
|
||||
show-word-limit
|
||||
placeholder="填写评论"
|
||||
/>
|
||||
<div v-if="picked.length" class="oa-comment-panel__picked">
|
||||
<section v-if="instanceStatus === 'running'" class="oa-comment-panel">
|
||||
<div class="oa-comment-panel__composer">
|
||||
<div class="oa-comment-panel__editor">
|
||||
<el-input
|
||||
ref="inputRef"
|
||||
v-model="draft"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
maxlength="1024"
|
||||
show-word-limit
|
||||
placeholder="填写评论,输入 @ 可提到人员"
|
||||
@focus="onDraftFocus"
|
||||
@input="onDraftInput"
|
||||
@keydown="onDraftKeydown"
|
||||
/>
|
||||
<div v-if="atOpen" class="oa-comment-at" v-loading="atLoading">
|
||||
<button
|
||||
v-for="(u, idx) in atOptions"
|
||||
:key="u.id"
|
||||
type="button"
|
||||
class="oa-comment-at__item"
|
||||
:class="{ 'is-active': idx === atActive }"
|
||||
@mousedown.prevent="pickAtUser(u)"
|
||||
>
|
||||
<span class="oa-comment-at__name">{{ u.name }}</span>
|
||||
</button>
|
||||
<div v-if="!atLoading && !atOptions.length" class="oa-comment-at__empty">未找到人员</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="mentionUsers.length" class="oa-comment-panel__picked">
|
||||
<el-tag
|
||||
v-for="(f, idx) in picked"
|
||||
:key="`${f.url}-${idx}`"
|
||||
v-for="u in mentionUsers"
|
||||
:key="u.id"
|
||||
closable
|
||||
size="small"
|
||||
effect="plain"
|
||||
@close="picked.splice(idx, 1)"
|
||||
@close="removeMention(u.id)"
|
||||
>
|
||||
{{ f.fileName || f.url }}
|
||||
@{{ u.name }}
|
||||
</el-tag>
|
||||
</div>
|
||||
<div v-if="picked.length" class="oa-comment-panel__files">
|
||||
<OaCommentFileCards :files="picked" removable @remove="removePicked" />
|
||||
</div>
|
||||
<div class="oa-comment-panel__actions">
|
||||
<el-button class="btn-ghost" @click="openMention">
|
||||
<el-icon><User /></el-icon>
|
||||
@人员
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="openAttach">
|
||||
<el-icon><Paperclip /></el-icon>
|
||||
引用附件
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" :loading="uploading" @click="pickUpload">
|
||||
<el-icon><Upload /></el-icon>
|
||||
上传附件
|
||||
</el-button>
|
||||
<el-button type="primary" class="btn-main" :loading="sending" @click="onSend">
|
||||
<el-icon><Promotion /></el-icon>
|
||||
发送
|
||||
</el-button>
|
||||
</div>
|
||||
<input
|
||||
ref="fileInputRef"
|
||||
class="oa-comment-file-input"
|
||||
type="file"
|
||||
multiple
|
||||
:accept="OA_UPLOAD_ACCEPT"
|
||||
@change="onUploadFiles"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<el-dialog
|
||||
v-model="attachVisible"
|
||||
title="引用表单附件"
|
||||
width="560px"
|
||||
width="640px"
|
||||
class="dialog-form-layout"
|
||||
align-center
|
||||
append-to-body
|
||||
@@ -95,21 +87,43 @@
|
||||
<div v-if="!attachLoading && !attachGroups.length" class="oa-comment-attach__empty">
|
||||
暂无可引用附件
|
||||
</div>
|
||||
<el-checkbox-group v-else v-model="selectedUrls" class="oa-comment-attach__groups">
|
||||
<div v-else class="oa-comment-attach__groups">
|
||||
<div v-for="g in attachGroups" :key="g.fieldKey" class="oa-comment-attach__group">
|
||||
<div class="oa-comment-attach__label">{{ g.fieldLabel || g.fieldKey }}</div>
|
||||
<div class="oa-comment-attach__files">
|
||||
<el-checkbox
|
||||
<button
|
||||
v-for="f in g.files"
|
||||
:key="f.url"
|
||||
:value="f.url"
|
||||
class="oa-comment-attach__file"
|
||||
type="button"
|
||||
class="oa-comment-attach__card"
|
||||
:class="{ 'is-selected': isSelected(f.url) }"
|
||||
:title="f.fileName || f.url"
|
||||
@click="toggleUrl(f.url)"
|
||||
>
|
||||
{{ f.fileName || f.url }}
|
||||
</el-checkbox>
|
||||
<div class="oa-comment-attach__thumb">
|
||||
<img
|
||||
v-if="isImageRef(f)"
|
||||
:src="thumbSrc(f.url)"
|
||||
:alt="f.fileName || '附件'"
|
||||
/>
|
||||
<div
|
||||
v-else-if="isVideoRef(f)"
|
||||
class="oa-comment-attach__icon oa-comment-attach__icon--video"
|
||||
>
|
||||
<el-icon :size="16"><VideoPlay /></el-icon>
|
||||
</div>
|
||||
<div v-else class="oa-comment-attach__icon oa-comment-attach__icon--doc">
|
||||
<el-icon :size="16"><Document /></el-icon>
|
||||
</div>
|
||||
<span v-if="isSelected(f.url)" class="oa-comment-attach__check">
|
||||
<el-icon :size="12"><Check /></el-icon>
|
||||
</span>
|
||||
</div>
|
||||
<div class="oa-comment-attach__name">{{ f.fileName || f.url }}</div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
</div>
|
||||
<template #footer>
|
||||
<el-button class="btn-ghost" @click="attachVisible = false">
|
||||
@@ -127,46 +141,98 @@
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog
|
||||
v-model="mentionVisible"
|
||||
title="提到人员"
|
||||
width="480px"
|
||||
class="dialog-form-layout"
|
||||
align-center
|
||||
append-to-body
|
||||
modal-class="protocol-dialog-mask"
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<el-select
|
||||
v-model="mentionDraftIds"
|
||||
multiple
|
||||
filterable
|
||||
:loading="userLoading"
|
||||
placeholder="搜索姓名"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="u in dialogUserOptions"
|
||||
:key="u.id"
|
||||
:label="u.name"
|
||||
:value="u.id"
|
||||
/>
|
||||
</el-select>
|
||||
<template #footer>
|
||||
<el-button @click="mentionVisible = false">
|
||||
<el-icon><Close /></el-icon>
|
||||
取消
|
||||
</el-button>
|
||||
<el-button type="primary" @click="confirmMention">
|
||||
<el-icon><Check /></el-icon>
|
||||
确定
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
ChatDotRound,
|
||||
Check,
|
||||
Close,
|
||||
Paperclip,
|
||||
Promotion,
|
||||
RefreshLeft
|
||||
} from '@element-plus/icons-vue'
|
||||
import { Check, Close, Document, Paperclip, Promotion, Upload, User, VideoPlay } from '@element-plus/icons-vue'
|
||||
import { fetchUserOptions } from '@/api/admin'
|
||||
import { fetchUploadAttachment } from '@/api/business'
|
||||
import {
|
||||
fetchCreateOaComment,
|
||||
fetchOaFormAttachments,
|
||||
fetchRevokeOaComment,
|
||||
type OaCommentAttachmentRef,
|
||||
type OaInstanceComment
|
||||
type OaCommentAttachmentRef
|
||||
} from '@/api/oaApproval'
|
||||
import OaCommentFileCards from '@/components/oa-approval/OaCommentFileCards.vue'
|
||||
import { attachmentFullUrl } from '@/composables/useAttachmentActions'
|
||||
import { isOaUploadImageFile, isOaUploadVideoFile } from '@/utils/oa-upload-file-type'
|
||||
|
||||
defineOptions({ name: 'OaCommentPanel' })
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
instanceId: string
|
||||
instanceStatus: string
|
||||
comments?: OaInstanceComment[]
|
||||
}>(),
|
||||
{
|
||||
comments: () => []
|
||||
}
|
||||
)
|
||||
type MentionUser = { id: string; name: string }
|
||||
|
||||
const props = defineProps<{
|
||||
instanceId: string
|
||||
instanceStatus: string
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{ refresh: [] }>()
|
||||
|
||||
const inputRef = ref<any>(null)
|
||||
const draft = ref('')
|
||||
const picked = ref<OaCommentAttachmentRef[]>([])
|
||||
const sending = ref(false)
|
||||
const revokingId = ref('')
|
||||
const uploading = ref(false)
|
||||
const fileInputRef = ref<HTMLInputElement | null>(null)
|
||||
const OA_UPLOAD_ACCEPT = 'image/*,.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.zip,.rar'
|
||||
const mentionUsers = ref<MentionUser[]>([])
|
||||
const mentionVisible = ref(false)
|
||||
const mentionDraftIds = ref<string[]>([])
|
||||
const userLoading = ref(false)
|
||||
|
||||
/** 租户内启用用户缓存:@ 与弹窗共用,本地过滤,避免每次请求 */
|
||||
const allMentionUsers = ref<MentionUser[]>([])
|
||||
let userCachePromise: Promise<void> | null = null
|
||||
|
||||
const dialogUserOptions = computed(() => {
|
||||
const map = new Map(allMentionUsers.value.map((u) => [u.id, u]))
|
||||
for (const u of mentionUsers.value) map.set(u.id, u)
|
||||
return [...map.values()]
|
||||
})
|
||||
|
||||
const atOpen = ref(false)
|
||||
const atQuery = ref('')
|
||||
const atStart = ref(-1)
|
||||
const atActive = ref(0)
|
||||
const atOptions = ref<MentionUser[]>([])
|
||||
const atLoading = ref(false)
|
||||
|
||||
const attachVisible = ref(false)
|
||||
const attachLoading = ref(false)
|
||||
@@ -175,15 +241,238 @@
|
||||
>([])
|
||||
const selectedUrls = ref<string[]>([])
|
||||
|
||||
function openUrl(url: string) {
|
||||
const full = attachmentFullUrl(url) || url
|
||||
if (full) window.open(full, '_blank')
|
||||
function getTextareaEl(): HTMLTextAreaElement | null {
|
||||
const inst = inputRef.value
|
||||
if (!inst) return null
|
||||
if (inst.textarea instanceof HTMLTextAreaElement) return inst.textarea
|
||||
const el = inst.$el as HTMLElement | undefined
|
||||
return (el?.querySelector?.('textarea') as HTMLTextAreaElement | null) || null
|
||||
}
|
||||
|
||||
async function ensureUserCache() {
|
||||
if (allMentionUsers.value.length) return
|
||||
if (userCachePromise) return userCachePromise
|
||||
userCachePromise = (async () => {
|
||||
try {
|
||||
const res = await fetchUserOptions()
|
||||
const list = Array.isArray(res) ? res : []
|
||||
const next: MentionUser[] = []
|
||||
const seen = new Set<string>()
|
||||
for (const u of list) {
|
||||
const id = String(u?.value || '').trim()
|
||||
if (!id || seen.has(id)) continue
|
||||
seen.add(id)
|
||||
const name = String(u?.label || id).trim() || id
|
||||
next.push({ id, name })
|
||||
}
|
||||
allMentionUsers.value = next
|
||||
} catch {
|
||||
allMentionUsers.value = []
|
||||
} finally {
|
||||
userCachePromise = null
|
||||
}
|
||||
})()
|
||||
return userCachePromise
|
||||
}
|
||||
|
||||
function filterMentionUsers(keyword: string, excludeIds?: Set<string>): MentionUser[] {
|
||||
const q = (keyword || '').trim().toLowerCase()
|
||||
const out: MentionUser[] = []
|
||||
for (const u of allMentionUsers.value) {
|
||||
if (excludeIds?.has(u.id)) continue
|
||||
if (q && !u.name.toLowerCase().includes(q) && !u.id.toLowerCase().includes(q)) {
|
||||
continue
|
||||
}
|
||||
out.push(u)
|
||||
if (out.length >= 30) break
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
function closeAtSuggest() {
|
||||
atOpen.value = false
|
||||
atQuery.value = ''
|
||||
atStart.value = -1
|
||||
atActive.value = 0
|
||||
atOptions.value = []
|
||||
}
|
||||
|
||||
async function applyAtSuggest(query: string) {
|
||||
const needFetch = !allMentionUsers.value.length
|
||||
if (needFetch) atLoading.value = true
|
||||
try {
|
||||
await ensureUserCache()
|
||||
if (!atOpen.value) return
|
||||
const pickedIds = new Set(mentionUsers.value.map((u) => u.id))
|
||||
atOptions.value = filterMentionUsers(query, pickedIds)
|
||||
if (atActive.value >= atOptions.value.length) {
|
||||
atActive.value = Math.max(0, atOptions.value.length - 1)
|
||||
}
|
||||
} finally {
|
||||
atLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function detectAtSuggest() {
|
||||
const ta = getTextareaEl()
|
||||
if (!ta) {
|
||||
closeAtSuggest()
|
||||
return
|
||||
}
|
||||
const pos = ta.selectionStart ?? 0
|
||||
const before = draft.value.slice(0, pos)
|
||||
const matched = before.match(/(?:^|[\s\n])(@([^\s@]*))$/)
|
||||
if (!matched) {
|
||||
closeAtSuggest()
|
||||
return
|
||||
}
|
||||
const token = matched[1] || ''
|
||||
const query = matched[2] || ''
|
||||
atStart.value = before.length - token.length
|
||||
atQuery.value = query
|
||||
atOpen.value = true
|
||||
atActive.value = 0
|
||||
// 有缓存则同步过滤;无缓存才拉一次
|
||||
if (allMentionUsers.value.length) {
|
||||
const pickedIds = new Set(mentionUsers.value.map((u) => u.id))
|
||||
atOptions.value = filterMentionUsers(query, pickedIds)
|
||||
} else {
|
||||
void applyAtSuggest(query)
|
||||
}
|
||||
}
|
||||
|
||||
function onDraftInput() {
|
||||
nextTick(() => detectAtSuggest())
|
||||
}
|
||||
|
||||
function onDraftFocus() {
|
||||
void ensureUserCache()
|
||||
}
|
||||
|
||||
function onDraftKeydown(e: KeyboardEvent) {
|
||||
if (!atOpen.value) return
|
||||
if (e.key === 'ArrowDown') {
|
||||
e.preventDefault()
|
||||
if (!atOptions.value.length) return
|
||||
atActive.value = (atActive.value + 1) % atOptions.value.length
|
||||
return
|
||||
}
|
||||
if (e.key === 'ArrowUp') {
|
||||
e.preventDefault()
|
||||
if (!atOptions.value.length) return
|
||||
atActive.value = (atActive.value - 1 + atOptions.value.length) % atOptions.value.length
|
||||
return
|
||||
}
|
||||
if (e.key === 'Enter' || e.key === 'Tab') {
|
||||
const u = atOptions.value[atActive.value]
|
||||
if (!u) return
|
||||
e.preventDefault()
|
||||
pickAtUser(u)
|
||||
return
|
||||
}
|
||||
if (e.key === 'Escape') {
|
||||
e.preventDefault()
|
||||
closeAtSuggest()
|
||||
}
|
||||
}
|
||||
|
||||
function addMentionUser(u: MentionUser) {
|
||||
if (mentionUsers.value.some((x) => x.id === u.id)) return true
|
||||
if (mentionUsers.value.length >= 20) {
|
||||
ElMessage.warning('一次最多@20人')
|
||||
return false
|
||||
}
|
||||
mentionUsers.value.push(u)
|
||||
return true
|
||||
}
|
||||
|
||||
function pickAtUser(u: MentionUser) {
|
||||
if (!addMentionUser(u)) return
|
||||
const start = atStart.value
|
||||
if (start < 0) {
|
||||
closeAtSuggest()
|
||||
return
|
||||
}
|
||||
const ta = getTextareaEl()
|
||||
const end = ta?.selectionStart ?? draft.value.length
|
||||
const insert = `@${u.name} `
|
||||
draft.value = `${draft.value.slice(0, start)}${insert}${draft.value.slice(end)}`
|
||||
closeAtSuggest()
|
||||
nextTick(() => {
|
||||
const el = getTextareaEl()
|
||||
if (!el) return
|
||||
const pos = start + insert.length
|
||||
el.focus()
|
||||
el.setSelectionRange(pos, pos)
|
||||
})
|
||||
}
|
||||
|
||||
function fileLike(f: OaCommentAttachmentRef) {
|
||||
return { url: f.url, name: f.fileName }
|
||||
}
|
||||
|
||||
function isImageRef(f: OaCommentAttachmentRef) {
|
||||
return isOaUploadImageFile(fileLike(f))
|
||||
}
|
||||
|
||||
function isVideoRef(f: OaCommentAttachmentRef) {
|
||||
return isOaUploadVideoFile(fileLike(f))
|
||||
}
|
||||
|
||||
function thumbSrc(url: string) {
|
||||
return attachmentFullUrl(url) || url
|
||||
}
|
||||
|
||||
function isSelected(url: string) {
|
||||
return selectedUrls.value.includes(url)
|
||||
}
|
||||
|
||||
function toggleUrl(url: string) {
|
||||
const u = String(url || '').trim()
|
||||
if (!u) return
|
||||
const idx = selectedUrls.value.indexOf(u)
|
||||
if (idx >= 0) selectedUrls.value.splice(idx, 1)
|
||||
else selectedUrls.value.push(u)
|
||||
}
|
||||
|
||||
function removeMention(id: string) {
|
||||
mentionUsers.value = mentionUsers.value.filter((u) => u.id !== id)
|
||||
}
|
||||
|
||||
async function openMention() {
|
||||
closeAtSuggest()
|
||||
mentionDraftIds.value = mentionUsers.value.map((u) => u.id)
|
||||
mentionVisible.value = true
|
||||
userLoading.value = !allMentionUsers.value.length
|
||||
try {
|
||||
await ensureUserCache()
|
||||
} finally {
|
||||
userLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function confirmMention() {
|
||||
const map = new Map(allMentionUsers.value.map((u) => [u.id, u.name]))
|
||||
for (const u of mentionUsers.value) map.set(u.id, u.name)
|
||||
const next = mentionDraftIds.value
|
||||
.map((id) => ({ id, name: map.get(id) || id }))
|
||||
.slice(0, 20)
|
||||
mentionUsers.value = next
|
||||
for (const u of next) {
|
||||
const token = `@${u.name}`
|
||||
if (!draft.value.includes(token)) {
|
||||
draft.value = `${draft.value.trimEnd()}${draft.value.trim() ? ' ' : ''}${token} `
|
||||
}
|
||||
}
|
||||
mentionVisible.value = false
|
||||
}
|
||||
|
||||
async function openAttach() {
|
||||
attachVisible.value = true
|
||||
attachLoading.value = true
|
||||
selectedUrls.value = picked.value.map((f) => f.url)
|
||||
selectedUrls.value = picked.value
|
||||
.filter((f) => f.source !== 'upload')
|
||||
.map((f) => f.url)
|
||||
try {
|
||||
const res = await fetchOaFormAttachments(props.instanceId)
|
||||
const items = res?.items || []
|
||||
@@ -206,29 +495,76 @@
|
||||
if (f?.url) map.set(f.url, f)
|
||||
}
|
||||
}
|
||||
const next: OaCommentAttachmentRef[] = []
|
||||
const cited: OaCommentAttachmentRef[] = []
|
||||
for (const url of selectedUrls.value) {
|
||||
const found = map.get(url) || picked.value.find((p) => p.url === url)
|
||||
if (found) next.push({ ...found })
|
||||
const found = map.get(url) || picked.value.find((p) => p.url === url && p.source !== 'upload')
|
||||
if (found) cited.push({ ...found, source: 'form' })
|
||||
}
|
||||
picked.value = next
|
||||
const uploads = picked.value.filter((f) => f.source === 'upload')
|
||||
picked.value = [...cited, ...uploads]
|
||||
attachVisible.value = false
|
||||
}
|
||||
|
||||
function removePicked(index: number) {
|
||||
picked.value.splice(index, 1)
|
||||
}
|
||||
|
||||
function pickUpload() {
|
||||
fileInputRef.value?.click()
|
||||
}
|
||||
|
||||
async function onUploadFiles(ev: Event) {
|
||||
const input = ev.target as HTMLInputElement
|
||||
const files = Array.from(input.files || [])
|
||||
input.value = ''
|
||||
if (!files.length) return
|
||||
uploading.value = true
|
||||
try {
|
||||
for (const file of files) {
|
||||
const fd = new FormData()
|
||||
fd.append('file', file)
|
||||
fd.append('folder', 'oa-approval')
|
||||
const res: any = await fetchUploadAttachment(fd)
|
||||
const url = String(res?.fileUrl || res?.data?.fileUrl || '').trim()
|
||||
if (!url) {
|
||||
ElMessage.error(`${file.name || '文件'} 上传失败`)
|
||||
continue
|
||||
}
|
||||
if (picked.value.some((p) => p.url === url)) continue
|
||||
picked.value.push({
|
||||
source: 'upload',
|
||||
fieldKey: '',
|
||||
fieldLabel: '',
|
||||
url,
|
||||
fileName: String(res?.fileName || res?.data?.fileName || file.name || '').trim() || file.name
|
||||
})
|
||||
}
|
||||
} catch (e: any) {
|
||||
ElMessage.error(e?.message || '上传失败')
|
||||
} finally {
|
||||
uploading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function onSend() {
|
||||
const content = draft.value.trim()
|
||||
if (!content) {
|
||||
ElMessage.warning('请填写评论')
|
||||
if (!content && !mentionUsers.value.length && !picked.value.length) {
|
||||
ElMessage.warning('请填写评论、@人员或添加附件')
|
||||
return
|
||||
}
|
||||
sending.value = true
|
||||
try {
|
||||
await fetchCreateOaComment(props.instanceId, {
|
||||
content,
|
||||
attachmentRefs: picked.value.length ? [...picked.value] : undefined
|
||||
attachmentRefs: picked.value.length ? [...picked.value] : undefined,
|
||||
mentionUserIds: mentionUsers.value.length
|
||||
? mentionUsers.value.map((u) => u.id)
|
||||
: undefined
|
||||
})
|
||||
draft.value = ''
|
||||
picked.value = []
|
||||
mentionUsers.value = []
|
||||
closeAtSuggest()
|
||||
ElMessage.success('已发送')
|
||||
emit('refresh')
|
||||
} catch (e: any) {
|
||||
@@ -238,101 +574,29 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function onRevoke(c: OaInstanceComment) {
|
||||
try {
|
||||
await ElMessageBox.confirm('确定撤回该评论吗?', '提示', { type: 'warning' })
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
revokingId.value = c.id
|
||||
try {
|
||||
await fetchRevokeOaComment(props.instanceId, c.id)
|
||||
ElMessage.success('已撤回')
|
||||
emit('refresh')
|
||||
} catch (e: any) {
|
||||
ElMessage.error(e?.message || '撤回失败')
|
||||
} finally {
|
||||
revokingId.value = ''
|
||||
}
|
||||
}
|
||||
onMounted(() => {
|
||||
void ensureUserCache()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.oa-comment-panel {
|
||||
max-width: 960px;
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.oa-comment-panel__title {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
align-items: center;
|
||||
margin: 16px 0 12px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: var(--mint-text, #0f172a);
|
||||
.oa-comment-file-input {
|
||||
position: absolute;
|
||||
width: 0;
|
||||
height: 0;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.oa-comment-panel__title-icon {
|
||||
color: var(--primary, #10b981);
|
||||
font-size: 16px;
|
||||
.oa-comment-panel__files {
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.oa-comment-panel__empty {
|
||||
padding: 8px 0 12px;
|
||||
color: var(--mint-text-muted, #94a3b8);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.oa-comment-panel__list {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.oa-comment-panel__item {
|
||||
padding: 10px 0;
|
||||
border-bottom: 1px solid var(--mint-border, #e2e8f0);
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
}
|
||||
|
||||
.oa-comment-panel__revoked {
|
||||
color: var(--mint-text-muted, #94a3b8);
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.oa-comment-panel__meta {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
margin-bottom: 6px;
|
||||
|
||||
strong {
|
||||
color: var(--mint-text-strong, #0f172a);
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
|
||||
.oa-comment-panel__time {
|
||||
margin-left: 4px;
|
||||
color: var(--mint-text-muted, #94a3b8);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.oa-comment-panel__content {
|
||||
color: var(--mint-text, #334155);
|
||||
font-size: 13px;
|
||||
line-height: 1.55;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.oa-comment-panel__refs,
|
||||
.oa-comment-panel__picked {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
@@ -340,29 +604,65 @@
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.oa-comment-panel__ref {
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
color: var(--primary-dark, #059669);
|
||||
border-color: #a7f3d0;
|
||||
background: var(--primary-bg, #ecfdf5);
|
||||
}
|
||||
.oa-comment-panel__composer {
|
||||
padding-top: 4px;
|
||||
}
|
||||
|
||||
.oa-comment-panel__composer {
|
||||
margin-top: 12px;
|
||||
padding-top: 12px;
|
||||
border-top: 1px solid var(--mint-border, #e2e8f0);
|
||||
.oa-comment-panel__editor {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.oa-comment-panel__actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
justify-content: flex-end;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.oa-comment-at {
|
||||
position: absolute;
|
||||
top: calc(100% - 28px);
|
||||
left: 0;
|
||||
z-index: 20;
|
||||
width: min(320px, 100%);
|
||||
max-height: 220px;
|
||||
overflow: auto;
|
||||
background: #fff;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
|
||||
}
|
||||
|
||||
.oa-comment-at__item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
min-height: 36px;
|
||||
padding: 6px 12px;
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
background: transparent;
|
||||
border: none;
|
||||
|
||||
&:hover,
|
||||
&.is-active {
|
||||
background: var(--primary-bg, #ecfdf5);
|
||||
}
|
||||
}
|
||||
|
||||
.oa-comment-at__name {
|
||||
color: var(--mint-text-strong, #0f172a);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.oa-comment-at__empty {
|
||||
padding: 12px;
|
||||
color: var(--mint-text-muted, #94a3b8);
|
||||
font-size: 13px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.oa-comment-attach {
|
||||
min-height: 80px;
|
||||
}
|
||||
@@ -376,26 +676,110 @@
|
||||
|
||||
.oa-comment-attach__groups {
|
||||
display: grid;
|
||||
gap: 14px;
|
||||
gap: 16px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.oa-comment-attach__label {
|
||||
margin-bottom: 6px;
|
||||
margin-bottom: 8px;
|
||||
color: var(--mint-text-strong, #0f172a);
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.oa-comment-attach__files {
|
||||
display: grid;
|
||||
gap: 4px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.oa-comment-attach__file {
|
||||
margin-right: 0;
|
||||
height: auto;
|
||||
white-space: normal;
|
||||
align-items: flex-start;
|
||||
.oa-comment-attach__card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 88px;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
background: #fff;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 8px;
|
||||
transition:
|
||||
border-color 0.15s,
|
||||
box-shadow 0.15s;
|
||||
|
||||
&:hover {
|
||||
border-color: #a7f3d0;
|
||||
box-shadow: 0 2px 8px rgba(16, 185, 129, 0.12);
|
||||
}
|
||||
|
||||
&.is-selected {
|
||||
border-color: var(--primary, #10b981);
|
||||
box-shadow: 0 0 0 1px var(--primary, #10b981);
|
||||
}
|
||||
}
|
||||
|
||||
.oa-comment-attach__thumb {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 64px;
|
||||
overflow: hidden;
|
||||
background: #f8fafc;
|
||||
|
||||
img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
}
|
||||
|
||||
.oa-comment-attach__icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 8px;
|
||||
|
||||
&--video {
|
||||
color: #7c3aed;
|
||||
background: #ede9fe;
|
||||
}
|
||||
|
||||
&--doc {
|
||||
color: #0284c7;
|
||||
background: #e0f2fe;
|
||||
}
|
||||
}
|
||||
|
||||
.oa-comment-attach__check {
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
right: 4px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
color: #fff;
|
||||
background: var(--primary, #10b981);
|
||||
border-radius: 50%;
|
||||
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.18);
|
||||
}
|
||||
|
||||
.oa-comment-attach__name {
|
||||
display: -webkit-box;
|
||||
margin: 0;
|
||||
padding: 4px 6px;
|
||||
overflow: hidden;
|
||||
color: var(--mint-text, #334155);
|
||||
font-size: 11px;
|
||||
line-height: 1.3;
|
||||
word-break: break-all;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
</style>
|
||||
@@ -39,8 +39,11 @@
|
||||
<img
|
||||
class="el-upload-list__item-thumbnail"
|
||||
:src="attachmentFullUrl(file.url || '') || file.url"
|
||||
alt=""
|
||||
:alt="getOaUploadDisplayName(file)"
|
||||
/>
|
||||
<div class="oa-fc-upload-card__name is-on-image" :title="getOaUploadDisplayName(file)">
|
||||
{{ getOaUploadDisplayName(file) }}
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="isOaUploadVideoFile(file)">
|
||||
<div class="oa-fc-upload-card__icon oa-fc-upload-card__icon--video">
|
||||
@@ -130,22 +133,64 @@
|
||||
return Array.isArray(value) ? value : [value]
|
||||
}
|
||||
|
||||
function getFileName(file: string): string {
|
||||
return String(file).split('/').pop() || String(file)
|
||||
function basenameOf(url: string): string {
|
||||
const path = String(url || '').split('?')[0]
|
||||
const last = path.split('/').pop() || ''
|
||||
try {
|
||||
return decodeURIComponent(last)
|
||||
} catch {
|
||||
return last
|
||||
}
|
||||
}
|
||||
|
||||
function parseFile(file: unknown, i: number): UploadUserFile & { is_string?: boolean } {
|
||||
/** 表单值里的地址:上传成功后的服务端 URL,不用本地 blob */
|
||||
function pickStoredUrl(file: any): string {
|
||||
const url = String(file?.url || file?.fileUrl || '').trim()
|
||||
if (!url || url.startsWith('blob:')) return ''
|
||||
return url
|
||||
}
|
||||
|
||||
/**
|
||||
* 回显名优先用户本地原始文件名。
|
||||
* 旧数据只有 URL 时,退回路径最后一段(通常是存储 UUID)。
|
||||
*/
|
||||
function pickStoredName(file: any, url: string): string {
|
||||
const raw = String(file?.name || file?.fileName || file?.raw?.name || '').trim()
|
||||
if (raw && raw !== url && !raw.startsWith('blob:') && !/^https?:\/\//i.test(raw)) {
|
||||
const base = raw.includes('/') ? raw.split('/').pop() || raw : raw
|
||||
if (base) return base
|
||||
}
|
||||
return basenameOf(url) || '未命名文件'
|
||||
}
|
||||
|
||||
function serializeUploadValue(file: any): { url: string; name: string } | undefined {
|
||||
const url = pickStoredUrl(file)
|
||||
if (!url) return undefined
|
||||
return { url, name: pickStoredName(file, url) }
|
||||
}
|
||||
|
||||
function parseFile(file: unknown, i: number): UploadUserFile {
|
||||
if (typeof file === 'string') {
|
||||
const url = file
|
||||
return {
|
||||
url,
|
||||
name: basenameOf(url) || '未命名文件',
|
||||
uid: i,
|
||||
status: 'success'
|
||||
}
|
||||
}
|
||||
if (file && typeof file === 'object') {
|
||||
return file as UploadUserFile
|
||||
}
|
||||
const url = String(file || '')
|
||||
return {
|
||||
url,
|
||||
name: getFileName(url),
|
||||
uid: i,
|
||||
status: 'success',
|
||||
is_string: true
|
||||
const url = pickStoredUrl(file)
|
||||
if (!url) return file as UploadUserFile
|
||||
const src = file as UploadUserFile
|
||||
return {
|
||||
url,
|
||||
name: pickStoredName(file, url),
|
||||
uid: src.uid ?? i,
|
||||
status: src.status || 'success'
|
||||
}
|
||||
}
|
||||
return { url: '', name: '未命名文件', uid: i, status: 'success' }
|
||||
}
|
||||
|
||||
function parseUpload(file: UploadUserFile): UploadUserFile & {
|
||||
@@ -273,10 +318,8 @@
|
||||
{ fullFileUrl: (u) => attachmentFullUrl(u) }
|
||||
)
|
||||
},
|
||||
update(list: Array<UploadUserFile & { is_string?: boolean; value?: unknown; url?: string }>) {
|
||||
const files = list
|
||||
.map((v) => (v.is_string ? v.url : (v.value as any) || v.url))
|
||||
.filter((url) => url !== undefined)
|
||||
update(list: Array<UploadUserFile & { url?: string; name?: string }>) {
|
||||
const files = list.map((v) => serializeUploadValue(v)).filter(Boolean)
|
||||
this.$emit('update:modelValue', files)
|
||||
},
|
||||
handleChange(file: UploadFile, list: UploadFile[]) {
|
||||
@@ -310,6 +353,7 @@
|
||||
|
||||
<style scoped lang="scss">
|
||||
.oa-fc-upload-card {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
@@ -365,5 +409,17 @@
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
word-break: break-all;
|
||||
|
||||
&.is-on-image {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
margin-top: 0;
|
||||
padding: 10px 4px 4px;
|
||||
color: #fff;
|
||||
background: linear-gradient(180deg, rgba(15, 23, 42, 0), rgba(15, 23, 42, 0.72));
|
||||
-webkit-line-clamp: 1;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -33,18 +33,20 @@
|
||||
<pre v-else-if="!loading" class="oa-detail-dlg__json">{{ prettyForm }}</pre>
|
||||
</div>
|
||||
</section>
|
||||
<section class="oa-detail-dlg__section">
|
||||
<section class="oa-detail-dlg__section oa-detail-dlg__section--progress">
|
||||
<OaProgressChain
|
||||
v-if="detail?.id"
|
||||
:items="timelineItems"
|
||||
:instance-id="detail.id"
|
||||
@refresh="load"
|
||||
/>
|
||||
<OaCommentPanel
|
||||
v-if="detail?.id"
|
||||
:instance-id="detail.id"
|
||||
:instance-status="detail.status || ''"
|
||||
:comments="detail.comments || []"
|
||||
@refresh="load"
|
||||
/>
|
||||
</section>
|
||||
<section class="oa-detail-dlg__section oa-detail-dlg__section--progress">
|
||||
<OaProgressChain :items="timelineItems" />
|
||||
</section>
|
||||
</div>
|
||||
<template #footer>
|
||||
<el-button class="btn-ghost" @click="emit('update:modelValue', false)">
|
||||
@@ -62,6 +64,7 @@
|
||||
import { fetchOaInstanceDetail } from '@/api/oaApproval'
|
||||
import OaCommentPanel from '@/components/oa-approval/OaCommentPanel.vue'
|
||||
import OaProgressChain from '@/components/oa-approval/OaProgressChain.vue'
|
||||
import { mergeProgressWithComments } from '@/utils/oa-progress-merge-comments'
|
||||
import {
|
||||
OA_FC_DEFAULT_GUTTER,
|
||||
ensureOaUploadRuleProps
|
||||
@@ -98,8 +101,10 @@
|
||||
|
||||
const timelineItems = computed(() => {
|
||||
const list = detail.value?.progress
|
||||
if (!Array.isArray(list) || !list.length) return []
|
||||
return list
|
||||
if (!Array.isArray(list) || !list.length) {
|
||||
return mergeProgressWithComments([], detail.value?.comments || [])
|
||||
}
|
||||
const progressMapped = list
|
||||
.filter((p: any) => {
|
||||
const kind = String(p?.kind || '')
|
||||
const status = String(p?.status || '')
|
||||
@@ -132,6 +137,7 @@
|
||||
}))
|
||||
: []
|
||||
}))
|
||||
return mergeProgressWithComments(progressMapped, detail.value?.comments || [])
|
||||
})
|
||||
|
||||
function statusType(s: string) {
|
||||
|
||||
@@ -11,70 +11,105 @@
|
||||
<div class="oa-flow-dot" :class="dotClass(item)" />
|
||||
<div v-if="idx < items.length - 1" class="oa-flow-line" />
|
||||
</div>
|
||||
<div class="oa-flow-card">
|
||||
<div class="oa-flow-card__row">
|
||||
<span class="oa-flow-card__name">{{ item.title }}</span>
|
||||
<span v-if="statusBadge(item)" class="oa-flow-badge" :class="statusBadge(item)">
|
||||
{{ nodeStatusText(item) }}
|
||||
</span>
|
||||
<span v-if="signBadge(item)" class="oa-flow-badge" :class="signBadge(item)">
|
||||
{{ signBadgeText(item) }}
|
||||
</span>
|
||||
<span v-else-if="item.taskType === 'cc'" class="oa-flow-badge cc">抄送</span>
|
||||
<span v-else-if="item.taskType === 'end'" class="oa-flow-badge mute">结束</span>
|
||||
<template v-if="showNodeTimestamp(item)">
|
||||
<span class="oa-flow-card__sep">·</span>
|
||||
<span class="oa-flow-card__meta" :title="item.timestamp">{{ item.timestamp }}</span>
|
||||
<div class="oa-flow-card" :class="{ 'is-comment': item.kind === 'comment' }">
|
||||
<!-- 讨论评论(钉钉式时间线条目) -->
|
||||
<template v-if="item.kind === 'comment'">
|
||||
<div v-if="item.status === 'revoked'" class="oa-flow-comment-revoked">
|
||||
{{ item.title }} 撤回了一条评论
|
||||
<span v-if="item.revokedTime" class="oa-flow-card__meta">{{ item.revokedTime }}</span>
|
||||
</div>
|
||||
<template v-else>
|
||||
<div class="oa-flow-card__row">
|
||||
<span class="oa-flow-card__name">{{ item.title }}</span>
|
||||
<span class="oa-flow-badge cc">评论</span>
|
||||
<template v-if="showNodeTimestamp(item)">
|
||||
<span class="oa-flow-card__sep">·</span>
|
||||
<span class="oa-flow-card__meta" :title="item.timestamp">{{ item.timestamp }}</span>
|
||||
</template>
|
||||
<el-button
|
||||
v-if="item.canRevoke && item.commentId"
|
||||
class="oa-flow-comment-revoke"
|
||||
link
|
||||
type="danger"
|
||||
:loading="revokingId === item.commentId"
|
||||
@click="onRevokeComment(item)"
|
||||
>
|
||||
<el-icon><RefreshLeft /></el-icon>
|
||||
撤回
|
||||
</el-button>
|
||||
</div>
|
||||
<div v-if="item.commentText" class="oa-flow-card__comment oa-flow-card__comment--body">
|
||||
{{ item.commentText }}
|
||||
</div>
|
||||
<div v-if="mentionText(item)" class="oa-flow-comment-mentions">提到:{{ mentionText(item) }}</div>
|
||||
<OaCommentFileCards v-if="item.attachmentRefs?.length" :files="item.attachmentRefs" />
|
||||
</template>
|
||||
<template v-if="item.resolveSource && item.kind === 'task'">
|
||||
<span class="oa-flow-card__sep">·</span>
|
||||
<span class="oa-flow-card__meta" :title="resolveSourceText(item.resolveSource)">
|
||||
{{ resolveSourceText(item.resolveSource) }}
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="oa-flow-card__row">
|
||||
<span class="oa-flow-card__name">{{ item.title }}</span>
|
||||
<span v-if="statusBadge(item)" class="oa-flow-badge" :class="statusBadge(item)">
|
||||
{{ nodeStatusText(item) }}
|
||||
</span>
|
||||
</template>
|
||||
<span
|
||||
v-if="displayPeople(item).length && item.kind !== 'terminal'"
|
||||
class="oa-flow-card__people"
|
||||
>
|
||||
<span v-if="signBadge(item)" class="oa-flow-badge" :class="signBadge(item)">
|
||||
{{ signBadgeText(item) }}
|
||||
</span>
|
||||
<span v-else-if="item.taskType === 'cc'" class="oa-flow-badge cc">抄送</span>
|
||||
<span v-else-if="item.taskType === 'end'" class="oa-flow-badge mute">结束</span>
|
||||
<template v-if="showNodeTimestamp(item)">
|
||||
<span class="oa-flow-card__sep">·</span>
|
||||
<span class="oa-flow-card__meta" :title="item.timestamp">{{ item.timestamp }}</span>
|
||||
</template>
|
||||
<template v-if="item.resolveSource && item.kind === 'task'">
|
||||
<span class="oa-flow-card__sep">·</span>
|
||||
<span class="oa-flow-card__meta" :title="resolveSourceText(item.resolveSource)">
|
||||
{{ resolveSourceText(item.resolveSource) }}
|
||||
</span>
|
||||
</template>
|
||||
<span
|
||||
v-for="p in displayPeople(item)"
|
||||
:key="p.id || p.nickName"
|
||||
class="oa-person-chip"
|
||||
:class="personChipClass(p.status)"
|
||||
:title="personTitle(p)"
|
||||
v-if="displayPeople(item).length && item.kind !== 'terminal'"
|
||||
class="oa-flow-card__people"
|
||||
>
|
||||
<span class="oa-person-chip__dot">{{ avatarChar(p.nickName) }}</span>
|
||||
{{ p.nickName }}
|
||||
<span v-if="personStatusHint(p.status)" class="oa-person-chip__st">
|
||||
{{ personStatusHint(p.status) }}
|
||||
<span
|
||||
v-for="p in displayPeople(item)"
|
||||
:key="p.id || p.nickName"
|
||||
class="oa-person-chip"
|
||||
:class="personChipClass(p.status)"
|
||||
:title="personTitle(p)"
|
||||
>
|
||||
<span class="oa-person-chip__dot">{{ avatarChar(p.nickName) }}</span>
|
||||
{{ p.nickName }}
|
||||
<span v-if="personStatusHint(p.status)" class="oa-person-chip__st">
|
||||
{{ personStatusHint(p.status) }}
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
<div v-if="personLines(item).length" class="oa-person-lines">
|
||||
<p
|
||||
v-for="(line, li) in personLines(item)"
|
||||
:key="`${item.key}-pl-${li}`"
|
||||
class="oa-person-line"
|
||||
:class="{
|
||||
'is-ok': line.tone === 'ok',
|
||||
'is-pending': line.tone === 'pending',
|
||||
'is-danger': line.tone === 'danger',
|
||||
'is-mute': line.tone === 'mute'
|
||||
}"
|
||||
</div>
|
||||
<div v-if="personLines(item).length" class="oa-person-lines">
|
||||
<p
|
||||
v-for="(line, li) in personLines(item)"
|
||||
:key="`${item.key}-pl-${li}`"
|
||||
class="oa-person-line"
|
||||
:class="{
|
||||
'is-ok': line.tone === 'ok',
|
||||
'is-pending': line.tone === 'pending',
|
||||
'is-danger': line.tone === 'danger',
|
||||
'is-mute': line.tone === 'mute'
|
||||
}"
|
||||
>
|
||||
{{ line.text }}
|
||||
</p>
|
||||
</div>
|
||||
<div
|
||||
v-else-if="item.kind === 'terminal' && item.status === 'cancelled' && terminalWithdrawText(item)"
|
||||
class="oa-person-lines"
|
||||
>
|
||||
{{ line.text }}
|
||||
</p>
|
||||
</div>
|
||||
<div
|
||||
v-else-if="item.kind === 'terminal' && item.status === 'cancelled' && terminalWithdrawText(item)"
|
||||
class="oa-person-lines"
|
||||
>
|
||||
<p class="oa-person-line is-danger">{{ terminalWithdrawText(item) }}</p>
|
||||
</div>
|
||||
<div v-else-if="showNodeComment(item)" class="oa-flow-card__comment">
|
||||
意见:{{ item.commentText }}
|
||||
</div>
|
||||
<p class="oa-person-line is-danger">{{ terminalWithdrawText(item) }}</p>
|
||||
</div>
|
||||
<div v-else-if="showNodeComment(item)" class="oa-flow-card__comment">
|
||||
意见:{{ item.commentText }}
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -82,6 +117,9 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { RefreshLeft } from '@element-plus/icons-vue'
|
||||
import { fetchRevokeOaComment, type OaCommentAttachmentRef } from '@/api/oaApproval'
|
||||
import OaCommentFileCards from '@/components/oa-approval/OaCommentFileCards.vue'
|
||||
import {
|
||||
formatProgressPersonLines,
|
||||
type ProgressPersonLine
|
||||
@@ -112,17 +150,61 @@
|
||||
kind?: string
|
||||
signMode?: string
|
||||
people?: OaProgressPerson[]
|
||||
/** kind=comment */
|
||||
attachmentRefs?: OaCommentAttachmentRef[]
|
||||
canRevoke?: boolean
|
||||
commentId?: string
|
||||
commentStatus?: string
|
||||
revokedTime?: string
|
||||
mentions?: Array<{ userId: string; userName: string }>
|
||||
}
|
||||
|
||||
withDefaults(
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
items?: OaProgressChainItem[]
|
||||
/** 用于进度内撤回评论 */
|
||||
instanceId?: string
|
||||
}>(),
|
||||
{
|
||||
items: () => []
|
||||
items: () => [],
|
||||
instanceId: ''
|
||||
}
|
||||
)
|
||||
|
||||
const emit = defineEmits<{
|
||||
refresh: []
|
||||
}>()
|
||||
|
||||
const revokingId = ref('')
|
||||
|
||||
function mentionText(item: OaProgressChainItem) {
|
||||
const names = (item.mentions || [])
|
||||
.map((m) => String(m.userName || m.userId || '').trim())
|
||||
.filter(Boolean)
|
||||
return names.join('、')
|
||||
}
|
||||
|
||||
async function onRevokeComment(item: OaProgressChainItem) {
|
||||
const id = String(item.commentId || '').trim()
|
||||
const instanceId = String(props.instanceId || '').trim()
|
||||
if (!id || !instanceId) return
|
||||
try {
|
||||
await ElMessageBox.confirm('确定撤回该评论吗?', '提示', { type: 'warning' })
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
revokingId.value = id
|
||||
try {
|
||||
await fetchRevokeOaComment(instanceId, id)
|
||||
ElMessage.success('已撤回')
|
||||
emit('refresh')
|
||||
} catch (e: any) {
|
||||
ElMessage.error(e?.message || '撤回失败')
|
||||
} finally {
|
||||
revokingId.value = ''
|
||||
}
|
||||
}
|
||||
|
||||
function statusText(s: string) {
|
||||
const map: Record<string, string> = {
|
||||
pending: '待处理',
|
||||
@@ -135,7 +217,9 @@
|
||||
submitted: '已提交',
|
||||
not_reached: '未到达',
|
||||
returned: '已打回',
|
||||
transferred: '已转交'
|
||||
transferred: '已转交',
|
||||
commented: '评论',
|
||||
revoked: '已撤回'
|
||||
}
|
||||
return map[s] || s
|
||||
}
|
||||
@@ -187,7 +271,7 @@
|
||||
}
|
||||
|
||||
function personLines(item: OaProgressChainItem): ProgressPersonLine[] {
|
||||
if (item.kind === 'terminal' || item.kind === 'submit') return []
|
||||
if (item.kind === 'terminal' || item.kind === 'submit' || item.kind === 'comment') return []
|
||||
if (item.taskType === 'cc' || item.signMode === 'cc') return []
|
||||
const list = displayPeople(item)
|
||||
if (!list.length) return []
|
||||
@@ -195,6 +279,7 @@
|
||||
}
|
||||
|
||||
function showNodeComment(item: OaProgressChainItem): boolean {
|
||||
if (item.kind === 'comment') return false
|
||||
// 有按人行时不再展示节点级拼接意见,避免双份
|
||||
if (personLines(item).length) return false
|
||||
if (item.kind === 'terminal' && item.status === 'cancelled') return false
|
||||
@@ -252,6 +337,10 @@
|
||||
|
||||
function dotClass(item: OaProgressChainItem) {
|
||||
const s = item.status || ''
|
||||
if (item.kind === 'comment') {
|
||||
if (s === 'revoked') return ''
|
||||
return 'ok'
|
||||
}
|
||||
if (item.kind !== 'terminal' && s === 'cancelled') return ''
|
||||
if (s === 'approved' || s === 'completed' || s === 'done' || s === 'submitted') return 'ok'
|
||||
if (s === 'pending' || s === 'running') return 'pending'
|
||||
@@ -414,6 +503,32 @@
|
||||
color: var(--mint-text, #334155);
|
||||
font-size: 12px;
|
||||
line-height: 1.4;
|
||||
|
||||
&--body {
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
}
|
||||
}
|
||||
|
||||
.oa-flow-card.is-comment {
|
||||
background: #f8fafc;
|
||||
}
|
||||
|
||||
.oa-flow-comment-revoked {
|
||||
color: var(--mint-text-muted, #94a3b8);
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.oa-flow-comment-revoke {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.oa-flow-comment-mentions {
|
||||
margin-top: 6px;
|
||||
color: var(--primary, #10b981);
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.oa-person-lines {
|
||||
|
||||
@@ -7,7 +7,8 @@ import type { AppRouteRecord } from '@/types/router'
|
||||
export const sqxpAdminRoutes: AppRouteRecord[] = [
|
||||
// ═══════════════════════════════════════════════════════════════════════════
|
||||
// 1. 市场 (menu:market)
|
||||
// 二级菜单:细胞存储、科研捐赠、中试服务、基础实验、市场基础信息
|
||||
// 二级菜单:细胞存储、科研捐赠、市场基础信息、中试服务、基础实验
|
||||
// (主推存储/捐赠在前;中试/基础实验及关联基础信息后置)
|
||||
// ═══════════════════════════════════════════════════════════════════════════
|
||||
{
|
||||
id: 'TOP00000000000000000000000000001',
|
||||
@@ -218,6 +219,228 @@ export const sqxpAdminRoutes: AppRouteRecord[] = [
|
||||
]
|
||||
},
|
||||
|
||||
// ── 市场基础信息(前段:存储/捐赠相关;后段:中试/基础实验相关)──
|
||||
{
|
||||
id: 'MKT00000000000000000000000000001',
|
||||
name: 'MarketInfo',
|
||||
path: 'market-info',
|
||||
component: '',
|
||||
meta: {
|
||||
title: '市场基础信息',
|
||||
icon: 'ri:price-tag-3-line',
|
||||
keepAlive: false,
|
||||
roles: ['admin']
|
||||
},
|
||||
children: [
|
||||
{
|
||||
id: '122',
|
||||
name: 'BizCellSampleType',
|
||||
path: 'cell-sample-type',
|
||||
component: '/basic-info/cell-sample-type/index',
|
||||
meta: {
|
||||
title: '细胞样本基础信息维护',
|
||||
keepAlive: true,
|
||||
menuCode: 'biz:cellSampleType:list'
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
id: '125',
|
||||
name: 'BizSampleCode',
|
||||
path: 'sample-code',
|
||||
component: '/basic-info/sample-code/index',
|
||||
meta: {
|
||||
title: '样本编码管理',
|
||||
keepAlive: false,
|
||||
isHide: true,
|
||||
menuCode: 'biz:sampleCode:list'
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
id: '123',
|
||||
name: 'BizCollectionRegion',
|
||||
path: 'collection-region',
|
||||
component: '/basic-info/collection-region/index',
|
||||
meta: {
|
||||
title: '采集地区及医院',
|
||||
keepAlive: true,
|
||||
menuCode: 'biz:collectionRegion:list'
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
id: '124',
|
||||
name: 'BizCollectionProtocolNo',
|
||||
path: 'collection-protocol-no',
|
||||
component: '/basic-info/collection-protocol-no/index',
|
||||
meta: {
|
||||
title: '采集协议号管理',
|
||||
keepAlive: false,
|
||||
isHide: true,
|
||||
menuCode: 'biz:collectionProtocolNo:list'
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
id: '40000000000000000000000000000007',
|
||||
name: 'BasicInfoInsuranceCompany',
|
||||
path: 'insurance-company',
|
||||
component: '/basic-info/insurance-company/index',
|
||||
meta: {
|
||||
title: '保险公司及险种价格',
|
||||
keepAlive: true,
|
||||
menuCode: 'basic-info:insurance-company:list'
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
id: '50000000000000000000000000000009',
|
||||
name: 'MarketMaterial',
|
||||
path: 'material',
|
||||
component: '/cell-storage/material/index',
|
||||
meta: {
|
||||
title: '市场物料库',
|
||||
keepAlive: true,
|
||||
menuCode: 'biz:material:list'
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
id: '95000000000000000000000000000003',
|
||||
name: 'MarketMyMaterialUsage',
|
||||
path: 'my-material-usage',
|
||||
component: '/cell-storage/my-material-usage/index',
|
||||
meta: {
|
||||
title: '我的物料领用记录',
|
||||
keepAlive: true,
|
||||
menuCode: 'market:material-usage:list'
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
id: '50000000000000000000000000000010',
|
||||
name: 'MarketMaterialStockLog',
|
||||
path: 'material-stock-log',
|
||||
component: '/cell-storage/material-stock-log/index',
|
||||
meta: {
|
||||
title: '市场物料变动记录',
|
||||
keepAlive: false,
|
||||
isHide: true,
|
||||
menuCode: 'biz:materialStockLog:list'
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
id: '121',
|
||||
name: 'BizCustomer',
|
||||
path: 'customer',
|
||||
component: '/basic-info/customer/index',
|
||||
meta: { title: '客户管理', keepAlive: true, menuCode: 'biz:customer:list' }
|
||||
},
|
||||
|
||||
{
|
||||
id: '80000000000000000000000000000002',
|
||||
name: 'CellProductType',
|
||||
path: 'cell-product-type',
|
||||
component: '/pilot-service/cell-product-type/index',
|
||||
meta: {
|
||||
title: '细胞产品基础信息维护',
|
||||
keepAlive: true,
|
||||
menuCode: 'pilot-service:cell-product-type:list'
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
id: '80000000000000000000000000000003',
|
||||
name: 'CellProductSpec',
|
||||
path: 'cell-product-spec',
|
||||
component: '/pilot-service/cell-product-spec/index',
|
||||
meta: {
|
||||
title: '细胞产品规格管理',
|
||||
keepAlive: false,
|
||||
isHide: true,
|
||||
menuCode: 'pilot-service:cell-product-spec:list'
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
id: '80000000000000000000000000000004',
|
||||
name: 'CellProductPrice',
|
||||
path: 'cell-product-price',
|
||||
component: '/pilot-service/cell-product-price/index',
|
||||
meta: {
|
||||
title: '细胞产品价格体系管理',
|
||||
keepAlive: false,
|
||||
isHide: true,
|
||||
menuCode: 'pilot-service:cell-product-price:list'
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
id: '80000000000000000000000000000005',
|
||||
name: 'ProjectPriceSystem',
|
||||
path: 'project-price-system',
|
||||
component: '/pilot-service/project-price-system/index',
|
||||
meta: {
|
||||
title: '细胞产品项目价格管理',
|
||||
keepAlive: false,
|
||||
isHide: true,
|
||||
menuCode: 'pilot-service:project-price-system:list'
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
id: '80000000000000000000000000000007',
|
||||
name: 'CheckupInstitution',
|
||||
path: 'checkup-institution',
|
||||
component: '/pilot-service/checkup-institution/index',
|
||||
meta: {
|
||||
title: '体检机构及项目价格',
|
||||
keepAlive: true,
|
||||
menuCode: 'pilot-service:checkup-institution:list'
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
id: '80000000000000000000000000000006',
|
||||
name: 'Channel',
|
||||
path: 'channel',
|
||||
component: '/pilot-service/channel/index',
|
||||
meta: {
|
||||
title: '渠道信息管理',
|
||||
keepAlive: true,
|
||||
menuCode: 'pilot-service:channel:list'
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
id: '80000000000000000000000000000008',
|
||||
name: 'ChannelServiceOrder',
|
||||
path: 'channel-service-order',
|
||||
component: '/pilot-service/channel-service-order/index',
|
||||
meta: {
|
||||
title: '渠道服务购买订单',
|
||||
keepAlive: false,
|
||||
isHide: true,
|
||||
menuCode: 'pilot-service:channel-service-order:list'
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
id: '80000000000000000000000000000009',
|
||||
name: 'ChannelServiceOrderFinance',
|
||||
path: 'channel-service-order-finance',
|
||||
component: '/pilot-service/channel-service-order-finance/index',
|
||||
meta: {
|
||||
title: '渠道服务订单(财务确认)',
|
||||
keepAlive: true,
|
||||
menuCode: 'pilot-service:channel-service-order-finance:list'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
// ── 中试服务 ──────────────────────────────────────────────────────────
|
||||
{
|
||||
id: 'PIL00000000000000000000000000001',
|
||||
@@ -334,212 +557,6 @@ export const sqxpAdminRoutes: AppRouteRecord[] = [
|
||||
props: { bizType: 'basic_experiment' }
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
// ── 市场基础信息 ─────────────────────────────────────────────────────
|
||||
{
|
||||
id: 'MKT00000000000000000000000000001',
|
||||
name: 'MarketInfo',
|
||||
path: 'market-info',
|
||||
component: '',
|
||||
meta: {
|
||||
title: '市场基础信息',
|
||||
icon: 'ri:price-tag-3-line',
|
||||
keepAlive: false,
|
||||
roles: ['admin']
|
||||
},
|
||||
children: [
|
||||
{
|
||||
id: '122',
|
||||
name: 'BizCellSampleType',
|
||||
path: 'cell-sample-type',
|
||||
component: '/basic-info/cell-sample-type/index',
|
||||
meta: {
|
||||
title: '细胞样本基础信息维护',
|
||||
keepAlive: true,
|
||||
menuCode: 'biz:cellSampleType:list'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: '125',
|
||||
name: 'BizSampleCode',
|
||||
path: 'sample-code',
|
||||
component: '/basic-info/sample-code/index',
|
||||
meta: {
|
||||
title: '样本编码管理',
|
||||
keepAlive: false,
|
||||
isHide: true,
|
||||
menuCode: 'biz:sampleCode:list'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: '123',
|
||||
name: 'BizCollectionRegion',
|
||||
path: 'collection-region',
|
||||
component: '/basic-info/collection-region/index',
|
||||
meta: {
|
||||
title: '细胞采集基础信息维护',
|
||||
keepAlive: true,
|
||||
menuCode: 'biz:collectionRegion:list'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: '124',
|
||||
name: 'BizCollectionProtocolNo',
|
||||
path: 'collection-protocol-no',
|
||||
component: '/basic-info/collection-protocol-no/index',
|
||||
meta: {
|
||||
title: '采集协议号管理',
|
||||
keepAlive: false,
|
||||
isHide: true,
|
||||
menuCode: 'biz:collectionProtocolNo:list'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: '80000000000000000000000000000002',
|
||||
name: 'CellProductType',
|
||||
path: 'cell-product-type',
|
||||
component: '/pilot-service/cell-product-type/index',
|
||||
meta: {
|
||||
title: '细胞产品基础信息维护',
|
||||
keepAlive: true,
|
||||
menuCode: 'pilot-service:cell-product-type:list'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: '80000000000000000000000000000003',
|
||||
name: 'CellProductSpec',
|
||||
path: 'cell-product-spec',
|
||||
component: '/pilot-service/cell-product-spec/index',
|
||||
meta: {
|
||||
title: '细胞产品规格管理',
|
||||
keepAlive: false,
|
||||
isHide: true,
|
||||
menuCode: 'pilot-service:cell-product-spec:list'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: '80000000000000000000000000000004',
|
||||
name: 'CellProductPrice',
|
||||
path: 'cell-product-price',
|
||||
component: '/pilot-service/cell-product-price/index',
|
||||
meta: {
|
||||
title: '细胞产品价格体系管理',
|
||||
keepAlive: false,
|
||||
isHide: true,
|
||||
menuCode: 'pilot-service:cell-product-price:list'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: '80000000000000000000000000000005',
|
||||
name: 'ProjectPriceSystem',
|
||||
path: 'project-price-system',
|
||||
component: '/pilot-service/project-price-system/index',
|
||||
meta: {
|
||||
title: '细胞产品项目价格管理',
|
||||
keepAlive: false,
|
||||
isHide: true,
|
||||
menuCode: 'pilot-service:project-price-system:list'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: '40000000000000000000000000000007',
|
||||
name: 'BasicInfoInsuranceCompany',
|
||||
path: 'insurance-company',
|
||||
component: '/basic-info/insurance-company/index',
|
||||
meta: {
|
||||
title: '保险公司及险种价格',
|
||||
keepAlive: true,
|
||||
menuCode: 'basic-info:insurance-company:list'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: '80000000000000000000000000000007',
|
||||
name: 'CheckupInstitution',
|
||||
path: 'checkup-institution',
|
||||
component: '/pilot-service/checkup-institution/index',
|
||||
meta: {
|
||||
title: '体检机构及项目价格',
|
||||
keepAlive: true,
|
||||
menuCode: 'pilot-service:checkup-institution:list'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: '50000000000000000000000000000009',
|
||||
name: 'MarketMaterial',
|
||||
path: 'material',
|
||||
component: '/cell-storage/material/index',
|
||||
meta: {
|
||||
title: '市场物料库',
|
||||
keepAlive: true,
|
||||
menuCode: 'biz:material:list'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: '95000000000000000000000000000003',
|
||||
name: 'MarketMyMaterialUsage',
|
||||
path: 'my-material-usage',
|
||||
component: '/cell-storage/my-material-usage/index',
|
||||
meta: {
|
||||
title: '我的物料领用记录',
|
||||
keepAlive: true,
|
||||
menuCode: 'market:material-usage:list'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: '50000000000000000000000000000010',
|
||||
name: 'MarketMaterialStockLog',
|
||||
path: 'material-stock-log',
|
||||
component: '/cell-storage/material-stock-log/index',
|
||||
meta: {
|
||||
title: '市场物料变动记录',
|
||||
keepAlive: false,
|
||||
isHide: true,
|
||||
menuCode: 'biz:materialStockLog:list'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: '121',
|
||||
name: 'BizCustomer',
|
||||
path: 'customer',
|
||||
component: '/basic-info/customer/index',
|
||||
meta: { title: '客户管理', keepAlive: true, menuCode: 'biz:customer:list' }
|
||||
},
|
||||
{
|
||||
id: '80000000000000000000000000000006',
|
||||
name: 'Channel',
|
||||
path: 'channel',
|
||||
component: '/pilot-service/channel/index',
|
||||
meta: {
|
||||
title: '渠道信息管理',
|
||||
keepAlive: true,
|
||||
menuCode: 'pilot-service:channel:list'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: '80000000000000000000000000000008',
|
||||
name: 'ChannelServiceOrder',
|
||||
path: 'channel-service-order',
|
||||
component: '/pilot-service/channel-service-order/index',
|
||||
meta: {
|
||||
title: '渠道服务购买订单',
|
||||
keepAlive: false,
|
||||
isHide: true,
|
||||
menuCode: 'pilot-service:channel-service-order:list'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: '80000000000000000000000000000009',
|
||||
name: 'ChannelServiceOrderFinance',
|
||||
path: 'channel-service-order-finance',
|
||||
component: '/pilot-service/channel-service-order-finance/index',
|
||||
meta: {
|
||||
title: '渠道服务订单(财务确认)',
|
||||
keepAlive: true,
|
||||
menuCode: 'pilot-service:channel-service-order-finance:list'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -1512,6 +1529,17 @@ export const sqxpAdminRoutes: AppRouteRecord[] = [
|
||||
menuCode: 'oa:cc'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'OA000000000000000000000000000110',
|
||||
name: 'OaApprovalMention',
|
||||
path: 'mentions',
|
||||
component: '/oa-approval/mentions/index',
|
||||
meta: {
|
||||
title: '提到我的',
|
||||
keepAlive: true,
|
||||
menuCode: 'oa:mention'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'OA000000000000000000000000000108',
|
||||
name: 'OaApprovalReceiveAccounts',
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
import type { OaCommentAttachmentRef, OaInstanceComment } from '@/api/oaApproval'
|
||||
|
||||
/** 进度链条目(与 OaProgressChain 对齐;评论条目带扩展字段) */
|
||||
export type ProgressTimelineItem = {
|
||||
key: string
|
||||
title: string
|
||||
status: string
|
||||
timestamp?: string
|
||||
assignee?: string
|
||||
resolveSource?: string
|
||||
commentText?: string
|
||||
taskType?: string
|
||||
kind?: string
|
||||
signMode?: string
|
||||
people?: Array<Record<string, any>>
|
||||
attachmentRefs?: OaCommentAttachmentRef[]
|
||||
canRevoke?: boolean
|
||||
commentId?: string
|
||||
commentStatus?: string
|
||||
revokedTime?: string
|
||||
mentions?: Array<{ userId: string; userName: string }>
|
||||
}
|
||||
|
||||
/** 当前待审 / 未落地节点:不参与与评论的时间交错,挂在已办节点与评论之后。 */
|
||||
function isNotReached(item: ProgressTimelineItem): boolean {
|
||||
return String(item.status || '') === 'not_reached'
|
||||
}
|
||||
|
||||
function isCurrentPending(item: ProgressTimelineItem): boolean {
|
||||
if (isNotReached(item)) return false
|
||||
const status = String(item.status || '')
|
||||
const kind = String(item.kind || '')
|
||||
return status === 'pending' || status === 'running' || kind === 'pending_node'
|
||||
}
|
||||
|
||||
/**
|
||||
* 将讨论评论按时间插入审批进度(钉钉式)。
|
||||
* - 已办节点(发起/已同意/已拒绝/抄送完成等)与评论按时间交错
|
||||
* - 当前待审节点挂在其后(评论落在「最后一个已办节点」后面)
|
||||
* - 未到达节点仍在轴末
|
||||
*/
|
||||
export function mergeProgressWithComments(
|
||||
progressItems: ProgressTimelineItem[],
|
||||
comments: OaInstanceComment[] | undefined | null
|
||||
): ProgressTimelineItem[] {
|
||||
const base = Array.isArray(progressItems) ? [...progressItems] : []
|
||||
const future = base.filter((p) => isNotReached(p))
|
||||
const current = base.filter((p) => isCurrentPending(p))
|
||||
const done = base.filter((p) => !isNotReached(p) && !isCurrentPending(p))
|
||||
|
||||
const commentRows: ProgressTimelineItem[] = (comments || []).map((c) => ({
|
||||
key: `comment-${c.id}`,
|
||||
kind: 'comment',
|
||||
title: c.createByName || c.createBy || '评论',
|
||||
status: c.status === 'revoked' ? 'revoked' : 'commented',
|
||||
timestamp: c.createTime || '',
|
||||
commentText: c.content || '',
|
||||
assignee: c.createByName || c.createBy || '',
|
||||
attachmentRefs: Array.isArray(c.attachmentRefs) ? c.attachmentRefs : [],
|
||||
canRevoke: !!c.canRevoke,
|
||||
commentId: c.id,
|
||||
commentStatus: c.status || 'normal',
|
||||
revokedTime: c.revokedTime || '',
|
||||
mentions: Array.isArray(c.mentions) ? c.mentions : []
|
||||
}))
|
||||
|
||||
const merged = [...done, ...commentRows].sort((a, b) => {
|
||||
const ta = String(a.timestamp || '')
|
||||
const tb = String(b.timestamp || '')
|
||||
if (ta !== tb) return ta < tb ? -1 : 1
|
||||
const aIsComment = a.kind === 'comment'
|
||||
const bIsComment = b.kind === 'comment'
|
||||
if (aIsComment !== bIsComment) return aIsComment ? 1 : -1
|
||||
return String(a.key || '').localeCompare(String(b.key || ''))
|
||||
})
|
||||
|
||||
return [...merged, ...current, ...future]
|
||||
}
|
||||
@@ -31,77 +31,72 @@
|
||||
<div class="form-container">
|
||||
<div class="form-header">
|
||||
<h2>欢迎登录</h2>
|
||||
<p>微信扫一扫,授权手机号后自动登录</p>
|
||||
<p>{{ loginTab === 'wechat' ? '微信扫一扫,授权手机号后自动登录' : '请输入账号密码登录系统' }}</p>
|
||||
</div>
|
||||
|
||||
<div class="qr-login">
|
||||
<div class="qr-frame">
|
||||
<img v-if="qrImage" class="qr-image" :src="qrImage" alt="登录二维码" />
|
||||
<div v-else class="qr-placeholder">{{ qrStatus === 'creating' ? '生成中…' : '暂无二维码' }}</div>
|
||||
</div>
|
||||
<p class="qr-status" :class="{ error: qrStatus === 'failed' || qrStatus === 'expired' }">
|
||||
{{ qrStatusText }}
|
||||
</p>
|
||||
<el-button :loading="qrLoading" @click="refreshQr">
|
||||
<el-icon><Refresh /></el-icon>
|
||||
刷新二维码
|
||||
</el-button>
|
||||
</div>
|
||||
<el-tabs v-model="loginTab" class="login-tabs" stretch @tab-change="handleLoginTabChange">
|
||||
<el-tab-pane label="微信扫码" name="wechat">
|
||||
<div class="qr-login">
|
||||
<div class="qr-frame">
|
||||
<img v-if="qrImage" class="qr-image" :src="qrImage" alt="登录二维码" />
|
||||
<div v-else class="qr-placeholder">
|
||||
{{ qrStatus === 'creating' ? '生成中…' : '暂无二维码' }}
|
||||
</div>
|
||||
</div>
|
||||
<p class="qr-status" :class="{ error: qrStatus === 'failed' || qrStatus === 'expired' }">
|
||||
{{ qrStatusText }}
|
||||
</p>
|
||||
<el-button :loading="qrLoading" @click="refreshQr">
|
||||
<el-icon><Refresh /></el-icon>
|
||||
刷新二维码
|
||||
</el-button>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
|
||||
<div class="password-toggle" @click="showPasswordLogin = !showPasswordLogin">
|
||||
<span class="divider-line"></span>
|
||||
<button type="button" class="toggle-btn">
|
||||
<el-icon>
|
||||
<ArrowDown v-if="!showPasswordLogin" />
|
||||
<ArrowUp v-else />
|
||||
</el-icon>
|
||||
或使用账号密码登录
|
||||
</button>
|
||||
<span class="divider-line"></span>
|
||||
</div>
|
||||
|
||||
<el-form
|
||||
v-show="showPasswordLogin"
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="rules"
|
||||
@keyup.enter="handleSubmit"
|
||||
class="login-form"
|
||||
>
|
||||
<el-form-item prop="username">
|
||||
<el-input
|
||||
v-model.trim="formData.username"
|
||||
placeholder="请输入用户名"
|
||||
size="large"
|
||||
:prefix-icon="User"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item prop="password">
|
||||
<el-input
|
||||
v-model.trim="formData.password"
|
||||
type="password"
|
||||
placeholder="请输入密码"
|
||||
size="large"
|
||||
:prefix-icon="Lock"
|
||||
show-password
|
||||
autocomplete="off"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="large"
|
||||
:loading="loading"
|
||||
class="login-btn"
|
||||
@click="handleSubmit"
|
||||
<el-tab-pane label="账号密码" name="password">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="rules"
|
||||
@keyup.enter="handleSubmit"
|
||||
class="login-form"
|
||||
>
|
||||
<el-icon><Check /></el-icon>
|
||||
登 录
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-form-item prop="username">
|
||||
<el-input
|
||||
v-model.trim="formData.username"
|
||||
placeholder="请输入用户名"
|
||||
size="large"
|
||||
:prefix-icon="User"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item prop="password">
|
||||
<el-input
|
||||
v-model.trim="formData.password"
|
||||
type="password"
|
||||
placeholder="请输入密码"
|
||||
size="large"
|
||||
:prefix-icon="Lock"
|
||||
show-password
|
||||
autocomplete="off"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="large"
|
||||
:loading="loading"
|
||||
class="login-btn"
|
||||
@click="handleSubmit"
|
||||
>
|
||||
<el-icon><Check /></el-icon>
|
||||
登 录
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
||||
<div class="form-footer">
|
||||
<span class="copyright">中科兴皖 © {{ currentYear }}</span>
|
||||
@@ -118,7 +113,8 @@
|
||||
import { resolveSafeRedirectTarget } from '@/utils/router'
|
||||
import { ElNotification, type FormInstance, type FormRules } from 'element-plus'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { User, Lock, Refresh, Check, ArrowDown, ArrowUp } from '@element-plus/icons-vue'
|
||||
import { User, Lock, Refresh, Check } from '@element-plus/icons-vue'
|
||||
import type { TabPaneName } from 'element-plus'
|
||||
|
||||
defineOptions({ name: 'Login' })
|
||||
|
||||
@@ -129,7 +125,7 @@
|
||||
const route = useRoute()
|
||||
|
||||
const formRef = ref<FormInstance>()
|
||||
const showPasswordLogin = ref(false)
|
||||
const loginTab = ref<'wechat' | 'password'>('wechat')
|
||||
|
||||
const formData = reactive({
|
||||
username: '',
|
||||
@@ -281,6 +277,20 @@
|
||||
}
|
||||
}
|
||||
|
||||
const handleLoginTabChange = (name: TabPaneName) => {
|
||||
if (name === 'password') {
|
||||
stopPoll()
|
||||
return
|
||||
}
|
||||
if (name === 'wechat') {
|
||||
if (!sessionId.value || qrStatus.value === 'failed' || qrStatus.value === 'expired') {
|
||||
void refreshQr()
|
||||
} else if (qrStatus.value === 'pending' || qrStatus.value === 'scanned') {
|
||||
startPoll()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 登录
|
||||
const handleSubmit = async () => {
|
||||
if (!formRef.value) return
|
||||
@@ -415,7 +425,7 @@
|
||||
}
|
||||
|
||||
.form-header {
|
||||
margin-bottom: 28px;
|
||||
margin-bottom: 20px;
|
||||
text-align: center;
|
||||
|
||||
h2 {
|
||||
@@ -432,12 +442,45 @@
|
||||
}
|
||||
}
|
||||
|
||||
.login-tabs {
|
||||
:deep(.el-tabs__header) {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
:deep(.el-tabs__nav-wrap::after) {
|
||||
height: 1px;
|
||||
background-color: #e5e7eb;
|
||||
}
|
||||
|
||||
:deep(.el-tabs__item) {
|
||||
font-size: 15px;
|
||||
color: #64748b;
|
||||
|
||||
&:hover {
|
||||
color: #10b981;
|
||||
}
|
||||
|
||||
&.is-active {
|
||||
color: #10b981;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.el-tabs__active-bar) {
|
||||
background-color: #10b981;
|
||||
}
|
||||
|
||||
:deep(.el-tabs__content) {
|
||||
overflow: visible;
|
||||
}
|
||||
}
|
||||
|
||||
.qr-login {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
margin-bottom: 8px;
|
||||
padding-top: 4px;
|
||||
}
|
||||
|
||||
.qr-frame {
|
||||
@@ -475,39 +518,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
.password-toggle {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin: 24px 0 8px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.divider-line {
|
||||
flex: 1;
|
||||
height: 1px;
|
||||
background: #e5e7eb;
|
||||
}
|
||||
|
||||
.toggle-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: #64748b;
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
white-space: nowrap;
|
||||
|
||||
&:hover {
|
||||
color: #10b981;
|
||||
}
|
||||
}
|
||||
|
||||
.login-form {
|
||||
margin-top: 16px;
|
||||
padding-top: 4px;
|
||||
|
||||
:deep(.el-form-item) {
|
||||
margin-bottom: 24px;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<!-- 旧「采集协议号管理」菜单入口:重定向至细胞采集基础信息维护 -->
|
||||
<!-- 旧「采集协议号管理」菜单入口:重定向至采集地区及医院(历史入口保留) -->
|
||||
<template>
|
||||
<div />
|
||||
</template>
|
||||
|
||||
@@ -3,8 +3,10 @@
|
||||
<template>
|
||||
<div class="page-container">
|
||||
<section class="panel">
|
||||
<el-tabs v-model="activeTab" class="panel-pill-tabs panel-pill-tabs--lg">
|
||||
<el-tab-pane label="采集地区及医院" name="region">
|
||||
<div class="panel-top">
|
||||
<h2 class="title-bar-heading">地区列表</h2>
|
||||
</div>
|
||||
|
||||
<div class="filter-block">
|
||||
<el-form :model="searchForm" class="filter-form" @submit.prevent>
|
||||
<div class="filter-grid">
|
||||
@@ -89,15 +91,27 @@
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="工作人员"
|
||||
min-width="160"
|
||||
align="left"
|
||||
min-width="240"
|
||||
align="center"
|
||||
header-align="center"
|
||||
class-name="hospital-info-col"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<template v-if="row.staffNames && row.staffNames.length">
|
||||
<div v-for="(name, idx) in row.staffNames" :key="idx" class="hospital-cell-line">
|
||||
{{ name }}
|
||||
<div class="staff-names-grid">
|
||||
<div
|
||||
v-for="(col, colIdx) in splitStaffNameColumns(row.staffNames)"
|
||||
:key="colIdx"
|
||||
class="staff-names-col"
|
||||
>
|
||||
<div
|
||||
v-for="(name, idx) in col"
|
||||
:key="idx"
|
||||
class="hospital-cell-line"
|
||||
>
|
||||
{{ name }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<span v-else class="muted">—</span>
|
||||
@@ -257,96 +271,107 @@
|
||||
<div class="hospital-dialog-head">
|
||||
<span class="muted">当前地区:{{ currentRegionName }}</span>
|
||||
</div>
|
||||
<div class="list-toolbar hospital-toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<div class="list-toolbar-selected">
|
||||
已选 <span class="sel-num">{{ hospitalSelected.length }}</span> 项
|
||||
<section class="panel dialog-nested-list">
|
||||
<div class="list-toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<div class="list-toolbar-selected">
|
||||
已选 <span class="sel-num">{{ hospitalSelected.length }}</span> 项
|
||||
</div>
|
||||
<el-button class="btn-main" type="primary" @click="handleAddHospital">
|
||||
<el-icon><Plus /></el-icon>
|
||||
新增医院
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="hospitalSelected.length === 0"
|
||||
@click="handleBatchDeleteHospital"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
批量删除
|
||||
</el-button>
|
||||
</div>
|
||||
<el-button class="btn-main" type="primary" @click="handleAddHospital">
|
||||
<el-icon><Plus /></el-icon>
|
||||
新增医院
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="hospitalSelected.length === 0"
|
||||
@click="handleBatchDeleteHospital"
|
||||
>
|
||||
批量删除
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="list-body list-wrap hospital-table-wrap">
|
||||
<el-table
|
||||
class="list-table"
|
||||
:data="hospitalTable"
|
||||
v-loading="hospitalLoading"
|
||||
stripe
|
||||
row-key="id"
|
||||
max-height="360"
|
||||
@selection-change="onHospitalSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
type="index"
|
||||
label="序号"
|
||||
min-width="68"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="hospitalName"
|
||||
label="医院名称"
|
||||
min-width="200"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="remark"
|
||||
label="备注"
|
||||
min-width="160"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
<div class="list-body list-wrap">
|
||||
<el-table
|
||||
class="list-table"
|
||||
:data="hospitalTable"
|
||||
v-loading="hospitalLoading"
|
||||
stripe
|
||||
row-key="id"
|
||||
max-height="360"
|
||||
@selection-change="onHospitalSelectionChange"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.remark">{{ row.remark }}</span>
|
||||
<span v-else class="muted">—</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
min-width="260"
|
||||
fixed="right"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-button class="btn-op-item primary" @click="handleEditHospital(row)"
|
||||
>编辑</el-button
|
||||
>
|
||||
<el-button class="btn-op-item" @click="handleDeleteHospital(row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination list-pager-bar">
|
||||
<el-pagination
|
||||
:current-page="hospitalPagination.page"
|
||||
:page-size="hospitalPagination.pageSize"
|
||||
:total="hospitalPagination.total"
|
||||
:page-sizes="[10, 20, 50]"
|
||||
layout="total, sizes, prev, pager, next"
|
||||
@size-change="
|
||||
(val) => (
|
||||
(hospitalPagination.page = 1),
|
||||
(hospitalPagination.pageSize = val),
|
||||
loadHospitals()
|
||||
)
|
||||
"
|
||||
@current-change="(val) => ((hospitalPagination.page = val), loadHospitals())"
|
||||
/>
|
||||
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
type="index"
|
||||
label="序号"
|
||||
min-width="68"
|
||||
align="center"
|
||||
header-align="center"
|
||||
:index="
|
||||
(index) =>
|
||||
(hospitalPagination.page - 1) * hospitalPagination.pageSize + index + 1
|
||||
"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="hospitalName"
|
||||
label="医院名称"
|
||||
min-width="200"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="remark"
|
||||
label="备注"
|
||||
min-width="160"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.remark">{{ row.remark }}</span>
|
||||
<span v-else class="muted">—</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
min-width="260"
|
||||
fixed="right"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-button class="btn-op-item primary" @click="handleEditHospital(row)">
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button class="btn-op-item" @click="handleDeleteHospital(row)">
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination list-pager-bar">
|
||||
<el-pagination
|
||||
:current-page="hospitalPagination.page"
|
||||
:page-size="hospitalPagination.pageSize"
|
||||
:total="hospitalPagination.total"
|
||||
:page-sizes="[10, 20, 50]"
|
||||
layout="total, sizes, prev, pager, next"
|
||||
@size-change="
|
||||
(val) => (
|
||||
(hospitalPagination.page = 1),
|
||||
(hospitalPagination.pageSize = val),
|
||||
loadHospitals()
|
||||
)
|
||||
"
|
||||
@current-change="(val) => ((hospitalPagination.page = val), loadHospitals())"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<el-dialog
|
||||
v-model="hospitalFormVisible"
|
||||
@@ -404,8 +429,8 @@
|
||||
<el-dialog
|
||||
v-model="staffDialogVisible"
|
||||
:title="staffDialogTitle"
|
||||
width="860px"
|
||||
class="dialog-form-layout"
|
||||
width="1100px"
|
||||
class="dialog-form-layout staff-config-dialog"
|
||||
align-center
|
||||
append-to-body
|
||||
modal-class="protocol-dialog-mask"
|
||||
@@ -416,124 +441,127 @@
|
||||
<div class="hospital-dialog-head">
|
||||
<span class="muted">当前地区:{{ currentRegionName }}</span>
|
||||
</div>
|
||||
<div class="list-toolbar hospital-toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<div class="list-toolbar-selected">
|
||||
已选 <span class="sel-num">{{ staffSelected.length }}</span> 项
|
||||
<section class="panel dialog-nested-list">
|
||||
<div class="list-toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<div class="list-toolbar-selected">
|
||||
已选 <span class="sel-num">{{ staffSelected.length }}</span> 项
|
||||
</div>
|
||||
<el-button class="btn-main" type="primary" @click="handleAddStaff">
|
||||
<el-icon><Plus /></el-icon>
|
||||
添加人员
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="staffSelected.length === 0"
|
||||
@click="handleBatchDeleteStaff"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
批量移除
|
||||
</el-button>
|
||||
</div>
|
||||
<el-button class="btn-main" type="primary" @click="handleAddStaff">
|
||||
<el-icon><Plus /></el-icon>
|
||||
添加人员
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="staffSelected.length === 0"
|
||||
@click="handleBatchDeleteStaff"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
批量移除
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="list-body list-wrap hospital-table-wrap">
|
||||
<el-table
|
||||
class="list-table"
|
||||
:data="staffTable"
|
||||
v-loading="staffLoading"
|
||||
stripe
|
||||
row-key="id"
|
||||
max-height="360"
|
||||
@selection-change="onStaffSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
type="index"
|
||||
label="序号"
|
||||
min-width="68"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="userName"
|
||||
label="姓名"
|
||||
min-width="120"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="userNo"
|
||||
label="工号"
|
||||
min-width="120"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="deptName"
|
||||
label="部门"
|
||||
min-width="140"
|
||||
align="center"
|
||||
header-align="center"
|
||||
<div class="list-body list-wrap">
|
||||
<el-table
|
||||
class="list-table"
|
||||
:data="staffTable"
|
||||
v-loading="staffLoading"
|
||||
stripe
|
||||
row-key="id"
|
||||
max-height="560"
|
||||
@selection-change="onStaffSelectionChange"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.deptName">{{ row.deptName }}</span>
|
||||
<span v-else class="muted">—</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="是否负责人"
|
||||
min-width="120"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="row.isLeader" type="success" size="small">负责人</el-tag>
|
||||
<el-tag v-else type="info" size="small">否</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
min-width="260"
|
||||
fixed="right"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-button class="btn-op-item primary" @click="toggleStaffLeader(row)">
|
||||
<el-icon>
|
||||
<StarFilled v-if="row.isLeader" />
|
||||
<Star v-else />
|
||||
</el-icon>
|
||||
{{ row.isLeader ? '取消负责人' : '设为负责人' }}
|
||||
</el-button>
|
||||
<el-button class="btn-op-item" @click="handleDeleteStaff(row)">
|
||||
<el-icon><Delete /></el-icon>
|
||||
移除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination list-pager-bar">
|
||||
<el-pagination
|
||||
:current-page="staffPagination.page"
|
||||
:page-size="staffPagination.pageSize"
|
||||
:total="staffPagination.total"
|
||||
:page-sizes="[10, 20, 50]"
|
||||
layout="total, sizes, prev, pager, next"
|
||||
@size-change="
|
||||
(val) => (
|
||||
(staffPagination.page = 1), (staffPagination.pageSize = val), loadStaff()
|
||||
)
|
||||
"
|
||||
@current-change="(val) => ((staffPagination.page = val), loadStaff())"
|
||||
/>
|
||||
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
type="index"
|
||||
label="序号"
|
||||
min-width="68"
|
||||
align="center"
|
||||
header-align="center"
|
||||
:index="(index) => (staffPagination.page - 1) * staffPagination.pageSize + index + 1"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="userName"
|
||||
label="姓名"
|
||||
min-width="120"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="userNo"
|
||||
label="工号"
|
||||
min-width="120"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="deptName"
|
||||
label="部门"
|
||||
min-width="140"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.deptName">{{ row.deptName }}</span>
|
||||
<span v-else class="muted">—</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="是否负责人"
|
||||
min-width="120"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="row.isLeader" type="success" size="small">负责人</el-tag>
|
||||
<el-tag v-else type="info" size="small">否</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
min-width="260"
|
||||
fixed="right"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-button class="btn-op-item primary" @click="toggleStaffLeader(row)">
|
||||
<el-icon>
|
||||
<StarFilled v-if="row.isLeader" />
|
||||
<Star v-else />
|
||||
</el-icon>
|
||||
{{ row.isLeader ? '取消负责人' : '设为负责人' }}
|
||||
</el-button>
|
||||
<el-button class="btn-op-item" @click="handleDeleteStaff(row)">
|
||||
<el-icon><Delete /></el-icon>
|
||||
移除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination list-pager-bar">
|
||||
<el-pagination
|
||||
:current-page="staffPagination.page"
|
||||
:page-size="staffPagination.pageSize"
|
||||
:total="staffPagination.total"
|
||||
:page-sizes="[10, 20, 50]"
|
||||
layout="total, sizes, prev, pager, next"
|
||||
@size-change="
|
||||
(val) => (
|
||||
(staffPagination.page = 1), (staffPagination.pageSize = val), loadStaff()
|
||||
)
|
||||
"
|
||||
@current-change="(val) => ((staffPagination.page = val), loadStaff())"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<el-dialog
|
||||
v-model="staffAddVisible"
|
||||
title="添加人员"
|
||||
width="520px"
|
||||
width="640px"
|
||||
class="dialog-form-layout"
|
||||
align-center
|
||||
append-to-body
|
||||
@@ -544,13 +572,17 @@
|
||||
<el-form label-position="top">
|
||||
<el-form-item label="系统人员" required>
|
||||
<el-select
|
||||
v-model="staffAddForm.userId"
|
||||
v-model="staffAddForm.userIds"
|
||||
multiple
|
||||
filterable
|
||||
remote
|
||||
clearable
|
||||
collapse-tags
|
||||
collapse-tags-tooltip
|
||||
:max-collapse-tags="4"
|
||||
:remote-method="remoteSearchUsers"
|
||||
:loading="staffUserLoading"
|
||||
placeholder="搜索姓名/账号"
|
||||
placeholder="搜索并选择一人或多名人员"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
@@ -561,7 +593,11 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="设为负责人">
|
||||
<el-form-item>
|
||||
<template #label>
|
||||
设为负责人
|
||||
<span class="form-label-tip">勾选后,本次添加的人员均标记为负责人</span>
|
||||
</template>
|
||||
<el-switch v-model="staffAddForm.isLeader" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@@ -596,8 +632,6 @@
|
||||
:meta="viewRow?.createTime ? '创建时间:' + viewRow.createTime : ''"
|
||||
:sections="viewSections"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
@@ -641,7 +675,14 @@
|
||||
} from '@/api/admin'
|
||||
defineOptions({ name: 'BizCollectionRegion' })
|
||||
|
||||
const activeTab = ref('region')
|
||||
/** 工作人员两列展示:左列 ceil(n/2),右列剩余(如 5 人 → 3+2) */
|
||||
function splitStaffNameColumns(names: string[]): [string[], string[]] {
|
||||
const list = names || []
|
||||
if (list.length <= 1) return [list, []]
|
||||
const mid = Math.ceil(list.length / 2)
|
||||
return [list.slice(0, mid), list.slice(mid)]
|
||||
}
|
||||
|
||||
const searchForm = reactive<{ keyword: string }>({ keyword: '' })
|
||||
const tableData = ref<Api.BizCollectionRegion.RegionItem[]>([])
|
||||
const selectedRows = ref<Api.BizCollectionRegion.RegionItem[]>([])
|
||||
@@ -943,8 +984,8 @@
|
||||
const staffPagination = reactive({ page: 1, pageSize: 10, total: 0 })
|
||||
const staffAddVisible = ref(false)
|
||||
const staffAddLoading = ref(false)
|
||||
const staffAddForm = reactive<{ userId: string; isLeader: boolean }>({
|
||||
userId: '',
|
||||
const staffAddForm = reactive<{ userIds: string[]; isLeader: boolean }>({
|
||||
userIds: [],
|
||||
isLeader: false
|
||||
})
|
||||
const staffUserOptions = ref<Api.User.UserItem[]>([])
|
||||
@@ -971,11 +1012,20 @@
|
||||
return
|
||||
}
|
||||
try {
|
||||
const res = await fetchRegionStaffList(currentRegionId.value, {
|
||||
page: 1,
|
||||
pageSize: 500
|
||||
})
|
||||
boundStaffUserIds.value = new Set((res.list || []).map((s) => s.userId))
|
||||
// 后端 pageSize 上限为 100,分页拉全量已绑定人员用于「添加人员」下拉去重
|
||||
const pageSize = 100
|
||||
const ids = new Set<string>()
|
||||
let page = 1
|
||||
let total = 0
|
||||
do {
|
||||
const res = await fetchRegionStaffList(currentRegionId.value, { page, pageSize })
|
||||
for (const s of res.list || []) {
|
||||
if (s.userId) ids.add(s.userId)
|
||||
}
|
||||
total = res.total ?? 0
|
||||
page += 1
|
||||
} while (ids.size < total)
|
||||
boundStaffUserIds.value = ids
|
||||
} catch {
|
||||
boundStaffUserIds.value = new Set(staffTable.value.map((s) => s.userId))
|
||||
}
|
||||
@@ -1005,7 +1055,7 @@
|
||||
}
|
||||
|
||||
function handleAddStaff() {
|
||||
staffAddForm.userId = ''
|
||||
staffAddForm.userIds = []
|
||||
staffAddForm.isLeader = false
|
||||
staffUserOptions.value = []
|
||||
staffAddVisible.value = true
|
||||
@@ -1017,36 +1067,52 @@
|
||||
try {
|
||||
const res = await fetchUserList({
|
||||
page: 1,
|
||||
pageSize: 20,
|
||||
pageSize: 50,
|
||||
keyword: query || undefined,
|
||||
status: '1'
|
||||
})
|
||||
const bound = boundStaffUserIds.value
|
||||
staffUserOptions.value = (res.list || []).filter((u) => !bound.has(u.id))
|
||||
const selectedIds = new Set(staffAddForm.userIds)
|
||||
const keep = staffUserOptions.value.filter((u) => selectedIds.has(u.id))
|
||||
const keepIds = new Set(keep.map((u) => u.id))
|
||||
const searched = (res.list || []).filter((u) => !bound.has(u.id) && !keepIds.has(u.id))
|
||||
staffUserOptions.value = [...keep, ...searched]
|
||||
} finally {
|
||||
staffUserLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function submitAddStaff() {
|
||||
if (!staffAddForm.userId) {
|
||||
const userIds = [...staffAddForm.userIds]
|
||||
if (userIds.length === 0) {
|
||||
ElMessage.warning('请选择系统人员')
|
||||
return
|
||||
}
|
||||
staffAddLoading.value = true
|
||||
try {
|
||||
await fetchCreateRegionStaff(currentRegionId.value, {
|
||||
userId: staffAddForm.userId,
|
||||
isLeader: staffAddForm.isLeader
|
||||
})
|
||||
ElMessage.success('添加成功')
|
||||
let ok = 0
|
||||
let fail = 0
|
||||
for (const userId of userIds) {
|
||||
try {
|
||||
await fetchCreateRegionStaff(currentRegionId.value, {
|
||||
userId,
|
||||
isLeader: staffAddForm.isLeader
|
||||
})
|
||||
ok += 1
|
||||
} catch {
|
||||
fail += 1
|
||||
}
|
||||
}
|
||||
if (ok === 0) {
|
||||
ElMessage.error('添加失败')
|
||||
return
|
||||
}
|
||||
ElMessage.success(fail > 0 ? `成功添加 ${ok} 人,${fail} 人失败` : `成功添加 ${ok} 人`)
|
||||
staffAddVisible.value = false
|
||||
staffAddForm.userId = ''
|
||||
staffAddForm.userIds = []
|
||||
staffAddForm.isLeader = false
|
||||
await loadStaff()
|
||||
await loadData()
|
||||
} catch {
|
||||
/* */
|
||||
} finally {
|
||||
staffAddLoading.value = false
|
||||
}
|
||||
@@ -1115,12 +1181,10 @@
|
||||
color: var(--mint-text-muted);
|
||||
}
|
||||
|
||||
.hospital-toolbar {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.hospital-table-wrap {
|
||||
padding-top: 0;
|
||||
/* 弹窗内嵌标准列表面板:工具栏与表格由全局 list-toolbar / list-body 分隔 */
|
||||
.dialog-nested-list {
|
||||
margin-top: 0;
|
||||
min-height: 480px;
|
||||
}
|
||||
|
||||
:deep(.hospital-info-col .cell) {
|
||||
@@ -1128,6 +1192,19 @@
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.staff-names-grid {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
gap: 6px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.staff-names-col {
|
||||
min-width: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.hospital-cell-line {
|
||||
line-height: 1.8;
|
||||
}
|
||||
@@ -1140,3 +1217,15 @@
|
||||
color: var(--mint-text-muted);
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
/* append-to-body 弹窗需非 scoped,才能提高可视高度 */
|
||||
.el-dialog.staff-config-dialog.dialog-form-layout {
|
||||
width: 1100px;
|
||||
max-height: calc(100vh - 48px);
|
||||
}
|
||||
|
||||
.el-dialog.staff-config-dialog.dialog-form-layout .el-dialog__body {
|
||||
min-height: 560px;
|
||||
}
|
||||
</style>
|
||||
@@ -90,19 +90,20 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="oa-detail__section">
|
||||
<section class="oa-detail__section oa-detail__section--progress">
|
||||
<OaProgressChain
|
||||
v-if="detail?.id"
|
||||
:items="timelineItems"
|
||||
:instance-id="detail.id"
|
||||
@refresh="load"
|
||||
/>
|
||||
<OaCommentPanel
|
||||
v-if="detail?.id"
|
||||
:instance-id="detail.id"
|
||||
:instance-status="detail.status || ''"
|
||||
:comments="detail.comments || []"
|
||||
@refresh="load"
|
||||
/>
|
||||
</section>
|
||||
|
||||
<section class="oa-detail__section oa-detail__section--progress">
|
||||
<OaProgressChain :items="timelineItems" />
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<el-dialog
|
||||
@@ -215,6 +216,7 @@
|
||||
} from '@/api/oaApproval'
|
||||
import OaCommentPanel from '@/components/oa-approval/OaCommentPanel.vue'
|
||||
import OaProgressChain from '@/components/oa-approval/OaProgressChain.vue'
|
||||
import { mergeProgressWithComments } from '@/utils/oa-progress-merge-comments'
|
||||
import { MAX_ADMIN_LIST_PAGE_SIZE } from '@/utils/fetch-paged-list'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import { refreshOaMenuBadges } from '@/utils/oa-menu-badge'
|
||||
@@ -254,11 +256,13 @@
|
||||
|
||||
const prettyForm = computed(() => JSON.stringify(detail.value?.formDataJson || {}, null, 2))
|
||||
|
||||
/** 进度以详情 API progress 投影为准(勿回落无序 tasks) */
|
||||
/** 进度 + 讨论评论按时间交错(钉钉式);未到达节点仍在轴末 */
|
||||
const timelineItems = computed(() => {
|
||||
const list = detail.value?.progress
|
||||
if (!Array.isArray(list) || !list.length) return []
|
||||
return list
|
||||
if (!Array.isArray(list) || !list.length) {
|
||||
return mergeProgressWithComments([], detail.value?.comments || [])
|
||||
}
|
||||
const progressMapped = list
|
||||
.filter((p: any) => {
|
||||
// 打回只保留审批人节点,过滤独立终态「已打回」行
|
||||
const kind = String(p?.kind || '')
|
||||
@@ -292,6 +296,7 @@
|
||||
}))
|
||||
: []
|
||||
}))
|
||||
return mergeProgressWithComments(progressMapped, detail.value?.comments || [])
|
||||
})
|
||||
|
||||
const currentUserId = computed(() => {
|
||||
|
||||
@@ -0,0 +1,298 @@
|
||||
<!-- OA 提到我的 -->
|
||||
<template>
|
||||
<div class="page-container">
|
||||
<section class="panel">
|
||||
<div class="panel-top">
|
||||
<h2 class="title-bar-heading">提到我的</h2>
|
||||
</div>
|
||||
|
||||
<div class="filter-block">
|
||||
<el-form :model="searchForm" class="filter-form" @submit.prevent>
|
||||
<div class="filter-grid">
|
||||
<el-form-item label="流程名称">
|
||||
<el-input
|
||||
v-model="searchForm.appName"
|
||||
placeholder="请输入流程名称"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="申请人">
|
||||
<el-input
|
||||
v-model="searchForm.initiatorName"
|
||||
placeholder="请输入申请人"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="申请时间">
|
||||
<el-date-picker
|
||||
v-model="applyTimeRange"
|
||||
type="daterange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
value-format="YYYY-MM-DD"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="流程状态">
|
||||
<el-select v-model="searchForm.instanceStatus" placeholder="全部" clearable>
|
||||
<el-option label="全部" value="" />
|
||||
<el-option label="进行中" value="running" />
|
||||
<el-option label="已完成" value="completed" />
|
||||
<el-option label="已拒绝" value="rejected" />
|
||||
<el-option label="已打回" value="returned" />
|
||||
<el-option label="已撤销" value="cancelled" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div class="filter-actions-row">
|
||||
<div class="filter-actions-end">
|
||||
<el-button class="btn-ghost" @click="handleReset">
|
||||
<el-icon><RefreshLeft /></el-icon>
|
||||
重置
|
||||
</el-button>
|
||||
<el-button class="btn-main" type="primary" @click="handleSearch">
|
||||
<el-icon><Search /></el-icon>
|
||||
搜索
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<div class="list-body list-wrap">
|
||||
<el-table class="list-table" :data="rows" v-loading="loading" stripe>
|
||||
<el-table-column
|
||||
type="index"
|
||||
label="序号"
|
||||
min-width="68"
|
||||
align="center"
|
||||
header-align="center"
|
||||
:index="indexMethod"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="appName"
|
||||
label="流程名称"
|
||||
min-width="160"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template #default="{ row }">{{ row.appName || row.title || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="initiatorUserName"
|
||||
label="申请人"
|
||||
min-width="120"
|
||||
align="center"
|
||||
>
|
||||
<template #default="{ row }">{{ row.initiatorUserName || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="applyTime"
|
||||
label="申请时间"
|
||||
min-width="170"
|
||||
align="center"
|
||||
>
|
||||
<template #default="{ row }">{{ row.applyTime || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="currentNodeName"
|
||||
label="当前节点"
|
||||
min-width="140"
|
||||
align="center"
|
||||
>
|
||||
<template #default="{ row }">{{ row.currentNodeName || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="currentApproverNames"
|
||||
label="当前审批人"
|
||||
min-width="140"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template #default="{ row }">{{ row.currentApproverNames || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="instanceStatus" label="流程状态" min-width="110" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag size="small" :type="statusType(row.instanceStatus)">
|
||||
{{ statusText(row.instanceStatus) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="260" fixed="right" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-button class="btn-op-item primary" @click="openDetail(row)">
|
||||
<el-icon><View /></el-icon>
|
||||
查看
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-op-item"
|
||||
:loading="printingId === row.id"
|
||||
@click="printRow(row)"
|
||||
>
|
||||
<el-icon><Printer /></el-icon>
|
||||
打印
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination list-pager-bar">
|
||||
<el-pagination
|
||||
v-model:current-page="page"
|
||||
v-model:page-size="pageSize"
|
||||
:total="total"
|
||||
:page-sizes="[10, 20, 50]"
|
||||
layout="total, sizes, prev, pager, next"
|
||||
background
|
||||
@size-change="load"
|
||||
@current-change="load"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onActivated, onMounted, reactive, ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { Printer, RefreshLeft, Search, View } from '@element-plus/icons-vue'
|
||||
import { fetchOaInstanceDetail, fetchOaTasks } from '@/api/oaApproval'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import { exportOaApprovalPdf } from '@/utils/oa-approval-print'
|
||||
|
||||
defineOptions({ name: 'OaApprovalMention' })
|
||||
|
||||
const router = useRouter()
|
||||
const userStore = useUserStore()
|
||||
const loading = ref(false)
|
||||
const printingId = ref('')
|
||||
const rows = ref<any[]>([])
|
||||
const page = ref(1)
|
||||
const pageSize = ref(20)
|
||||
const total = ref(0)
|
||||
const applyTimeRange = ref<string[] | null>(null)
|
||||
const searchForm = reactive({
|
||||
appName: '',
|
||||
initiatorName: '',
|
||||
instanceStatus: ''
|
||||
})
|
||||
|
||||
function indexMethod(index: number) {
|
||||
return (page.value - 1) * pageSize.value + index + 1
|
||||
}
|
||||
|
||||
function currentPrinterName() {
|
||||
const info: any = userStore.info || userStore.getUserInfo || {}
|
||||
return String(
|
||||
info.realName || info.nickName || info.userName || info.username || ''
|
||||
).trim()
|
||||
}
|
||||
|
||||
function statusType(s: string) {
|
||||
if (s === 'pending' || s === 'running') return 'warning'
|
||||
if (s === 'approved' || s === 'completed' || s === 'done') return 'success'
|
||||
if (s === 'rejected' || s === 'cancelled' || s === 'returned') return 'danger'
|
||||
return 'info'
|
||||
}
|
||||
|
||||
function statusText(s: string) {
|
||||
if (!s) return '-'
|
||||
const map: Record<string, string> = {
|
||||
pending: '待处理',
|
||||
running: '进行中',
|
||||
approved: '已同意',
|
||||
rejected: '已拒绝',
|
||||
completed: '已完成',
|
||||
cancelled: '已撤销',
|
||||
done: '已结束',
|
||||
returned: '已打回',
|
||||
transferred: '已转交'
|
||||
}
|
||||
return map[s] || s
|
||||
}
|
||||
|
||||
function openDetail(row: any) {
|
||||
const id = row.id
|
||||
if (!id) return
|
||||
router.push({ path: `/system-manage/oa-approval/instances/${id}` })
|
||||
}
|
||||
|
||||
async function printRow(row: any) {
|
||||
const id = String(row?.id || '').trim()
|
||||
if (!id || printingId.value) return
|
||||
printingId.value = id
|
||||
let detail: any
|
||||
try {
|
||||
detail = await fetchOaInstanceDetail(id)
|
||||
} catch {
|
||||
printingId.value = ''
|
||||
ElMessage.error('加载审批单失败')
|
||||
return
|
||||
}
|
||||
try {
|
||||
await exportOaApprovalPdf(detail, { printerName: currentPrinterName() })
|
||||
ElMessage.success('PDF 已下载')
|
||||
} catch {
|
||||
ElMessage.error('导出 PDF 失败')
|
||||
} finally {
|
||||
printingId.value = ''
|
||||
}
|
||||
}
|
||||
|
||||
function buildFilterParams() {
|
||||
const range = applyTimeRange.value
|
||||
return {
|
||||
appName: searchForm.appName,
|
||||
initiatorName: searchForm.initiatorName,
|
||||
instanceStatus: searchForm.instanceStatus,
|
||||
applyTimeFrom: range?.[0] || '',
|
||||
applyTimeTo: range?.[1] || '',
|
||||
page: page.value,
|
||||
pageSize: pageSize.value
|
||||
}
|
||||
}
|
||||
|
||||
function handleSearch() {
|
||||
page.value = 1
|
||||
void load()
|
||||
}
|
||||
|
||||
function handleReset() {
|
||||
searchForm.appName = ''
|
||||
searchForm.initiatorName = ''
|
||||
searchForm.instanceStatus = ''
|
||||
applyTimeRange.value = null
|
||||
page.value = 1
|
||||
void load()
|
||||
}
|
||||
|
||||
async function load() {
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await fetchOaTasks('mention', buildFilterParams())
|
||||
rows.value = res?.list || []
|
||||
total.value = res?.total || 0
|
||||
} catch {
|
||||
rows.value = []
|
||||
total.value = 0
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
watchDebounced(
|
||||
[searchForm, applyTimeRange],
|
||||
() => {
|
||||
page.value = 1
|
||||
void load()
|
||||
},
|
||||
{ debounce: 300, deep: true }
|
||||
)
|
||||
|
||||
onMounted(load)
|
||||
onActivated(load)
|
||||
</script>
|
||||
Reference in new issue
Block a user