1
0
mirror of https://github.com/fumiama/paper-manager.git synced 2026-06-11 03:20:24 +08:00

finish getFileList getFilePercent and part of analyzeFile

This commit is contained in:
源文雨
2023-04-08 00:30:04 +08:00
parent 773db2e581
commit 2fcb3fd636
15 changed files with 302 additions and 90 deletions

View File

@@ -11,12 +11,6 @@
{{ fileList.length }}
</template>
</template>
<a-button @click="openPreviewModal">
<Icon icon="bi:eye" />
<template v-if="fileList.length && showPreviewNumber">
{{ fileList.length }}
</template>
</a-button>
</Tooltip>
</Space>
<UploadModal
@@ -26,18 +20,10 @@
@change="handleChange"
@delete="handleDelete"
/>
<UploadPreviewModal
:value="fileList"
@register="registerPreviewModal"
@list-change="handlePreviewChange"
@delete="handlePreviewDelete"
/>
</div>
</template>
<script lang="ts">
import { defineComponent, ref, watch, unref, computed } from 'vue'
import { Icon } from '/@/components/Icon'
import { Tooltip, Space } from 'ant-design-vue'
import { useModal } from '/@/components/Modal'
import { uploadContainerProps } from './props'
@@ -45,10 +31,9 @@
import { useI18n } from '/@/hooks/web/useI18n'
import { isArray } from '/@/utils/is'
import UploadModal from './UploadModal.vue'
import UploadPreviewModal from './UploadPreviewModal.vue'
export default defineComponent({
name: 'BasicUpload',
components: { UploadModal, Space, UploadPreviewModal, Icon, Tooltip },
components: { UploadModal, Space, Tooltip },
props: uploadContainerProps,
emits: ['change', 'delete', 'preview-delete', 'update:value'],
setup(props, { emit, attrs }) {
@@ -80,12 +65,6 @@
emit('update:value', fileList.value)
emit('change', fileList.value)
}
// 预览modal保存操作
function handlePreviewChange(urls: string[]) {
fileList.value = [...(urls || [])]
emit('update:value', fileList.value)
emit('change', fileList.value)
}
function handleDelete(record: Recordable) {
emit('delete', record)
}
@@ -96,7 +75,6 @@
registerUploadModal,
openUploadModal,
handleChange,
handlePreviewChange,
registerPreviewModal,
openPreviewModal,
fileList,

View File

@@ -2,7 +2,7 @@
<BasicModal
width="800px"
:title="t('component.upload.upload')"
:okText="t('component.upload.save')"
:okText="t('component.upload.complete')"
v-bind="$attrs"
@register="register"
@ok="handleOk"
@@ -236,11 +236,11 @@
if (isUploadingRef.value) {
return createMessage.warning(t('component.upload.saveWarn'))
}
const fileList: string[] = []
const fileList: number[] = []
for (const item of fileListRef.value) {
const { status, responseData } = item
if (status === UploadResultStatus.SUCCESS && responseData) {
fileList.push(responseData.url)
fileList.push(responseData.result)
}
}
// 存在一个上传成功的即可保存