perf(系统管理-用户管理): 用户批量导入

This commit is contained in:
fit2cloud-chenyw 2022-08-16 14:08:11 +08:00
parent fe73dc2888
commit ae0d69e258
5 changed files with 52 additions and 8 deletions

View File

@ -107,10 +107,7 @@
<artifactId>shiro-spring</artifactId>
<version>${shiro.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>

View File

@ -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);
}
}

View File

@ -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)
}

View File

@ -975,3 +975,6 @@ div:focus {
border: none !important;
}
}
.user-import-class>.el-dialog__body {
padding-bottom: 1px;
}

View File

@ -10,6 +10,10 @@
@click="create"
>{{ $t("user.create") }}</el-button
>
<plugin-com v-if="isPluginLoaded" ref="ImportUserCom" component-name="ImportUser" />
</el-col>
<el-col :span="12" class="right-user">
<el-input
@ -290,6 +294,7 @@ const columnOptions = [
import DeLayoutContent from "@/components/business/DeLayoutContent";
import { addOrder, formatOrders } from "@/utils/index";
import { pluginLoaded, defaultPwd } from "@/api/user";
import bus from '@/utils/bus'
/* import { ldapStatus, pluginLoaded } from '@/api/user' */
import {
userLists,
@ -301,9 +306,10 @@ import {
import { mapGetters } from "vuex";
import filterUser from "./filterUser.vue";
import GridTable from "@/components/gridTable/index.vue";
import PluginCom from '@/views/system/plugin/PluginCom';
import _ from 'lodash';
export default {
components: { DeLayoutContent, GridTable, filterUser, userEditer },
components: { DeLayoutContent, GridTable, filterUser, userEditer, PluginCom },
data() {
return {
checkAll: true,
@ -369,6 +375,7 @@ export default {
},
},
mounted() {
bus.$on('reload-user-grid', this.search)
this.allRoles();
this.search();
document.addEventListener("keypress", this.entryKey);
@ -395,6 +402,7 @@ export default {
},
destroyed() {
document.removeEventListener("keypress", this.entryKey);
bus.$off('reload-user-grid', this.search)
},
methods: {
resizeObserver() {