diff --git a/src/pages/09_task-order/TableEmployee.vue b/src/pages/09_task-order/TableEmployee.vue index ea78c7d4..e8b931cc 100644 --- a/src/pages/09_task-order/TableEmployee.vue +++ b/src/pages/09_task-order/TableEmployee.vue @@ -113,7 +113,8 @@ function handleCheckAll() { validate ? status === TaskStatus.Success || status === TaskStatus.Complete || - status === TaskStatus.Redo + status === TaskStatus.Redo || + status === TaskStatus.Restart : status === TaskStatus.Failed || status === TaskStatus.Success || status === TaskStatus.Complete || @@ -196,6 +197,7 @@ function handleCheck( row.taskStatus === TaskStatus.Success || row.taskStatus === TaskStatus.Complete || row.taskStatus === TaskStatus.Redo || + row.taskStatus === TaskStatus.Restart || (selectedEmployee.value.length > 0 && selectedEmployee.value.some((v) => v._template?.id !== row._template?.id)) ) { @@ -311,7 +313,7 @@ function disableCheckAll() { class="" > - + + + {{ $t(`taskOrder.status.Restart`) }} + 0 && selectedEmployee.some( (v) => v._template?.id !== props.row._template?.id, diff --git a/src/pages/09_task-order/TaskStatusComponent.vue b/src/pages/09_task-order/TaskStatusComponent.vue index 2ab602d8..30a7195b 100644 --- a/src/pages/09_task-order/TaskStatusComponent.vue +++ b/src/pages/09_task-order/TaskStatusComponent.vue @@ -41,7 +41,8 @@ function inactiveCheck() { currStatus.value?.value === TaskStatus.Redo || currStatus.value?.value === TaskStatus.Success || currStatus.value?.value === TaskStatus.Complete || - currStatus.value?.value === TaskStatus.Canceled + currStatus.value?.value === TaskStatus.Canceled || + currStatus.value?.value === TaskStatus.Restart ); } diff --git a/src/pages/09_task-order/order_view/MainPage.vue b/src/pages/09_task-order/order_view/MainPage.vue index 9b13b24d..bb69f6e6 100644 --- a/src/pages/09_task-order/order_view/MainPage.vue +++ b/src/pages/09_task-order/order_view/MainPage.vue @@ -227,6 +227,7 @@ const messengerListGroup = computed(() => }); if (indexUser === -1) { + // If user does not exist in acc, create a new entry acc.push({ responsibleUser: task.responsibleUser, list: [ @@ -236,27 +237,38 @@ const messengerListGroup = computed(() => }, ], }); - if (selectedEmployee.value.length < acc.length) { - selectedEmployee.value.push([[]]); - } - } + } else { + const userEntry = acc[indexUser]; - if (indexUser !== -1) { - const indexProduct = acc[indexUser].list.findIndex( + // Find product in user's list + const indexProduct = userEntry.list.findIndex( (v) => v.product.id === task.requestWork.productService.product.id, ); if (indexProduct === -1) { - acc[indexUser].list.push({ + // If product does not exist in user's list, add it + userEntry.list.push({ product: task.requestWork.productService.product, list: [record], }); - } - - if (indexProduct !== -1) { - acc[indexUser].list[indexProduct].list.push(record); + } else { + // Append task to the correct product's list + userEntry.list[indexProduct].list.push(record); } } + + // Ensure `selectedEmployee.value` grows dynamically + while (selectedEmployee.value.length < acc.length) { + selectedEmployee.value.push([]); + } + + acc.forEach((accItem, index) => { + const length = accItem.list.length; + + while (selectedEmployee.value[index].length < length) { + selectedEmployee.value[index].push([]); + } + }); } return acc; @@ -1106,15 +1118,21 @@ watch( step-on :checkbox-on=" view === TaskOrderStatus.Validate && - fullTaskOrder?.userTask.find( + (fullTaskOrder?.userTask.find( (l) => l.userId === v.responsibleUser.id, - )?.userTaskStatus === UserTaskStatus.Submit + )?.userTaskStatus === UserTaskStatus.Submit || + fullTaskOrder?.userTask.find( + (l) => l.userId === v.responsibleUser.id, + )?.userTaskStatus === UserTaskStatus.Restart) " :check-all=" - view === TaskOrderStatus.Validate && + (view === TaskOrderStatus.Validate && + fullTaskOrder?.userTask.find( + (l) => l.userId === v.responsibleUser.id, + )?.userTaskStatus === UserTaskStatus.Submit) || fullTaskOrder?.userTask.find( (l) => l.userId === v.responsibleUser.id, - )?.userTaskStatus === UserTaskStatus.Submit + )?.userTaskStatus === UserTaskStatus.Restart " :rows="sortList(list)" @change-all-status="