Merge remote-tracking branch 'origin/v1.8' into v1.8

This commit is contained in:
wangjiahao 2022-03-02 18:02:26 +08:00
commit 479081bcee
9 changed files with 84 additions and 141 deletions

View File

@ -1,28 +0,0 @@
package io.dataease.auth.api;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("api/data")
public class demo {
@ApiOperation("查询")
@GetMapping("demo")
public Object listByTableId() {
JSONArray jsonArray = new JSONArray();
for(int i=0;i<10;i++){
JSONObject jsonObject = new JSONObject();
for(int j=0;j<1;j++){
jsonObject.set("column" +i + j, "value"+i+j);
}
jsonArray.put(jsonObject);
}
return jsonArray;
}
}

View File

@ -20,7 +20,6 @@ public class ShiroServiceImpl implements ShiroService {
// ----------------------------------------------------------
// 放行Swagger2页面需要放行这些
filterChainDefinitionMap.put("/api/data/demo", ANON);
filterChainDefinitionMap.put("/doc.html**", "doc");
filterChainDefinitionMap.put("/deApi**", ANON);
filterChainDefinitionMap.put("/swagger-ui.html", ANON);

View File

@ -64,12 +64,12 @@ public class ColumnPermissionsController {
return columnPermissionService.searchPermissions(request);
}
@DePermission(type = DePermissionType.DATASET, level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
@DePermission(type = DePermissionType.DATASET, value = "datasetId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
@ApiOperation("删除")
@PostMapping("/delete/{id}")
public void delete(@PathVariable String id) {
@PostMapping("/delete")
public void delete(@RequestBody DatasetColumnPermissions datasetColumnPermissions) {
ColumnPermissionService columnPermissionService = SpringContextUtil.getBean(ColumnPermissionService.class);
columnPermissionService.delete(id);
columnPermissionService.delete(datasetColumnPermissions.getId());
}
@DePermission(type = DePermissionType.DATASET, level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)

View File

@ -62,12 +62,12 @@ public class RowPermissionsController {
return rowPermissionService.searchRowPermissions(request);
}
@DePermission(type = DePermissionType.DATASET, level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
@DePermission(type = DePermissionType.DATASET, value = "datasetId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
@ApiOperation("删除")
@PostMapping("/delete/{id}")
public void dataSetRowPermissionInfo(@PathVariable String id) {
@PostMapping("/delete")
public void dataSetRowPermissionInfo(@RequestBody DatasetRowPermissions datasetRowPermissions) {
RowPermissionService rowPermissionService = SpringContextUtil.getBean(RowPermissionService.class);
rowPermissionService.delete(id);
rowPermissionService.delete(datasetRowPermissions.getId());
}
@DePermission(type = DePermissionType.DATASET, value = "datasetId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)

View File

@ -26,14 +26,12 @@ public class VAuthModelService {
public List<VAuthModelDTO> queryAuthModel(VAuthModelRequest request) {
request.setUserId(String.valueOf(AuthUtils.getUser().getUserId()));
// 定时任务选数据集时列表需去除空目录
if (request.isClearEmptyDir()) {
request.setMode(null);
}
List<VAuthModelDTO> result = extVAuthModelMapper.queryAuthModel(request);
// 定时任务选数据集时列表需去除空目录
if (request.getPrivileges() != null) {
result = filterPrivileges(request, result);
}
if (request.isClearEmptyDir()) {
result = filterData(request, result);
List<VAuthModelDTO> vAuthModelDTOS = TreeUtils.mergeTree(result);
setAllLeafs(vAuthModelDTOS);
removeEmptyDir(vAuthModelDTOS);
@ -42,16 +40,7 @@ public class VAuthModelService {
return TreeUtils.mergeTree(result);
}
private List<VAuthModelDTO> filterData(VAuthModelRequest request, List<VAuthModelDTO> result) {
if (request.getDatasetMode() != null && request.getDatasetMode() == 1) {
result = result.stream().filter(vAuthModelDTO -> {
if (vAuthModelDTO.getNodeType().equalsIgnoreCase("spine") || (vAuthModelDTO.getNodeType().equalsIgnoreCase("leaf") && vAuthModelDTO.getMode().equals(1L)) && !vAuthModelDTO.getModelInnerType().equalsIgnoreCase("excel") && !vAuthModelDTO.getModelInnerType().equalsIgnoreCase("custom") && !vAuthModelDTO.getModelInnerType().equalsIgnoreCase("union")) {
return true;
} else {
return false;
}
}).collect(Collectors.toList());
}
private List<VAuthModelDTO> filterPrivileges(VAuthModelRequest request, List<VAuthModelDTO> result) {
if (request.getPrivileges() != null) {
result = result.stream().filter(vAuthModelDTO -> {
if (vAuthModelDTO.getNodeType().equalsIgnoreCase("spine") || (vAuthModelDTO.getNodeType().equalsIgnoreCase("leaf") && vAuthModelDTO.getPrivileges() != null && vAuthModelDTO.getPrivileges().contains(request.getPrivileges()))) {

View File

@ -60,7 +60,7 @@
<!--选择数据集-->
<el-dialog v-if="selectDsDialog" v-dialogDrag :title="$t('chart.select_dataset')" :visible="selectDsDialog" :show-close="false" width="400px" class="dialog-css">
<dataset-group-selector-tree :fix-height="true" show-mode="union" :custom-type="customType" @getTable="firstDs" />
<dataset-group-selector-tree :fix-height="true" show-mode="union" :custom-type="customType" clear-empty-dir="true" @getTable="firstDs" />
<div slot="footer" class="dialog-footer">
<el-button size="mini" @click="closeSelectDs()">{{ $t('dataset.cancel') }}</el-button>
<el-button :disabled="!tempDs.id" type="primary" size="mini" @click="confirmSelectDs()">{{ $t('dataset.confirm') }}</el-button>
@ -139,7 +139,7 @@ export default {
allChildCount: 0
},
name: '关联数据集',
customType: ['db', 'sql', 'excel'],
customType: ['db', 'sql', 'excel', 'api'],
selectDsDialog: false,
//
tempDs: {},
@ -185,7 +185,7 @@ export default {
mode: this.dataset[0].currentDs.mode,
info: '{"union":' + JSON.stringify(this.dataset) + '}'
}
post('/dataset/table/update', table).then(response => {
post('/dataset/table/updateUnion', table).then(response => {
this.$emit('saveSuccess', table)
this.cancel()
})

View File

@ -29,7 +29,7 @@
<!--选择数据集-->
<el-dialog v-if="selectDsDialog" v-dialogDrag :title="$t('chart.select_dataset')" :visible="selectDsDialog" :show-close="false" width="400px" class="dialog-css">
<dataset-group-selector-tree :fix-height="true" show-mode="union" :custom-type="customType" :mode="currentNode.currentDs.mode" @getTable="firstDs" />
<dataset-group-selector-tree :fix-height="true" show-mode="union" :custom-type="customType" clear-empty-dir="true" :mode="currentNode.currentDs.mode" @getTable="firstDs" />
<div slot="footer" class="dialog-footer">
<el-button size="mini" @click="closeSelectDs()">{{ $t('dataset.cancel') }}</el-button>
<el-button :disabled="!tempDs.id" type="primary" size="mini" @click="confirmSelectDs()">{{ $t('dataset.confirm') }}</el-button>
@ -79,7 +79,7 @@ export default {
},
allChildCount: 0
},
customType: ['db', 'sql', 'excel'],
customType: ['db', 'sql', 'excel', 'api'],
selectDsDialog: false,
//
tempDs: {},
@ -129,7 +129,7 @@ export default {
selectDs() {
// node
if (this.currentNode.currentDs.mode === 1) {
this.customType = ['db', 'sql', 'excel']
this.customType = ['db', 'sql', 'excel', 'api']
} else if (this.currentNode.currentDs.mode === 0) {
if (this.currentNode.currentDs.modelInnerType === 'db') {
this.customType = ['db']

View File

@ -340,7 +340,7 @@ export default {
{ required: true, message: this.$t('dataset.required'), trigger: 'change' }
]
},
customType: ['db', 'sql']
customType: ['db', 'sql', 'api']
}
},
computed: {

View File

@ -21,13 +21,21 @@
</block>
</uni-nav-bar>
<view v-if="url">
<web-view
:webview-styles="webViewStyles"
style="height: 100vh;"
>
</web-view>
</view>
<scroll-view
:scroll-top="scrollTop"
scroll-y="true"
class="scroll-Y"
@scrolltoupper="upper"
@scrolltolower="lower"
@scroll="scroll">
<web-view v-if="url" :style="{height: viewHeight}" />
</scroll-view>
@ -73,16 +81,15 @@
title: '',
banner: {},
htmlNodes: [],
webViewStyles: {
progress: {
color: '#FF3333'
},
height: '700px'
},
url: '',
hasStar: false,
refreshCount: 0
refreshCount: 0,
scrollTop: 0,
old: {
scrollTop: 0
},
viewHeight: null
}
},
onLoad(event) {
@ -101,12 +108,12 @@
uni.setNavigationBarTitle({
title: this.banner.title
});
// this.getDetail();
this.addRecent()
uni.$emit('loadHomeIndex', {
index: 1
})
this.loadStarStatus()
this.caclViewHeight()
},
@ -118,68 +125,10 @@
uni.navigateBack()
},
onShareAppMessage() {
return {
title: this.banner.title,
path: DETAIL_PAGE_PATH + '?detailDate=' + JSON.stringify(this.banner)
}
},
onNavigationBarButtonTap(event) {
const buttonIndex = event.index;
if (buttonIndex === 0) {
// 分享 H5 的页面
const shareProviders = [];
uni.getProvider({
service: 'share',
success: (result) => {
// 目前仅考虑分享到微信
if (result.provider && result.provider.length && ~result.provider.indexOf('weixin')) {
const channels = _handleShareChannels(result.provider);
uni.showActionSheet({
itemList: channels.map(channel => {
return channel.text;
}),
success: (result) => {
const tapIndex = result.tapIndex;
uni.share({
provider: 'weixin',
type: 0,
title: this.banner.title,
scene: tapIndex === 0 ? 'WXSceneSession' : 'WXSenceTimeline',
href: 'https://uniapp.dcloud.io/h5' + DETAIL_PAGE_PATH + '?detailDate=' + JSON.stringify(this.banner),
imageUrl: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b6304f00-5168-11eb-bd01-97bc1429a9ff.png'
});
}
});
} else {
uni.showToast({
title: '未检测到可用的微信分享服务'
});
}
},
fail: (error) => {
uni.showToast({
title: '获取分享服务失败'
});
}
});
}
},
methods: {
getDetail() {
uni.request({
url: 'https://unidemo.dcloud.net.cn/api/news/36kr/' + this.banner.post_id,
success: (data) => {
if (data.statusCode == 200) {
var htmlString = data.data.content.replace(/\\/g, "").replace(/<img/g, "<img style=\"display:none;\"");
//this.htmlNodes = htmlParser(htmlString);
}
},
fail: () => {
console.log('fail');
}
});
},
addRecent() {
const item = {id: this.banner.id, title: this.banner.title, index: this.banner.index}
addRecent(item)
@ -215,18 +164,32 @@
})
},
loadLinkUrl() {
this.url = process.env.VUE_APP_BASE_API + 'tempMobileLink/' + this.banner.id + "/" + getToken()
const url = this.url
/* uni.hideLoading() */
setTimeout(() => {
const iframe = document.getElementsByTagName("iframe")[0]
// iframe.style.height = (ktxScreentHeight - ktxStatusHeight) + 'px'
iframe.src = url
iframe.onload = e => {
uni.hideLoading()
iframe.onload = e => {
uni.hideLoading()
}
}, 1000);
},
caclViewHeight() {
let systemInfo = uni.getSystemInfoSync()
let pxToRpxScale = 750 / systemInfo.windowWidth;
// 屏幕的高度
let ktxScreentHeight = systemInfo.screenHeight * pxToRpxScale
// 状态栏的高度
let ktxStatusHeight = systemInfo.statusBarHeight * pxToRpxScale
// 导航栏的高度
let navigationHeight = 44 * pxToRpxScale
this.viewHeight = (ktxScreentHeight - ktxStatusHeight) + 'px'
},
back() {
// #ifdef H5
let canBack = true
@ -245,7 +208,27 @@
return
// #endif
uni.navigateBack(1)
}
},
upper: function(e) {
console.log(e)
},
lower: function(e) {
console.log(e)
},
scroll: function(e) {
console.log(e)
this.old.scrollTop = e.detail.scrollTop
},
goTop: function(e) {
this.scrollTop = this.old.scrollTop
this.$nextTick(() => {
this.scrollTop = 0
});
uni.showToast({
icon:"none",
title:"纵向滚动 scrollTop 值已被修改为 0"
})
}
}
}
</script>