58 lines
1.3 KiB
Vue
58 lines
1.3 KiB
Vue
<template>
|
|
<div>
|
|
<div class="form-group">
|
|
<label for="ssel1">Typ:</label>
|
|
<select v-model="type" class="form-control" id="ssel1">
|
|
<option>Užívateľ</option>
|
|
<option>Meno PC</option>
|
|
<option>Ip adresa</option>
|
|
</select>
|
|
</div>
|
|
<vue-suggestion :items="items"
|
|
v-model="item"
|
|
:setLabel="setLabel"
|
|
:itemTemplate="itemTemplate"
|
|
@changed="inputChange"
|
|
@selected="itemSelected">
|
|
</vue-suggestion>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import itemTemplate from './item-template.vue';
|
|
export default {
|
|
data () {
|
|
return {
|
|
item: {},
|
|
type: null,
|
|
items: [
|
|
|
|
],
|
|
itemTemplate,
|
|
}
|
|
},
|
|
methods: {
|
|
itemSelected (item) {
|
|
this.item = item;
|
|
},
|
|
setLabel (item) {
|
|
return item.computer;
|
|
},
|
|
inputChange (text) {
|
|
axios.get("search/multicomplete", {
|
|
params: {
|
|
type: this.type,
|
|
term: text,
|
|
}
|
|
})
|
|
.then((response) => {
|
|
this.items = response.data;
|
|
})
|
|
.catch(function (error) {
|
|
console.log(error);
|
|
});
|
|
},
|
|
},
|
|
};
|
|
</script>
|