This commit is contained in:
77
2024-08-03 19:19:18 +08:00
parent bd126f89f4
commit 1b861661d8
4 changed files with 509 additions and 0 deletions

View File

@@ -0,0 +1,91 @@
<template>
<el-dialog :title="title" :close-on-click-modal="false" :visible.sync="open" width="700px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="账户号" prop="cardAccount">
<el-input v-model="form.cardAccount" placeholder="请输入账户号" />
</el-form-item>
<el-form-item label="账户名称" prop="cardName">
<el-input v-model="form.cardName" placeholder="请输入账户名称" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="open = false"> </el-button>
</div>
</el-dialog>
</template>
<script>
import {addAccountBlack, getAccountBlack, updateAccountBlack} from "@/api/cai/accountBlack";
export default {
components: {
},
data () {
return {
open: false,
title: '',
form:{
id: undefined,
cardAccount: undefined,
cardName: undefined,
},
// 表单校验
rules: {
cardAccount: [
{ required: true, message: "银行名称不能为空", trigger: "blur" }
],
cardName: [
{ required: true, message: "账户名称不能为空", trigger: "blur" }
],
},
buttonLoading: false,
}
},
created() {
},
methods: {
init (id) {
this.form.id = id || undefined;
this.title = (id ? "修改" : "新增") + "账户黑名单";
this.open = true;
this.$nextTick(() => {
this.$refs['form'].resetFields();
if(this.form.id){
getAccountBlack(id).then(response => {
this.form = response.data;
});
}
})
},
// 表单提交
submitForm () {
this.$refs['form'].validate((valid) => {
if (valid) {
this.buttonLoading = true;
if (this.form.id != null) {
updateAccountBlack(this.form).then(data => {
this.$modal.msgSuccess("修改成功");
this.$modal.buttonLoading = false;
this.open = false
this.$emit('refreshDataList')
}).finally(() => {
this.buttonLoading = false;
});
}else{
addAccountBlack(this.form).then(data => {
this.$modal.msgSuccess("新增成功");
this.buttonLoading = false;
this.open = false
this.$emit('refreshDataList')
}).finally(() => {
this.buttonLoading = false;
});
}
}
})
},
}
}
</script>

View File

@@ -0,0 +1,135 @@
<template>
<el-dialog :title="title" :close-on-click-modal="false" :visible.sync="open" width="1200px" append-to-body>
<el-table v-loading="loading" :data="userList" >
<el-table-column label="状态" align="center" prop="status">
<template v-slot="scope">
<cai-dict-tag :options="userStatusList" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column :label="systemName+'号'" align="center" prop="usercode" />
<el-table-column label="账户号" align="center" prop="cardAccount" />
<el-table-column label="账户名称" align="center" prop="cardName" />
<el-table-column label="昵称" align="center" prop="nickname" />
<el-table-column label="手机号" align="center" prop="mobile" width="120"/>
<el-table-column label="头像" align="center" prop="avatar" >
<template v-slot="scope">
<image-avatar :src="scope.row.avatar"/>
</template>
</el-table-column>
<el-table-column label="性别" align="center" prop="gender">
<template v-slot="scope">
<cai-dict-tag :options="genderList" :value="scope.row.gender" />
</template>
</el-table-column>
<el-table-column label="主播" align="center" prop="isAnchor">
<template v-slot="scope">
<cai-dict-tag :options="isAnchorList" :value="scope.row.isAnchor"/>
</template>
</el-table-column>
<el-table-column label="最后登陆时间" align="center" prop="lastLoginTime" width="150"/>
<el-table-column label="登陆IP" align="center" prop="lastLoginIp" width="125"/>
<el-table-column label="注册时间" align="center" prop="regTime" width="150"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120" fixed="right">
<template v-slot="scope">
<el-button
size="mini"
type="text"
@click="handleInfo(scope.row)"
>详情</el-button>
<el-button
size="mini"
type="text"
@click="handleUserForbid(scope.row)"
v-hasPermi="['cai:user:lock']"
>封禁</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<user-info-dialog v-if="userInfoDialogVisible" ref="userInfoDialog" />
<user-forbid-dialog v-if="userForbidVisible" ref="userForbid" @refreshDataList="getList" />
</el-dialog>
</template>
<script>
import {
authList,
genderList,
isAnchorList,
onlineStatusList,
userStatusList,
videoStatusList
} from "@/constant/statusMap";
import UserInfoDialog from "@/views/cai/user/user-info-dialog.vue";
import UserForbidDialog from "@/views/cai/user/user-forbid-dialog.vue";
import {listAccountBlackUser} from "@/api/cai/accountBlack";
export default {
components: {
UserForbidDialog,
UserInfoDialog
},
data () {
return {
genderList,authList,userStatusList,isAnchorList,videoStatusList,onlineStatusList,
systemName: process.env.VUE_APP_SYSTEM_HOME,
userInfoDialogVisible: false,
userForbidVisible: false,
open: false,
title: '',
loading: false,
// 总条数
total: 0,
// 用户表格数据
userList: [],
queryParams: {
pageNum: 1,
pageSize: 10,
cardAccount: undefined,
cardName: undefined,
}
}
},
created() {
},
methods: {
init (row) {
this.title = "账户黑名单命中用户";
this.open = true;
this.$nextTick(() => {
this.queryParams.cardAccount = row.cardAccount;
this.queryParams.cardName = row.cardName;
this.getList();
})
},
/** 查询用户列表 */
getList() {
this.loading = true;
listAccountBlackUser(this.queryParams).then(response => {
this.userList = response.rows;
this.total = response.total;
this.loading = false;
});
},
handleInfo(row){
this.userInfoDialogVisible = true
this.$nextTick(() => {
this.$refs.userInfoDialog.init(row.id)
})
},
handleUserForbid(row){
this.userForbidVisible = true
this.$nextTick(() => {
this.$refs.userForbid.init(row.id)
})
},
}
}
</script>

