49 lines
1.4 KiB
Vue
49 lines
1.4 KiB
Vue
<template>
|
|
<div v-if="isLoadingGetListLelong" class="row justify-content-center">
|
|
<div class="spinner-border text-primary" role="status">
|
|
<span class="sr-only">Loading...</span>
|
|
</div>
|
|
</div>
|
|
<div v-else>
|
|
<label>Pilih Batch Lelong</label>
|
|
<select class="custom-select" @change="pilihBatchLelong($event)">
|
|
<option selected>Batch Lelong</option>
|
|
<option v-for="val in listLelong" :key="val" v-bind:value="val.id">{{ val.id }}</option>
|
|
</select>
|
|
<div class="mt-3">
|
|
<SelectCawangan v-if="pilihLelong != 'Batch Lelong'" v-bind:key="componentKey" v-bind:selectedLelong="pilihLelong" />
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { ref, onMounted } from "vue";
|
|
import SelectCawangan from "./SelectCawangan.vue"
|
|
import axios from "axios";
|
|
|
|
const listLelong = ref();
|
|
const pilihLelong = ref('Batch Lelong');
|
|
const componentKey = ref(0);
|
|
const isLoadingGetListLelong = ref(false);
|
|
|
|
function getListLelong() {
|
|
isLoadingGetListLelong.value = true;
|
|
axios.get("/listLelong", {}).then((response) => {
|
|
listLelong.value = response.data;
|
|
}).catch((error) => {
|
|
alert(error);
|
|
});
|
|
isLoadingGetListLelong.value = false;
|
|
};
|
|
|
|
function pilihBatchLelong(e) {
|
|
let val = e.target.value;
|
|
pilihLelong.value = val;
|
|
componentKey.value += 1;
|
|
};
|
|
|
|
onMounted(() => {
|
|
getListLelong();
|
|
})
|
|
</script>
|