Updated flows tree
Deploy Frontend / build-and-deploy (push) Successful in 1m1s
Details
Deploy Frontend / build-and-deploy (push) Successful in 1m1s
Details
This commit is contained in:
parent
863f38cdb5
commit
a7822e0351
|
|
@ -31,6 +31,7 @@ import { notifications } from '@mantine/notifications'
|
|||
import {
|
||||
useHierarchies,
|
||||
useDeleteHierarchy,
|
||||
useUpdateHierarchy,
|
||||
} from '@/features/hierarchies/hooks/useHierarchies'
|
||||
import { useUsers } from '@/features/users/hooks/useUsers'
|
||||
import { useDepartments } from '@/features/departments/hooks/useDepartments'
|
||||
|
|
@ -94,6 +95,7 @@ export default function HierarchiesPage() {
|
|||
const { data: topics } = useTopics({ limit: 1000 })
|
||||
|
||||
const deleteHierarchy = useDeleteHierarchy()
|
||||
const updateHierarchy = useUpdateHierarchy()
|
||||
|
||||
const totalPages = data?.total_count ? Math.ceil(data.total_count / LIMIT) : 1
|
||||
|
||||
|
|
@ -244,6 +246,28 @@ export default function HierarchiesPage() {
|
|||
const isIndeterminate =
|
||||
selectedIds.length > 0 && selectedIds.length < (data?.data?.length || 0)
|
||||
|
||||
const handleBulkUpdateSystem = async (group: ChainGroup, targetSystem: string | null) => {
|
||||
try {
|
||||
// Обновляем все шаги в выбранной цепочке асинхронно
|
||||
await Promise.all(
|
||||
group.steps.map((step) =>
|
||||
updateHierarchy.mutateAsync({
|
||||
id: step.id!,
|
||||
subordinate_id: step.subordinate_id,
|
||||
approver_id: step.approver_id,
|
||||
department_id: step.department_id,
|
||||
topic_category_id: step.topic_category_id,
|
||||
topic_id: step.topic_id,
|
||||
priority: step.priority,
|
||||
target_system: targetSystem, // Применяем новую систему
|
||||
})
|
||||
)
|
||||
)
|
||||
} catch (error) {
|
||||
console.error("Ошибка при массовом обновлении систем цепочки", error)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<Stack gap="md">
|
||||
{/* Заголовок */}
|
||||
|
|
@ -366,6 +390,7 @@ export default function HierarchiesPage() {
|
|||
onDeleteStep={handleDelete}
|
||||
onAddStep={handleAddStep}
|
||||
onDuplicateChain={handleDuplicateChain}
|
||||
onBulkUpdateSystem={handleBulkUpdateSystem}
|
||||
/>
|
||||
))
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -231,6 +231,8 @@ export default function HierarchyEditModal({
|
|||
const isSubmitting = createHierarchy.isPending || updateHierarchy.isPending
|
||||
const hasErrors = Object.keys(form.errors).length > 0
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<Modal
|
||||
opened={opened}
|
||||
|
|
|
|||
Loading…
Reference in New Issue