antdesign vue 步骤条a-step按审核人员节点排序显示逻辑

一、需求内容

目前审核人员角色有:学术、法务、售后,串行执行审核流程。

审核流程:发起/修改审核-》审核节点

审核节点规则:学术-》法务-》售后,每个节点均可以审核或修改。

审核状态:发起、修改、待审核、已审核。

因此前端根据节点规则来展示审核步骤给用户。

二、开发思路

1.根据节点规则,自定义一个字段存储审核节点类型:nodeType:1-8

2.区分审核节点是一组还是多组,

例如:一组审核时['发起审核','学术待审核','法务待审核','售后待审核'] ;

而多组审核则是8个状态都会出现,例如:['发起审核','学术已审核','法务已审核','售后已审核','修改审核','学术已审核','法务待审核','售后待审核',...]等此循环出现;

3.多组审核数据需要按照'审核节点规则'重新排序,用sort()重新生产结果数组。

4. 根据生成结果数组result,设置当前步骤值current。

三、项目运用代码(部分)

复制代码
function auditCheckClick(result){      
          if(result && result.length){
            let len = result.length
            result.map((item,index)=>{
              if(item.auditType==1){ item.nodeType=6}
              else if(item.auditType==2){ item.nodeType=7}
              else if(item.auditType==3){ item.nodeType=8}
              else if(item.auditType==4){ item.nodeType=2}
              else if(item.auditType==5){ item.nodeType=3}
              else if(item.auditType==6){ item.nodeType=4}
              else if(item.auditType==7||item.auditType==8){ item.nodeType=1}
              if(item.auditType==8){item.nodeIndex=index}
              return item
            })
            console.log(1,result)
            if(len<=4){ // 一组审核
              result.sort((r1,r2)=>{
                return r1.nodeType - r2.nodeType
              })
            }else{ // 多组审核
              let lastArr = result.filter(el=>el.nodeIndex)
              let lastIndex= lastArr&&lastArr.length?lastArr[lastArr.length-1].nodeIndex:0
              let hisSort = result.slice(0,lastIndex)
              let sortArr = result.slice(lastIndex)
              sortArr.sort((r1,r2)=>{return r1.nodeType - r2.nodeType})
              result = hisSort.concat(sortArr)
              console.log(2, lastArr,lastIndex)
              console.log(3, hisSort,sortArr)
              console.log(4, result)
            }
          }
 // result 结果数组

let step = result.findIndex(item=>item.auditType==1||item.auditType==2||item.auditType==3) // 学术、法务、售后的待审核状态
  let current = step&&step!=-1?step:result.length-1

复制代码
 
相关推荐
诗和远方149395623273414 小时前
Matrix 内存监控
前端框架
水宁成冰16 小时前
前端静态网站Lighthouse评分优化,vue3项目
前端·vue
前端无涯16 小时前
TypeScript 完整学习指南:从基础到工程化实践
typescript·vue·react
狗哥哥16 小时前
Vite 插件开发实战:从业务痛点到优雅解决方案
vue.js·架构·前端框架
邂逅星河浪漫20 小时前
【Dify-Chatflow】简历优化助手实现+前后端分离式系统集成+Docker容器化部署)
java·docker·vue·springboot·dify·apifox
by__csdn21 小时前
Vue3 大文件分片上传完整指南:图片/视频附件高效传输方案
前端·javascript·vue.js·typescript·vue·css3·html5
high201121 小时前
【CVE-Fix】-- CVE-2025-66478 (React 2 Shell RCE) 漏洞修复指南
前端·react.js·前端框架·cve
扑棱蛾子21 小时前
微前端:从“大前端”到“积木式开发”的架构演进
前端·架构·前端框架
大布布将军1 天前
Vue 3 的“降维打击”:Composition API 是如何让 Mixin 成为历史文物的?
前端·javascript·vue.js·程序人生·面试·前端框架·学习方法
Mintopia1 天前
🧭 2025 年「大前端 Monorepo 架构」最佳实践指南
前端·前端框架·前端工程化