Refactor form component in FiltersType/Type13.vue
This commit is contained in:
parent
42ea91bd33
commit
87135ec5a6
@ -2,50 +2,41 @@
|
|||||||
import Select from '@/components/Select.vue'
|
import Select from '@/components/Select.vue'
|
||||||
import DatePicker from '@/components/DatePicker.vue'
|
import DatePicker from '@/components/DatePicker.vue'
|
||||||
import InlineRadioGroup from '@/components/Form/InlineRadioGroup.vue'
|
import InlineRadioGroup from '@/components/Form/InlineRadioGroup.vue'
|
||||||
import {
|
import { selectedUid, selectedUp3Ulp, selectedUlp, fetchUid, itemsUid, itemsUp3, itemsUlp } from './reference';
|
||||||
selectedUid,
|
import { onMounted, ref } from 'vue';
|
||||||
selectedUp3Ulp,
|
const uidPlaceholder = 'Semua Unit Induk Distribusi/Wilayah';
|
||||||
selectedUlp,
|
const up3Placeholder = 'Semua Unit Pelaksanaan Pelayanan Pelanggan';
|
||||||
fetchUid,
|
const ulpPlaceholder = 'Semua Unit Layanan Pelanggan';
|
||||||
itemsUid,
|
const up3 = ref({ id: 0, name: up3Placeholder });
|
||||||
itemsUp3,
|
const uid = ref({ id: 0, name: uidPlaceholder });
|
||||||
itemsUlp
|
const ulp = ref({ id: 0, name: ulpPlaceholder });
|
||||||
} from './reference'
|
|
||||||
import { onMounted, ref } from 'vue'
|
|
||||||
const uidPlaceholder = 'Semua Unit Induk Distribusi/Wilayah'
|
|
||||||
const up3Placeholder = 'Semua Unit Pelaksanaan Pelayanan Pelanggan'
|
|
||||||
const ulpPlaceholder = 'Semua Unit Layanan Pelanggan'
|
|
||||||
const uppp = ref({ id: 0, name: up3Placeholder })
|
|
||||||
const uid = ref({ id: 0, name: uidPlaceholder })
|
|
||||||
const up3 = ref({ id: 0, name: up3Placeholder })
|
|
||||||
const ulp = ref({ id: '', name: ulpPlaceholder })
|
|
||||||
const emit = defineEmits(['update:filters'])
|
const emit = defineEmits(['update:filters'])
|
||||||
const data = ref({
|
const data = ref({
|
||||||
uid: uid.value,
|
uid: uid.value,
|
||||||
up3: uppp.value,
|
up3: up3.value,
|
||||||
posko: ulp.value,
|
posko: ulp.value,
|
||||||
periode: '',
|
periode: '',
|
||||||
group: 1
|
group: 1
|
||||||
})
|
})
|
||||||
const setUid = (value: any) => {
|
const setUid = (value: any) => {
|
||||||
uid.value = value
|
uid.value = value;
|
||||||
selectedUid(value)
|
selectedUid(value);
|
||||||
uppp.value = { id: 0, name: up3Placeholder }
|
up3.value = { id: 0, name: up3Placeholder };
|
||||||
data.value.uid = value
|
data.value.uid = value;
|
||||||
}
|
};
|
||||||
|
|
||||||
const setUp3 = (value: any) => {
|
const setUp3 = (value: any) => {
|
||||||
uppp.value = value
|
up3.value = value;
|
||||||
selectedUp3Ulp(value)
|
selectedUp3Ulp(value);
|
||||||
ulp.value = { id: '', name: ulpPlaceholder }
|
ulp.value = { id: 0, name: ulpPlaceholder };
|
||||||
data.value.up3 = value
|
data.value.up3 = value;
|
||||||
}
|
};
|
||||||
|
|
||||||
const setUlp = (value: any) => {
|
const setUlp = (value: any) => {
|
||||||
ulp.value = value
|
ulp.value = value;
|
||||||
selectedUlp(value)
|
selectedUlp(value);
|
||||||
data.value.posko = value
|
data.value.posko = value;
|
||||||
}
|
};
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
emit('update:filters', data.value)
|
emit('update:filters', data.value)
|
||||||
fetchUid()
|
fetchUid()
|
||||||
@ -54,65 +45,38 @@ onMounted(() => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="sm:grid sm:grid-cols-2 lg:grid-cols-3 sm:items-center">
|
<div class="sm:grid sm:grid-cols-2 lg:grid-cols-3 sm:items-center">
|
||||||
<label class="text-gray-800 font-semibold mb-2 sm:mb-0 block"
|
<label class="text-gray-800 font-semibold mb-2 sm:mb-0 block">Unit Induk Distribusi/Wilayah:</label>
|
||||||
>Unit Induk Distribusi/Wilayah:</label
|
|
||||||
>
|
|
||||||
|
|
||||||
<Select @update:selected="setUid($event)" :data="itemsUid" :placeholder="uidPlaceholder" />
|
<Select @update:selected="setUid($event)" :data="itemsUid" :placeholder="uidPlaceholder" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="sm:grid sm:grid-cols-2 lg:grid-cols-3 sm:items-center">
|
<div class="sm:grid sm:grid-cols-2 lg:grid-cols-3 sm:items-center">
|
||||||
<label class="text-gray-800 font-semibold mb-2 sm:mb-0 block"
|
<label class="text-gray-800 font-semibold mb-2 sm:mb-0 block">Unit Pelaksanaan Pelayanan Pelanggan:</label>
|
||||||
>Unit Pelaksanaan Pelayanan Pelanggan:</label
|
|
||||||
>
|
|
||||||
|
|
||||||
<Select
|
<Select @update:selected="setUp3($event)" :data="itemsUp3" :selected="up3" :placeholder="up3Placeholder" />
|
||||||
@update:selected="setUp3($event)"
|
|
||||||
:data="itemsUp3"
|
|
||||||
:selected="up3"
|
|
||||||
:placeholder="up3Placeholder"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="sm:grid sm:grid-cols-2 lg:grid-cols-3 sm:items-center">
|
<div class="sm:grid sm:grid-cols-2 lg:grid-cols-3 sm:items-center">
|
||||||
<label class="text-gray-800 font-semibold mb-2 sm:mb-0 block">Unit Layanan Pelanggan:</label>
|
<label class="text-gray-800 font-semibold mb-2 sm:mb-0 block">Unit Layanan Pelanggan:</label>
|
||||||
|
|
||||||
<Select
|
<Select @update:selected="setUlp($event)" :data="itemsUlp" :placeholder="ulpPlaceholder" />
|
||||||
@update:selected="setUlp($event)"
|
|
||||||
:selected="ulp"
|
|
||||||
:data="itemsUlp"
|
|
||||||
:placeholder="ulpPlaceholder"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="sm:grid sm:grid-cols-2 lg:grid-cols-3 sm:items-center">
|
<div class="sm:grid sm:grid-cols-2 lg:grid-cols-3 sm:items-center">
|
||||||
<label class="text-gray-800 font-semibold mb-2 sm:mb-0 block">Periode Tanggal:</label>
|
<label class="text-gray-800 font-semibold mb-2 sm:mb-0 block">Periode Tanggal:</label>
|
||||||
|
|
||||||
<DatePicker
|
<DatePicker @update:date-value="(value) => {
|
||||||
@update:date-value="
|
|
||||||
(value) => {
|
|
||||||
data.periode = value
|
data.periode = value
|
||||||
}
|
}
|
||||||
"
|
" />
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="sm:grid sm:grid-cols-2 lg:grid-cols-3 sm:items-center">
|
<div class="sm:grid sm:grid-cols-2 lg:grid-cols-3 sm:items-center">
|
||||||
<label class="text-gray-800 font-semibold mb-2 sm:mb-0 block"
|
<label class="text-gray-800 font-semibold mb-2 sm:mb-0 block">Group By Kode Unit Distribusi:</label>
|
||||||
>Group By Kode Unit Distribusi:</label
|
|
||||||
>
|
|
||||||
|
|
||||||
<InlineRadioGroup
|
<InlineRadioGroup @update:group-value="(value) => {
|
||||||
@update:group-value="
|
|
||||||
(value) => {
|
|
||||||
data.group = value
|
data.group = value
|
||||||
console.log('data.group', value)
|
console.log('data.group', value)
|
||||||
}
|
}" :radio-items="[{ id: 1, title: 'Tidak' }, { id: 2, title: 'Ya, Grupkan' }]" />
|
||||||
"
|
|
||||||
:radio-items="[
|
|
||||||
{ id: 1, title: 'Tidak' },
|
|
||||||
{ id: 2, title: 'Ya, Grupkan' }
|
|
||||||
]"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user