Browse Source

Web 隐患台账审核流程图修正:正序展示、审核时间取 finishTime、补充上报与结束节点

- flowRecord 返回的 flowList 是「最新在前」的用户任务,原实现用 createTime 展示,
  实际显示的是上一环节的办结时间(实测 procInsId=55001:安全生产办公室
  finishTime=15:51:25 被显示成 createTime=15:45:11,与客户实际审核时间对不上)
- 新增 flowSteps 计算属性:flowList 反转为正序(左→右 = 上报 → 各审批环节 → 结束),
  审核时间改取 finishTime;未办结节点只显示「待办理」且不显示时间;
  左侧补「隐患上报」节点(取隐患详情的上报人/上报时间),
  所有环节办结时右侧补「流程结束」节点
- flowActiveIndex 改为按「首个未完成步骤」计算,修正 el-steps 图标错位
  (倒序数据叠加旧的已完成计数,导致待办节点显示绿勾、已办结节点显示序号)
- 同步更新 CURRENT_TASK / CURRENT_STATUS / DEVELOPMENT_LOG
master
DU 2 weeks ago
parent
commit
226b7db793
  1. 3
      docs/development/CURRENT_STATUS.md
  2. 33
      docs/development/CURRENT_TASK.md
  3. 16
      docs/development/DEVELOPMENT_LOG.md
  4. 40
      src/views/hazard/ledger/index.vue

3
docs/development/CURRENT_STATUS.md

@ -1,9 +1,10 @@ @@ -1,9 +1,10 @@
# 当前开发状态
更新时间:2026-11-10
更新时间:2026-11-17
## 已完成的基础改造
- 隐患台账详情弹窗的「审核流程」步骤条已修正(2026-11-17,待部署验证):步骤改为正序(上报 → 各审批环节 → 结束),审核时间改取 `flowRecord` 的 `finishTime`(原先误用 `createTime`,显示的其实是上一环节办结时间),未办结节点只显示「待办理」且不显示时间,并补出「隐患上报」「流程结束」两个节点;`el-steps` 图标错位(待办节点显示绿勾)一并修复。另:同批客户反馈的「整改负责人选择范围」「发现时间 00:00:00」「隐患照片不可删除」属于 APP 端,在 `zhongyouApp` 处理。
- 已完成管理后台原型视觉统一第一阶段:移除固定 1920×1080 全局缩放,后台恢复流式布局。
- 登录页已移除固定 1920×1080 登录画布和负边距定位,登录框改为视口 Flex 居中,并补充窄屏安全边距和低高度滚动。
- Token 过期、获取用户信息失败和主动退出已不再回跳废弃的 `/index`;登录页会过滤历史无效回跳地址,默认进入 `/hazard/ledger`。

33
docs/development/CURRENT_TASK.md

