Răsfoiți Sursa

fix: 多级审批流程显示问题

liujt 1 săptămână în urmă
părinte
comite
5b3bc64ec0
1 a modificat fișierele cu 16 adăugiri și 3 ștergeri
  1. 16 3
      pages/home/wt/components/detail.vue

+ 16 - 3
pages/home/wt/components/detail.vue

@@ -61,14 +61,25 @@
 			this.getInfo(processInstanceId)
 		},
 		methods: {
+			getChildren(data) {
+				const arr = [];
+				(data || []).forEach((item) => {
+				if (item.children && item.children.length > 0) {
+					arr.push(...this.getChildren(item.children));
+				}
+				arr.push(item);
+				});
+				return arr;
+			},
 			async getInfo(processInstanceId) {
 				// 审批记录
 				let data = await getTaskListByProcessinstanceid(processInstanceId)
 				// 移除已取消的审批
 				data.forEach((task) => {
-					if (task.result !== 4) {
-						this.tasks.push(task);
-					}
+					// if (task.result !== 4) {
+						// this.tasks.push(task);
+						this.tasks.push(...this.getChildren([task]));
+					// }
 				});
 				// 排序,将未完成的排在前面,已完成的排在后面;
 				this.tasks.sort((a, b) => {
@@ -98,6 +109,8 @@
 						return;
 					}
 				});
+
+				console.log('tasks~~~~', this.tasks)
 			},
 			getTimelineItemIcon(item) {
 				if (item.result === 1) {