feat: gantt block suprt time range change

This commit is contained in:
katherinehhh 2023-02-01 15:31:24 +08:00
parent 71aeeee6b4
commit a437cf2f5f
2 changed files with 23 additions and 5 deletions

View File

@ -91,10 +91,10 @@ const formatData = (data = [], fieldNames, tasks: any[] = [], projectId: any = u
} else {
tasks.push({
start: new Date(item[fieldNames.start]),
end: new Date(item[fieldNames.end]),
end: new Date(item[fieldNames.end]||item[fieldNames.start]+1),
name: item[fieldNames.title],
id: item.id + '',
type: 'task',
type: fieldNames.end?'task':'milestone',
progress: item[fieldNames.progress],
project: projectId,
});
@ -125,7 +125,6 @@ const InternalGanttBlockProvider = (props) => {
};
export const GanttBlockProvider = (props) => {
console.log(props);
return (
<BlockProvider {...props} params={{ ...props.params, paginate: false }}>
<InternalGanttBlockProvider {...props} />

View File

@ -64,8 +64,8 @@ export const GanttDesigner = () => {
value={fieldNames.range||'day'}
options={[
{ label: compile('{{t("Hour")}}'), value: 'hour', color: 'orange' },
{ label: compile('{{t("Quarter of day")}}'), value: 'quarterOfDay', color: 'default' },
{ label: compile('{{t("Half of day")}}'), value: 'halOfDay', color: 'blue' },
{ label: compile('{{t("Quarter of day")}}'), value: 'quarterDay', color: 'default' },
{ label: compile('{{t("Half of day")}}'), value: 'halfDay', color: 'blue' },
{ label: compile('{{t("Day")}}'), value: 'day', color: 'yellow' },
{ label: compile('{{t("Week")}}'), value: 'week', color: 'pule' },
{ label: compile('{{t("Month")}}'), value: 'month', color: 'green' },
@ -126,6 +126,25 @@ export const GanttDesigner = () => {
});
dn.refresh();
}}
/>
<SchemaSettings.SelectItem
title={t('Progress field')}
value={fieldNames.progress}
options={useOptions('double')}
onChange={(progress) => {
const fieldNames = field.decoratorProps.fieldNames || {};
fieldNames['progress'] = progress;
field.decoratorProps.fieldNames = fieldNames;
fieldSchema['x-decorator-props']['fieldNames'] = fieldNames;
service.refresh();
dn.emit('patch', {
schema: {
['x-uid']: fieldSchema['x-uid'],
'x-decorator-props': field.decoratorProps,
},
});
dn.refresh();
}}
/>
<SchemaSettings.ModalItem
title={t('Set the data scope')}