@ -1,5 +1,38 @@ @@ -1,5 +1,38 @@
# 当前开发任务
## 隐患台账「审核流程」步骤条修正(2026-11-17)
### 1. 用户目标
- 详情的「审核流程」审核时间要与实际一致;未审核(待办理)的节点不显示时间。
- 步骤顺序改为从左往右(上报 → 各审批环节 → 结束),并补全上报节点和最终节点。
- (同批反馈中的「整改负责人范围」「发现时间 00:00:00」「照片不可删除」属于 APP 端,在 `zhongyouApp` 仓库处理,不在本项目内。)
### 2. 接口计划
| 页面动作 | 接口名称 | 方法 | 前端请求路径 | 确认状态 |
| --- | --- | --- | --- | --- |
| 审核流程节点 | 流程历史流转记录 | GET | `/flowable/task/flowRecord` | 已联调:`data.flowList` 为**最新在前**的用户任务;每项含 `createTime`(进入该节点时间,等于上一环节办结时间)与 `finishTime`(本环节实际审核时间);**不含**发起节点与结束节点 |
| 上报节点回填 | 隐患详情 | GET | `/business/hazard/info/{id}` | 已联调:`reporterName`、`createTime` 可作上报人/上报时间 |
### 3. 问题定位(已用测试环境真实数据确认)
- 原实现取 `createTime` 展示,等于把**上一环节的办结时间**当成**本环节的审核时间**。实测 `procInsId=55001`:安全生产办公室 `createTime=15:45:11`、`finishTime=15:51:25`,页面显示 15:45:11,客户实际审核时间 15:51:25。
- `flowList` 倒序 + `:active="已完成节点数"` 叠加,导致图标错位:待办理节点显示绿勾,已办结节点显示序号。
- `flowRecord` 只返回用户任务,发起(上报)环节和结束环节本身缺失。
### 4. 改动
- `src/views/hazard/ledger/index.vue`
- 新增计算属性 `flowSteps`:`flowList` 反转成正序 → 时间只取 `finishTime`、未办结节点 `meta='待办理'` 且不显示时间 → 左侧补「隐患上报」节点(`detail.reporterName` / `detail.createTime`)→ 所有环节均办结时右侧补「流程结束」节点。
- `flowActiveIndex` 改为「首个未完成步骤的下标」(全部完成则为步骤总数),修正 `el-steps` 图标错位。
- `el-step` 描述改为渲染 `step.meta` 与 `step.time`,不再直接取 `node.createTime`。
### 5. 自测
- 用测试环境真实响应(`procInsId=55001` + 隐患详情 `HR_20261117_006`)复刻截图的三个场景跑转换断言:显示时间 == 各节点 `finishTime`;节点 N 的 `finishTime` == 节点 N+1 的 `createTime`(证明原显示偏移一节);待办节点无时间且为未完成;`active` 与步骤位置一致。
- `npm run build:prod` 通过。
## 隐患流程配置厂区下拉改为组织树(2026-11-10)
### 1. 用户目标

16
docs/development/DEVELOPMENT_LOG.md

@ -1,5 +1,21 @@ @@ -1,5 +1,21 @@
# 开发日志
## 2026-11-17:隐患台账「审核流程」步骤条修正
- 问题(客户反馈):详情弹窗的审核流程,未审核节点也带时间;审核时间与实际的差一节(安全生产办公室实际 15:51:25,页面显示 15:45:11);步骤顺序只从「下一节点」开始,上报节点和最终节点看不到。
- 定位(用测试环境真实响应确认,`procInsId=55001`):
- `GET /flowable/task/flowRecord` 的 `data.flowList` 是**最新在前**的用户任务列表,每项同时含 `createTime`(进入该节点时间,等于上一环节办结时间)与 `finishTime`(本环节实际审核时间)。原实现显示 `createTime`,因此每个节点的「审核时间」实际是上一环节的时间;实测节点 N 的 `finishTime` == 节点 N+1 的 `createTime`。
- 倒序数据 + `:active="flowNodes.filter(finishTime).length"` 叠加导致图标错位:待办理节点被染成已完成(绿勾),已办结节点反而显示步骤序号。
- `flowRecord` 只返回用户任务,不含发起(上报)节点与结束节点。
- 改动 `src/views/hazard/ledger/index.vue`:
- 新增 `flowSteps` 计算属性:`flowList` 反转为正序(左→右 = 上报 → 各审批环节 → 结束);时间只取 `finishTime`,未办结节点显示「待办理」且不显示时间;左侧补「隐患上报」节点(取隐患详情的 `reporterName` + `createTime`);所有环节均办结时右侧补「流程结束」节点。
- `flowActiveIndex` 改为「首个未完成步骤的下标」(全部办结则为步骤总数),修正 `el-steps` 图标。
- `el-step` 描述改为渲染 `step.meta` / `step.time`。
- 自测:
- 用真实响应复刻截图时刻的三个场景(全部办结、停在分管安全领导待办理、停在安全生产办公室待办理)跑转换断言:显示时间 == 各节点 `finishTime`;待办节点无时间且标记未完成;`active` 与步骤位置一致。修正后安全生产办公室显示 15:51:25(与客户实际审核时间一致)。
- `npm run build:prod` 通过。
- 待验证:部署后由客户在真实隐患上确认流程步骤与时间。
## 2026-11-10:隐患流程配置厂区下拉改为组织树(bindDeptTree)
- `src/api/flowable/hazardConfig.js` 新增 `getBindDeptTree()`(`GET /flowable/hazardFlowConfig/bindDeptTree`)。

