import type { DmsFilePreviewTicket } from '#/api/x/dms/preview';
|
import type { DmsCustomBarcode, DmsWatermarkParameters } from '#/api/x/dms/watermarkParameters';
|
|
/** 附件字段里的 fileItem(见 components/Jnpf/upload/src/props.ts),此处只声明本功能用到的部分 */
|
export interface OfficeDocumentFile {
|
fileExtension?: string;
|
fileId: string;
|
fileSize?: number | string;
|
name: string;
|
url?: string;
|
[key: string]: any;
|
}
|
|
export interface DmsPageVariables {
|
/** 原始文档页码,从 1 开始。 */
|
pageNo: number;
|
/** 仅供前端打印页面处理器消费的动态变量。 */
|
variables: Record<string, unknown>;
|
}
|
|
export interface DmsPrintCopyBarcodes {
|
/** 打印份序,从 1 开始;批量打印时必须连续且不可重复。 */
|
copyNo: number;
|
/** 当前份按原始文档物理页码配置的条码。 */
|
customBarcode: DmsCustomBarcode[];
|
}
|
|
export interface DmsPreviewPrintOptions {
|
/** 打印份数,默认 1,允许范围 1~999。 */
|
copies?: number;
|
/** 原始文档页码表达式,例如 1-3,5;为空表示全部页面。 */
|
pages?: string;
|
/** 按原始文档页码关联的前端页面变量。 */
|
pageVariables?: DmsPageVariables[];
|
/** 每份使用不同条码时传入;存在时 copies 必须省略或与数组长度一致。 */
|
copyBarcodes?: DmsPrintCopyBarcodes[];
|
}
|
|
export interface DmsReprintPreview {
|
requestId: string;
|
printRecordId: string;
|
/** 仅重打预览按钮执行:复用原发送任务和已保存的不平衡登记。 */
|
send: () => Promise<void>;
|
}
|
|
export interface DmsPrintConfig extends DmsPreviewPrintOptions, DmsWatermarkParameters {
|
/** 在线表单配置的逐份条码格式;预览与实际发送共用。 */
|
buildCustomBarcode?: import('#/views/x/dms/shared/dmsPrintBarcode').DmsPrintBarcodeBuilder;
|
reprint?: DmsReprintPreview;
|
/** 台账打印技术任务:并发排他、持久恢复和批次回传。 */
|
printTaskId?: string;
|
/** 任务累计成功发送份数;作废不返还额度。 */
|
printQuantity?: { total: number; printed: number };
|
/** 用户点击打印且客户端可用后、创建打印票据前执行。抛错会终止后续 PDF 转换与打印。 */
|
beforePrint?: (context: { copies: number }) => Promise<void> | void;
|
/** 客户端确认提交后执行;失败时仅重试本回调,不再次发送打印。 */
|
confirmPrint?: (context: { copies: number }) => Promise<void> | void;
|
/** 预览票据固定下来的文件中心版本 ID。 */
|
fileVersionId: string;
|
/** Hiprint 客户端确认打印任务已成功提交后执行;不代表纸张已实际输出。 */
|
onPrintSuccess?: () => Promise<void> | void;
|
/** 所有打印批次均确认提交后关闭预览弹窗。 */
|
closeOnPrintSuccess?: boolean;
|
}
|
|
/** 文档业务打开模式;qianpiye 当前复用编辑器 edit 模式,供后续签批页处理识别。 */
|
export type OfficeDocumentMode = 'edit' | 'qianpiye' | 'review' | 'view' | 'viewComments';
|
|
export interface OpenOfficeDocumentConfig {
|
/** 附件对象,必填。fileId 定位文件、name 做标题并决定 documentType */
|
file: OfficeDocumentFile;
|
/** 业务归属记录 id */
|
bizDataId?: string;
|
/** 业务归属模块,用于后端权限判定与审计留痕 */
|
bizModule?: string;
|
/** ONLYOFFICE 插件业务场景;为空时后端强制只读 */
|
bizScene?: string;
|
/** 文件存储类型;DMS 预览固定为 dms,普通附件省略 */
|
fileType?: string;
|
/** DMS READ 裁决成功后签发的短期预览票据 */
|
dmsAccessTicket?: string;
|
/** 保留原预览参数并重新鉴权换票;打印票据不使用此回调。 */
|
refreshDmsPreviewTicket?: () => Promise<DmsFilePreviewTicket>;
|
dmsPreviewExpiresAt?: string;
|
/** DMS 预览内部打印上下文;业务页面应通过 previewDmsFile 生成。 */
|
dmsPrint?: DmsPrintConfig;
|
/** 期望模式,默认 edit。qianpiye 当前按 edit 打开,最终以后端返回的 editorConfig.mode 为准 */
|
mode?: OfficeDocumentMode;
|
/** 模板体检只读定位的内容控件 Tag */
|
locateControlTag?: string;
|
/** 模板体检触发重新标注时指定的绑定 ID */
|
repairBindingId?: string;
|
/** 用户主动关闭编辑器前执行;抛错会显示确认弹窗,由用户决定是否继续关闭 */
|
beforeClose?: () => Promise<void> | void;
|
/** ONLYOFFICE 手动保存完成后执行;抛错只提示,不改变已经完成的保存结果 */
|
onManualSave?: () => Promise<void> | void;
|
/** DMS upload only: request native editor close and await confirmed release; never discard automatically. */
|
registerSubmitPreparation?: (prepare: undefined | (() => Promise<void>)) => void;
|
onClose?: () => void;
|
/** 弹窗尚未打开就失败时通知调用方解除操作锁定。 */
|
onOpenError?: (error: Error) => void;
|
/**
|
* 编辑期间文档有过改动、且弹窗已关闭时触发。
|
*
|
* 普通场景回传的仍是原附件对象。`qianpiye` 场景会在 DS 保存完成后回传新的上传组件
|
* fileItem;业务侧可用 `setFormData('qianpiyeFiles', [result.file])` 替换附件字段,原文件
|
* 不会被覆盖。
|
*/
|
onSave?: (result: { file: OfficeDocumentFile; modified: boolean }) => void;
|
/** 弹窗标题,默认取 file.name */
|
title?: string;
|
}
|
|
export interface NormalizedOfficeDocumentConfig extends OpenOfficeDocumentConfig {
|
fileType: string;
|
mode: OfficeDocumentMode;
|
title: string;
|
}
|