This commit is contained in:
2025-06-07 12:52:52 +07:00
parent 35772f38c9
commit 1a4edfded4
7 changed files with 57 additions and 34 deletions
+2
View File
@@ -27,6 +27,8 @@ const state = ref(false)
<v-btn color="primary" class="ms-auto" @click="emit('detail', props?.item)">Detail</v-btn>
</template> -->
<slot name="actions"></slot>
</v-card>
<!-- <MasterDialogModal v-if="state" :stateValue="state" @stateValue="val => state = val" /> -->
+7 -7
View File
@@ -77,7 +77,7 @@ onMounted(async () => {
console.log('aaaaa', data.value);
});
const form = ref({})
// Helper function to create checkbox config
const createCheckbox = (namePrefix: string, menu: any) => {
const accessMap = {
@@ -126,12 +126,12 @@ const createMenuRow = (menu: any) => {
:rows="1+data.length"
:grid="[
[
['No', 1, 1, null, null],
['Nama Menu', 1, 1, null, null],
['Tambah', 1, 1, null, null],
['Ubah', 1, 1, null, null],
['Baca', 1, 1, null, null],
['Hapus', 1, 1, null, null],
['<strong>No</strong>', 1, 1, null, null],
['<strong>Nama Menu</strong>', 1, 1, null, null],
['<strong>Tambah</strong>', 1, 1, null, null],
['<strong>Ubah</strong>', 1, 1, null, null],
['<strong>Baca</strong>', 1, 1, null, null],
['<strong>Hapus</strong>', 1, 1, null, null],
],
...data.map((menu:any) => createMenuRow(menu))
]"
+7 -3
View File
@@ -16,7 +16,7 @@ const {typeUser} =storeToRefs(useRoleMode())
const state = ref(false)
const type = ref('')
const detailType = async(item:any) => {
// console.log(item._id); //simpan pinia
console.log(item._id); //simpan pinia
await getRoleMenuById(item._id)
type.value='detail'
state.value= true
@@ -31,6 +31,7 @@ onMounted(async() => {
</script>
<!-- ini list -->
<template>
<!-- <MasterContoh1 /> -->
<div class="d-flex pt-6 align-center ml-3 mb-6">
<v-btn class="mr-16" color="primary" variant="tonal" @click="state= !state; type='create'"><v-icon>mdi-plus</v-icon> Tipe User</v-btn>
</div>
@@ -39,7 +40,9 @@ onMounted(async() => {
<div class="d-flex justify-space-between">
<template v-if="listTypeUser && listTypeUser.length > 0">
<v-col v-for="(item, index) in listTypeUser" :key="index">
<MasterCardList :item="item" @detail="detailType" />
<MasterCardList :item="item" @detail="detailType" >
<template v-slot:actions></template>
</MasterCardList>
</v-col>
</template>
<template v-else>
@@ -55,7 +58,8 @@ onMounted(async() => {
<!-- <p>coba ini</p> -->
<!-- {{ type }}-->
<MasterFormTypeUser v-if="type=='create'"/>
<MasterFormDetail1 v-if="type=='detail'"/>
<MasterFormDetailgit v-if="type=='detail'"/>
<!-- <MasterContoh v-if="type=='detail'"/> -->
</template>
</MasterDialogModal>
</template>
+6 -1
View File
@@ -2,6 +2,7 @@ import { defineStore } from "pinia";
import axios from "axios";
export const useMenu = defineStore("menu", () => {
const listMenu = ref<any>([]);
const messages = ref<any>({});
const getMenu = async () => {
// await $fetch("http://10.10.150.131:8080/api/menu/getlist", {
await $fetch("/api/menu/listMenu", {
@@ -14,7 +15,11 @@ export const useMenu = defineStore("menu", () => {
.then((res) => {
listMenu.value = res
console.log(listMenu.value);
});
}).catch((error) => {
console.log(`Info Error : ${error}`)
messages.value.title = 'Sambungan Sever Terputus!!!';
messages.value.type = 'error';
})
// return listMenu;
};
return { getMenu,listMenu };
+6 -1
View File
@@ -3,6 +3,7 @@ import axios from "axios";
export const useRoleMode = defineStore("roleMode", () => {
const typeUser = ref<any>([]);
const roleMenuById = ref<any>([]);
const messages = ref<any>({});
const getRoleMenuById = async (body: Record<string, any>) => {
typeUser.value = body;
// console.log(typeUser.value);
@@ -17,7 +18,11 @@ export const useRoleMode = defineStore("roleMode", () => {
}).then((res) => {
roleMenuById.value = res;
// console.log(roleMenuById.value);
});
}).catch((error) => {
console.log(`Info Error : ${error}`)
messages.value.title = 'Sambungan Sever Terputus!!!';
messages.value.type = 'error';
});
// return roleMenuById;
};
return { getRoleMenuById, roleMenuById, typeUser };
+23 -21
View File
@@ -1,5 +1,5 @@
import axios from 'axios'
import { defineStore } from 'pinia'
import axios from "axios";
import { defineStore } from "pinia";
// export const useMySidebarStore = defineStore({
// id: 'mySidebarStore',
@@ -7,22 +7,24 @@ import { defineStore } from 'pinia'
// actions: {}
// })
export const useSidebarStore = defineStore('SidebarStore', () => {
const getSidebar = async () => {
console.log('aaaaa')
const res = await $fetch(`http://10.10.150.131:8080/api/login/6835632801e46cf9c5551876`, {
mode: 'no-cors',
headers: {
'Access-Control-Allow-Origin': '*',
Accept: 'application/json',
'Content-Type': 'application/json',
},
})
.then((response) => {
console.log(response)
})
}
return {
getSidebar
}
})
export const useSidebarStore = defineStore("SidebarStore", () => {
const getSidebar = async () => {
console.log("aaaaa");
const res = await $fetch(
`http://10.10.150.131:8080/api/login/6835632801e46cf9c5551876`,
{
mode: "no-cors",
headers: {
"Access-Control-Allow-Origin": "*",
Accept: "application/json",
"Content-Type": "application/json",
},
}
).then((response) => {
console.log(response);
});
};
return {
getSidebar,
};
});
+6 -1
View File
@@ -2,6 +2,7 @@ import { defineStore } from "pinia";
import axios from "axios";
export const useTypeUser = defineStore("typeUser", () => {
const listTypeUser = ref<any>([]);
const messages = ref<any>({});
const getTypeUser = async () => {
// await $fetch("http://10.10.150.131:8080/api/menu/type", {
await $fetch("/api/typeUser/listTypeUser", {
@@ -16,7 +17,11 @@ export const useTypeUser = defineStore("typeUser", () => {
.then((res) => {
listTypeUser.value = res
// console.log(listTypeUser.value);
});
}).catch((error) => {
console.log(`Info Error : ${error}`)
messages.value.title = 'Sambungan Sever Terputus!!!';
messages.value.type = 'error';
});
// return listTypeUser;
};
return { getTypeUser,listTypeUser };