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

复制代码
 
相关推荐
南城以南溫暖如初1477 小时前
从零搭建24小时自助健身系统:技术选型与核心模块实战
java·spring boot·redis·mysql·vue·mybatis
泠曦れいひ11 小时前
在当前项目中安装Vite
前端框架·npm·node.js
_xaboy15 小时前
开源表单设计器 FcDesigner 保存表单教程:toJson parseJson 回显
低代码·开源·vue·表单·fcdesigner
墨白曦煜16 小时前
智能体架构范式总结(React、Plan-And-Solve、Reflection)
前端·react.js·前端框架
zttbee16 小时前
vue学习(白话功能版)
前端·vue.js·学习·前端框架
钛态1 天前
Vite 中的 CSS 工程化:从 CSS Modules 到 UnoCSS 的渐进式迁移
前端·vue·react·web
南城以南溫暖如初1472 天前
树洞交友系统架构设计与匿名聊天实战指南
java·spring boot·mysql·系统架构·vue·mybatis·交友
_xaboy2 天前
低代码可视化表单设计器 FcDesigner 远程请求教程:GET POST 变量鉴权
低代码·开源·vue·表单·fcdesigner
WebInfra3 天前
Rspack 2.2 发布:30+ 项性能优化,拥抱 Solid 2.0
前端·javascript·前端框架