|
@@ -3,12 +3,6 @@
|
|
|
<div class="part-box part-box-filter part-box-flex">
|
|
|
<el-form ref="FilterForm" label-position="left" label-width="85px" inline>
|
|
|
<template v-if="checkPrivilege('condition', 'condition')">
|
|
|
- <el-form-item label="所在机构:">
|
|
|
- <org-select
|
|
|
- v-model="filter.orgId"
|
|
|
- placeholder="所在机构"
|
|
|
- ></org-select>
|
|
|
- </el-form-item>
|
|
|
<el-form-item label="关键词:" label-width="75px">
|
|
|
<el-input
|
|
|
style="width: 180px;"
|
|
@@ -17,37 +11,6 @@
|
|
|
clearable
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="角色:" label-width="55px">
|
|
|
- <el-select
|
|
|
- v-model="filter.roleId"
|
|
|
- style="width: 142px;"
|
|
|
- placeholder="角色"
|
|
|
- filterable
|
|
|
- clearable
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="item in roles"
|
|
|
- :key="item.id"
|
|
|
- :value="item.id"
|
|
|
- :label="item.name"
|
|
|
- ></el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="启用/禁用:" label-width="90px">
|
|
|
- <el-select
|
|
|
- v-model="filter.enable"
|
|
|
- style="width: 120px;"
|
|
|
- placeholder="启用/禁用"
|
|
|
- clearable
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="(val, key) in ABLE_TYPE"
|
|
|
- :key="key"
|
|
|
- :value="key * 1"
|
|
|
- :label="val"
|
|
|
- ></el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
</template>
|
|
|
|
|
|
<el-form-item label-width="0px">
|
|
@@ -61,12 +24,12 @@
|
|
|
</el-form>
|
|
|
<div class="part-box-action">
|
|
|
<el-button
|
|
|
- v-if="checkPrivilege('button', 'SyncUser')"
|
|
|
- type="primary"
|
|
|
- icon="el-icon-refresh"
|
|
|
+ v-if="checkPrivilege('button', 'batchDelete')"
|
|
|
+ type="danger"
|
|
|
+ icon="el-icon-delete"
|
|
|
:loading="loading"
|
|
|
- @click="syncUser"
|
|
|
- >同步用户</el-button
|
|
|
+ @click="batchDelete"
|
|
|
+ >批量删除</el-button
|
|
|
>
|
|
|
<el-button
|
|
|
type="success"
|
|
@@ -97,7 +60,16 @@
|
|
|
</div>
|
|
|
|
|
|
<div class="part-box part-box-pad">
|
|
|
- <el-table ref="TableList" :data="users">
|
|
|
+ <el-table
|
|
|
+ ref="TableList"
|
|
|
+ :data="users"
|
|
|
+ @selection-change="handleSelectionChange"
|
|
|
+ >
|
|
|
+ <el-table-column
|
|
|
+ type="selection"
|
|
|
+ width="55"
|
|
|
+ align="center"
|
|
|
+ ></el-table-column>
|
|
|
<el-table-column
|
|
|
type="index"
|
|
|
label="序号"
|
|
@@ -110,7 +82,6 @@
|
|
|
label="姓名"
|
|
|
width="120"
|
|
|
></el-table-column>
|
|
|
- <el-table-column prop="code" label="工号"></el-table-column>
|
|
|
<el-table-column
|
|
|
prop="mobileNumber"
|
|
|
label="手机号"
|
|
@@ -130,7 +101,7 @@
|
|
|
<el-table-column
|
|
|
class-name="action-column"
|
|
|
label="操作"
|
|
|
- width="160px"
|
|
|
+ width="200px"
|
|
|
fixed="right"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
@@ -148,6 +119,13 @@
|
|
|
@click="toEnable(scope.row)"
|
|
|
>{{ scope.row.enable ? "禁用" : "启用" }}</el-button
|
|
|
>
|
|
|
+ <el-button
|
|
|
+ v-if="checkPrivilege('link', 'delete')"
|
|
|
+ class="btn-danger"
|
|
|
+ type="text"
|
|
|
+ @click="toDelete(scope.row)"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
<el-button
|
|
|
v-if="checkPrivilege('link', 'reset')"
|
|
|
class="btn-danger"
|
|
@@ -183,15 +161,13 @@
|
|
|
|
|
|
<script>
|
|
|
import ModifyUser from "../components/ModifyUser";
|
|
|
-import { ABLE_TYPE } from "@/constants/enumerate";
|
|
|
import {
|
|
|
userListPage,
|
|
|
ableUser,
|
|
|
resetPwd,
|
|
|
userRoleListPage,
|
|
|
- syncUserToEcs
|
|
|
+ deleteUser
|
|
|
} from "../api";
|
|
|
-// import { logout } from "@/modules/login/api";
|
|
|
import UploadButton from "../../../components/UploadButton";
|
|
|
|
|
|
export default {
|
|
@@ -200,20 +176,18 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
filter: {
|
|
|
- orgId: "",
|
|
|
- userInfo: "",
|
|
|
- roleId: "",
|
|
|
- enable: ""
|
|
|
+ userInfo: ""
|
|
|
},
|
|
|
current: 1,
|
|
|
size: this.GLOBAL.pageSize,
|
|
|
total: 0,
|
|
|
visible: false,
|
|
|
- ABLE_TYPE,
|
|
|
+ multipleSelection: [],
|
|
|
roles: [],
|
|
|
users: [],
|
|
|
curUser: {},
|
|
|
loading: false,
|
|
|
+ userId: this.$ls.get("user", { id: "" }).id,
|
|
|
// import
|
|
|
uploadUrl: "/api/admin/sys/user/import",
|
|
|
downloadUrl: "/temps/userTemplate.xlsx",
|
|
@@ -243,8 +217,6 @@ export default {
|
|
|
pageNumber: this.current,
|
|
|
pageSize: this.size
|
|
|
};
|
|
|
- if (datas.enable !== null && datas.enable !== "")
|
|
|
- datas.enable = !!datas.enable;
|
|
|
const data = await userListPage(datas);
|
|
|
this.users = data.records;
|
|
|
this.total = data.total;
|
|
@@ -253,10 +225,12 @@ export default {
|
|
|
this.current = page;
|
|
|
this.getList();
|
|
|
},
|
|
|
+ handleSelectionChange(val) {
|
|
|
+ this.multipleSelection = val.map(item => item.id);
|
|
|
+ },
|
|
|
toEnable(row) {
|
|
|
// 自己不可以启用/禁用自己
|
|
|
- const userId = this.$ls.get("user", { id: "" }).id;
|
|
|
- if (row.id === userId) {
|
|
|
+ if (row.id === this.userId) {
|
|
|
this.$message.error("不可以启用/禁用自己!");
|
|
|
return;
|
|
|
}
|
|
@@ -293,14 +267,38 @@ export default {
|
|
|
// if (row.id !== userId) return;
|
|
|
// this.toLogout();
|
|
|
},
|
|
|
- async syncUser() {
|
|
|
- if (this.loading) return;
|
|
|
- this.loading = true;
|
|
|
- const res = await syncUserToEcs().catch(() => {});
|
|
|
- this.loading = false;
|
|
|
+ async batchDelete() {
|
|
|
+ if (!this.multipleSelection.length) {
|
|
|
+ this.$message.error("请选择要删除的数据");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const res = await this.$confirm(
|
|
|
+ `确定要删除用户选中的这些用户吗?`,
|
|
|
+ "提示",
|
|
|
+ {
|
|
|
+ type: "warning"
|
|
|
+ }
|
|
|
+ ).catch(() => {});
|
|
|
+ if (res !== "confirm") return;
|
|
|
+
|
|
|
+ await deleteUser(this.multipleSelection);
|
|
|
+ this.$message.success("操作成功!");
|
|
|
+ this.deletePageLastItem(this.multipleSelection.length);
|
|
|
+ this.multipleSelection = [];
|
|
|
+ },
|
|
|
+ async toDelete(row) {
|
|
|
+ const res = await this.$confirm(
|
|
|
+ `确定要删除用户【${row.realName}】吗??`,
|
|
|
+ "提示",
|
|
|
+ {
|
|
|
+ type: "warning"
|
|
|
+ }
|
|
|
+ ).catch(() => {});
|
|
|
+ if (res !== "confirm") return;
|
|
|
|
|
|
- if (!res) return;
|
|
|
- this.$message.success("同步任务已经提交!");
|
|
|
+ await deleteUser([row.id]);
|
|
|
+ this.$message.success("操作成功!");
|
|
|
+ this.deletePageLastItem();
|
|
|
},
|
|
|
// async toLogout() {
|
|
|
// await logout();
|