提交 aea71643 authored 作者: taojinlong's avatar taojinlong

Merge branch 'main' of github.com:dataease/dataease into main

...@@ -31,6 +31,6 @@ public interface StoreApi { ...@@ -31,6 +31,6 @@ public interface StoreApi {
@ApiOperation("移除收藏") @ApiOperation("移除收藏")
@PostMapping("/remove/{storeId}") @PostMapping("/remove/{storeId}")
void remove(@PathVariable("storeId") Long storeId); void remove(@PathVariable("storeId") String storeId);
} }
...@@ -16,7 +16,7 @@ public class StoreServer implements StoreApi { ...@@ -16,7 +16,7 @@ public class StoreServer implements StoreApi {
private StoreService storeService; private StoreService storeService;
@Override @Override
public void store( String id) { public void store(String id) {
storeService.save(id); storeService.save(id);
} }
...@@ -26,7 +26,12 @@ public class StoreServer implements StoreApi { ...@@ -26,7 +26,12 @@ public class StoreServer implements StoreApi {
} }
@Override @Override
public void remove( Long storeId) { public void remove(String storeId) {
storeService.remove(storeId); try {
Long id = Long.parseLong(storeId);
storeService.remove(id);
} catch (Exception e) {
storeService.removeByPanelId(storeId);
}
} }
} }
package io.dataease.service.panel; package io.dataease.service.panel;
import io.dataease.base.domain.PanelStore; import io.dataease.base.domain.PanelStore;
import io.dataease.base.domain.PanelStoreExample;
import io.dataease.base.mapper.PanelStoreMapper; import io.dataease.base.mapper.PanelStoreMapper;
import io.dataease.base.mapper.ext.ExtPanelStoreMapper; import io.dataease.base.mapper.ext.ExtPanelStoreMapper;
import io.dataease.base.mapper.ext.query.GridExample; import io.dataease.base.mapper.ext.query.GridExample;
...@@ -9,6 +10,7 @@ import io.dataease.controller.sys.base.BaseGridRequest; ...@@ -9,6 +10,7 @@ import io.dataease.controller.sys.base.BaseGridRequest;
import io.dataease.controller.sys.base.ConditionEntity; import io.dataease.controller.sys.base.ConditionEntity;
import io.dataease.dto.panel.PanelStoreDto; import io.dataease.dto.panel.PanelStoreDto;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -22,7 +24,7 @@ public class StoreService { ...@@ -22,7 +24,7 @@ public class StoreService {
@Resource @Resource
private ExtPanelStoreMapper extPanelStoreMapper; private ExtPanelStoreMapper extPanelStoreMapper;
public void save(String panelGroupId){ public void save(String panelGroupId) {
Long userId = AuthUtils.getUser().getUserId(); Long userId = AuthUtils.getUser().getUserId();
PanelStore panelStore = new PanelStore(); PanelStore panelStore = new PanelStore();
panelStore.setCreateTime(System.currentTimeMillis()); panelStore.setCreateTime(System.currentTimeMillis());
...@@ -31,24 +33,31 @@ public class StoreService { ...@@ -31,24 +33,31 @@ public class StoreService {
panelStoreMapper.insert(panelStore); panelStoreMapper.insert(panelStore);
} }
public void removeByPanelId(String panelId) {
PanelStoreExample panelStoreExample = new PanelStoreExample();
panelStoreExample.createCriteria().andPanelGroupIdEqualTo(panelId);
panelStoreMapper.deleteByExample(panelStoreExample);
}
public void remove(Long storeId) {
public void remove(Long storeId){
panelStoreMapper.deleteByPrimaryKey(storeId); panelStoreMapper.deleteByPrimaryKey(storeId);
} }
/** /**
* 按照当前用户ID查询收藏仪表板 * 按照当前用户ID查询收藏仪表板
*
* @param request * @param request
* @return * @return
*/ */
public List<PanelStoreDto> query(BaseGridRequest request){ public List<PanelStoreDto> query(BaseGridRequest request) {
Long userId = AuthUtils.getUser().getUserId(); Long userId = AuthUtils.getUser().getUserId();
ConditionEntity condition = new ConditionEntity(); ConditionEntity condition = new ConditionEntity();
condition.setField("s.user_id"); condition.setField("s.user_id");
condition.setOperator("eq"); condition.setOperator("eq");
condition.setValue(userId); condition.setValue(userId);
request.setConditions(new ArrayList<ConditionEntity>(){{add(condition);}}); request.setConditions(new ArrayList<ConditionEntity>() {{
add(condition);
}});
GridExample example = request.convertExample(); GridExample example = request.convertExample();
List<PanelStoreDto> stores = extPanelStoreMapper.query(example); List<PanelStoreDto> stores = extPanelStoreMapper.query(example);
return stores; return stores;
......
...@@ -45,6 +45,7 @@ CREATE TABLE `datasource` ( ...@@ -45,6 +45,7 @@ CREATE TABLE `datasource` (
`create_time` bigint(13) NOT NULL COMMENT 'Create timestamp', `create_time` bigint(13) NOT NULL COMMENT 'Create timestamp',
`create_by` varchar(50) DEFAULT NULL COMMENT '创建人ID', `create_by` varchar(50) DEFAULT NULL COMMENT '创建人ID',
`update_time` bigint(13) NOT NULL COMMENT 'Update timestamp', `update_time` bigint(13) NOT NULL COMMENT 'Update timestamp',
`create_by` varchar(50) COMMENT '创建人ID',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
)ENGINE = InnoDB )ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4; DEFAULT CHARSET = utf8mb4;
......
...@@ -6,8 +6,9 @@ ...@@ -6,8 +6,9 @@
{{ message }} {{ message }}
</div> </div>
</div> </div>
<chart-component v-if="requestStatus==='success'&&chart.type && !chart.type.includes('table')" :ref="element.propValue.id" class="chart-class" :chart="chart" /> <chart-component v-if="requestStatus==='success'&&chart.type && !chart.type.includes('table') && !chart.type.includes('text')" :ref="element.propValue.id" class="chart-class" :chart="chart" />
<table-normal v-if="requestStatus==='success'&&chart.type && chart.type.includes('table')" :chart="chart" class="table-class" /> <table-normal v-if="requestStatus==='success'&&chart.type && chart.type.includes('table')" :ref="element.propValue.id" :chart="chart" class="table-class" />
<label-normal v-if="requestStatus==='success'&&chart.type && chart.type.includes('text')" :ref="element.propValue.id" :chart="chart" class="table-class" />
</div> </div>
</template> </template>
...@@ -16,6 +17,7 @@ ...@@ -16,6 +17,7 @@
import { viewData } from '@/api/panel/panel' import { viewData } from '@/api/panel/panel'
import ChartComponent from '@/views/chart/components/ChartComponent.vue' import ChartComponent from '@/views/chart/components/ChartComponent.vue'
import TableNormal from '@/views/chart/components/table/TableNormal' import TableNormal from '@/views/chart/components/table/TableNormal'
import LabelNormal from '../../../views/chart/components/normal/LabelNormal'
import { mapState } from 'vuex' import { mapState } from 'vuex'
...@@ -33,7 +35,7 @@ import { ...@@ -33,7 +35,7 @@ import {
export default { export default {
name: 'UserView', name: 'UserView',
components: { ChartComponent, TableNormal }, components: { ChartComponent, TableNormal, LabelNormal },
props: { props: {
element: { element: {
type: Object type: Object
......
...@@ -87,6 +87,7 @@ export default { ...@@ -87,6 +87,7 @@ export default {
password_error: '密码不小于6位' password_error: '密码不小于6位'
}, },
commons: { commons: {
close: '关闭',
icon: '图标', icon: '图标',
all: '全部', all: '全部',
enable: '启用', enable: '启用',
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
<script> <script>
import { hexColorToRGBA } from '../../chart/util' import { hexColorToRGBA } from '../../chart/util'
import eventBus from '@/components/canvas/utils/eventBus'
export default { export default {
name: 'LabelNormal', name: 'LabelNormal',
...@@ -83,6 +84,10 @@ export default { ...@@ -83,6 +84,10 @@ export default {
mounted() { mounted() {
this.init() this.init()
this.calcHeight() this.calcHeight()
// 监听元素变动事件
eventBus.$on('resizing', (componentId) => {
this.chartResize()
})
}, },
methods: { methods: {
init() { init() {
...@@ -94,14 +99,14 @@ export default { ...@@ -94,14 +99,14 @@ export default {
}, },
calcHeight() { calcHeight() {
const that = this const that = this
setTimeout(function() { this.$nextTick(function() {
// const currentHeight = document.documentElement.clientHeight if (that.$refs.tableContainer) {
// const tableMaxHeight = currentHeight - 56 - 40 - 84 - that.$refs.title.offsetHeight - 20 const currentHeight = that.$refs.tableContainer.offsetHeight
const currentHeight = that.$refs.tableContainer.offsetHeight const contentHeight = currentHeight - that.$refs.title.offsetHeight
const contentHeight = currentHeight - that.$refs.title.offsetHeight that.height = contentHeight + 'px'
that.height = contentHeight + 'px' that.content_class.height = that.height
that.content_class.height = that.height }
}, 10) })
}, },
initStyle() { initStyle() {
if (this.chart.customAttr) { if (this.chart.customAttr) {
...@@ -135,6 +140,10 @@ export default { ...@@ -135,6 +140,10 @@ export default {
this.bg_class.background = hexColorToRGBA(customStyle.background.color, customStyle.background.alpha) this.bg_class.background = hexColorToRGBA(customStyle.background.color, customStyle.background.alpha)
} }
} }
},
chartResize() {
// 指定图表的配置项和数据
this.calcHeight()
} }
} }
} }
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
<script> <script>
import { hexColorToRGBA } from '../../chart/util' import { hexColorToRGBA } from '../../chart/util'
import eventBus from '@/components/canvas/utils/eventBus'
export default { export default {
name: 'TableNormal', name: 'TableNormal',
...@@ -91,6 +92,10 @@ export default { ...@@ -91,6 +92,10 @@ export default {
mounted() { mounted() {
this.init() this.init()
this.calcHeight() this.calcHeight()
// 监听元素变动事件
eventBus.$on('resizing', (componentId) => {
this.chartResize()
})
}, },
methods: { methods: {
init() { init() {
...@@ -111,23 +116,23 @@ export default { ...@@ -111,23 +116,23 @@ export default {
}, },
calcHeight() { calcHeight() {
const that = this const that = this
setTimeout(function() { this.$nextTick(function() {
// const currentHeight = document.documentElement.clientHeight if (that.$refs.tableContainer) {
// const tableMaxHeight = currentHeight - 56 - 40 - 84 - that.$refs.title.offsetHeight - 20 const currentHeight = that.$refs.tableContainer.offsetHeight
const currentHeight = that.$refs.tableContainer.offsetHeight const tableMaxHeight = currentHeight - that.$refs.title.offsetHeight
const tableMaxHeight = currentHeight - that.$refs.title.offsetHeight let tableHeight
let tableHeight if (that.chart.data) {
if (that.chart.data) { tableHeight = (that.chart.data.tableRow.length + 2) * 36
tableHeight = (that.chart.data.tableRow.length + 2) * 36 } else {
} else { tableHeight = 0
tableHeight = 0 }
} if (tableHeight > tableMaxHeight) {
if (tableHeight > tableMaxHeight) { that.height = tableMaxHeight + 'px'
that.height = tableMaxHeight + 'px' } else {
} else { that.height = 'auto'
that.height = 'auto' }
} }
}, 10) })
}, },
initStyle() { initStyle() {
if (this.chart.customAttr) { if (this.chart.customAttr) {
...@@ -207,6 +212,11 @@ export default { ...@@ -207,6 +212,11 @@ export default {
}) })
// 返回一个二维数组的表尾合计(不要平均值,就不要在数组中添加) // 返回一个二维数组的表尾合计(不要平均值,就不要在数组中添加)
return [means] return [means]
},
chartResize() {
// 指定图表的配置项和数据
this.calcHeight()
} }
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论