Skip to content

Commit

Permalink
chore(data-table): fix timediff bug
Browse files Browse the repository at this point in the history
Signed-off-by: samuel.park <[email protected]>
  • Loading branch information
piggggggggy committed Dec 18, 2024
1 parent f905417 commit dc2ea1d
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,14 @@ const originDataState = reactive({
}),
dataName: computed(() => (props.item.options as DataTableAddOptions).data_name ?? ''),
dataUnit: computed(() => (props.item.options as DataTableAddOptions).data_unit ?? ''),
timeDiff: computed(() => {
timeDiff: computed<string>(() => {
const timeDiff = (props.item.options as DataTableAddOptions).timediff;
const timeDiffKeys = Object.keys(timeDiff || {});
const timeDiffKeys = Object.keys(timeDiff || {}).filter((key) => key !== 'data_name');
return timeDiffKeys.length ? timeDiffKeys[0] : 'none';
}),
timeDiffDate: computed(() => {
timeDiffDate: computed<string|undefined>(() => {
const timeDiff = (props.item.options as DataTableAddOptions).timediff;
const timeDiffKeys = Object.keys(timeDiff || {});
const timeDiffKeys = Object.keys(timeDiff || {}).filter((key) => key !== 'data_name');
return timeDiffKeys.length ? `${-timeDiff[timeDiffKeys[0]]}` : undefined;
}),
timeDiffDataName: computed<string>(() => {
Expand Down Expand Up @@ -320,7 +320,7 @@ const setInitialDataTableForm = () => {
// Advanced Options
advancedOptionsState.selectedTimeDiff = originDataState.timeDiff;
advancedOptionsState.selectedTimeDiffDate = originDataState.timeDiffDate;
advancedOptionsState.timeDiffDataName = '';
advancedOptionsState.timeDiffDataName = originDataState.timeDiffDataName;
};
onMounted(() => {
Expand Down

0 comments on commit dc2ea1d

Please sign in to comment.