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(() => {
|
onMounted(() => {
|
||||||
fetchUid();
|
fetchUid();
|
||||||
emit('update:filters', data.value)
|
emit('update:filters', data.value)
|
||||||
|
fetchUid()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<script setup lang="ts">
|
<!-- <script setup lang="ts">
|
||||||
import Select from '@/components/Select.vue'
|
import Select from '@/components/Select.vue'
|
||||||
import { selectedUid, selectedUp3Ulp, fetchData, items, itemsUp3, itemsUlp,itemsRegional ,months, years} from './reference';
|
import { selectedUid, selectedUp3Ulp, fetchData, items, itemsUp3, itemsUlp,itemsRegional ,months, years} from './reference';
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
@ -68,4 +68,6 @@ const setUlp = (value: any) => {
|
|||||||
<Select :data="years" placeholder="Pilih Tahun" />
|
<Select :data="years" placeholder="Pilih Tahun" />
|
||||||
</div>
|
</div>
|
||||||
</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 Select from '@/components/Select.vue'
|
||||||
import DatePicker from '@/components/DatePicker.vue'
|
import DatePicker from '@/components/DatePicker.vue'
|
||||||
import { selectedUid, selectedUp3Ulp,selectedUlp, fetchData, items, itemsUp3, itemsUlp } from './reference';
|
import { selectedUid, selectedUp3Ulp,selectedUlp, fetchData, items, itemsUp3, itemsUlp } from './reference';
|
||||||
@ -53,4 +53,5 @@ const setUlp = (value: any) => {
|
|||||||
|
|
||||||
<DatePicker />
|
<DatePicker />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template> -->
|
||||||
|
<template></template>
|
||||||
|
@ -1,91 +1,48 @@
|
|||||||
|
import { getUid, getUp3, getPosko, getUlp } from '@/utils/network'
|
||||||
import { getUid, getUp3, getPosko, getUlp } from '@/utils/network';
|
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { usePostsStore } from '@/stores/posts';
|
import { usePostsStore } from '@/stores/posts'
|
||||||
import { useUp3Store } from '@/stores/up3';
|
import { useUp3Store } from '@/stores/up3'
|
||||||
import { useRegionStore } from '@/stores/region';
|
import { useRegionStore } from '@/stores/region'
|
||||||
import { useUlpStore } from '@/stores/ulp';
|
import { useUlpStore } from '@/stores/ulp'
|
||||||
|
|
||||||
interface Item {
|
interface Item {
|
||||||
id: any;
|
id: number;
|
||||||
name: any;
|
name: any;
|
||||||
}
|
}
|
||||||
const months = [
|
const months =[
|
||||||
{ id: 1, name: 'Januari' },
|
{id:1, name: 'Januari'},
|
||||||
{ id: 2, name: 'Februari' },
|
{id:2, name: 'Februari'},
|
||||||
{ id: 3, name: 'Maret' },
|
{id:3, name: 'Maret'},
|
||||||
{ id: 4, name: 'April' },
|
{id:4, name: 'April'},
|
||||||
{ id: 5, name: 'Mei' },
|
{id:5, name: 'Mei'},
|
||||||
{ id: 6, name: 'Juni' },
|
{id:6, name: 'Juni'},
|
||||||
{ id: 7, name: 'Juli' },
|
{id:7, name: 'Juli'},
|
||||||
{ id: 8, name: 'Agustus' },
|
{id:8, name: 'Agustus'},
|
||||||
{ id: 9, name: 'September' },
|
{id:9, name: 'September'},
|
||||||
{ id: 10, name: 'Oktober' },
|
{id:10, name: 'Oktober'},
|
||||||
{ id: 11, name: 'November' },
|
{id:11, name: 'November'},
|
||||||
{ id: 12, name: 'Desember' },
|
{id:12, name: 'Desember'},
|
||||||
]
|
]
|
||||||
// create 4 year back array
|
// create 4 year back array
|
||||||
const year = new Date().getFullYear();
|
const year = new Date().getFullYear();
|
||||||
const years = ref<Item[]>([]);
|
const years =ref<Item[]>([]);
|
||||||
for (let i = 0; i < 5; i++) {
|
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 itemsUp3 = ref<Item[]>([]);
|
||||||
const itemsPosko = ref<Item[]>([]);
|
const itemsPosko = ref<Item[]>([]);
|
||||||
const itemsUlp = ref<Item[]>([]);
|
const itemsUlp = ref<Item[]>([]);
|
||||||
const itemsRegional = ref<Item[]>([]);
|
const itemsRegional = ref<Item[]>([]);
|
||||||
const itemsMedia = ref<Item[]>([]);
|
const itemsMedia = ref<Item[]>([]);
|
||||||
// Fetch data from the API using Axios
|
// 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) => (
|
|
||||||
{
|
|
||||||
id: item.id,
|
|
||||||
name: item.nama,
|
|
||||||
}
|
|
||||||
));
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error fetching data:', error);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const fetchDataUp3 = async (uid: number) => {
|
|
||||||
|
|
||||||
try {
|
|
||||||
const res = await getUp3(uid)
|
|
||||||
itemsUp3.value = res.data.map((item: any) => (
|
|
||||||
{
|
|
||||||
id: item.id,
|
|
||||||
name: item.nama,
|
|
||||||
}
|
|
||||||
));
|
|
||||||
|
|
||||||
} catch (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,
|
|
||||||
}
|
|
||||||
));
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error fetching data:', error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const fetchDataPosko = async (up3: number) => {
|
|
||||||
try {
|
try {
|
||||||
const res = await getPosko(up3)
|
const res = await getUid()
|
||||||
itemsPosko.value = res.data.map((item: any) => (
|
items.value = res.data.map((item: any) => (
|
||||||
{
|
{
|
||||||
id: item.nama,
|
id: item.id,
|
||||||
name: item.nama,
|
name: item.nama,
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
@ -93,59 +50,66 @@ const fetchDataPosko = async (up3: number) => {
|
|||||||
console.error('Error fetching data:', error);
|
console.error('Error fetching data:', error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
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 fetchDataUp3 = async (uid: number) => {
|
||||||
|
try {
|
||||||
|
const res = await getUp3(uid)
|
||||||
|
itemsUp3.value = res.data.map((item: any) => ({
|
||||||
|
id: item.id,
|
||||||
|
name: item.nama
|
||||||
|
}))
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error fetching data:', error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const fetchStatus = (data : any) => {
|
const fetchDataUlp = async (up3: number) => {
|
||||||
|
try {
|
||||||
const status = [
|
const res = await getUlp(up3)
|
||||||
{"id": "8", "name": "Selesai"},
|
itemsUlp.value = res.data.map((item: any) => (
|
||||||
{"id": "7", "name": "Nyala"},
|
{
|
||||||
{"id": "6", "name": "Pengalihan"},
|
id: item.id,
|
||||||
{"id": "5", "name": "Dialihkan"},
|
name: item.nama,
|
||||||
{"id": "4", "name": "Dalam Pengerjaan"},
|
}
|
||||||
{"id": "3", "name": "Dalam Perjalanan"},
|
));
|
||||||
{"id": "2", "name": "Penugasan Regu"},
|
} catch (error) {
|
||||||
{"id": "1", "name": "lapor"}
|
console.error('Error fetching data:', error)
|
||||||
]
|
}
|
||||||
const filteredStatus = status.find(item => item.id == data);
|
|
||||||
const name = filteredStatus ? filteredStatus.name : null;
|
|
||||||
return name;
|
|
||||||
}
|
}
|
||||||
|
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.id,
|
||||||
|
name: item.nama,
|
||||||
|
}
|
||||||
|
));
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error fetching data:', error);
|
||||||
|
}
|
||||||
|
},300);
|
||||||
|
};
|
||||||
const selectedUid = (value: any) => {
|
const selectedUid = (value: any) => {
|
||||||
useRegionStore().setData(value.id);
|
useRegionStore().setData(value.id)
|
||||||
fetchDataUp3(value.id);
|
fetchDataUp3(value.id)
|
||||||
}
|
}
|
||||||
const selectedUp3Posko = (value: any) => {
|
const selectedUp3Posko = (value: any) => {
|
||||||
useUp3Store().setData(value.id);
|
if (value.id != 0) {
|
||||||
fetchDataPosko(value.id);
|
useUp3Store().setData(value.id)
|
||||||
|
fetchDataPosko(value.id)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const selectedUp3Ulp = (value: any) => {
|
const selectedUp3Ulp = (value: any) => {
|
||||||
useUp3Store().setData(value.id);
|
useUp3Store().setData(value.id)
|
||||||
fetchDataUlp(value.id);
|
fetchDataUlp(value.id)
|
||||||
}
|
}
|
||||||
const selectedPosko = (value: any) => {
|
const selectedPosko = (value: any) => {
|
||||||
usePostsStore().setData(value.id);
|
usePostsStore().setData(value.id)
|
||||||
}
|
}
|
||||||
const selectedUlp = (value: any) => {
|
const selectedUlp = (value: any) => {
|
||||||
useUlpStore().setData(value.id);
|
useUlpStore().setData(value.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export { selectedUid, selectedUp3Posko ,selectedUp3Ulp, selectedPosko,selectedUlp, fetchData, items, itemsUp3, itemsPosko,itemsRegional,itemsMedia,itemsUlp ,months ,years};
|
||||||
|
|
||||||
export { selectedUid, selectedUp3Posko, selectedUp3Ulp, selectedPosko, selectedUlp, fetchUid,fetchMedia,fetchStatus, itemsUid, itemsUp3, itemsPosko, itemsRegional, itemsMedia, itemsUlp, months, years };
|
|
||||||
|
@ -37,8 +37,6 @@ computed(() => {
|
|||||||
if (props.selected.id === 0) {
|
if (props.selected.id === 0) {
|
||||||
selected.value = { id: 0, name: props.placeholder }
|
selected.value = { id: 0, name: props.placeholder }
|
||||||
}
|
}
|
||||||
|
|
||||||
// console.log('selected', selected.value.name)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
@ -63,10 +61,6 @@ let filteredData = computed(() =>
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
watch(selected, (value) => {
|
|
||||||
emit('update:selected', value)
|
|
||||||
})
|
|
||||||
|
|
||||||
const show = ref(false)
|
const show = ref(false)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -1,16 +1,13 @@
|
|||||||
import axios from "axios";
|
import axios from 'axios'
|
||||||
|
|
||||||
const instance = axios.create({
|
const instance = axios.create({
|
||||||
baseURL: 'http://localhost:8443'
|
baseURL: 'http://10.8.0.13:8443'
|
||||||
});
|
})
|
||||||
|
|
||||||
|
const getUid = async () => await instance.get('/uid')
|
||||||
const getUid = async () => await instance.get('/uid');
|
const getMedia = async () => await instance.get('/media')
|
||||||
const getMedia = async() => await instance.get('/media');
|
const getJenisTransaksi = async () => await instance.get('/jenisTransaksi')
|
||||||
const getJenisTransaksi = async() => await instance.get('/jenisTransaksi');
|
const getUp3 = async (uid: number) => await instance.get('/up3?uid=' + uid)
|
||||||
const getUp3 = async (
|
const getUlp = async (up3: number) => await instance.get('/ulp?up3=' + up3)
|
||||||
uid: number,
|
const getPosko = async (uppp: number) => await instance.get('/posko?up3=' + uppp)
|
||||||
) => await instance.get('/up3?uid=' + uid);
|
export { getUid, getUp3, getPosko, getUlp, getMedia, getJenisTransaksi }
|
||||||
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