|
@@ -2,6 +2,18 @@
|
|
|
<div class="table_container">
|
|
|
<div class="title_examine">
|
|
|
<div class="pub_title">账号审核</div>
|
|
|
+
|
|
|
+ <div style="margin-left: auto">
|
|
|
+ <el-button v-if="type == 0" type="primary" size="small" @click="bactchConfirm(1)"
|
|
|
+ >批量通过</el-button
|
|
|
+ >
|
|
|
+ <el-button v-if="type == 0" type="primary" size="small" @click="bactchConfirm(2)"
|
|
|
+ >批量忽略</el-button
|
|
|
+ >
|
|
|
+ <el-button v-if="type == 2" type="primary" size="small" @click="bactchConfirm(0)"
|
|
|
+ >批量操作</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div class="table_content">
|
|
|
<div class="button_top">
|
|
@@ -32,7 +44,7 @@
|
|
|
color: type == 2 ? 'black' : 'rgb(179, 179, 179)',
|
|
|
fontWeight: 'bold',
|
|
|
}"
|
|
|
- >已拒绝({{ RefusedData }})</a
|
|
|
+ >已忽略({{ RefusedData }})</a
|
|
|
>
|
|
|
</div>
|
|
|
<div class="examine_title">
|
|
@@ -57,13 +69,26 @@
|
|
|
border
|
|
|
style="width: 100%"
|
|
|
:header-cell-style="headerCellStyle"
|
|
|
+ @selection-change="handleSelectionChange"
|
|
|
+ :row-key="(row) => row.id"
|
|
|
+ ref="rtable"
|
|
|
+ @sort-change="onSortChange"
|
|
|
>
|
|
|
- <el-table-column label="组织名称" min-width="45" show-overflow-tooltip>
|
|
|
+ <el-table-column type="selection" width="50px"></el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="组织名称"
|
|
|
+ min-width="45"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
<template slot-scope="scope">{{
|
|
|
scope.row.orgName ? scope.row.orgName : "-"
|
|
|
}}</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="学校名字" min-width="45" show-overflow-tooltip>
|
|
|
+ <el-table-column
|
|
|
+ label="学校名字"
|
|
|
+ min-width="45"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
<template slot-scope="scope">{{
|
|
|
scope.row.schoolName ? scope.row.schoolName : "-"
|
|
|
}}</template>
|
|
@@ -91,8 +116,18 @@
|
|
|
<el-table-column
|
|
|
prop="time"
|
|
|
label="提交时间"
|
|
|
- min-width="45"
|
|
|
+ width="180px"
|
|
|
+ sortable="custom"
|
|
|
></el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="utime"
|
|
|
+ label="审核时间"
|
|
|
+ width="180px"
|
|
|
+ sortable="custom"
|
|
|
+ v-if="type !== 0"
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">{{scope.row.utime ? scope.row.utime : '-'}}</template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="状态" min-width="45">
|
|
|
<template slot-scope="scope">{{
|
|
|
getStatusText(scope.row.type)
|
|
@@ -103,9 +138,10 @@
|
|
|
label="备注"
|
|
|
min-width="45"
|
|
|
></el-table-column>
|
|
|
- <el-table-column label="操作" width="150px" v-if="type == 0">
|
|
|
+ <el-table-column label="操作" width="150px" v-if="type == 0 || type == 2">
|
|
|
<template slot-scope="{ row }">
|
|
|
<button
|
|
|
+ v-if="type == 0"
|
|
|
@click="ajax_move_user(1, row)"
|
|
|
style="
|
|
|
color: #308fff;
|
|
@@ -118,6 +154,7 @@
|
|
|
通过
|
|
|
</button>
|
|
|
<button
|
|
|
+ v-if="type == 0"
|
|
|
@click="ajax_move_user(2, row)"
|
|
|
style="
|
|
|
color: #ff2570;
|
|
@@ -127,7 +164,20 @@
|
|
|
margin-left: 35px;
|
|
|
"
|
|
|
>
|
|
|
- 拒绝
|
|
|
+ 忽略
|
|
|
+ </button>
|
|
|
+ <button
|
|
|
+ v-if="type == 2"
|
|
|
+ @click="ajax_move_user(0, row)"
|
|
|
+ style="
|
|
|
+ color: #308fff;
|
|
|
+ background: none;
|
|
|
+ border: none;
|
|
|
+ cursor: pointer;
|
|
|
+ margin-left: 25px;
|
|
|
+ "
|
|
|
+ >
|
|
|
+ 移动至待审核
|
|
|
</button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -149,8 +199,8 @@
|
|
|
|
|
|
<script>
|
|
|
import { API_CONFIG } from "@/common/apiConfig";
|
|
|
-import { mapGetters } from 'vuex';
|
|
|
-import { addUser } from "@/api/user.js"
|
|
|
+import { mapGetters } from "vuex";
|
|
|
+import { addUser } from "@/api/user.js";
|
|
|
|
|
|
export default {
|
|
|
name: "IndexTable",
|
|
@@ -178,10 +228,14 @@ export default {
|
|
|
approvedData: 0,
|
|
|
RefusedData: 0,
|
|
|
AllData: 0,
|
|
|
+ checkArray: [],
|
|
|
+ checkArray2: [],
|
|
|
+ sortF: "add_time",
|
|
|
+ sortO: "DESC",
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
- ...mapGetters(['userid']),
|
|
|
+ ...mapGetters(["userid"]),
|
|
|
},
|
|
|
methods: {
|
|
|
// 获取状态文本
|
|
@@ -189,7 +243,7 @@ export default {
|
|
|
const statusMap = {
|
|
|
0: "待审核",
|
|
|
1: "已通过",
|
|
|
- 2: "已拒绝",
|
|
|
+ 2: "已忽略",
|
|
|
};
|
|
|
return statusMap[status] || "未知状态";
|
|
|
},
|
|
@@ -199,7 +253,7 @@ export default {
|
|
|
const typeMap = {
|
|
|
0: "primary", // 待审核 -> 蓝色
|
|
|
1: "success", // 已通过 -> 绿色
|
|
|
- 2: "danger", // 已拒绝 -> 红色
|
|
|
+ 2: "danger", // 已忽略 -> 红色
|
|
|
};
|
|
|
return typeMap[status] || "default"; // 默认为默认按钮类型
|
|
|
},
|
|
@@ -213,30 +267,43 @@ export default {
|
|
|
this.ajaxAll();
|
|
|
},
|
|
|
showData(type) {
|
|
|
- this.type = type
|
|
|
- this.ajaxAll()
|
|
|
+ this.sortF = "add_time"
|
|
|
+ this.sortO = "DESC"
|
|
|
+ this.type = type;
|
|
|
+ this.$refs.rtable.clearSort();
|
|
|
+ this.ajaxAll();
|
|
|
+ },
|
|
|
+ handleSelectionChange(selectedRows) {
|
|
|
+ console.log(selectedRows);
|
|
|
+
|
|
|
+ this.checkArray = selectedRows.map((row) => row.id);
|
|
|
+ this.checkArray2 = selectedRows
|
|
|
},
|
|
|
// 用于显示全部记录的表格数据
|
|
|
ajaxAll() {
|
|
|
console.log("获取所有记录");
|
|
|
// 根据 allRecords 配置生成请求
|
|
|
- const params = [{
|
|
|
- functionName: API_CONFIG.allRecords.functionName,
|
|
|
- r_type: this.type == 3 ? '' : this.type,
|
|
|
- page: API_CONFIG.allRecords.page,
|
|
|
- r_num: API_CONFIG.allRecords.num,
|
|
|
- }];
|
|
|
- this.currentTableData = []
|
|
|
+ const params = [
|
|
|
+ {
|
|
|
+ functionName: API_CONFIG.allRecords.functionName,
|
|
|
+ r_type: this.type == 3 ? '""' : this.type,
|
|
|
+ page: API_CONFIG.allRecords.page,
|
|
|
+ r_num: API_CONFIG.allRecords.num,
|
|
|
+ sort_field: this.sortF,
|
|
|
+ sort_order: this.sortO
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ this.currentTableData = [];
|
|
|
this.$ajax
|
|
|
.post(API_CONFIG.baseUrl, params)
|
|
|
.then((res) => {
|
|
|
if (res.data) {
|
|
|
this.currentTableData = res.data[0];
|
|
|
- this.total = res.data[0].length ? res.data[0][0].total_count : 0
|
|
|
- this.tableData = res.data[1][0].num
|
|
|
- this.approvedData = res.data[2][0].num
|
|
|
- this.RefusedData = res.data[3][0].num
|
|
|
- this.AllData = res.data[4][0].num
|
|
|
+ this.total = res.data[0].length ? res.data[0][0].total_count : 0;
|
|
|
+ this.tableData = res.data[1][0].num;
|
|
|
+ this.approvedData = res.data[2][0].num;
|
|
|
+ this.RefusedData = res.data[3][0].num;
|
|
|
+ this.AllData = res.data[4][0].num;
|
|
|
}
|
|
|
console.log("返回的结果为:", res.data);
|
|
|
})
|
|
@@ -244,7 +311,7 @@ export default {
|
|
|
console.error("请求失败,错误信息:", err);
|
|
|
});
|
|
|
},
|
|
|
- addUser(row){
|
|
|
+ addUser(row) {
|
|
|
let params = {
|
|
|
alias: row.name,
|
|
|
username: row.username,
|
|
@@ -256,35 +323,92 @@ export default {
|
|
|
opid: "",
|
|
|
dest: "",
|
|
|
eduid: "",
|
|
|
- }
|
|
|
+ };
|
|
|
addUser(params)
|
|
|
.then((response) => {
|
|
|
- if(response){
|
|
|
+ if (response) {
|
|
|
this.$message({
|
|
|
type: "success",
|
|
|
- message: '操作成功',
|
|
|
+ message: "操作成功",
|
|
|
});
|
|
|
- this.ajaxAll(); // 例如刷新表格数据
|
|
|
+ this.ajaxAll(); // 例如刷新表格数据
|
|
|
}
|
|
|
})
|
|
|
.catch((error) => {
|
|
|
console.error("请求失败,错误信息:", error);
|
|
|
});
|
|
|
},
|
|
|
- // 忽略操作,将数据移到已拒绝
|
|
|
- ajax_move_user(type, row) {
|
|
|
- let string = ''
|
|
|
- if(type == 1){
|
|
|
- string = '您确定同意此用户申请并创建吗?'
|
|
|
- }else if(type == 2){
|
|
|
- string = '您确定拒绝此用户申请吗?'
|
|
|
+ async bactchConfirm(type) {
|
|
|
+ if (!this.checkArray.length) {
|
|
|
+ this.$message.error(`请选择要操作的用户`);
|
|
|
+ return;
|
|
|
}
|
|
|
- let _type = 0
|
|
|
- if(type == 1){
|
|
|
- _type = 1
|
|
|
- }else if(type == 2){
|
|
|
- _type = 2
|
|
|
+
|
|
|
+ const confirmationMessage = type === 1 ? "您确定同意这些用户申请并创建吗?" : type ==0 ? "您确定将这些用户移动至待审核吗?" : "您确定忽略这些用户申请吗?";
|
|
|
+ const requestType = type;
|
|
|
+
|
|
|
+ // 弹出确认框
|
|
|
+ this.$confirm(confirmationMessage, "确认操作", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ })
|
|
|
+ .then(async () => {
|
|
|
+ for (const row of this.checkArray2) {
|
|
|
+ // 确认后发起请求
|
|
|
+ const params = [{
|
|
|
+ functionName: API_CONFIG.moveUser.functionName,
|
|
|
+ uid: row.id,
|
|
|
+ type: requestType,
|
|
|
+ euid: this.userid,
|
|
|
+ }];
|
|
|
+
|
|
|
+ try {
|
|
|
+ const res = await this.$ajax.post(API_CONFIG.baseUrl, params);
|
|
|
+ console.log(res);
|
|
|
+ if (type === 1) {
|
|
|
+ await this.addUser(row);
|
|
|
+ } else {
|
|
|
+ this.$message.success("操作成功");
|
|
|
+ }
|
|
|
+ console.log("此条数据处理后的id为:", row.id);
|
|
|
+ } catch (err) {
|
|
|
+ this.$message.error("操作失败");
|
|
|
+ console.error("请求失败,错误信息:", err);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 所有请求完成后刷新表格数据
|
|
|
+ await this.ajaxAll();
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ // 取消操作后的提示
|
|
|
+ });
|
|
|
+ },
|
|
|
+ onSortChange({ prop, order }){
|
|
|
+ if(order){
|
|
|
+ this.sortF = prop == 'time' ? 'add_time' : 'update_time'
|
|
|
+ this.sortO = order == 'descending' ? 'DESC' : 'ASC'
|
|
|
+ }else{
|
|
|
+ this.sortF = 'add_time'
|
|
|
+ this.sortO = 'DESC'
|
|
|
}
|
|
|
+ this.ajaxAll()
|
|
|
+ console.log(prop, order);
|
|
|
+
|
|
|
+ },
|
|
|
+ // 忽略操作,将数据移到已忽略
|
|
|
+ ajax_move_user(type, row) {
|
|
|
+ let string = "";
|
|
|
+ if (type == 1) {
|
|
|
+ string = "您确定同意此用户申请并创建吗?";
|
|
|
+ } else if (type == 2) {
|
|
|
+ string = "您确定忽略此用户申请吗?";
|
|
|
+ } else if (type == 0) {
|
|
|
+ string = "您确定将此用户移动至待审核吗?";
|
|
|
+ }
|
|
|
+ let _type = type;
|
|
|
+
|
|
|
// 弹出确认框
|
|
|
this.$confirm(string, "确认操作", {
|
|
|
confirmButtonText: "确定",
|
|
@@ -295,10 +419,10 @@ export default {
|
|
|
// 确认后发起请求
|
|
|
let params = [
|
|
|
{
|
|
|
- functionName: API_CONFIG.moveUser.functionName, // 这里是将数据移至已拒绝状态的操作,使用配置中的存储过程名称
|
|
|
+ functionName: API_CONFIG.moveUser.functionName, // 这里是将数据移至已忽略状态的操作,使用配置中的存储过程名称
|
|
|
uid: row.id,
|
|
|
type: _type,
|
|
|
- euid: this.userid
|
|
|
+ euid: this.userid,
|
|
|
},
|
|
|
];
|
|
|
|
|
@@ -307,15 +431,15 @@ export default {
|
|
|
.post(API_CONFIG.baseUrl, params)
|
|
|
.then((res) => {
|
|
|
console.log(res);
|
|
|
- if(type == 1){
|
|
|
- this.addUser(row)
|
|
|
- }else{
|
|
|
- this.$message({
|
|
|
- type: "success",
|
|
|
- message: '操作成功',
|
|
|
- });
|
|
|
- // 更新数据状态
|
|
|
- this.ajaxAll(); // 例如刷新表格数据
|
|
|
+ if (type == 1) {
|
|
|
+ this.addUser(row);
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "操作成功",
|
|
|
+ });
|
|
|
+ // 更新数据状态
|
|
|
+ this.ajaxAll(); // 例如刷新表格数据
|
|
|
}
|
|
|
|
|
|
console.log("此条数据处理后的id为:", row.id);
|
|
@@ -327,13 +451,8 @@ export default {
|
|
|
})
|
|
|
.catch(() => {
|
|
|
// 取消操作后的提示
|
|
|
- this.$message({
|
|
|
- type: "info",
|
|
|
- message: "已取消操作",
|
|
|
- });
|
|
|
});
|
|
|
},
|
|
|
-
|
|
|
},
|
|
|
mounted() {
|
|
|
this.ajaxAll(); // 组件挂载后调用 ajaxAll 方法
|