diff --git a/backend/pom.xml b/backend/pom.xml index f00f9fdbdc..252ffdd3b1 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -21,11 +21,6 @@ - - ru.yandex.qatools.ashot - ashot - 1.5.4 - com.google.guava diff --git a/backend/src/main/java/io/dataease/controller/sys/SystemParameterController.java b/backend/src/main/java/io/dataease/controller/sys/SystemParameterController.java index 6ba2f212bd..010967ba1d 100644 --- a/backend/src/main/java/io/dataease/controller/sys/SystemParameterController.java +++ b/backend/src/main/java/io/dataease/controller/sys/SystemParameterController.java @@ -5,6 +5,8 @@ import io.dataease.commons.constants.ParamConstants; import io.dataease.controller.sys.response.BasicInfo; import io.dataease.controller.sys.response.MailInfo; import io.dataease.dto.SystemParameterDTO; +import io.dataease.listener.DatasetCheckListener; +import io.dataease.listener.util.CacheUtils; import io.dataease.service.FileService; import io.dataease.service.system.EmailService; import io.dataease.service.system.SystemParameterService; @@ -16,6 +18,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import springfox.documentation.annotations.ApiIgnore; + import javax.annotation.Resource; import java.io.IOException; import java.util.HashMap; @@ -45,7 +48,7 @@ public class SystemParameterController { public BasicInfo basicInfo() { return systemParameterService.basicInfo(); } - + @GetMapping("/requestTimeOut") public Integer RequestTimeOut() { BasicInfo basicInfo = systemParameterService.basicInfo(); @@ -73,19 +76,17 @@ public class SystemParameterController { } - - @GetMapping("/base/info") - public List getBaseInfo () { + public List getBaseInfo() { return systemParameterService.getSystemParameterInfo(ParamConstants.Classify.BASE.getValue()); } @GetMapping("/ui/info") - public List getDisplayInfo () { + public List getDisplayInfo() { return systemParameterService.getSystemParameterInfo(ParamConstants.Classify.UI.getValue()); } - @GetMapping(value="/ui/image/{imageId}", produces = {MediaType.IMAGE_JPEG_VALUE, MediaType.IMAGE_PNG_VALUE}) + @GetMapping(value = "/ui/image/{imageId}", produces = {MediaType.IMAGE_JPEG_VALUE, MediaType.IMAGE_PNG_VALUE}) public ResponseEntity image(@PathVariable("imageId") String imageId) { byte[] bytes = fileService.loadFileAsBytes(imageId); final HttpHeaders headers = new HttpHeaders(); @@ -93,12 +94,19 @@ public class SystemParameterController { return new ResponseEntity<>(bytes, headers, HttpStatus.OK); } - @PostMapping(value="/save/ui", consumes = {"multipart/form-data"}) - public void saveUIInfo (@RequestPart("request") Map> systemParameterMap,@RequestPart(value = "files", required = false) List bodyFiles) throws IOException { - systemParameterService.saveUIInfo(systemParameterMap,bodyFiles); + @PostMapping(value = "/save/ui", consumes = {"multipart/form-data"}) + public void saveUIInfo(@RequestPart("request") Map> systemParameterMap, @RequestPart(value = "files", required = false) List bodyFiles) throws IOException { + systemParameterService.saveUIInfo(systemParameterMap, bodyFiles); } - - + @PostMapping(value = "/checkCustomDs") + public boolean checkCustomDs() throws IOException { + try { + Object cache = CacheUtils.get(DatasetCheckListener.CACHE_NAME, DatasetCheckListener.CACHE_KEY); + return cache != null && (boolean) cache; + } catch (Exception e) { + return false; + } + } } diff --git a/backend/src/main/java/io/dataease/listener/DatasetCheckListener.java b/backend/src/main/java/io/dataease/listener/DatasetCheckListener.java new file mode 100644 index 0000000000..f6a572388d --- /dev/null +++ b/backend/src/main/java/io/dataease/listener/DatasetCheckListener.java @@ -0,0 +1,39 @@ +package io.dataease.listener; + +import io.dataease.base.domain.DatasetTable; +import io.dataease.base.domain.DatasetTableExample; +import io.dataease.base.mapper.DatasetTableMapper; +import io.dataease.listener.util.CacheUtils; +import io.dataease.plugins.loader.ClassloaderResponsity; +import org.apache.commons.collections4.CollectionUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.context.event.ApplicationReadyEvent; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.List; + +/** + * @Author gin + * @Date 2021/12/22 10:01 上午 + */ +@Component +public class DatasetCheckListener implements ApplicationListener { + private final Logger logger = LoggerFactory.getLogger(ClassloaderResponsity.class); + public static final String CACHE_NAME = "check_ds"; + public static final String CACHE_KEY = "hide_custom_ds"; + @Resource + private DatasetTableMapper datasetTableMapper; + + @Override + public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) { + logger.info("Start check custom dataset"); + // 项目启动查找是否有'自定义数据集' + DatasetTableExample datasetTableExample = new DatasetTableExample(); + datasetTableExample.createCriteria().andTypeEqualTo("custom"); + List datasetTables = datasetTableMapper.selectByExampleWithBLOBs(datasetTableExample); + CacheUtils.put(CACHE_NAME, CACHE_KEY, CollectionUtils.isEmpty(datasetTables), null, null); + } +} diff --git a/frontend/src/api/dataset/dataset.js b/frontend/src/api/dataset/dataset.js index 9cc9cc958f..dba01e154d 100644 --- a/frontend/src/api/dataset/dataset.js +++ b/frontend/src/api/dataset/dataset.js @@ -182,4 +182,12 @@ export function datasetRowPermissionsList(datasetId, page, size, data, loading) }) } -export default { loadTable, getScene, addGroup, delGroup, addTable, delTable, groupTree } +export function checkCustomDs() { + return request({ + url: '/system/checkCustomDs', + method: 'post', + loading: true + }) +} + +export default { loadTable, getScene, addGroup, delGroup, addTable, delTable, groupTree, checkCustomDs } diff --git a/frontend/src/components/canvas/store/copy.js b/frontend/src/components/canvas/store/copy.js index 80decf5614..3b6f34f511 100644 --- a/frontend/src/components/canvas/store/copy.js +++ b/frontend/src/components/canvas/store/copy.js @@ -28,6 +28,8 @@ export default { } const data = state.copyData.data + // 仪表板复制的组件默认不在移动端部署中mobileSelected = false + data.mobileSelected = false if (!state.curComponent.auxiliaryMatrix) { data.style.top += 20 data.style.left += 20 diff --git a/frontend/src/store/getters.js b/frontend/src/store/getters.js index cb814086c2..6e40c8f092 100644 --- a/frontend/src/store/getters.js +++ b/frontend/src/store/getters.js @@ -16,6 +16,7 @@ const getters = { errorLogs: state => state.errorLog.logs, sceneData: state => state.dataset.sceneData, table: state => state.dataset.table, + hideCustomDs: state => state.dataset.hideCustomDs, loadingMap: state => state.request.loadingMap, currentPath: state => state.permission.currentPath, permissions: state => state.user.permissions, diff --git a/frontend/src/store/modules/dataset.js b/frontend/src/store/modules/dataset.js index 244706da00..b7773a8371 100644 --- a/frontend/src/store/modules/dataset.js +++ b/frontend/src/store/modules/dataset.js @@ -2,7 +2,8 @@ const getDefaultState = () => { return { sceneData: {}, - table: {} + table: {}, + hideCustomDs: false } } @@ -14,6 +15,9 @@ const mutations = { }, setTable: (state, table) => { state.table = table + }, + setHideCustomDs: (state, hideCustomDs) => { + state.hideCustomDs = hideCustomDs } } @@ -23,6 +27,9 @@ const actions = { }, setTable({ commit }, table) { commit('setTable', table) + }, + setHideCustomDs({ commit }, hideCustomDs) { + commit('setHideCustomDs', hideCustomDs) } } diff --git a/frontend/src/views/dataset/data/ViewTable.vue b/frontend/src/views/dataset/data/ViewTable.vue index 5608f5fab8..2e2681251f 100644 --- a/frontend/src/views/dataset/data/ViewTable.vue +++ b/frontend/src/views/dataset/data/ViewTable.vue @@ -56,7 +56,7 @@ - + @@ -76,7 +76,7 @@ import FieldEdit from './FieldEdit' export default { name: 'ViewTable', - components: {FieldEdit, UnionView, DatasetChartDetail, UpdateInfo, TabDataPreview }, + components: { FieldEdit, UnionView, DatasetChartDetail, UpdateInfo, TabDataPreview }, props: { param: { type: Object, @@ -103,10 +103,9 @@ export default { } }, computed: { - // tableRefresh() { - // this.initTable(this.param) - // return this.$store.state.dataset.table - // } + hideCustomDs: function() { + return this.$store.getters.hideCustomDs + } }, watch: { 'param': function() { diff --git a/frontend/src/views/dataset/group/Group.vue b/frontend/src/views/dataset/group/Group.vue index 26f19c79a5..103b3c899d 100644 --- a/frontend/src/views/dataset/group/Group.vue +++ b/frontend/src/views/dataset/group/Group.vue @@ -91,7 +91,7 @@ {{ $t('dataset.excel_data') }} - + {{ $t('dataset.custom_data') }} @@ -309,6 +309,9 @@ export default { } }, computed: { + hideCustomDs: function() { + return this.$store.getters.hideCustomDs + } }, watch: { saveStatus() { diff --git a/frontend/src/views/dataset/index.vue b/frontend/src/views/dataset/index.vue index 63a6fe478b..7cb9e9d9d3 100644 --- a/frontend/src/views/dataset/index.vue +++ b/frontend/src/views/dataset/index.vue @@ -26,6 +26,7 @@ import AddCustom from './add/AddCustom' import AddUnion from '@/views/dataset/add/AddUnion' import FieldEdit from './data/FieldEdit' import { removeClass } from '@/utils' +import { checkCustomDs } from '@/api/dataset/dataset' export default { name: 'DataSet', components: { DeMainContainer, DeContainer, DeAsideContainer, Group, DataHome, ViewTable, AddDB, AddSQL, AddExcel, AddCustom }, @@ -40,11 +41,17 @@ export default { removeClass(document.body, 'showRightPanel') }, created() { + this.initDs() this.$store.dispatch('app/toggleSideBarHide', true) const routerParam = this.$router.currentRoute.params this.toMsgShare(routerParam) }, methods: { + initDs() { + checkCustomDs().then(res => { + this.$store.dispatch('dataset/setHideCustomDs', res.data) + }) + }, switchComponent(c) { this.param = c.param switch (c.name) {