刘光辉
10 小时以前 0dfe84494048ce27ba8449831782128412d3eb13
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/** 附件字段里的 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 OpenOfficeDocumentConfig {
  /** 附件对象,必填。fileId 定位文件、name 做标题并决定 documentType */
  file: OfficeDocumentFile;
  /** 业务归属记录 id */
  bizDataId?: string;
  /** 业务归属模块,用于后端权限判定与审计留痕 */
  bizModule?: string;
  /** ONLYOFFICE 插件业务场景;为空时后端强制只读 */
  bizScene?: string;
  /** 文件存储类型;DMS 预览固定为 dms,普通附件省略 */
  fileType?: string;
  /** DMS READ 裁决成功后签发的短期预览票据 */
  dmsAccessTicket?: string;
  /** 期望模式,默认 edit。最终以后端返回的 editorConfig.mode 为准 */
  mode?: 'edit' | 'view';
  onClose?: () => void;
  /**
   * 编辑期间文档有过改动、且弹窗已关闭时触发。
   *
   * ⚠️ 它**不**代表后端已经把新版文档写回附件:DS 是在所有人退出后才异步回调后端保存的,
   * 前端无从得知那一步何时完成。需要展示新的 fileSize 等元信息时,业务侧应在此回调里
   * 自行重拉附件(必要时延迟重试),不要假设回调触发的瞬间文件已经是新的。
   */
  onSave?: (result: { file: OfficeDocumentFile; modified: boolean }) => void;
  /** 弹窗标题,默认取 file.name */
  title?: string;
}
 
export interface NormalizedOfficeDocumentConfig extends OpenOfficeDocumentConfig {
  mode: 'edit' | 'view';
  title: string;
}