|
|
@@ -937,7 +937,7 @@
|
|
|
},
|
|
|
created() {
|
|
|
const isWt = this.$route.query?.isWt;
|
|
|
-
|
|
|
+
|
|
|
if (isWt) {
|
|
|
this.tabValue = '1';
|
|
|
this.$nextTick(() => {
|
|
|
@@ -945,11 +945,11 @@
|
|
|
const way = this.$route.query?.way;
|
|
|
console.log(item);
|
|
|
if (way == 'todo') {
|
|
|
- this.handleOrderPublish(item)
|
|
|
+ this.handleOrderPublish(item);
|
|
|
} else {
|
|
|
- this.goDetail(item)
|
|
|
+ this.goDetail(item);
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
}
|
|
|
this.getFieldModel();
|
|
|
this.getPlanDotLine();
|
|
|
@@ -1038,44 +1038,47 @@
|
|
|
},
|
|
|
|
|
|
async loadTaskNames(list) {
|
|
|
- for (const row of list) {
|
|
|
- try {
|
|
|
- const res = await getTaskInstanceList(row.id);
|
|
|
- const findIndex = res.findIndex(
|
|
|
- (item) => item.taskId == row.taskId
|
|
|
- );
|
|
|
-
|
|
|
- const markedList = res.map((item, index) => {
|
|
|
- let flag = 'after';
|
|
|
-
|
|
|
- if (findIndex != -1) {
|
|
|
- if (index < findIndex) {
|
|
|
- flag = '4';
|
|
|
- } else if (index === findIndex) {
|
|
|
- flag = '3';
|
|
|
- } else {
|
|
|
- flag = '1';
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return {
|
|
|
- ...item,
|
|
|
- flag
|
|
|
- };
|
|
|
- });
|
|
|
-
|
|
|
- this.$set(this.taskNameMap, row.id, markedList);
|
|
|
+ const results = await Promise.all(
|
|
|
+ list.map((row) =>
|
|
|
+ getTaskInstanceList(row.id)
|
|
|
+ .then((res) => {
|
|
|
+ const findIndex = res.findIndex(
|
|
|
+ (item) => item.taskId == row.taskId
|
|
|
+ );
|
|
|
+
|
|
|
+ const markedList = res.map((item, index) => {
|
|
|
+ let flag = 'after';
|
|
|
+
|
|
|
+ if (findIndex != -1) {
|
|
|
+ if (index < findIndex) {
|
|
|
+ flag = '4';
|
|
|
+ } else if (index === findIndex) {
|
|
|
+ flag = '3';
|
|
|
+ } else {
|
|
|
+ flag = '1';
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ flag
|
|
|
+ };
|
|
|
+ });
|
|
|
+
|
|
|
+ return { id: row.id, data: markedList };
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ return { id: row.id, data: [] };
|
|
|
+ })
|
|
|
+ )
|
|
|
+ );
|
|
|
|
|
|
- // this.$set(
|
|
|
- // this.taskNameMap,
|
|
|
- // row.taskId,
|
|
|
- // res.list.map((i) => i.name)
|
|
|
- // );
|
|
|
- // console.log(res, '工序数据');
|
|
|
- } catch (e) {
|
|
|
- this.$set(this.taskNameMap, row.id, []);
|
|
|
- }
|
|
|
+ // 一次性替换整个 map,只触发一次响应式更新,避免界面抖动
|
|
|
+ const newMap = { ...this.taskNameMap };
|
|
|
+ for (const { id, data } of results) {
|
|
|
+ newMap[id] = data;
|
|
|
}
|
|
|
+ this.taskNameMap = newMap;
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs.table?.doLayout?.();
|
|
|
@@ -1107,7 +1110,6 @@
|
|
|
|
|
|
/* 表格数据源 */
|
|
|
async datasource({ page, limit, where, order }) {
|
|
|
- console.log(this.tabValue, '888');
|
|
|
let statusList = this.tabValue == 1 ? [4, 5, 7] : [this.tabValue];
|
|
|
|
|
|
let params = {
|
|
|
@@ -1129,14 +1131,6 @@
|
|
|
let res = await URL({ ...params, statusList });
|
|
|
|
|
|
this.loadTaskNames(res.list);
|
|
|
- // let res = await URL({ ...params, statusList });
|
|
|
-
|
|
|
- // await Promise.all(
|
|
|
- // res.list.map(async (row) => {
|
|
|
- // const tasks = await getTaskInstanceList(row.id);
|
|
|
- // row._taskList = tasks;
|
|
|
- // })
|
|
|
- // );
|
|
|
|
|
|
return res;
|
|
|
},
|