40
src/views/hazard/ledger/index.vue

@ -200,14 +200,13 @@ @@ -200,14 +200,13 @@
<div class="flow-section">
<div class="section-title">审核流程</div>
<div v-loading="flowLoading" class="flow-steps">
<el-steps v-if="flowNodes.length" :active="flowActiveIndex" align-center finish-status="success">
<el-step v-for="(node, index) in flowNodes" :key="index">
<template slot="title">{{ node.taskName || '—' }}</template>
<el-steps v-if="flowSteps.length" :active="flowActiveIndex" align-center finish-status="success">
<el-step v-for="(step, index) in flowSteps" :key="index">
<template slot="title">{{ step.title }}</template>
<template slot="description">
<div class="step-desc">
<span v-if="node.assigneeName">办理人:{{ node.assigneeName }}</span>
<span v-else-if="node.candidate">待办理</span>
<span>{{ formatTime(node.createTime) }}</span>
<span>{{ step.meta }}</span>
<span v-if="step.time">{{ formatTime(step.time) }}</span>
</div>
</template>
</el-step>
@ -286,7 +285,34 @@ export default { @@ -286,7 +285,34 @@ export default {
imageAttachments() { return this.attachments.filter(item => this.isImageAttachment(item)) },
otherAttachments() { return this.attachments.filter(item => !this.isImageAttachment(item)) },
previewUrls() { return this.imageAttachments.map(item => this.attachmentUrl(item)).filter(Boolean) },
flowActiveIndex() { return this.flowNodes.filter(node => node.finishTime).length }
// 审核流程步骤。flowRecord 返回的是「最新在前」的用户任务,且每个节点同时带
// createTime(进入该节点的时间,等于上一环节办结时间)和 finishTime(本环节实际审核时间),
// 页面必须用 finishTime。这里统一整理成「左→右 = 上报 → 各审批环节 → 结束」的正序步骤;
// 未办结的节点不显示时间,避免把上一环节的时间显示成本环节的审核时间。
// el-steps 的 active 语义是「前 N 个已完成」,所以正序后待办节点之后的步骤才会显示为未完成。
flowSteps() {
const report = this.detail || {}
const tasks = Array.isArray(this.flowNodes) ? this.flowNodes.slice().reverse() : []
const steps = tasks.map(node => ({
title: node.taskName || '—',
meta: node.finishTime ? `办理人:${node.assigneeName || '—'}` : '待办理',
time: node.finishTime || '',
finished: Boolean(node.finishTime)
}))
// 流程记录只含审批环节,不含发起环节,用隐患记录的上报人/上报时间补齐最左侧节点
if (report.reporterName || report.createTime) {
steps.unshift({ title: '隐患上报', meta: `上报人:${report.reporterName || '—'}`, time: report.createTime || '', finished: true })
}
// 所有环节都已办结时补一个结束节点,让流程有明确的最终节点
if (tasks.length && tasks.every(node => node.finishTime)) {
steps.push({ title: '流程结束', meta: '已结束', time: '', finished: true })
}
return steps
},
flowActiveIndex() {
const pendingIndex = this.flowSteps.findIndex(step => !step.finished)
return pendingIndex === -1 ? this.flowSteps.length : pendingIndex
}
},
created() { this.getUnits().finally(() => this.getList()) },
methods: {

Loading…
Cancel
Save