View File

@@ -0,0 +1,230 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="账户号" prop="cardAccount">
<el-input
v-model="queryParams.cardAccount"
placeholder="请输入账户号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="账户名称" prop="cardName">
<el-input
v-model="queryParams.cardName"
placeholder="请输入账户名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['cai:accountBlack:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['cai:accountBlack:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['cai:accountBlack:remove']"
>删除</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="accountBlackList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="id" align="center" prop="id" v-if="true"/>
<el-table-column label="账户号" align="center" prop="cardAccount" />
<el-table-column label="账户名称" align="center" prop="cardName" />
<el-table-column label="是否开启" align="center" prop="enableStatus">
<template v-slot="scope">
<el-switch
v-model="scope.row.enableStatus"
:active-value="1"
:inactive-value="0"
@change="handleStatusChange(scope.row)"
></el-switch>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template v-slot="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['cai:accountBlack:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['cai:accountBlack:remove']"
>删除</el-button>
<el-button
size="mini"
type="text"
@click="handleUser(scope.row)"
>命中用户</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<account-black-add-update-dialog v-if="accountBlackAddUpdateDialogVisible" ref="accountBlackAddUpdateDialog" @refreshDataList="getList" />
<account-black-user-dialog v-if="accountBlackUserDialogVisible" ref="accountBlackUserDialog" />
</div>
</template>
<script>
import {delAccountBlack, listAccountBlack, updateAccountBlack} from "@/api/cai/accountBlack";
import AccountBlackAddUpdateDialog from "@/views/cai/accountBlack/account-black-add-update-dialog.vue";
import AccountBlackUserDialog from "@/views/cai/accountBlack/account-black-user-dialog.vue";
export default {
name: "AccountBlack",
components: {AccountBlackAddUpdateDialog,AccountBlackUserDialog},
data() {
return {
accountBlackAddUpdateDialogVisible: false,
accountBlackUserDialogVisible: false,
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 账户黑名单表格数据
accountBlackList: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
cardAccount: undefined,
cardName: undefined,
},
};
},
created() {
this.getList();
},
methods: {
/** 查询账户黑名单列表 */
getList() {
this.loading = true;
listAccountBlack(this.queryParams).then(response => {
this.accountBlackList = response.rows;
this.total = response.total;
this.loading = false;
});
},
handleUser(row){
this.accountBlackUserDialogVisible = true
this.$nextTick(() => {
this.$refs.accountBlackUserDialog.init(row)
})
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.accountBlackAddUpdateDialogVisible = true
this.$nextTick(() => {
this.$refs.accountBlackAddUpdateDialog.init()
})
},
/** 修改按钮操作 */
handleUpdate(row) {
this.accountBlackAddUpdateDialogVisible = true
this.$nextTick(() => {
this.$refs.accountBlackAddUpdateDialog.init(row.id)
})
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除账户黑名单编号为"' + ids + '"的数据项?').then(() => {
this.loading = true;
return delAccountBlack(ids);
}).then(() => {
this.loading = false;
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
}).finally(() => {
this.loading = false;
});
},
handleStatusChange(row){
let text = row.enableStatus === 1 ? '开启' : '关闭'
this.$confirm('确认要' + text + '[' + row.cardName + ']账号黑名单吗?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
return updateAccountBlack({ id: row.id, enableStatus: row.enableStatus })
}).then(() => {
this.$modal.msgSuccess(text + '成功')
}).catch(function() {
console.log("操作失败")
row.enableStatus = row.enableStatus === 0 ? 1 : 0
})
}
}
};
</script>