feat: 更新沃尔玛账户管理界面,添加创建人字段并优化表单布局

This commit is contained in:
danial
2025-04-29 00:51:58 +08:00
parent c0c7282b6e
commit 17ec6cf4fd
6 changed files with 198 additions and 213 deletions

View File

@@ -1,210 +1,186 @@
<template>
<div class="container">
<Breadcrumb :items="['充值账户管理', '沃尔玛Cookie']" />
<a-space direction="vertical" fill>
<a-card class="general-card" title="沃尔玛Cookie管理">
<a-row>
<a-col :flex="1">
<a-form
:model="formModel"
:label-col-props="{ span: 6 }"
:wrapper-col-props="{ span: 18 }"
label-align="left"
>
<a-row :gutter="16">
<a-col :span="8">
<a-form-item field="cookie" label="cookie">
<a-input
v-model="formModel.cookie"
placeholder="请输入Cookie"
/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item field="name" label="名称">
<a-input
v-model="formModel.name"
placeholder="请输入名称"
/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item field="nickname" label="沃尔玛昵称">
<a-input
v-model="formModel.nickname"
placeholder="请输入沃尔玛账户昵称"
/>
</a-form-item>
</a-col>
</a-row>
</a-form>
<a-row>
<a-col :flex="1">
<a-form
:model="formModel"
:label-col-props="{ span: 6 }"
:wrapper-col-props="{ span: 18 }"
label-align="left"
>
<a-row :gutter="16">
<a-col :span="8">
<a-form-item field="cookie" label="cookie">
<a-input v-model="formModel.cookie" placeholder="请输入Cookie" />
</a-form-item>
</a-col>
<a-divider style="height: 42px" direction="vertical" />
<a-col flex="172px" style="text-align: right">
<a-space direction="horizontal" :size="18">
<a-button type="primary" @click="search">
<template #icon>
<icon-search />
</template>
搜索
</a-button>
<a-button @click="reset">
<template #icon>
<icon-refresh />
</template>
重置
</a-button>
</a-space>
<a-col :span="8">
<a-form-item field="name" label="名称">
<a-input v-model="formModel.name" placeholder="请输入名称" />
</a-form-item>
</a-col>
</a-row>
<a-divider style="margin-top: 0" />
<a-row style="justify-content: space-between; margin-bottom: 16px">
<a-space>
<a-button
v-if="checkTokenFromLogin()"
type="primary"
size="small"
@click="showAddModel({ id: '', ...generateFormModel() })"
>
<template #icon>
<icon-plus />
</template>
添加
</a-button>
<a-button @click="download">
<template #icon>
<icon-download />
</template>
导出
</a-button>
<batchImportModel @close="() => search()" />
</a-space>
<a-tabs
default-active-key=""
type="capsule"
:onChange="onChangeRadio"
animation
>
<a-tab-pane key="" title="全部" />
<a-tab-pane
v-for="item in groupList"
:key="item.id"
:title="item.name"
:value="item.id"
/>
</a-tabs>
</a-row>
<a-table
:loading="loading"
:pagination="{
current: pagination.current,
pageSize: pagination.pageSize,
total: pagination.total,
pageSizeOptions: [10, 20, 50, 100],
showPageSize: true
}"
:columns="columns"
:data="renderData"
:scroll="{ x: 1080 }"
@page-change="onPageChange"
@page-size-change="onPageSizeChange"
>
<template #status="{ record }">
<a-space size="small">
<a-switch
v-if="[0, 1].includes(record.status)"
v-model="record.status"
size="small"
:checked-value="1"
:unchecked-value="0"
:beforeChange="
newValue => updateCurrentStatus(record, newValue)
"
<a-col :span="8">
<a-form-item field="nickname" label="沃尔玛昵称">
<a-input
v-model="formModel.nickname"
placeholder="请输入沃尔玛账户昵称"
/>
<a-tag
v-else
size="small"
:color="statusMapper(record.status).color"
>
{{ statusMapper(record.status).text }}
</a-tag>
</a-space>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item field="createdUserName" label="创建人">
<a-select v-model="formModel.createdUserName">
<a-option
v-for="item in userList"
:key="item.id"
:value="item.id"
:label="item.userName"
/>
</a-select>
</a-form-item>
</a-col>
</a-row>
</a-form>
</a-col>
<a-divider style="height: 42px" direction="vertical" />
<a-col flex="172px" style="text-align: right">
<a-space direction="horizontal" :size="18">
<a-button type="primary" @click="search">
<template #icon>
<icon-search />
</template>
<template #operations="{ record }">
<a-space size="small">
<a-tooltip content="修改">
<a-button
size="small"
status="warning"
@click="showAddModel(record)"
>
<template #icon>
<icon-pen />
</template>
</a-button>
</a-tooltip>
<a-tooltip content="详情">
<a-button size="small" @click="showDetailModel(record)">
<template #icon>
<icon-list />
</template>
</a-button>
</a-tooltip>
<a-popconfirm
type="warning"
content="确认刷新账号状态嘛?"
@ok="refreshButton(record)"
>
<a-tooltip content="刷新">
<a-button
v-if="record.status === 3"
size="small"
status="success"
>
<template #icon>
<icon-refresh />
</template>
</a-button>
</a-tooltip>
</a-popconfirm>
<a-tooltip content="检查账号状态">
<a-button
size="small"
status="warning"
@click="checkOne(record.id)"
>
<template #icon>
<icon-check-circle />
</template>
</a-button>
</a-tooltip>
<a-tooltip content="删除">
<a-button
size="small"
status="danger"
@click="deleteOne(record.id)"
>
<template #icon>
<icon-delete />
</template>
</a-button>
</a-tooltip>
</a-space>
搜索
</a-button>
<a-button @click="reset">
<template #icon>
<icon-refresh />
</template>
</a-table>
</a-card>
<summary-card />
重置
</a-button>
</a-space>
</a-col>
</a-row>
<a-divider style="margin-top: 0" />
<a-row style="justify-content: space-between; margin-bottom: 16px">
<a-space>
<a-button
v-if="checkTokenFromLogin()"
type="primary"
size="small"
@click="showAddModel({ id: '', ...generateFormModel() })"
>
<template #icon>
<icon-plus />
</template>
添加
</a-button>
<a-button @click="download">
<template #icon>
<icon-download />
</template>
导出
</a-button>
<batchImportModel @close="() => search()" />
</a-space>
<add-modal
:id="state.accountId"
v-model:visible="state.addModalVisible"
:account="state.account"
/>
<account-detail
v-model:visible="state.accountDetailVisible"
:accountId="state.accountId"
/>
</div>
<a-tabs
default-active-key=""
type="capsule"
:onChange="onChangeRadio"
animation
>
<a-tab-pane key="" title="全部" />
<a-tab-pane
v-for="item in groupList"
:key="item.id"
:title="item.name"
:value="item.id"
/>
</a-tabs>
</a-row>
<a-table
:loading="loading"
:pagination="{
current: pagination.current,
pageSize: pagination.pageSize,
total: pagination.total,
pageSizeOptions: [10, 20, 50, 100],
showPageSize: true
}"
:columns="columns"
:data="renderData"
:scroll="{ x: 1080 }"
@page-change="onPageChange"
@page-size-change="onPageSizeChange"
>
<template #status="{ record }">
<a-space size="small">
<a-switch
v-if="[0, 1].includes(record.status)"
v-model="record.status"
size="small"
:checked-value="1"
:unchecked-value="0"
:beforeChange="newValue => updateCurrentStatus(record, newValue)"
/>
<a-tag v-else size="small" :color="statusMapper(record.status).color">
{{ statusMapper(record.status).text }}
</a-tag>
</a-space>
</template>
<template #operations="{ record }">
<a-space size="small">
<a-tooltip content="修改">
<a-button size="small" status="warning" @click="showAddModel(record)">
<template #icon>
<icon-pen />
</template>
</a-button>
</a-tooltip>
<a-tooltip content="详情">
<a-button size="small" @click="showDetailModel(record)">
<template #icon>
<icon-list />
</template>
</a-button>
</a-tooltip>
<a-popconfirm
type="warning"
content="确认刷新账号状态嘛?"
@ok="refreshButton(record)"
>
<a-tooltip content="刷新">
<a-button v-if="record.status === 3" size="small" status="success">
<template #icon>
<icon-refresh />
</template>
</a-button>
</a-tooltip>
</a-popconfirm>
<a-tooltip content="检查账号状态">
<a-button size="small" status="warning" @click="checkOne(record.id)">
<template #icon>
<icon-check-circle />
</template>
</a-button>
</a-tooltip>
<a-tooltip content="删除">
<a-button size="small" status="danger" @click="deleteOne(record.id)">
<template #icon>
<icon-delete />
</template>
</a-button>
</a-tooltip>
</a-space>
</template>
</a-table>
<add-modal
:id="state.accountId"
v-model:visible="state.addModalVisible"
:account="state.account"
/>
<account-detail
v-model:visible="state.accountDetailVisible"
:accountId="state.accountId"
/>
</template>
<script lang="ts" setup>
@@ -214,7 +190,6 @@ import { checkTokenFromLogin } from '@/utils/auth';
import { onMounted, reactive, ref, watchEffect } from 'vue';
import { Notification, TableColumnData } from '@arco-design/web-vue';
import AddModal from './components/add-modal.vue';
import summaryCard from './summary.tsx';
import AccountDetail from './components/detail.vue';
import {
deleteWalmartCard,
@@ -228,6 +203,7 @@ import { batchImportModel } from './components/component.tsx';
import {
ApiCardInfoWalmartAccountGetListGetPageSizeEnum,
KamiApiCardInfoWalmartV1AccountListRecord,
KamiApiSysUserV1UserGetAllSimpleUser,
KamiInternalModelEntityV1CardRedeemAccountGroup
} from '@/api/generated/index.ts';
import { apiClient } from '@/api/index.ts';
@@ -478,10 +454,6 @@ const refreshButton = (record: walmartCardUpdateRecord) => {
fetchData();
});
};
onMounted(() => {
fetchData();
getAllGroupList();
});
const onChangeRadio = (value: string | number | boolean) => {
formModel.value.groupId = value as number;
@@ -490,4 +462,19 @@ const onChangeRadio = (value: string | number | boolean) => {
const download = () => {
downloadDataList();
};
const userList = ref<KamiApiSysUserV1UserGetAllSimpleUser[]>([]);
// 获取所有分组
const getAllUserList = () => {
apiClient.apiUserGetSimpleAllGet().then(res => {
userList.value = res.data.list;
});
};
onMounted(() => {
fetchData();
getAllGroupList();
getAllUserList();
});
</script>

View File

@@ -182,7 +182,7 @@ export default defineComponent({
</FormItem>
</Col>
<Col span={8}>
<FormItem field='userId' label='分配账号'>
<FormItem field='userId' label='创建人'>
<Select v-model={formModel.value.userId}>
{userList.value.map(item => (
<Option key={item.id} value={item.id}>

View File

@@ -5,10 +5,10 @@
<template #extra>
<a-radio-group v-model="state.module" type="button">
<a-radio value="list">列表</a-radio>
<a-radio value="record">统计</a-radio>
<a-radio value="summary">统计</a-radio>
</a-radio-group>
</template>
<list v-if="state.module === 'list'" />
<List v-if="state.module === 'list'" />
<Summary v-if="state.module === 'summary'" />
</a-card>
</div>

View File

@@ -22,7 +22,7 @@
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item field="userId" label="分配账号">
<a-form-item field="userId" label="创建人">
<a-select v-model="searchForm.userId">
<a-option
v-for="item in userList"
@@ -116,7 +116,6 @@
</a-table>
</a-space>
</a-card>
<summary-card />
</a-space>
<a-modal
v-model:visible="dialogVisible"
@@ -156,7 +155,6 @@ import {
KamiApiSysUserV1UserGetAllSimpleUser,
KamiInternalModelEntityV1CardRedeemAccountGroup
} from '@/api/generated/index.ts';
import summaryCard from './summary.tsx';
import { checkTokenFromLogin } from '@/utils/auth';
// 搜索表单

View File

@@ -187,7 +187,7 @@ export default defineComponent({
</FormItem>
</Col>
<Col span={8}>
<FormItem field='userId' label='分配账号'>
<FormItem field='userId' label='创建人'>
<Select v-model={formModel.value.userId}>
{userList.value.map(item => (
<Option key={item.id} value={item.userName} />

View File

@@ -57,7 +57,7 @@
</a-form-item>
</a-col>
<a-col :span="6">
<a-form-item field="userId" label="分配账号">
<a-form-item field="userId" label="账号所属用户">
<a-select v-model="formModel.userId">
<Option
v-for="item in userList"