unis-oa/frontend/src/dev/donePreview.ts

99 lines
4.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/**
* 「我的已办」那一列的排版预览台(只在开发模式用,不进产物)。
*
* 列宽是像素级的事,光看代码说不准:这一台挂的是**真的** DoneListView,
* 只把接口那一路换成一份假数据(apiClient 的 adapter 换掉),没有后端、没有登录。
* 开法:`pnpm dev` 之后访问 http://localhost:3000/preview-done.html
*
* 下面这几行照着用户截图里那几条摆:环节名是「补充确认信息」「执行董事」这种四五个字,
* 外加一张还在走的单(当前环节 + 压在谁手上)、一张已办结的、一条抄送处理、一条挂起的。
*/
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import { createI18n } from 'vue-i18n'
import { createMemoryHistory, createRouter } from 'vue-router'
import type { AxiosAdapter, AxiosResponse, InternalAxiosRequestConfig } from 'axios'
import zh from '@/i18n/locales/zh'
import { apiClient } from '@/api/client'
import DoneListView from '@/views/oa/DoneListView.vue'
import type { TaskCompletedItem } from '@/types'
import '@/style.css'
const BASE = {
task: 't', job: 'j', work: 'w', process: 'p', process_name: '费用报销流程', category_name: '财务',
identity: 'kangwenjing', identity_name: '康文靖', unit_name: '软件开发事业部',
creator_person: '康文靖', route_alias: '', attachments: [], form_changes: [],
start_time: '2026-11-12 09:12:00', label: '', latest: true, recallable: null, recall_blocker: '',
processing_type: 'normal'
}
const ROWS: TaskCompletedItem[] = [
{
...BASE, id: 'r1', title: '康文靖报销2026年10月定制开发项目费用流程', serial: 'FYBX202611030012',
activity: 'a1', activity_name: '补充确认信息', route_name: '同意', opinion: '金额与发票一致,可以付',
completed_time: '2026-11-03 11:28:00', handle_count: 1, work_status: 'running',
current_activity_name: '财务出纳付款', current_handlers: '陈妮'
},
{
...BASE, id: 'r2', title: '备用金申请流程测试(软件开发事业部)-康文靖kangwenjing-2026-11-12',
serial: 'BYJ202611120002', activity: 'a2', activity_name: '执行董事', route_name: '同意',
opinion: '', completed_time: '2026-11-12 10:26:00', handle_count: 4, work_status: 'running',
current_activity_name: '董事长审批', current_handlers: '张锦杰,李总,王主管'
},
{
...BASE, id: 'r3', title: '康文靖报销2026年10月定制开发项目费用流程', serial: 'FYBX202611030012',
activity: 'a3', activity_name: '归档', route_name: '', opinion: '', processing_type: 'cc',
completed_time: '2026-11-17 12:54:00', handle_count: 1, work_status: 'running',
current_activity_name: '归档确认', current_handlers: '陈妮', done_source: 'cc'
},
{
...BASE, id: 'r4', title: '差旅费报销-市场部-2026-11', serial: 'CLBX202611100007',
activity: 'a4', activity_name: '部门负责人审批', route_name: '驳回重填',
opinion: '发票抬头开错了,换一张重传', completed_time: '2026-11-10 16:02:00', handle_count: 2,
work_status: 'completed', current_activity_name: '结束'
},
{
...BASE, id: 'r5', title: '备用金申请-软件事业部-2026-11', serial: 'BYJ202611090001',
activity: 'a5', activity_name: '财务经理复核', route_name: '同意', opinion: '同意',
completed_time: '2026-11-09 09:40:00', handle_count: 1, work_status: 'running',
current_activity_name: '总经理审批', current_handlers: '张锦杰', work_paused: true
},
{
...BASE, id: 'r6', title: '公章使用申请-2026-11', serial: 'GY202611080003',
activity: 'a6', activity_name: '办公室用印', route_name: '转办', opinion: '',
processing_type: 'transfer', completed_time: '2026-11-08 14:20:00', handle_count: 1,
work_status: 'terminated', current_activity_name: '办公室用印'
}
]
apiClient.defaults.adapter = (async (config: InternalAxiosRequestConfig) => {
const url = String(config.url || '')
const data = url.includes('/task/completed')
? { items: ROWS, total: ROWS.length, page: 1, page_size: 20, pages: 1 }
: url.includes('/process/processes')
? [{ id: 'p', name: '费用报销流程' }]
: []
return {
data: { code: 0, message: 'ok', data },
status: 200,
statusText: 'OK',
headers: {},
config
} as unknown as AxiosResponse
}) as unknown as AxiosAdapter
const router = createRouter({
history: createMemoryHistory(),
routes: [
{ path: '/done', name: 'done', component: DoneListView },
{ path: '/work/:job', name: 'work-detail', component: { template: '<div />' } }
]
})
void router.push('/done')
createApp(DoneListView)
.use(createPinia())
.use(router)
.use(createI18n({ legacy: false, locale: 'zh', messages: { zh } }))
.mount('#app')