feat: 初步整合xpack功能完毕

This commit is contained in:
fit2cloud-chenyw 2021-06-01 11:13:40 +08:00
parent 4ae8488274
commit 35796108c7
10 changed files with 80 additions and 17 deletions

View File

@ -31,6 +31,8 @@ public class DynamicMenuDto implements Serializable {
private Boolean isPlugin;
private Boolean noLayout;
private List<DynamicMenuDto> children;
}

View File

@ -14,10 +14,10 @@ import io.dataease.commons.utils.BeanUtils;
import io.dataease.commons.utils.CodingUtil;
import io.dataease.commons.utils.ServletUtils;
import io.dataease.plugins.config.SpringContextUtil;
/*import io.dataease.plugins.config.SpringContextUtil;
import io.dataease.plugins.xpack.display.dto.response.SysSettingDto;
import io.dataease.plugins.xpack.display.service.DisPlayXpackService;
import io.dataease.plugins.xpack.display.service.DisPlayXpackService;*/
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
@ -110,7 +110,7 @@ public class AuthServer implements AuthApi {
SysUserEntity userById = authUserService.getUserById(4L);
String nickName = userById.getNickName();
// System.out.println(nickName);
Map<String, DisPlayXpackService> beansOfType = SpringContextUtil.getApplicationContext().getBeansOfType(DisPlayXpackService.class);
/* Map<String, DisPlayXpackService> beansOfType = SpringContextUtil.getApplicationContext().getBeansOfType(DisPlayXpackService.class);
for (Map.Entry entry : beansOfType.entrySet()) {
Object key = entry.getKey();
DisPlayXpackService value = (DisPlayXpackService)entry.getValue();
@ -118,7 +118,7 @@ public class AuthServer implements AuthApi {
String name = entry.getValue().getClass().getName();
System.out.println("key: "+ key + ", value: "+ name);
}
}*/
return "apple";
}
}

View File

@ -73,6 +73,7 @@ public class DynamicMenuServiceImpl implements DynamicMenuService {
dynamicMenuDto.setPermission(sysMenu.getPermission());
dynamicMenuDto.setHidden(sysMenu.getHidden());
dynamicMenuDto.setIsPlugin(true);
dynamicMenuDto.setNoLayout(!!sysMenu.isNoLayout());
return dynamicMenuDto;
}

View File

@ -0,0 +1,48 @@
package io.dataease.plugins.server;
import io.dataease.auth.api.dto.CurrentUserDto;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.controller.handler.annotation.I18n;
import io.dataease.plugins.config.SpringContextUtil;
import io.dataease.plugins.xpack.auth.dto.request.XpackBaseTreeRequest;
import io.dataease.plugins.xpack.auth.dto.request.XpackSysAuthRequest;
import io.dataease.plugins.xpack.auth.dto.response.XpackSysAuthDetail;
import io.dataease.plugins.xpack.auth.dto.response.XpackVAuthModelDTO;
import org.springframework.web.bind.annotation.*;
import io.dataease.plugins.xpack.auth.service.AuthXpackService;
import java.util.List;
import java.util.Map;
@RequestMapping("/plugin/auth")
@RestController
public class XAuthServer {
@PostMapping("/authModels")
@I18n
public List<XpackVAuthModelDTO> authModels(@RequestBody XpackBaseTreeRequest request){
AuthXpackService sysAuthService = SpringContextUtil.getBean(AuthXpackService.class);
CurrentUserDto user = AuthUtils.getUser();
return sysAuthService.searchAuthModelTree(request, user.getUserId(), user.getIsAdmin());
}
@PostMapping("/authDetails")
public Map<String,List<XpackSysAuthDetail>> authDetails(@RequestBody XpackSysAuthRequest request){
AuthXpackService sysAuthService = SpringContextUtil.getBean(AuthXpackService.class);
return sysAuthService.searchAuthDetails(request);
}
@GetMapping("/authDetailsModel/{authType}")
@I18n
public List<XpackSysAuthDetail>authDetailsModel(@PathVariable String authType){
AuthXpackService sysAuthService = SpringContextUtil.getBean(AuthXpackService.class);
return sysAuthService.searchAuthDetailsModel(authType);
}
@PostMapping("/authChange")
public void authChange(@RequestBody XpackSysAuthRequest request){
AuthXpackService sysAuthService = SpringContextUtil.getBean(AuthXpackService.class);
CurrentUserDto user = AuthUtils.getUser();
sysAuthService.authChange(request, user.getUserId(), user.getUsername(), user.getIsAdmin());
}
}

