上传文件至 .vitepress

This commit is contained in:
2026-04-13 12:27:43 +08:00
parent 9f29ace92a
commit da2eb7841b
2 changed files with 305 additions and 0 deletions

211
.vitepress/config.mjs Normal file
View File

@@ -0,0 +1,211 @@
import { defineConfig } from 'vitepress'
export default defineConfig({
title: 'HF-MES v5.0 使用手册',
description: 'HF-MES v5.0 制造执行系统完整使用指南',
lang: 'zh-CN',
themeConfig: {
logo: '/logo.svg',
siteTitle: 'HF-MES v5.0 使用手册',
nav: [
{ text: '首页', link: '/' },
{
text: '文档说明',
items: [
{ text: '文档说明', link: '/guide/document-guide' },
{ text: '系统概述', link: '/guide/system-overview' }
]
},
{
text: '快速入门',
items: [
{ text: '快速入门', link: '/getting-started/quick-start' }
]
},
{
text: '基础配置',
items: [
{ text: '基础数据管理', link: '/basic/data-management' },
{ text: '设备管理', link: '/basic/equipment' }
]
},
{
text: '业务模块',
items: [
{ text: '生产管理', link: '/business/production' },
{ text: '质量管理', link: '/business/quality' },
{ text: '仓储物流', link: '/business/warehouse' },
{ text: '设备仓储', link: '/business/equipment-warehouse' }
]
},
{
text: '数据集成',
items: [
{ text: '数据与集成', link: '/integration/data-integration' }
]
},
{
text: '报表分析',
items: [
{ text: '报表与分析', link: '/analysis/reports' }
]
},
{
text: '系统运维',
items: [
{ text: '系统运维', link: '/operation/system-operation' },
{ text: '技术支持', link: '/operation/technical-support' }
]
},
{
text: '附录',
items: [
{ text: '术语表', link: '/appendix/glossary' }
]
}
],
sidebar: {
'/guide/': [
{
text: '文档管理篇',
items: [
{ text: '文档说明', link: '/guide/document-guide' }
]
},
{
text: '系统认知篇',
items: [
{ text: '系统概述', link: '/guide/system-overview' }
]
}
],
'/getting-started/': [
{
text: '快速入门篇',
items: [
{ text: '快速入门', link: '/getting-started/quick-start' }
]
}
],
'/basic/': [
{
text: '基础配置篇',
items: [
{ text: '基础数据管理', link: '/basic/data-management' },
{ text: '设备基础信息', link: '/basic/equipment' }
]
}
],
'/business/': [
{
text: '生产管理篇',
items: [
{ text: '生产管理', link: '/business/production' }
]
},
{
text: '质量管理篇',
items: [
{ text: '质量与追溯', link: '/business/quality' }
]
},
{
text: '仓储物流篇',
items: [
{ text: '设备与仓储', link: '/business/equipment-warehouse' }
]
}
],
'/integration/': [
{
text: '数据集成篇',
items: [
{ text: '数据与集成', link: '/integration/data-integration' }
]
}
],
'/analysis/': [
{
text: '报表分析篇',
items: [
{ text: '报表与分析', link: '/analysis/reports' }
]
}
],
'/operation/': [
{
text: '系统运维篇',
items: [
{ text: '系统运维', link: '/operation/system-operation' }
]
},
{
text: '技术支持篇',
items: [
{ text: '异常处理与技术支持', link: '/operation/technical-support' }
]
}
],
'/appendix/': [
{
text: '附录篇',
items: [
{ text: '术语表', link: '/appendix/glossary' }
]
}
]
},
socialLinks: [
{ icon: 'github', link: 'https://github.com/vuejs/vitepress' }
],
footer: {
message: 'HF-MES v5.0 使用手册',
copyright: 'Copyright © 2026 All Rights Reserved'
},
search: {
provider: 'local'
},
editLink: {
pattern: 'https://github.com/vuejs/vitepress/edit/main/docs/:path',
text: '在 GitHub 上编辑此页'
},
lastUpdated: {
text: '最后更新于',
formatOptions: {
dateStyle: 'short',
timeStyle: 'short'
}
},
outline: {
level: [2, 3],
label: '目录'
},
docFooter: {
prev: '← 上一页',
next: '下一页 →'
}
},
markdown: {
theme: {
light: 'github-light',
dark: 'github-dark'
},
lineNumbers: false
},
head: [
['link', { rel: 'icon', href: '/favicon.ico' }],
['meta', { name: 'author', content: 'HF-MES' }],
['meta', { name: 'viewport', content: 'width=device-width, initial-scale=1.0' }]
]
})

View File

@@ -0,0 +1,94 @@
import { defineUserConfig } from 'vitepress-export-pdf'
import userConfig from './config.mjs'
function extractLinksFromConfig(config: DefaultTheme.Config) {
const links: string[] = []
function extractLinks(sidebar: DefaultTheme.SidebarItem[]) {
for (const item of sidebar) {
if (item.items)
extractLinks(item.items)
else if (item.link)
links.push(`${item.link}.html`)
}
}
for (const key in config.sidebar)
extractLinks(config.sidebar[key])
return links
}
const links = extractLinksFromConfig(userConfig.themeConfig!)
export default defineUserConfig({
sorter: (pageA, pageB) => {
const routeOrder = [
'/index.html',
...links,
]
const aIndex = routeOrder.findIndex(route => route === pageA.path)
const bIndex = routeOrder.findIndex(route => route === pageB.path)
if (aIndex === -1 && bIndex === -1) {
return pageA.path.localeCompare(pageB.path)
}
if (aIndex === -1) return 1
if (bIndex === -1) return -1
return aIndex - bIndex
},
outFile: 'HF-MES-v5.0-使用手册.pdf',
outDir: 'docs',
routePatterns: ['/**'],
pdfOptions: {
format: 'A4',
margin: {
top: '20mm',
right: '15mm',
bottom: '20mm',
left: '15mm'
},
printBackground: true,
preferCSSPageSize: true,
displayHeaderFooter: true,
headerTemplate: `
<div style="font-size: 10px; width: 100%; text-align: center; color: #666; font-family: 'Microsoft YaHei', '微软雅黑', 'Microsoft YaHei UI', 'PingFang SC', sans-serif;">
<span class="title"></span>
</div>
`,
footerTemplate: `
<div style="font-size: 10px; width: 100%; display: flex; justify-content: space-between; padding: 0 15mm; font-family: 'Microsoft YaHei', '微软雅黑', 'Microsoft YaHei UI', 'PingFang SC', sans-serif;">
<span>HF-MES v5.0 使用手册</span>
<span><span class="pageNumber"></span> / <span class="totalPages"></span></span>
</div>
`
},
pdfOutlines: true,
puppeteerLaunchOptions: {
headless: true,
timeout: 60000,
args: [
'--no-sandbox',
'--disable-setuid-sandbox',
'--disable-dev-shm-usage',
'--disable-gpu',
'--disable-software-rasterizer',
'--no-first-run',
'--no-zygote',
'--single-process',
'--font-render-hinting=none',
'--disable-font-subpixel-positioning',
'--force-color-profile=srgb',
],
env: {
FC_LANG: 'zh-CN',
LANG: 'zh_CN.UTF-8',
LC_ALL: 'zh_CN.UTF-8',
},
dumpio: false,
}
})