From ae0d69e25826eea9904074aec778777fa0d45b5f Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Tue, 16 Aug 2022 14:08:11 +0800 Subject: [PATCH] =?UTF-8?q?perf(=E7=B3=BB=E7=BB=9F=E7=AE=A1=E7=90=86-?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=AE=A1=E7=90=86):=20=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=AF=BC=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/pom.xml | 5 +-- .../dataease/plugins/server/XUserServer.java | 33 +++++++++++++++++++ frontend/src/api/system/dynamic.js | 9 +++-- frontend/src/styles/index.scss | 3 ++ frontend/src/views/system/user/index.vue | 10 +++++- 5 files changed, 52 insertions(+), 8 deletions(-) create mode 100644 backend/src/main/java/io/dataease/plugins/server/XUserServer.java diff --git a/backend/pom.xml b/backend/pom.xml index 943f2b2737..da52fa1f95 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -107,10 +107,7 @@ shiro-spring ${shiro.version} - - org.springframework.boot - spring-boot-starter-validation - + org.apache.commons commons-lang3 diff --git a/backend/src/main/java/io/dataease/plugins/server/XUserServer.java b/backend/src/main/java/io/dataease/plugins/server/XUserServer.java new file mode 100644 index 0000000000..9b6ee5750c --- /dev/null +++ b/backend/src/main/java/io/dataease/plugins/server/XUserServer.java @@ -0,0 +1,33 @@ +package io.dataease.plugins.server; + +import io.dataease.plugins.config.SpringContextUtil; +import io.dataease.plugins.xpack.user.service.UserXpackService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; + +@Api(tags = "xpack:用户导入") +@RequestMapping("/plugin/user") +@RestController +public class XUserServer { + + @ApiOperation("下载模版") + @PostMapping("/template") + public void template(HttpServletResponse response) { + UserXpackService userXpackService = SpringContextUtil.getBean(UserXpackService.class); + userXpackService.templateDown(response); + } + + @ApiOperation("导入") + @PostMapping("/upload") + public void upload(@RequestPart(value = "file", required = true) MultipartFile file, HttpServletResponse response) throws Exception{ + UserXpackService userXpackService = SpringContextUtil.getBean(UserXpackService.class); + userXpackService.upload(file, response); + } +} diff --git a/frontend/src/api/system/dynamic.js b/frontend/src/api/system/dynamic.js index 053c405aaa..e16d914cca 100644 --- a/frontend/src/api/system/dynamic.js +++ b/frontend/src/api/system/dynamic.js @@ -13,11 +13,14 @@ export function execute(options) { return null } options.type = options.type || 'post' - - return request({ + const param = { url: options.url, method: options.type, loading: true, data: options.data - }) + } + if (options.responseType) { + param.responseType = options.responseType + } + return request(param) } diff --git a/frontend/src/styles/index.scss b/frontend/src/styles/index.scss index b4741d71da..45ed875c0d 100644 --- a/frontend/src/styles/index.scss +++ b/frontend/src/styles/index.scss @@ -975,3 +975,6 @@ div:focus { border: none !important; } } +.user-import-class>.el-dialog__body { + padding-bottom: 1px; +} diff --git a/frontend/src/views/system/user/index.vue b/frontend/src/views/system/user/index.vue index a677aa3a4f..7964fe9816 100644 --- a/frontend/src/views/system/user/index.vue +++ b/frontend/src/views/system/user/index.vue @@ -10,6 +10,10 @@ @click="create" >{{ $t("user.create") }} + + + +