|
1 | 1 | <template> |
2 | 2 | <el-upload |
3 | | - style="width: 80%" |
| 3 | + style="width: 100%" |
4 | 4 | v-loading="loading" |
5 | 5 | action="#" |
6 | 6 | v-bind="$attrs" |
|
10 | 10 | multiple |
11 | 11 | > |
12 | 12 | <el-button type="primary">{{ $t('chat.uploadFile.label') }}</el-button> |
13 | | - <template #file="{ file, index }" |
14 | | - ><el-card style="--el-card-padding: 0" shadow="never"> |
| 13 | + <template #file="{ file }"> |
| 14 | + <el-card style="--el-card-padding: 0" shadow="never"> |
15 | 15 | <div |
| 16 | + class="flex-between" |
16 | 17 | :class="[inputDisabled ? 'is-disabled' : '']" |
17 | | - style=" |
18 | | - padding: 0 8px 0 8px; |
19 | | - display: flex; |
20 | | - justify-content: space-between; |
21 | | - align-items: center; |
22 | | - align-content: center; |
23 | | - " |
| 18 | + style="padding: 0 8px 0 8px" |
24 | 19 | > |
25 | | - <el-tooltip class="box-item" effect="dark" :content="file.name" placement="top-start"> |
26 | | - <div style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 40%"> |
| 20 | + <div class="flex align-center" style="width: 70%"> |
| 21 | + <img :src="getImgUrl(file && file?.name)" alt="" width="24" class="mr-4" /> |
| 22 | + <span class="ellipsis-1" :title="file.name"> |
27 | 23 | {{ file.name }} |
28 | | - </div></el-tooltip |
29 | | - > |
| 24 | + </span> |
| 25 | + </div> |
| 26 | + <div class="flex align-center"> |
| 27 | + <div>{{ formatSize(file.size) }}</div> |
30 | 28 |
|
31 | | - <div>{{ formatSize(file.size) }}</div> |
32 | | - <el-icon @click="deleteFile(file)" style="cursor: pointer"><DeleteFilled /></el-icon> |
| 29 | + <el-button link class="ml-8" @click="deleteFile(file)"> |
| 30 | + <AppIcon iconName="app-delete"></AppIcon> |
| 31 | + </el-button> |
| 32 | + </div> |
33 | 33 | </div> |
34 | 34 | </el-card> |
35 | 35 | </template> |
|
39 | 39 | import { computed, inject, ref, useAttrs } from 'vue' |
40 | 40 | import { ElMessage } from 'element-plus' |
41 | 41 | import type { FormField } from '@/components/dynamics-form/type' |
| 42 | +import { getImgUrl } from '@/utils/common' |
42 | 43 | import { t } from '@/locales' |
43 | 44 | import { useFormDisabled } from 'element-plus' |
44 | 45 | const inputDisabled = useFormDisabled() |
@@ -71,7 +72,7 @@ const deleteFile = (file: any) => { |
71 | 72 |
|
72 | 73 | const model_value = computed({ |
73 | 74 | get: () => { |
74 | | - if (!model_value) { |
| 75 | + if (!model_value.value) { |
75 | 76 | emit('update:modelValue', []) |
76 | 77 | } |
77 | 78 | return props.modelValue |
|
0 commit comments