import { Observable } from 'rxjs'; import { UploadDialogService, DownloadService } from '@gsp-svc/formdoc-upload'; import { FrameContext } from '@farris/devkit'; import { FormNotifyService } from '../form-notify.service'; import { AttachmentDataService } from './attachment-data.service'; /** * 附件服务 */ declare class AttachmentService { private frameContext; private attachDataService; private notifyService; private uploadDialogService; private downloadService; /** * 默认根目录 */ private defaultRootDirId; /** * 默认父路径 */ private readonly defaultParentDirName; /** * 绑定数据 */ private readonly bindingData; /** * 多语服务 */ private languageService; /** * 附件预览服务 */ private fileViewerService; /** * 实体服务 */ private entityService; /** * 构造函数 */ constructor(frameContext: FrameContext, attachDataService: AttachmentDataService, notifyService: FormNotifyService, uploadDialogService: UploadDialogService, downloadService: DownloadService); /** * 设置语言服务 */ private setLanguageService; /** * 上传单个文件 * @param attachmentIdPath 附件内码字段的路径,形如/attachInfo/attachmentId; * @param attachmentNamePath 附件名称字段的路径 */ uploadAndUpdateRow(attachmentInfoFieldPath: string, rootDirId?: string, parentDirName?: string, fileType?: string, id?: string): Observable; /** * 上传单个文件(支持多列) * @param attachmentInfoFieldPath 附件内码字段的路径,形如/attachInfo/attachmentId; * @param rootDirId 附件存储根目录 * @param parentDirName 附件存储目录 * @param fileType 文件类型,like .txt,.docx */ uploadAndUpdateRowWithPropertyName(attachmentInfoFieldPath: string, rootDirId?: string, parentDirName?: string, fileType?: string, id?: string): Observable; /** * 上传多个文件 */ uploadAndBatchAddRows(attachmentInfoFieldPath: string, rootDirId?: string, parentDirName?: string, fileType?: string): Observable; /** * 上传多个文件 */ uploadAndBatchAddRowsWithPropertyName(attachmentInfoFieldPath: string, rootDirId?: string, parentDirName?: string, fileType?: string, id?: string): Observable; /** * 下载附件(根据附件id) */ download(attachId: string, rootId?: string): any; /** * 批量下载附件(根据附件id数组) */ batchDownload(attachIds: string[], rootId: string): any; /** * 获取下载路径 * @param metadataidlist 附件id数组 * @param rootId rootId */ private getDownloadUrl; /** * 下载(根据数据id) */ downloadByDataId(dataId: string, attachmentInfoFieldPath: string, rootId: string): Observable; /** * 批量下载附件 */ batchDownloadByDataIds(dataIds: string[] | string, attachmentInfoFieldPath: string, rootId: string): Observable; /** * 根据附件UDT字段的路径预览附件 * @param attachmentInfoFieldPath 附件UDT字段path * @param rootDirId 跟目录id * @param ids 附件id */ previewByAttachmentInfoFieldPath(attachmentInfoFieldPath: string, rootDirId: string, ids?: any): Observable; /** * 根据附件UDT字段的路径预览当前行的附件 * @param attachmentInfoFieldPath 附件UDT字段path * @param rootDirId 根目录id */ previewByAttachmentInfoFieldPathWithIndex(attachmentInfoFieldPath: string, rootDirId: string): Observable; /** * 根据目录预览附件 * @param subDirName 父目录名称 * @param rootDirId 根目录id */ previewBySubDirName(subDirName: string, rootDirId: string): Observable; /** * 根据目录预览指定索引的附件 * @param attachmentInfoFieldPath 附件UDT字段path * @param subDirName 子目录名称 * @param rootDirId 根目录id */ previewBySubDirNameWithIndex(attachmentInfoFieldPath: string, subDirName: string, rootDirId: string): Observable; /** * 根据附件id数组预览附件 * @param attachmentIds 附件id数组 * @param rootDirId 根目录id */ previewByAttachmentIds(attachmentIds: string[], rootDirId: string): Observable; /** * 根据附件id数组预览指定索引的附件 * @param attachmentIds 附件id数组 * @param rootDirId 根目录id * @param attachmentId 附件Id */ previewFileListWithIndex(attachmentIds: string[], rootDirId: string, attachmentId: string): Observable<{}>; /** * 生成版本号 * @param versions 历史版本号 * @description 默认编码规则v1.0 v2.0 ... */ genVersion(versions: string[]): string; /** * 更新附件版本信息 * @param versionField 附件版本字段 * @param historyField 是否历史版本字段 * @param attachmentFieldPath 附件udt字段路径 */ updateAttachmentVersion(versionField: string, historyField: string, attachmentFieldPath: string): void; isAttachmentCanDelete(historyField: string, attachmentFieldPath: string): Observable; updateAttachmentHistory(versionField: string, historyField: string, attachmentFieldPath: string): void; /** * 删除附件 * @param attachmentInfoFieldPath 附件udt字段路径 * @param id 数据id * @param rootDirId 根目录 * @returns */ removeAttachment(attachmentInfoFieldPath: string, id: string, rootDirId: string): Observable; /** * 获取当前视图模型当前行的附件id * @param attachmentInfoFieldPath 附件udt字段 */ private getCurrentAttachmentId; /** * 获取当前行 * @param attachmentInfoFieldPath udt字段 */ private getCurrentRow; /** * 获取指定附件信息表的指定行 * @param attachmentInfoFieldPath * @param primaryValue * @returns */ private getSpecialRow; /** * 获取dataIds对应Entity上的附件id数组 */ private getAttachmentIdsByPathAndDataIds; } export { AttachmentService };