Refactor: user resources

This commit is contained in:
Lazy 2023-11-30 19:49:00 +08:00
parent 6824077ef0
commit c066828a13
5 changed files with 17 additions and 12 deletions

View File

@ -124,7 +124,7 @@ let originRouterConfig: RouterConfig[] = [
},
children: [
{
path: "/users/config",
path: "/users/resources",
name: t("TXT_CODE_236f70aa"),
component: LayoutContainer,
meta: {

View File

@ -13,6 +13,7 @@ import { arrayFilter } from "../tools/array";
import { useAppRouters } from "@/hooks/useAppRouters";
import { getUserInfo, deleteUser as deleteUserApi, addUser as addUserApi } from "@/services/apis";
import type { LayoutCard, UserInfo } from "@/types/index";
import type { BaseUserInfo } from "@/types/user";
defineProps<{
card: LayoutCard;
@ -91,9 +92,13 @@ const data = ref<dataType>();
const dataSource = computed(() => data?.value?.data);
const selectedUsers = ref<string[]>([]);
const handleToUserConfig = (user: any) => {
const handleToUserConfig = (user: BaseUserInfo) => {
// TXT_CODE_dbc9f7b2
};
const handleToUserResources = (user: BaseUserInfo) => {
toPage({
path: "/users/config",
path: "/users/resources",
query: {
uuid: user.uuid
}
@ -105,6 +110,7 @@ const handleTableChange = (e: { current: number; pageSize: number }) => {
operationForm.value.pageSize = e.pageSize;
fetchData();
};
const fetchData = async () => {
if (operationForm.value.currentPage < 1) {
operationForm.value.currentPage = 1;
@ -293,7 +299,6 @@ onMounted(async () => {
<a-menu-item key="2" @click="handleBatchDelete()">
{{ t("TXT_CODE_760f00f5") }}
</a-menu-item>
<!-- <a-menu-item key="3">{{ t("TXT_CODE_4d934e3a") }}</a-menu-item> -->
</a-menu>
</template>
<a-button type="primary">
@ -350,12 +355,12 @@ onMounted(async () => {
<a-menu-item key="1" @click="handleToUserConfig(record)">
{{ t("TXT_CODE_236f70aa") }}
</a-menu-item>
<a-menu-item key="2" @click="handleDeleteUser(record)">
<a-menu-item key="2" @click="handleToUserResources(record)">
{{ t("TXT_CODE_4d934e3a") }}
</a-menu-item>
<a-menu-item key="3" @click="handleDeleteUser(record)">
{{ t("TXT_CODE_760f00f5") }}
</a-menu-item>
<!-- <a-menu-item key="3">
{{ t("TXT_CODE_4d934e3a") }}
</a-menu-item> -->
</a-menu>
</template>
<a-button size="">

View File

@ -278,7 +278,7 @@
"TXT_CODE_4b7eba50": "Online node / total node",
"TXT_CODE_4ccdd3a0": "console",
"TXT_CODE_4d81a657": "Preview",
"TXT_CODE_4d934e3a": "Ban user",
"TXT_CODE_4d934e3a": "Allocate resources",
"TXT_CODE_4d993ca4": "picture frame",
"TXT_CODE_4df7e9bd": "CPU name",
"TXT_CODE_4ea93630": "Please enter content",

View File

@ -454,7 +454,7 @@
"TXT_CODE_9e9d3767": "若您从事出租商业活动,请务必保证应用实例运行在 Linux 的 Docker 虚拟容器中,否则将有安全隐患。",
"TXT_CODE_b01f8383": "了解更多",
"TXT_CODE_760f00f5": "删除用户",
"TXT_CODE_4d934e3a": "封禁用户",
"TXT_CODE_4d934e3a": "分配资源",
"TXT_CODE_f7084f84": "用户操作",
"TXT_CODE_2471b9c": "根据用户名搜索",
"TXT_CODE_50d471b2": "重置",

View File

@ -324,13 +324,13 @@ function getDefaultFrontendLayoutConfig(): IPageLayoutConfig[] {
]
},
{
page: "/users/config",
page: "/users/resources",
items: [
{
id: getRandomId(),
meta: {},
type: "UserAccessSettings",
title: t("TXT_CODE_dbc9f7b2"),
title: t("用户资源管理"),
width: 12,
height: LayoutCardHeight.AUTO,
disableDelete: true