20260715221223

This commit is contained in:
oneao committed 2026-07-15 22:12:23 +08:00
1 parent 7049584d1e
commit 704dda07b5
21 files changed
+2649 -427

No files matched your search

+4
View File
@@ -0,0 +1,4 @@
{
"$schema": "./node_modules/oxfmt/configuration_schema.json",
"ignorePatterns": []
}
+3 -2
View File
@@ -1,10 +1,11 @@
<!doctype html>
<html lang="en">
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>fms-vue</title>
<meta name="theme-color" content="#ffffff" />
<title>FMS 管理系统</title>
</head>
<body>
<div id="app"></div>
+14 -3
View File
@@ -1,20 +1,31 @@
{
"name": "fms-vue",
"private": true,
"version": "0.0.0",
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
"preview": "vite preview",
"fmt": "oxfmt",
"fmt:check": "oxfmt --check"
},
"dependencies": {
"vue": "^3.5.39"
"@antdv-next/icons": "1.1.1",
"antdv-next": "^1.4.2",
"pinia": "^4.0.2",
"pinia-plugin-persistedstate": "^4.7.1",
"vue": "^3.5.39",
"vue-router": "^5.2.0"
},
"devDependencies": {
"@antdv-next/auto-import-resolver": "^1.1.0",
"@antdv-next/tailwind": "^1.1.1",
"@tailwindcss/vite": "4.3.2",
"@vitejs/plugin-vue": "^6.0.7",
"oxfmt": "^0.58.0",
"sass": "^1.101.0",
"tailwindcss": "^4.3.2",
"unplugin-auto-import": "^21.0.0",
"unplugin-vue-components": "^32.1.0",
"vite": "^8.1.1"
+1352 -15
View File
File diff suppressed because it is too large. Load diff
+5
View File
@@ -0,0 +1,5 @@
allowBuilds:
"@parcel/watcher": true
minimumReleaseAgeExclude:
- pinia@4.0.2
- vue-router@5.2.0
+5 -5
View File
@@ -1,7 +1,7 @@
<script setup>
import HelloWorld from './components/HelloWorld.vue'
</script>
<template>
<HelloWorld />
<a-app>
<div class="theme-root">
<router-view />
</div>
</a-app>
</template>
@@ -1,95 +0,0 @@
<script setup>
import { ref } from 'vue'
import viteLogo from '../assets/vite.svg'
import heroImg from '../assets/hero.png'
import vueLogo from '../assets/vue.svg'
const count = ref(0)
</script>
<template>
<section id="center">
<div class="hero">
<img :src="heroImg" class="base" width="170" height="179" alt="" />
<img :src="vueLogo" class="framework" alt="Vue logo" />
<img :src="viteLogo" class="vite" alt="Vite logo" />
</div>
<div>
<h1>Get started</h1>
<p>Edit <code>src/App.vue</code> and save to test <code>HMR</code></p>
</div>
<button type="button" class="counter" @click="count++">
Count is {{ count }}
</button>
</section>
<div class="ticks"></div>
<section id="next-steps">
<div id="docs">
<svg class="icon" role="presentation" aria-hidden="true">
<use href="/icons.svg#documentation-icon"></use>
</svg>
<h2>Documentation</h2>
<p>Your questions, answered</p>
<ul>
<li>
<a href="https://vite.dev/" target="_blank">
<img class="logo" :src="viteLogo" alt="" />
Explore Vite
</a>
</li>
<li>
<a href="https://vuejs.org/" target="_blank">
<img class="button-icon" :src="vueLogo" alt="" />
Learn more
</a>
</li>
</ul>
</div>
<div id="social">
<svg class="icon" role="presentation" aria-hidden="true">
<use href="/icons.svg#social-icon"></use>
</svg>
<h2>Connect with us</h2>
<p>Join the Vite community</p>
<ul>
<li>
<a href="https://github.com/vitejs/vite" target="_blank">
<svg class="button-icon" role="presentation" aria-hidden="true">
<use href="/icons.svg#github-icon"></use>
</svg>
GitHub
</a>
</li>
<li>
<a href="https://chat.vite.dev/" target="_blank">
<svg class="button-icon" role="presentation" aria-hidden="true">
<use href="/icons.svg#discord-icon"></use>
</svg>
Discord
</a>
</li>
<li>
<a href="https://x.com/vite_js" target="_blank">
<svg class="button-icon" role="presentation" aria-hidden="true">
<use href="/icons.svg#x-icon"></use>
</svg>
X.com
</a>
</li>
<li>
<a href="https://bsky.app/profile/vite.dev" target="_blank">
<svg class="button-icon" role="presentation" aria-hidden="true">
<use href="/icons.svg#bluesky-icon"></use>
</svg>
Bluesky
</a>
</li>
</ul>
</div>
</section>
<div class="ticks"></div>
<section id="spacer"></section>
</template>
@@ -0,0 +1,453 @@
<script setup>
import { computed, ref, watch } from "vue";
import { useRoute, useRouter } from "vue-router";
import {
AppstoreOutlined,
BarChartOutlined,
BellOutlined,
DollarOutlined,
DownOutlined,
FileTextOutlined,
LogoutOutlined,
MenuFoldOutlined,
MenuUnfoldOutlined,
SettingOutlined,
TranslationOutlined,
UserOutlined,
} from "@antdv-next/icons";
import { useAppStore } from "../stores/app";
import { useAuthStore } from "../stores/auth";
const route = useRoute();
const router = useRouter();
const appStore = useAppStore();
const authStore = useAuthStore();
const profileOpen = ref(false);
const logoutOpen = ref(false);
const menuItems = [
{
key: "/dashboard",
icon: AppstoreOutlined,
label: "工作台",
},
{
key: "business",
icon: FileTextOutlined,
label: "业务管理",
children: [{ key: "/business/orders", label: "业务单据" }],
},
{
key: "fees",
icon: DollarOutlined,
label: "费用管理",
children: [{ key: "/fees/receivable", label: "应收费用" }],
},
{
key: "reports",
icon: BarChartOutlined,
label: "报表中心",
children: [{ key: "/reports/operations", label: "运营报表" }],
},
{
key: "system",
icon: SettingOutlined,
label: "系统设置",
children: [{ key: "/system/users", label: "用户管理" }],
},
];
const selectedKeys = computed(() => [route.meta.menuKey || route.path]);
const activeTab = computed(() => route.path);
const tabItems = computed(() => appStore.visitedTabs);
const languageMenu = computed(() => ({
items: [
{ key: "zh-CN", label: "简体中文" },
{ key: "en", label: "English" },
],
onClick: ({ key }) => appStore.setLocale(key),
selectable: true,
selectedKeys: [appStore.locale],
}));
const userMenu = {
items: [
{ key: "profile", icon: UserOutlined, label: "个人资料" },
{ key: "settings", icon: SettingOutlined, label: "账户设置" },
{ type: "divider" },
{ key: "logout", icon: LogoutOutlined, label: "退出登录", danger: true },
],
onClick: handleUserMenu,
};
watch(
() => appStore.locale,
(locale) => document.documentElement.setAttribute("lang", locale),
{ immediate: true },
);
watch(
() => route.path,
() => {
if (!route.meta.title) return;
appStore.addVisitedTab({
key: route.path,
label: route.meta.title,
closable: route.path !== "/dashboard",
});
},
{ immediate: true },
);
function navigate({ key }) {
if (typeof key === "string" && key.startsWith("/")) {
router.push(key);
}
}
function changeTab(key) {
if (key !== route.path) router.push(key);
}
function editTab(targetKey, action) {
if (action !== "remove" || typeof targetKey !== "string" || targetKey === "/dashboard") {
return;
}
const currentIndex = appStore.visitedTabs.findIndex((item) => item.key === targetKey);
const fallback =
appStore.visitedTabs[currentIndex - 1] ??
appStore.visitedTabs[currentIndex + 1] ??
appStore.visitedTabs[0];
appStore.removeVisitedTab(targetKey);
if (route.path === targetKey && fallback) router.push(fallback.key);
}
function handleUserMenu({ key }) {
if (key === "profile" || key === "settings") profileOpen.value = true;
if (key === "logout") logoutOpen.value = true;
}
function confirmLogout() {
authStore.clearSession();
logoutOpen.value = false;
router.replace("/dashboard");
}
</script>
<template>
<a-layout class="app-layout">
<a-layout-sider
class="app-sider"
:collapsed="appStore.sidebarCollapsed"
:trigger="null"
:collapsed-width="56"
collapsible
theme="light"
width="208"
>
<div class="brand" :class="{ 'brand--collapsed': appStore.sidebarCollapsed }">
<div class="brand__mark">F</div>
<div class="brand__copy" :aria-hidden="appStore.sidebarCollapsed">
<strong>FMS 管理系统</strong>
</div>
</div>
<div class="sider-menu">
<a-menu mode="inline" :items="menuItems" :selected-keys="selectedKeys" @click="navigate" />
</div>
<div class="sider-footer">
<a-tooltip :title="appStore.sidebarCollapsed ? '展开侧栏' : '收起侧栏'" placement="top">
<a-button
type="text"
class="sider-collapse"
aria-label="切换侧栏宽度"
@click="appStore.toggleSidebar"
>
<template #icon>
<MenuUnfoldOutlined v-if="appStore.sidebarCollapsed" />
<MenuFoldOutlined v-else />
</template>
</a-button>
</a-tooltip>
</div>
</a-layout-sider>
<a-layout class="app-main">
<header class="tab-header">
<a-tabs
:active-key="activeTab"
:items="tabItems"
type="editable-card"
size="small"
hide-add
:animated="false"
@change="changeTab"
@edit="editTab"
>
<template #rightExtra>
<div class="global-actions">
<a-tooltip title="切换语言" placement="bottom">
<a-dropdown :menu="languageMenu" :trigger="['click']" placement="bottomRight">
<a-button type="text" class="global-action" aria-label="切换语言">
<template #icon><TranslationOutlined /></template>
</a-button>
</a-dropdown>
</a-tooltip>
<a-tooltip title="通知提醒" placement="bottom">
<a-button type="text" class="global-action" aria-label="通知提醒">
<a-badge dot><BellOutlined /></a-badge>
</a-button>
</a-tooltip>
<a-dropdown :menu="userMenu" :trigger="['click']" placement="bottomRight">
<button type="button" class="header-user">
<a-avatar :size="24"><UserOutlined /></a-avatar>
<span>管理员</span>
<DownOutlined class="header-user__arrow" />
</button>
</a-dropdown>
</div>
</template>
</a-tabs>
</header>
<a-layout-content class="app-content">
<router-view v-slot="{ Component, route: currentRoute }">
<transition name="slide" mode="out-in">
<component :is="Component" :key="currentRoute.path" />
</transition>
</router-view>
</a-layout-content>
</a-layout>
</a-layout>
<a-modal v-model:open="profileOpen" title="个人资料" :footer="null" width="420px">
<a-descriptions :column="1" bordered size="small">
<a-descriptions-item label="用户名">admin</a-descriptions-item>
<a-descriptions-item label="姓名">管理员</a-descriptions-item>
<a-descriptions-item label="角色">系统管理员</a-descriptions-item>
<a-descriptions-item label="机构码">{{ authStore.orgid || "--" }}</a-descriptions-item>
</a-descriptions>
</a-modal>
<a-modal
v-model:open="logoutOpen"
title="退出登录"
ok-text="确认退出"
cancel-text="取消"
@ok="confirmLogout"
>
确认退出当前账号吗?
</a-modal>
</template>
<style lang="scss" scoped>
.app-layout {
min-height: 100vh;
background: var(--fms-bg);
}
.app-sider {
position: sticky;
top: 0;
z-index: 20;
height: 100vh;
overflow: hidden;
border-right: 1px solid var(--fms-border);
:deep(.ant-layout-sider-children) {
display: flex;
flex-direction: column;
}
:deep(.ant-menu) {
border-inline-end: 0;
}
}
.sider-menu {
flex: 1;
min-height: 0;
overflow-x: hidden;
overflow-y: auto;
}
.sider-footer {
display: flex;
flex: none;
align-items: center;
justify-content: center;
padding: 5px;
}
.sider-collapse {
width: 100%;
height: 30px;
padding-inline: 0;
color: var(--fms-text-secondary);
font-size: 18px;
}
.brand {
display: flex;
align-items: center;
min-height: 48px;
gap: 8px;
padding: 8px 12px;
&--collapsed {
justify-content: center;
padding-inline: 8px;
.brand__copy {
max-width: 0;
opacity: 0;
transform: translateX(-4px);
}
}
&__mark {
display: grid;
flex: none;
width: 26px;
height: 26px;
place-items: center;
border-radius: 6px;
background: #1677ff;
color: #fff;
font-size: 14px;
font-weight: 700;
}
&__copy {
display: flex;
max-width: 140px;
min-width: 0;
overflow: hidden;
opacity: 1;
line-height: 1;
transform: translateX(0);
transition:
max-width 0.18s ease,
opacity 0.12s ease,
transform 0.18s ease;
strong {
color: var(--fms-text);
font-size: 14px;
font-weight: 650;
white-space: nowrap;
}
}
}
.app-main {
height: 100vh;
min-width: 0;
overflow: hidden;
background: var(--fms-bg);
}
.tab-header {
z-index: 15;
flex: none;
height: 44px;
padding: 6px 8px 0;
border-bottom: 1px solid var(--fms-border);
background: var(--fms-surface);
:deep(.ant-tabs) {
height: 37px;
}
:deep(.ant-tabs-nav) {
margin: 0;
}
:deep(.ant-tabs-content-holder) {
display: none;
}
:deep(.ant-tabs-tab) {
min-width: 80px;
padding: 5px 10px !important;
justify-content: center;
border-radius: 3px 3px 0 0 !important;
}
:deep(.ant-tabs-extra-content) {
height: 37px;
}
}
.global-actions {
display: flex;
height: 36px;
align-items: center;
gap: 6px;
padding-left: 8px;
}
.global-action {
width: 32px;
height: 32px;
padding-inline: 0;
color: var(--fms-text-secondary);
font-size: 18px;
}
.header-user {
display: flex;
height: 32px;
align-items: center;
gap: 6px;
margin-left: 12px;
padding: 0 8px 0 0;
border: 0;
border-radius: 6px;
color: var(--fms-text);
background: transparent;
cursor: pointer;
font-size: 13px;
white-space: nowrap;
&:hover {
background: var(--fms-hover);
}
&__arrow {
color: var(--fms-text-secondary);
font-size: 10px;
}
}
.app-content {
min-height: 0;
overflow-x: hidden;
overflow-y: auto;
padding: 8px;
}
.slide-enter-active,
.slide-leave-active {
transition:
opacity 0.24s ease,
transform 0.24s ease;
}
.slide-enter-from {
opacity: 0;
transform: translateX(18px);
}
.slide-leave-to {
opacity: 0;
transform: translateX(-18px);
}
.slide-enter-to,
.slide-leave-from {
opacity: 1;
transform: translateX(0);
}
</style>
+14 -4
View File
@@ -1,5 +1,15 @@
import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
import { createApp } from "vue";
import { createPinia } from "pinia";
import piniaPluginPersistedstate from "pinia-plugin-persistedstate";
import App from "./App.vue";
import router from "./router";
import "./styles/tailwind.css";
import "./styles/main.scss";
createApp(App).mount('#app')
const app = createApp(App);
const pinia = createPinia();
pinia.use(piniaPluginPersistedstate);
app.use(pinia);
app.use(router);
app.mount("#app");
+82
View File
@@ -0,0 +1,82 @@
import { createRouter, createWebHistory } from "vue-router";
const routes = [
{
path: "/",
component: () => import("../layouts/DefaultLayout.vue"),
children: [
{
path: "",
redirect: "/dashboard",
},
{
path: "dashboard",
name: "dashboard",
component: () => import("../views/DashboardView.vue"),
meta: { title: "工作台", menuKey: "/dashboard" },
},
{
path: "business/orders",
name: "business-orders",
component: () => import("../views/DataListView.vue"),
meta: {
title: "业务单据",
section: "业务管理",
menuKey: "/business/orders",
source: "v_bs_business",
},
},
{
path: "fees/receivable",
name: "fees-receivable",
component: () => import("../views/DataListView.vue"),
meta: {
title: "应收费用",
section: "费用管理",
menuKey: "/fees/receivable",
source: "v_fee_receivable",
},
},
{
path: "reports/operations",
name: "reports-operations",
component: () => import("../views/DataListView.vue"),
meta: {
title: "运营报表",
section: "报表中心",
menuKey: "/reports/operations",
source: "v_report_operations",
},
},
{
path: "system/users",
name: "system-users",
component: () => import("../views/DataListView.vue"),
meta: {
title: "用户管理",
section: "系统设置",
menuKey: "/system/users",
source: "sys_user",
},
},
],
},
{
path: "/:pathMatch(.*)*",
redirect: "/dashboard",
},
];
const router = createRouter({
history: createWebHistory(),
routes,
scrollBehavior: () => ({ top: 0 }),
});
router.beforeEach((to) => {
document.title = to.meta.title ? `${to.meta.title} - FMS 管理系统` : "FMS 管理系统";
return true;
});
export default router;
+22
View File
@@ -0,0 +1,22 @@
import { post } from "./http";
export const authApi = {
login(credentials) {
return post("/api/auth/login", credentials);
},
};
export const dataApi = {
loadData(params) {
return post("/api/data/loaddata", params);
},
loadDataBySql(sql) {
return post("/api/data/loaddatabysql", { sql });
},
page(params) {
return post("/api/data/page", params);
},
saveObject(tables) {
return post("/api/data/saveobjt", { tables });
},
};
+40
View File
@@ -0,0 +1,40 @@
import { useAuthStore } from "../stores/auth";
const API_BASE_URL = import.meta.env.VITE_API_BASE_URL ?? "";
export async function request(path, options = {}) {
const authStore = useAuthStore();
const headers = new Headers(options.headers);
headers.set("Accept", "application/json");
if (options.body && !headers.has("Content-Type")) {
headers.set("Content-Type", "application/json");
}
if (authStore.token) {
headers.set("Authorization", `Bearer ${authStore.token}`);
}
const response = await fetch(`${API_BASE_URL}${path}`, {
...options,
headers,
});
const payload = await response.json().catch(() => null);
if (!response.ok) {
if (response.status === 401) authStore.clearSession();
throw new Error(payload?.message ?? `请求失败 (${response.status})`);
}
if (payload?.code !== undefined && payload.code !== 0) {
throw new Error(payload.message ?? "请求失败");
}
return payload?.data ?? payload;
}
export function post(path, body) {
return request(path, {
method: "POST",
body: JSON.stringify(body),
});
}
+29
View File
@@ -0,0 +1,29 @@
import { defineStore } from "pinia";
export const useAppStore = defineStore("app", {
state: () => ({
locale: "zh-CN",
sidebarCollapsed: false,
visitedTabs: [{ key: "/dashboard", label: "工作台", closable: false }],
}),
actions: {
toggleSidebar() {
this.sidebarCollapsed = !this.sidebarCollapsed;
},
setLocale(locale) {
this.locale = locale;
},
addVisitedTab(tab) {
if (!this.visitedTabs.some((item) => item.key === tab.key)) {
this.visitedTabs.push(tab);
}
},
removeVisitedTab(key) {
this.visitedTabs = this.visitedTabs.filter((item) => item.key !== key);
},
},
persist: {
key: "fms-app",
pick: ["locale", "sidebarCollapsed", "visitedTabs"],
},
});
+39
View File
@@ -0,0 +1,39 @@
import { computed, ref } from "vue";
import { defineStore } from "pinia";
export const useAuthStore = defineStore(
"auth",
() => {
const token = ref("");
const orgid = ref("");
const user = ref(null);
const isAuthenticated = computed(() => Boolean(token.value));
function setSession(payload, organization) {
token.value = payload.token ?? payload.access_token ?? "";
orgid.value = payload.orgid ?? organization;
user.value = payload.user ?? payload.user_info ?? null;
}
function clearSession() {
token.value = "";
orgid.value = "";
user.value = null;
}
return {
token,
orgid,
user,
isAuthenticated,
setSession,
clearSession,
};
},
{
persist: {
key: "fms-auth",
pick: ["token", "orgid", "user"],
},
},
);
-296
View File
@@ -1,296 +0,0 @@
:root {
--text: #6b6375;
--text-h: #08060d;
--bg: #fff;
--border: #e5e4e7;
--code-bg: #f4f3ec;
--accent: #aa3bff;
--accent-bg: rgba(170, 59, 255, 0.1);
--accent-border: rgba(170, 59, 255, 0.5);
--social-bg: rgba(244, 243, 236, 0.5);
--shadow:
rgba(0, 0, 0, 0.1) 0 10px 15px -3px, rgba(0, 0, 0, 0.05) 0 4px 6px -2px;
--sans: system-ui, 'Segoe UI', Roboto, sans-serif;
--heading: system-ui, 'Segoe UI', Roboto, sans-serif;
--mono: ui-monospace, Consolas, monospace;
font: 18px/145% var(--sans);
letter-spacing: 0.18px;
color-scheme: light dark;
color: var(--text);
background: var(--bg);
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
@media (max-width: 1024px) {
font-size: 16px;
}
}
@media (prefers-color-scheme: dark) {
:root {
--text: #9ca3af;
--text-h: #f3f4f6;
--bg: #16171d;
--border: #2e303a;
--code-bg: #1f2028;
--accent: #c084fc;
--accent-bg: rgba(192, 132, 252, 0.15);
--accent-border: rgba(192, 132, 252, 0.5);
--social-bg: rgba(47, 48, 58, 0.5);
--shadow:
rgba(0, 0, 0, 0.4) 0 10px 15px -3px, rgba(0, 0, 0, 0.25) 0 4px 6px -2px;
}
#social .button-icon {
filter: invert(1) brightness(2);
}
}
body {
margin: 0;
}
h1,
h2 {
font-family: var(--heading);
font-weight: 500;
color: var(--text-h);
}
h1 {
font-size: 56px;
letter-spacing: -1.68px;
margin: 32px 0;
@media (max-width: 1024px) {
font-size: 36px;
margin: 20px 0;
}
}
h2 {
font-size: 24px;
line-height: 118%;
letter-spacing: -0.24px;
margin: 0 0 8px;
@media (max-width: 1024px) {
font-size: 20px;
}
}
p {
margin: 0;
}
code,
.counter {
font-family: var(--mono);
display: inline-flex;
border-radius: 4px;
color: var(--text-h);
}
code {
font-size: 15px;
line-height: 135%;
padding: 4px 8px;
background: var(--code-bg);
}
.counter {
font-size: 16px;
padding: 5px 10px;
border-radius: 5px;
color: var(--accent);
background: var(--accent-bg);
border: 2px solid transparent;
transition: border-color 0.3s;
margin-bottom: 24px;
&:hover {
border-color: var(--accent-border);
}
&:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
}
.hero {
position: relative;
.base,
.framework,
.vite {
inset-inline: 0;
margin: 0 auto;
}
.base {
width: 170px;
position: relative;
z-index: 0;
}
.framework,
.vite {
position: absolute;
}
.framework {
z-index: 1;
top: 34px;
height: 28px;
transform: perspective(2000px) rotateZ(300deg) rotateX(44deg) rotateY(39deg)
scale(1.4);
}
.vite {
z-index: 0;
top: 107px;
height: 26px;
width: auto;
transform: perspective(2000px) rotateZ(300deg) rotateX(40deg) rotateY(39deg)
scale(0.8);
}
}
#app {
width: 1126px;
max-width: 100%;
margin: 0 auto;
text-align: center;
border-inline: 1px solid var(--border);
min-height: 100svh;
display: flex;
flex-direction: column;
box-sizing: border-box;
}
#center {
display: flex;
flex-direction: column;
gap: 25px;
place-content: center;
place-items: center;
flex-grow: 1;
@media (max-width: 1024px) {
padding: 32px 20px 24px;
gap: 18px;
}
}
#next-steps {
display: flex;
border-top: 1px solid var(--border);
text-align: left;
& > div {
flex: 1 1 0;
padding: 32px;
@media (max-width: 1024px) {
padding: 24px 20px;
}
}
.icon {
margin-bottom: 16px;
width: 22px;
height: 22px;
}
@media (max-width: 1024px) {
flex-direction: column;
text-align: center;
}
}
#docs {
border-right: 1px solid var(--border);
@media (max-width: 1024px) {
border-right: none;
border-bottom: 1px solid var(--border);
}
}
#next-steps ul {
list-style: none;
padding: 0;
display: flex;
gap: 8px;
margin: 32px 0 0;
.logo {
height: 18px;
}
a {
color: var(--text-h);
font-size: 16px;
border-radius: 6px;
background: var(--social-bg);
display: flex;
padding: 6px 12px;
align-items: center;
gap: 8px;
text-decoration: none;
transition: box-shadow 0.3s;
&:hover {
box-shadow: var(--shadow);
}
.button-icon {
height: 18px;
width: 18px;
}
}
@media (max-width: 1024px) {
margin-top: 20px;
flex-wrap: wrap;
justify-content: center;
li {
flex: 1 1 calc(50% - 8px);
}
a {
width: 100%;
justify-content: center;
box-sizing: border-box;
}
}
}
#spacer {
height: 88px;
border-top: 1px solid var(--border);
@media (max-width: 1024px) {
height: 48px;
}
}
.ticks {
position: relative;
width: 100%;
&::before,
&::after {
content: '';
position: absolute;
top: -4.5px;
border: 5px solid transparent;
}
&::before {
left: 0;
border-left-color: var(--border);
}
&::after {
right: 0;
border-right-color: var(--border);
}
}
+60
View File
@@ -0,0 +1,60 @@
:root {
color: #1f2329;
background: #f5f7fa;
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
* {
box-sizing: border-box;
}
html,
body,
#app,
.ant-app,
.theme-root {
min-height: 100%;
margin: 0;
}
body {
min-width: 1200px;
}
button,
input,
textarea,
select {
font: inherit;
}
a {
text-decoration: none;
}
.theme-root {
--fms-bg: #f5f7fa;
--fms-surface: #ffffff;
--fms-border: #e5e8eb;
--fms-hover: #f2f3f5;
--fms-text: #1f2329;
--fms-text-secondary: #646a73;
--fms-shadow: 0 4px 12px rgb(31 35 41 / 6%);
color: var(--fms-text);
background: var(--fms-bg);
}
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
scroll-behavior: auto !important;
transition-duration: 0.01ms !important;
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
}
}
+2
View File
@@ -0,0 +1,2 @@
@import "tailwindcss";
@import "@antdv-next/tailwind/compat.css";
@@ -0,0 +1,218 @@
<script setup>
import {
CheckCircleOutlined,
ClockCircleOutlined,
DollarOutlined,
FileTextOutlined,
PlusOutlined,
} from "@antdv-next/icons";
const metrics = [
{ label: "今日新增", value: "0", tone: "blue", icon: FileTextOutlined },
{ label: "待处理", value: "0", tone: "amber", icon: ClockCircleOutlined },
{ label: "本月应收", value: "¥ 0.00", tone: "green", icon: DollarOutlined },
{ label: "本月完成", value: "0", tone: "gray", icon: CheckCircleOutlined },
];
const columns = [
{ title: "单据编号", dataIndex: "id", key: "id" },
{ title: "客户名称", dataIndex: "customer", key: "customer" },
{ title: "业务状态", dataIndex: "status", key: "status" },
{ title: "更新时间", dataIndex: "updatedAt", key: "updatedAt" },
];
</script>
<template>
<div class="dashboard">
<section class="metric-grid" aria-label="业务概览">
<article v-for="item in metrics" :key="item.label" class="metric-card">
<div class="metric-card__copy">
<span>{{ item.label }}</span>
<strong>{{ item.value }}</strong>
</div>
<div class="metric-card__icon" :class="`metric-card__icon--${item.tone}`">
<component :is="item.icon" />
</div>
</article>
</section>
<section class="dashboard-grid">
<div class="panel work-panel">
<div class="panel__header">
<div>
<h2>待办业务</h2>
<span>最近更新</span>
</div>
<a-button type="primary">
<template #icon><PlusOutlined /></template>
新建业务
</a-button>
</div>
<a-table
:columns="columns"
:data-source="[]"
:pagination="false"
size="middle"
:scroll="{ x: 620 }"
/>
</div>
<div class="panel quick-panel">
<div class="panel__header">
<div>
<h2>快捷入口</h2>
<span>常用操作</span>
</div>
</div>
<nav class="quick-links">
<router-link to="/business/orders">
<FileTextOutlined />
<span>业务单据</span>
</router-link>
<router-link to="/fees/receivable">
<DollarOutlined />
<span>应收费用</span>
</router-link>
<router-link to="/reports/operations">
<CheckCircleOutlined />
<span>运营报表</span>
</router-link>
</nav>
</div>
</section>
</div>
</template>
<style lang="scss" scoped>
.dashboard {
display: grid;
gap: 8px;
}
.metric-grid {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 8px;
}
.metric-card {
display: flex;
min-width: 0;
align-items: center;
justify-content: space-between;
padding: 10px 12px;
border: 1px solid var(--fms-border);
border-radius: 4px;
background: var(--fms-surface);
&__copy {
display: flex;
min-width: 0;
flex-direction: column;
span {
color: var(--fms-text-secondary);
font-size: 12px;
}
strong {
margin-top: 4px;
overflow: hidden;
color: var(--fms-text);
font-size: 19px;
line-height: 1.2;
text-overflow: ellipsis;
white-space: nowrap;
}
}
&__icon {
display: grid;
flex: none;
width: 34px;
height: 34px;
place-items: center;
border-radius: 4px;
font-size: 17px;
&--blue {
background: #e6f4ff;
color: #1677ff;
}
&--amber {
background: #fff7e6;
color: #d46b08;
}
&--green {
background: #f0f9eb;
color: #389e0d;
}
&--gray {
background: #f2f3f5;
color: #4e5969;
}
}
}
.dashboard-grid {
display: grid;
grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
gap: 8px;
}
.panel {
min-width: 0;
border: 1px solid var(--fms-border);
border-radius: 4px;
background: var(--fms-surface);
&__header {
display: flex;
min-height: 46px;
align-items: center;
justify-content: space-between;
gap: 8px;
padding: 7px 10px;
border-bottom: 1px solid var(--fms-border);
h2 {
margin: 0;
color: var(--fms-text);
font-size: 13px;
}
span {
color: var(--fms-text-secondary);
font-size: 11px;
}
}
}
.work-panel :deep(.ant-table-wrapper) {
padding: 0 2px 2px;
}
.quick-links {
display: grid;
padding: 4px;
a {
display: flex;
min-height: 36px;
align-items: center;
gap: 8px;
padding: 5px 7px;
border-radius: 3px;
color: var(--fms-text);
font-size: 12px;
&:hover {
background: var(--fms-hover);
color: #1677ff;
}
}
}
</style>
+140
View File
@@ -0,0 +1,140 @@
<script setup>
import { computed, reactive, ref, watch } from "vue";
import { useRoute } from "vue-router";
import { PlusOutlined, ReloadOutlined, SearchOutlined } from "@antdv-next/icons";
const route = useRoute();
const loading = ref(false);
const rows = ref([]);
const total = ref(0);
const filters = reactive({ keyword: "" });
const pagination = reactive({ current: 1, pageSize: 20 });
const title = computed(() => route.meta.title);
const columns = computed(() => [
{ title: "编号", dataIndex: "id", key: "id", width: 180 },
{ title: "名称", dataIndex: "name", key: "name" },
{ title: "状态", dataIndex: "state", key: "state", width: 120 },
{ title: "更新时间", dataIndex: "updated_at", key: "updated_at", width: 180 },
]);
function loadData() {
loading.value = true;
rows.value = [];
total.value = 0;
loading.value = false;
}
function reset() {
filters.keyword = "";
pagination.current = 1;
loadData();
}
watch(() => route.meta.source, loadData, { immediate: true });
</script>
<template>
<div class="data-page">
<section class="data-toolbar">
<div class="data-toolbar__title">
<h1>{{ title }}</h1>
<span>共 {{ total }} 条</span>
</div>
<a-button type="primary">
<template #icon><PlusOutlined /></template>
新增
</a-button>
</section>
<section class="filter-bar">
<a-input
v-model:value="filters.keyword"
class="keyword-input"
placeholder="输入名称查询"
allow-clear
@press-enter="loadData"
>
<template #prefix><SearchOutlined /></template>
</a-input>
<a-button type="primary" @click="loadData">查询</a-button>
<a-button @click="reset">
<template #icon><ReloadOutlined /></template>
重置
</a-button>
</section>
<section class="table-panel">
<a-table
row-key="id"
:columns="columns"
:data-source="rows"
:loading="loading"
:pagination="{
current: pagination.current,
pageSize: pagination.pageSize,
total,
showSizeChanger: true,
showTotal: (value) => `共 ${value} 条`,
}"
:scroll="{ x: 760 }"
/>
</section>
</div>
</template>
<style lang="scss" scoped>
.data-page {
display: grid;
gap: 8px;
}
.data-toolbar,
.filter-bar {
display: flex;
align-items: center;
}
.data-toolbar {
justify-content: space-between;
gap: 8px;
&__title {
display: flex;
align-items: baseline;
gap: 6px;
h1 {
margin: 0;
color: var(--fms-text);
font-size: 16px;
}
span {
color: var(--fms-text-secondary);
font-size: 11px;
}
}
}
.filter-bar {
flex-wrap: wrap;
gap: 6px;
padding: 8px;
border: 1px solid var(--fms-border);
border-radius: 4px;
background: var(--fms-surface);
}
.keyword-input {
width: 240px;
}
.table-panel {
min-width: 0;
padding: 0;
border: 1px solid var(--fms-border);
border-radius: 4px;
background: var(--fms-surface);
}
</style>
+158
View File
@@ -0,0 +1,158 @@
<script setup>
import { reactive, ref } from "vue";
import { useRoute, useRouter } from "vue-router";
import { LockOutlined, UserOutlined } from "@antdv-next/icons";
import { authApi } from "../services/api";
import { useAuthStore } from "../stores/auth";
const route = useRoute();
const router = useRouter();
const authStore = useAuthStore();
const loading = ref(false);
const errorMessage = ref("");
const form = reactive({
orgid: "",
username: "",
password: "",
});
async function submit() {
errorMessage.value = "";
loading.value = true;
try {
const session = await authApi.login(form);
authStore.setSession(session, form.orgid);
await router.replace(route.query.redirect || "/dashboard");
} catch (error) {
errorMessage.value = error.message || "登录失败";
} finally {
loading.value = false;
}
}
</script>
<template>
<main class="login-page">
<section class="login-shell">
<div class="login-brand">
<div class="login-brand__mark">F</div>
<div>
<h1>FMS 管理系统</h1>
<p>机构业务管理平台</p>
</div>
</div>
<a-form layout="vertical" :model="form" @finish="submit">
<a-alert
v-if="errorMessage"
class="login-alert"
type="error"
show-icon
:message="errorMessage"
/>
<a-form-item
label="机构码"
name="orgid"
:rules="[{ required: true, message: '请输入机构码' }]"
>
<a-input v-model:value="form.orgid" size="large" autocomplete="organization" />
</a-form-item>
<a-form-item
label="用户名"
name="username"
:rules="[{ required: true, message: '请输入用户名' }]"
>
<a-input v-model:value="form.username" size="large" autocomplete="username">
<template #prefix><UserOutlined /></template>
</a-input>
</a-form-item>
<a-form-item
label="密码"
name="password"
:rules="[{ required: true, message: '请输入密码' }]"
>
<a-input-password
v-model:value="form.password"
size="large"
autocomplete="current-password"
>
<template #prefix><LockOutlined /></template>
</a-input-password>
</a-form-item>
<a-button type="primary" html-type="submit" size="large" block :loading="loading">
登录
</a-button>
</a-form>
</section>
</main>
</template>
<style lang="scss" scoped>
.login-page {
display: grid;
min-height: 100vh;
place-items: center;
padding: 24px;
background:
linear-gradient(90deg, var(--fms-border) 1px, transparent 1px),
linear-gradient(var(--fms-border) 1px, transparent 1px), var(--fms-bg);
background-size: 32px 32px;
}
.login-shell {
width: min(100%, 400px);
padding: 30px;
border: 1px solid var(--fms-border);
border-radius: 8px;
background: var(--fms-surface);
box-shadow: var(--fms-shadow);
}
.login-brand {
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 28px;
&__mark {
display: grid;
width: 44px;
height: 44px;
place-items: center;
border-radius: 7px;
background: #1677ff;
color: #fff;
font-size: 22px;
font-weight: 700;
}
h1 {
margin: 0;
color: var(--fms-text);
font-size: 20px;
}
p {
margin: 3px 0 0;
color: var(--fms-text-secondary);
font-size: 13px;
}
}
.login-alert {
margin-bottom: 18px;
}
@media (max-width: 480px) {
.login-page {
padding: 0;
background: var(--fms-surface);
}
.login-shell {
border: 0;
box-shadow: none;
}
}
</style>
+9 -7
View File
@@ -1,14 +1,16 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { AntdvNextResolver } from '@antdv-next/auto-import-resolver'
import Components from 'unplugin-vue-components/vite'
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import tailwindcss from "@tailwindcss/vite";
import { AntdvNextResolver } from "@antdv-next/auto-import-resolver";
import Components from "unplugin-vue-components/vite";
// https://vite.dev/config/
export default defineConfig({
plugins: [vue(),
plugins: [
tailwindcss(),
vue(),
Components({
resolvers: [AntdvNextResolver()],
}),
],
})
});