forked from github/dataease
feat: 新增我分享的
This commit is contained in:
parent
3f7d1be0f8
commit
db55c0782a
@ -10,12 +10,14 @@ import java.util.Map;
|
||||
|
||||
public interface ExtPanelShareMapper {
|
||||
|
||||
int batchInsert(@Param("shares") List<PanelShare> shares);
|
||||
int batchInsert(@Param("shares") List<PanelShare> shares, @Param("userName") String userName);
|
||||
|
||||
int batchDelete(@Param("shareIds") List<Long> shareIds);
|
||||
|
||||
List<PanelSharePo> query(Map<String, Object> param);
|
||||
|
||||
List<PanelSharePo> queryOut(String userName);
|
||||
|
||||
List<PanelShare> queryWithResource(GridExample example);
|
||||
|
||||
List<Long> queryUserIdWithRoleIds(Map<String, List<Long>> param);
|
||||
|
@ -9,10 +9,10 @@
|
||||
</resultMap>
|
||||
|
||||
<insert id="batchInsert" parameterType="io.dataease.base.domain.PanelShare">
|
||||
INSERT INTO panel_share (panel_group_id,target_id,create_time,type)
|
||||
INSERT INTO panel_share (panel_group_id,target_id,granter,create_time,type)
|
||||
VALUES
|
||||
<foreach collection="shares" item="share" separator=",">
|
||||
(#{share.panelGroupId}, #{share.targetId}, #{share.createTime}, #{share.type})
|
||||
(#{share.panelGroupId}, #{share.targetId}, #{userName}, #{share.createTime}, #{share.type})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
</delete>
|
||||
|
||||
<select id="query" resultMap="treeNodeMap">
|
||||
select distinct s.panel_group_id as id, g.create_by as creator, g.name
|
||||
select distinct s.panel_group_id as id, IFNULL(s.granter,g.create_by) as creator, g.name
|
||||
from panel_share s
|
||||
left join panel_group g on g.id = s.panel_group_id
|
||||
where
|
||||
@ -42,6 +42,15 @@
|
||||
|
||||
</select>
|
||||
|
||||
<select id="queryOut" resultMap="treeNodeMap">
|
||||
select distinct s.panel_group_id as id, g.name
|
||||
from panel_share s
|
||||
left join panel_group g on g.id = s.panel_group_id
|
||||
where ( s.granter is not null and s.granter = #{userName} ) or ( s.granter is null and g.create_by = #{userName} )
|
||||
order by s.create_time desc
|
||||
|
||||
</select>
|
||||
|
||||
<select id="queryWithResource" parameterType="io.dataease.base.mapper.ext.query.GridExample" resultMap="io.dataease.base.mapper.PanelShareMapper.BaseResultMap">
|
||||
select * from panel_share
|
||||
<if test="_parameter != null">
|
||||
|
@ -6,6 +6,7 @@ import io.dataease.controller.request.panel.PanelShareFineDto;
|
||||
import io.dataease.controller.request.panel.PanelShareRequest;
|
||||
import io.dataease.controller.sys.base.BaseGridRequest;
|
||||
import io.dataease.dto.panel.PanelShareDto;
|
||||
import io.dataease.dto.panel.PanelSharePo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@ -22,14 +23,19 @@ import java.util.List;
|
||||
@RequestMapping("/api/share")
|
||||
public interface ShareApi {
|
||||
|
||||
@ApiIgnore
|
||||
/*@ApiIgnore
|
||||
@PostMapping("/")
|
||||
void share(PanelShareRequest request);
|
||||
void share(PanelShareRequest request);*/
|
||||
|
||||
@ApiOperation("查询分享")
|
||||
@ApiOperation("查询分享给我")
|
||||
@PostMapping("/treeList")
|
||||
List<PanelShareDto> treeList(BaseGridRequest request);
|
||||
|
||||
@ApiOperation("查询我分享的")
|
||||
@PostMapping("/shareOut")
|
||||
List<PanelSharePo> shareOut();
|
||||
|
||||
|
||||
|
||||
@ApiOperation("根据资源查询分享")
|
||||
@PostMapping("/queryWithResourceId")
|
||||
|
@ -6,6 +6,7 @@ import io.dataease.controller.request.panel.PanelShareFineDto;
|
||||
import io.dataease.controller.request.panel.PanelShareRequest;
|
||||
import io.dataease.controller.sys.base.BaseGridRequest;
|
||||
import io.dataease.dto.panel.PanelShareDto;
|
||||
import io.dataease.dto.panel.PanelSharePo;
|
||||
import io.dataease.service.panel.ShareService;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@ -18,16 +19,20 @@ public class ShareServer implements ShareApi {
|
||||
|
||||
@Resource
|
||||
private ShareService shareService;
|
||||
@Override
|
||||
/*@Override
|
||||
public void share(@RequestBody PanelShareRequest request) {
|
||||
shareService.save(request);
|
||||
}
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public List<PanelShareDto> treeList(@RequestBody BaseGridRequest request) {
|
||||
return shareService.queryTree(request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PanelSharePo> shareOut() {
|
||||
return shareService.queryShareOut();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PanelShare> queryWithResourceId(@RequestBody BaseGridRequest request) {
|
||||
|
@ -115,7 +115,7 @@ public class ShareService {
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(addShares)){
|
||||
extPanelShareMapper.batchInsert(addShares);
|
||||
extPanelShareMapper.batchInsert(addShares, AuthUtils.getUser().getUsername());
|
||||
}
|
||||
|
||||
// 以上是业务代码
|
||||
@ -241,7 +241,7 @@ public class ShareService {
|
||||
})
|
||||
).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(shares)){
|
||||
extPanelShareMapper.batchInsert(shares);
|
||||
extPanelShareMapper.batchInsert(shares, AuthUtils.getUser().getUsername());
|
||||
}
|
||||
|
||||
// 下面是发送提醒消息逻辑
|
||||
@ -287,6 +287,15 @@ public class ShareService {
|
||||
mapper.deleteByExample(example);
|
||||
}
|
||||
|
||||
public List<PanelSharePo> shareOut() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<PanelSharePo> queryShareOut() {
|
||||
String username = AuthUtils.getUser().getUsername();
|
||||
List<PanelSharePo> panelSharePos = extPanelShareMapper.queryOut(username);
|
||||
return panelSharePos;
|
||||
}
|
||||
|
||||
public List<PanelShareDto> queryTree(BaseGridRequest request){
|
||||
CurrentUserDto user = AuthUtils.getUser();
|
||||
|
5
backend/src/main/resources/db/migration/V28__de1.5.sql
Normal file
5
backend/src/main/resources/db/migration/V28__de1.5.sql
Normal file
@ -0,0 +1,5 @@
|
||||
-- ----------------------------
|
||||
-- 新增我分享出去的功能
|
||||
-- ----------------------------
|
||||
ALTER TABLE `dataease`.`panel_share`
|
||||
ADD COLUMN `granter` varchar(255) NULL COMMENT '分享人' AFTER `target_id`;
|
@ -1,13 +1,13 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function saveShare(data) {
|
||||
/* export function saveShare(data) {
|
||||
return request({
|
||||
url: '/api/share/',
|
||||
method: 'post',
|
||||
loading: true,
|
||||
data
|
||||
})
|
||||
}
|
||||
} */
|
||||
|
||||
export function loadShares(data) {
|
||||
return request({
|
||||
@ -27,6 +27,14 @@ export function loadTree(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export function loadShareOutTree() {
|
||||
return request({
|
||||
url: '/api/share/shareOut',
|
||||
method: 'post',
|
||||
loading: true
|
||||
})
|
||||
}
|
||||
|
||||
export function fineSave(data) {
|
||||
return request({
|
||||
url: '/api/share/fineSave',
|
||||
|
@ -17,7 +17,8 @@
|
||||
<script>
|
||||
import { roleGrid } from '@/api/system/user'
|
||||
import { formatCondition } from '@/utils/index'
|
||||
import { saveShare, loadShares } from '@/api/panel/share'
|
||||
import { loadShares } from '@/api/panel/share'
|
||||
/* import { saveShare, loadShares } from '@/api/panel/share' */
|
||||
export default {
|
||||
name: 'GrantRole',
|
||||
props: {
|
||||
@ -85,7 +86,7 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
save(msg) {
|
||||
/* save(msg) {
|
||||
const rows = this.$refs.table.store.states.selection
|
||||
const request = this.buildRequest(rows)
|
||||
saveShare(request).then(res => {
|
||||
@ -95,7 +96,7 @@ export default {
|
||||
this.$error(err.message)
|
||||
return false
|
||||
})
|
||||
},
|
||||
}, */
|
||||
|
||||
cancel() {
|
||||
},
|
||||
|
@ -1,24 +1,47 @@
|
||||
<template>
|
||||
<div>
|
||||
|
||||
<el-tree :data="datas" :props="defaultProps" node-key="name" :default-expanded-keys="expandNodes" @node-click="handleNodeClick">
|
||||
<span slot-scope="{ data }" class="custom-tree-node">
|
||||
<span :class="!!data.msgNode ? 'msg-node-class': ''">
|
||||
<span v-if="!!data.id">
|
||||
<el-button
|
||||
icon="el-icon-picture-outline"
|
||||
type="text"
|
||||
/>
|
||||
<el-col style="padding: 0 5px 0 5px;">
|
||||
<el-row>
|
||||
<span class="header-title">分享给我</span>
|
||||
<div class="block" style="margin-top:8px;">
|
||||
<el-tree :data="datas" :props="defaultProps" node-key="name" :default-expanded-keys="expandNodes" @node-click="handleNodeClick">
|
||||
<span slot-scope="{ data }" class="custom-tree-node">
|
||||
<span :class="!!data.msgNode ? 'msg-node-class': ''">
|
||||
<span v-if="!!data.id">
|
||||
<el-button
|
||||
icon="el-icon-picture-outline"
|
||||
type="text"
|
||||
/>
|
||||
</span>
|
||||
<span style="margin-left: 6px">{{ data.name }}</span>
|
||||
</span>
|
||||
</span>
|
||||
<span style="margin-left: 6px">{{ data.name }}</span>
|
||||
</span>
|
||||
</span>
|
||||
</el-tree>
|
||||
</div>
|
||||
</el-tree>
|
||||
</div>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<span class="header-title">我分享的</span>
|
||||
<div class="block" style="margin-top:8px;">
|
||||
<el-tree :data="outDatas" :props="defaultProps" node-key="name" :default-expand-all="true" @node-click="handleNodeClick">
|
||||
<span slot-scope="{ data }" class="custom-tree-node">
|
||||
<span>
|
||||
<span v-if="!!data.id">
|
||||
<el-button
|
||||
icon="el-icon-picture-outline"
|
||||
type="text"
|
||||
/>
|
||||
</span>
|
||||
<span style="margin-left: 6px">{{ data.name }}</span>
|
||||
</span>
|
||||
</span>
|
||||
</el-tree>
|
||||
</div>
|
||||
</el-row>
|
||||
</el-col>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { loadTree } from '@/api/panel/share'
|
||||
import { loadTree, loadShareOutTree } from '@/api/panel/share'
|
||||
import { uuid } from 'vue-uuid'
|
||||
import { get } from '@/api/panel/panel'
|
||||
import bus from '@/utils/bus'
|
||||
@ -37,7 +60,8 @@ export default {
|
||||
children: 'children',
|
||||
label: 'name'
|
||||
},
|
||||
expandNodes: []
|
||||
expandNodes: [],
|
||||
outDatas: []
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@ -47,6 +71,9 @@ export default {
|
||||
this.expandMsgNode(this.msgPanelIds)
|
||||
}
|
||||
})
|
||||
this.initOutData().then(res => {
|
||||
this.outDatas = res.data
|
||||
})
|
||||
},
|
||||
|
||||
methods: {
|
||||
@ -54,6 +81,9 @@ export default {
|
||||
const param = {}
|
||||
return loadTree(param)
|
||||
},
|
||||
initOutData() {
|
||||
return loadShareOutTree()
|
||||
},
|
||||
handleNodeClick(data) {
|
||||
get('panel/group/findOne/' + data.id).then(response => {
|
||||
this.$store.commit('setComponentData', this.resetID(JSON.parse(response.data.panelData)))
|
||||
@ -96,6 +126,15 @@ export default {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.header-title {
|
||||
font-size: 14px;
|
||||
flex: 1;
|
||||
color: var(--TextPrimary, #606266);
|
||||
font-weight: bold;
|
||||
display: block;
|
||||
height: 100%;
|
||||
/*line-height: 36px;*/
|
||||
}
|
||||
.msg-node-class {
|
||||
color: red;
|
||||
>>> i{
|
||||
|
@ -25,7 +25,8 @@
|
||||
<script>
|
||||
import { userLists } from '@/api/system/user'
|
||||
import { formatCondition } from '@/utils/index'
|
||||
import { saveShare, loadShares } from '@/api/panel/share'
|
||||
import { loadShares } from '@/api/panel/share'
|
||||
/* import { saveShare, loadShares } from '@/api/panel/share' */
|
||||
export default {
|
||||
name: 'GrantUser',
|
||||
props: {
|
||||
@ -92,7 +93,7 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
save(msg) {
|
||||
/* save(msg) {
|
||||
const rows = this.$refs.table.store.states.selection
|
||||
const request = this.buildRequest(rows)
|
||||
saveShare(request).then(response => {
|
||||
@ -102,7 +103,7 @@ export default {
|
||||
this.$error(err.message)
|
||||
return false
|
||||
})
|
||||
},
|
||||
}, */
|
||||
|
||||
cancel() {
|
||||
console.log('user cancel')
|
||||
|
Loading…
Reference in New Issue
Block a user