mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-09 15:39:24 +08:00
feat: gantt block progress change
This commit is contained in:
parent
7c5a23cdb9
commit
33a8a25c76
@ -20,7 +20,8 @@ import { removeHiddenTasks, sortTasks } from '../../helpers/other-helper';
|
|||||||
import styles from './gantt.module.css';
|
import styles from './gantt.module.css';
|
||||||
import { GanttToolbarContext } from '../../context';
|
import { GanttToolbarContext } from '../../context';
|
||||||
import { useDesignable } from '../../../../../schema-component';
|
import { useDesignable } from '../../../../../schema-component';
|
||||||
import { TableBlockProvider, useGanttBlockContext } from '../../../../../block-provider';
|
import { TableBlockProvider, useGanttBlockContext, useBlockRequestContext } from '../../../../../block-provider';
|
||||||
|
|
||||||
import { useProps } from '../../../../hooks/useProps';
|
import { useProps } from '../../../../hooks/useProps';
|
||||||
|
|
||||||
// export function getTestTasks() {
|
// export function getTestTasks() {
|
||||||
@ -188,6 +189,7 @@ export const Gantt: any = (props) => {
|
|||||||
onSelect,
|
onSelect,
|
||||||
onExpanderClick,
|
onExpanderClick,
|
||||||
} = props;
|
} = props;
|
||||||
|
const { resource } = useBlockRequestContext();
|
||||||
const fieldSchema = useFieldSchema();
|
const fieldSchema = useFieldSchema();
|
||||||
const { fieldNames, dataSource } = useProps(props);
|
const { fieldNames, dataSource } = useProps(props);
|
||||||
const { range: viewMode } = fieldNames || { range: 'day' };
|
const { range: viewMode } = fieldNames || { range: 'day' };
|
||||||
@ -457,7 +459,6 @@ export const Gantt: any = (props) => {
|
|||||||
* Task select event
|
* Task select event
|
||||||
*/
|
*/
|
||||||
const handleSelectedTask = (taskId: string) => {
|
const handleSelectedTask = (taskId: string) => {
|
||||||
console.log(taskId);
|
|
||||||
const newSelectedTask = barTasks.find((t) => t.id === taskId);
|
const newSelectedTask = barTasks.find((t) => t.id === taskId);
|
||||||
const oldSelectedTask = barTasks.find((t) => !!selectedTask && t.id === selectedTask.id);
|
const oldSelectedTask = barTasks.find((t) => !!selectedTask && t.id === selectedTask.id);
|
||||||
if (onSelect) {
|
if (onSelect) {
|
||||||
@ -475,14 +476,25 @@ export const Gantt: any = (props) => {
|
|||||||
onExpanderClick({ ...task, hideChildren: !task.hideChildren });
|
onExpanderClick({ ...task, hideChildren: !task.hideChildren });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const handleProgressChange = (task) => {
|
const handleProgressChange = async (task) => {
|
||||||
console.log(task);
|
console.log(task);
|
||||||
|
await resource.update({
|
||||||
|
filterByTk: task.id,
|
||||||
|
values: {
|
||||||
|
...task,
|
||||||
|
[fieldNames.progress]: task.progress,
|
||||||
|
},
|
||||||
|
});
|
||||||
};
|
};
|
||||||
const handleTaskChange = (task) => {
|
const handleTaskChange = async (task) => {
|
||||||
console.log('On date change Id:' + task.id);
|
await resource.update({
|
||||||
let newTasks = tasks.map((t) => (t.id === task.id ? task : t));
|
filterByTk: task.id,
|
||||||
console.log(newTasks);
|
values: {
|
||||||
// setTasks(newTasks);
|
...task,
|
||||||
|
[fieldNames.start]: task.start,
|
||||||
|
[fieldNames.end]: task.end,
|
||||||
|
},
|
||||||
|
});
|
||||||
};
|
};
|
||||||
const gridProps: GridProps = {
|
const gridProps: GridProps = {
|
||||||
columnWidth,
|
columnWidth,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user