-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathApp.vue
77 lines (71 loc) · 1.79 KB
/
App.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<template>
<div class='container'>
<CustomScheduler
:dataSource='dataSource'
/>
<FilterForm
:onFilterValueChange='onFilterValueChange'
:onStartDateChange='onStartDateChange'
:onEndDateChange='onEndDateChange'
/>
</div>
</template>
<script>
import 'devextreme/dist/css/dx.common.css';
import 'devextreme/dist/css/dx.material.blue.light.compact.css';
import DataSource from 'devextreme/data/data_source';
import CustomScheduler from '@/components/CustomScheduler';
import FilterForm from '@/components/FilterForm';
import {
startViewDate,
endViewDate
} from './config.js'
import {data} from './data.js';
import './style.css';
const filterDataSource = new DataSource({
store: {
type: 'array',
data: data,
},
paginate: false,
})
export default {
name: 'App',
components: {
CustomScheduler,
FilterForm
},
data() {
return {
dataSource: filterDataSource,
startDate: startViewDate,
endDate: endViewDate,
filterValue: '',
};
},
methods: {
onFilterValueChange({event}) {
this.filterValue = event.currentTarget.value.toLowerCase();
this.filterAppointments(this.filterValue, this.startDate, this.endDate);
},
onStartDateChange(e) {
this.startDate = e.value;
this.filterAppointments(this.filterValue, this.startDate, this.endDate);
},
onEndDateChange(e) {
this.endDate = e.value;
this.filterAppointments(this.filterValue, this.startDate, this.endDate);
},
filterAppointments(filterValue, startDate, endDate) {
filterDataSource.filter([
['text', 'contains', filterValue],
'and',
['startDate', '>=', startDate],
'and',
['endDate', '<=', endDate]
])
filterDataSource.load()
}
}
};
</script>