This commit is contained in:
zlwu committed 2026-07-23 18:01:11 +08:00
1 parent 91b8dd1aaa
commit 89fda927a2
119 files changed
+36038 -28744

No files matched your search

+23 -3
View File
@@ -160,7 +160,7 @@ function extractUrls(value: unknown): string[] {
return []
}
function formatScalar(value: unknown): string {
function formatScalar(value: unknown, sep = '、'): string {
if (value == null || value === '') return '-'
if (typeof value === 'boolean') return value ? '是' : '否'
if (typeof value === 'number') return String(value)
@@ -170,7 +170,7 @@ function formatScalar(value: unknown): string {
return value
.map((v) => formatScalar(v))
.filter((s) => s && s !== '-')
.join('、')
.join(sep)
}
if (typeof value === 'object') {
try {
@@ -182,6 +182,26 @@ function formatScalar(value: unknown): string {
return String(value)
}
/** 日期/时间区间(FormCreate:日期区间、时间区间等)打印用 ~ 连接起止 */
function isRangeFieldRule(rule: any): boolean {
const type = String(rule?.type || '').trim()
const props = rule?.props && typeof rule.props === 'object' ? rule.props : {}
if (type === 'datePicker' || type === 'date' || type === 'dateRange') {
return /range$/i.test(String(props.type || type))
}
if (type === 'timePicker' || type === 'time' || type === 'timeRange') {
return props.isRange === true || type === 'timeRange'
}
return false
}
function formatFieldValue(value: unknown, rule: any): string {
if (Array.isArray(value) && isRangeFieldRule(rule)) {
return formatScalar(value, '~')
}
return formatScalar(value)
}
async function walkRules(
rules: any[],
formData: Record<string, any>,
@@ -235,7 +255,7 @@ async function walkRules(
out.push({ label, urls })
continue
}
out.push({ label, text: formatScalar(value) })
out.push({ label, text: formatFieldValue(value, rule) })
}
}
@@ -2,11 +2,13 @@
* FormCreate 运行时补丁:
* - 内置 upload 默认 action 为「/」,会 POST 到前端原点导致 404;接管为附件上传 API
* - 运行时注册 FcRow(flex ._fd-row),间距与铺满由 oa-fc-runtime.scss 处理
* - 覆盖内置 upload:picture-card 下非图片用文档/视频图标展示,避免破图
*/
import { ElMessage } from 'element-plus'
import { fetchUploadAttachment } from '@/api/business'
import { attachmentFullUrl } from '@/composables/useAttachmentActions'
import OaFcRow from '@/components/oa-approval/OaFcRow.vue'
import OaFcUpload from '@/components/oa-approval/OaFcUpload.vue'
type FcFetchOptions = {
source?: string
@@ -110,6 +112,9 @@ export function setupFormCreateUpload(formCreate: {
if (typeof formCreate.component === 'function') {
formCreate.component('fcRow', OaFcRow)
formCreate.component('FcRow', OaFcRow)
// 覆盖默认 fcUpload:非图片不再走 <img> 破图
formCreate.component('upload', OaFcUpload)
formCreate.component('fcUpload', OaFcUpload)
}
const prevFetch = formCreate.fetch
@@ -1,6 +1,7 @@
/**
* 或签/会签进度人员行格式化
* Spec: docs/superpowers/specs/2026-07-23-oa-or-and-sign-display-design.md
* 转交行:docs/superpowers/specs/2026-07-23-oa-approval-transfer-design.md(扩展展示转交目标)
*/
export type ProgressPersonInput = {
@@ -9,6 +10,10 @@ export type ProgressPersonInput = {
status?: string
timestamp?: string
commentText?: string
/** 转交目标用户 id(后端 build_progress_items 补齐) */
transferToUserId?: string
/** 转交目标用户昵称 */
transferToUserName?: string
}
export type PersonLineTone = 'ok' | 'pending' | 'danger' | 'mute' | ''
@@ -24,6 +29,10 @@ function displayName(p: ProgressPersonInput): string {
return String(p.nickName || p.id || '').trim()
}
function transferTargetName(p: ProgressPersonInput): string {
return String(p.transferToUserName || p.transferToUserId || '').trim()
}
function statusFallbackLabel(status: string): string {
const s = (status || '').trim()
if (s === 'approved') return '已同意'
@@ -61,6 +70,19 @@ export function formatProgressPersonLines(
out.push({ text: `${name} 无需处理`, tone: 'mute' })
continue
}
if (status === 'transferred') {
const target = transferTargetName(p)
const mid = target
? comment
? `转交给${target} ${comment}`
: `转交给${target}`
: comment || statusFallbackLabel('transferred')
out.push({
text: ts ? `${name} ${mid} ${ts}` : `${name} ${mid}`,
tone: 'mute'
})
continue
}
if (status === 'pending' || status === 'running' || status === 'not_reached' || !status) {
// 无 status 时:若有意见/时间仍按已处理拼;否则待处理
if (!status && (comment || ts)) {
@@ -0,0 +1,52 @@
/** OA FormCreate 上传:按扩展名 / MIME 判定预览形态(无 Vue 依赖,便于脚本校验) */
export type OaUploadFileLike = {
name?: string
url?: string
type?: string
raw?: { type?: string; name?: string } | File
}
const IMAGE_EXT = /\.(jpg|jpeg|png|gif|bmp|webp|svg)(\?|$)/i
const VIDEO_EXT = /\.(mp4|webm|ogg|mov|avi)(\?|$)/i
function fileNameHint(file: OaUploadFileLike): string {
return String(file?.name || file?.raw?.name || '').trim()
}
function fileUrlHint(file: OaUploadFileLike): string {
return String(file?.url || '').trim()
}
function mimeHint(file: OaUploadFileLike): string {
return String(file?.raw?.type || file?.type || '').trim().toLowerCase()
}
export function isOaUploadImageFile(file: OaUploadFileLike | null | undefined): boolean {
if (!file) return false
const mime = mimeHint(file)
if (mime.startsWith('image/')) return true
return IMAGE_EXT.test(fileNameHint(file)) || IMAGE_EXT.test(fileUrlHint(file))
}
export function isOaUploadVideoFile(file: OaUploadFileLike | null | undefined): boolean {
if (!file) return false
const mime = mimeHint(file)
if (mime.startsWith('video/')) return true
return VIDEO_EXT.test(fileNameHint(file)) || VIDEO_EXT.test(fileUrlHint(file))
}
export function getOaUploadDisplayName(file: OaUploadFileLike | null | undefined): string {
if (!file) return '未命名文件'
const name = fileNameHint(file)
if (name) return name
const url = fileUrlHint(file)
if (!url) return '未命名文件'
try {
const path = url.split('?')[0] || url
const last = path.split('/').pop() || ''
return decodeURIComponent(last) || '未命名文件'
} catch {
return '未命名文件'
}
}