详情见代码
This commit is contained in:
@@ -87,6 +87,8 @@ const EVENT_FAMILIES = [
|
||||
{ label: '角色', value: 'role.' },
|
||||
{ label: '权限', value: 'rbac.' },
|
||||
{ label: '物料档案', value: 'material.' },
|
||||
{ label: '产品工艺', value: 'product.process.' },
|
||||
{ label: '附件', value: 'attachment.' },
|
||||
{ label: '预警规则', value: 'alert.rule.' }
|
||||
]
|
||||
// B3.4 对象类型筛选选项(与后端 entityType 写入值一致)
|
||||
@@ -107,6 +109,7 @@ const ENTITY_TYPES = [
|
||||
{ label: '权限', value: 'permission' },
|
||||
{ label: '物料', value: 'material' },
|
||||
{ label: '预警规则', value: 'alert_rule' },
|
||||
{ label: '产品工艺', value: 'product_process' },
|
||||
{ label: '附件', value: 'attachment' }
|
||||
]
|
||||
const FAMILY_LABEL = Object.fromEntries(EVENT_FAMILIES.map((f) => [f.value, f.label]))
|
||||
@@ -115,16 +118,27 @@ const FAMILY_TAG = {
|
||||
'material.request.': 'warning', 'process.flow.': 'info', 'station.': 'info',
|
||||
'plc.': 'danger', 'torque.': 'info', 'scan.': 'success', 'workpiece.': 'success',
|
||||
'inspection.': 'warning', 'semi.': 'info',
|
||||
'user.': 'primary', 'role.': 'warning', 'rbac.': 'danger', 'material.': 'success', 'alert.rule.': 'info'
|
||||
'user.': 'primary', 'role.': 'warning', 'rbac.': 'danger', 'material.': 'success', 'alert.rule.': 'info',
|
||||
'product.process.': 'success', 'attachment.': 'info'
|
||||
}
|
||||
const ENTITY_LABEL = {
|
||||
work_order: '工单', material_request: '备料单',
|
||||
process_flow: '工艺', station: '工位', workpiece: '工件', torque: '拧紧',
|
||||
inspection: '检验', scan: '报工', daily_plan: '日排产', plc: '下发', semi: '半成品',
|
||||
user: '账号', role: '角色', permission: '权限', material: '物料', alert_rule: '预警规则', attachment: '附件'
|
||||
user: '账号', role: '角色', permission: '权限', material: '物料', alert_rule: '预警规则', product_process: '产品工艺', attachment: '附件'
|
||||
}
|
||||
|
||||
// 事件类型精确中文名:覆盖后端实际写入的全部 event_type(前缀+动作直译,用业务语言)。
|
||||
// 命中后优先于上面的族前缀映射,使「product.process.save」显示「保存产品工艺」而非仅「产品工艺」。
|
||||
const EVENT_TYPE_NAMES = {
|
||||
'product.process.save': '保存产品工艺',
|
||||
'product.process.delete': '删除产品工艺',
|
||||
'product.process.status': '产品工艺状态变更',
|
||||
'product.process.copy': '复制产品工艺',
|
||||
'attachment.upload': '上传附件'
|
||||
}
|
||||
function familyName(evt) {
|
||||
if (evt && EVENT_TYPE_NAMES[evt]) return EVENT_TYPE_NAMES[evt]
|
||||
const k = Object.keys(FAMILY_LABEL).find((p) => evt && evt.startsWith(p))
|
||||
return k ? FAMILY_LABEL[k] : (evt || '-')
|
||||
}
|
||||
|
||||
@@ -280,9 +280,17 @@ func serveUploadFile(w http.ResponseWriter, r *http.Request, dir, name string) {
|
||||
ct = "application/vnd.ms-excel"
|
||||
}
|
||||
w.Header().Set("Content-Type", ct)
|
||||
// 统一强制下载(Content-Disposition: attachment):文件名按 RFC 5987 编码(中文安全),
|
||||
// 浏览器直接下载不预览;<img>/<iframe> 内嵌展示不受此头影响
|
||||
w.Header().Set("Content-Disposition", "attachment; filename*=UTF-8''"+url.PathEscape(filepath.Base(abs)))
|
||||
// 图片/PDF 内联预览(浏览器新标签页直接渲染,修复附件中心/工艺 PDF 预览变下载);
|
||||
// 其余类型强制下载;显式 dl=1 一律强制下载(对齐 WMS /uploads/ 行为)。
|
||||
// 文件名按 RFC 5987 编码(中文安全)。
|
||||
disp := "attachment"
|
||||
if isInlineExt(filepath.Ext(abs)) {
|
||||
disp = "inline"
|
||||
}
|
||||
if r.URL.Query().Get("dl") == "1" {
|
||||
disp = "attachment"
|
||||
}
|
||||
w.Header().Set("Content-Disposition", fmt.Sprintf(`%s; filename*=UTF-8''%s`, disp, url.PathEscape(filepath.Base(abs))))
|
||||
http.ServeContent(w, r, filepath.Base(abs), time.Time{}, f)
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<title>MES 产线控制</title>
|
||||
<!-- 系统图标:产线齿轮(内联 SVG,避免依赖外部文件) -->
|
||||
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><rect width='32' height='32' rx='6' fill='%231668dc'/><circle cx='16' cy='16' r='4.2' fill='none' stroke='%23fff' stroke-width='2'/><path d='M16 5v3M16 24v3M5 16h3M24 16h3M8.2 8.2l2.1 2.1M21.7 21.7l2.1 2.1M23.8 8.2l-2.1 2.1M10.3 21.7l-2.1 2.1' stroke='%23fff' stroke-width='2' stroke-linecap='round'/></svg>">
|
||||
<script type="module" crossorigin src="./assets/index-B1Zht7qD.js"></script>
|
||||
<script type="module" crossorigin src="./assets/index-C6E9sGPj.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="./assets/index-Bq2UqthT.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
Reference in New Issue
Block a user