Merge branch 'main' of github.com:defuj/eis

This commit is contained in:
kur0nek-o
2023-10-24 13:57:35 +07:00
42 changed files with 1569 additions and 1812 deletions

View File

@ -1,319 +1,563 @@
import { createRouter, createWebHistory } from 'vue-router'
import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router'
import { useAuthStore } from '@/stores/auth'
import HomeView from '@/views/HomeView.vue'
import TestView from '@/views/TestView.vue'
import LoginView from '@/views/LoginView.vue'
import NotFoundView from '@/views/NotFoundView.vue'
import MenuSample from '@/components/Menus/MenuSample.vue'
import AktifIndividual from '@/components/Menus/DaftarTransaksi/AktifIndividual.vue'
import HomeEmptyView from '@/components/HomeEmpty.vue'
import { useAuthStore } from '@/stores/auth'
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
linkActiveClass: 'active',
routes: [
{
path: '/home',
name: 'Home',
'meta': { requiresAuth: true },
component: HomeView,
children: [
{
path: '',
name: 'Home Page',
component: HomeEmptyView,
},
{
path: 'daftar-transaksi',
name: 'Daftar Transaksi',
children: [
{
path: 'aktif-individual',
name: 'Transaksi Aktif Individual',
component: AktifIndividual,
},
{
path: 'aktif-pln-mobile',
name: 'Transaksi Aktif PLN Mobile',
component: MenuSample,
},
{
path: 'periksa-return-order',
name: 'Transaksi Aktif Periksa dan Return Order',
component: MenuSample,
},
{
path: 'aktif-tm',
name: 'Transaksi Aktif TM',
component: MenuSample,
},
{
path: 'aktif-historis',
name: 'Transaksi Aktif Historis',
component: MenuSample,
},
{
path: 'monitoring-alih-unit',
name: 'Monitoring Alih Unit',
component: MenuSample,
},
{
path: 'monitoring-all',
name: 'Monitoring All',
component: MenuSample,
},
{
path: 'monitoring-tiket',
name: 'Monitoring Tiket',
component: MenuSample,
},
{
path: 'monitoring-history',
name: 'Monitoring History',
component: MenuSample,
},
{
path: 'monitoring-aktif',
name: 'Monitoring Aktif',
component: MenuSample,
},
{
path: 'monitoring-close-cc',
name: 'Monitoring Close CC',
component: MenuSample,
},
{
path: 'monitoring-log-autodispatch',
name: 'Monitoring Log AutoDispatch',
component: MenuSample,
},
{
path: 'monitoring-perlu-diperhatikan',
name: 'Monitoring yang Perlu Diperhatikan',
component: MenuSample,
},
{
path: 'monitoring-log-break-regu',
name: 'Monitoring Log Break Regu',
component: MenuSample,
},
{
path: 'monitoring-log-alih-regu',
name: 'Monitoring Log Alih Regu',
component: MenuSample,
},
]
},
{
path: 'administration',
name: 'Administration',
children: [
{
path: 'audit-trails',
name: 'Audit Trails',
children: [
{
path: 'log-login',
name: 'Log Login',
component: MenuSample,
},
{
path: 'log-aktivity',
name: 'Log Aktivity',
component: MenuSample,
},
{
path: 'log-error',
name: 'Log Error',
component: MenuSample,
},
],
},
{
path: 'task-management',
name: 'Task Management',
children: [
{
path: 'menu-management',
name: 'Menu Management',
component: MenuSample,
},
{
path: 'system-parameter',
name: 'System Parameter',
component: MenuSample,
},
{
path: 'ubah-profile-manager',
name: 'Ubah Profile Manager',
component: MenuSample,
},
{
path: 'security-projek',
name: 'Security Projek',
component: MenuSample,
},
{
path: 'user-role-manager',
name: 'User Role Manager',
component: MenuSample,
},
{
path: 'menu-authorization',
name: 'Menu Authorization',
component: MenuSample,
},
{
path: 'workflow-designer',
name: 'Workflow Designer',
component: MenuSample,
},
{
path: 'apkt-news',
name: 'APKT News',
component: MenuSample,
},
],
},
{
path: 'master-borderless',
name: 'Master Borderless',
children: [
{
path: 'zone-borderless',
name: 'Zone Borderless',
component: MenuSample,
},
{
path: 'user-zone-borderless',
name: 'User Zone Borderless',
component: MenuSample,
},
],
},
],
},
{
path: 'master-yantek',
name: 'Master Yantek',
children: [
{
path: 'unit',
name: 'Unit',
component: MenuSample,
},
{
path: 'unit-jaringan',
name: 'Unit Jaringan',
component: MenuSample,
},
{
path: 'unit-pelayanan',
name: 'Unit Pelayanan',
component: MenuSample,
},
{
path: 'regu-yantek',
name: 'Regu Yantek',
component: MenuSample,
},
{
path: 'gardu-induk',
name: 'Gardu Induk',
component: MenuSample,
},
{
path: 'gardu-penyulang-tm',
name: 'Gardu Penyulang TM',
component: MenuSample,
},
{
path: 'gardu-distribusi',
name: 'Gardu Distribusi',
component: MenuSample,
},
{
path: 'group-gangguan',
name: 'Group Gangguan',
component: MenuSample,
},
{
path: 'wilayah-yantek',
name: 'Wilayah Yantek',
component: MenuSample,
},
{
path: 'material',
name: 'Material',
component: MenuSample,
},
]
},
{
path: 'transaksi',
name: 'Transaksi',
children: [
{
path: 'gangguan-dan-keluhan',
name: 'Gangguan dan Keluhan',
component: MenuSample,
},
{
path: 'gangguan-tegangan-menengah',
name: 'Gangguan Tegangan Menengah',
component: MenuSample,
},
{
path: 'pemadaman-terencana',
name: 'Pemadaman Terencana',
component: MenuSample,
},
{
path: 'aplikasi-off-line',
name: 'Aplikasi Off-Line',
component: MenuSample,
},
{
path: 'penugasan-khusus',
name: 'Penugasan Khusus',
component: MenuSample,
},
{
path: 'mutasi-pengaduan',
name: 'Mutasi Pengaduan',
component: MenuSample,
},
]
},
]
},
{
path: '/test',
name: 'Test',
component: TestView
},
{
path: '/login',
name: 'Login',
component: LoginView
},
{
path: '/logout',
name: 'Logout',
beforeEnter(to, from, next) {
const auth = useAuthStore()
auth.logout()
next('/login')
import EmptyPage from '@/components/Pages/HomeEmpty.vue'
import TestPage from '@/components/Pages/TestPage.vue'
import { hasMoreThanTwoSlashes, removeExtraSlashes } from '@/utils/route'
const routes: RouteRecordRaw[] = [
{
path: '/home',
name: 'Home',
component: HomeView,
children: [
{
path: '',
name: 'Home Page',
component: EmptyPage,
},
redirect: '/logout'
},
{
path: '/404',
name: 'Not Found',
component: NotFoundView
},
]
{
path: 'gangguan',
name: 'Gangguan',
children: [
{
path: 'a',
name: 'Daftar',
children: [
{
path: '1',
name: 'Daftar Keluhan Dialihkan Ke Posko Lain',
component: TestPage,
},
{
path: '2',
name: 'Daftar Gangguan Melapor Lebih Dari 1 Kali',
component: TestPage,
},
{
path: '3',
name: 'Daftar Gangguan Response Time',
component: TestPage,
},
{
path: '4',
name: 'Daftar Gangguan Recovery Time',
component: TestPage,
},
{
path: '5',
name: 'Daftar Gangguan Selesai Tanpa ID Pelanggan',
component: TestPage,
},
{
path: '6',
name: 'Daftar Gangguan Berdasarkan Media',
component: TestPage,
},
{
path: '7',
name: 'Daftar Gangguan Diselesaikan Mobile APKT',
component: TestPage,
},
],
},
{
path: 'b',
name: 'Rekapitulasi',
children: [
{
path: '1',
name: 'Rekapitulasi Gangguan All',
component: TestPage,
},
{
path: '2',
name: 'Rekapitulasi Gangguan/Jenis Gangguan',
component: TestPage,
},
{
path: '3',
name: 'Rekapitulasi Gangguan/Jenis Gangguan SE 004',
component: TestPage,
},
{
path: '4',
name: 'Rekapitulasi Gangguan Per Posko',
component: TestPage,
},
{
path: '5',
name: 'Rekapitulasi Gangguan Per Regu',
component: TestPage,
},
{
path: '6',
name: 'Rekapitulasi Gangguan Per Tanggal',
component: TestPage,
},
{
path: '7',
name: 'Rekapitulasi Gangguan Berdasarkan Media',
component: TestPage,
},
{
path: '8',
name: 'Rekapitulasi Gangguan Alih Posko',
component: TestPage,
},
{
path: '9',
name: 'Rekapitulasi Gangguan Per Status',
component: TestPage,
},
{
path: '10',
name: 'Rekapitulasi Gangguan Diselesaikan Mobile APKT',
component: TestPage,
},
{
path: '11',
name: 'Rekapitulasi Rating Per Posko',
component: TestPage,
},
{
path: '12',
name: 'Rekapitulasi Rating Per Regu',
component: TestPage,
},
{
path: '13',
name: 'Rekapitulasi Koreksi Transaksi Individual',
component: TestPage,
},
{
path: '14',
name: 'Rekapitulasi Cleansing Transaksi TM',
component: TestPage,
},
],
}
]
},
{
path: 'keluhan',
name: 'Keluhan',
children: [
{
path: 'a',
name: 'Daftar',
children: [
{
path: '1',
name: 'Daftar Keluhan Dialihkan Ke Unit Lain',
component: TestPage,
},
{
path: '2',
name: 'Daftar Keluhan Pelanggan Lebih Dari 1 Kali',
component: TestPage,
},
{
path: '3',
name: 'Daftar Keluhan Response Time',
component: TestPage,
},
{
path: '4',
name: 'Daftar Keluhan Recovery Time',
component: TestPage,
},
{
path: '5',
name: 'Daftar Keluhan Selesai Tanpa ID Pelanggan',
component: TestPage,
},
{
path: '6',
name: 'Daftar Keluhan Berdasarkan Media',
component: TestPage,
},
{
path: '7',
name: 'Daftar Keluhan Selesai di CC123',
component: TestPage,
},
],
},
{
path: 'b',
name: 'Rekapitulasi',
children: [
{
path: '1',
name: 'Rekapitulasi Keluhan All',
component: TestPage,
},
{
path: '2',
name: 'Rekapitulasi Keluhan Per Fungsi Bidang',
component: TestPage,
},
{
path: '3',
name: 'Rekapitulasi Keluhan Per Jenis Keluhan',
component: TestPage,
},
{
path: '4',
name: 'Rekapitulasi Keluhan Per Tanggal',
component: TestPage,
},
{
path: '5',
name: 'Rekapitulasi Keluhan Per Unit',
component: TestPage,
},
{
path: '6',
name: 'Rekapitulasi Keluhan Berdasarkan Media',
component: TestPage,
},
{
path: '7',
name: 'Rekapitulasi Keluhan Per Kelompok Keluhan',
component: TestPage,
},
{
path: '8',
name: 'Rekapitulasi Rating Per Unit',
component: TestPage,
},
],
}
],
},
{
path: 'monalisa',
name: 'Monalisa',
children: [
{
path: 'a',
name: 'Gangguan',
children: [
{
path: 'a',
name: 'Rekapitulasi',
children: [
{
path: '1',
name: 'Jumlah Kali Gangguan',
component: TestPage,
},
{
path: '2',
name: 'Recovery Time (RCT) Gangguan',
component: TestPage,
},
{
path: '3',
name: 'Response Time (RPT) Gangguan',
component: TestPage,
},
{
path: '4',
name: 'Rekapitulasi Gangguan Per Jenis Gangguan',
component: TestPage,
},
{
path: '5',
name: 'Rekapitulasi Lapor Ulang Gangguan',
component: TestPage,
},
{
path: '6',
name: 'Rekapitulasi ENS Gangguan',
component: TestPage,
},
{
path: '7',
name: 'Rekapitulasi Gangguan Belum Selesai',
component: TestPage,
},
],
},
],
},
{
path: 'b',
name: 'Keluhan',
children: [
{
path: 'a',
name: 'Rekapitulasi',
children: [
{
path: '1',
name: 'Jumlah Kali Keluhan',
component: TestPage,
},
{
path: '2',
name: 'Recovery Time (RCT) Keluhan',
component: TestPage,
},
{
path: '3',
name: 'Response Time (RPT) Keluhan',
component: TestPage,
},
{
path: '4',
name: 'Rekapitulasi Gangguan Per Jenis Keluhan',
component: TestPage,
},
{
path: '5',
name: 'Rekapitulasi Lapor Ulang Keluhan',
component: TestPage,
},
{
path: '6',
name: 'Rekapitulasi Keluhan Belum Selesai',
component: TestPage,
},
],
},
],
},
{
path: 'c',
name: 'Laporan KPI',
children: [
{
path: 'a',
name: 'Bulanan',
children: [
{
path: '1',
name: 'Penurunan Jumlah Komplain',
component: TestPage,
},
{
path: '2',
name: 'Aging Complaint',
component: TestPage,
},
{
path: '3',
name: 'Energy Not Sales (ENS)',
component: TestPage,
},
{
path: '4',
name: 'Kepatuhan dan Akurasi Dalam Pelaporan',
component: TestPage,
},
],
},
{
path: '2',
name: 'Kumulatif',
children: [
{
path: '1',
name: 'Penurunan Jumlah Komplain',
component: TestPage,
},
{
path: '2',
name: 'Aging Complaint',
component: TestPage,
},
{
path: '3',
name: 'Energy Not Sales (ENS)',
component: TestPage,
},
{
path: '4',
name: 'Kepatuhan dan Akurasi Dalam Pelaporan',
component: TestPage,
},
],
}
],
},
],
},
{
path: 'check-in-out',
name: 'Check In OutCheck In Dan Check Out',
children: [
{
path: 'a',
name: 'Laporan Check In /Check Out (CICO)',
children: [
{
path: '1',
name: 'Laporan Check In /Check Out (CICO)',
component: TestPage,
},
],
},
],
},
{
path: 'anomali-pengaduan',
name: 'Anomali Penangan Pengaduan',
children: [
{
path: 'a',
name: 'Gangguan',
children: [
{
path: '1',
name: 'Laporan Anomali Penangan Pengaduan Gangguan Unit',
component: TestPage,
},
{
path: '2',
name: 'Laporan Anomali Penangan Pengaduan Gangguan Petugas',
component: TestPage,
},
],
},
{
path: 'b',
name: 'Keluhan',
children: [
{
path: '1',
name: 'Laporan Anomali Penangan Pengaduan Keluhan Unit',
component: TestPage,
},
],
},
],
},
{
path: 'ctt-kwh-periksa',
name: 'CTT & KWH Periksa',
children: [
{
path: '1',
name: 'Laporan CTT & KWH Periksa',
component: TestPage,
},
],
},
]
},
{
path: '/login',
name: 'Login',
component: LoginView
},
{
path: '/404',
name: 'Not Found',
component: NotFoundView
},
]
// const createRoute = (route: RouteRecordRaw[]): RouteRecordRaw[] => {
// var newRoute: RouteRecordRaw[] = []
// const getRoute = (route: RouteRecordRaw[], parent: string = '') => {
// route.forEach((r) => {
// if (r.children) {
// if (r.component) {
// var fullPath = `${parent.replace('/', '')}/${r.path.replace('/', '')}`
// fullPath = hasMoreThanTwoSlashes(fullPath) ? removeExtraSlashes(fullPath) : fullPath
// newRoute.push({
// path: fullPath,
// name: r.name,
// component: r.component
// } as RouteRecordRaw)
// }
// getRoute(r.children, `${parent}/${r.path}`)
// } else {
// var fullPath = `${parent.replace('/', '')}/${r.path.replace('/', '')}`
// if (newRoute.find((nr) => nr.path !== '/' && nr.path === '/home' && fullPath.includes(nr.path))) {
// const index = newRoute.findIndex((nr) => nr.path !== '/' && fullPath.includes(nr.path))
// newRoute[index] = {
// ...newRoute[index], children: [...newRoute[index].children ?? [], {
// path: fullPath === '/home/' ? '' : fullPath.includes('/home/') ? fullPath.replace('/home/', '').split('/').join('-') : fullPath.split('/').join('-'),
// name: r.name,
// component: r.component
// } as RouteRecordRaw]
// }
// } else {
// newRoute.push({
// path: fullPath,
// name: r.name,
// component: r.component
// } as RouteRecordRaw)
// }
// }
// })
// }
// getRoute(route)
// console.log(newRoute);
// return newRoute
// }
const createRoute = (route: RouteRecordRaw[]): RouteRecordRaw[] => {
var newRoute: RouteRecordRaw[] = []
const getRoute = (route: RouteRecordRaw[], parent: string = '') => {
route.forEach((r) => {
if (r.children) {
if (r.component) {
const fullPath = `${parent.replace('/', '')}/${r.path.replace('/', '')}`
newRoute.push({
path: fullPath,
name: r.name,
component: r.component
} as RouteRecordRaw)
}
getRoute(r.children, `${parent}/${r.path}`)
} else {
const fullPath = `${parent.replace('/', '')}/${r.path.replace('/', '')}`
if (newRoute.find((nr) => nr.path !== '/' && nr.path === '/home' && fullPath.includes(nr.path))) {
const index = newRoute.findIndex((nr) => nr.path !== '/' && fullPath.includes(nr.path))
newRoute[index] = {
...newRoute[index], children: [...newRoute[index].children ?? [], {
path: fullPath === '/home/' ? '' : fullPath.includes('/home/') ? fullPath.replace('/home/', '') : fullPath,
name: r.name,
component: r.component
} as RouteRecordRaw]
}
} else {
newRoute.push({
path: fullPath,
name: r.name,
component: r.component
} as RouteRecordRaw)
}
}
})
}
getRoute(route)
// remove duplicate route path and sort by path length
const uniqueRoute = newRoute.filter((nr, index, self) => self.findIndex((n) => n.path === nr.path) === index).sort((a, b) => b.path.length - a.path.length)
return uniqueRoute
}
const router = createRouter({
history: createWebHistory(),
linkActiveClass: 'active',
routes: createRoute(routes)
})
console.log(router.getRoutes());
router.beforeEach((to, from, next) => {
// redirect to login page if not logged in and trying to access a restricted page
@ -348,7 +592,9 @@ router.beforeEach((to, from, next) => {
}
}
}
})
export default router
export {
routes
}