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 }