From 54c8831dfc105656bd2fddc96e9e702c90dfa062 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Wed, 6 Dec 2023 11:41:01 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=9C=B0=E7=90=86=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=9C=B0=E5=9B=BE=E6=96=87=E4=BB=B6=E9=AA=8C?= =?UTF-8?q?=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/dataease/map/manage/MapManage.java | 8 ++++++ .../system/parameter/map/GeometryEdit.vue | 28 +++++++++++++------ .../views/system/parameter/map/interface.ts | 1 + 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/core/core-backend/src/main/java/io/dataease/map/manage/MapManage.java b/core/core-backend/src/main/java/io/dataease/map/manage/MapManage.java index f774538ef8..b49278b60b 100644 --- a/core/core-backend/src/main/java/io/dataease/map/manage/MapManage.java +++ b/core/core-backend/src/main/java/io/dataease/map/manage/MapManage.java @@ -1,6 +1,7 @@ package io.dataease.map.manage; import cn.hutool.core.collection.ListUtil; +import cn.hutool.core.io.FileUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import io.dataease.api.map.dto.GeometryNodeCreator; import io.dataease.api.map.vo.AreaNode; @@ -110,6 +111,13 @@ public class MapManage { @CacheEvict(cacheNames = WORLD_MAP_CACHE, key = "'world_map'") @Transactional public void saveMapGeo(GeometryNodeCreator request, MultipartFile file) { + if (ObjectUtils.isEmpty(file) || file.isEmpty()) { + DEException.throwException("geometry file is require"); + } + String suffix = FileUtil.getSuffix(file.getOriginalFilename()); + if (!StringUtils.equalsIgnoreCase("json", suffix)) { + DEException.throwException("仅支持json格式文件"); + } List areas = proxy().defaultArea(); String code = getBusiGeoCode(request.getCode()); diff --git a/core/core-frontend/src/views/system/parameter/map/GeometryEdit.vue b/core/core-frontend/src/views/system/parameter/map/GeometryEdit.vue index aa3239ead8..cb653309bb 100644 --- a/core/core-frontend/src/views/system/parameter/map/GeometryEdit.vue +++ b/core/core-frontend/src/views/system/parameter/map/GeometryEdit.vue @@ -17,12 +17,12 @@ const dialogVisible = ref(false) const loadingInstance = ref(null) const geoForm = ref() const geoFile = ref() -const fileName = ref() const state = reactive({ form: reactive({ pid: null, code: null, - name: null + name: null, + fileName: null }), treeData: [] }) @@ -53,6 +53,13 @@ const rule = reactive({ message: t('common.require'), trigger: 'blur' } + ], + fileName: [ + { + required: true, + message: t('common.require'), + trigger: 'blur' + } ] }) @@ -63,7 +70,7 @@ const edit = (pid?: string) => { state.form.code = null state.form.name = null geoFile.value = null - fileName.value = null + state.form.fileName = null dialogVisible.value = true } @@ -71,7 +78,7 @@ const emits = defineEmits(['saved']) const submitForm = async (formEl: FormInstance | undefined) => { if (!formEl) return - await formEl.validate((valid, fields) => { + await formEl.validate(valid => { if (valid) { const param = { ...state.form } const formData = buildFormData(geoFile.value, param) @@ -96,7 +103,6 @@ const submitForm = async (formEl: FormInstance | undefined) => { const resetForm = (formEl: FormInstance | undefined) => { if (!formEl) return geoFile.value = null - fileName.value = null formEl.resetFields() dialogVisible.value = false } @@ -119,7 +125,7 @@ const handleError = () => { } const setFile = (options: UploadRequestOptions) => { geoFile.value = options.file - fileName.value = options.file.name + state.form.fileName = options.file.name } const uploadValidate = file => { const suffix = file.name.substring(file.name.lastIndexOf('.') + 1) @@ -185,7 +191,7 @@ defineExpose({
- + - + diff --git a/core/core-frontend/src/views/system/parameter/map/interface.ts b/core/core-frontend/src/views/system/parameter/map/interface.ts index 1600eae66d..ee49a9f0b9 100644 --- a/core/core-frontend/src/views/system/parameter/map/interface.ts +++ b/core/core-frontend/src/views/system/parameter/map/interface.ts @@ -2,4 +2,5 @@ export interface GeometryFrom { pid?: string code?: string name?: string + fileName?: string }