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,44 +165,58 @@ export default { ...@@ -165,44 +165,58 @@ export default {
bizObjId: this.context.bill.getMasterData().getValue('id'), bizObjId: this.context.bill.getMasterData().getValue('id'),
}, },
}).then((res) => { }).then((res) => {
const formatTrack = (curTrack) => {
if (!curTrack) return []
curTrack.steps.push({
title: "提交申请",
state: 2,
createTime: curTrack.startTime,
completeTime: curTrack.startTime,
comments: null,
result: -1,
actualOwner: curTrack.submitter,
})
// 审批流程结束贴一个结束节点
if (curTrack.procState === 2) {
curTrack.steps.unshift({
state: curTrack.procState,
createTime: curTrack.finishTime,
completeTime: curTrack.finishTime,
result: -2,
})
}
// 否则从当前节点切断,
else {
for (let i = 0; i < curTrack.steps.length - 1; ++i) {
if (curTrack.steps[i].state === 1 && curTrack.steps[i + 1].state === 2) {
curTrack.steps = curTrack.steps.slice(i)
break
}
}
}
return curTrack.steps || []
}
res = res || [] res = res || []
let count = 0 let count = 0
this.data = res[0]
for (let o of res) { for (let o of res) {
if (o.procState == 1) { if (o.procState == 1) {
this.data = o
;++count ;++count
} }
} }
if (count > 1) { if (count > 1) {
this.$Message.error('工作流数据异常') this.$Message.error('工作流数据异常')
} }
if (!this.data) return this.data = []
this.data.steps.push({ for (let i = res.length - 1; i >= 0; --i) {
title: "提交申请", const o = res[i]
state: 2, this.data = this.data.concat(formatTrack(o))
createTime: this.data.startTime,
completeTime: this.data.startTime,
comments: null,
result: -1,
actualOwner: this.data.submitter,
})
// 审批流程结束贴一个结束节点
if (this.data.procState === 2) {
this.data.steps.unshift({
state: this.data.procState,
createTime: this.data.finishTime,
completeTime: this.data.finishTime,
result: -2,
})
} }
// 否则从当前节点切断, // 去掉中间的审批结束节点
else { for (let i = 1; i < this.data.length; ++i) {
for (let i = 0; i < this.data.steps.length - 1; ++i) { if (this.data[i].result == -2) {
if (this.data.steps[i].state === 1 && this.data.steps[i + 1].state === 2) { this.data.splice(i, 1)
this.data.steps = this.data.steps.slice(i) ;--i
break
}
} }
} }
}) })
......
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