@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,318 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="listType === 'text' ? 'file_upload_box' : 'img_upload_box'" class="flx-left-center">
|
|
3
|
+
<slot name="upload-left"></slot>
|
|
4
|
+
<el-upload
|
|
5
|
+
v-if="isShow ? _fileList && _fileList.length : true"
|
|
6
|
+
v-model:file-list="_fileList"
|
|
7
|
+
action="#"
|
|
8
|
+
:list-type="listType"
|
|
9
|
+
:class="[
|
|
10
|
+
'upload',
|
|
11
|
+
self_disabled ? 'disabled' : '',
|
|
12
|
+
isShow || (listType !== 'text' && _fileList.length >= limit) ? 'no-upload' : ''
|
|
13
|
+
]"
|
|
14
|
+
:multiple="true"
|
|
15
|
+
:disabled="self_disabled || _fileList.length >= limit"
|
|
16
|
+
:limit="isShow ? _fileList.length : limit"
|
|
17
|
+
:drag="listType === 'text' ? false : drag"
|
|
18
|
+
:http-request="handleHttpUpload"
|
|
19
|
+
:before-upload="beforeUpload"
|
|
20
|
+
:on-exceed="handleExceed"
|
|
21
|
+
:on-success="uploadSuccess"
|
|
22
|
+
:on-error="uploadError"
|
|
23
|
+
:accept="fileType.join(',')"
|
|
24
|
+
>
|
|
25
|
+
<template #trigger>
|
|
26
|
+
<div style="color: var(--el-text-color-secondary)">
|
|
27
|
+
<slot name="empty">
|
|
28
|
+
<div v-if="listType === 'text'">
|
|
29
|
+
<el-button :disabled="_fileList.length >= limit" type="primary">
|
|
30
|
+
{{ emptyText }}
|
|
31
|
+
</el-button>
|
|
32
|
+
</div>
|
|
33
|
+
<div v-else class="upload-empty">
|
|
34
|
+
<el-icon><Plus /></el-icon>
|
|
35
|
+
<span>{{ emptyText }}</span>
|
|
36
|
+
</div>
|
|
37
|
+
</slot>
|
|
38
|
+
</div>
|
|
39
|
+
</template>
|
|
40
|
+
<template #file="{ file }">
|
|
41
|
+
<div v-if="listType === 'text'" class="el-upload-list__item flx-between-center" @click.stop>
|
|
42
|
+
<div class="el-upload-list__item-name sle flx-left-center" @click="handlePictureCardPreview(file as UploadUserFileTypes)">
|
|
43
|
+
<el-icon><Document /></el-icon>
|
|
44
|
+
<div class="sle fileName">{{ file.name }}</div>
|
|
45
|
+
</div>
|
|
46
|
+
<div class="result">
|
|
47
|
+
<span class="success">
|
|
48
|
+
<el-icon color="#67c23a"><CircleCheck /></el-icon>
|
|
49
|
+
</span>
|
|
50
|
+
<span v-if="!self_disabled" class="delete" @click="handleRemove(file as UploadUserFileTypes)">
|
|
51
|
+
<el-icon color="#A1A1A3"><Close /></el-icon>
|
|
52
|
+
</span>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
<div v-else class="img-box">
|
|
56
|
+
<img v-if="isFullUrl(file?.url)" :src="file?.isPdf ? pdfCover : file.url" class="upload-image" />
|
|
57
|
+
<div v-else class="upload-image img-box">
|
|
58
|
+
<img :src="file?.isPdf ? pdfCover : file.url" class="upload-image" />
|
|
59
|
+
</div>
|
|
60
|
+
<div v-if="!file?.halfUrl" class="jzt-upload-loading">
|
|
61
|
+
<el-icon class="loading-icon"><Loading /></el-icon>
|
|
62
|
+
</div>
|
|
63
|
+
<div v-else class="upload-handle" @click.stop>
|
|
64
|
+
<div class="handle-icon" @click="handlePictureCardPreview(file as UploadUserFileTypes)">
|
|
65
|
+
<el-icon><ZoomIn /></el-icon>
|
|
66
|
+
<span>查看</span>
|
|
67
|
+
</div>
|
|
68
|
+
<div v-if="!self_disabled" class="handle-icon" @click="handleRemove(file as UploadUserFileTypes)">
|
|
69
|
+
<el-icon><Delete /></el-icon>
|
|
70
|
+
<span>删除</span>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
</template>
|
|
75
|
+
<template #tip>
|
|
76
|
+
<div class="el-upload__tip">
|
|
77
|
+
<slot name="tip"></slot>
|
|
78
|
+
</div>
|
|
79
|
+
</template>
|
|
80
|
+
</el-upload>
|
|
81
|
+
<JztEmpty v-else-if="isShow" emptyText="暂无图片" />
|
|
82
|
+
<JztFilePreview ref="JztFilePreviewRef" title="预览" :show-list="false" />
|
|
83
|
+
<el-image-viewer v-if="imgViewVisible" :url-list="[viewImageUrl]" @close="imgViewVisible = false" />
|
|
84
|
+
</div>
|
|
85
|
+
</template>
|
|
86
|
+
|
|
87
|
+
<script setup lang="ts" name="UploadImgs">
|
|
88
|
+
import { ref, computed, inject, watch } from 'vue'
|
|
89
|
+
import { pdfCover } from '@jzt-spd/styles/assets'
|
|
90
|
+
import { isFullUrl } from '@jzt-spd/utils'
|
|
91
|
+
import { Plus, Loading } from "@element-plus/icons-vue";
|
|
92
|
+
import JztEmpty from "../JztEmpty/index.vue";
|
|
93
|
+
import JztFilePreview from "../JztFilePreview/index.vue";
|
|
94
|
+
import type {
|
|
95
|
+
UploadProps,
|
|
96
|
+
UploadFile,
|
|
97
|
+
UploadUserFile,
|
|
98
|
+
UploadRequestOptions,
|
|
99
|
+
} from "element-plus";
|
|
100
|
+
import {
|
|
101
|
+
ElNotification,
|
|
102
|
+
formContextKey,
|
|
103
|
+
formItemContextKey,
|
|
104
|
+
} from "element-plus";
|
|
105
|
+
import { useUploadFileHook } from "../hooks/useUploadFileHook";
|
|
106
|
+
const {
|
|
107
|
+
useBeforeUpload,
|
|
108
|
+
useRemoveFilterList,
|
|
109
|
+
useUploadSuccess,
|
|
110
|
+
useHttpUploadHook,
|
|
111
|
+
getFileShowList,
|
|
112
|
+
getFullUrl,
|
|
113
|
+
} = useUploadFileHook();
|
|
114
|
+
|
|
115
|
+
interface UploadUserFileTypes extends UploadUserFile {
|
|
116
|
+
halfUrl: string;
|
|
117
|
+
isPdf?: boolean;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
interface UploadFileProps {
|
|
121
|
+
fileList: string[];
|
|
122
|
+
api?: (params: any) => Promise<any>; // 上传图片的 api 方法,一般项目上传都是同一个 api 方法,在组件里直接引入即可 ==> 非必传
|
|
123
|
+
drag?: boolean; // 是否支持拖拽上传 ==> 非必传(默认为 true)
|
|
124
|
+
disabled?: boolean; // 是否禁用上传组件 ==> 非必传(默认为 false)
|
|
125
|
+
limit?: number; // 最大图片上传数 ==> 非必传(默认为 5张)
|
|
126
|
+
fileSize?: number; // 图片大小限制 ==> 非必传(默认为 5M)
|
|
127
|
+
fileType?: File.FilePostfixType[]; // 图片类型限制 ==> 非必传(默认为 [".jpeg", ".png", ".jpeg", ".jpg", ".pdf"])
|
|
128
|
+
height?: string; // 组件高度 ==> 非必传(默认为 150px)
|
|
129
|
+
width?: string; // 组件宽度 ==> 非必传(默认为 150px)
|
|
130
|
+
borderRadius?: string; // 组件边框圆角 ==> 非必传(默认为 8px)
|
|
131
|
+
listType?: "text" | "picture" | "picture-card";
|
|
132
|
+
emptyText?: string;
|
|
133
|
+
fileName?: string;
|
|
134
|
+
isShow?: boolean; // 是否是查看模式,没有数据时会展示空图
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const props = withDefaults(defineProps<UploadFileProps>(), {
|
|
138
|
+
fileList: () => [],
|
|
139
|
+
drag: false,
|
|
140
|
+
disabled: false,
|
|
141
|
+
limit: 5,
|
|
142
|
+
fileSize: 5,
|
|
143
|
+
fileType: () => [".jpeg", ".png", ".jpeg", ".jpg", ".pdf"],
|
|
144
|
+
height: "120px",
|
|
145
|
+
width: "120px",
|
|
146
|
+
borderRadius: "8px",
|
|
147
|
+
listType: "text",
|
|
148
|
+
emptyText: "文件上传",
|
|
149
|
+
fileName: "file",
|
|
150
|
+
isShow: false,
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
// 获取 el-form 组件上下文
|
|
154
|
+
const formContext = inject(formContextKey, void 0);
|
|
155
|
+
// 获取 el-form-item 组件上下文
|
|
156
|
+
const formItemContext = inject(formItemContextKey, void 0);
|
|
157
|
+
// 判断是否禁用上传和删除
|
|
158
|
+
const self_disabled = computed(() => {
|
|
159
|
+
return props.disabled || formContext?.disabled;
|
|
160
|
+
});
|
|
161
|
+
interface UploadUserFileTypes extends UploadUserFile {
|
|
162
|
+
halfUrl: string;
|
|
163
|
+
}
|
|
164
|
+
const _fileList = ref<UploadUserFileTypes[]>([]);
|
|
165
|
+
|
|
166
|
+
// 监听 props.fileList 列表默认值改变
|
|
167
|
+
watch(
|
|
168
|
+
() => props.fileList,
|
|
169
|
+
(fileList: any[]) => {
|
|
170
|
+
const newList = getFileShowList(fileList)
|
|
171
|
+
// 用 halfUrl 匹配已有文件,复用原对象引用,避免所有图片重新加载
|
|
172
|
+
const existingMap = new Map(_fileList.value.filter(f => f.halfUrl).map(f => [f.halfUrl, f]))
|
|
173
|
+
_fileList.value = newList.map(item => {
|
|
174
|
+
const existing = existingMap.get(item.halfUrl)
|
|
175
|
+
if (existing) return existing
|
|
176
|
+
return item
|
|
177
|
+
})
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
immediate: true,
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* @description 文件上传之前判断
|
|
186
|
+
* @param rawFile 选择的文件
|
|
187
|
+
* */
|
|
188
|
+
const beforeUpload: UploadProps["beforeUpload"] = (rawFile) => {
|
|
189
|
+
return useBeforeUpload({
|
|
190
|
+
rawFile,
|
|
191
|
+
fileSize: props.fileSize,
|
|
192
|
+
fileType: props.fileType,
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* @description 图片上传
|
|
198
|
+
* @param options upload 所有配置项
|
|
199
|
+
* */
|
|
200
|
+
const handleHttpUpload = async (options: UploadRequestOptions) => {
|
|
201
|
+
// PDF 的 blob URL 无法在 img 中显示,提前替换为封面图
|
|
202
|
+
const file = _fileList.value.find(f => f.uid === options.file.uid)
|
|
203
|
+
if (file && /\.(pdf)$/i.test(options.file.name)) {
|
|
204
|
+
file.url = pdfCover
|
|
205
|
+
file.isPdf = true
|
|
206
|
+
}
|
|
207
|
+
useHttpUploadHook({
|
|
208
|
+
fileName: props.fileName,
|
|
209
|
+
options,
|
|
210
|
+
api: props.api,
|
|
211
|
+
});
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* @description 图片上传成功
|
|
215
|
+
* @param response 上传响应结果
|
|
216
|
+
* @param uploadFile 上传的文件
|
|
217
|
+
* */
|
|
218
|
+
const emit = defineEmits<{
|
|
219
|
+
"update:fileList": [value: UploadUserFile[] | string[]];
|
|
220
|
+
}>();
|
|
221
|
+
|
|
222
|
+
// emit fileList 同步fileList数据
|
|
223
|
+
const setEmit = (halfUrls: string[]) => {
|
|
224
|
+
emit("update:fileList", halfUrls);
|
|
225
|
+
};
|
|
226
|
+
// 上传成功!
|
|
227
|
+
const uploadSuccess = async (
|
|
228
|
+
response: { fileUrl: string },
|
|
229
|
+
uploadFile: UploadUserFile | UploadUserFileTypes
|
|
230
|
+
) => {
|
|
231
|
+
useUploadSuccess({
|
|
232
|
+
response,
|
|
233
|
+
uploadFile: uploadFile as UploadUserFileTypes,
|
|
234
|
+
_fileList: _fileList.value,
|
|
235
|
+
callback: (halfUrls) => {
|
|
236
|
+
setEmit(halfUrls);
|
|
237
|
+
},
|
|
238
|
+
formItemContext,
|
|
239
|
+
formContext,
|
|
240
|
+
});
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* @description 删除图片
|
|
245
|
+
* @param file 删除的文件
|
|
246
|
+
* */
|
|
247
|
+
const handleRemove = (file: UploadFile | UploadUserFileTypes) => {
|
|
248
|
+
const halfUrls = useRemoveFilterList({
|
|
249
|
+
_fileList: _fileList.value,
|
|
250
|
+
file: file as UploadUserFileTypes,
|
|
251
|
+
});
|
|
252
|
+
setEmit(halfUrls);
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* @description 图片上传错误
|
|
257
|
+
* */
|
|
258
|
+
const uploadError = () => {
|
|
259
|
+
ElNotification({
|
|
260
|
+
title: "温馨提示",
|
|
261
|
+
message: "文件上传失败,请您重新上传!",
|
|
262
|
+
type: "error",
|
|
263
|
+
});
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* @description 文件数超出
|
|
268
|
+
* */
|
|
269
|
+
const handleExceed = () => {
|
|
270
|
+
ElNotification({
|
|
271
|
+
title: "温馨提示",
|
|
272
|
+
message: `当前最多只能上传 ${props.limit} 张图片,请移除后上传!`,
|
|
273
|
+
type: "warning",
|
|
274
|
+
});
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* @description 图片预览
|
|
279
|
+
* @param file 预览的文件
|
|
280
|
+
* */
|
|
281
|
+
const viewImageUrl = ref("");
|
|
282
|
+
const imgViewVisible = ref(false);
|
|
283
|
+
const JztFilePreviewRef = ref();
|
|
284
|
+
|
|
285
|
+
const handlePictureCardPreview = (file: UploadUserFileTypes) => {
|
|
286
|
+
if (file && file.isPdf) {
|
|
287
|
+
// PDF预览功能
|
|
288
|
+
const url = getFullUrl((file as UploadUserFileTypes).halfUrl);
|
|
289
|
+
JztFilePreviewRef.value && JztFilePreviewRef.value.openDialog([url]);
|
|
290
|
+
} else {
|
|
291
|
+
viewImageUrl.value = file.url!;
|
|
292
|
+
imgViewVisible.value = true;
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
</script>
|
|
296
|
+
|
|
297
|
+
<style scoped lang="scss">
|
|
298
|
+
@use "./multiple";
|
|
299
|
+
|
|
300
|
+
//图片上传
|
|
301
|
+
.img_upload_box {
|
|
302
|
+
:deep(.upload) {
|
|
303
|
+
.el-upload-dragger {
|
|
304
|
+
border-radius: v-bind(borderRadius);
|
|
305
|
+
}
|
|
306
|
+
.el-upload-list__item,
|
|
307
|
+
.el-upload--picture-card {
|
|
308
|
+
width: v-bind(width) !important;
|
|
309
|
+
height: v-bind(height) !important;
|
|
310
|
+
border-radius: v-bind(borderRadius);
|
|
311
|
+
.img-box {
|
|
312
|
+
width: 100%;
|
|
313
|
+
height: 100%;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
</style>
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
// 公共样式
|
|
2
|
+
.no-upload {
|
|
3
|
+
:deep(.el-upload) {
|
|
4
|
+
display: none;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
.upload {
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
}
|
|
10
|
+
:deep(.el-list-leave-to) {
|
|
11
|
+
display: none !important;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.is-error {
|
|
15
|
+
.upload {
|
|
16
|
+
:deep(.el-upload--picture-card),
|
|
17
|
+
:deep(.el-upload-dragger) {
|
|
18
|
+
border: 1px dashed var(--el-color-danger) !important;
|
|
19
|
+
&:hover {
|
|
20
|
+
border-color: var(--el-color-primary) !important;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
:deep(.disabled) {
|
|
27
|
+
.el-upload {
|
|
28
|
+
background: var(--el-disabled-bg-color) !important;
|
|
29
|
+
}
|
|
30
|
+
.el-upload--picture-card,
|
|
31
|
+
.el-upload-dragger {
|
|
32
|
+
cursor: not-allowed;
|
|
33
|
+
background: var(--el-disabled-bg-color) !important;
|
|
34
|
+
border: 1px dashed var(--el-border-color-darker);
|
|
35
|
+
&:hover {
|
|
36
|
+
border-color: var(--el-border-color-darker) !important;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
.el-upload__tip {
|
|
41
|
+
display: block;
|
|
42
|
+
line-height: 15px;
|
|
43
|
+
text-align: left;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.upload-empty {
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-direction: column;
|
|
49
|
+
align-items: center;
|
|
50
|
+
font-size: 12px;
|
|
51
|
+
line-height: 30px;
|
|
52
|
+
color: var(--el-color-info);
|
|
53
|
+
.el-icon {
|
|
54
|
+
font-size: 28px;
|
|
55
|
+
color: var(--el-text-color-secondary);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//文件上传
|
|
59
|
+
.file_upload_box {
|
|
60
|
+
.upload-btn {
|
|
61
|
+
display: flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
justify-content: flex-start;
|
|
64
|
+
.el-button {
|
|
65
|
+
margin-right: 10px;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
:deep(.el-upload) {
|
|
69
|
+
display: flex;
|
|
70
|
+
justify-content: flex-start;
|
|
71
|
+
align-items: center;
|
|
72
|
+
width: 100% !important;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
//图片上传
|
|
76
|
+
.img_upload_box {
|
|
77
|
+
.no-border {
|
|
78
|
+
:deep(.el-upload) {
|
|
79
|
+
border: none !important;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
:deep(.upload) {
|
|
83
|
+
.el-upload {
|
|
84
|
+
position: relative;
|
|
85
|
+
display: flex;
|
|
86
|
+
align-items: center;
|
|
87
|
+
justify-content: center;
|
|
88
|
+
// width: v-bind(width);
|
|
89
|
+
// height: v-bind(height);
|
|
90
|
+
overflow: hidden;
|
|
91
|
+
border: 1px dashed var(--el-border-color-darker);
|
|
92
|
+
// border-radius: v-bind(borderRadius);
|
|
93
|
+
transition: var(--el-transition-duration-fast);
|
|
94
|
+
background-color: #fff;
|
|
95
|
+
&:hover {
|
|
96
|
+
border-color: var(--el-color-primary);
|
|
97
|
+
.upload-handle {
|
|
98
|
+
opacity: 1;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
.el-upload-dragger {
|
|
102
|
+
display: flex;
|
|
103
|
+
align-items: center;
|
|
104
|
+
justify-content: center;
|
|
105
|
+
// width: 100%;
|
|
106
|
+
// height: 100%;
|
|
107
|
+
|
|
108
|
+
padding: 0;
|
|
109
|
+
overflow: hidden;
|
|
110
|
+
// background-color: transparent;
|
|
111
|
+
border: 1px dashed var(--el-border-color-darker);
|
|
112
|
+
border-radius: v-bind(borderRadius);
|
|
113
|
+
&:hover {
|
|
114
|
+
border: 1px dashed var(--el-color-primary);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
.el-upload-dragger.is-dragover {
|
|
118
|
+
background-color: var(--el-color-primary-light-9);
|
|
119
|
+
border: 2px dashed var(--el-color-primary) !important;
|
|
120
|
+
}
|
|
121
|
+
.upload-image {
|
|
122
|
+
width: 100%;
|
|
123
|
+
height: 100%;
|
|
124
|
+
// object-fit: contain;
|
|
125
|
+
object-fit: cover;
|
|
126
|
+
}
|
|
127
|
+
.upload-empty {
|
|
128
|
+
position: relative;
|
|
129
|
+
display: flex;
|
|
130
|
+
flex-direction: column;
|
|
131
|
+
align-items: center;
|
|
132
|
+
justify-content: center;
|
|
133
|
+
font-size: 12px;
|
|
134
|
+
line-height: 30px;
|
|
135
|
+
color: var(--el-color-info);
|
|
136
|
+
.el-icon {
|
|
137
|
+
font-size: 28px;
|
|
138
|
+
color: var(--el-text-color-secondary);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
.upload-handle {
|
|
142
|
+
position: absolute;
|
|
143
|
+
top: 0;
|
|
144
|
+
right: 0;
|
|
145
|
+
box-sizing: border-box;
|
|
146
|
+
display: flex;
|
|
147
|
+
align-items: center;
|
|
148
|
+
justify-content: center;
|
|
149
|
+
width: 100%;
|
|
150
|
+
height: 100%;
|
|
151
|
+
cursor: pointer;
|
|
152
|
+
background: rgb(0 0 0 / 60%);
|
|
153
|
+
opacity: 0;
|
|
154
|
+
transition: var(--el-transition-duration-fast);
|
|
155
|
+
.handle-icon {
|
|
156
|
+
display: flex;
|
|
157
|
+
flex-direction: column;
|
|
158
|
+
align-items: center;
|
|
159
|
+
justify-content: center;
|
|
160
|
+
padding: 0 6%;
|
|
161
|
+
color: aliceblue;
|
|
162
|
+
.el-icon {
|
|
163
|
+
margin-bottom: 40%;
|
|
164
|
+
font-size: 130%;
|
|
165
|
+
line-height: 130%;
|
|
166
|
+
}
|
|
167
|
+
span {
|
|
168
|
+
font-size: 85%;
|
|
169
|
+
line-height: 85%;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
:deep(.el-upload-list--text) {
|
|
177
|
+
max-width: 500px;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// 文件列列表显示样式
|
|
181
|
+
.el-upload-list__item {
|
|
182
|
+
width: 100%;
|
|
183
|
+
border-radius: 4px;
|
|
184
|
+
box-sizing: border-box;
|
|
185
|
+
color: var(--el-text-color-regular);
|
|
186
|
+
font-size: 14px;
|
|
187
|
+
margin-bottom: 5px;
|
|
188
|
+
position: relative;
|
|
189
|
+
transition: all 0.5s cubic-bezier(0.55, 0, 0.1, 1);
|
|
190
|
+
|
|
191
|
+
&:hover {
|
|
192
|
+
background-color: var(--el-fill-color-light);
|
|
193
|
+
.result .delete {
|
|
194
|
+
display: block !important;
|
|
195
|
+
}
|
|
196
|
+
.result .success {
|
|
197
|
+
display: none !important;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
.result {
|
|
201
|
+
padding: 0 10px;
|
|
202
|
+
.success {
|
|
203
|
+
display: inline-block !important;
|
|
204
|
+
}
|
|
205
|
+
.delete {
|
|
206
|
+
display: none !important;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.el-upload-list__item-name {
|
|
211
|
+
color: var(--el-text-color-regular);
|
|
212
|
+
display: inline-flex;
|
|
213
|
+
font-size: var(--el-font-size-base);
|
|
214
|
+
padding: 0 4px;
|
|
215
|
+
text-align: center;
|
|
216
|
+
transition: color var(--el-transition-duration);
|
|
217
|
+
overflow: hidden;
|
|
218
|
+
&:hover {
|
|
219
|
+
color: var(--el-color-primary);
|
|
220
|
+
cursor: pointer;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
.fileName {
|
|
224
|
+
flex: 1;
|
|
225
|
+
}
|
|
226
|
+
}
|