import type { FileAccess } from './fileAccess';
|
|
export interface imgItem {
|
fileId: string;
|
name: string;
|
thumbUrl: string;
|
url: string;
|
}
|
export interface fileItem extends imgItem {
|
/** 后端核验的当前附件模板来源,随附件保存;普通上传不得继承旧值。 */
|
laiyuan_muban_id?: string;
|
uploadReceipt?: string;
|
revisionEditReceipt?: string;
|
fileExtension?: string;
|
fileSize: number | string;
|
fileVersionId?: string;
|
/** 服务端文件持久化成功时间;心跳和预览不更新。 */
|
contentSavedAt?: number;
|
}
|
|
export const units = {
|
GB: 1024 * 1024 * 1024,
|
KB: 1024,
|
MB: 1024 * 1024,
|
};
|
const uploadBaseProps = {
|
detailed: { default: false, type: Boolean },
|
disabled: { default: false, type: Boolean },
|
fileSize: { default: 10, type: Number },
|
folder: { default: '', type: String },
|
limit: { default: 0, type: Number },
|
pathType: { default: 'defaultPath', type: String },
|
showTip: { default: false, type: Boolean },
|
showUploadList: { default: true, type: Boolean },
|
simple: { default: false, type: Boolean },
|
sizeUnit: { default: 'MB', type: String },
|
sortRule: { default: () => [], type: Object },
|
timeFormat: { default: 'YYYY', type: String },
|
tipText: { default: '', type: String },
|
};
|
|
export const uploadImgProps = {
|
...uploadBaseProps,
|
accept: { default: 'image/*', type: String },
|
buttonText: { default: '', type: String },
|
// card,button,dragger
|
showType: { default: 'card', type: String },
|
type: { default: 'annexpic', type: String },
|
value: { type: Array as PropType<imgItem[]> },
|
};
|
export const uploadFileProps = {
|
...uploadBaseProps,
|
accept: { default: '*', type: String },
|
buttonText: { default: '点击上传', type: String },
|
onlineEdit: { default: false, type: Boolean },
|
qianpiyeAnnotatorEnabled: { default: false, type: Boolean },
|
fileAccess: { type: Object as PropType<FileAccess>, default: undefined },
|
allowDownload: { default: true, type: Boolean },
|
editField: { default: '', type: String },
|
editParentField: { default: '', type: String },
|
editRowId: { default: '', type: String },
|
showDownload: { default: true, type: Boolean },
|
showAllDownload: { default: true, type: Boolean },
|
showIcon: { default: true, type: Boolean },
|
// button,dragger
|
showType: { default: 'button', type: String },
|
showView: { default: true, type: Boolean },
|
type: { default: 'annex', type: String },
|
value: { default: [], type: Array as PropType<fileItem[]> },
|
};
|
export const uploadImgSingleProps = {
|
accept: { default: 'image/*', type: String },
|
action: { default: '', type: String },
|
actionPrefix: { default: '', type: String },
|
disabled: { default: false, type: Boolean },
|
fileSize: { default: 10, type: Number },
|
sizeUnit: { default: 'MB', type: String },
|
subTipText: { default: '', type: String },
|
tipText: { default: '', type: String },
|
type: { default: 'annexpic', type: String },
|
value: { default: '', type: String },
|
};
|