mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-22 05:02:57 +00:00
chore: 批量修复优化代码与配置
1. 统一修复多处状态选项值类型从字符串转为数字 2. 优化用户更新逻辑简化代码 3. 新增ORM转Schema工具方法优化数据转换 4. 调整部门与菜单模型加载配置 5. 修复订单详情展示逻辑与样式 6. 移动主题配置到单独文件并更新gitignore
This commit is contained in:
@@ -47,119 +47,3 @@
|
||||
"border-radius": "10px",
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* 浅蓝色系主题 — #1975FC
|
||||
*
|
||||
* 来源:花瓣网 B端淡蓝色配色参考
|
||||
* 主色 #1975FC — 明快透亮、B端专业感
|
||||
*
|
||||
* 【启用方式】在本文件中取消注释对应主题模式的变量块,
|
||||
* 并在 src/styles/index.scss 中 @use "./core/theme-blue";
|
||||
* 同时在 src/config/setting.ts 中将 themeColor 改为 "#1975FC"。
|
||||
*
|
||||
* 【色阶 palette】
|
||||
* #f8fcff 最浅底色(页面背景)
|
||||
* #f0f5ff 浅蓝悬停态
|
||||
* #e5f2ff 选中态 / tag 背景
|
||||
* #c5ddff 浅蓝边框 / 分割线点缀
|
||||
* #82b8ff 中浅蓝(图标辅助色)
|
||||
* #1975FC ★ 主色
|
||||
* #115ac8 深蓝(hover 按下态)
|
||||
*
|
||||
* 【功能色】
|
||||
* success: #16a34a
|
||||
* warning: #d97706
|
||||
* danger: #dc2626
|
||||
* error: #fa896b
|
||||
* info: #8b92a0
|
||||
*
|
||||
* ================================================================
|
||||
*/
|
||||
|
||||
// ================================================================
|
||||
// 亮色主题 — 浅蓝色系
|
||||
// ================================================================
|
||||
|
||||
// :root {
|
||||
// /* ---- 侧边栏 ---- */
|
||||
// --sidebar-bg-color: #ffffff;
|
||||
// --sidebar-border-color: #edf0f2;
|
||||
// --sidebar-text-color: #485260;
|
||||
// --sidebar-text-hover-color: #1975fc;
|
||||
// --sidebar-text-active-color: #1975fc;
|
||||
// --sidebar-bg-hover-color: #f0f5ff;
|
||||
// --sidebar-bg-active-color: #e5f2ff;
|
||||
// --sidebar-logo-color: #121926;
|
||||
// --sidebar-section-title-color: #8b92a0;
|
||||
//
|
||||
// /* ---- 页面 ---- */
|
||||
// --main-bg-color: #f4f6f9;
|
||||
// --header-bg-color: #ffffff;
|
||||
// --header-border-color: #edf0f2;
|
||||
//
|
||||
// /* ---- 卡片 ---- */
|
||||
// --card-bg-color: #ffffff;
|
||||
// --card-border-color: #edf0f2;
|
||||
//
|
||||
// /* ---- 表格 ---- */
|
||||
// --table-header-bg: #f8fafc;
|
||||
// --table-header-color: #8b92a0;
|
||||
// --table-row-hover-bg: #f8fafc;
|
||||
// --table-border-color: #edf0f2;
|
||||
//
|
||||
// /* ---- 文字 ---- */
|
||||
// --text-primary: #121926;
|
||||
// --text-regular: #334155;
|
||||
// --text-secondary: #8b92a0;
|
||||
//
|
||||
// /* ---- 标签 ---- */
|
||||
// --tag-bg-color: #e5f2ff;
|
||||
// --tag-text-color: #1975fc;
|
||||
//
|
||||
// /* ---- 按钮 —— 由 Element Plus 通过 primary 色阶自动生成 ---- */
|
||||
// /* ---- 进度条 ---- */
|
||||
// --nprogress-color: #1975fc;
|
||||
//
|
||||
// /* ---- 边框模式 ---- */
|
||||
// --fa-card-border: #edf0f2;
|
||||
// --default-box-color: #ffffff;
|
||||
// --default-border: #edf0f2;
|
||||
// --custom-radius: 0.75rem;
|
||||
// }
|
||||
|
||||
// ================================================================
|
||||
// 暗色主题 — 浅蓝色系(可选)
|
||||
// ================================================================
|
||||
|
||||
// html.dark {
|
||||
// --sidebar-bg-color: #0c1031;
|
||||
// --sidebar-border-color: #1a1e3d;
|
||||
// --sidebar-text-color: #a8adcc;
|
||||
// --sidebar-text-hover-color: #5c9fff;
|
||||
// --sidebar-text-active-color: #1975fc;
|
||||
// --sidebar-bg-hover-color: rgba(25, 117, 252, 0.15);
|
||||
// --sidebar-bg-active-color: rgba(25, 117, 252, 0.25);
|
||||
// --sidebar-logo-color: #ffffff;
|
||||
// --sidebar-section-title-color: #6b7094;
|
||||
//
|
||||
// --main-bg-color: #0f1420;
|
||||
// --header-bg-color: #151a2d;
|
||||
// --header-border-color: #1a1e3d;
|
||||
//
|
||||
// --card-bg-color: #151a2d;
|
||||
// --card-border-color: #1a1e3d;
|
||||
//
|
||||
// --table-header-bg: #1a1e3d;
|
||||
// --table-header-color: #6b7094;
|
||||
// --table-row-hover-bg: #1a1e3d;
|
||||
// --table-border-color: #1a1e3d;
|
||||
//
|
||||
// --text-primary: #e5e7eb;
|
||||
// --text-regular: #a8adcc;
|
||||
// --text-secondary: #6b7094;
|
||||
//
|
||||
// --tag-bg-color: rgba(25, 117, 252, 0.2);
|
||||
// --tag-text-color: #5c9fff;
|
||||
// }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="fa-card p-5 pb-3 h-53 max-sm:h-48 flex flex-col">
|
||||
<div class="fa-card p-5 pb-3 h-53 max-sm:h-53 flex flex-col">
|
||||
<div class="fa-card-header">
|
||||
<div class="title">
|
||||
<h4>
|
||||
|
||||
@@ -458,8 +458,8 @@ const searchBarRef = ref<InstanceType<typeof FaSearchBar> | null>(null);
|
||||
const searchBarRules: Record<string, unknown> = {};
|
||||
|
||||
const statusOptions = ref([
|
||||
{ label: "启用", value: "0" },
|
||||
{ label: "停用", value: "1" },
|
||||
{ label: "启用", value: 0 },
|
||||
{ label: "停用", value: 1 },
|
||||
]);
|
||||
|
||||
const menuSearchItems = computed<SearchFormItem[]>(() => [
|
||||
|
||||
@@ -107,7 +107,13 @@
|
||||
|
||||
<!-- 订单详情弹窗 -->
|
||||
<FaDialog v-model="detailVisible" title="订单详情" width="560px" :show-footer="false">
|
||||
<FaDescriptions v-if="orderDetail" :column="2" border :items="detailItems" />
|
||||
<FaDescriptions
|
||||
v-if="orderDetail"
|
||||
:column="2"
|
||||
border
|
||||
:items="detailItems"
|
||||
:data="orderDetail"
|
||||
/>
|
||||
</FaDialog>
|
||||
|
||||
<!-- 驳回退款弹窗 -->
|
||||
@@ -345,7 +351,13 @@ const orderDetail = ref<OrderTable | null>(null);
|
||||
async function showOrderDetail(row: OrderTable) {
|
||||
try {
|
||||
const res = await OrderAPI.detailOrder(row.id);
|
||||
orderDetail.value = res.data.data as OrderTable;
|
||||
const data = res.data.data as OrderTable;
|
||||
if (data) {
|
||||
data.amount = data.amount / 100;
|
||||
data.order_type = orderTypeLabel(data.order_type);
|
||||
data.pay_method = data.pay_method ? payMethodLabel(data.pay_method) : "";
|
||||
}
|
||||
orderDetail.value = data;
|
||||
detailVisible.value = true;
|
||||
} catch {
|
||||
/* ignore */
|
||||
@@ -362,16 +374,30 @@ async function cancelOrder(orderId: number) {
|
||||
}
|
||||
}
|
||||
|
||||
const detailItems = computed(() => {
|
||||
const detailItems = computed<
|
||||
import("@/components/others/fa-descriptions/index.vue").DescriptionsItem[]
|
||||
>(() => {
|
||||
if (!orderDetail.value) return [];
|
||||
return [
|
||||
{ label: "订单ID", prop: "id" },
|
||||
{ label: "订单号", prop: "order_no" },
|
||||
{ label: "租户ID", prop: "tenant_id" },
|
||||
{ label: "套餐ID", prop: "package_id" },
|
||||
{ label: "订单类型", prop: "order_type", slot: "order_type" },
|
||||
{ label: "金额", prop: "amount", slot: "amount" },
|
||||
{ label: "状态", prop: "status", slot: "status" },
|
||||
{ label: "订单类型", prop: "order_type" },
|
||||
{ label: "金额", prop: "amount" },
|
||||
{
|
||||
label: "状态",
|
||||
prop: "status",
|
||||
tag: {
|
||||
map: {
|
||||
"0": { type: "warning", text: "待支付" },
|
||||
"1": { type: "success", text: "已支付" },
|
||||
"2": { type: "info", text: "已取消" },
|
||||
"3": { type: "warning", text: "已退款" },
|
||||
"4": { type: "danger", text: "已过期" },
|
||||
},
|
||||
},
|
||||
},
|
||||
{ label: "支付方式", prop: "pay_method" },
|
||||
{ label: "支付时间", prop: "pay_time" },
|
||||
{ label: "过期时间", prop: "expire_time" },
|
||||
|
||||
@@ -245,8 +245,8 @@ const searchBarRef = ref<InstanceType<typeof FaSearchBar> | null>(null);
|
||||
const searchBarRules: Record<string, unknown> = {};
|
||||
|
||||
const statusOptions = ref([
|
||||
{ label: "正常", value: "0" },
|
||||
{ label: "禁用", value: "1" },
|
||||
{ label: "正常", value: 0 },
|
||||
{ label: "禁用", value: 1 },
|
||||
]);
|
||||
|
||||
const pkgSearchItems = computed<SearchFormItem[]>(() => [
|
||||
|
||||
@@ -291,8 +291,8 @@ const categoryOptions = ref([
|
||||
]);
|
||||
|
||||
const statusOptions = ref([
|
||||
{ label: "启用", value: "0" },
|
||||
{ label: "停用", value: "1" },
|
||||
{ label: "启用", value: 0 },
|
||||
{ label: "停用", value: 1 },
|
||||
]);
|
||||
|
||||
const pluginSearchItems = computed<SearchFormItem[]>(() => [
|
||||
|
||||
@@ -209,8 +209,8 @@ const searchBarRef = ref<InstanceType<typeof FaSearchBar> | null>(null);
|
||||
const searchBarRules: Record<string, unknown> = {};
|
||||
|
||||
const statusOptions = ref([
|
||||
{ label: "启用", value: "0" },
|
||||
{ label: "停用", value: "1" },
|
||||
{ label: "启用", value: 0 },
|
||||
{ label: "停用", value: 1 },
|
||||
]);
|
||||
|
||||
const deptSearchItems = computed<SearchFormItem[]>(() => [
|
||||
|
||||
@@ -322,8 +322,8 @@ const searchBarRef = ref<InstanceType<typeof FaSearchBar> | null>(null);
|
||||
const searchBarRules: Record<string, unknown> = {};
|
||||
|
||||
const statusOptions = ref([
|
||||
{ label: "启用", value: "0" },
|
||||
{ label: "停用", value: "1" },
|
||||
{ label: "启用", value: 0 },
|
||||
{ label: "停用", value: 1 },
|
||||
]);
|
||||
|
||||
const dictDataSearchItems = computed<SearchFormItem[]>(() => [
|
||||
|
||||
@@ -177,8 +177,8 @@ const searchBarRef = ref<InstanceType<typeof FaSearchBar> | null>(null);
|
||||
const searchBarRules: Record<string, unknown> = {};
|
||||
|
||||
const statusOptions = ref([
|
||||
{ label: "启用", value: "0" },
|
||||
{ label: "停用", value: "1" },
|
||||
{ label: "启用", value: 0 },
|
||||
{ label: "停用", value: 1 },
|
||||
]);
|
||||
|
||||
const dictTypeSearchItems = computed<SearchFormItem[]>(() => [
|
||||
|
||||
@@ -213,8 +213,8 @@ const searchBarRef = ref<InstanceType<typeof FaSearchBar> | null>(null);
|
||||
const searchBarRules: Record<string, unknown> = {};
|
||||
|
||||
const statusOptions = ref([
|
||||
{ label: "启用", value: "0" },
|
||||
{ label: "停用", value: "1" },
|
||||
{ label: "启用", value: 0 },
|
||||
{ label: "停用", value: 1 },
|
||||
]);
|
||||
|
||||
const noticeTypeSearchOptions = computed(() =>
|
||||
|
||||
@@ -310,8 +310,8 @@ const searchBarRef = ref<InstanceType<typeof FaSearchBar> | null>(null);
|
||||
const searchBarRules: Record<string, unknown> = {};
|
||||
|
||||
const statusOptions = ref([
|
||||
{ label: "启用", value: "0" },
|
||||
{ label: "停用", value: "1" },
|
||||
{ label: "启用", value: 0 },
|
||||
{ label: "停用", value: 1 },
|
||||
]);
|
||||
|
||||
const positionSearchItems = computed<SearchFormItem[]>(() => [
|
||||
|
||||
@@ -375,7 +375,7 @@ const userDetailItems: DescriptionsItem[] = [
|
||||
label: "状态",
|
||||
prop: "status",
|
||||
tag: {
|
||||
map: { "0": { type: "success", text: "启用" }, "1": { type: "danger", text: "停用" } },
|
||||
map: { 0: { type: "success", text: "启用" }, 1: { type: "danger", text: "停用" } },
|
||||
},
|
||||
},
|
||||
{ label: "上次登录时间", prop: "last_login" },
|
||||
@@ -437,8 +437,8 @@ const userDialogFormItems = computed<FormItem[]>(() => [
|
||||
type: "radiogroup",
|
||||
props: {
|
||||
options: [
|
||||
{ label: "启用", value: "0" },
|
||||
{ label: "停用", value: "1" },
|
||||
{ label: "启用", value: 0 },
|
||||
{ label: "停用", value: 1 },
|
||||
],
|
||||
},
|
||||
},
|
||||
@@ -469,8 +469,8 @@ const searchBarRef = ref<InstanceType<typeof FaSearchBar> | null>(null);
|
||||
const searchBarRules: Record<string, unknown> = {};
|
||||
|
||||
const statusOptions = ref([
|
||||
{ label: "启用", value: "0" },
|
||||
{ label: "停用", value: "1" },
|
||||
{ label: "启用", value: 0 },
|
||||
{ label: "停用", value: 1 },
|
||||
]);
|
||||
|
||||
const userSearchItems = computed<SearchFormItem[]>(() => [
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
:show-search="true"
|
||||
:disabled-search="false"
|
||||
:default-expanded="false"
|
||||
:button-left-limit="0"
|
||||
@search="handleJobSearchBarSearch"
|
||||
@reset="onJobResetSearch"
|
||||
/>
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
:show-search="true"
|
||||
:disabled-search="false"
|
||||
:default-expanded="false"
|
||||
:button-left-limit="0"
|
||||
@search="handleSearchBarSearch"
|
||||
@reset="onResetSearch"
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user