-
- {{ row.title }}
-
+
+
+ {{ row.title }}
+
+
+
+ {{ row.creator_person.slice(0, 1) }}
+ {{ t('task.starter') }}
+ {{ row.creator_person }}
+
+
{{ row.serial }} · {{ row.process_name }}(() =>
// 挂在谁手上、挂没挂起:手机上没有悬浮提示,那句话说在徽章下面那一行小字里
meta: [row.process_name, formatRelativeTime(row.completed_time), step.note].filter(Boolean),
badges: [
+ // 手机上没有列头:发起人作为第一枚徽章,与桌面标题右侧同一个口径。
+ ...(row.creator_person ? [{ text: row.creator_person, cls: 'badge creator-badge' }] : []),
...(isCc(row) ? [{ text: t('task.doneFromCc'), cls: 'badge-warning' }] : []),
{ text: row.activity_name, cls: 'badge-primary' },
// 桌面上那一列「当前环节」手机上也得说得出:办完之后这张单走到哪儿了。
diff --git a/frontend/src/views/oa/PrintWorkView.cc.spec.ts b/frontend/src/views/oa/PrintWorkView.cc.spec.ts
index 780696c..aa2f564 100644
--- a/frontend/src/views/oa/PrintWorkView.cc.spec.ts
+++ b/frontend/src/views/oa/PrintWorkView.cc.spec.ts
@@ -17,6 +17,10 @@ import type { FlowNodeCc, WorkDetail } from '@/types'
const api = vi.hoisted(() => ({ getJob: vi.fn() }))
vi.mock('@/api', () => ({ workAPI: { getJob: api.getJob } }))
+vi.mock('@/utils/attachment', async (importOriginal) => ({
+ ...(await importOriginal()),
+ attachmentObjectUrl: vi.fn().mockRejectedValue(new Error('no bytes'))
+}))
const CC: FlowNodeCc = {
rules: [
@@ -118,7 +122,7 @@ describe('打印件上的抄送', () => {
expect(text).not.toContain('岗位角色 · 会计')
})
- it('收受人处理时上传的图与文件:纸上只列名字,一个都不静默丢', async () => {
+ it('收受人处理时上传的图与文件:图退成名字框、pdf 仍列名字,一个都不静默丢', async () => {
api.getJob.mockResolvedValue(
detail({
flow: {
@@ -151,8 +155,9 @@ describe('打印件上的抄送', () => {
})
)
const text = (await render()).text()
- // 图片不印,名字要印:纸上也要答得出「他附了发票」
- expect(text).toContain('随附文件:发票.jpg、付款凭证.pdf')
+ // 取不到字节的图片退成带名字的灰框;非图片仍走「随附文件」那句话
+ expect(text).toContain('发票.jpg(未加载)')
+ expect(text).toContain('随附文件:付款凭证.pdf')
// 没附东西的那两个人不许多出这一句
expect(text.match(/随附文件/g)).toHaveLength(1)
})
diff --git a/frontend/src/views/oa/PrintWorkView.comments.spec.ts b/frontend/src/views/oa/PrintWorkView.comments.spec.ts
new file mode 100644
index 0000000..e372d16
--- /dev/null
+++ b/frontend/src/views/oa/PrintWorkView.comments.spec.ts
@@ -0,0 +1,211 @@
+// @vitest-environment jsdom
+/**
+ * 打印件「补充批注」整节与附图。
+ *
+ * 纸上没有悬浮提示也没有点得开的画廊:批注是谁说的、发在哪一环、写了什么、附了什么,
+ * 都得直接落在审批记录表底下。这一份钉住三件事:整节的位置、图片与文件的两种落法、
+ * 以及「没有审批记录的抄送」那一行补回第七格之后时间回到最右列。
+ */
+import { beforeEach, describe, expect, it, vi } from 'vitest'
+import { flushPromises, mount } from '@vue/test-utils'
+import { createMemoryHistory, createRouter } from 'vue-router'
+import { createPinia, setActivePinia } from 'pinia'
+import { createI18n } from 'vue-i18n'
+import zh from '@/i18n/locales/zh'
+import PrintWorkView from './PrintWorkView.vue'
+import type { WorkComment, WorkDetail } from '@/types'
+
+const api = vi.hoisted(() => ({ getJob: vi.fn(), listComments: vi.fn() }))
+vi.mock('@/api', () => ({ workAPI: { getJob: api.getJob, listComments: api.listComments } }))
+vi.mock('@/utils/attachment', async (importOriginal) => ({
+ ...(await importOriginal()),
+ attachmentObjectUrl: vi.fn().mockRejectedValue(new Error('no bytes'))
+}))
+
+const END_CC = {
+ id: 'end',
+ name: '归档',
+ type: 'end',
+ state: 'done',
+ arrived_time: '2026-11-16 16:30:00',
+ completed_time: '2026-11-16 16:32:00',
+ handlers: [],
+ waiting: [],
+ cc: {
+ rules: [],
+ people: [
+ {
+ name: '张梅',
+ identity: 'zhangmei',
+ unit: '经营管理中心',
+ time: '2026-11-16 16:32:00',
+ view_time: '2026-11-24 10:00:00',
+ handle_time: '2026-11-24 10:05:00',
+ viewed: true,
+ handled: true,
+ requires_action: true,
+ sender: '康文靖',
+ opinion: '付款已到账,回单见附件',
+ attachments: [
+ { id: 'p1', name: 'screenshot-20261124-100506.png', extension: 'png', length: 100, is_image: true },
+ { id: 'p2', name: '回单-1124.pdf', extension: 'pdf', length: 100, is_image: false }
+ ]
+ }
+ ],
+ sent: 1,
+ unread: 0,
+ unhandled: 0
+ }
+}
+
+function detail(): WorkDetail {
+ return {
+ id: 'w1',
+ job: 'j1',
+ serial: 'BX-1',
+ title: '一张报销单',
+ process_name: '费用报销',
+ status: 'completed',
+ activity: 'end',
+ activity_name: '归档',
+ creator_person: '张三',
+ creator_unit_name: '研发中心',
+ start_time: '2026-11-03 11:20:00',
+ finish_time: '2026-11-16 16:32:00',
+ data: {},
+ forms: [],
+ tasks: [],
+ work_logs: [],
+ attachments: [],
+ routes: [],
+ activities: [],
+ flow: {
+ activities: [],
+ nodes: { end: END_CC },
+ edges: {},
+ current: [],
+ reached: 1,
+ total: 1,
+ auto_layout: false,
+ forwards: { items: [], count: 0, unread: 0, unhandled: 0 }
+ },
+ task_completed: [],
+ ...{}
+ } as unknown as WorkDetail
+}
+
+function comment(over: Partial = {}): WorkComment {
+ return {
+ id: 'c1',
+ job: 'j1',
+ work: 'w1',
+ activity: 'a-audit',
+ activity_name: '财务经理',
+ identity: 'kangwenjing',
+ identity_name: '康文靖',
+ content: '发票抬头开错了一个字,已让供应商重开。',
+ mentions: ['zhangmei'],
+ mention_names: ['张梅'],
+ mention_action: true,
+ attachments: [
+ { id: 'c-img', name: '发票044124-重开.jpg', extension: 'jpg', length: 200, is_image: true },
+ { id: 'c-doc', name: '作废说明.docx', extension: 'docx', length: 200, is_image: false }
+ ],
+ create_time: '2026-11-03 14:02:00',
+ ...over
+ }
+}
+
+async function render() {
+ const router = createRouter({
+ history: createMemoryHistory(),
+ routes: [{ path: '/print/:job', name: 'work-print', component: PrintWorkView }]
+ })
+ await router.push('/print/j1')
+ await router.isReady()
+ const i18n = createI18n({ legacy: false, locale: 'zh', messages: { zh }, missingWarn: false, fallbackWarn: false })
+ return mount(PrintWorkView, {
+ global: { plugins: [router, createPinia(), i18n], stubs: { FormRenderer: true, BackButton: true } }
+ })
+}
+
+describe('打印件上的补充批注', () => {
+ beforeEach(() => {
+ vi.clearAllMocks()
+ setActivePinia(createPinia())
+ api.getJob.mockResolvedValue(detail())
+ api.listComments.mockResolvedValue([])
+ })
+
+ it('整节挂在审批记录表后、转发之前:谁说的、发在哪、写了什么都印出来', async () => {
+ api.listComments.mockResolvedValue([comment()])
+ const wrapper = await render()
+ await flushPromises()
+ const text = wrapper.text()
+ expect(text).toContain('补充批注')
+ expect(text).toContain('康文靖')
+ expect(text).toContain('财务经理')
+ expect(text).toContain('发票抬头开错了一个字')
+ expect(text).toContain('张梅')
+ expect(text).toContain('要求对方处理')
+ // 没有转发时那颗标题本就不出现:确认「补充批注」没有跑进表格前面
+ const sections = wrapper.findAll('.sheet-section').map((node) => node.text())
+ expect(sections).toContain('补充批注')
+ expect(sections.indexOf('补充批注')).toBeGreaterThan(sections.indexOf('审批记录'))
+ })
+
+ it('批注附图退成灰色名字框,非图片走「随附文件」那一行', async () => {
+ api.listComments.mockResolvedValue([comment()])
+ const wrapper = await render()
+ await flushPromises()
+ const text = wrapper.text()
+ expect(text).toContain('发票044124-重开.jpg(未加载)')
+ expect(text).toContain('随附文件:作废说明.docx')
+ })
+
+ it('0 条批注时整节不出现', async () => {
+ const wrapper = await render()
+ await flushPromises()
+ expect(wrapper.text()).not.toContain('补充批注')
+ })
+
+ it('按发生时间从早到晚排', async () => {
+ api.listComments.mockResolvedValue([
+ comment({ id: 'c2', content: '后一句', create_time: '2026-11-10 09:00:00' }),
+ comment({ id: 'c1', content: '前一句', create_time: '2026-11-03 14:02:00' })
+ ])
+ const wrapper = await render()
+ await flushPromises()
+ const text = wrapper.text()
+ expect(text.indexOf('前一句')).toBeLessThan(text.indexOf('后一句'))
+ })
+})
+
+describe('打印件上的抄送结果与第七格', () => {
+ beforeEach(() => {
+ vi.clearAllMocks()
+ setActivePinia(createPinia())
+ api.getJob.mockResolvedValue(detail())
+ api.listComments.mockResolvedValue([])
+ })
+
+ it('逐人的处理意见、图片和文件名字都跟在处理结果下面', async () => {
+ const wrapper = await render()
+ await flushPromises()
+ const text = wrapper.text()
+ expect(text).not.toContain('经营管理中心')
+ expect(text).toContain('处理意见:付款已到账,回单见附件')
+ expect(text).toContain('screenshot-20261124-100506.png(未加载)')
+ expect(text).toContain('随附文件:回单-1124.pdf')
+ })
+
+ it('没有审批记录的那一行补回第七格,时间回到最右列', async () => {
+ const wrapper = await render()
+ await flushPromises()
+ const rows = wrapper.findAll('tbody tr')
+ const row = rows.find((node) => node.text().includes('办结时的抄送'))
+ expect(row).toBeDefined()
+ expect(row!.findAll('td')).toHaveLength(7)
+ expect(row!.findAll('td')[6].text()).toContain('11/16/2026')
+ })
+})
diff --git a/frontend/src/views/oa/PrintWorkView.vue b/frontend/src/views/oa/PrintWorkView.vue
index 8851300..30fa6da 100644
--- a/frontend/src/views/oa/PrintWorkView.vue
+++ b/frontend/src/views/oa/PrintWorkView.vue
@@ -72,14 +72,27 @@
| {{ item.route_name || '--' }} |
{{ item.opinion || '--' }}
-
-
- {{ t('attachment.attachedFiles') }}:{{ item.attachments.map((file) => file.name).join('、') }}
-
+
|
{{ ccOfStep(item) || '--' }}
- {{ line }}
+
+ {{ ccPersonBrief(t, person, { formatTime: formatDateTimeToMinute }) }}
+
+ {{ ccPersonOpinion(t, person) }}
+
+
+
|
{{ formatDateTimeToMinute(item.completed_time) }} |
@@ -91,9 +104,23 @@
{{ row.name }} |
-- |
{{ row.tag }} |
+ -- |
{{ row.line }}
- {{ line }}
+
+ {{ ccPersonBrief(t, person, { formatTime: formatDateTimeToMinute }) }}
+
+ {{ ccPersonOpinion(t, person) }}
+
+
+
|
{{ row.time ? formatDateTimeToMinute(row.time) : '--' }} |
@@ -103,6 +130,33 @@
+
+
+ {{ t('task.commentAdd') }}
+
+
+
{{ t('flow.forwardTitle') }}
@@ -111,6 +165,19 @@
{{ forwardOfRow(item) }}
+
@@ -122,7 +189,12 @@
-
+
+ {{ comment.identity_name || comment.identity }} + {{ comment.activity_name }} + {{ formatDateTimeToMinute(comment.create_time) }} +
+{{ comment.content }}
++ + @ {{ comment.mention_names.join('、') }} + + · {{ t('task.commentMentionAction') }} +
+