View File

@ -16,7 +16,7 @@ import java.util.stream.Collectors;
@RequestMapping("/plugin/dept")
@RestController
public class DeptServer {
public class XDeptServer {
@PostMapping("/childNodes/{pid}")
public List<DeptNodeResponse> childNodes(@PathVariable("pid") Long pid){

View File

@ -3,7 +3,7 @@ package io.dataease.plugins.server;
import io.dataease.plugins.config.SpringContextUtil;
import io.dataease.plugins.xpack.display.dto.response.SysSettingDto;
import io.dataease.plugins.xpack.display.service.DisPlayXpackService;
import io.dataease.plugins.xpack.display.service.DisplayXpackService;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
@ -11,20 +11,20 @@ import java.util.Map;
@RequestMapping("/api/display")
@RestController
public class DisplayServer {
public class XDisplayServer {
@GetMapping("/uiInfo")
public List<SysSettingDto> uiInfo() {
DisPlayXpackService disPlayXpackService = SpringContextUtil.getBean(DisPlayXpackService.class);
DisplayXpackService disPlayXpackService = SpringContextUtil.getBean(DisplayXpackService.class);
return disPlayXpackService.systemSettings();
}
@PostMapping(value="/save", consumes = {"multipart/form-data"})
public void saveUIInfo(@RequestPart("request") Map<String,List<SysSettingDto>> systemParameterMap, @RequestPart(value = "files", required = false) List<MultipartFile> bodyFiles) throws Exception {
DisPlayXpackService disPlayXpackService = SpringContextUtil.getBean(DisPlayXpackService.class);
DisplayXpackService disPlayXpackService = SpringContextUtil.getBean(DisplayXpackService.class);
disPlayXpackService.save(systemParameterMap, bodyFiles);
}

View File

@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.List;
@RequestMapping("/plugin/role")
@RestController
public class RoleServer {
public class XRoleServer {
@PostMapping("/create")

View File

@ -41,7 +41,8 @@ export const filterAsyncRouter = (routers) => { // 遍历后台传来的路由
router.component = 'system/plugin/dynamic'
router.props = {
jsname: jsName,
menuid: router.id
menuid: router.id,
noLayout: router.noLayout
}
}
if (router.component) {

View File

@ -2,13 +2,13 @@
<de-main-container style="height: calc(100vh - 56px)">
<el-tabs v-model="authorityType" @tab-click="handleClick">
<el-tab-pane name="authConfig">
<span slot="label">{{$t('auth.authConfig')}}</span>
<span slot="label">{{ $t('auth.authConfig') }}</span>
<auth-config />
</el-tab-pane>
<!-- <el-tab-pane name="authQuickConfig">-->
<!-- <span slot="label">{{$t('auth.authQuickConfig')}}</span>-->
<!-- <auth-quick-config />-->
<!-- </el-tab-pane>-->
<!-- <el-tab-pane name="authQuickConfig">-->
<!-- <span slot="label">{{$t('auth.authQuickConfig')}}</span>-->
<!-- <auth-quick-config />-->
<!-- </el-tab-pane>-->
</el-tabs>
</de-main-container>
</template>

View File

@ -1,10 +1,17 @@
<template>
<layout-content v-loading="$store.getters.loadingMap[$store.getters.currentPath]" :header="header" :back-name="backName">
<layout-content v-if="!noLayout" v-loading="$store.getters.loadingMap[$store.getters.currentPath]" :header="header" :back-name="backName">
<async-component v-if="showAsync" :url="url" @execute-axios="executeAxios" @on-add-languanges="addLanguages" @on-plugin-layout="setLayoutInfo" />
<div v-else>
<h1>未知组件无法展示</h1>
</div>
</layout-content>
<div v-else>
<async-component v-if="showAsync" :url="url" @execute-axios="executeAxios" @on-add-languanges="addLanguages" @on-plugin-layout="setLayoutInfo" />
<div v-else>
<h1>未知组件无法展示</h1>
</div>
</div>
</template>
<script>
@ -26,6 +33,10 @@ export default {
menuid: {
type: Number,
default: null
},
noLayout: {
type: Boolean,
default: false
}
},
data() {