From 69dd20b7de2b54818ba992d1fbb703812d9a3d63 Mon Sep 17 00:00:00 2001 From: taojinlong Date: Thu, 29 Aug 2024 16:10:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AD=97=E5=BA=93=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/dataease/font/manage/FontManage.java | 8 +++++++- .../src/views/system/font/UploadDetail.vue | 5 +++-- .../src/views/visualized/data/dataset/index.vue | 13 ++++--------- .../data/datasource/form/EditorDetail.vue | 2 +- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/core/core-backend/src/main/java/io/dataease/font/manage/FontManage.java b/core/core-backend/src/main/java/io/dataease/font/manage/FontManage.java index 24a9d13db0..ec488fbfca 100644 --- a/core/core-backend/src/main/java/io/dataease/font/manage/FontManage.java +++ b/core/core-backend/src/main/java/io/dataease/font/manage/FontManage.java @@ -14,6 +14,7 @@ import jakarta.annotation.Resource; import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.ObjectUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; import org.springframework.web.multipart.MultipartFile; @@ -91,7 +92,9 @@ public class FontManage { CoreFont coreFont = coreFontMapper.selectById(id); if (coreFont != null) { coreFontMapper.deleteById(id); - FileUtils.deleteFile(path + coreFont.getFileTransName()); + if (StringUtils.isNotEmpty(coreFont.getFileTransName())) { + FileUtils.deleteFile(path + coreFont.getFileTransName()); + } } } @@ -152,6 +155,9 @@ public class FontManage { FontDto fontDto = new FontDto(); try { String filename = file.getOriginalFilename(); + if (StringUtils.isEmpty(filename) || !filename.endsWith(".ttf")) { + DEException.throwException("非法格式的文件!"); + } String suffix = filename.substring(filename.lastIndexOf(".") + 1); String filePath = path + fileNameUUID + "." + suffix; File f = new File(filePath); diff --git a/core/core-frontend/src/views/system/font/UploadDetail.vue b/core/core-frontend/src/views/system/font/UploadDetail.vue index fdc3e88529..ad60bbd4e5 100644 --- a/core/core-frontend/src/views/system/font/UploadDetail.vue +++ b/core/core-frontend/src/views/system/font/UploadDetail.vue @@ -13,12 +13,13 @@ const upload = ref() const uploadExcel = () => { const formData = new FormData() formData.append('file', state.fileList.raw) - ruleForm.fileName = state.fileList.raw.name loading.value = true return uploadFontFile(formData) .then(res => { ruleForm.size = res.data.size + ruleForm.sizeType = res.data.sizeType ruleForm.fileTransName = res.data.fileTransName + ruleForm.fileName = state.fileList.raw.name upload.value?.clearFiles() loading.value = false }) @@ -142,7 +143,7 @@ const confirm = () => { { - return allFields.reduce((pre, next) => { - if (next.id !== '-1') { - pre[next.id] = next - } - return pre - }, {}) -}) -provide('filedList', computedFiledList) +const datasetTableFiled = ref([]) +provide('filedList', datasetTableFiled) const nickName = ref('') const router = useRouter() @@ -342,6 +335,7 @@ const exportDataset = () => { showExport.value = true exportForm.value.name = nodeInfo.name exportForm.value.expressionTree = '' + console.log(computedFiledList) nextTick(() => { rowAuth.value.init({}) rowAuth.value.relationList = [] @@ -461,6 +455,7 @@ const handleClick = (tabName: TabPaneName) => { getDatasetPreview(nodeInfo.id) .then(res => { allFields = (res?.allFields as unknown as Field[]) || [] + datasetTableFiled.value = allFields columnsPreview = generateColumns((res?.data?.fields as Field[]) || []) dataPreview = (res?.data?.data as Array<{}>) || [] columns.value = columnsPreview diff --git a/core/core-frontend/src/views/visualized/data/datasource/form/EditorDetail.vue b/core/core-frontend/src/views/visualized/data/datasource/form/EditorDetail.vue index fa40d5a6c6..6058e587da 100644 --- a/core/core-frontend/src/views/visualized/data/datasource/form/EditorDetail.vue +++ b/core/core-frontend/src/views/visualized/data/datasource/form/EditorDetail.vue @@ -600,7 +600,7 @@ const apiObjRules = { const setActiveName = val => { gridData.value = val.fields activeParamsName.value = val.name - activeParamsName.value = val.serialNumber + activeParamsID.value = val.serialNumber } const paramsObjRef = ref()