perbaikan dan sweetalert
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import {useSettingStore} from "@/stores/api/setting/setting";
|
||||
import { sweetalert } from "~/utils/helper";
|
||||
|
||||
const {getTypeUser, getMenu, postRoleUserMenu} = useSettingStore();
|
||||
const {listMenu, listTypeUser, typeUser, roleMenuById,messages} = storeToRefs(useSettingStore());
|
||||
@@ -8,6 +9,8 @@ const menuItem = ref<any>([]);
|
||||
const type_user = ref<any>([]);
|
||||
const dataDetail = ref(null)
|
||||
|
||||
const emit = defineEmits(['stateValue']);
|
||||
|
||||
const dataMenu = async () => {
|
||||
await Promise.all([
|
||||
getMenu(),
|
||||
@@ -88,15 +91,19 @@ const onSubmit = async () => {
|
||||
// console.log('Payload yang dikirim:', payload);
|
||||
await postRoleUserMenu(payload);
|
||||
// console.log(messages.value);
|
||||
// if(messages.value.type==='success'){
|
||||
// sweetalert(messages.value.title,'',messages.value.type);
|
||||
// }
|
||||
window.location.reload();
|
||||
if(messages.value.type==='success'){
|
||||
emit('stateValue', false)
|
||||
sweetalert(messages.value.title,'',messages.value.type);
|
||||
}else{
|
||||
sweetalert(messages.value.title,'',messages.value.type);
|
||||
}
|
||||
// window.location.reload();
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
data.value = await dataMenu();
|
||||
checkMenu()
|
||||
// console.log("ini rrolemenu :",roleMenuById);
|
||||
});
|
||||
|
||||
// Helper function to create checkbox config
|
||||
@@ -199,3 +206,10 @@ const createMenuRow = (menu: any) => {
|
||||
</Vueform>
|
||||
</div>
|
||||
</template>
|
||||
<style>
|
||||
.my-swal{
|
||||
z-index:2147483647 !important;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
Generated
+11
@@ -24,6 +24,7 @@
|
||||
"openid-client": "^5.7.1",
|
||||
"pinia": "^3.0.2",
|
||||
"sass": "1.70.0",
|
||||
"sweetalert2": "^11.22.0",
|
||||
"vue": "3.5.13",
|
||||
"vue-tabler-icons": "2.21.0",
|
||||
"vue3-apexcharts": "1.5.2",
|
||||
@@ -18686,6 +18687,16 @@
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/sweetalert2": {
|
||||
"version": "11.22.0",
|
||||
"resolved": "https://registry.npmjs.org/sweetalert2/-/sweetalert2-11.22.0.tgz",
|
||||
"integrity": "sha512-pSMuRGDULhh+wrFkO22O0YsIXxs8yFE0O+WVYXcqc/sTa1oRnf0JlR+vfQIRY1QM1UeFfnCjyw6DYnG75/oxiQ==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "individual",
|
||||
"url": "https://github.com/sponsors/limonte"
|
||||
}
|
||||
},
|
||||
"node_modules/symbol": {
|
||||
"version": "0.2.3",
|
||||
"resolved": "https://registry.npmjs.org/symbol/-/symbol-0.2.3.tgz",
|
||||
|
||||
@@ -48,7 +48,7 @@ onMounted(async() => {
|
||||
<!-- <p>coba ini</p> -->
|
||||
<!-- {{ type }}-->
|
||||
<MasterFormTypeUser v-if="type=='create'"/>
|
||||
<MasterFormDetail1 v-if="type=='detail'"/>
|
||||
<MasterFormDetail1 v-if="type=='detail'" @stateValue="val => state = val"/>
|
||||
<!-- <MasterContoh v-if="type=='detail'"/> -->
|
||||
</template>
|
||||
</MasterDialogModal>
|
||||
|
||||
@@ -26,8 +26,8 @@ export const useSettingStore = defineStore("SettingStore", () => {
|
||||
const roleMenuById = ref<any>([]);
|
||||
const getRoleMenuById = async (body: Record<string, any>) => {
|
||||
typeUser.value = body;
|
||||
|
||||
await $fetch(`/api/roleMenu/roleMenu`, {
|
||||
|
||||
await $fetch(`/api/setting/getRoleMenu`, {
|
||||
// mode: "no-cors",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
@@ -36,6 +36,7 @@ export const useSettingStore = defineStore("SettingStore", () => {
|
||||
body: JSON.stringify(body),
|
||||
}).then((res) => {
|
||||
roleMenuById.value = res;
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
@@ -85,7 +86,9 @@ export const useSettingStore = defineStore("SettingStore", () => {
|
||||
messages.value.title = 'Akses User Sudah Disimpan'
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err)
|
||||
// console.log(err)
|
||||
messages.value.type = 'error'
|
||||
messages.value.title = 'Akses User Tidak Berhasil Disimpan'
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
+4
-1
@@ -35,6 +35,9 @@ export function sweetalert(message: string,subtitle:string,type: string) {
|
||||
title: message,
|
||||
text: subtitle,
|
||||
showConfirmButton: false,
|
||||
timer: 3500
|
||||
timer: 3500,
|
||||
customClass:{
|
||||
container:'my-swal'
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user