feat: handle changing props
This commit is contained in:
parent
c39e9d5c62
commit
4e0c69d751
2 changed files with 14 additions and 4 deletions
|
@ -53,7 +53,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {computed, nextTick, ref} from 'vue'
|
import {computed, nextTick, ref, watch} from 'vue'
|
||||||
import TaskCollectionService from '@/services/taskCollection'
|
import TaskCollectionService from '@/services/taskCollection'
|
||||||
import {format, parse} from 'date-fns'
|
import {format, parse} from 'date-fns'
|
||||||
import {colorIsDark} from '@/helpers/color/colorIsDark'
|
import {colorIsDark} from '@/helpers/color/colorIsDark'
|
||||||
|
@ -85,6 +85,11 @@ const props = defineProps({
|
||||||
type: String,
|
type: String,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
showTasksWithoutDates: {
|
||||||
|
type: Boolean,
|
||||||
|
required: false,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const dateFromDate = computed(() => parse(props.dateFrom, 'yyyy-LL-dd', new Date()))
|
const dateFromDate = computed(() => parse(props.dateFrom, 'yyyy-LL-dd', new Date()))
|
||||||
|
@ -142,7 +147,7 @@ async function loadTasks() {
|
||||||
filter_comparator: ['greater_equals', 'less_equals'],
|
filter_comparator: ['greater_equals', 'less_equals'],
|
||||||
filter_value: [props.dateFrom, props.dateTo],
|
filter_value: [props.dateFrom, props.dateTo],
|
||||||
filter_concat: 'and',
|
filter_concat: 'and',
|
||||||
filter_include_nulls: true,
|
filter_include_nulls: props.showTasksWithoutDates,
|
||||||
}
|
}
|
||||||
|
|
||||||
const taskCollectionService = new TaskCollectionService()
|
const taskCollectionService = new TaskCollectionService()
|
||||||
|
@ -168,6 +173,10 @@ async function loadTasks() {
|
||||||
|
|
||||||
loadTasks()
|
loadTasks()
|
||||||
|
|
||||||
|
watch(() => props.dateTo, loadTasks)
|
||||||
|
watch(() => props.dateFrom, loadTasks)
|
||||||
|
watch(() => props.showTasksWithoutDates, loadTasks)
|
||||||
|
|
||||||
async function updateTask(e) {
|
async function updateTask(e) {
|
||||||
const task = tasks.value.get(e.bar.ganttBarConfig.id)
|
const task = tasks.value.get(e.bar.ganttBarConfig.id)
|
||||||
task.startDate = e.bar.startDate
|
task.startDate = e.bar.startDate
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<fancycheckbox class="is-block" v-model="showTaskswithoutDates">
|
<fancycheckbox class="is-block" v-model="showTasksWithoutDates">
|
||||||
{{ $t('list.gantt.showTasksWithoutDates') }}
|
{{ $t('list.gantt.showTasksWithoutDates') }}
|
||||||
</fancycheckbox>
|
</fancycheckbox>
|
||||||
</div>
|
</div>
|
||||||
|
@ -44,6 +44,7 @@
|
||||||
:date-to="dateTo"
|
:date-to="dateTo"
|
||||||
:precision="precision"
|
:precision="precision"
|
||||||
:list-id="props.listId"
|
:list-id="props.listId"
|
||||||
|
:show-tasks-without-dates="showTasksWithoutDates"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</card>
|
</card>
|
||||||
|
@ -71,7 +72,7 @@ const props = defineProps({
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const showTaskswithoutDates = ref(false)
|
const showTasksWithoutDates = ref(false)
|
||||||
const precision = ref('day')
|
const precision = ref('day')
|
||||||
|
|
||||||
const now = ref(new Date())
|
const now = ref(new Date())
|
||||||
|
|
Loading…
Reference in a new issue