15 min, search multiple
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
<template>
|
||||
<form>
|
||||
<div class="row form-group">
|
||||
<label for="ssel1" class="col-sm-2">Typ</label>
|
||||
<div class="col-sm-4">
|
||||
<select v-model="type" class="form-control" id="ssel1">
|
||||
<select v-model="type" name="type" class="form-control" id="ssel1">
|
||||
<option value="0">Užívateľ</option>
|
||||
<option value="1">Meno PC</option>
|
||||
<option value="2">Ip adresa</option>
|
||||
@@ -18,11 +19,13 @@
|
||||
@selected="itemSelected">
|
||||
</vue-suggestion>
|
||||
<span class="input-group-append">
|
||||
<button v-on:click="displayResults()" type="button" class="btn btn-secondary">Zobraz</button>
|
||||
<button v-on:click="submit()" type="button" class="btn btn-secondary">Zobraz</button>
|
||||
</span>
|
||||
</div>
|
||||
<input type="hidden" name="_token" :value="csrf">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -32,10 +35,14 @@ export default {
|
||||
return {
|
||||
item: {},
|
||||
type: null,
|
||||
errors: {},
|
||||
success: false,
|
||||
loaded: true,
|
||||
items: [
|
||||
|
||||
],
|
||||
itemTemplate,
|
||||
csrf: document.querySelector('meta[name="csrf-token"]').getAttribute('content'),
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -59,6 +66,30 @@ export default {
|
||||
console.log(error);
|
||||
});
|
||||
},
|
||||
submit() {
|
||||
axios.get('search/multiple', {
|
||||
params: {
|
||||
type: this.type,
|
||||
search: this.item.name
|
||||
}
|
||||
})
|
||||
.then((response) => {
|
||||
|
||||
let data = [];
|
||||
data.push(['IP Adresa','Meno PC','Uzivatel','Od','Do']);
|
||||
for (var index = 0; index < response.data.length; ++index) {
|
||||
let row = response.data[index];
|
||||
data.push([row.ip, row.comp, row.name, moment(row.f).format('DD.MM.YYYY HH:mm'), moment(row.t).format('D.MM.YYYY HH:mm')]);
|
||||
}
|
||||
console.log(data);
|
||||
this.$parent.$refs.table.params.data = data;
|
||||
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user