From 21abb95623bcb7d8cfc876e5214dfd0deb7b0525 Mon Sep 17 00:00:00 2001 From: Eko Haryadi Date: Fri, 23 Feb 2024 17:41:55 +0700 Subject: [PATCH] Refactor form filters in multiple components --- src/components/Form/FiltersType/Type1.vue | 11 +++----- src/components/Form/FiltersType/Type10.vue | 10 ++++--- src/components/Form/FiltersType/Type11.vue | 10 +++---- src/components/Form/FiltersType/Type13.vue | 2 +- src/components/Form/FiltersType/Type18.vue | 32 ++++++++++++++++++---- src/components/Form/FiltersType/Type3.vue | 4 +-- src/components/Form/FiltersType/Type6.vue | 4 +-- src/components/Form/FiltersType/Type7.vue | 4 +-- src/components/Pages/Gangguan/Table_5.vue | 4 +-- src/components/Pages/Keluhan/Table_21.vue | 2 +- 10 files changed, 51 insertions(+), 32 deletions(-) diff --git a/src/components/Form/FiltersType/Type1.vue b/src/components/Form/FiltersType/Type1.vue index 6c8def1..f17686d 100755 --- a/src/components/Form/FiltersType/Type1.vue +++ b/src/components/Form/FiltersType/Type1.vue @@ -76,12 +76,9 @@ onMounted(() => {
- +
diff --git a/src/components/Form/FiltersType/Type10.vue b/src/components/Form/FiltersType/Type10.vue index e9ae3b0..11c0178 100755 --- a/src/components/Form/FiltersType/Type10.vue +++ b/src/components/Form/FiltersType/Type10.vue @@ -18,13 +18,13 @@ import InputNumber from '@/components/Form/InputNumber.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']) const data = ref({ uid: uid.value, - up3: uppp.value, + up3: up3.value, posko: ulp.value, periode: '', minJmlLapor: 1, @@ -33,12 +33,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; @@ -78,6 +78,7 @@ onMounted(() => { diff --git a/src/components/Form/FiltersType/Type11.vue b/src/components/Form/FiltersType/Type11.vue index 3ae83d4..b855f82 100755 --- a/src/components/Form/FiltersType/Type11.vue +++ b/src/components/Form/FiltersType/Type11.vue @@ -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(() => {
-
diff --git a/src/components/Form/FiltersType/Type13.vue b/src/components/Form/FiltersType/Type13.vue index 78ccdcb..bcfe0c9 100755 --- a/src/components/Form/FiltersType/Type13.vue +++ b/src/components/Form/FiltersType/Type13.vue @@ -53,7 +53,7 @@ onMounted(() => {
-
diff --git a/src/components/Form/FiltersType/Type18.vue b/src/components/Form/FiltersType/Type18.vue index 1a418fa..0492d9f 100755 --- a/src/components/Form/FiltersType/Type18.vue +++ b/src/components/Form/FiltersType/Type18.vue @@ -4,15 +4,33 @@ import SelectMulti from '@/components/SelectMulti.vue' import DatePicker from '@/components/DatePicker.vue' import { selectedUid, selectedUp3Posko, selectedPosko ,fetchUid, itemsUid,itemsUp3, itemsPosko} from './reference'; -fetchUid(); +import { onMounted, ref } from 'vue'; +const uidPlaceholder = 'Semua Unit Induk Distribusi/Wilayah'; +const up3Placeholder = 'Semua Unit Pelaksanaan Pelayanan Pelanggan'; +const poskoPlaceholder = 'Semua Posko'; +const up3 = ref({ id: 0, name: up3Placeholder }); +const uid = ref({ id: 0, name: uidPlaceholder }); +const posko = ref({ id: "", name: poskoPlaceholder }); +const emit = defineEmits(['update:filters']) const jenisTransakasi = [ { id: 1, value: 'Koreksi Transaksi Individual',label: 'Koreksi Transaksi Individual' }, { id: 2, value: 'Cleansing Traksaksi TM',label: 'Cleansing Traksaksi TM', }, { id: 3, value: 'Koreksi Transaksi TM',label: 'Koreksi Transaksi TM', }, { id: 4, value: 'Koreksi Kode Gangguan dan Anev',label: 'Koreksi Kode Gangguan dan Anev' }, ] - + const data = ref({ + uid: uid.value, + up3: up3.value, + posko: posko.value, + periode: '', + jenisTransaksi: [], + group: 1 +}) +onMounted(() => { + emit('update:filters', data.value) + fetchUid() +}) diff --git a/src/components/Form/FiltersType/Type3.vue b/src/components/Form/FiltersType/Type3.vue index aba3642..4daaf7d 100755 --- a/src/components/Form/FiltersType/Type3.vue +++ b/src/components/Form/FiltersType/Type3.vue @@ -56,13 +56,13 @@ onMounted(() => {
-
-
diff --git a/src/components/Form/FiltersType/Type6.vue b/src/components/Form/FiltersType/Type6.vue index 45a3b76..e058acd 100755 --- a/src/components/Form/FiltersType/Type6.vue +++ b/src/components/Form/FiltersType/Type6.vue @@ -56,13 +56,13 @@ onMounted(() => {
-
-
diff --git a/src/components/Form/FiltersType/Type7.vue b/src/components/Form/FiltersType/Type7.vue index afb7573..66a8bd1 100755 --- a/src/components/Form/FiltersType/Type7.vue +++ b/src/components/Form/FiltersType/Type7.vue @@ -100,13 +100,13 @@ onMounted(() => {
-
-
diff --git a/src/components/Pages/Gangguan/Table_5.vue b/src/components/Pages/Gangguan/Table_5.vue index 49ff140..4256230 100755 --- a/src/components/Pages/Gangguan/Table_5.vue +++ b/src/components/Pages/Gangguan/Table_5.vue @@ -54,7 +54,7 @@