@jzt-packages/components 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +68 -0
- package/src/JztBackTop/index.vue +255 -0
- package/src/JztButtonList/index.vue +88 -0
- package/src/JztChart/index.vue +95 -0
- package/src/JztCharts/index.vue +317 -0
- package/src/JztClassTabs/index.vue +156 -0
- package/src/JztDateSelect/dateSelect.vue +186 -0
- package/src/JztDateSelect/dateType.vue +54 -0
- package/src/JztDateSelect/index.ts +135 -0
- package/src/JztDateSelect/interface/index.ts +13 -0
- package/src/JztDialog/index.vue +249 -0
- package/src/JztEllipsisTooltip/index.vue +61 -0
- package/src/JztEmpty/index.vue +45 -0
- package/src/JztErrorPage/403.vue +30 -0
- package/src/JztErrorPage/404.vue +19 -0
- package/src/JztErrorPage/500.vue +18 -0
- package/src/JztErrorPage/assets/401.png +0 -0
- package/src/JztErrorPage/assets/403.png +0 -0
- package/src/JztErrorPage/assets/404.png +0 -0
- package/src/JztErrorPage/assets/500.png +0 -0
- package/src/JztErrorPage/index.scss +35 -0
- package/src/JztErrorPage/index.vue +35 -0
- package/src/JztFilePreview/components/pdfViewer.vue +221 -0
- package/src/JztFilePreview/hooks/useImageMethod.ts +256 -0
- package/src/JztFilePreview/index.scss +171 -0
- package/src/JztFilePreview/index.vue +68 -0
- package/src/JztFilePreview/interface/index.ts +18 -0
- package/src/JztFilePreview/previewFile.vue +371 -0
- package/src/JztFormGrid/README.md +520 -0
- package/src/JztFormGrid/components/formItem.vue +209 -0
- package/src/JztFormGrid/components/formItemValue.vue +384 -0
- package/src/JztFormGrid/components/showDetailForm.vue +172 -0
- package/src/JztFormGrid/index.scss +60 -0
- package/src/JztFormGrid/index.vue +513 -0
- package/src/JztFormGrid/interface/index.ts +106 -0
- package/src/JztGrid/components/GridItem.vue +68 -0
- package/src/JztGrid/index.vue +179 -0
- package/src/JztGrid/interface/index.ts +6 -0
- package/src/JztImportExcel/assets/delete.png +0 -0
- package/src/JztImportExcel/index.scss +46 -0
- package/src/JztImportExcel/index.vue +430 -0
- package/src/JztImportExcel/interface/index.ts +25 -0
- package/src/JztLabelTitle/index.vue +65 -0
- package/src/JztLeftRightMode/components/CollapseButton.vue +80 -0
- package/src/JztLeftRightMode/components/LeftCard.vue +203 -0
- package/src/JztLeftRightMode/components/LeftLayout.vue +173 -0
- package/src/JztLeftRightMode/components/RightHeader.vue +186 -0
- package/src/JztLeftRightMode/components/RightLayout.vue +235 -0
- package/src/JztLeftRightMode/components/RightTableHeader.vue +43 -0
- package/src/JztLeftRightMode/hooks/useCollapse.ts +17 -0
- package/src/JztLeftRightMode/hooks/useDefaultProps.ts +19 -0
- package/src/JztLeftRightMode/hooks/useLeftLayout.ts +201 -0
- package/src/JztLeftRightMode/hooks/useMode.ts +20 -0
- package/src/JztLeftRightMode/hooks/usePrevNext.ts +60 -0
- package/src/JztLeftRightMode/hooks/useRightLayout.ts +215 -0
- package/src/JztLeftRightMode/hooks/useSlots.ts +15 -0
- package/src/JztLeftRightMode/index.ts +3 -0
- package/src/JztLeftRightMode/index.vue +494 -0
- package/src/JztLeftRightMode/types/index.ts +457 -0
- package/src/JztLoading/fullScreen.ts +45 -0
- package/src/JztLoading/index.scss +67 -0
- package/src/JztLoading/index.vue +18 -0
- package/src/JztLogin/components/LoginFooter.vue +17 -0
- package/src/JztLogin/components/LoginForm.vue +99 -0
- package/src/JztLogin/hooks/useLogin.ts +186 -0
- package/src/JztLogin/index.scss +142 -0
- package/src/JztLogin/index.vue +31 -0
- package/src/JztLogin/interface/index.ts +47 -0
- package/src/JztNumericalRange/index.vue +81 -0
- package/src/JztPageCard/comm/datePicker.vue +151 -0
- package/src/JztPageCard/comm/details.vue +60 -0
- package/src/JztPageCard/comm/export.vue +24 -0
- package/src/JztPageCard/comm/tabs.vue +94 -0
- package/src/JztPageCard/comm/tooltip.vue +31 -0
- package/src/JztPageCard/index.vue +287 -0
- package/src/JztPagination/index.vue +70 -0
- package/src/JztProductInfo/components/imagePreview.vue +275 -0
- package/src/JztProductInfo/components/qxUnique.vue +101 -0
- package/src/JztProductInfo/components/records.vue +265 -0
- package/src/JztProductInfo/hooks/useParams.ts +143 -0
- package/src/JztProductInfo/hooks/useQxUnique.tsx +466 -0
- package/src/JztProductInfo/images/defaultProduct.png +0 -0
- package/src/JztProductInfo/index.ts +116 -0
- package/src/JztProductInfo/index.vue +108 -0
- package/src/JztProductInfo/interface/index.ts +15 -0
- package/src/JztQueryDetailTable/index.scss +100 -0
- package/src/JztQueryDetailTable/index.vue +400 -0
- package/src/JztQueryDetailTable/interface/index.ts +10 -0
- package/src/JztQueryTable/QueryTable /345/212/237/350/203/275.md" +1580 -0
- package/src/JztQueryTable/README.md +567 -0
- package/src/JztQueryTable/components/ColSetting.vue +67 -0
- package/src/JztQueryTable/components/ColumnsSetting.vue +404 -0
- package/src/JztQueryTable/components/ColumnsSetting1.vue +220 -0
- package/src/JztQueryTable/components/DeployToAccountLevelSetting.vue +351 -0
- package/src/JztQueryTable/components/Pagination.vue +54 -0
- package/src/JztQueryTable/components/TableColumn.vue +109 -0
- package/src/JztQueryTable/const.ts +1 -0
- package/src/JztQueryTable/hooks/useQueryTable.ts +194 -0
- package/src/JztQueryTable/hooks/useSelection.ts +47 -0
- package/src/JztQueryTable/hooks/useTableSetting.ts +197 -0
- package/src/JztQueryTable/hooks/useTemplate.ts +127 -0
- package/src/JztQueryTable/index.scss +91 -0
- package/src/JztQueryTable/index.vue +1445 -0
- package/src/JztQueryTable/interface/index.ts +185 -0
- package/src/JztRegionSelect/index.vue +134 -0
- package/src/JztSearchForm/components/SearchFormItem.vue +473 -0
- package/src/JztSearchForm/index.vue +530 -0
- package/src/JztSearchForm/interface/index.ts +100 -0
- package/src/JztSelectFilter/index.scss +63 -0
- package/src/JztSelectFilter/index.vue +110 -0
- package/src/JztSelectTable/index.vue +257 -0
- package/src/JztTable/index.scss +72 -0
- package/src/JztTable/index.vue +353 -0
- package/src/JztTable/interface/index.ts +1 -0
- package/src/JztTime/comm/agencySelect.vue +112 -0
- package/src/JztTime/comm/collapseRow.vue +132 -0
- package/src/JztTime/comm/dateSelect.vue +292 -0
- package/src/JztTime/comm/deptSelect.vue +193 -0
- package/src/JztTime/comm/typeSelect.vue +97 -0
- package/src/JztTime/index.ts +216 -0
- package/src/JztTime/index.vue +303 -0
- package/src/JztTime/interface/index.ts +23 -0
- package/src/JztTreeFilter/index.scss +44 -0
- package/src/JztTreeFilter/index.vue +177 -0
- package/src/JztUploadFile/interface/index.ts +21 -0
- package/src/JztUploadFile/multiple.scss +215 -0
- package/src/JztUploadFile/multiple.vue +318 -0
- package/src/JztUploadFile/single.scss +226 -0
- package/src/JztUploadFile/single.vue +274 -0
- package/src/JztUploadImg/Img.vue +294 -0
- package/src/JztUploadImg/Imgs.vue +411 -0
- package/src/JztUploadImg/index.scss +138 -0
- package/src/JztUploadImg/interface/index.ts +22 -0
- package/src/SelectIcon/index.scss +39 -0
- package/src/SelectIcon/index.vue +106 -0
- package/src/SvgIcon/index.vue +22 -0
- package/src/hooks/useAuthButtons.ts +58 -0
- package/src/hooks/useFormByUserType.ts +90 -0
- package/src/hooks/useTableEvents.ts +30 -0
- package/src/hooks/useUploadFileHook.ts +262 -0
- package/src/index.ts +91 -0
- package/src/typings/global.d.ts +101 -0
- package/src/utils/index.ts +107 -0
- package/src/utils/tree.ts +57 -0
- package/tsconfig.json +45 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { VNode, ComponentPublicInstance, Ref } from 'vue'
|
|
2
|
+
import { FilePreview } from '../index.vue'
|
|
3
|
+
|
|
4
|
+
export type FilePreviewRefInstance = keyof ComponentPublicInstance | keyof FilePreview
|
|
5
|
+
export type FilePreviewRef = {
|
|
6
|
+
// [key in FilePreviewRefInstance]: (param: string[]) => any
|
|
7
|
+
openDialog: (param: string[]) => any
|
|
8
|
+
openDialogById: (id: string) => any
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface FileItemProps {
|
|
12
|
+
arrayIndex: number
|
|
13
|
+
id: string
|
|
14
|
+
url: string
|
|
15
|
+
name: string
|
|
16
|
+
fileType: string
|
|
17
|
+
isPdf: boolean // 是否是pdf
|
|
18
|
+
}
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-if="fileList.length" v-loading="loading" class="dialog-content flx-left-center">
|
|
3
|
+
<div v-if="showList" class="left-list">
|
|
4
|
+
<div v-if="slots.leftContent" class="thumbnail flex-top-center">
|
|
5
|
+
<el-scrollbar style="height: calc(100% - 160px)">
|
|
6
|
+
<slot name="leftContent"></slot>
|
|
7
|
+
</el-scrollbar>
|
|
8
|
+
<div v-if="fileList && fileList.length">
|
|
9
|
+
<div class="scroll-thumbnail flx-left-center" ref="scrollBox">
|
|
10
|
+
<div
|
|
11
|
+
v-for="(itemSrc, index) in fileList"
|
|
12
|
+
class="thumbnail-item"
|
|
13
|
+
:id="`thumbnail_${index}`"
|
|
14
|
+
:key="`thumbnail_${index}`"
|
|
15
|
+
:class="{ active: index === currentItem.arrayIndex }"
|
|
16
|
+
@click="changeActiveItem(itemSrc)"
|
|
17
|
+
>
|
|
18
|
+
<el-image v-if="itemSrc.isPdf" style="width: 100%; height: 100%" :src="pdfCover" fit="scale-down" />
|
|
19
|
+
<el-image v-else style="width: 100%; height: 100%" :src="itemSrc.url" fit="scale-down" />
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
<div class="footer">
|
|
23
|
+
<span>{{ currentItem.arrayIndex + 1 }}</span>
|
|
24
|
+
<span>/</span>
|
|
25
|
+
<span>{{ fileList.length }}</span>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
<el-scrollbar v-else ref="scrollbarRef">
|
|
30
|
+
<div class="thumbnail flx-left-center" :class="[fileList.length <= 3 ? 'single' : '']">
|
|
31
|
+
<div v-for="file in fileList" class="thumbnail-item column-center" @click="onPreview(file)">
|
|
32
|
+
<span
|
|
33
|
+
class="thumbnail-box flx-center"
|
|
34
|
+
:class="[file.fileType === 'pdf' ? 'pdf-box' : '', currentItem.id === file.id ? 'active-item' : '']"
|
|
35
|
+
>
|
|
36
|
+
<el-image :src="file.fileType === 'pdf' ? pdfCover : file.url" fit="scale-down" class="thumbnail-image" />
|
|
37
|
+
</span>
|
|
38
|
+
<JztEllipsisTooltip :isEllipsis="true" :content="file.name" />
|
|
39
|
+
|
|
40
|
+
<!-- <span class="fileName sle" :title="file.name">
|
|
41
|
+
{{ file.name }}
|
|
42
|
+
</span> -->
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</el-scrollbar>
|
|
46
|
+
</div>
|
|
47
|
+
<div class="preview ml5">
|
|
48
|
+
<div v-if="showHeader" class="header flx-between-center">
|
|
49
|
+
<div class="fileName mb10">
|
|
50
|
+
<slot name="fileInfo">{{ currentItem.name }}</slot>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
<div v-if="currentItem.url" class="preview-item flx-center">
|
|
54
|
+
<div
|
|
55
|
+
v-if="fileList.length > 1"
|
|
56
|
+
class="circle flx-center previous"
|
|
57
|
+
@click="onPrevious(currentItem.arrayIndex)"
|
|
58
|
+
title="上一张"
|
|
59
|
+
>
|
|
60
|
+
<el-icon :size="18"><ArrowLeftBold /></el-icon>
|
|
61
|
+
</div>
|
|
62
|
+
<div
|
|
63
|
+
v-if="fileList.length > 1"
|
|
64
|
+
class="circle flx-center next"
|
|
65
|
+
@click="onNext(currentItem.arrayIndex)"
|
|
66
|
+
title="上一张"
|
|
67
|
+
>
|
|
68
|
+
<el-icon :size="18"><ArrowRightBold /></el-icon>
|
|
69
|
+
</div>
|
|
70
|
+
<div style="width: 100%; height: 100%" v-if="currentItem.fileType === 'pdf'">
|
|
71
|
+
<pdf-viewer ref="pdfViewerRef" :pdfUrl="currentItem.url" :pdfName="currentItem.name" />
|
|
72
|
+
</div>
|
|
73
|
+
<el-image v-else id="printImage" ref="targetEleRef" :src="currentItem.url" fit="scale-down" class="preview-image" />
|
|
74
|
+
<div v-if="currentItem.fileType !== 'pdf'" class="page-tool flx-evenly-center cursor-pointer">
|
|
75
|
+
<span @click="useDownloadImgByUrl(currentItem.url, currentItem.name)">
|
|
76
|
+
<el-tooltip effect="dark" content="下载" placement="top">
|
|
77
|
+
<i class="iconfont icon-xiazai"></i>
|
|
78
|
+
</el-tooltip>
|
|
79
|
+
</span>
|
|
80
|
+
<span @click="printA4File({ printable: currentItem.url, type: 'image' })">
|
|
81
|
+
<el-tooltip effect="dark" content="打印" placement="top">
|
|
82
|
+
<i class="iconfont icon-dayin"></i>
|
|
83
|
+
</el-tooltip>
|
|
84
|
+
</span>
|
|
85
|
+
<span @click="useRotateImg">
|
|
86
|
+
<el-tooltip effect="dark" content="旋转" placement="top">
|
|
87
|
+
<i class="iconfont icon-xuanzhuan"></i>
|
|
88
|
+
</el-tooltip>
|
|
89
|
+
</span>
|
|
90
|
+
<span @click="resetImageInfo">
|
|
91
|
+
<el-tooltip effect="dark" content="适应" placement="top">
|
|
92
|
+
<i class="iconfont icon-shiyingchuangkou"></i>
|
|
93
|
+
</el-tooltip>
|
|
94
|
+
</span>
|
|
95
|
+
<div class="flx-center">
|
|
96
|
+
<span @click="pageZoomOut">
|
|
97
|
+
<el-tooltip effect="dark" content="放大" placement="top">
|
|
98
|
+
<i class="iconfont icon-fangda"></i>
|
|
99
|
+
</el-tooltip>
|
|
100
|
+
</span>
|
|
101
|
+
<span class="ml10 mr10">{{ Math.round(scaleValue * 100) }}%</span>
|
|
102
|
+
<span @click="pageZoomIn">
|
|
103
|
+
<el-tooltip effect="dark" content="缩小" placement="top">
|
|
104
|
+
<i class="iconfont icon-suoxiao"></i>
|
|
105
|
+
</el-tooltip>
|
|
106
|
+
</span>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
<div v-else class="dialog-content column-center">
|
|
113
|
+
<JztEmpty emptyText="暂无数据" />
|
|
114
|
+
</div>
|
|
115
|
+
</template>
|
|
116
|
+
|
|
117
|
+
<script setup lang="ts" name="JztFilePreview">
|
|
118
|
+
import { watchEffect, ref, useSlots, nextTick } from 'vue'
|
|
119
|
+
import { FileItemProps } from './interface/index'
|
|
120
|
+
import pdfViewer from './components/pdfViewer.vue'
|
|
121
|
+
import { useDownloadImgByUrl, isPdfSuffix } from '@jzt-spd/utils'
|
|
122
|
+
import { useImageDragZoom } from './hooks/useImageMethod'
|
|
123
|
+
import JztEmpty from '../JztEmpty/index.vue'
|
|
124
|
+
import { printA4File } from '@jzt-spd/utils'
|
|
125
|
+
import { useUploadFileHook } from '../hooks/useUploadFileHook'
|
|
126
|
+
import { pdfCover } from '@jzt-spd/styles/assets'
|
|
127
|
+
import JztEllipsisTooltip from '../JztEllipsisTooltip/index.vue'
|
|
128
|
+
|
|
129
|
+
const {
|
|
130
|
+
targetEleRef,
|
|
131
|
+
scaleValue,
|
|
132
|
+
setupDragEvents,
|
|
133
|
+
setupWheelEvent,
|
|
134
|
+
resetImageInfo,
|
|
135
|
+
useRotateImg,
|
|
136
|
+
pageZoomOut,
|
|
137
|
+
pageZoomIn
|
|
138
|
+
} = useImageDragZoom()
|
|
139
|
+
const slots = useSlots()
|
|
140
|
+
const { getFullUrl } = useUploadFileHook()
|
|
141
|
+
|
|
142
|
+
export interface FilePreview {
|
|
143
|
+
showList?: boolean
|
|
144
|
+
showHeader?: boolean
|
|
145
|
+
}
|
|
146
|
+
const props = withDefaults(defineProps<FilePreview>(), {
|
|
147
|
+
showList: true, // 是否展示左边的缩略图列表
|
|
148
|
+
showHeader: true // 是否展示头部
|
|
149
|
+
})
|
|
150
|
+
const dialogVisible = ref(false)
|
|
151
|
+
const pdfViewerRef = ref()
|
|
152
|
+
const scrollbarRef = ref()
|
|
153
|
+
const fileList = ref<FileItemProps[]>([])
|
|
154
|
+
const loading = ref(false)
|
|
155
|
+
const currentItem = ref<FileItemProps>({
|
|
156
|
+
id: '',
|
|
157
|
+
url: '',
|
|
158
|
+
name: '',
|
|
159
|
+
fileType: '',
|
|
160
|
+
arrayIndex: 0,
|
|
161
|
+
isPdf: false
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* @description 打开预览弹框
|
|
166
|
+
* @param file 文件
|
|
167
|
+
* @param number 点击打开的是第几个文件
|
|
168
|
+
* */
|
|
169
|
+
const setFileInfo = (list: string[], curIndex: number = 0) => {
|
|
170
|
+
resetImageInfo()
|
|
171
|
+
dialogVisible.value = true
|
|
172
|
+
fileList.value = []
|
|
173
|
+
if (!list || !list.length) return
|
|
174
|
+
list.forEach((url, index) => {
|
|
175
|
+
const fileName = getFileNameByUrl(url)
|
|
176
|
+
const nameList = fileName.split('.')
|
|
177
|
+
const fileType = nameList[nameList.length - 1] || ''
|
|
178
|
+
fileList.value.push({
|
|
179
|
+
arrayIndex: index,
|
|
180
|
+
id: fileName + '_' + index,
|
|
181
|
+
fileType: fileType,
|
|
182
|
+
isPdf: isPdfSuffix(fileName), //当前项是否为 PDF
|
|
183
|
+
url: getFullUrl(url),
|
|
184
|
+
name: fileName
|
|
185
|
+
})
|
|
186
|
+
})
|
|
187
|
+
onPreview(fileList.value[curIndex])
|
|
188
|
+
scrollToActiveThumbnail()
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* @description 截取处理文件名称
|
|
192
|
+
* @param url url
|
|
193
|
+
*/
|
|
194
|
+
function getFileNameByUrl(url: string): string {
|
|
195
|
+
const fileName = url.substring(url.lastIndexOf('/') + 1) // 获取文件名部分
|
|
196
|
+
const firstUnderscoreIndex = fileName.indexOf('_')
|
|
197
|
+
const name = firstUnderscoreIndex !== -1 ? fileName.slice(firstUnderscoreIndex + 1) : ''
|
|
198
|
+
return name.toLowerCase()
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* @description 文件预览
|
|
203
|
+
* @param file 文件
|
|
204
|
+
* */
|
|
205
|
+
const onPreview = (file: FileItemProps) => {
|
|
206
|
+
currentItem.value = file
|
|
207
|
+
resetImageInfo()
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* @description 文件预览
|
|
212
|
+
* @param file 文件
|
|
213
|
+
* */
|
|
214
|
+
const closePreview = (file: FileItemProps) => {
|
|
215
|
+
fileList.value = []
|
|
216
|
+
Object.keys(currentItem.value).forEach(key => {
|
|
217
|
+
currentItem.value[key] = null
|
|
218
|
+
})
|
|
219
|
+
resetImageInfo()
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const scrollBox = ref<HTMLElement>()
|
|
223
|
+
|
|
224
|
+
const scrollToActiveThumbnail = () => {
|
|
225
|
+
nextTick(() => {
|
|
226
|
+
const activeIndex = currentItem.value.arrayIndex
|
|
227
|
+
// 水平缩略图条(scrollBox)
|
|
228
|
+
if (scrollBox.value) {
|
|
229
|
+
const thumbnail = document.getElementById(`thumbnail_${activeIndex}`)
|
|
230
|
+
if (thumbnail) {
|
|
231
|
+
thumbnail.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'center' })
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
// 垂直缩略图列表(el-scrollbar)
|
|
235
|
+
const wrap = scrollbarRef.value?.wrapRef
|
|
236
|
+
if (wrap) {
|
|
237
|
+
const activeItem = wrap.querySelector('.active-item')
|
|
238
|
+
if (activeItem) {
|
|
239
|
+
activeItem.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'nearest' })
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
})
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// 切换上一张图片
|
|
246
|
+
const onPrevious = (index: number) => {
|
|
247
|
+
if (fileList.value.length <= 1) return
|
|
248
|
+
if (index === 0) {
|
|
249
|
+
onPreview(fileList.value[fileList.value.length - 1])
|
|
250
|
+
} else {
|
|
251
|
+
onPreview(fileList.value[index - 1])
|
|
252
|
+
}
|
|
253
|
+
scrollToActiveThumbnail()
|
|
254
|
+
}
|
|
255
|
+
// 切换下一张图片
|
|
256
|
+
const onNext = (index: number) => {
|
|
257
|
+
if (fileList.value.length <= 1) return
|
|
258
|
+
if (index === fileList.value.length - 1) {
|
|
259
|
+
onPreview(fileList.value[0])
|
|
260
|
+
} else {
|
|
261
|
+
onPreview(fileList.value[index + 1])
|
|
262
|
+
}
|
|
263
|
+
scrollToActiveThumbnail()
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// 切换图片
|
|
267
|
+
const changeActiveItem = itemSrc => {
|
|
268
|
+
currentItem.value = { ...itemSrc }
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
watchEffect(
|
|
272
|
+
() => {
|
|
273
|
+
if (dialogVisible.value) {
|
|
274
|
+
setupDragEvents()
|
|
275
|
+
setupWheelEvent()
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
{ flush: 'post' }
|
|
279
|
+
)
|
|
280
|
+
defineExpose({
|
|
281
|
+
closePreview,
|
|
282
|
+
setFileInfo
|
|
283
|
+
})
|
|
284
|
+
</script>
|
|
285
|
+
<style lang="scss" scoped>
|
|
286
|
+
@use './index';
|
|
287
|
+
|
|
288
|
+
.iconfont {
|
|
289
|
+
font-size: 22px;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.thumbnail {
|
|
293
|
+
.preview {
|
|
294
|
+
flex: 1;
|
|
295
|
+
position: relative;
|
|
296
|
+
width: 100%;
|
|
297
|
+
height: 100%;
|
|
298
|
+
border-radius: 6px;
|
|
299
|
+
background: #f6f7f9;
|
|
300
|
+
padding: 8px;
|
|
301
|
+
overflow: hidden;
|
|
302
|
+
img {
|
|
303
|
+
width: 100%;
|
|
304
|
+
height: 100%;
|
|
305
|
+
object-fit: scale-down;
|
|
306
|
+
}
|
|
307
|
+
.circle {
|
|
308
|
+
width: 48px;
|
|
309
|
+
height: 48px;
|
|
310
|
+
border-radius: 50%;
|
|
311
|
+
opacity: 0.8;
|
|
312
|
+
border: 1px solid #bbbfc2;
|
|
313
|
+
background: #ffffffcc;
|
|
314
|
+
}
|
|
315
|
+
.previous {
|
|
316
|
+
position: absolute;
|
|
317
|
+
left: 24px;
|
|
318
|
+
top: 50%;
|
|
319
|
+
transform: translateY(-50%);
|
|
320
|
+
z-index: 10;
|
|
321
|
+
cursor: pointer;
|
|
322
|
+
}
|
|
323
|
+
.next {
|
|
324
|
+
position: absolute;
|
|
325
|
+
right: 24px;
|
|
326
|
+
top: 50%;
|
|
327
|
+
transform: translateY(-50%);
|
|
328
|
+
z-index: 10;
|
|
329
|
+
cursor: pointer;
|
|
330
|
+
}
|
|
331
|
+
&:hover .pdf-overlay {
|
|
332
|
+
opacity: 1;
|
|
333
|
+
}
|
|
334
|
+
.pdf-overlay {
|
|
335
|
+
position: absolute;
|
|
336
|
+
inset: 0;
|
|
337
|
+
background: rgba(0, 0, 0, 0.45);
|
|
338
|
+
opacity: 0;
|
|
339
|
+
transition: opacity 0.2s;
|
|
340
|
+
flex-direction: column;
|
|
341
|
+
gap: 8px;
|
|
342
|
+
.pdf-hint {
|
|
343
|
+
color: #fff;
|
|
344
|
+
font-size: 14px;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.scroll-thumbnail {
|
|
350
|
+
width: 100%;
|
|
351
|
+
height: 120px;
|
|
352
|
+
overflow-x: auto;
|
|
353
|
+
overflow-y: hidden;
|
|
354
|
+
scroll-behavior: smooth; /* 平滑滚动 */
|
|
355
|
+
white-space: nowrap; /* 禁止换行 */
|
|
356
|
+
flex-wrap: nowrap;
|
|
357
|
+
.thumbnail-item {
|
|
358
|
+
flex-shrink: 0;
|
|
359
|
+
width: 150px;
|
|
360
|
+
height: 92px;
|
|
361
|
+
margin-right: 15px;
|
|
362
|
+
border-radius: 4px;
|
|
363
|
+
border: 2px solid #dee2e6;
|
|
364
|
+
user-select: none;
|
|
365
|
+
&.active {
|
|
366
|
+
border: 2px solid var(--el-color-primary);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
</style>
|