web-admin 工程的界面实现 SHALL 以 docs/web-admin-ui-spec-fresh-mint.md 及其中引用的 docs/fresh-mint-green.html 为权威来源;主色链 SHALL 使用文档定义的 Mint 绿系(如 --primary #10b981 等),不得擅自替换为小程序品牌色。
web-admin 新增标准列表/表单页#/demo/unit、#/demo/order)所体现的模式miniprogram 工程的界面 SHALL 以 docs/miniprogram-ui-spec-sanqiang.md 及其中列出的 mobile-ui/sanqiang-*.html 为权威来源;品牌绿、大麦黄与中性色 SHALL 采用规范 §2 Token,不得直接复用 Web 端 Fresh Mint 色板作为主色。
除非产品书面要求,Web 管理端 SHALL NOT 使用小程序规范中的 #0a9f6d 等作为主色;小程序 SHALL NOT 使用 #10b981 作为主色替代品牌绿。
涉及树形主数据(分类、库位、组织等)时,Web 端 SHALL 遵循:下拉/树节点展示本级名称,选中后在输入框、表格、导出与查看弹窗中展示全路径;路径分隔符 SHALL 与工程约定一致(当前为 /,见 web-admin/src/utils/tree-path.ts 与规范 §5.6)。
Web 管理端弹窗 SHALL 遵循规范:表单 label-position="top";遮罩 SHALL NOT 使用背景模糊(backdrop-filter: none 等与仓库既有策略一致)。
el-dialog 承载表单docs/web-admin-ui-spec-fresh-mint.md 中 el-dialog 小节小程序列表缩略图、轮播与详情图 SHALL 遵循 docs/miniprogram-ui-spec-sanqiang.md §7.0 的宽高比与 mode 约定;可点击控件 SHALL 满足最小触控区域(规范中的 44×44 等要求)。
aspectFill(与规范 §7.0.1 一致)web-admin 所有左侧菜单对应的页面 SHALL NOT 包含顶部 <header class="page-head">(或 <div class="page-head">)区块,即不在页面顶部展示 <h1> 大标题和 <p class="page-desc"> 描述文字。页面内容 SHALL 直接从 <section class="panel">(或 <div class="panel">)开始。
理由:左侧菜单已提供当前页面名称,顶部大标题和描述属于冗余信息,移除后页面更简洁、内容区更大。
<header class="page-head"> 或 <div class="page-head"> 元素<section class="panel"> 或 <div class="panel"> 作为第一个子内容块src/views/**/*.vue)class="page-head" 元素web-admin 中列表面板 panel-top 下的主标题(h2.title-bar-heading)SHALL 在标题文案前展示 主色竖条(与全局 app.scss 中 h2.title-bar-heading::before 一致);含「租户」「用户」等易歧义文案的标题 SHALL 通过 App.vue 中 panelTitleBarTextRules 显式纳入竖条样式,避免子串误匹配为其它图标。
重要:App.vue 中 panelTitleBarTextRules 是标题竖条样式的唯一触发入口。新增任何包含 panel-top > h2 标题的页面时,开发者 SHALL 将该标题文案追加到 panelTitleBarTextRules 正则表达式的 | 分隔列表中。遗漏将导致标题无绿色竖条而显示为无样式或错误图标。
#/system/tenant 租户管理页panel-top > h2 标题的列表页(如标题为"XXX列表")App.vue 的 panelTitleBarTextRules 正则中追加该标题文案(用 | 分隔)panel-top > h2 标题App.vue 的 panelTitleBarTextRules 已同步更新web-admin 中弹窗(el-dialog)和面板内的子区域标题(如「选择部门」「已选用户」「基本信息」「参数配置」等区块标题)SHALL 在文字左侧展示主色竖条装饰(border-left: 3px solid #10b981,padding-left: 10px),与列表面板主标题的竖条风格保持一致。子区域标题与字段标签(el-form-item label 或 dt)SHALL 形成明显视觉区分:子区域标题使用深色文字 + 竖条,字段标签使用辅助灰色、无竖条。
此规则适用于以下场景的区块标题:
data-scope-col-title 类标题。data-scope-summary-heading 类标题。SystemViewDialog 的 section title(h3)。panel-section-title 类标题。section-title、col-title、summary-heading 等类名作为区块标题border-left: 3px solid #10b981 + padding-left: 10px 展示主色竖条使用 Element Plus el-dialog 承载新增/编辑表单时,系统 SHALL 满足:
.form-grid-2,grid-template-columns: repeat(2, minmax(0, 1fr)),gap: 12px 20px);字段较多时 SHALL 通过加宽 width 并选用 .form-grid-3、.form-grid-4 或 .form-grid-5 扩展列数,列数上限为 5;跨整行长字段 SHALL 使用 .form-col-span-2(grid-column: 1 / -1)。app.scss 中 @media (max-width: 900px)、(max-width: 560px) 规则一致)。ElConfigProvider 的 dialog.alignCenter 及 Element Plus 默认遮罩层居中行为)。.dialog-form-layout 类名的弹窗壳层 SHALL max-height: calc(100vh - 100px),保证相对视口上下各 至少约 50px 可视留白;弹窗 SHALL NOT 以固定高度占满视口;当内容超出时 仅 .el-dialog__body 区域出现纵向滚动条,页头与底栏固定不滚动。dialog-form-layout 且正文区在内容过多时可滚动el-dialog 的 width 并选用 form-grid-3 至 form-grid-5 之一,且 SHALL NOT 使用超过 5 列的栅格类web-admin 中的图标 SHALL 优先使用 Element Plus 内置图标(@element-plus/icons-vue),通过 ArtSvgIcon 组件的 EP 图标映射(src/utils/ui/ep-icon-map.ts)渲染;SHALL NOT 在新增代码中直接使用 Iconify 远程图标名(如 ri:xxx、fluent:xxx)。仅在 Element Plus 无等价图标时,方可保留 Iconify 图标名作为例外。
src/router/modules/ 中新增路由并设置 meta.iconicon 值 SHALL 使用 ep-icon-map.ts 中已注册的名称(如 setting、grid),SHALL NOT 使用 ri: 前缀的 Iconify 名<ArtSvgIcon icon="ep-icon-name" /> 或 <el-icon><XxxIcon /></el-icon>,SHALL NOT 使用 <ArtSvgIcon icon="ri:xxx" /> 除非 Element Plus 无等价图标ep-icon-map.ts 尚未注册ep-icon-map.ts 中注册映射条目,再在业务代码中使用web-admin 中所有业务列表页(系统管理、业务模块等,不含 Demo 参考页)的 el-table 操作列 SHALL 使用 fixed="right" 固定在表格右侧。宽度规则:2 个按钮时 min-width="260",3 个按钮时 min-width="320",4 个及以上按钮时 min-width="400"。全局 CSS 通过 .el-table-fixed-column--right 选择器(注意:Element Plus 使用单短横线,非双下划线)提供固定列样式。
fixed="right",宽度按按钮数设置:≤ 2 按钮用 min-width="260",3 按钮用 min-width="320",≥ 4 按钮用 min-width="400"el-table-column 且 label="操作"fixed="right" 属性,且宽度与按钮数量匹配(2 按钮 260px,3+ 按钮 320px)web-admin 中所有 el-table 的列宽属性 SHALL 使用 min-width 替代 width,使浏览器视口宽度变化时各列按基础比例等比伸缩。
原理:Element Plus 的布局逻辑是,所有 min-width 列按各自 min-width 值的比例分配容器可用宽度;当容器宽度小于所有 min-width 之和时,触发横向滚动。若部分列使用 width(固定宽度),则多余空间全部由 min-width 列吸收,导致视口加宽时只有 min-width 列变宽而 width 列不变。
规则:
el-table-column(包括序号列、数据列、操作列)SHALL 使用 min-width 设定基础宽度,SHALL NOT 使用 width。min-width 值即为该列的最小可读宽度,也是等比分配的权重基数。el-table 本身的 width 属性(如弹窗内嵌表格的固定总宽)不受此规则约束。el-tableel-table-column 的宽度属性 SHALL 使用 min-width,SHALL NOT 使用 widthmin-width 设定的基础比例等比伸缩el-table-column 且使用 width 属性min-widthweb-admin 左侧菜单区域的图标展示 SHALL 遵循以下层级规则:
meta.icon)。DualMenu)左侧一级图标栏 SHALL 为每个一级菜单项渲染图标,与侧边栏一级规则一致。HorizontalMenu)和混合菜单(MixedMenu)如使用图标,SHALL 与侧边栏保持相同的层级规则。web-admin 主页,查看左侧菜单区域的一级菜单项meta.icon 对应的图标SidebarSubmenu.vue 或其他菜单组件中图标渲染逻辑level === 0 条件判断保持不变,仅一级菜单渲染图标web-admin 顶部标签页区域(WorkTab strip)的每个标签 SHALL 仅展示文字标题,SHALL NOT 展示图标。路由 meta.icon 仅用于侧边栏菜单,SHALL NOT 传递到标签页渲染。
art-work-tab/index.vue 或 utils/navigation/worktab.tssetWorktab 不向 openTab 传递 icon 字段web-admin 中弹窗表单(el-form-item)如需对某字段添加辅助说明文字(如"数值越小越靠前"),该注释 SHALL 以小字形式直接显示在 label 文字后方,SHALL NOT 放置在输入控件旁边或下方。实现方式为使用 el-form-item 的 #label 插槽,在 label 文字后追加 <span class="form-label-tip">注释内容</span>。样式类 form-label-tip 定义在全局 app.scss 中(字号 12px、font-weight: 400、使用 --mint-text-muted 颜色)。
orderNum).form-label-tip 样式类,SHALL NOT 使用 .sort-field + .form-tip 的旧模式<template #label>字段名<span class="form-label-tip">注释内容</span></template> 格式,SHALL NOT 将注释放在输入控件旁web-admin 中所有 el-table 组件——包括主列表页(标准列表、树形列表)、弹窗内嵌列表(如编辑弹窗/查看弹窗/选择弹窗中的子表格)、侧栏面板内的列表——若操作列包含「查看」「查看详情」「查看确认信息」等只读查看类按钮,SHALL 同时提供行双击触发查看的能力,实现规则如下:
<el-icon><View /></el-icon>查看),点击后弹出只读查看弹窗。el-table SHALL 监听 @row-dblclick 事件,双击任意行时触发与「查看」按钮相同的弹窗(即调用同一 handleView(row) 函数)。@row-dblclick handler SHALL 仅在「查看」类按钮可见时触发对应查看函数,其余状态下可忽略或调用对应主操作函数。SystemViewDialog 共享组件(src/components/business/system-view-dialog/index.vue),样式对齐待办中心「查看详情」弹窗(无标题栏、hero 渐变头图 + 图标、KV grid 字段展示、关闭按钮)。id、del_flag 等技术字段。长文本/备注字段 SHALL 使用 span: true 跨两列展示。SystemViewDialog 的 section title,渲染为 h3)SHALL 与字段标签(dt)形成明显视觉区分。区块标题 SHALL 使用深色文字(#1e293b)配合左侧主色竖条装饰(border-left: 3px solid #10b981),字号 14px、font-weight: 600;字段标签 SHALL 保持为辅助灰色(#64748b)、font-weight: 500。区块标题样式 SHALL NOT 与字段标签使用相同颜色或相近字重。el-table SHALL 绑定 @row-dblclick="handleView" 事件SystemViewDialog 弹窗@row-dblclick 双击事件,两者调用同一个 handleView 函数el-tableel-table 绑定了 @row-dblclick 事件,且操作列包含「查看」按钮web-admin 中所有只读查看弹窗(SystemViewDialog 及类似组件)中,存储为编码(code / value)的字段 SHALL 展示为对应的人类可读标签(label),SHALL NOT 直接展示原始编码值。这包括但不限于:字典编码→字典标签、状态编码→状态文本、站点类型编码→类型名称等。
对于多值编码字段(如逗号分隔的编码串),SHALL 逐个编码转换为标签后以顿号(、)连接展示;无匹配标签时 SHALL 回退展示原始编码值。
businessScopeOptions、statusOptions 等)将编码翻译为标签后展示web-admin 中所有列表页的表格列、新增弹窗表单、编辑弹窗表单 SHALL NOT 默认包含排序字段(sortOrder、orderNum、排序等)。排序字段仅在产品明确要求时按需添加,不应作为默认 UI 元素。
web-admin 列表页筛选区(.filter-block 内 .filter-grid)若包含关键词模糊检索字段(label 为「关键词」或等效语义、el-input 绑定 keyword 等),该字段 SHALL 作为 .filter-grid 中第一个 el-form-item,位于下拉筛选、状态筛选、日期范围等条件字段之前。落地参考:#/demo/unit、#/demo/user 及质检模块「入库放行审核」页。
el-form-item SHALL 位于 .filter-grid 首位.filter-grid 中第一个字段 SHALL 为「关键词」,其后依次为协议类别、审核结论、入库状态等条件.filter-block 筛选字段.filter-grid 第一位web-admin 所有列表页的筛选表单(.filter-block 内 searchForm / filterForm)SHALL 使用 watchDebounced(来自 @vueuse/core,已 auto-import)对筛选表单做 deep watch,当任意字段值变更后 300ms 防抖自动触发搜索(重置页码为 1 并调用数据加载函数),无需用户手动点击「搜索」按钮。「搜索」按钮 SHALL 保留作为手动触发入口。
watchDebounced(
searchForm, // 或 filterForm
() => {
pagination.page = 1
loadData()
},
{ debounce: 300, deep: true }
)
对于含有独立日期范围选择器(dateRange ref,不属于 searchForm)的页面(如 material-stock-log、qc-material-usage),SHALL 额外添加 watch(dateRange, ...) 监听,在日期变更时同样触发搜索。
dateRange ref(非 searchForm 内字段)进行日期范围筛选watch(dateRange, ...) 监听变更并触发搜索watchDebounced 自动搜索,且 debounce 不超过 500msweb-admin 弹窗表单中的附件上传与展示 SHALL 采用卡片化布局,实现与交互以 web-admin/src/views/cell-storage/protocol/ProtocolFormDialog.vue 中「协议附件」为权威参考;储存证等业务弹窗(如 web-admin/src/views/cell-storage/storage-cert/index.vue)SHALL 复用同一套 DOM 结构、类名与样式规则,仅调整 el-form-item 的 label 与上传 folder 等业务参数。
el-form-item(建议 class="form-col-span-2" 占满弹窗栅格宽)→ .attachment-upload → .attachment-list(flex 行)→ 上传卡片 + 若干 .attachment-item;.upload-hint 在 flex 行下方独立一行。border: 1px dashed #a7f3d0;background: #f0fdf4;border-radius: 8px;居中 Plus(size 28,#10b981)+ 文案「上传附件」(.upload-card-text,12px #10b981 font-weight 500)。hover:border-color: #10b981、border-style: solid、background: #ecfdf5。border: 1px solid #e2e8f0;border-radius: 8px;hover:border-color: #10b981、box-shadow: 0 2px 8px rgba(16, 185, 129, 0.1)。.attachment-preview):背景 #f8fafc;图片已上传且 fileUrl 存在时显示缩略图(object-fit: cover),可点击预览;图片上传中无 URL 时显示 Loading;视频显示 .attachment-preview__icon--video(#ede9fe / #7c3aed + VideoPlay);其他文件显示 .attachment-preview__icon--doc(#e0f2fe / #0284c7 + Document)。.attachment-footer):文件名 .attachment-name(11px #334155,最多 2 行省略,title 为完整文件名);.attachment-actions 居中排列 下载(Download)、删除(Delete,.action-btn--danger hover 红色)。.attachment-item.is-uploading → opacity: 0.6、pointer-events: none。.upload-hint — 11px #94a3b8,margin-top: 8px;默认文案:「支持图片、视频、PDF、Word、Excel等文件,单文件不超过 20MB」。#10b981、#a7f3d0、#f0fdf4、#ecfdf5);SHALL NOT 使用小程序主色 #0a9f6d。el-upload 的 list-type="picture-card"、默认 file-list 展示,或单独一行纯文字「选择文件」按钮替代上传卡片。el-upload 配置| 属性 | 值 |
|---|---|
:auto-upload |
false |
:show-file-list |
false |
:multiple |
true |
accept |
image/*,video/*,.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.txt,.zip,.rar |
@change |
选中后立即走上传逻辑(见下) |
上传卡片 SHALL 作为 .attachment-list 的第一个子元素,且始终渲染(不因已有附件数量而隐藏)。
附件列表 SHALL 为响应式数组,元素至少包含:id、fileName、fileUrl、fileType(可选)、_uploading(可选布尔)。
ElMessage.error 并 clearFiles()。_uploading: true、fileUrl: '');FormData 调用 fetchUploadAttachment(@/api/business),fd.append('folder', '<业务目录>')(如 protocol、storage-cert、protocol-payment);成功后回填 fileUrl 等字段并 _uploading: false;失败则移除该项并提示。nextTick 后 uploadRef.clearFiles(),避免同一文件无法重复选择。splice 移除,不单独调删除接口(除非产品另有要求)。@/utils/download-attachment 的 downloadAttachmentFile(file, { fullFileUrl });fullFileUrl 需拼接 VITE_MINIO_BASE_URL(与参考页一致)。el-dialog(宽 800px,destroy-on-close);图片用 <img>,视频用 <video controls>。_uploading === true 的项,SHALL 阻止提交并提示「附件上传中,请稍候」;业务字段若存逗号分隔 URL,提交前 SHALL 从数组中过滤 fileUrl 非空且非上传中的项拼接。缴费明细等嵌套场景可使用 .upload-card--sm(宽 96px、高 76px),其余规则不变。
<el-form-item label="协议附件" class="form-col-span-2">
<div class="attachment-upload">
<div class="attachment-list">
<el-upload
ref="attachmentUploadRef"
:auto-upload="false"
:show-file-list="false"
:multiple="true"
accept="image/*,video/*,.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.txt,.zip,.rar"
@change="handleAttachmentChange"
>
<div class="upload-card">
<el-icon :size="28" color="#10b981"><Plus /></el-icon>
<span class="upload-card-text">上传附件</span>
</div>
</el-upload>
<div
v-for="(file, index) in attachments"
:key="file.id || index"
class="attachment-item"
:class="{ 'is-uploading': file._uploading }"
>
<div
class="attachment-preview"
@click="isImageFile(file) && file.fileUrl ? handlePreviewAttachment(file) : undefined"
>
<template v-if="isImageFile(file) && file.fileUrl">
<img :src="fullFileUrl(file.fileUrl)" :alt="file.fileName" />
</template>
<template v-else-if="isImageFile(file) && !file.fileUrl">
<el-icon :size="24" color="#94a3b8"><Loading /></el-icon>
</template>
<template v-else-if="isVideoFile(file)">
<div class="attachment-preview__icon attachment-preview__icon--video">
<el-icon :size="28"><VideoPlay /></el-icon>
</div>
</template>
<template v-else>
<div class="attachment-preview__icon attachment-preview__icon--doc">
<el-icon :size="28"><Document /></el-icon>
</div>
</template>
</div>
<div class="attachment-footer">
<span class="attachment-name" :title="file.fileName">{{ file.fileName }}</span>
<div class="attachment-actions">
<el-icon class="action-btn" title="下载" @click="handleDownloadAttachment(file)">
<Download />
</el-icon>
<el-icon
class="action-btn action-btn--danger"
title="删除"
@click="removeAttachment(index)"
>
<Delete />
</el-icon>
</div>
</div>
</div>
</div>
<span class="upload-hint">支持图片、视频、PDF、Word、Excel等文件,单文件不超过 20MB</span>
</div>
</el-form-item>
说明:
attachments为业务侧附件数组变量名;图标Plus、Loading、VideoPlay、Document、Download、DeleteSHALL 在<script setup>中从@element-plus/icons-vue显式 import。
scoped 内)完整类名与尺寸 SHALL 与参考页一致,核心片段:
.attachment-upload { width: 100%; }
.attachment-list { display: flex; flex-wrap: wrap; gap: 12px; }
.upload-card {
width: 140px; height: 96px;
border: 1px dashed #a7f3d0; border-radius: 8px; background: #f0fdf4;
display: flex; flex-direction: column; align-items: center; justify-content: center;
gap: 6px; cursor: pointer;
&:hover { border-color: #10b981; border-style: solid; background: #ecfdf5; }
}
.upload-card-text { font-size: 12px; color: #10b981; font-weight: 500; line-height: 1; }
.upload-hint { display: block; font-size: 11px; color: #94a3b8; margin-top: 8px; line-height: 1; }
.attachment-item {
width: 140px; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; overflow: hidden;
&.is-uploading { opacity: 0.6; pointer-events: none; }
&:hover { border-color: #10b981; box-shadow: 0 2px 8px rgba(16, 185, 129, 0.1); }
}
.attachment-preview {
width: 100%; height: 96px; display: flex; align-items: center; justify-content: center;
background: #f8fafc; overflow: hidden; cursor: pointer;
img { width: 100%; height: 100%; object-fit: cover; display: block; }
}
.attachment-preview__icon {
width: 48px; height: 48px; border-radius: 10px;
display: flex; align-items: center; justify-content: center;
&--video { background: #ede9fe; color: #7c3aed; }
&--doc { background: #e0f2fe; color: #0284c7; }
}
.attachment-footer { display: flex; flex-direction: column; padding: 6px 8px; }
.attachment-name {
display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
overflow: hidden; font-size: 11px; color: #334155; line-height: 1.4; word-break: break-all;
}
.attachment-actions {
display: flex; justify-content: center; gap: 8px; margin-top: 4px;
}
.action-btn {
width: 22px; height: 22px; border-radius: 4px; background: #f1f5f9; color: #64748b;
cursor: pointer;
&:hover { background: #10b981; color: #fff; }
&--danger:hover { background: #ef4444; color: #fff; }
}
只读查看态 SHALL 使用 web-admin/src/views/cell-storage/protocol/ProtocolAttachmentReadonly.vue(无上传卡片、无删除,可保留下载/预览)。
.attachment-list 第一项且始终可见.upload-hint SHALL 位于卡片行下方downloadAttachmentFile 与数组移除逻辑is-uploading(半透明、不可点),预览区显示 Loading_uploading 项ProtocolFormDialog.vue 确认卡片化布局与立即上传逻辑THEN SHALL 拒绝 picture-card、show-file-list 默认列表、与规范不一致的尺寸/色值
web-admin 中所有带文字标签的 el-button(或 ElButton)SHALL 在文字前方包含 <el-icon> 子元素,使用 @element-plus/icons-vue 提供的图标组件;SHALL NOT 出现仅有文字而无图标的按钮。该规则适用于列表工具栏、表格操作列、el-dialog / 抽屉的 #footer 底栏、表单内 link / plain / size="small" 等凡渲染可见文案的按钮,不限于 type="primary"。图标的引入方式为在文件 <script setup> 中显式 import 所需图标组件(@element-plus/icons-vue 不属于 auto-import 范围)。图标与文字间距由全局样式保证(与 Fresh Mint 弹窗底栏约定一致,约 6px)。
| 按钮语义 | 图标组件 | 适用场景 |
|---|---|---|
| 新增 | Plus |
工具栏「新增 XXX」按钮 |
| 搜索 | Search |
筛选区「搜索」按钮 |
| 重置 | RefreshLeft |
筛选区「重置」按钮 |
| 确定 / 确认 / 提交 / 保存 | Check |
弹窗确认类按钮 |
| 取消 / 关闭 | Close |
弹窗取消、关闭按钮 |
| 编辑 / 修改 | Edit |
操作列「编辑」按钮 |
| 删除 / 批量删除 | Delete |
操作列、工具栏「删除」按钮 |
| 查看 / 详情 / 查看详情 | View |
操作列「查看」「详情」按钮 |
| 审批 / 审核 | EditPen |
操作列「审批」按钮 |
| 配置 / 设置 | Setting 或 SetUp |
操作列「配置」按钮 |
| 导入 / 上传 | Upload |
工具栏「导入」、表单「上传」按钮 |
| 折叠 / 展开 | ArrowDown / ArrowUp |
工具栏「展开/收起」按钮 |
| 充值 / 发起充值 | Wallet |
渠道服务订单等预付款充值操作 |
| 退款 / 申请退款 | Sell |
退款、退费类操作 |
| 购买产品 | ShoppingCart |
购买、下单类操作 |
| 退订 | Remove |
退订、减少持有类操作 |
| 作废 | Delete |
作废流水/订单(与删除同图标,可用 op-warn 样式区分) |
| 操作流水 / 记录列表 | List |
「操作流水」等子列表入口 |
<el-icon><Search /></el-icon> 和 <el-icon><RefreshLeft /></el-icon>,SHALL NOT 仅有文字el-dialog 的 #footer 插槽中添加「取消」和「确定」按钮<el-icon><Close /></el-icon>,确定按钮 SHALL 包含 <el-icon><Check /></el-icon><el-icon> 子元素(如 <el-icon><Edit /></el-icon>),SHALL NOT 仅有文字<el-icon><Plus /></el-icon>el-button<el-icon> 子元素,且图标组件已从 @element-plus/icons-vue 显式导入web-admin/src/views/pilot-service/channel-service-order/** 或 channel-service-order-finance/** 中的按钮(含弹窗底栏、表格操作列、行内 link 删除)el-button SHALL 按上表携带图标(如查看 View、确认 Check、取消 Close、作废 Delete、发起充值 Wallet 等)btn-ghost / btn-main 类名并与 Demo 页图标约定一致<!-- 工具栏 -->
<el-button class="btn-main" type="primary" @click="handleAdd">
<el-icon><Plus /></el-icon>
新增单位
</el-button>
<!-- 筛选区 -->
<el-button class="btn-ghost" @click="handleReset">
<el-icon><RefreshLeft /></el-icon>重置
</el-button>
<el-button class="btn-main" type="primary" @click="handleSearch">
<el-icon><Search /></el-icon>搜索
</el-button>
<!-- 操作列 -->
<el-button class="btn-op-item primary" @click="handleEdit(row)">
<el-icon><Edit /></el-icon>编辑
</el-button>
<el-button class="btn-op-item" @click="handleDelete(row)">
<el-icon><Delete /></el-icon>删除
</el-button>
<!-- 弹窗底部 -->
<el-button class="btn-ghost" @click="dialogVisible = false">
<el-icon><Close /></el-icon>取消
</el-button>
<el-button class="btn-main" type="primary" @click="handleSubmit">
<el-icon><Check /></el-icon>确定
</el-button>
// <script setup> 中显式导入
import { Plus, Close, Check, Search, RefreshLeft, Edit, Delete, View } from '@element-plus/icons-vue'
web-admin 中所有列表表格和查看弹窗中的状态、结论、类型等枚举类字段 SHALL 使用 Element Plus <el-tag> 组件以彩色标签形式展示,SHALL NOT 以纯文本形式展示。具体规则如下:
el-table 中所有状态/结论/类型列 SHALL 在 <template #default="{ row }"> 内使用 <el-tag> 渲染,并通过 :type 属性区分语义色。SHALL NOT 使用自定义 <span class="tag"> 或纯文本。
标准写法:
<el-table-column prop="status" label="状态" min-width="90" align="center">
<template #default="{ row }">
<el-tag :type="row.status === '1' ? 'success' : 'info'" size="small">
{{ row.status === '1' ? '正常' : '停用' }}
</el-tag>
</template>
</el-table-column>
多状态映射标准写法(使用状态标签注册表):
<el-table-column prop="workOrderStatus" label="状态" min-width="100" align="center">
<template #default="{ row }">
<el-tag :type="workOrderStatusTagType(row.workOrderStatus)" size="small">
{{ workOrderStatusLabel(row.workOrderStatus) }}
</el-tag>
</template>
</el-table-column>
import { workOrderStatusLabel, workOrderStatusTagType } from '@/utils/status-tag-registry'
使用 SystemViewDialog 组件(src/components/business/system-view-dialog/index.vue)时,状态/结论/类型字段 SHALL 在 ViewField 定义中传入 tagType 属性。组件检测到 tagType 后自动以 <el-tag> 渲染该字段值。
ViewField 接口扩展(已实现):
export type TagType = 'success' | 'warning' | 'danger' | 'info' | '' | 'primary'
export interface ViewField {
label: string
value: string | number | boolean | null | undefined
span?: boolean
/** 传入后以 el-tag 渲染,值为 el-tag 的 type 属性 */
tagType?: TagType
}
标准写法:
import { taskStatusLabel, taskStatusTagType, qcTaskConclusionLabel, qcTaskConclusionTagType } from '@/utils/status-tag-registry'
const viewSections = computed<ViewSection[]>(() => [
{
title: '任务信息',
fields: [
{ label: '任务号', value: d.taskNo },
{ label: '状态', value: taskStatusLabel(d.status), tagType: taskStatusTagType(d.status) },
{ label: '检测结论', value: qcTaskConclusionLabel(d.conclusion), tagType: qcTaskConclusionTagType(d.conclusion) },
// 普通字段不加 tagType,仍以纯文本展示
{ label: '备注', value: d.remark || '—', span: true },
]
}
])
不使用 SystemViewDialog 的自定义查看弹窗(如 ProtocolViewDialog、DonationViewDialog 等)中的状态/结论字段 SHALL 同样使用 <el-tag> 展示。
标准写法:
<dd>
<el-tag :type="acceptConclusionTagType(row.acceptConclusion)" size="small">
{{ acceptConclusionLabel(row.acceptConclusion) }}
</el-tag>
</dd>
import { acceptConclusionLabel, acceptConclusionTagType } from '@/utils/status-tag-registry'
| Tag Type | 颜色 | 适用语义 | 示例 |
|---|---|---|---|
success |
绿色 | 正常、启用、已完成、生效中、通过 | 正常/启用/已完成/接收/通过 |
warning |
橙色 | 进行中、待确认、已过期、预警 | 进行中/已排配/已过期/待确认 |
danger |
红色 | 异常、停用、已作废、拒绝、不通过 | 异常/已作废/拒绝/不通过 |
info |
灰色 | 待执行、待生效、未知、默认 | 待执行/待生效/停用/无结论 |
primary |
蓝色 | 特殊分类、来源类型、转出 | 转科研/转细胞存储/来源类型/菜单类型 |
对于启用/停用的状态字段,SHALL 使用 success(启用)和 info(停用),SHALL NOT 使用 danger 表示停用状态。
web-admin 中所有状态、结论、类型等枚举字段的 文案(label)与 Tag 语义色(tagType)SHALL 在单一注册表中集中定义,权威文件为 web-admin/src/utils/status-tag-registry.ts。
核心原则:
Record 重复定义映射。xxxLabel(code)、xxxTagType(code) 两个 getter;未知 code 时 label 回退为原值、tagType 回退为 'info'。status-tag-registry.ts 追加 registry 与 getter,再在页面/组件中 import 使用;SHALL NOT 直接在 .vue 中写 if/else 或内联映射。注册表结构(已实现):
/** el-tag 的 type 属性值 */
export type TagType = 'success' | 'warning' | 'danger' | 'info' | '' | 'primary'
export interface StatusItem {
label: string
tagType: TagType
}
export type StatusRegistry = Record<string, StatusItem>
export const protocolStatus: StatusRegistry = {
dsx: { label: '待生效', tagType: 'info' },
sxz: { label: '生效中', tagType: 'success' },
ygq: { label: '已过期', tagType: 'warning' },
yzf: { label: '已作废', tagType: 'danger' },
zky: { label: '转科研', tagType: 'primary' }
}
export const protocolStatusLabel = createLabelGetter(protocolStatus)
export const protocolStatusTagType = createTagTypeGetter(protocolStatus)
页面使用方式:
import { protocolStatusLabel, protocolStatusTagType } from '@/utils/status-tag-registry'
<el-tag :type="protocolStatusTagType(row.status)" size="small">
{{ protocolStatusLabel(row.status) }}
</el-tag>
兼容 re-export(非新增入口):
utils/protocol-payment-labels.ts、utils/qc-labels.ts 等历史文件 MAY 继续 re-export 注册表中的 getter 以保持既有 import 路径;新增枚举 SHALL 直接写入 status-tag-registry.ts,SHALL NOT 再新建独立的 label/tag 映射文件。
禁止写法:
<script setup> 内定义 function xxxTagType() / const xxxMap = { ... } 映射已在或应在注册表中的枚举ViewField.tagType 使用内联三元表达式(如 d.status === 'ywc' ? 'success' : ...)替代 registry getterstatus-tag-registry.ts 注册该枚举的 label 与 tagType,并在页面中 import 对应的 xxxLabel / xxxTagType getter 使用protocolStatus、taskStatus、enableStatus)@/utils/status-tag-registry import 并使用,SHALL NOT 在页面内重复定义映射<el-tag> 渲染,通过 :type 绑定语义色,SHALL NOT 使用纯文本或自定义 <span class="tag">SystemViewDialog 查看弹窗,且 fields 中包含状态/结论/类型字段tagType 属性,组件自动以 <el-tag> 渲染<el-tag> 组件(表格列)或 tagType 属性(SystemViewDialog),SHALL NOT 出现纯文本状态展示或自定义 <span class="tag">;若枚举已在或应进入注册表,SHALL 确认映射来自 status-tag-registry.ts 而非页面内联定义web-admin 中所有界面(含主列表页、编辑弹窗、查看弹窗、子弹窗、侧栏详情面板等)内的 el-table 列表 SHALL 与标准列表页(如 #/demo/unit、#/demo/order)保持一致的表格视觉规格,不得因处于弹窗或嵌套区域而缩小字号、压缩行高或改用 size="small" 等紧凑样式。
具体规则:
.list-table / 主列表一致);SHALL NOT 为弹窗内表格单独设置更小 font-size 或通过 size="small" / size="mini" 缩小表格。.list-table(可与 .inner-table 等场景类叠加),以复用全局表格 Token 与行高,而非在 scoped 样式中覆盖为紧凑尺寸。height / max-height 控制可视区域高度以便滚动,但 SHALL NOT 以缩小字体或行高换取更多行展示。el-dialog 或子弹窗中新增 el-table 展示业务数据.list-table 且 SHALL NOT 设置 size="small" 或自定义更小字号/行高以适配弹窗el-tablesize="small" / 紧凑字号覆盖,且列表风格与主列表页一致web-admin 新增或改造业务页面时,开发者 SHALL 在编码前按 功能特征 → 模式编号(P01–P27)→ 参考页 完成界面选型;模式定义、决策表、各模式标准写法与全站页面映射的详细说明以 docs/web-admin-ui-pattern-index.md 为权威索引,本 Requirement 给出 SHALL 级门禁与摘要。
选型流程(SHALL 按序执行):
menuCode;SHALL NOT 从零设计布局或另起一套类名习惯。status-tag-registry.ts(见本 spec「状态标签注册表」Requirement)。官方 Demo 模板(永远优先对照,SHALL 优先于业务页):
| 用途 | Hash | 源码 |
|---|---|---|
| 标准列表 CRUD | /#/demo/unit |
web-admin/src/views/system/unit/index.vue |
| 复杂业务列表 | /#/demo/order |
web-admin/src/views/system/order/index.vue |
| 商品类 + 查看弹窗 | /#/demo/product |
web-admin/src/views/system/product/index.vue |
| 树形主数据 | /#/demo/category |
web-admin/src/views/system/category/index.vue |
| 用户类 CRUD | /#/demo/user |
web-admin/src/views/system/user/index.vue |
| 工作台说明 | /#/demo/console |
web-admin/src/views/dashboard/console/index.vue |
功能特征 → 模式编号(决策表):
| 功能特征 | 模式 | 首选参考 |
|---|---|---|
| 单表主数据,增删改查 + 分页 + 关键词筛选 | P01 | /#/demo/unit → basic-info/customer |
| 列表多状态,操作按钮随状态变化 | P02 | /#/demo/order → cell-storage/protocol-audit |
| 树形结构,父子级联,无分页 | P03 | /#/demo/category → system/dept |
| 左侧组织/分类树 + 右侧分页列表 | P04 | /#/demo/user → system/user |
| 同页上下两块表(类型 + 明细) | P05 | system/dict |
| 主表列表 + 弹窗内维护子表 | P06 | basic-info/collection-region |
| 批量生成编号/编码 + 下发/收回 | P07 | basic-info/sample-code |
| 列表顶部 Tab 按状态切换(非路由 Tab) | P08 | cell-storage/payment-info |
| 只读查看,字段分 Section(≤20 字段) | P09 | SystemViewDialog → system/express |
| 只读查看,多 Tab/KPI/审核历史/附件 | P10 | ProtocolViewDialog / DonationViewDialog |
| 简单审核/状态变更(单表单 ~560px) | P11 | ProtocolAuditDialog |
| 多分区大表单(Tab 锚点 + 行内子表) | P12 | ProtocolFormDialog / DonationFormDialog |
| 财务/业务确认(只读明细 + 上传附件) | P13 | cell-storage/payment-confirm |
| 主表 + 嵌套配置大弹窗(子资源 CRUD) | P14 | basic-info/insurance-company |
| 主表 + 多 Tab 子模块(渠道/协议等) | P15 | pilot-service/channel |
| 三栏:资源库 | 步骤列表 | 步骤详情 | P16 | production/process-route |
| 工单列表 + 派发/执行弹窗链 | P17 | production/production-work-order |
| 任务执行(虚拟步骤 + 步骤状态机) | P18 | TaskExecutionDialog + useTaskStepEditor |
| 主数据 + append-to-body 选择器弹窗 | P19 | production/process |
| 库存主数据 + 入库/出库 + 流水只读页 | P20 | production/consumable + material-stock-log |
| 质检工单/任务(配置检测项) | P21 | quality-inspection/qc-work-order |
| 审核列表 + 专用审核弹窗 | P22 | quality-inspection/storage-release-review |
| 接收/登记(关联协议样本) | P23 | quality-inspection/sample-reception |
| 工作流配置 / 待办 / 审批 | P24 | system/workflow/* |
| 独立详情页(非弹窗) | P25 | system/user/detail |
| 角色/权限扩展(菜单树/数据范围) | P26 | system/role |
| 衍生列表(跳转主业务查看弹窗) | P27 | cell-storage/storage-cert |
各模式 SHALL 级要点(摘要):
filter-block → list-toolbar(已选 N 项在前)→ list-table stripe → 分页;dialog-form-layout 编辑 + SystemViewDialog 查看。el-table 树形、无分页;路径展示遵循「树形主数据展示规则」Requirement。el-tree + 右 P01 列表;组织全路径用 tree-path.ts。/batch-generate、/batch-issue、/batch-revoke;批量请求超时 SHALL ≥ 120s。region-tabs 切换列表筛选;各 Tab 可有不同批量操作。SystemViewDialog;状态字段传 tagType。*ViewDialog 组件;与编辑弹窗 同 Tab/section 命名;只读附件复用 ProtocolAttachmentReadonly 等。.vue 组件;DialogFormBody + detail-tabs + scroll-to-error;附件卡片化布局遵循本 spec 附件 Requirement。_route-config.scss 的 .route-config-* 类;新三栏场景 SHALL 复用 useTaskStepEditor + StepDetailPanel,SHALL NOT 复制 process-route 内联逻辑。production-work-order 弹窗链与 composable 模式。ProtocolViewDialog),SHALL NOT 重复实现完整查看 UI。维护约定:
docs/web-admin-ui-pattern-index.md §四补充「页面 → 模式」映射。/#/demo/unit 或 basic-info/customer 为骨架参考index.vue 内堆叠超过 500 行表单/查看模板web-admin 业务页面docs/web-admin-ui-pattern-index.md 与本 Requirement 决策表金额、单价等可编辑输入字段 SHALL 使用 AmountInput 组件(路径 @/components/common/amount-input/index.vue),满足以下行为:
| 时机 | 行为 |
|---|---|
| 聚焦输入中 | 纯数字展示,无千分位逗号,如 1234567.89 |
| 失焦后 | 千分位展示,如 1,234,567.89 |
| 再次聚焦 | 自动去掉逗号,恢复纯数字便于修改 |
| 提交/API | number 类型,不受逗号影响 |
金额、单价等只读展示(列表列、查看弹窗、合计文案)SHALL 使用 formatMoneyDisplay 工具函数(路径 @/utils/money-format.ts),整数部分千分位、小数位默认 2 位。
业务 .vue 文件 SHALL NOT 复制千分位正则或 addThousandSeparators 等函数实现;SHALL 统一引用 @/utils/money-format.ts。
不在范围内:数量、份数、排序号、百分比系数等非金额字段(仍用 el-input-number)。
<AmountInput v-model="..." /> 组件<el-input-number> 或页面内联 focus/blur 千分位逻辑formatMoneyDisplay(v, 2) 格式化¥ 仍在模板侧拼接,不内置于函数AmountInput(可编辑)或 formatMoneyDisplay(只读),拒绝页面内复制千分位实现