账号管理

This commit is contained in:
余同学 2025-01-13 18:05:14 +08:00
parent fe7b82f00e
commit 4db5bd6e02
5 changed files with 378 additions and 1 deletions

View File

@ -0,0 +1,36 @@
import $http from "@/utils/httpRequest.js";
//账号管理
export const accountNumber = {
//账号列表
accountPage: (data) => {
return $http.request({
url: `/merchant-api/unify/account/page`,
method: "get",
params: data,
});
},
//添加账号
addAccount: (data) => {
return $http.request({
url: `/merchant-api/unify/account/add`,
method: "post",
data: data,
});
},
//编辑账号
updateAccount: (data) => {
return $http.request({
url: `/merchant-api/unify/account/update`,
method: "post",
data: data,
});
},
//删除账号
deleteAccount: (data) => {
return $http.request({
url: `/merchant-api/unify/account/delete`,
method: "post",
data: data,
});
},
};

View File

@ -130,6 +130,19 @@ export default {
open: null, open: null,
list: [], list: [],
}, },
{
menuId: getUUID(),
parentId: 0,
parentName: null,
name: "账号管理",
url: "operation-management/accountNumber/index",
perms: "",
type: 1,
elIcon: "el-icon-menu",
orderNum: 0,
open: null,
list: [],
},
{ {
menuId: getUUID(), menuId: getUUID(),
parentId: 0, parentId: 0,

View File

@ -169,7 +169,8 @@ export function getMenu(role) {
"ogistics-fare", "ogistics-fare",
"logistics-fare/logistics-template/index", "logistics-fare/logistics-template/index",
"bank-card/index", "bank-card/index",
"operation-management/total-order/index" "operation-management/total-order/index",
"operation-management/accountNumber/index",
]; ];
} else if (role == "ROLE_BRAND_MANAGER") { } else if (role == "ROLE_BRAND_MANAGER") {
return [ return [
@ -185,6 +186,7 @@ export function getMenu(role) {
"brand/config/index", "brand/config/index",
"local-course/resources", "local-course/resources",
"wallet/index", "wallet/index",
"operation-management/accountNumber/index",
]; ];
} else if (role == "ROLE_AGENT") { } else if (role == "ROLE_AGENT") {
return [ return [
@ -198,6 +200,7 @@ export function getMenu(role) {
"datacenter/order-analysis/index", "datacenter/order-analysis/index",
"local-course/resources", "local-course/resources",
"wallet/index", "wallet/index",
"operation-management/accountNumber/index",
]; ];
} }
} }

View File

@ -0,0 +1,174 @@
<template>
<div style="height: calc(100vh - 200px)">
<obj-table-plus
ref="oTable"
style="height: 100%"
:tableCols="tableCols"
:tableProp="tableProp"
@query="queryList"
v-model="dataList"
:tableEvent="tableEvent"
>
<template slot="tableTop">
<el-form :inline="true" :model="formInline" class="demo-form-inline">
<el-form-item label="姓名">
<el-input
v-model="formInline.username"
placeholder="姓名搜索"
></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="$refs.oTable.reload()"
>查询</el-button
>
<el-button type="primary">重置</el-button>
</el-form-item>
</el-form>
<div class="mb-2">
<el-button type="primary" @click="addAccount">添加</el-button>
</div>
</template>
</obj-table-plus>
<!-- 编辑编辑账号 -->
<addOrUpdate
ref="addOrUpdate"
@queryList="$refs.oTable.reload()"
></addOrUpdate>
</div>
</template>
<script>
import addOrUpdate from "./popup/add-or-update.vue";
export default {
components: { addOrUpdate },
data() {
return {
dataList: [],
formInline: {
name: "",
},
tableProp: {
"auto-resize": true,
border: true,
height: "auto",
"row-id": "id",
"show-overflow": false,
},
productFilterType: "SALE",
selectList: [],
};
},
created() {
this.$nextTick(() => {
this.$refs.oTable.reload();
});
},
methods: {
queryList(pageNo, pageSize) {
this.$api.accountNumber
.accountPage({
pageNumber: pageNo,
pageSize: pageSize,
ownerId: JSON.parse(sessionStorage.getItem("userInfo")).managerId
? JSON.parse(sessionStorage.getItem("userInfo")).managerId
: JSON.parse(sessionStorage.getItem("userInfo")).merchantId,
})
.then((res) => {
console.log(res);
this.$refs.oTable.complete(
res.data.data.data,
Number(res.data.data.total)
);
})
.catch((err) => {
this.$refs.oTable.complete(false);
});
},
addAccount() {
console.log("添加账号");
this.$refs.addOrUpdate.toggle().add();
},
},
computed: {
tableCols() {
return [
{ type: "checkbox", width: "60px", fixed: "left" },
// { type: "seq", width: "60px", align: "center", title: "" },
{
title: "姓名",
align: "center",
field: "username",
},
{
title: "账号",
align: "center",
field: "mobile",
},
{
title: "加入时间",
align: "center",
field: "createTime",
},
{
title: "操作",
fixed: "right",
type: "jsx",
align: "center",
width: "240px",
render: (row) => {
let edit = () => {
this.$refs.addOrUpdate.toggle(row).update();
};
let deleteBanner = () => {
this.$api.accountNumber
.deleteAccount({ id: row.row.id })
.then((res) => {
console.log(res);
this.$refs.oTable.reload();
});
};
let onCancel = () => {};
return (
<div>
<el-button
style="margin-right:20px"
size="mini"
type="primary"
onClick={edit}
>
编辑
</el-button>
<el-popconfirm
onConfirm={deleteBanner}
onCancel={onCancel}
confirm-button-text="确定"
cancel-button-text="取消"
icon="el-icon-info"
icon-color="red"
title="确定删除吗?"
>
<el-button size="mini" type="danger" slot="reference">
删除
</el-button>
</el-popconfirm>
</div>
);
},
},
];
},
tableEvent() {
return {
"checkbox-all": ({ records, reserves }) => {
this.selectList = [...records, ...reserves];
},
"checkbox-change": ({ records, reserves }) => {
this.selectList = [...records, ...reserves];
},
};
},
},
};
</script>
<style lang="scss" scoped></style>

