changes
This commit is contained in:
@@ -76,20 +76,61 @@ const route = useRoute();
|
||||
const emit = defineEmits(["changetab", "langChanged"]);
|
||||
const { $find, $filter, $findIndex, $store } = useNuxtApp();
|
||||
const lang = ref($store.lang);
|
||||
var menu = $filter($store.common, { category: "topmenu" });
|
||||
// var menu = $filter($store.common, { category: "topmenu" });
|
||||
const menu = [
|
||||
{
|
||||
id: 1,
|
||||
category: 'topmenu',
|
||||
classify: 'left',
|
||||
code: 'dashboard',
|
||||
vi: 'Dashboard',
|
||||
link: null,
|
||||
detail: {
|
||||
base: 'Dashboard',
|
||||
component: 'DashboardMaster',
|
||||
},
|
||||
index: 0,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
category: 'topmenu',
|
||||
classify: 'left',
|
||||
code: 'orders',
|
||||
vi: 'Đơn hàng',
|
||||
link: null,
|
||||
detail: {
|
||||
base: 'Orders',
|
||||
component: 'OrdersMaster',
|
||||
},
|
||||
index: 0,
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
category: 'topmenu',
|
||||
classify: 'left',
|
||||
code: 'inventory',
|
||||
vi: 'Tồn kho',
|
||||
link: null,
|
||||
detail: {
|
||||
base: 'Inventory',
|
||||
component: 'InventoryMaster',
|
||||
},
|
||||
index: 0,
|
||||
},
|
||||
]
|
||||
if($store.rights.length>0) {
|
||||
menu = menu.filter(v=>$findIndex($store.rights, {setting: v.id})>=0)
|
||||
}
|
||||
if(menu.length===0) {
|
||||
$snackbar($store.lang==='vi'? 'Bạn không có quyền truy cập' : 'You do not have permission to access.')
|
||||
}
|
||||
menu.map(v=>{
|
||||
let arr = $filter($store.common, {category: 'submenu', classify: v.code})
|
||||
if($store.rights.length>0) {
|
||||
arr = arr.filter(x=>$findIndex($store.rights, {setting: x.id})>=0)
|
||||
}
|
||||
v.submenu = arr.length>0? arr : null
|
||||
})
|
||||
// menu.map(v=>{
|
||||
// let arr = $filter($store.common, {category: 'submenu', classify: v.code})
|
||||
// if($store.rights.length>0) {
|
||||
// arr = arr.filter(x=>$findIndex($store.rights, {setting: x.id})>=0)
|
||||
// }
|
||||
// v.submenu = arr.length>0? arr : null
|
||||
// })
|
||||
var leftmenu = $filter(menu, {category: 'topmenu', classify: 'left'})
|
||||
var currentTab = ref(leftmenu.length>0? leftmenu[0] : undefined)
|
||||
var subTab = ref();
|
||||
|
||||
5
app/components/dashboard/Dashboard.vue
Normal file
5
app/components/dashboard/Dashboard.vue
Normal file
@@ -0,0 +1,5 @@
|
||||
<script setup>
|
||||
</script>
|
||||
<template>
|
||||
Dashboard
|
||||
</template>
|
||||
5
app/components/inventory/Inventory.vue
Normal file
5
app/components/inventory/Inventory.vue
Normal file
@@ -0,0 +1,5 @@
|
||||
<script setup>
|
||||
</script>
|
||||
<template>
|
||||
Inventory
|
||||
</template>
|
||||
5
app/components/orders/Orders.vue
Normal file
5
app/components/orders/Orders.vue
Normal file
@@ -0,0 +1,5 @@
|
||||
<script setup>
|
||||
</script>
|
||||
<template>
|
||||
Orders
|
||||
</template>
|
||||
@@ -1,9 +1,12 @@
|
||||
<template>
|
||||
<div style="min-height: 100vh" class="has-background-white" data-theme="light" lang="vi" v-if="authorized">
|
||||
<slot />
|
||||
|
||||
<div
|
||||
style="min-height: 100vh"
|
||||
class="has-background-white"
|
||||
data-theme="light"
|
||||
lang="vi"
|
||||
>
|
||||
<slot></slot>
|
||||
<SnackBar v-if="snackbar" v-bind="snackbar" @close="$store.removeSnackbar()" />
|
||||
|
||||
<Modal v-if="showmodal" v-bind="showmodal" @close="showmodal = undefined" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -39,12 +42,12 @@ async function checkRedirect() {
|
||||
},
|
||||
true
|
||||
);
|
||||
if (row === "error" || row === undefined) $requestLogin();
|
||||
if (row === "error" || row === undefined) return; /* $requestLogin(); */
|
||||
else {
|
||||
row.token = route.query.token;
|
||||
$store.commit("login", row);
|
||||
}
|
||||
} else if (!$store.login) return $requestLogin();
|
||||
} else if (!$store.login) return /* $requestLogin(); */
|
||||
await checkLogin();
|
||||
}
|
||||
async function checkLogin() {
|
||||
@@ -58,9 +61,10 @@ async function checkLogin() {
|
||||
true
|
||||
));
|
||||
let authtoken = await $getdata("token", { token: $store.login.token }, undefined, true);
|
||||
if (authtoken ? authtoken.expiry : true) return $requestLogin();
|
||||
if (authtoken ? authtoken.expiry : true) return /* $requestLogin(); */
|
||||
authorized.value = true;
|
||||
} else $requestLogin();
|
||||
}
|
||||
// else $requestLogin();
|
||||
}
|
||||
onMounted(() => {
|
||||
checkRedirect()
|
||||
|
||||
@@ -7,9 +7,9 @@ export default defineNuxtPlugin(() => {
|
||||
const module = "application";
|
||||
const mode = "dev";
|
||||
const paths = [
|
||||
{ name: "dev", url: "https://dev.api.utopia.com.vn/" },
|
||||
{ name: "dev", url: "https://erpapi.bigdatatech.vn/" },
|
||||
{ name: "local", url: "http://localhost:8000/" },
|
||||
{ name: "prod", url: "https://api.utopia.com.vn/" },
|
||||
{ name: "prod", url: "https://erpapi.bigdatatech.vn/" },
|
||||
];
|
||||
const path = paths.find((v) => v.name === mode).url;
|
||||
const apis = [
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
export default defineNuxtPlugin(async (nuxtApp) => {
|
||||
const { $getapi, $readyapi } = useNuxtApp()
|
||||
let connlist = $readyapi(['moneyunit', 'datatype', 'filterchoice', 'colorchoice', 'textalign', 'placement', 'colorscheme',
|
||||
let connlist = $readyapi(['datatype', 'filterchoice', 'colorchoice', 'textalign', 'placement', 'colorscheme',
|
||||
'filtertype', 'sorttype', 'tablesetting', 'settingchoice', 'sharechoice', 'menuchoice', 'settingtype', 'settingclass',
|
||||
'common', 'sex', 'legaltype', 'cart'])
|
||||
'sex', 'legaltype', 'cart'])
|
||||
let filter = connlist.filter(v=>!v.ready)
|
||||
if(filter.length>0) await $getapi(filter)
|
||||
})
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { defineNuxtPlugin } from "#app";
|
||||
import Dashboard from '@/components/dashboard/Dashboard.vue';
|
||||
import Orders from '@/components/orders/Orders.vue';
|
||||
import Inventory from '@/components/inventory/Inventory.vue';
|
||||
import Notebox from "~/components/common/Notebox.vue";
|
||||
import ProductCountbox from "~/components/common/ProductCountbox.vue";
|
||||
import SvgIcon from "~/components/SvgIcon.vue";
|
||||
@@ -126,6 +129,9 @@ const components = {
|
||||
DebtCustomer,
|
||||
Due,
|
||||
Overdue,
|
||||
Dashboard,
|
||||
Orders,
|
||||
Inventory
|
||||
};
|
||||
|
||||
export default defineNuxtPlugin((nuxtApp) => {
|
||||
|
||||
Reference in New Issue
Block a user