feat: 会话令牌与守卫、看板组件及工位终端功能完善
- 用户表扩展:MES/WMS user 实体新增字段,新增 active_token 迁移 SQL(2026-11-11) - 会话机制:MES 新增 session_guard,重构 token/auth/jwt/perm 与路由;WMS/工作站同步令牌续签与鉴权 - 看板(board):调整 MES 看板产线/生产/侧栏/仓库组件及样式;WMS 看板展示页同步调整 - 工位终端后端:完善报警流、绑定、PLC 对账、拧紧、proxy、上报、站点告警/操作等 handler,补充 mes client/store - 工位终端前端:登录/主界面/各操作面板调整,新增滚动分页与多语言 yaml 文案,刷新构建产物 - MES 业务:新增流程链 logic,调整待审核/产能支撑/产品工艺/设置页、PLC 监控与帮助文档,刷新构建产物 - 更新问题记录文档
This commit is contained in:
@@ -63,7 +63,9 @@ function mapLoginError(error) {
|
||||
if (error.response) {
|
||||
const status = error.response.status
|
||||
const serverMsg = error.response.data && error.response.data.message
|
||||
if (status === 401 || status === 403) return '工号或密码错误'
|
||||
// 2026-11-11:登录 401/403 优先展示服务端透传的真实原因(MES 的拒绝消息,
|
||||
// 如「该账号无此工位的操作权限」「该账号未开通工位终端登录权限」),无消息才回退通用文案
|
||||
if (status === 401 || status === 403) return serverMsg || '工号或密码错误'
|
||||
if (status === 400 || status === 422) return serverMsg || '输入信息有误,请检查后重试'
|
||||
if (status >= 500) return 'MES 服务不可达,请检查网络或联系管理员'
|
||||
return serverMsg || '登录失败,请联系管理员'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { computed, reactive, ref, watch } from 'vue'
|
||||
|
||||
// 2026-11-10 改动17:工位终端长列表统一「往下滚加载更多」,不用页码。
|
||||
// 用法:
|
||||
@@ -8,6 +8,13 @@ import { computed, ref, watch } from 'vue'
|
||||
// <div class="scroll-more-hint">{{ pager.hint }}</div>
|
||||
// </div>
|
||||
// 数据刷新(数组被整体替换)时自动回到第一页;每滚到底追加 pageSize 条。
|
||||
//
|
||||
// 2026-11-11 修复(作业页白屏/物料与各表格崩溃总根源):
|
||||
// 返回值必须包一层 reactive() —— 模板里 `pager.rows` 这类「对象内嵌 ref」不会自动解包
|
||||
// (Vue 只对 setup 顶层 ref 解包;嵌在普通对象里的 ref 直接把 Ref 实例带进模板):
|
||||
// v-for="row in wipPager.rows" 拿到的是 Ref 实例被当可迭代对象展开出 undefined 项(row.sn 崩溃)、
|
||||
// el-table :data="pager.rows" 拿到非数组(kt is not iterable)、pager.hint 渲染异常,整面板渲染崩溃白屏。
|
||||
// reactive 包裹后访问 pager.rows/hint/total 会深度解包为原始值,模板/脚本用法均不受影响。
|
||||
export function useScrollPaging(source, pageSize = 20) {
|
||||
const visible = ref(pageSize)
|
||||
const rows = computed(() => {
|
||||
@@ -29,7 +36,7 @@ export function useScrollPaging(source, pageSize = 20) {
|
||||
}
|
||||
}
|
||||
function reset() { visible.value = pageSize }
|
||||
return { visible, rows, total, hint, onScroll, reset }
|
||||
return reactive({ visible, rows, total, hint, onScroll, reset })
|
||||
}
|
||||
|
||||
export default useScrollPaging
|
||||
|
||||
@@ -29,11 +29,8 @@
|
||||
<span class="lab">工位</span>
|
||||
<!-- 固定模式:服务端配置了工位(stationNo>0),不允许选择 -->
|
||||
<span v-if="fixedStation" class="station-fixed">工位 {{ fixedStation }}</span>
|
||||
<!-- 选择模式:终端未配置工位(2026-11-09 拍板),实体+虚拟工位都可选 -->
|
||||
<el-select v-else v-model="pickedStation" class="station-el" placeholder="请选择工位" size="large">
|
||||
<el-option-group v-if="stationGroups.LINE.length" label="实体工位">
|
||||
<el-option v-for="s in stationGroups.LINE" :key="s.stationNo" :label="stationLabel(s)" :value="s.stationNo" />
|
||||
</el-option-group>
|
||||
<!-- 选择模式(2026-11-11 多会话拍板):终端未配置工位=虚拟工位专用机,只允许选虚拟工位 -->
|
||||
<el-select v-else v-model="pickedStation" class="station-el" placeholder="请选择虚拟工位" size="large">
|
||||
<el-option-group v-if="stationGroups.OFFLINE.length" label="虚拟工位">
|
||||
<el-option v-for="s in stationGroups.OFFLINE" :key="s.stationNo" :label="stationLabel(s)" :value="s.stationNo" />
|
||||
</el-option-group>
|
||||
@@ -66,7 +63,6 @@ const stationList = ref([])
|
||||
const loading = ref(false)
|
||||
|
||||
const stationGroups = computed(() => ({
|
||||
LINE: stationList.value.filter((s) => s.stationType !== 'OFFLINE'),
|
||||
OFFLINE: stationList.value.filter((s) => s.stationType === 'OFFLINE')
|
||||
}))
|
||||
const stationLabel = (s) => {
|
||||
@@ -74,8 +70,9 @@ const stationLabel = (s) => {
|
||||
return s.name ? `工位 ${s.stationNo} ${s.name}${tip}` : `工位 ${s.stationNo}${tip}`
|
||||
}
|
||||
|
||||
// 2026-11-09 拍板:配置了工位(stationNo>0)登录页不允许选择;未配置则加载工位清单供选择
|
||||
//(实体工位 + 虚拟工位 0 上线位/13 下线位)。固定模式下不再显示接驳台(dock 配置已删除)。
|
||||
// 2026-11-09 拍板:配置了工位(stationNo>0)登录页不允许选择。
|
||||
// 2026-11-11 多会话拍板:未配置工位(<=0)的终端实例=虚拟工位专用机,登录页只显示虚拟工位
|
||||
//(后端登录接口同样硬校验 stationType=OFFLINE,防前端绕过)。固定模式下不显示接驳台。
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const cfg = await getConfig()
|
||||
@@ -85,9 +82,8 @@ onMounted(async () => {
|
||||
}
|
||||
const list = await getStationOptions()
|
||||
stationList.value = Array.isArray(list) ? list : []
|
||||
// 默认选中首个虚拟工位(上线位 0)优先,否则首个实体工位
|
||||
pickedStation.value = stationList.value.find((s) => s.stationType === 'OFFLINE')?.stationNo ??
|
||||
stationList.value[0]?.stationNo ?? null
|
||||
// 默认选中首个虚拟工位
|
||||
pickedStation.value = stationList.value.find((s) => s.stationType === 'OFFLINE')?.stationNo ?? null
|
||||
} catch {
|
||||
// 网络异常:固定模式保持 null(提交时提示),选择模式保持空清单(提交时提示)
|
||||
}
|
||||
|
||||
@@ -81,7 +81,9 @@
|
||||
</template>
|
||||
<WorkPanel ref="workRef" @call-material="tab = 'material'" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane v-if="hasTab('material') && hasDock" name="material">
|
||||
<!-- 2026-11-11 修复:去掉 hasDock 门槛——虚拟工位(无接驳台)也要能看到工位物料/叫料池/叫料记录,
|
||||
仅发起类动作在 MaterialPanel 内部按无接驳台禁用并提示 -->
|
||||
<el-tab-pane v-if="hasTab('material')" name="material">
|
||||
<template #label>
|
||||
<span class="tab-label" :title="TAB_DUTY.material">物料 / 叫料</span>
|
||||
<span v-if="badgeCount.material" class="tab-badge">{{ badgeCount.material }}</span>
|
||||
@@ -373,7 +375,9 @@ function connectAlertStream() {
|
||||
if (!stationNo.value || alertES) return
|
||||
let everFailed = false // 断过线才在重连成功后补拉,平时事件即实时
|
||||
try {
|
||||
alertES = new EventSource('/api/alerts/stream')
|
||||
// 多会话版(2026-11-11):query 带本页登录的工位号,后端按工位过滤分发,
|
||||
// 同一终端实例登录多个虚拟工位时各页面只收到自己工位的报警
|
||||
alertES = new EventSource('/api/alerts/stream?stationNo=' + encodeURIComponent(stationNo.value))
|
||||
alertES.addEventListener('station.alert', (e) => {
|
||||
try {
|
||||
handleAlerts([JSON.parse(e.data)])
|
||||
|
||||
@@ -69,8 +69,16 @@
|
||||
<el-empty v-else description="当前无进行中工单或工艺步骤" />
|
||||
</el-collapse-item>
|
||||
|
||||
<!-- 4. 完工确认 -->
|
||||
<el-collapse-item name="done" title="④ 完工确认(扫序列号)">
|
||||
<!-- 4. 完工确认(2026-11-11:标题带红点——作业页有步骤未勾选检测确认时提示,并说明去哪处理) -->
|
||||
<el-collapse-item name="done">
|
||||
<template #title>
|
||||
<span class="sec-title">
|
||||
④ 完工确认(扫序列号)
|
||||
<span v-if="missingChecks.length" class="sec-dot" :title="'作业页有 ' + missingChecks.length + ' 个步骤未勾选「检测确认(合格)」——到「作业」页对应步骤勾选'">
|
||||
{{ missingChecks.length }}
|
||||
</span>
|
||||
</span>
|
||||
</template>
|
||||
<el-form label-width="84px" size="large">
|
||||
<el-form-item label="工件序列号">
|
||||
<el-input v-model="done.sn" placeholder="扫描或输入工件序列号" />
|
||||
@@ -86,8 +94,14 @@
|
||||
</el-form>
|
||||
</el-collapse-item>
|
||||
|
||||
<!-- 5. 应急呼叫 -->
|
||||
<el-collapse-item name="emergency" title="⑤ 应急呼叫">
|
||||
<!-- 5. 应急呼叫(2026-11-11:标题带红点——存在不合格告警时提示复检/上报) -->
|
||||
<el-collapse-item name="emergency">
|
||||
<template #title>
|
||||
<span class="sec-title">
|
||||
⑤ 应急呼叫
|
||||
<span v-if="hasNg" class="sec-dot" title="当前工件存在不合格(NG)告警:请复检并在③过程巡检上报 NG、或到作业页复检合格后清零">1</span>
|
||||
</span>
|
||||
</template>
|
||||
<el-form label-width="84px" size="large">
|
||||
<el-form-item label="说明">
|
||||
<el-input v-model="emergency.remark" type="textarea" :rows="2" placeholder="设备故障 / 缺料 / 安全等" />
|
||||
@@ -204,11 +218,10 @@ import { computed, onMounted, ref, watch } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import PhotoField from './PhotoField.vue'
|
||||
import { emergencyCall, listDocks, qtyReport, returnCancel, returnList, returnMaterial, returnReference, submitInspection } from '../../api'
|
||||
import { orderNo, sn as snState, stationNo, taskSteps, canReport } from '../../store/station'
|
||||
import { orderNo, sn as snState, stationNo, taskSteps, canReport, missingChecks, hasNg } from '../../store/station'
|
||||
import { useScrollPaging } from '../../utils/scrollPaging'
|
||||
|
||||
const docks = ref([])
|
||||
|
||||
const active = ref(['checkin', 'point', 'process', 'done'])
|
||||
|
||||
const checkin = ref({ shift: '早', photo: '', remark: '' })
|
||||
@@ -433,4 +446,12 @@ async function submitReturn() {
|
||||
<style scoped>
|
||||
.inspect { padding: 4px; max-height: calc(100vh - 220px); overflow-y: auto; }
|
||||
.blocks { margin-top: 12px; }
|
||||
/* 2026-11-11:折叠项标题红点——红点直接落在具体子项标题上,进页即知道哪一项要处理 */
|
||||
.sec-title { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
|
||||
.sec-dot {
|
||||
display: inline-flex; align-items: center; justify-content: center;
|
||||
min-width: 22px; height: 22px; padding: 0 6px;
|
||||
border-radius: 11px; background: #f56c6c; color: #fff;
|
||||
font-size: 13px; font-weight: 700; cursor: help;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -86,10 +86,13 @@
|
||||
<div class="card-title">
|
||||
叫料(一次提交=一个叫料包)
|
||||
<el-button size="small" @click="loadPool">刷新池子</el-button>
|
||||
<el-button size="small" type="warning" plain @click="doPalletReturn">托盘回库</el-button>
|
||||
<el-button size="small" type="warning" plain :disabled="!dockOptions.length" @click="doPalletReturn">托盘回库</el-button>
|
||||
</div>
|
||||
<el-alert v-if="crossDayWarn" type="warning" :closable="false" show-icon style="margin-bottom:10px"
|
||||
title="叫料池含非今日排产的料(跨日叫料):工位端预警提示;仓库可正常发,也可按「非当日」驳回。" />
|
||||
<!-- 2026-11-11:虚拟工位(无接驳台)可查看叫料池/物料/记录,但不能发起叫料与托盘回库 -->
|
||||
<el-alert v-if="!dockOptions.length" type="info" :closable="false" show-icon style="margin-bottom:10px"
|
||||
title="本工位为虚拟工位(无接驳台):可查看物料与叫料记录;发起叫料、托盘回库需在实体工位操作。" />
|
||||
<el-alert v-if="todayRemainText" type="warning" :closable="false" show-icon style="margin-bottom:8px" :title="todayRemainText" />
|
||||
<el-alert v-if="crossDayRemainText" type="info" :closable="false" show-icon style="margin-bottom:8px" :title="crossDayRemainText" />
|
||||
<el-alert v-if="hasBorrow" type="warning" :closable="false" show-icon style="margin-bottom:10px"
|
||||
@@ -162,7 +165,7 @@
|
||||
</div>
|
||||
|
||||
<div class="call-foot">
|
||||
<el-button type="primary" size="large" class="big-btn" :loading="calling" :disabled="!canCall" @click="doCall">提交叫料</el-button>
|
||||
<el-button type="primary" size="large" class="big-btn" :loading="calling" :disabled="!canCall || !dockOptions.length" @click="doCall">提交叫料</el-button>
|
||||
<span class="block-tip" v-if="!canCall">勾选物料并填「叫料量」后可提交(默认全选;两接驳台须为空)</span>
|
||||
</div>
|
||||
</section>
|
||||
@@ -234,7 +237,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, ref, reactive, onMounted } from 'vue'
|
||||
import { computed, ref, reactive, onMounted, watch } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { bindRecord, bindRemove, callPool, callCreate, callList, callSign, callCancel, callReturn, listDocks,
|
||||
callPlanDetail, stationDockPallets, palletReturn, materialDetail } from '../../api'
|
||||
@@ -540,13 +543,18 @@ async function removeBind(r, b) {
|
||||
} catch (e) { /* 统一错误提示 */ }
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
// 2026-11-11 修复:本面板挂载早于 Main 的 loadConfig(子组件 onMounted 先于父组件),
|
||||
// 挂载瞬间 stationNo 可能还是 0,用 0 拉一次后固化空数据(虚拟工位/选择模式下必现)。
|
||||
// 改为监听 stationNo:>0 才拉取,变化(重登录换工位)时重拉。
|
||||
function reloadAll() {
|
||||
loadPool()
|
||||
loadList()
|
||||
loadDocks()
|
||||
loadPlanDetail()
|
||||
loadMaterialDetail()
|
||||
})
|
||||
}
|
||||
onMounted(() => { if (stationNo.value > 0) reloadAll() })
|
||||
watch(stationNo, (v) => { if (v > 0) reloadAll() })
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -345,10 +345,14 @@ function ackMismatch(choice) {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 2026-11-11 修复:原两列栅格在「工单详情」默认折叠(v-if 不渲染)时,
|
||||
footer 变成第 2 个子元素被 nth-child(2) 规则错位拉伸,右列大留白;
|
||||
改单列流式布局:工单选择 → 工单详情(展开时) → 提交区,紧凑无空置 */
|
||||
.online-panel {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(360px, 1fr) minmax(420px, 1.4fr);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
max-width: 980px;
|
||||
align-content: start;
|
||||
}
|
||||
.card {
|
||||
@@ -357,9 +361,6 @@ function ackMismatch(choice) {
|
||||
padding: 14px 16px;
|
||||
box-shadow: 0 1px 6px rgba(0, 21, 41, 0.08);
|
||||
}
|
||||
.card:nth-child(2) {
|
||||
grid-row: span 2;
|
||||
}
|
||||
.card-title {
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
@@ -417,7 +418,6 @@ function ackMismatch(choice) {
|
||||
color: #909399;
|
||||
}
|
||||
.action-bar {
|
||||
grid-column: 1 / -1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
@@ -446,12 +446,4 @@ function ackMismatch(choice) {
|
||||
gap: 12px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
@media (max-width: 1100px) {
|
||||
.online-panel {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.card:nth-child(2) {
|
||||
grid-row: auto;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -191,7 +191,9 @@
|
||||
</template>
|
||||
|
||||
<div v-if="s.needCheck" class="check-row">
|
||||
<el-checkbox v-model="stepChecks[s.id]" size="large" border @change="onCheckChange(s)">检测确认(合格)</el-checkbox>
|
||||
<!-- 2026-11-11 修复:原 @change="onCheckChange(s)" 引用了未定义函数(点击即抛 ReferenceError);
|
||||
v-model 已写入 stepChecks,store 内 watch(stepChecks) 负责自动推进,无需额外 handler -->
|
||||
<el-checkbox v-model="stepChecks[s.id]" size="large" border>检测确认(合格)</el-checkbox>
|
||||
</div>
|
||||
<div v-if="(s.attachment || []).length" class="step-files">
|
||||
<el-button size="large" type="primary" plain @click="openStepFiles(s)">
|
||||
|
||||
Reference in New Issue
Block a user