View File

@ -0,0 +1,151 @@
<template>
<div>
<obj-modal
ref="modal"
labelWidth="150px"
:modalCols="modalCols"
:modalConfig="modalConfig"
:modalData="modalData"
:modalHandles="modalHandles"
>
<template slot="dialog__after"> </template>
</obj-modal>
</div>
</template>
<script>
import { debounce, cloneDeep } from "lodash";
import { Divider } from "element-ui";
export default {
components: {},
data() {
return {
isAdd: true,
//
modalConfig: {
title: "添加账号",
show: false,
width: "700px",
},
modalData: {},
settingId: "",
form: {},
};
},
watch: {
"modalConfig.show"(newVal) {
if (!newVal) {
//
setTimeout(() => {
this.$refs.modal.resetFields();
});
}
},
},
methods: {
queryTableData(pageNo, pageSize) {},
toggle(e) {
if (this.modalConfig.show == false) {
this.modalConfig.show = true;
} else {
this.modalConfig.show = false;
}
if (e) {
this.init(cloneDeep(e.row));
}
return {
add: () => {
this.modalData = {};
this.modalConfig.title = "添加账号";
this.isAdd = true;
},
update: () => {
this.modalConfig.title = "编辑账号";
this.isAdd = false;
},
};
},
init(row) {
this.modalData = row;
},
},
computed: {
modalCols() {
return [
{
label: "姓名",
prop: "username",
type: "Input",
required: true,
rules: {
required: true,
message: "请输入姓名",
trigger: "blur",
},
},
{
label: "账号",
prop: "mobile",
type: "Input",
required: true,
rules: {
required: true,
message: "请输入角色编码",
trigger: "blur",
},
},
{
label: "密码",
prop: "password",
type: "Input",
required: true,
rules: {
required: true,
message: "请输入权限字段",
trigger: "blur",
},
},
];
},
modalHandles() {
return [
{
label: "取消",
handle: () => {
this.toggle();
},
},
{
label: "确认",
type: "primary",
submit: true,
handle: () => {
console.log(this.modalData);
if (this.isAdd) {
this.$api.accountNumber
.addAccount({
...this.modalData,
ownerId: JSON.parse(sessionStorage.getItem("userInfo"))
.managerId
? JSON.parse(sessionStorage.getItem("userInfo")).managerId
: JSON.parse(sessionStorage.getItem("userInfo")).merchantId,
})
.then((res) => {
this.toggle();
this.$emit("queryList");
});
} else {
this.$api.mer_admin.noticeUpdate(this.modalData).then((res) => {
this.toggle();
this.$emit("queryList");
});
}
},
},
];
},
},
asyncComputed: {},
};
</script>
<style lang="scss" scoped>
</style>