mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-09 15:39:24 +08:00
feat: gantt block suprt process update
This commit is contained in:
parent
b6db10944d
commit
3e01b71234
@ -20,11 +20,11 @@ import { GanttToolbarContext } from '../../context';
|
|||||||
import { useDesignable } from '../../../../../schema-component';
|
import { useDesignable } from '../../../../../schema-component';
|
||||||
import { TableBlockProvider, useGanttBlockContext, useBlockRequestContext } from '../../../../../block-provider';
|
import { TableBlockProvider, useGanttBlockContext, useBlockRequestContext } from '../../../../../block-provider';
|
||||||
|
|
||||||
function Toolbar(props:any) {
|
function Toolbar(props: any) {
|
||||||
const fieldSchema = useFieldSchema();
|
const fieldSchema = useFieldSchema();
|
||||||
const toolBarSchema: Schema = useMemo(
|
const toolBarSchema: Schema = useMemo(
|
||||||
() =>
|
() =>
|
||||||
fieldSchema.reduceProperties((buf:any, current:any) => {
|
fieldSchema.reduceProperties((buf: any, current: any) => {
|
||||||
if (current['x-component'].endsWith('.ActionBar')) {
|
if (current['x-component'].endsWith('.ActionBar')) {
|
||||||
return current;
|
return current;
|
||||||
}
|
}
|
||||||
@ -39,12 +39,12 @@ function Toolbar(props:any) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const getColumnWidth = (dataSetLength:any, clientWidth:any) => {
|
const getColumnWidth = (dataSetLength: any, clientWidth: any) => {
|
||||||
const columnWidth = clientWidth / dataSetLength > 50 ? Math.floor(clientWidth / dataSetLength) + 20 : 50;
|
const columnWidth = clientWidth / dataSetLength > 50 ? Math.floor(clientWidth / dataSetLength) + 20 : 50;
|
||||||
return columnWidth;
|
return columnWidth;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Gantt: any = (props:any) => {
|
export const Gantt: any = (props: any) => {
|
||||||
const { designable } = useDesignable();
|
const { designable } = useDesignable();
|
||||||
const {
|
const {
|
||||||
headerHeight = designable ? 65 : 55,
|
headerHeight = designable ? 65 : 55,
|
||||||
@ -364,22 +364,21 @@ export const Gantt: any = (props:any) => {
|
|||||||
setSelectedTask(newSelectedTask);
|
setSelectedTask(newSelectedTask);
|
||||||
};
|
};
|
||||||
const handleTableExpanderClick = (expanded: boolean, record: any) => {
|
const handleTableExpanderClick = (expanded: boolean, record: any) => {
|
||||||
const task = tasks.find((v:any) => v.id === record.id + '');
|
const task = tasks.find((v: any) => v.id === record.id + '');
|
||||||
if (onExpanderClick && record.children.length) {
|
if (onExpanderClick && record.children.length) {
|
||||||
onExpanderClick({ ...task, hideChildren: !expanded });
|
onExpanderClick({ ...task, hideChildren: !expanded });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const handleProgressChange = async (task:Task) => {
|
const handleProgressChange = async (task: Task) => {
|
||||||
await resource.update({
|
await resource.update({
|
||||||
filterByTk: task.id,
|
filterByTk: task.id,
|
||||||
values: {
|
values: {
|
||||||
...task,
|
...task,
|
||||||
[fieldNames.progress]: task.progress/100,
|
[fieldNames.progress]: task.progress / 100,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
await ctx.service.refresh();
|
|
||||||
};
|
};
|
||||||
const handleTaskChange = async (task:Task) => {
|
const handleTaskChange = async (task: Task) => {
|
||||||
await resource.update({
|
await resource.update({
|
||||||
filterByTk: task.id,
|
filterByTk: task.id,
|
||||||
values: {
|
values: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user