diff --git a/backend/pom.xml b/backend/pom.xml index 1523947dec..0add4657ae 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -352,6 +352,10 @@ log4j log4j + + org.objenesis + objenesis + provided diff --git a/backend/src/main/java/io/dataease/base/domain/PanelShare.java b/backend/src/main/java/io/dataease/base/domain/PanelShare.java index 5d45eca63a..ab0c0bfe11 100644 --- a/backend/src/main/java/io/dataease/base/domain/PanelShare.java +++ b/backend/src/main/java/io/dataease/base/domain/PanelShare.java @@ -9,9 +9,11 @@ public class PanelShare implements Serializable { private String panelGroupId; - private Long userId; + private Long targetId; private Long createTime; + private Integer type; + private static final long serialVersionUID = 1L; } \ No newline at end of file diff --git a/backend/src/main/java/io/dataease/base/domain/PanelShareExample.java b/backend/src/main/java/io/dataease/base/domain/PanelShareExample.java index 887d2f1d8c..0f589d6f3d 100644 --- a/backend/src/main/java/io/dataease/base/domain/PanelShareExample.java +++ b/backend/src/main/java/io/dataease/base/domain/PanelShareExample.java @@ -234,63 +234,63 @@ public class PanelShareExample { return (Criteria) this; } - public Criteria andUserIdIsNull() { - addCriterion("user_id is null"); + public Criteria andTargetIdIsNull() { + addCriterion("target_id is null"); return (Criteria) this; } - public Criteria andUserIdIsNotNull() { - addCriterion("user_id is not null"); + public Criteria andTargetIdIsNotNull() { + addCriterion("target_id is not null"); return (Criteria) this; } - public Criteria andUserIdEqualTo(Long value) { - addCriterion("user_id =", value, "userId"); + public Criteria andTargetIdEqualTo(Long value) { + addCriterion("target_id =", value, "targetId"); return (Criteria) this; } - public Criteria andUserIdNotEqualTo(Long value) { - addCriterion("user_id <>", value, "userId"); + public Criteria andTargetIdNotEqualTo(Long value) { + addCriterion("target_id <>", value, "targetId"); return (Criteria) this; } - public Criteria andUserIdGreaterThan(Long value) { - addCriterion("user_id >", value, "userId"); + public Criteria andTargetIdGreaterThan(Long value) { + addCriterion("target_id >", value, "targetId"); return (Criteria) this; } - public Criteria andUserIdGreaterThanOrEqualTo(Long value) { - addCriterion("user_id >=", value, "userId"); + public Criteria andTargetIdGreaterThanOrEqualTo(Long value) { + addCriterion("target_id >=", value, "targetId"); return (Criteria) this; } - public Criteria andUserIdLessThan(Long value) { - addCriterion("user_id <", value, "userId"); + public Criteria andTargetIdLessThan(Long value) { + addCriterion("target_id <", value, "targetId"); return (Criteria) this; } - public Criteria andUserIdLessThanOrEqualTo(Long value) { - addCriterion("user_id <=", value, "userId"); + public Criteria andTargetIdLessThanOrEqualTo(Long value) { + addCriterion("target_id <=", value, "targetId"); return (Criteria) this; } - public Criteria andUserIdIn(List values) { - addCriterion("user_id in", values, "userId"); + public Criteria andTargetIdIn(List values) { + addCriterion("target_id in", values, "targetId"); return (Criteria) this; } - public Criteria andUserIdNotIn(List values) { - addCriterion("user_id not in", values, "userId"); + public Criteria andTargetIdNotIn(List values) { + addCriterion("target_id not in", values, "targetId"); return (Criteria) this; } - public Criteria andUserIdBetween(Long value1, Long value2) { - addCriterion("user_id between", value1, value2, "userId"); + public Criteria andTargetIdBetween(Long value1, Long value2) { + addCriterion("target_id between", value1, value2, "targetId"); return (Criteria) this; } - public Criteria andUserIdNotBetween(Long value1, Long value2) { - addCriterion("user_id not between", value1, value2, "userId"); + public Criteria andTargetIdNotBetween(Long value1, Long value2) { + addCriterion("target_id not between", value1, value2, "targetId"); return (Criteria) this; } @@ -353,6 +353,66 @@ public class PanelShareExample { addCriterion("create_time not between", value1, value2, "createTime"); return (Criteria) this; } + + public Criteria andTypeIsNull() { + addCriterion("`type` is null"); + return (Criteria) this; + } + + public Criteria andTypeIsNotNull() { + addCriterion("`type` is not null"); + return (Criteria) this; + } + + public Criteria andTypeEqualTo(Integer value) { + addCriterion("`type` =", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotEqualTo(Integer value) { + addCriterion("`type` <>", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeGreaterThan(Integer value) { + addCriterion("`type` >", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeGreaterThanOrEqualTo(Integer value) { + addCriterion("`type` >=", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeLessThan(Integer value) { + addCriterion("`type` <", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeLessThanOrEqualTo(Integer value) { + addCriterion("`type` <=", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeIn(List values) { + addCriterion("`type` in", values, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotIn(List values) { + addCriterion("`type` not in", values, "type"); + return (Criteria) this; + } + + public Criteria andTypeBetween(Integer value1, Integer value2) { + addCriterion("`type` between", value1, value2, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotBetween(Integer value1, Integer value2) { + addCriterion("`type` not between", value1, value2, "type"); + return (Criteria) this; + } } public static class Criteria extends GeneratedCriteria { diff --git a/backend/src/main/java/io/dataease/base/mapper/PanelShareMapper.xml b/backend/src/main/java/io/dataease/base/mapper/PanelShareMapper.xml index 7c4d62bdcc..fc57f983b7 100644 --- a/backend/src/main/java/io/dataease/base/mapper/PanelShareMapper.xml +++ b/backend/src/main/java/io/dataease/base/mapper/PanelShareMapper.xml @@ -4,8 +4,9 @@ - + + @@ -66,7 +67,7 @@ - share_id, panel_group_id, user_id, create_time + share_id, panel_group_id, target_id, create_time, `type` @@ -150,12 +157,15 @@ panel_group_id = #{record.panelGroupId,jdbcType=VARCHAR}, - - user_id = #{record.userId,jdbcType=BIGINT}, + + target_id = #{record.targetId,jdbcType=BIGINT}, create_time = #{record.createTime,jdbcType=BIGINT}, + + `type` = #{record.type,jdbcType=INTEGER}, + @@ -165,8 +175,9 @@ update panel_share set share_id = #{record.shareId,jdbcType=BIGINT}, panel_group_id = #{record.panelGroupId,jdbcType=VARCHAR}, - user_id = #{record.userId,jdbcType=BIGINT}, - create_time = #{record.createTime,jdbcType=BIGINT} + target_id = #{record.targetId,jdbcType=BIGINT}, + create_time = #{record.createTime,jdbcType=BIGINT}, + `type` = #{record.type,jdbcType=INTEGER} @@ -177,20 +188,24 @@ panel_group_id = #{panelGroupId,jdbcType=VARCHAR}, - - user_id = #{userId,jdbcType=BIGINT}, + + target_id = #{targetId,jdbcType=BIGINT}, create_time = #{createTime,jdbcType=BIGINT}, + + `type` = #{type,jdbcType=INTEGER}, + where share_id = #{shareId,jdbcType=BIGINT} update panel_share set panel_group_id = #{panelGroupId,jdbcType=VARCHAR}, - user_id = #{userId,jdbcType=BIGINT}, - create_time = #{createTime,jdbcType=BIGINT} + target_id = #{targetId,jdbcType=BIGINT}, + create_time = #{createTime,jdbcType=BIGINT}, + `type` = #{type,jdbcType=INTEGER} where share_id = #{shareId,jdbcType=BIGINT} \ No newline at end of file diff --git a/backend/src/main/java/io/dataease/base/mapper/ext/ExtPanelShareMapper.java b/backend/src/main/java/io/dataease/base/mapper/ext/ExtPanelShareMapper.java index 784e6317f1..6d2cc5acda 100644 --- a/backend/src/main/java/io/dataease/base/mapper/ext/ExtPanelShareMapper.java +++ b/backend/src/main/java/io/dataease/base/mapper/ext/ExtPanelShareMapper.java @@ -3,12 +3,15 @@ package io.dataease.base.mapper.ext; import io.dataease.base.domain.PanelShare; import io.dataease.base.mapper.ext.query.GridExample; import io.dataease.dto.panel.PanelShareDto; +import org.apache.ibatis.annotations.Param; import java.util.List; public interface ExtPanelShareMapper { - int batchInsert(List shares); + int batchInsert(@Param("shares") List shares); List query(GridExample example); + + List queryWithResource(GridExample example); } diff --git a/backend/src/main/java/io/dataease/base/mapper/ext/ExtPanelShareMapper.xml b/backend/src/main/java/io/dataease/base/mapper/ext/ExtPanelShareMapper.xml index 6da4ef665b..35fbc15311 100644 --- a/backend/src/main/java/io/dataease/base/mapper/ext/ExtPanelShareMapper.xml +++ b/backend/src/main/java/io/dataease/base/mapper/ext/ExtPanelShareMapper.xml @@ -6,13 +6,14 @@ + - - INSERT INTO panel_store (panel_group_id,user_id,create_time) + + INSERT INTO panel_share (panel_group_id,target_id,create_time,type) VALUES - - (#{store.panelGroupId}, #{store.userId}, #{store.createTime}) + + (#{share.panelGroupId}, #{share.targetId}, #{share.createTime}, #{share.type}) @@ -32,6 +33,18 @@ + + diff --git a/backend/src/main/java/io/dataease/controller/panel/api/ShareApi.java b/backend/src/main/java/io/dataease/controller/panel/api/ShareApi.java index f12e247fd6..14cc345578 100644 --- a/backend/src/main/java/io/dataease/controller/panel/api/ShareApi.java +++ b/backend/src/main/java/io/dataease/controller/panel/api/ShareApi.java @@ -1,5 +1,6 @@ package io.dataease.controller.panel.api; +import io.dataease.base.domain.PanelShare; import io.dataease.controller.request.panel.PanelShareRequest; import io.dataease.controller.sys.base.BaseGridRequest; import io.dataease.dto.panel.PanelShareDto; @@ -25,5 +26,10 @@ public interface ShareApi { @PostMapping("/treeList") List treeList(BaseGridRequest request); + + @ApiOperation("根据资源查询分享") + @PostMapping("/queryWithResourceId") + List queryWithResourceId(BaseGridRequest request); + } diff --git a/backend/src/main/java/io/dataease/controller/panel/server/ShareServer.java b/backend/src/main/java/io/dataease/controller/panel/server/ShareServer.java index 99fcad3163..82845e111b 100644 --- a/backend/src/main/java/io/dataease/controller/panel/server/ShareServer.java +++ b/backend/src/main/java/io/dataease/controller/panel/server/ShareServer.java @@ -1,15 +1,19 @@ package io.dataease.controller.panel.server; +import io.dataease.base.domain.PanelShare; import io.dataease.controller.panel.api.ShareApi; import io.dataease.controller.request.panel.PanelShareRequest; import io.dataease.controller.sys.base.BaseGridRequest; import io.dataease.dto.panel.PanelShareDto; import io.dataease.service.panel.ShareService; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.util.List; +@RestController public class ShareServer implements ShareApi { @Resource @@ -23,4 +27,10 @@ public class ShareServer implements ShareApi { public List treeList(@RequestBody BaseGridRequest request) { return shareService.queryTree(request); } + + + @Override + public List queryWithResourceId(@RequestBody BaseGridRequest request) { + return shareService.queryWithResource(request); + } } diff --git a/backend/src/main/java/io/dataease/controller/request/panel/PanelShareRequest.java b/backend/src/main/java/io/dataease/controller/request/panel/PanelShareRequest.java index 0a8c652fee..9025280cda 100644 --- a/backend/src/main/java/io/dataease/controller/request/panel/PanelShareRequest.java +++ b/backend/src/main/java/io/dataease/controller/request/panel/PanelShareRequest.java @@ -8,9 +8,10 @@ import java.util.List; @Data public class PanelShareRequest implements Serializable { - - @ApiModelProperty("分享目标用户集合") - private List userIds; + @ApiModelProperty(value = "分享目标类型", allowableValues = "0:user,1:role,2:dept") + private Integer type; + @ApiModelProperty("分享目标集合") + private List targetIds; @ApiModelProperty("分享仪表板集合") private List panelIds; } diff --git a/backend/src/main/java/io/dataease/service/panel/ShareService.java b/backend/src/main/java/io/dataease/service/panel/ShareService.java index 0d90204ced..83022d807a 100644 --- a/backend/src/main/java/io/dataease/service/panel/ShareService.java +++ b/backend/src/main/java/io/dataease/service/panel/ShareService.java @@ -2,6 +2,7 @@ package io.dataease.service.panel; import io.dataease.base.domain.PanelShare; import io.dataease.base.domain.PanelShareExample; +import io.dataease.base.domain.SysUser; import io.dataease.base.mapper.PanelShareMapper; import io.dataease.base.mapper.ext.ExtPanelShareMapper; import io.dataease.base.mapper.ext.query.GridExample; @@ -36,21 +37,26 @@ public class ShareService { public void save(PanelShareRequest request){ //1.先根据仪表板删除所有已经分享的 + Integer type = request.getType(); List panelIds = request.getPanelIds(); - List userIds = request.getUserIds(); + List targetIds = request.getTargetIds(); // 使用原生对象会导致事物失效 所以这里需要使用spring代理对象 if (CollectionUtils.isNotEmpty(panelIds)){ ShareService proxy = CommonBeanFactory.getBean(ShareService.class); - panelIds.forEach(proxy::delete); + panelIds.forEach(panelId -> { + proxy.delete(panelId, type); + }); } - if (CollectionUtils.isEmpty(userIds)) return; + if (CollectionUtils.isEmpty(targetIds)) return; + long now = System.currentTimeMillis(); List shares = panelIds.stream().flatMap(panelId -> - userIds.stream().map(userId -> { + targetIds.stream().map(targetId -> { PanelShare share = new PanelShare(); share.setCreateTime(now); share.setPanelGroupId(panelId); - share.setUserId(userId); + share.setTargetId(targetId); + share.setType(type); return share; }) ).collect(Collectors.toList()); @@ -64,20 +70,31 @@ public class ShareService { * @param panel_group_id */ @Transactional - public void delete(String panel_group_id){ + public void delete(String panel_group_id, Integer type){ PanelShareExample example = new PanelShareExample(); - example.createCriteria().andPanelGroupIdEqualTo(panel_group_id); + example.createCriteria().andPanelGroupIdEqualTo(panel_group_id).andTypeEqualTo(type); mapper.deleteByExample(example); } public List queryTree(BaseGridRequest request){ - Long userId = AuthUtils.getUser().getUserId(); + SysUser user = AuthUtils.getUser(); + Long userId = user.getUserId(); + Long deptId = user.getDeptId(); + List roleIds = new ArrayList<>(); + + List targetIds = new ArrayList<>(); + targetIds.add(userId); + targetIds.add(deptId); + targetIds.addAll(roleIds); + ConditionEntity condition = new ConditionEntity(); - condition.setField("s.user_id"); - condition.setOperator("eq"); - condition.setValue(userId); + condition.setField("s.target_id"); + condition.setOperator("in"); + condition.setValue(targetIds); + request.setConditions(new ArrayList(){{add(condition);}}); + GridExample example = request.convertExample(); List datas = extPanelShareMapper.query(example); return convertTree(datas); @@ -86,9 +103,13 @@ public class ShareService { //List构建Tree private List convertTree(List datas){ Map> map = datas.stream().collect(Collectors.groupingBy(PanelShareDto::getCreator)); - List roots = new ArrayList<>(); return map.entrySet().stream().map(entry -> PanelShareDto.builder().name(entry.getKey()).children(entry.getValue()).build()).collect(Collectors.toList()); } + public List queryWithResource(BaseGridRequest request){ + GridExample example = request.convertExample(); + return extPanelShareMapper.queryWithResource(example); + } + } diff --git a/backend/src/main/java/io/dataease/service/sys/DeptService.java b/backend/src/main/java/io/dataease/service/sys/DeptService.java index d33adcd36e..a3c74199ea 100644 --- a/backend/src/main/java/io/dataease/service/sys/DeptService.java +++ b/backend/src/main/java/io/dataease/service/sys/DeptService.java @@ -14,6 +14,7 @@ import io.dataease.controller.sys.request.DeptDeleteRequest; import io.dataease.controller.sys.request.DeptStatusRequest; import io.dataease.controller.sys.request.SimpleTreeNode; import io.dataease.controller.sys.response.DeptTreeNode; +import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.ObjectUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -134,8 +135,10 @@ public class DeptService { List targetNodes = nodeByCondition(request); List ids = upTree(allNodes, targetNodes); SysDeptExample example = new SysDeptExample(); - SysDeptExample.Criteria criteria = example.createCriteria(); - criteria.andDeptIdIn(ids); + if (CollectionUtils.isNotEmpty(ids)){ + SysDeptExample.Criteria criteria = example.createCriteria(); + criteria.andDeptIdIn(ids); + } example.setOrderByClause("dept_sort"); List sysDepts = sysDeptMapper.selectByExample(example); return sysDepts; diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties index 82cdf1f357..8b7d88331d 100644 --- a/backend/src/main/resources/application.properties +++ b/backend/src/main/resources/application.properties @@ -58,6 +58,8 @@ spring.cache.ehcache.config=classpath:/ehcache/ehcache.xml logging.level.org.springframework.web=trace logging.level.org.springframework.boot.web=trace spring.mvc.log-request-details=true +pagehelper.PageRowBounds=true + diff --git a/backend/src/main/resources/db/migration/V12__panel_table.sql b/backend/src/main/resources/db/migration/V12__panel_table.sql index 0a4fea5f3c..b3a0802f76 100644 --- a/backend/src/main/resources/db/migration/V12__panel_table.sql +++ b/backend/src/main/resources/db/migration/V12__panel_table.sql @@ -67,7 +67,7 @@ CREATE TABLE `panel_store` ( `user_id` bigint(20) NOT NULL COMMENT '用户ID', `create_time` bigint(13) DEFAULT NULL COMMENT '创建日期', PRIMARY KEY (`store_id`) USING BTREE, - UNIQUE KEY `UK_store_user_id` (`user_id`) USING BTREE + KEY `UK_store_user_id` (`user_id`) ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='仪表板收藏'; @@ -86,11 +86,14 @@ DROP TABLE IF EXISTS `panel_share`; CREATE TABLE `panel_share` ( `share_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '分享ID', `panel_group_id` varchar(50) DEFAULT NULL COMMENT '仪表板ID', - `user_id` bigint(20) DEFAULT NULL COMMENT '用户ID', + `target_id` bigint(20) DEFAULT NULL COMMENT '目标ID', `create_time` bigint(13) DEFAULT NULL COMMENT '创建日期', + `type` int(8) DEFAULT NULL COMMENT '类型0:user,1:role,2dept', PRIMARY KEY (`share_id`) USING BTREE, - UNIQUE KEY `UK_share_user_id` (`user_id`) USING BTREE, - UNIQUE KEY `UK_share_panel_group_id` (`panel_group_id`) USING BTREE + KEY `UK_share_arget_id` (`target_id`) , + KEY `UK_share_panel_group_id` (`panel_group_id`) , + KEY `UK_share_type` (`type`) + ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='仪表板分享'; diff --git a/frontend/src/api/panel/share.js b/frontend/src/api/panel/share.js new file mode 100644 index 0000000000..ed12ea2301 --- /dev/null +++ b/frontend/src/api/panel/share.js @@ -0,0 +1,20 @@ +import request from '@/utils/request' + +export function saveShare(data) { + return request({ + url: '/api/share/', + method: 'post', + loading: true, + data + }) +} + +export function loadShares(data) { + return request({ + url: '/api/share/queryWithResourceId', + method: 'post', + loading: true, + data + }) +} + diff --git a/frontend/src/components/vue-drag-resize-rotate/index.vue b/frontend/src/components/vue-drag-resize-rotate/index.vue index c019654d98..108e9acfd6 100644 --- a/frontend/src/components/vue-drag-resize-rotate/index.vue +++ b/frontend/src/components/vue-drag-resize-rotate/index.vue @@ -69,6 +69,10 @@ export default { replace: true, name: 'VueDragResizeRotate', props: { + viewId: { + type: String, + default: '' + }, className: { type: String, default: 'vdr' @@ -596,6 +600,11 @@ export default { }, methods: { + removeView() { + debugger + console.log(this.viewId) + this.$emit('removeView', this.viewId) + }, // 重置边界和鼠标状态 resetBoundsAndMouseState() { this.mouseClickPosition = { mouseX: 0, mouseY: 0, x: 0, y: 0, w: 0, h: 0 } diff --git a/frontend/src/icons/svg/bar-horizontal.svg b/frontend/src/icons/svg/bar-horizontal.svg new file mode 100644 index 0000000000..6ade56b3c8 --- /dev/null +++ b/frontend/src/icons/svg/bar-horizontal.svg @@ -0,0 +1 @@ + diff --git a/frontend/src/icons/svg/bar-stack-horizontal.svg b/frontend/src/icons/svg/bar-stack-horizontal.svg new file mode 100644 index 0000000000..9a78910ab6 --- /dev/null +++ b/frontend/src/icons/svg/bar-stack-horizontal.svg @@ -0,0 +1 @@ + diff --git a/frontend/src/icons/svg/bar-stack.svg b/frontend/src/icons/svg/bar-stack.svg new file mode 100644 index 0000000000..90beda11f0 --- /dev/null +++ b/frontend/src/icons/svg/bar-stack.svg @@ -0,0 +1 @@ + diff --git a/frontend/src/icons/svg/bar.svg b/frontend/src/icons/svg/bar.svg new file mode 100644 index 0000000000..2136e79aad --- /dev/null +++ b/frontend/src/icons/svg/bar.svg @@ -0,0 +1 @@ + diff --git a/frontend/src/icons/svg/funnel.svg b/frontend/src/icons/svg/funnel.svg new file mode 100644 index 0000000000..89190945f5 --- /dev/null +++ b/frontend/src/icons/svg/funnel.svg @@ -0,0 +1 @@ + diff --git a/frontend/src/icons/svg/line.svg b/frontend/src/icons/svg/line.svg new file mode 100644 index 0000000000..c72c676e2b --- /dev/null +++ b/frontend/src/icons/svg/line.svg @@ -0,0 +1 @@ + diff --git a/frontend/src/icons/svg/pie.svg b/frontend/src/icons/svg/pie.svg new file mode 100644 index 0000000000..7d7c52824e --- /dev/null +++ b/frontend/src/icons/svg/pie.svg @@ -0,0 +1 @@ + diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index 6da2829093..061d89d88f 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -602,7 +602,20 @@ export default { std: '标准差', var_samp: '方差', quick_calc: '快速计算', - show_name_set: '显示名设置' + show_name_set: '显示名设置', + color: '颜色', + color_case: '配色方案', + pls_slc_color_case: '请选择配色方案', + color_default: '默认', + color_retro: '复古', + color_future: '未来', + color_gradual: '渐变', + color_business: '商务', + color_gentle: '柔和', + color_elegant: '淡雅', + color_technology: '科技', + color_simple: '简洁', + not_alpha: '不透明度' }, dataset: { datalist: '数据集', diff --git a/frontend/src/main.js b/frontend/src/main.js index 7326ce4c68..22ce2e0eed 100644 --- a/frontend/src/main.js +++ b/frontend/src/main.js @@ -8,15 +8,13 @@ import i18n from './lang' // internationalization import App from './App' import store from './store' import router from './router' - +import message from './utils/message' import '@/icons' // icon import '@/permission' // permission control import api from '@/api/index.js' import filter from '@/filter/filter' import directives from './directive' -import './styles/vdrr/common-temp.scss' - import vdrr from './components/vue-drag-resize-rotate' Vue.component('vdrr', vdrr) @@ -27,7 +25,7 @@ import * as echarts from 'echarts' Vue.prototype.$echarts = echarts import UmyUi from 'umy-ui' -import 'umy-ui/lib/theme-chalk/index.css'// 引入样式 + Vue.use(UmyUi) /** @@ -55,6 +53,7 @@ Vue.use(Fit2CloudUI, { }) Vue.use(filter) Vue.use(directives) +Vue.use(message) Vue.config.productionTip = false new Vue({ diff --git a/frontend/src/store/modules/panel.js b/frontend/src/store/modules/panel.js index a3c5d064e7..5f10d361a9 100644 --- a/frontend/src/store/modules/panel.js +++ b/frontend/src/store/modules/panel.js @@ -1,7 +1,10 @@ const getDefaultState = () => { return { - panelName: '' + panelName: '', + panelInfo: { + name: '' + } } } @@ -10,12 +13,20 @@ const state = getDefaultState() const mutations = { setPanelName: (state, panelName) => { state.panelName = panelName + }, + setPanelInfo: (state, panelInfo) => { + debugger + state.panelInfo = panelInfo } } const actions = { setPanelName({ commit }, panelName) { commit('setPanelName', panelName) + }, + setPanelInfo({ commit }, panelInfo) { + debugger + commit('setPanelInfo', panelInfo) } } diff --git a/frontend/src/styles/index.scss b/frontend/src/styles/index.scss index c8f6acbde9..eadcbd344f 100644 --- a/frontend/src/styles/index.scss +++ b/frontend/src/styles/index.scss @@ -6,6 +6,8 @@ @import './sidebar.scss'; @import './topbar.scss'; @import "~fit2cloud-ui/src/styles/index.scss"; +@import './vdrr/common-temp.scss'; +@import '~umy-ui/lib/theme-chalk/index.css';// 引入样式 // @import '../metersphere/common/css/index.css'; @@ -69,3 +71,42 @@ div:focus { .app-container { padding: 20px; } + +.de-dialog { + width: 30% !important; + + .el-dialog__header{ + background-color: #f4f4f5; + padding: 10px 20px !important; + } + .el-dialog__body{ + padding: 1px 20px !important; + + } +} + +.de-search-header { + .el-tabs__header{ + display: none !important;; + } +} + +.de-input{ + margin-bottom: 14px; + margin-top: 10px; + .el-input{ + .el-input__inner { + line-height: 30px !important; + height: 30px !important; + border-right: none; + + } + } + .el-input__inner:focus{ + border-color: #E6E6E6 !important; + } + .el-input-group__append { + background-color: #ffffff; + } + +} diff --git a/frontend/src/utils/request.js b/frontend/src/utils/request.js index 7232afaea8..b48224cdc3 100644 --- a/frontend/src/utils/request.js +++ b/frontend/src/utils/request.js @@ -14,7 +14,7 @@ const RefreshTokenKey = Config.RefreshTokenKey const service = axios.create({ baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url // withCredentials: true, // send cookies when cross-domain requests - timeout: 5000 // request timeout + timeout: 10000 // request timeout }) // request interceptor diff --git a/frontend/src/views/chart/chart/bar/bar.js b/frontend/src/views/chart/chart/bar/bar.js new file mode 100644 index 0000000000..1200b1d3a3 --- /dev/null +++ b/frontend/src/views/chart/chart/bar/bar.js @@ -0,0 +1,81 @@ +import { hexColorToRGBA } from '../util.js' + +export function baseBarOption(chart_option, chart) { + // 处理shape attr + let customAttr = {} + if (chart.customAttr) { + customAttr = JSON.parse(chart.customAttr) + if (customAttr.color) { + chart_option.color = customAttr.color.colors + } + } + // 处理data + if (chart.data) { + chart_option.title.text = chart.title + chart_option.xAxis.data = chart.data.x + for (let i = 0; i < chart.data.series.length; i++) { + const y = chart.data.series[i] + y.itemStyle = { + color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha) + } + y.type = 'bar' + chart_option.legend.data.push(y.name) + chart_option.series.push(y) + } + } + // console.log(chart_option); + return chart_option +} + +export function stackBarOption(chart_option, chart) { + baseBarOption(chart_option, chart) + + // ext + chart_option.series.forEach(function(s) { + s.stack = 'stack' + s.emphasis = { + focus: 'series' + } + }) + return chart_option +} + +export function horizontalBarOption(chart_option, chart) { + // 处理shape attr + let customAttr = {} + if (chart.customAttr) { + customAttr = JSON.parse(chart.customAttr) + if (customAttr.color) { + chart_option.color = customAttr.color.colors + } + } + // 处理data + if (chart.data) { + chart_option.title.text = chart.title + chart_option.yAxis.data = chart.data.x + for (let i = 0; i < chart.data.series.length; i++) { + const y = chart.data.series[i] + y.itemStyle = { + color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha) + } + y.type = 'bar' + chart_option.legend.data.push(y.name) + chart_option.series.push(y) + } + } + // console.log(chart_option); + return chart_option +} + +export function horizontalStackBarOption(chart_option, chart) { + horizontalBarOption(chart_option, chart) + + // ext + chart_option.series.forEach(function(s) { + s.stack = 'stack' + s.emphasis = { + focus: 'series' + } + }) + return chart_option +} diff --git a/frontend/src/views/chart/chart/chart.js b/frontend/src/views/chart/chart/chart.js index 7392c1b3d2..3a0e91698e 100644 --- a/frontend/src/views/chart/chart/chart.js +++ b/frontend/src/views/chart/chart/chart.js @@ -1,3 +1,8 @@ +export const DEFAULT_COLOR_CASE = { + value: 'default', + colors: ['#5470c6', '#91cc75', '#fac858', '#ee6666', '#73c0de', '#3ba272', '#fc8452', '#9a60b4', '#ea7ccc'], + alpha: 100 +} export const BASE_BAR = { title: { text: '' @@ -14,6 +19,22 @@ export const BASE_BAR = { }, series: [] } +export const HORIZONTAL_BAR = { + title: { + text: '' + }, + tooltip: {}, + legend: { + data: [] + }, + xAxis: { + type: 'value' + }, + yAxis: { + data: [] + }, + series: [] +} export const BASE_LINE = { title: { @@ -32,6 +53,78 @@ export const BASE_LINE = { series: [] } -export default { - BASE_BAR, BASE_LINE +export const BASE_PIE = { + title: { + text: '' + }, + tooltip: { + trigger: 'item', + formatter: '{a}
{b}: {c} ({d}%)' + }, + legend: {}, + series: [ + { + name: '', + type: 'pie', + radius: ['0%', '60%'], + avoidLabelOverlap: false, + emphasis: { + itemStyle: { + shadowBlur: 10, + shadowOffsetX: 0, + shadowColor: 'rgba(0, 0, 0, 0.5)' + } + }, + data: [] + } + ] +} + +export const BASE_FUNNEL = { + title: { + text: '' + }, + tooltip: { + trigger: 'item' + }, + legend: { + // data: [] + }, + series: [ + { + name: '', + type: 'funnel', + left: 'center', + top: 60, + bottom: 60, + width: '80%', + min: 0, + max: 100, + minSize: '0%', + maxSize: '100%', + sort: 'descending', + gap: 1, + // label: { + // show: true, + // position: 'inside' + // }, + labelLine: { + length: 10, + lineStyle: { + width: 1, + type: 'solid' + } + }, + itemStyle: { + borderColor: '#fff', + borderWidth: 1 + }, + emphasis: { + label: { + fontSize: 20 + } + }, + data: [] + } + ] } diff --git a/frontend/src/views/chart/chart/funnel/funnel.js b/frontend/src/views/chart/chart/funnel/funnel.js new file mode 100644 index 0000000000..96bbcf9a96 --- /dev/null +++ b/frontend/src/views/chart/chart/funnel/funnel.js @@ -0,0 +1,35 @@ +import { hexColorToRGBA } from '@/views/chart/chart/util' + +export function baseFunnelOption(chart_option, chart) { + // 处理shape attr + let customAttr = {} + if (chart.customAttr) { + customAttr = JSON.parse(chart.customAttr) + if (customAttr.color) { + chart_option.color = customAttr.color.colors + } + } + // 处理data + if (chart.data) { + chart_option.title.text = chart.title + if (chart.data.series.length > 0) { + chart_option.series[0].name = chart.data.series[0].name + const valueArr = chart.data.series[0].data + chart_option.series[0].max = Math.max.apply(Math, valueArr) + for (let i = 0; i < valueArr.length; i++) { + const y = { + name: chart.data.x[i], + value: valueArr[i] + } + y.itemStyle = { + color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha) + } + y.type = 'funnel' + chart_option.series[0].data.push(y) + } + } + } + // console.log(chart_option); + return chart_option +} + diff --git a/frontend/src/views/chart/chart/line/line.js b/frontend/src/views/chart/chart/line/line.js new file mode 100644 index 0000000000..8fe395b7e7 --- /dev/null +++ b/frontend/src/views/chart/chart/line/line.js @@ -0,0 +1,29 @@ +import { hexColorToRGBA } from '@/views/chart/chart/util' + +export function baseLineOption(chart_option, chart) { + // 处理shape attr + let customAttr = {} + if (chart.customAttr) { + customAttr = JSON.parse(chart.customAttr) + if (customAttr.color) { + chart_option.color = customAttr.color.colors + } + } + // 处理data + if (chart.data) { + chart_option.title.text = chart.title + chart_option.xAxis.data = chart.data.x + for (let i = 0; i < chart.data.series.length; i++) { + const y = chart.data.series[i] + y.itemStyle = { + color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha) + } + y.type = 'line' + chart_option.legend.data.push(y.name) + chart_option.series.push(y) + } + } + // console.log(chart_option); + return chart_option +} + diff --git a/frontend/src/views/chart/chart/pie/pie.js b/frontend/src/views/chart/chart/pie/pie.js new file mode 100644 index 0000000000..8739c4a0e1 --- /dev/null +++ b/frontend/src/views/chart/chart/pie/pie.js @@ -0,0 +1,34 @@ +import { hexColorToRGBA } from '@/views/chart/chart/util' + +export function basePieOption(chart_option, chart) { + // 处理shape attr + let customAttr = {} + if (chart.customAttr) { + customAttr = JSON.parse(chart.customAttr) + if (customAttr.color) { + chart_option.color = customAttr.color.colors + } + } + // 处理data + if (chart.data) { + chart_option.title.text = chart.title + if (chart.data.series.length > 0) { + chart_option.series[0].name = chart.data.series[0].name + const valueArr = chart.data.series[0].data + for (let i = 0; i < valueArr.length; i++) { + const y = { + name: chart.data.x[i], + value: valueArr[i] + } + y.itemStyle = { + color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha) + } + y.type = 'pie' + chart_option.series[0].data.push(y) + } + } + } + // console.log(chart_option); + return chart_option +} + diff --git a/frontend/src/views/chart/chart/util.js b/frontend/src/views/chart/chart/util.js new file mode 100644 index 0000000000..1429a54fd2 --- /dev/null +++ b/frontend/src/views/chart/chart/util.js @@ -0,0 +1,19 @@ +export function hexColorToRGBA(hex, alpha) { + const rgb = [] // 定义rgb数组 + if (/^\#[0-9A-F]{3}$/i.test(hex)) { // 判断传入是否为#三位十六进制数 + let sixHex = '#' + hex.replace(/[0-9A-F]/ig, function(kw) { + sixHex += kw + kw // 把三位16进制数转化为六位 + }) + hex = sixHex // 保存回hex + } + if (/^#[0-9A-F]{6}$/i.test(hex)) { // 判断传入是否为#六位十六进制数 + hex.replace(/[0-9A-F]{2}/ig, function(kw) { + rgb.push(eval('0x' + kw)) // 十六进制转化为十进制并存如数组 + }) + return `rgba(${rgb.join(',')},${alpha / 100})` // 输出RGB格式颜色 + } else { + console.log(`Input ${hex} is wrong!`) + return 'rgb(0,0,0)' + } +} diff --git a/frontend/src/views/chart/components/ChartComponent.vue b/frontend/src/views/chart/components/ChartComponent.vue index 20c906e16b..fe4e9fffd8 100644 --- a/frontend/src/views/chart/components/ChartComponent.vue +++ b/frontend/src/views/chart/components/ChartComponent.vue @@ -5,7 +5,11 @@ + + diff --git a/frontend/src/views/chart/components/QuotaItem.vue b/frontend/src/views/chart/components/QuotaItem.vue index 1efa6c5ced..76c07c82ce 100644 --- a/frontend/src/views/chart/components/QuotaItem.vue +++ b/frontend/src/views/chart/components/QuotaItem.vue @@ -24,10 +24,10 @@ - {{ $t('chart.quick_calc') }}(test) + {{ $t('chart.quick_calc') }}(无) - test + diff --git a/frontend/src/views/chart/group/Group.vue b/frontend/src/views/chart/group/Group.vue index 35a2a951e1..a7ce7ad8cc 100644 --- a/frontend/src/views/chart/group/Group.vue +++ b/frontend/src/views/chart/group/Group.vue @@ -211,6 +211,7 @@ - diff --git a/frontend/src/views/panel/GrantAuth/dept/index.vue b/frontend/src/views/panel/GrantAuth/dept/index.vue new file mode 100644 index 0000000000..dcf426fa3e --- /dev/null +++ b/frontend/src/views/panel/GrantAuth/dept/index.vue @@ -0,0 +1,235 @@ + + + + + diff --git a/frontend/src/views/panel/GrantAuth/index.vue b/frontend/src/views/panel/GrantAuth/index.vue new file mode 100644 index 0000000000..da7f8fe016 --- /dev/null +++ b/frontend/src/views/panel/GrantAuth/index.vue @@ -0,0 +1,101 @@ + + + + + diff --git a/frontend/src/views/panel/GrantAuth/role/index.vue b/frontend/src/views/panel/GrantAuth/role/index.vue new file mode 100644 index 0000000000..99bca3e460 --- /dev/null +++ b/frontend/src/views/panel/GrantAuth/role/index.vue @@ -0,0 +1,144 @@ + + + + + diff --git a/frontend/src/views/panel/GrantAuth/user/index.vue b/frontend/src/views/panel/GrantAuth/user/index.vue new file mode 100644 index 0000000000..43b3c57ac5 --- /dev/null +++ b/frontend/src/views/panel/GrantAuth/user/index.vue @@ -0,0 +1,144 @@ + + + + + diff --git a/frontend/src/views/panel/list/PanelList.vue b/frontend/src/views/panel/list/PanelList.vue index 3de67d91e2..e4d33e628d 100644 --- a/frontend/src/views/panel/list/PanelList.vue +++ b/frontend/src/views/panel/list/PanelList.vue @@ -111,30 +111,31 @@ - 分享授权 - + +