@jari-ace/element-plus-component 0.2.2 → 0.3.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/README.md +1 -1
- package/dist/components/autoComplete/JaAutoComplete.vue.d.ts +18 -18
- package/dist/components/button/JaButton.vue.d.ts +24 -24
- package/dist/components/customGroupTree/src/customGroupTree.vue.d.ts +1 -1
- package/dist/components/departmentPicker/src/DepartmentPicker.vue.d.ts +2 -2
- package/dist/components/departmentTree/src/departmentTree.vue.d.ts +1 -1
- package/dist/components/dropdownButton/JaDropdownButton.vue.d.ts +55 -55
- package/dist/components/enumList/EnumListInput.vue.d.ts +2 -2
- package/dist/components/enumPicker/src/EnumPicker.vue.d.ts +1 -1
- package/dist/components/form/JaForm.vue.d.ts +1 -1
- package/dist/components/formItem/JaFormItem.vue.d.ts +12 -12
- package/dist/components/input/JaInput.vue.d.ts +18 -18
- package/dist/components/inputI18n/I18nBundleEditor.vue.d.ts +1 -1
- package/dist/components/inputI18n/InputI18n.vue.d.ts +2 -2
- package/dist/components/inputI18n/JaInputI18n.vue.d.ts +70 -70
- package/dist/components/inputNumber/JaInputNumber.vue.d.ts +12 -12
- package/dist/components/mapItemList/MapItemListInput.vue.d.ts +2 -2
- package/dist/components/numberList/NumberListInput.vue.d.ts +2 -2
- package/dist/components/rolePicker/RoleEditor.vue.d.ts +1 -1
- package/dist/components/rolePicker/baseRolePicker.vue.d.ts +1 -1
- package/dist/components/rolePicker/baseRolePicker.vue.d.ts.map +1 -1
- package/dist/components/rolePicker/baseRolePicker.vue.js +4 -2
- package/dist/components/rolePicker/baseRolePicker.vue.js.map +1 -1
- package/dist/components/scrollbar/Scrollbar.vue.d.ts +8 -8
- package/dist/components/select/JaSelect.vue.d.ts +70 -70
- package/dist/components/stringList/StringListInput.vue.d.ts +2 -2
- package/dist/components/tip/index.d.ts +6 -6
- package/dist/components/tip/src/AceTip.vue.d.ts +1 -1
- package/dist/components/upload/index.d.ts +23 -4
- package/dist/components/upload/index.d.ts.map +1 -1
- package/dist/components/upload/index.js +1 -3
- package/dist/components/upload/index.js.map +1 -1
- package/dist/components/upload/pdf-viewer/PdfViewerModal.vue.d.ts +27 -0
- package/dist/components/upload/pdf-viewer/PdfViewerModal.vue.d.ts.map +1 -0
- package/dist/components/upload/pdf-viewer/PdfViewerModal.vue.js +94 -0
- package/dist/components/upload/pdf-viewer/PdfViewerModal.vue.js.map +1 -0
- package/dist/components/upload/uploader-locale-zh-cn.d.ts +223 -0
- package/dist/components/upload/uploader-locale-zh-cn.d.ts.map +1 -0
- package/dist/components/upload/uploader-locale-zh-cn.js +224 -0
- package/dist/components/upload/uploader-locale-zh-cn.js.map +1 -0
- package/dist/components/upload/uploader.vue.d.ts +42 -0
- package/dist/components/upload/uploader.vue.d.ts.map +1 -0
- package/dist/components/upload/uploader.vue.js +713 -0
- package/dist/components/upload/uploader.vue.js.map +1 -0
- package/dist/components/userGroupPicker/src/UserGroupPicker.vue.d.ts +2 -2
- package/dist/components/userPicker/src/UserPicker.vue.d.ts +3 -3
- package/dist/components/userSelectDialog/src/userSelectDialog.vue.d.ts +1 -1
- package/dist/components/userTag/UserInfoTag.vue.d.ts +2 -2
- package/lib/index.css +9 -1
- package/lib/index.js +37354 -2740
- package/lib/index.umd.cjs +407 -2
- package/package.json +70 -61
- package/packages/components/autoComplete/JaAutoComplete.vue +47 -47
- package/packages/components/autoComplete/index.ts +5 -5
- package/packages/components/avatar/JaAvatar.vue +126 -126
- package/packages/components/avatar/avatarToken.ts +11 -11
- package/packages/components/avatar/defaultImg.ts +14 -14
- package/packages/components/avatar/index.ts +7 -7
- package/packages/components/button/JaButton.vue +51 -51
- package/packages/components/button/index.ts +4 -4
- package/packages/components/channelPicker/index.ts +7 -7
- package/packages/components/channelPicker/src/ChannelPicker.vue +43 -43
- package/packages/components/channelPicker/src/JaChannelPicker.vue +42 -42
- package/packages/components/checkbox/JaCheckbox.vue +73 -73
- package/packages/components/checkbox/index.ts +4 -4
- package/packages/components/checkboxGroup/JaCheckboxGroup.vue +45 -45
- package/packages/components/checkboxGroup/index.ts +4 -4
- package/packages/components/customGroupTree/index.ts +10 -10
- package/packages/components/customGroupTree/src/customGroupTree.vue +91 -91
- package/packages/components/datePicker/JaDatePicker.vue +52 -52
- package/packages/components/datePicker/index.ts +4 -4
- package/packages/components/departmentPicker/index.ts +4 -4
- package/packages/components/departmentPicker/src/DepartmentPicker.vue +107 -107
- package/packages/components/departmentPicker/src/consts.ts +2 -2
- package/packages/components/departmentTree/index.ts +10 -10
- package/packages/components/departmentTree/src/departmentTree.vue +135 -135
- package/packages/components/dropdownButton/JaDropdownButton.vue +59 -59
- package/packages/components/dropdownButton/index.ts +4 -4
- package/packages/components/enumList/EnumListInput.vue +107 -107
- package/packages/components/enumList/JaEnumList.vue +39 -39
- package/packages/components/enumList/index.ts +7 -7
- package/packages/components/enumPicker/index.ts +5 -5
- package/packages/components/enumPicker/src/EnumPicker.vue +103 -103
- package/packages/components/form/JaForm.vue +146 -146
- package/packages/components/form/index.ts +5 -5
- package/packages/components/form/types.ts +4 -4
- package/packages/components/formItem/JaFormItem.vue +87 -87
- package/packages/components/formItem/index.ts +4 -4
- package/packages/components/index.ts +34 -34
- package/packages/components/input/JaInput.vue +143 -143
- package/packages/components/input/index.ts +4 -4
- package/packages/components/inputI18n/I18nBundleEditor.vue +76 -76
- package/packages/components/inputI18n/InputI18n.vue +146 -146
- package/packages/components/inputI18n/JaInputI18n.vue +50 -50
- package/packages/components/inputI18n/index.ts +8 -8
- package/packages/components/inputNumber/JaInputNumber.vue +98 -98
- package/packages/components/inputNumber/index.ts +4 -4
- package/packages/components/mapItemList/JaMapItemList.vue +35 -35
- package/packages/components/mapItemList/MapItemListInput.vue +191 -191
- package/packages/components/mapItemList/index.ts +7 -7
- package/packages/components/numberList/JaNumberList.vue +36 -36
- package/packages/components/numberList/NumberListInput.vue +111 -111
- package/packages/components/numberList/index.ts +7 -7
- package/packages/components/properyPicker/JaPropertyPicker.vue +38 -38
- package/packages/components/properyPicker/PropertyPicker.vue +314 -314
- package/packages/components/properyPicker/index.ts +7 -7
- package/packages/components/radioGroup/JaRadioGroup.vue +50 -50
- package/packages/components/radioGroup/index.ts +4 -4
- package/packages/components/rolePicker/RoleEditor.vue +129 -129
- package/packages/components/rolePicker/RolePicker.vue +44 -44
- package/packages/components/rolePicker/RolePickerRaw.vue +56 -56
- package/packages/components/rolePicker/baseRolePicker.vue +91 -87
- package/packages/components/rolePicker/index.ts +10 -10
- package/packages/components/scrollbar/Scrollbar.vue +89 -89
- package/packages/components/scrollbar/index.ts +5 -5
- package/packages/components/scrollbar/utils.ts +17 -17
- package/packages/components/select/JaSelect.vue +48 -48
- package/packages/components/select/index.ts +4 -4
- package/packages/components/stringList/JaStringList.vue +36 -36
- package/packages/components/stringList/StringListInput.vue +96 -96
- package/packages/components/stringList/index.ts +7 -7
- package/packages/components/switch/JaSwitch.vue +50 -50
- package/packages/components/switch/index.ts +4 -4
- package/packages/components/timePicker/JaTimePicker.vue +52 -52
- package/packages/components/timePicker/index.ts +5 -5
- package/packages/components/tip/index.ts +4 -4
- package/packages/components/tip/src/AceTip.vue +43 -43
- package/packages/components/upload/index.ts +4 -6
- package/packages/components/upload/pdf-viewer/PdfViewerModal.vue +32 -0
- package/packages/components/upload/uploader-locale-zh-cn.ts +223 -0
- package/packages/components/upload/uploader.vue +513 -0
- package/packages/components/userGroupPicker/index.ts +4 -4
- package/packages/components/userGroupPicker/src/UserGroupPicker.vue +94 -94
- package/packages/components/userGroupTree/index.ts +10 -10
- package/packages/components/userGroupTree/src/userGroupTree.vue +149 -149
- package/packages/components/userPicker/index.ts +10 -10
- package/packages/components/userPicker/src/CustomGroupManager.vue +189 -189
- package/packages/components/userPicker/src/JaUserList.vue +317 -317
- package/packages/components/userPicker/src/JaUserPicker.vue +40 -40
- package/packages/components/userPicker/src/UserPicker.vue +472 -472
- package/packages/components/userSelectDialog/index.ts +6 -6
- package/packages/components/userSelectDialog/src/userSelectDialog.vue +462 -462
- package/packages/components/userTag/UserInfoTag.vue +397 -397
- package/packages/components/userTag/index.ts +6 -6
- package/packages/components/userTag/sharedAxios.ts +8 -8
- package/packages/directives/auth/index.ts +41 -41
- package/packages/directives/autofocus/index.ts +29 -29
- package/packages/directives/index.ts +10 -10
- package/packages/directives/shortcut/index.ts +192 -192
- package/packages/hooks/useAppInstances.ts +34 -34
- package/packages/hooks/useBackendValidations.ts +81 -81
- package/packages/hooks/useBridage.ts +157 -157
- package/packages/hooks/useClassificationLevels.ts +62 -62
- package/packages/hooks/useDateTimeShortCuts.ts +65 -65
- package/packages/hooks/useRealms.ts +28 -28
- package/packages/hooks/useTreeData.ts +45 -45
- package/packages/hooks/useUserRefQuery.ts +232 -232
- package/packages/index.ts +24 -24
- package/packages/list.json +7 -7
- package/packages/types/custom.d.ts +13 -13
- package/packages/types/window.d.ts +16 -16
- package/packages/utils/install.ts +43 -43
- package/packages/utils/objectUtils.ts +31 -31
- package/theme-style/fonts/iconfont.json +5196 -5196
- package/theme-style/index.scss +10 -10
- package/theme-style/styles/element-plus-var.scss +1419 -1419
- package/theme-style/styles/iconfont.css +2979 -2979
- package/theme-style/styles/theme-var.scss +72 -72
- package/theme-style/styles/transition.scss +122 -122
- package/packages/components/upload/src/Upload.vue +0 -25
- package/packages/components/upload/src/type.ts +0 -3
|
@@ -0,0 +1,513 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
createAxiosWithoutCache,
|
|
4
|
+
type FileInfo, Jari,
|
|
5
|
+
useFilesApi,
|
|
6
|
+
useLoginUser,
|
|
7
|
+
type ClassificationLevel, type UploadInitParams, useLoading
|
|
8
|
+
} from "@jari-ace/app-bolts";
|
|
9
|
+
import { nextTick, onMounted, onUnmounted, ref, watch } from "vue";
|
|
10
|
+
import { ArrowDown, Download, Upload } from "@element-plus/icons-vue";
|
|
11
|
+
import {
|
|
12
|
+
useSystemClassificationLevelMap,
|
|
13
|
+
useSystemClassificationLevels
|
|
14
|
+
} from "../../hooks/useClassificationLevels";
|
|
15
|
+
import Ace = Jari.Ace;
|
|
16
|
+
import { ElMessageBox } from "element-plus";
|
|
17
|
+
import "@uppy/core/css/style.min.css";
|
|
18
|
+
import "@uppy/dashboard/css/style.min.css";
|
|
19
|
+
import "@uppy/audio/css/style.min.css";
|
|
20
|
+
import "@uppy/screen-capture/css/style.min.css";
|
|
21
|
+
import "@uppy/webcam/css/style.min.css";
|
|
22
|
+
import "@uppy/image-editor/css/style.min.css";
|
|
23
|
+
import Uppy from "@uppy/core";
|
|
24
|
+
import Tus from "@uppy/tus";
|
|
25
|
+
import Webcam from "@uppy/webcam";
|
|
26
|
+
import ScreenCapture from "@uppy/screen-capture";
|
|
27
|
+
import Audio from "@uppy/audio";
|
|
28
|
+
import zhCN from "./uploader-locale-zh-cn";
|
|
29
|
+
import Dashboard from "@uppy/dashboard";
|
|
30
|
+
import ImageEditor from "@uppy/image-editor";
|
|
31
|
+
import prettyBytes from "pretty-bytes";
|
|
32
|
+
import PdfViewerModal from "./pdf-viewer/PdfViewerModal.vue";
|
|
33
|
+
|
|
34
|
+
import {
|
|
35
|
+
ElTable,
|
|
36
|
+
ElTableColumn,
|
|
37
|
+
ElButton,
|
|
38
|
+
ElDropdown,
|
|
39
|
+
ElDropdownItem,
|
|
40
|
+
ElDropdownMenu,
|
|
41
|
+
ElIcon,
|
|
42
|
+
ElTag
|
|
43
|
+
} from "element-plus";
|
|
44
|
+
|
|
45
|
+
const props = defineProps<{
|
|
46
|
+
/**
|
|
47
|
+
* 应用名
|
|
48
|
+
*/
|
|
49
|
+
serviceName: string,
|
|
50
|
+
/**
|
|
51
|
+
* 附件配置key
|
|
52
|
+
*/
|
|
53
|
+
configKey: string,
|
|
54
|
+
/**
|
|
55
|
+
* 附件令牌
|
|
56
|
+
*/
|
|
57
|
+
attachToken?: string,
|
|
58
|
+
/**
|
|
59
|
+
* 数据密集
|
|
60
|
+
*/
|
|
61
|
+
classificationLevel?: number,
|
|
62
|
+
/**
|
|
63
|
+
* 文件列表高度
|
|
64
|
+
*/
|
|
65
|
+
height?: string | number,
|
|
66
|
+
/**
|
|
67
|
+
* 文件列表最大高度
|
|
68
|
+
*/
|
|
69
|
+
maxHeight?: string | number
|
|
70
|
+
}>();
|
|
71
|
+
const attachId = defineModel<string>({
|
|
72
|
+
required: false
|
|
73
|
+
});
|
|
74
|
+
const axios = createAxiosWithoutCache();
|
|
75
|
+
const loading = useLoading(axios);
|
|
76
|
+
const api = useFilesApi(axios);
|
|
77
|
+
const files = ref<FileInfo[]>([]);
|
|
78
|
+
const classificationLevels = ref<ClassificationLevel[]>([]);
|
|
79
|
+
const allowedClassificationLevels = ref<ClassificationLevel[]>([]);
|
|
80
|
+
const classificationLevelMap = ref<Map<number, string>>();
|
|
81
|
+
const user = ref<Ace.User>();
|
|
82
|
+
const selectedFileClassificationLevel = ref(50);
|
|
83
|
+
const curAttachToken = ref<string>();
|
|
84
|
+
const uploadInitParams = ref<UploadInitParams>();
|
|
85
|
+
const isNewForm = ref(false);
|
|
86
|
+
const uploadingProgress = ref(100);
|
|
87
|
+
const pdfViewerVisible = ref(false);
|
|
88
|
+
const pdfSrc = ref("");
|
|
89
|
+
const previewableFileExts = [".doc", ".docx", ".xls", ".xlsx", ".wps", ".et",
|
|
90
|
+
".csv", ".txt", ".rtf", ".odt", "ods", ".mht", ".ppt", ".pptx", ".odp", ".pdf", "xps", "."];
|
|
91
|
+
let uppy: Uppy | undefined;
|
|
92
|
+
curAttachToken.value = props.attachToken;
|
|
93
|
+
|
|
94
|
+
onMounted(async () => {
|
|
95
|
+
user.value = useLoginUser();
|
|
96
|
+
const cl = Math.max(props.classificationLevel ?? 50, user.value?.classifiedLevel ?? 50);
|
|
97
|
+
classificationLevels.value = await useSystemClassificationLevels();
|
|
98
|
+
classificationLevelMap.value = await useSystemClassificationLevelMap();
|
|
99
|
+
allowedClassificationLevels.value = classificationLevels.value.filter(l => l.value >= cl);
|
|
100
|
+
if (props.attachToken) {
|
|
101
|
+
await initLoad();
|
|
102
|
+
} else {
|
|
103
|
+
await initNew();
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
onUnmounted(() => {
|
|
108
|
+
if (uppy) uppy.destroy();
|
|
109
|
+
uppy = undefined;
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
async function loadFileInfos() {
|
|
113
|
+
if (!curAttachToken.value) {
|
|
114
|
+
files.value = [];
|
|
115
|
+
}
|
|
116
|
+
files.value = await api.getFileList(curAttachToken.value!);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function createUppyInstance() {
|
|
120
|
+
if (uppy) {
|
|
121
|
+
uppy.destroy();
|
|
122
|
+
}
|
|
123
|
+
const cfg = uploadInitParams.value!.fileConfig;
|
|
124
|
+
uppy = new Uppy({
|
|
125
|
+
autoProceed: true,
|
|
126
|
+
locale: zhCN
|
|
127
|
+
}).on("progress", progress => {
|
|
128
|
+
if (progress == 100) {
|
|
129
|
+
loadFileInfos();
|
|
130
|
+
}
|
|
131
|
+
uploadingProgress.value = progress;
|
|
132
|
+
});
|
|
133
|
+
uppy.use(Tus, {
|
|
134
|
+
endpoint: new URL("/ace-file-service/uploads", location.origin).toString(),
|
|
135
|
+
withCredentials: true,
|
|
136
|
+
retryDelays: undefined,
|
|
137
|
+
chunkSize: !uploadInitParams.value?.chunkSize || uploadInitParams.value?.chunkSize
|
|
138
|
+
== 0 ? Infinity : uploadInitParams.value?.chunkSize,
|
|
139
|
+
parallelUploads: 1,
|
|
140
|
+
headers: {
|
|
141
|
+
aceAttachId: attachId.value!,
|
|
142
|
+
aceNewForm: isNewForm.value ? "yes" : "no"
|
|
143
|
+
},
|
|
144
|
+
metadata: {
|
|
145
|
+
attachId: attachId.value!,
|
|
146
|
+
configKey: props.configKey,
|
|
147
|
+
appServiceName: props.serviceName,
|
|
148
|
+
classifiedLevel: selectedFileClassificationLevel.value.toString()
|
|
149
|
+
},
|
|
150
|
+
metadataForPartialUploads: {
|
|
151
|
+
attachId: attachId.value!,
|
|
152
|
+
configKey: props.configKey,
|
|
153
|
+
appServiceName: props.serviceName,
|
|
154
|
+
classifiedLevel: selectedFileClassificationLevel.value.toString()
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
if (cfg.enableWebcam) {
|
|
158
|
+
uppy.use(Webcam, {
|
|
159
|
+
// Webcam 的相关配置
|
|
160
|
+
modes: cfg.allowedWebcamModes?.map(m => {
|
|
161
|
+
switch (m) {
|
|
162
|
+
case "VIDEO_AUDIO":
|
|
163
|
+
return "video-audio";
|
|
164
|
+
case "VIDEO_ONLY":
|
|
165
|
+
return "video-only";
|
|
166
|
+
case "PICTURE":
|
|
167
|
+
return "picture";
|
|
168
|
+
}
|
|
169
|
+
}),
|
|
170
|
+
mirror: false
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
if (cfg.enableAudio) {
|
|
174
|
+
uppy.use(Audio);
|
|
175
|
+
}
|
|
176
|
+
if (cfg.enableScreenCapture) {
|
|
177
|
+
uppy.use(ScreenCapture);
|
|
178
|
+
}
|
|
179
|
+
let selectionType: "files" | "folders" | "both" | undefined;
|
|
180
|
+
if (cfg.disableFileUpload) {
|
|
181
|
+
if (cfg.disableDirUpload) {
|
|
182
|
+
selectionType = undefined;
|
|
183
|
+
} else {
|
|
184
|
+
selectionType = "folders";
|
|
185
|
+
}
|
|
186
|
+
} else {
|
|
187
|
+
if (cfg.disableDirUpload) {
|
|
188
|
+
selectionType = "files";
|
|
189
|
+
} else {
|
|
190
|
+
selectionType = "both";
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
uppy.use(Dashboard, {
|
|
194
|
+
inline: false,
|
|
195
|
+
note: cfg.uploadNote,
|
|
196
|
+
proudlyDisplayPoweredByUppy: false,
|
|
197
|
+
fileManagerSelectionType: selectionType,
|
|
198
|
+
singleFileFullScreen: false,
|
|
199
|
+
disableLocalFiles: cfg.disableFileUpload ?? false,
|
|
200
|
+
closeAfterFinish: true,
|
|
201
|
+
closeModalOnClickOutside: true
|
|
202
|
+
}).use(ImageEditor);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
async function onUploadBtnClick() {
|
|
206
|
+
const cfg = uploadInitParams.value?.fileConfig;
|
|
207
|
+
if (cfg) {
|
|
208
|
+
uppy?.setMeta({
|
|
209
|
+
attachId: attachId.value!,
|
|
210
|
+
configKey: props.configKey,
|
|
211
|
+
appServiceName: props.serviceName,
|
|
212
|
+
classifiedLevel: selectedFileClassificationLevel.value.toString()
|
|
213
|
+
});
|
|
214
|
+
const dashboard = uppy?.getPlugin("Dashboard") as any;
|
|
215
|
+
if (dashboard) {
|
|
216
|
+
dashboard.setOptions({
|
|
217
|
+
note: (
|
|
218
|
+
cfg.uploadNote ? cfg.uploadNote : ""
|
|
219
|
+
)
|
|
220
|
+
+ `(正在上传${classificationLevelMap.value?.get(selectedFileClassificationLevel.value)}文件)`
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
dashboard?.openModal();
|
|
224
|
+
} else {
|
|
225
|
+
ElMessageBox.alert("无法找到附件配置" + props.configKey, "错误");
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
function handleClassificationLevelSelCmd(level: number) {
|
|
230
|
+
selectedFileClassificationLevel.value = level;
|
|
231
|
+
uppy?.setMeta({
|
|
232
|
+
attachId: attachId.value!,
|
|
233
|
+
configKey: props.configKey,
|
|
234
|
+
appServiceName: props.serviceName,
|
|
235
|
+
classifiedLevel: selectedFileClassificationLevel.value.toString()
|
|
236
|
+
});
|
|
237
|
+
const dashboard = uppy?.getPlugin("Dashboard") as any;
|
|
238
|
+
if (dashboard) {
|
|
239
|
+
const cfg = uploadInitParams.value?.fileConfig;
|
|
240
|
+
if (cfg) {
|
|
241
|
+
dashboard.setOptions({
|
|
242
|
+
note: (
|
|
243
|
+
cfg.uploadNote ? cfg.uploadNote : ""
|
|
244
|
+
)
|
|
245
|
+
+ `(正在上传${classificationLevelMap.value?.get(selectedFileClassificationLevel.value)}文件)`
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
dashboard?.openModal();
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
async function initLoad() {
|
|
253
|
+
uploadInitParams.value = await api.initLoad(props.serviceName, props.configKey, props.attachToken!);
|
|
254
|
+
files.value = uploadInitParams.value.files;
|
|
255
|
+
attachId.value = uploadInitParams.value?.attachId;
|
|
256
|
+
curAttachToken.value = uploadInitParams.value?.attachId;
|
|
257
|
+
isNewForm.value = false;
|
|
258
|
+
await nextTick();
|
|
259
|
+
createUppyInstance();
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
async function initNew() {
|
|
263
|
+
uploadInitParams.value = await api.initNew(props.serviceName, props.configKey);
|
|
264
|
+
files.value = uploadInitParams.value.files;
|
|
265
|
+
attachId.value = uploadInitParams.value?.attachId;
|
|
266
|
+
curAttachToken.value = uploadInitParams.value?.attachToken;
|
|
267
|
+
isNewForm.value = true;
|
|
268
|
+
await nextTick();
|
|
269
|
+
createUppyInstance();
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
async function delUploadedFile(file: FileInfo) {
|
|
273
|
+
await api.deleteFile(file.token || file.id);
|
|
274
|
+
files.value = files.value.filter(f => f.id !== file.id);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
function previewFile(fileToken:string) {
|
|
278
|
+
pdfSrc.value = new URL("uploads/preview/" + fileToken, location.origin).toString()
|
|
279
|
+
pdfViewerVisible.value = true;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
function downloadFile(fileToken: string) {
|
|
283
|
+
api.downloadFile(fileToken);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
function viewUppyDashboard() {
|
|
287
|
+
const dashboard = uppy?.getPlugin("Dashboard") as any;
|
|
288
|
+
if (dashboard) {
|
|
289
|
+
dashboard.openModal();
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
function downloadAll() {
|
|
294
|
+
if (!curAttachToken.value) {
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
api.downloadZipFile(curAttachToken.value);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
function checkAllowUpload() {
|
|
301
|
+
const cfg = uploadInitParams.value?.fileConfig;
|
|
302
|
+
if (cfg) {
|
|
303
|
+
let hasRole = true;
|
|
304
|
+
if (cfg.uploadAuthCode) {
|
|
305
|
+
const login = useLoginUser();
|
|
306
|
+
if (login) {
|
|
307
|
+
hasRole = login.hasRole(cfg.uploadAuthCode);
|
|
308
|
+
}
|
|
309
|
+
return !cfg.disallowUpload && hasRole;
|
|
310
|
+
}
|
|
311
|
+
return !cfg.disallowUpload;
|
|
312
|
+
}
|
|
313
|
+
console.log('file cfg is null')
|
|
314
|
+
return false;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
function checkAllowDownload() {
|
|
318
|
+
const cfg = uploadInitParams.value?.fileConfig;
|
|
319
|
+
if (cfg) {
|
|
320
|
+
let hasRole = true;
|
|
321
|
+
if (cfg.downloadAuthCode) {
|
|
322
|
+
const login = useLoginUser();
|
|
323
|
+
if (login) {
|
|
324
|
+
hasRole = login.hasRole(cfg.downloadAuthCode);
|
|
325
|
+
}
|
|
326
|
+
return !cfg.disallowDownload && hasRole;
|
|
327
|
+
}
|
|
328
|
+
return !cfg.disallowDownload;
|
|
329
|
+
}
|
|
330
|
+
return false;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
function checkAllowDelete() {
|
|
334
|
+
const cfg = uploadInitParams.value?.fileConfig;
|
|
335
|
+
if (cfg) {
|
|
336
|
+
let hasRole = true;
|
|
337
|
+
if (cfg.deleteAuthCode) {
|
|
338
|
+
const login = useLoginUser();
|
|
339
|
+
if (login) {
|
|
340
|
+
hasRole = login.hasRole(cfg.deleteAuthCode);
|
|
341
|
+
}
|
|
342
|
+
return !cfg.disallowDelete && hasRole;
|
|
343
|
+
}
|
|
344
|
+
return !cfg.disallowDelete;
|
|
345
|
+
}
|
|
346
|
+
return false;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
function checkAllowPreview(file: FileInfo) {
|
|
350
|
+
const cfg = uploadInitParams.value?.fileConfig;
|
|
351
|
+
if (cfg) {
|
|
352
|
+
if (cfg.disablePreview) {
|
|
353
|
+
return false;
|
|
354
|
+
}
|
|
355
|
+
if (!previewableFileExts.some(ext => file.fileName.endsWith(ext))) {
|
|
356
|
+
return false;
|
|
357
|
+
}
|
|
358
|
+
return true;
|
|
359
|
+
}
|
|
360
|
+
return false;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
watch(() => props.attachToken, () => {
|
|
364
|
+
if (props.attachToken) {
|
|
365
|
+
initLoad();
|
|
366
|
+
} else {
|
|
367
|
+
initNew();
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
</script>
|
|
373
|
+
|
|
374
|
+
<template>
|
|
375
|
+
<div class="ja-uploader">
|
|
376
|
+
<div class="ja-uploader-tools">
|
|
377
|
+
<el-button plain type="success" :icon="Upload" @click="onUploadBtnClick"
|
|
378
|
+
:loading="loading" :disabled="loading" size="small"
|
|
379
|
+
v-if="allowedClassificationLevels.length <= 1 && checkAllowUpload()">
|
|
380
|
+
上传{{ uploadInitParams?.fileConfig.enableClassifiedLevel ? "(非密)" : "" }}
|
|
381
|
+
</el-button>
|
|
382
|
+
<el-button plain :icon="Download" @click="downloadAll" v-if="checkAllowDownload()"
|
|
383
|
+
:loading="loading" :disabled="loading || files?.length === 0" size="small">全部下载
|
|
384
|
+
</el-button>
|
|
385
|
+
<el-dropdown v-if="allowedClassificationLevels.length > 1 && checkAllowUpload()"
|
|
386
|
+
@command="handleClassificationLevelSelCmd" size="small">
|
|
387
|
+
<el-button type="success" size="small">
|
|
388
|
+
上传
|
|
389
|
+
<el-icon class="el-icon--right">
|
|
390
|
+
<arrow-down />
|
|
391
|
+
</el-icon>
|
|
392
|
+
</el-button>
|
|
393
|
+
<template #dropdown>
|
|
394
|
+
<el-dropdown-menu>
|
|
395
|
+
<el-dropdown-item v-for="cl in allowedClassificationLevels"
|
|
396
|
+
:key="cl.value"
|
|
397
|
+
:command="cl.value">{{ cl.label }}
|
|
398
|
+
</el-dropdown-item>
|
|
399
|
+
</el-dropdown-menu>
|
|
400
|
+
</template>
|
|
401
|
+
</el-dropdown>
|
|
402
|
+
<div class="container" @click="viewUppyDashboard"
|
|
403
|
+
v-if="uploadingProgress < 100 && uploadingProgress > 0">
|
|
404
|
+
<p>
|
|
405
|
+
<span class="loader-shimmer">正在上传,已完成{{ uploadingProgress }}%...</span>
|
|
406
|
+
</p>
|
|
407
|
+
</div>
|
|
408
|
+
</div>
|
|
409
|
+
<el-table :data="files" :show-header="true" style="width: 100%" empty-text="暂无文件"
|
|
410
|
+
:height="props.height" :max-height="props.maxHeight">
|
|
411
|
+
<el-table-column prop="fileName" />
|
|
412
|
+
<el-table-column prop="fileSize" width="100">
|
|
413
|
+
<template #default="scope">
|
|
414
|
+
{{ prettyBytes(scope.row.fileSize) }}
|
|
415
|
+
</template>
|
|
416
|
+
</el-table-column>
|
|
417
|
+
<el-table-column prop="classifiedLevel" width="60">
|
|
418
|
+
<template #default="scope">
|
|
419
|
+
<el-tag
|
|
420
|
+
:type="scope.row.classifiedLevel < 50? ( scope.row.classifiedLevel < 30 ? 'danger' : 'warning'): 'info'">
|
|
421
|
+
{{ classificationLevelMap?.get(scope.row.classifiedLevel) }}
|
|
422
|
+
</el-tag>
|
|
423
|
+
</template>
|
|
424
|
+
</el-table-column>
|
|
425
|
+
<el-table-column align="right" width="150" fixed="right">
|
|
426
|
+
<template #default="scope">
|
|
427
|
+
<el-button link type="warning" @click="previewFile(scope.row.token)"
|
|
428
|
+
v-if="checkAllowPreview(scope.row)">预览</el-button>
|
|
429
|
+
<el-button link type="primary" @click="downloadFile(scope.row.token)"
|
|
430
|
+
v-if="checkAllowDownload()">下载
|
|
431
|
+
</el-button>
|
|
432
|
+
<el-button link type="danger" @click="delUploadedFile(scope.row)"
|
|
433
|
+
v-if="checkAllowDelete()">删除
|
|
434
|
+
</el-button>
|
|
435
|
+
</template>
|
|
436
|
+
</el-table-column>
|
|
437
|
+
</el-table>
|
|
438
|
+
</div>
|
|
439
|
+
<pdf-viewer-modal :src="pdfSrc" v-model="pdfViewerVisible"></pdf-viewer-modal>
|
|
440
|
+
</template>
|
|
441
|
+
|
|
442
|
+
<style>
|
|
443
|
+
.uppy-Dashboard--modal {
|
|
444
|
+
z-index: 9999 !important;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
.uppy-Root {
|
|
448
|
+
z-index: 9999;
|
|
449
|
+
}
|
|
450
|
+
</style>
|
|
451
|
+
|
|
452
|
+
<style lang="scss" scoped>
|
|
453
|
+
|
|
454
|
+
.ja-uploader {
|
|
455
|
+
width: 100%;
|
|
456
|
+
display: flex;
|
|
457
|
+
flex-direction: column;
|
|
458
|
+
gap: 4px;
|
|
459
|
+
|
|
460
|
+
&-tools {
|
|
461
|
+
display: flex;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
.container {
|
|
466
|
+
padding: 0 0 0 8px;
|
|
467
|
+
cursor: pointer;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
.loader-shimmer {
|
|
471
|
+
display: inline-block;
|
|
472
|
+
margin-left: 8px;
|
|
473
|
+
padding: 0 12px;
|
|
474
|
+
background-color: #e0f5f0;
|
|
475
|
+
color: #888;
|
|
476
|
+
border-radius: 4px;
|
|
477
|
+
font-size: 0.9em;
|
|
478
|
+
font-weight: 500;
|
|
479
|
+
position: relative;
|
|
480
|
+
overflow: hidden; /* 隐藏闪光效果的溢出 */
|
|
481
|
+
vertical-align: middle;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
.loader-shimmer::after {
|
|
485
|
+
content: '';
|
|
486
|
+
position: absolute;
|
|
487
|
+
top: 0;
|
|
488
|
+
left: -100%; /* 从左侧外部开始 */
|
|
489
|
+
width: 50%; /* 闪光宽度 */
|
|
490
|
+
height: 100%;
|
|
491
|
+
|
|
492
|
+
/* 闪光效果:透明 -> 亮白色 -> 透明 */
|
|
493
|
+
background: linear-gradient(
|
|
494
|
+
90deg,
|
|
495
|
+
transparent,
|
|
496
|
+
rgba(255, 255, 255, 0.8),
|
|
497
|
+
transparent
|
|
498
|
+
);
|
|
499
|
+
|
|
500
|
+
/* 动画: 1.5秒, 缓入缓出, 无限循环 */
|
|
501
|
+
animation: shimmer 1.5s ease-in-out infinite;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
@keyframes shimmer {
|
|
505
|
+
0% {
|
|
506
|
+
left: -100%;
|
|
507
|
+
}
|
|
508
|
+
100% {
|
|
509
|
+
left: 150%; /* 移动到右侧外部 */
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
</style>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import UserGroupPicker from "./src/UserGroupPicker.vue";
|
|
2
|
-
import {type SFCWithInstall, withInstall} from "../../utils/install";
|
|
3
|
-
|
|
4
|
-
export const JaUserGroupPicker: SFCWithInstall<typeof UserGroupPicker> = withInstall(UserGroupPicker);
|
|
1
|
+
import UserGroupPicker from "./src/UserGroupPicker.vue";
|
|
2
|
+
import {type SFCWithInstall, withInstall} from "../../utils/install";
|
|
3
|
+
|
|
4
|
+
export const JaUserGroupPicker: SFCWithInstall<typeof UserGroupPicker> = withInstall(UserGroupPicker);
|