Commit 06107e61 by Joey

feat(@gms/gms-plugin-billexpand): 驳回单据审批轨迹显示被驳回流程

parent 948b88d9
...@@ -17,11 +17,11 @@ ...@@ -17,11 +17,11 @@
:inner="true" :inner="true"
:mask="false" :mask="false"
> >
<div v-if="!data || !data.steps">暂无数据</div> <div v-if="!data || data.length == 0">暂无数据</div>
<div v-if="data && data.steps" class="workflow-step-wrapper"> <div v-if="data && data.length" class="workflow-step-wrapper">
<div <div
class="workflow-step" class="workflow-step"
v-for="step, k in data.steps" v-for="step, k in data"
:key="k" :key="k"
> >
<div class="step-head"> <div class="step-head">
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
<use v-else-if="step.result == -2" xlink:href="#icon-a-24_BILLEXPAND_C_RBC_moduanjiedian"></use> <use v-else-if="step.result == -2" xlink:href="#icon-a-24_BILLEXPAND_C_RBC_moduanjiedian"></use>
</svg> </svg>
</div> </div>
<div :class="`step-line ${step.state === 2 ? 'finish-line' : 'waiting-line'}`" v-if="k != data.steps.length - 1"></div> <div :class="`step-line ${step.state === 2 ? 'finish-line' : 'waiting-line'}`" v-if="k != data.length - 1"></div>
</div> </div>
<div class="step-main"> <div class="step-main">
<div class="main-body"> <div class="main-body">
...@@ -165,46 +165,60 @@ export default { ...@@ -165,46 +165,60 @@ export default {
bizObjId: this.context.bill.getMasterData().getValue('id'), bizObjId: this.context.bill.getMasterData().getValue('id'),
}, },
}).then((res) => { }).then((res) => {
res = res || [] const formatTrack = (curTrack) => {
let count = 0 if (!curTrack) return []
this.data = res[0] curTrack.steps.push({
for (let o of res) {
if (o.procState == 1) {
this.data = o
;++count
}
}
if (count > 1) {
this.$Message.error('工作流数据异常')
}
if (!this.data) return
this.data.steps.push({
title: "提交申请", title: "提交申请",
state: 2, state: 2,
createTime: this.data.startTime, createTime: curTrack.startTime,
completeTime: this.data.startTime, completeTime: curTrack.startTime,
comments: null, comments: null,
result: -1, result: -1,
actualOwner: this.data.submitter, actualOwner: curTrack.submitter,
}) })
// 审批流程结束贴一个结束节点 // 审批流程结束贴一个结束节点
if (this.data.procState === 2) { if (curTrack.procState === 2) {
this.data.steps.unshift({ curTrack.steps.unshift({
state: this.data.procState, state: curTrack.procState,
createTime: this.data.finishTime, createTime: curTrack.finishTime,
completeTime: this.data.finishTime, completeTime: curTrack.finishTime,
result: -2, result: -2,
}) })
} }
// 否则从当前节点切断, // 否则从当前节点切断,
else { else {
for (let i = 0; i < this.data.steps.length - 1; ++i) { for (let i = 0; i < curTrack.steps.length - 1; ++i) {
if (this.data.steps[i].state === 1 && this.data.steps[i + 1].state === 2) { if (curTrack.steps[i].state === 1 && curTrack.steps[i + 1].state === 2) {
this.data.steps = this.data.steps.slice(i) curTrack.steps = curTrack.steps.slice(i)
break break
} }
} }
} }
return curTrack.steps || []
}
res = res || []
let count = 0
for (let o of res) {
if (o.procState == 1) {
;++count
}
}
if (count > 1) {
this.$Message.error('工作流数据异常')
}
this.data = []
for (let i = res.length - 1; i >= 0; --i) {
const o = res[i]
this.data = this.data.concat(formatTrack(o))
}
// 去掉中间的审批结束节点
for (let i = 1; i < this.data.length; ++i) {
if (this.data[i].result == -2) {
this.data.splice(i, 1)
;--i
}
}
}) })
}, },
computed: { computed: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment