mirror of
https://github.com/keven1024/015.git
synced 2026-05-26 07:08:02 +00:00
refactor(front): replace FileUploadResultView with ResultIndexView and update form field naming for consistency
This commit is contained in:
@@ -2,12 +2,12 @@
|
||||
import VeeForm from '@/components/VeeForm.vue'
|
||||
import FileUploadInputFileView from './FileUploadInputFileView.vue'
|
||||
import FileUploadProgressView from './FileUploadProgressView.vue'
|
||||
import FileUploadResultView from './FileUploadResultView.vue'
|
||||
import ResultIndexView from '@/components/Result/ResultIndexView.vue'
|
||||
|
||||
const fileStepList = [
|
||||
{ component: FileUploadInputFileView, key: 'input' },
|
||||
{ component: FileUploadProgressView, key: 'progress' },
|
||||
{ component: FileUploadResultView, key: 'result' },
|
||||
{ component: ResultIndexView, key: 'result' },
|
||||
]
|
||||
|
||||
const step = ref('input')
|
||||
|
||||
@@ -14,7 +14,7 @@ const handleFormSubmit = async (form: any) => {
|
||||
showDrawer({
|
||||
render: ({ hide }) => h(FileShareDrawer, {
|
||||
hide, file, onFileHandle: ({ type, config }) => {
|
||||
form.setFieldValue('file_handle_type', type)
|
||||
form.setFieldValue('handle_type', type)
|
||||
form.setFieldValue('config', config)
|
||||
emit('change', 'progress')
|
||||
}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
<script lang="ts" setup>
|
||||
import FileShareResult from '@/components/Result/FileShareResult.vue'
|
||||
|
||||
const props = defineProps<{
|
||||
data: { file: File, config: any, file_handle_type: string, file_id: string }
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'change', key: string): void
|
||||
}>()
|
||||
|
||||
// console.log(props.data)
|
||||
|
||||
const handleList = [
|
||||
{ component: FileShareResult, key: 'file-share' },
|
||||
// { component: FileShareResult, key: 'file-share' },
|
||||
]
|
||||
const handleComponent = computed(() => {
|
||||
return handleList.find((item) => item.key === props?.data?.file_handle_type)?.component
|
||||
})
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<div class="">
|
||||
<component :is="handleComponent" :data="data" @change="(key: string) => {
|
||||
emit('change', key)
|
||||
}" />
|
||||
</div>
|
||||
</template>
|
||||
33
front/components/Result/ResultIndexView.vue
Normal file
33
front/components/Result/ResultIndexView.vue
Normal file
@@ -0,0 +1,33 @@
|
||||
<script lang="ts" setup>
|
||||
import FileShareResult from '@/components/Result/FileShareResult.vue'
|
||||
type basehandleData = { config: any, handle_type: string }
|
||||
|
||||
type filehandleData = { file: File, file_id: string } & basehandleData
|
||||
type texthandleData = { text: string } & basehandleData
|
||||
|
||||
const props = defineProps<{
|
||||
data: filehandleData
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'change', key: string): void
|
||||
}>()
|
||||
|
||||
// console.log(props.data)
|
||||
|
||||
const handleList = [
|
||||
{ component: FileShareResult, key: 'file-share' },
|
||||
// { component: FileShareResult, key: 'file-share' },
|
||||
]
|
||||
const handleComponent = computed(() => {
|
||||
return handleList.find((item) => item.key === props?.data?.handle_type)?.component
|
||||
})
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<div class="">
|
||||
<component :is="handleComponent" :data="data" @change="(key: string) => {
|
||||
emit('change', key)
|
||||
}" />
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user