refactor: route

This commit is contained in:
Methapon2001 2024-12-25 13:44:02 +07:00
parent 8885db8207
commit 80ab12d77d
4 changed files with 20 additions and 15 deletions

View file

@ -88,7 +88,7 @@ async function triggerTaskOrder(opts: {
id?: string;
}) {
const url = new URL(
`/task-order/order/${opts.statusDialog === 'create' ? 'add' : opts.id}`,
`/task-order/${opts.statusDialog === 'create' ? 'add' : opts.id}`,
window.location.origin,
);
@ -99,7 +99,7 @@ async function triggerTaskReceive(opts: {
statusDialog: 'info' | 'edit';
id?: string;
}) {
const url = new URL(`/task-order/receive/${opts.id}`, window.location.origin);
const url = new URL(`/task-order/${opts.id}`, window.location.origin);
window.open(url.toString(), '_blank');
}

View file

@ -0,0 +1,11 @@
<script setup lang="ts">
import OrderView from './order_view/MainPage.vue';
import ReceiveView from './receive_view/MainPage.vue';
import { isRoleInclude } from 'src/stores/utils';
</script>
<template>
<OrderView v-if="!isRoleInclude(['messenger'])" />
<ReceiveView v-if="isRoleInclude(['messenger'])" />
</template>

View file

@ -587,7 +587,7 @@ watch([currentFormData.value.taskStatus], () => {
});
function viewDocument(id: string) {
window.open(`/task-order/doc/${id}`, '_blank');
window.open(`/task-order/${id}/doc`, '_blank');
}
</script>
<template>

View file

@ -134,21 +134,15 @@ const routes: RouteRecordRaw[] = [
component: () => import('pages/09_task-order/order_view/MainPage.vue'),
},
{
path: '/task-order/doc/:id',
path: '/task-order/:id',
name: 'TaskReceiveView',
component: () => import('pages/09_task-order/PageView.vue'),
},
{
path: '/task-order/:id/doc',
name: 'TaskOrderAdd',
component: () => import('pages/09_task-order/document_view/MainPage.vue'),
},
{
path: '/task-order/order/:id',
name: 'TaskOrderView',
component: () => import('pages/09_task-order/order_view/MainPage.vue'),
},
{
path: '/task-order/receive/:id',
name: 'TaskReceiveView',
component: () => import('pages/09_task-order/receive_view/MainPage.vue'),
},
// Always leave this as last one,
// but you can also remove it