searchFeatureBox.vue
3.07 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<template>
<div>
<CloseBox
@clickClose="clickClose"
>
<template v-slot:header>
드론 기체 검색
</template>
<template v-slot:body>
<a-alert
v-if="getLogFilter.checkFilter"
message="필터가 적용된 상태입니다."
type="info" show-icon
class="filter-alert"
/>
<div class="r-flex gap-default"
:style="{marginTop: getLogFilter.checkFilter ? '10px' : '0px'}"
>
<a-select
v-model="searchType"
class="search-input"
style="min-width: 80px"
>
<a-select-option value="modelName">
모델명
</a-select-option>
<a-select-option value="maker">
제조사
</a-select-option>
<a-select-option value="usageName">
용도
</a-select-option>
</a-select>
<a-input-search
placeholder="검색어"
enter-button
@search="onSearch"
/>
</div>
<a-list
v-if="searchData.length"
bordered
:data-source="searchData">
<a-list-item
slot="renderItem"
slot-scope="item"
@click="() => clickListItem(item)"
>
{{ `${item.modelName} / ${item.maker} / ${item.usage || '*'}` }}
</a-list-item>
</a-list>
</template>
</CloseBox>
</div>
</template>
<script>
import CloseBox from '@/components/_Common/CloseBox/closeBox';
import { mapGetters } from 'vuex';
export default {
head() {
return {
title: 'Drone',
meta: [
{
hid: 'database',
name: 'Descriptions',
content: 'DroneWeb-Content',
},
],
};
},
components: {
CloseBox,
},
props: {},
data() {
return {
searchValue: null,
searchType: 'modelName',
searchData: [],
dataSource: [],
};
},
computed: {
...mapGetters('Etc', {
getMakerDroneList: 'getMakerDroneList',
}),
...mapGetters('Drone', {
getLogFilter: 'drone/getLogFilter',
getWholeDroneLog: 'drone/getWholeDroneLog',
}),
},
created() {
},
methods: {
onSearch(value) {
const params = {};
params[this.searchType] = value;
this.$store.dispatch('Drone/list/fetchListContents', params).then((r) => {
this.searchData = r.drones;
});
},
handleSearch(value) {
},
clickClose() {
this.$emit('clickClose');
},
clickListItem(item) {
let checkValid = false;
this.getWholeDroneLog.forEach((log) => {
if (Number(log.droneId) === Number(item.id)) {
this.$emit('focusChange', log.latitude, log.longitude);
this.$emit('clickDrone', Number(item.id));
checkValid = true;
}
});
if (!checkValid) {
this.$warning({
title: '선택하신 드론은 현재 가동 중이지 않은 드론입니다.',
});
}
},
},
};
</script>
<style lang="scss">
</style>