adtec-core-package 2.7.0 → 2.7.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adtec-core-package",
3
- "version": "2.7.0",
3
+ "version": "2.7.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -24,7 +24,7 @@ const props = defineProps({
24
24
 
25
25
  const echartsRef = ref()
26
26
 
27
- const { setOptions, initCharts } = useEcharts(echartsRef, props.options)
27
+ const { setOptions, initCharts,resize } = useEcharts(echartsRef, props.options)
28
28
 
29
29
  watch(
30
30
  () => props.options,
@@ -44,5 +44,5 @@ watch(
44
44
  onMounted(() => {
45
45
  initCharts()
46
46
  })
47
- defineExpose({ setOptions, initCharts })
47
+ defineExpose({ setOptions, initCharts,resize })
48
48
  </script>
@@ -196,13 +196,13 @@ const mouseout = () => {
196
196
  }
197
197
  const getAccept = computed(() => {
198
198
  if (props.accept === 'images') {
199
- return '.jpg,.jpeg,.png,.gif,.bmp,.JPG,.JPEG,.PBG,.GIF,.BMP'
199
+ return '.jpg,.jpeg,.png,.gif,.bmp'
200
200
  } else if (props.accept === 'document') {
201
201
  return '.txt,.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx'
202
202
  } else if (props.accept === 'txt') {
203
203
  return '.txt'
204
204
  } else if (props.accept === 'pdf') {
205
- return '.pdf'
205
+ return '.pdf' // 正确配置,仅允许 pdf
206
206
  } else if (props.accept === 'word') {
207
207
  return '.doc,.docx'
208
208
  } else if (props.accept === 'excel') {
@@ -266,6 +266,17 @@ const beforeUpload = (file: File) => {
266
266
  ElMessage.warning('文件大小不能超过' + props.size + 'MB')
267
267
  return false
268
268
  }
269
+ const acceptSuffixes = getAccept.value
270
+ ?.split(',')
271
+ .map(suffix => suffix.slice(1).toLowerCase())
272
+ const fileSuffix = file.name.split('.').pop()?.toLowerCase()
273
+ if (acceptSuffixes && !acceptSuffixes.includes(fileSuffix)) {
274
+ ElMessage.error(`文件 ${file.name} 格式不支持,仅允许 ${getAccept.value}!`)
275
+ setTimeout(() => {
276
+ ref_upload.value?.clearFiles(["ready"])
277
+ }, 1)
278
+ return false
279
+ }
269
280
  loadingFiles.value.push(file.name)
270
281
  return true
271
282
  }