Merge branch 'dev/bagus' of https://gitea.callysta-engineering.com/APKT/eis into IntegrationTableWithFilter
This commit is contained in:
commit
a3564afce7
@ -53,6 +53,7 @@ const setPosko = (value: any) => {
|
||||
onMounted(() => {
|
||||
fetchUid();
|
||||
emit('update:filters', data.value)
|
||||
fetchUid()
|
||||
})
|
||||
</script>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
<!-- <script setup lang="ts">
|
||||
import Select from '@/components/Select.vue'
|
||||
import { selectedUid, selectedUp3Ulp, fetchData, items, itemsUp3, itemsUlp,itemsRegional ,months, years} from './reference';
|
||||
import { ref } from 'vue';
|
||||
@ -68,4 +68,6 @@ const setUlp = (value: any) => {
|
||||
<Select :data="years" placeholder="Pilih Tahun" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</template> -->
|
||||
|
||||
<template></template>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
<!-- <script setup lang="ts">
|
||||
import Select from '@/components/Select.vue'
|
||||
import DatePicker from '@/components/DatePicker.vue'
|
||||
import { selectedUid, selectedUp3Ulp,selectedUlp, fetchData, items, itemsUp3, itemsUlp } from './reference';
|
||||
@ -53,4 +53,5 @@ const setUlp = (value: any) => {
|
||||
|
||||
<DatePicker />
|
||||
</div>
|
||||
</template>
|
||||
</template> -->
|
||||
<template></template>
|
||||
|
@ -1,46 +1,46 @@
|
||||
|
||||
import { getUid, getUp3, getPosko, getUlp } from '@/utils/network';
|
||||
import { getUid, getUp3, getPosko, getUlp } from '@/utils/network'
|
||||
import { ref } from 'vue'
|
||||
import { usePostsStore } from '@/stores/posts';
|
||||
import { useUp3Store } from '@/stores/up3';
|
||||
import { useRegionStore } from '@/stores/region';
|
||||
import { useUlpStore } from '@/stores/ulp';
|
||||
import { usePostsStore } from '@/stores/posts'
|
||||
import { useUp3Store } from '@/stores/up3'
|
||||
import { useRegionStore } from '@/stores/region'
|
||||
import { useUlpStore } from '@/stores/ulp'
|
||||
|
||||
interface Item {
|
||||
id: any;
|
||||
id: number;
|
||||
name: any;
|
||||
}
|
||||
const months = [
|
||||
{ id: 1, name: 'Januari' },
|
||||
{ id: 2, name: 'Februari' },
|
||||
{ id: 3, name: 'Maret' },
|
||||
{ id: 4, name: 'April' },
|
||||
{ id: 5, name: 'Mei' },
|
||||
{ id: 6, name: 'Juni' },
|
||||
{ id: 7, name: 'Juli' },
|
||||
{ id: 8, name: 'Agustus' },
|
||||
{ id: 9, name: 'September' },
|
||||
{ id: 10, name: 'Oktober' },
|
||||
{ id: 11, name: 'November' },
|
||||
{ id: 12, name: 'Desember' },
|
||||
const months =[
|
||||
{id:1, name: 'Januari'},
|
||||
{id:2, name: 'Februari'},
|
||||
{id:3, name: 'Maret'},
|
||||
{id:4, name: 'April'},
|
||||
{id:5, name: 'Mei'},
|
||||
{id:6, name: 'Juni'},
|
||||
{id:7, name: 'Juli'},
|
||||
{id:8, name: 'Agustus'},
|
||||
{id:9, name: 'September'},
|
||||
{id:10, name: 'Oktober'},
|
||||
{id:11, name: 'November'},
|
||||
{id:12, name: 'Desember'},
|
||||
]
|
||||
// create 4 year back array
|
||||
const year = new Date().getFullYear();
|
||||
const years = ref<Item[]>([]);
|
||||
const years =ref<Item[]>([]);
|
||||
for (let i = 0; i < 5; i++) {
|
||||
years.value.push({ id: year - i, name: year - i })
|
||||
years.value.push({id:year-i, name: year-i})
|
||||
}
|
||||
const itemsUid = ref<Item[]>([]);
|
||||
const timeout = ref()
|
||||
const items = ref<Item[]>([]);
|
||||
const itemsUp3 = ref<Item[]>([]);
|
||||
const itemsPosko = ref<Item[]>([]);
|
||||
const itemsUlp = ref<Item[]>([]);
|
||||
const itemsRegional = ref<Item[]>([]);
|
||||
const itemsMedia = ref<Item[]>([]);
|
||||
// Fetch data from the API using Axios
|
||||
const fetchUid = async () => {
|
||||
const fetchData = async () => {
|
||||
try {
|
||||
const res = await getUid()
|
||||
itemsUid.value = res.data.map((item: any) => (
|
||||
items.value = res.data.map((item: any) => (
|
||||
{
|
||||
id: item.id,
|
||||
name: item.nama,
|
||||
@ -52,100 +52,64 @@ const fetchUid = async () => {
|
||||
};
|
||||
|
||||
const fetchDataUp3 = async (uid: number) => {
|
||||
|
||||
try {
|
||||
const res = await getUp3(uid)
|
||||
itemsUp3.value = res.data.map((item: any) => (
|
||||
{
|
||||
itemsUp3.value = res.data.map((item: any) => ({
|
||||
id: item.id,
|
||||
name: item.nama,
|
||||
}
|
||||
));
|
||||
|
||||
name: item.nama
|
||||
}))
|
||||
} catch (error) {
|
||||
console.error('Error fetching data:', error);
|
||||
console.error('Error fetching data:', error)
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
const fetchDataUlp = async (up3: number) => {
|
||||
try {
|
||||
const res = await getUlp(up3)
|
||||
itemsUlp.value = res.data.map((item: any) => (
|
||||
{
|
||||
id: item.name,
|
||||
name: item.name,
|
||||
id: item.id,
|
||||
name: item.nama,
|
||||
}
|
||||
));
|
||||
} catch (error) {
|
||||
console.error('Error fetching data:', error);
|
||||
console.error('Error fetching data:', error)
|
||||
}
|
||||
}
|
||||
const fetchDataPosko = async (up3: number) => {
|
||||
clearTimeout(timeout.value)
|
||||
timeout.value = setTimeout(async () => {
|
||||
try {
|
||||
const res = await getPosko(up3)
|
||||
itemsPosko.value = res.data.map((item: any) => (
|
||||
{
|
||||
id: item.nama,
|
||||
id: item.id,
|
||||
name: item.nama,
|
||||
}
|
||||
));
|
||||
} catch (error) {
|
||||
console.error('Error fetching data:', error);
|
||||
}
|
||||
},300);
|
||||
};
|
||||
const fetchMedia = () => {
|
||||
itemsMedia.value = [
|
||||
{ id: "Ulasan Aplikasi PLN Mobile", name: "Ulasan Aplikasi PLN Mobile"},
|
||||
{ id: "Twitter", name: "Twitter" },
|
||||
{ id: "PLN Mobile", name: "PLN Mobile" },
|
||||
{ id: "Media Massa", name: "Media Massa" },
|
||||
{ id: "Live Chat Website", name: "Live Chat Website" },
|
||||
{ id: "Live Chat PLN Mobile", name: "Live Chat PLN Mobile" },
|
||||
{ id: "Instagram", name: "Instagram" },
|
||||
{ id: "Facebook", name: "Facebook" },
|
||||
{ id: "Email", name: "Email" },
|
||||
{ id: "EMS", name: "EMS" },
|
||||
{ id: "Datang ke Kantor", name: "Datang ke Kantor" },
|
||||
{ id: "Call ke Kantor Unit", name: "Call ke Kantor Unit" },
|
||||
{ id: "Call PLN 123", name: "Call PLN 123" },
|
||||
]
|
||||
|
||||
}
|
||||
const fetchStatus = (data : any) => {
|
||||
|
||||
const status = [
|
||||
{"id": "8", "name": "Selesai"},
|
||||
{"id": "7", "name": "Nyala"},
|
||||
{"id": "6", "name": "Pengalihan"},
|
||||
{"id": "5", "name": "Dialihkan"},
|
||||
{"id": "4", "name": "Dalam Pengerjaan"},
|
||||
{"id": "3", "name": "Dalam Perjalanan"},
|
||||
{"id": "2", "name": "Penugasan Regu"},
|
||||
{"id": "1", "name": "lapor"}
|
||||
]
|
||||
const filteredStatus = status.find(item => item.id == data);
|
||||
const name = filteredStatus ? filteredStatus.name : null;
|
||||
return name;
|
||||
}
|
||||
const selectedUid = (value: any) => {
|
||||
useRegionStore().setData(value.id);
|
||||
fetchDataUp3(value.id);
|
||||
useRegionStore().setData(value.id)
|
||||
fetchDataUp3(value.id)
|
||||
}
|
||||
const selectedUp3Posko = (value: any) => {
|
||||
useUp3Store().setData(value.id);
|
||||
fetchDataPosko(value.id);
|
||||
if (value.id != 0) {
|
||||
useUp3Store().setData(value.id)
|
||||
fetchDataPosko(value.id)
|
||||
}
|
||||
}
|
||||
const selectedUp3Ulp = (value: any) => {
|
||||
useUp3Store().setData(value.id);
|
||||
fetchDataUlp(value.id);
|
||||
useUp3Store().setData(value.id)
|
||||
fetchDataUlp(value.id)
|
||||
}
|
||||
const selectedPosko = (value: any) => {
|
||||
usePostsStore().setData(value.id);
|
||||
usePostsStore().setData(value.id)
|
||||
}
|
||||
const selectedUlp = (value: any) => {
|
||||
useUlpStore().setData(value.id);
|
||||
useUlpStore().setData(value.id)
|
||||
}
|
||||
|
||||
|
||||
|
||||
export { selectedUid, selectedUp3Posko, selectedUp3Ulp, selectedPosko, selectedUlp, fetchUid,fetchMedia,fetchStatus, itemsUid, itemsUp3, itemsPosko, itemsRegional, itemsMedia, itemsUlp, months, years };
|
||||
export { selectedUid, selectedUp3Posko ,selectedUp3Ulp, selectedPosko,selectedUlp, fetchData, items, itemsUp3, itemsPosko,itemsRegional,itemsMedia,itemsUlp ,months ,years};
|
||||
|
@ -37,8 +37,6 @@ computed(() => {
|
||||
if (props.selected.id === 0) {
|
||||
selected.value = { id: 0, name: props.placeholder }
|
||||
}
|
||||
|
||||
// console.log('selected', selected.value.name)
|
||||
})
|
||||
|
||||
watch(
|
||||
@ -63,10 +61,6 @@ let filteredData = computed(() =>
|
||||
)
|
||||
)
|
||||
|
||||
watch(selected, (value) => {
|
||||
emit('update:selected', value)
|
||||
})
|
||||
|
||||
const show = ref(false)
|
||||
</script>
|
||||
|
||||
|
@ -1,16 +1,13 @@
|
||||
import axios from "axios";
|
||||
import axios from 'axios'
|
||||
|
||||
const instance = axios.create({
|
||||
baseURL: 'http://localhost:8443'
|
||||
});
|
||||
baseURL: 'http://10.8.0.13:8443'
|
||||
})
|
||||
|
||||
|
||||
const getUid = async () => await instance.get('/uid');
|
||||
const getMedia = async() => await instance.get('/media');
|
||||
const getJenisTransaksi = async() => await instance.get('/jenisTransaksi');
|
||||
const getUp3 = async (
|
||||
uid: number,
|
||||
) => await instance.get('/up3?uid=' + uid);
|
||||
const getUlp = async (up3: number) => await instance.get('/ulp?up3=' + up3);
|
||||
const getPosko = async (uppp: number) => await instance.get('/posko?up3=' + uppp);
|
||||
export { getUid, getUp3, getPosko,getUlp,getMedia,getJenisTransaksi };
|
||||
const getUid = async () => await instance.get('/uid')
|
||||
const getMedia = async () => await instance.get('/media')
|
||||
const getJenisTransaksi = async () => await instance.get('/jenisTransaksi')
|
||||
const getUp3 = async (uid: number) => await instance.get('/up3?uid=' + uid)
|
||||
const getUlp = async (up3: number) => await instance.get('/ulp?up3=' + up3)
|
||||
const getPosko = async (uppp: number) => await instance.get('/posko?up3=' + uppp)
|
||||
export { getUid, getUp3, getPosko, getUlp, getMedia, getJenisTransaksi }
|
||||
|
Loading…
x
Reference in New Issue
Block a user