Refactor form filters in multiple components

This commit is contained in:
Eko Haryadi
2024-02-23 17:41:55 +07:00
parent f7d8cc102a
commit 21abb95623
10 changed files with 51 additions and 32 deletions

View File

@@ -19,7 +19,7 @@ import InputWithSuffix from '@/components/Form/InputWithSuffix.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 up3 = ref({ id: 0, name: up3Placeholder });
const uid = ref({ id: 0, name: uidPlaceholder });
const ulp = ref({ id: "", name: ulpPlaceholder });
const emit = defineEmits(['update:filters'])
@@ -36,7 +36,7 @@ const sla = [
];
const data = ref({
uid: uid.value,
up3: uppp.value,
up3: up3.value,
posko: ulp.value,
periode: '',
minTime: 1,
@@ -45,12 +45,12 @@ const data = ref({
const setUid = (value: any) => {
uid.value = value;
selectedUid(value);
uppp.value = { id: 0, name: up3Placeholder };
up3.value = { id: 0, name: up3Placeholder };
data.value.uid = value;
};
const setUp3 = (value: any) => {
uppp.value = value;
up3.value = value;
selectedUp3Ulp(value);
ulp.value = { id: "", name: ulpPlaceholder };
data.value.up3 = value;
@@ -106,7 +106,7 @@ onMounted(() => {
<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 Pelaksanaan Pelayanan Pelanggan:</label>
<Select @update:selected="setUp3($event)" :data="itemsUp3" :placeholder="up3Placeholder" />
<Select @update:selected="setUp3($event)" :data="itemsUp3" :selected="up3" :placeholder="up3Placeholder" />
</div>
<div class="sm:grid sm:grid-cols-2 lg:grid-cols-3 sm:items-center">