fix(ui): ui调整

This commit is contained in:
廖彦棋 2024-03-13 09:54:20 +08:00
parent 960d294aa2
commit fcd86fbebd
13 changed files with 59 additions and 46 deletions

View File

@ -1,2 +0,0 @@
VITE_PROXY_BASE_URL="/api"
VITE_TARGET_URL="http://172.22.11.2:5678"

View File

@ -1,4 +1,4 @@
lockfileVersion: '6.0'
lockfileVersion: '6.1'
settings:
autoInstallPeers: true

View File

@ -38,6 +38,7 @@ onActivated(handleSearch);
<template>
<div class="search-table">
<div class="search-table-header">
<div class="search-table-header-option">
<div>
<slot name="header-title">{{ props.headerTitle }}</slot>
</div>
@ -55,13 +56,14 @@ onActivated(handleSearch);
<slot :name="slot" v-bind="{ ...config, reload: handleSearch }" />
</template>
</FormSection>
</div>
<div ref="tableContainerRef" class="search-table-container">
<ATable
v-bind="{
...$attrs,
...tableConfig,
...props,
scroll: useTableScroll(_columns, tableContainerRef as HTMLElement),
scroll: useTableScroll(_columns),
columns: _columns,
}"
>
@ -74,14 +76,18 @@ onActivated(handleSearch);
</template>
<style scoped>
.search-table {
display: flex;
flex-direction: column;
position: relative;
height: 100%;
}
.search-table-container {
flex: 1;
position: relative;
z-index: 1;
}
.search-table-header {
background: #fff;
z-index: 2;
}
.search-table-header-option {
display: flex;
align-items: center;
justify-content: space-between;

View File

@ -1,20 +1,11 @@
import type { TableColumnData } from "@arco-design/web-vue";
import type { SearchTableColumns, SearchColumns } from "./type";
export function useTableXScroll(columns: TableColumnData[]) {
return columns.reduce((prev, curr) => {
const width = curr.width ?? 150;
return prev + width;
}, 0);
}
export function useTableScroll(columns: SearchTableColumns[], container?: HTMLElement) {
export function useTableScroll(columns: SearchTableColumns[]) {
const x = columns.reduce((prev, curr) => {
const width = curr.hideInTable ? 0 : curr.width ?? 150;
return prev + width;
}, 0);
const y = container?.clientHeight ?? undefined;
return { x, y };
return { x };
}
export function getDefaultFormData(columns: SearchTableColumns[]) {

View File

@ -1,4 +1,4 @@
import { createRouter, createWebHistory } from 'vue-router'
import { createRouter, createWebHashHistory } from 'vue-router'
import { useAuthStore } from "@/stores/auth";
import CustomLayout from '@/components/CustomLayout.vue'
import menu from './menu'
@ -17,7 +17,7 @@ const whiteListRoutes = [
];
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
history: createWebHashHistory(import.meta.env.BASE_URL),
routes: [
{
path: '/',

View File

@ -29,10 +29,13 @@ const columns = [
title: "使用代理",
dataIndex: "use_proxy",
slotName: "proxy",
align: "center",
width: 100
},
{
title: "最后使用时间",
dataIndex: "last_used_at",
width: 180,
render: ({ record }) => {
return dateFormat(record.last_used_at);
},
@ -41,10 +44,14 @@ const columns = [
title: "启用状态",
dataIndex: "enabled",
slotName: "status",
align: "center",
width: 100
},
{
title: "操作",
slotName: "action",
width: 120,
fixed: "right",
},
];

View File

@ -16,8 +16,9 @@ export const save = (data?: Record<string, unknown>) => {
};
export const deleting = (id: string | number) => {
return http({
url: `/api/admin/apikey/remove?id=${id}`,
method: "get",
url: `/api/admin/apikey/remove`,
method: "post",
data: { id },
});
};
export const setStatus = (data) => {

View File

@ -44,6 +44,8 @@ const columns = [
{
title: "操作",
slotName: "action",
width: 120,
fixed: "right",
},
];

View File

@ -16,8 +16,9 @@ export const save = (data?: Record<string, unknown>) => {
};
export const deleting = (id: string | number) => {
return http({
url: `/api/admin/model/remove?id=${id}`,
method: "get",
url: `/api/admin/model/remove`,
method: "post",
data: { id },
});
};
export const setStatus = (data) => {

View File

@ -40,10 +40,13 @@ const columns = [
title: "启用状态",
dataIndex: "enabled",
slotName: "status",
align: "center",
width: 100
},
{
title: "更新时间",
dataIndex: "updated_at",
width: 180,
render: ({ record }) => {
return dateFormat(record.updated_at);
},
@ -51,6 +54,8 @@ const columns = [
{
title: "操作",
slotName: "action",
width: 120,
fixed: "right"
},
];

View File

@ -8,10 +8,10 @@ export const getList = (params?: Record<string, unknown>) => {
})
}
export const remove = (params?: Record<string, unknown>) => {
export const remove = (data?: Record<string, unknown>) => {
return http({
url: "/api/admin/reward/remove",
method: "get",
params
method: "post",
data
})
}

View File

@ -16,8 +16,9 @@ export const save = (data?: Record<string, unknown>) => {
};
export const deleting = (id: string | number) => {
return http({
url: `/api/admin/role/remove?id=${id}`,
method: "get",
url: `/api/admin/role/remove`,
method: "post",
data: { id }
});
};
export const setStatus = (data) => {

View File

@ -18,8 +18,9 @@ export const save = (data?: Record<string, unknown>) => {
export const deletApi = (id: string | number) => {
return http({
url: `/api/admin/user/remove?id=${id}`,
method: "get",
url: `/api/admin/user/remove`,
method: "post",
data: { id }
});
};