feat: add delete is OWNER

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2026-05-29 10:12:16 +07:00
parent aa3d41b7b3
commit 21401ed519
6 changed files with 174 additions and 45 deletions

View file

@ -10,11 +10,11 @@ import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
const q = useQuasar();
const $q = useQuasar();
const leaveStore = useLeavelistDataStore();
const route = useRoute();
const router = useRouter();
const { showLoader, hideLoader, messageError, dialogRemove } =
const { showLoader, hideLoader, messageError, dialogRemove, success } =
useCounterMixin();
const total = defineModel<number>("total", { required: true });
@ -49,7 +49,8 @@ const isPermissionDelete = computed(() => {
return (status: string) => {
return (
checkPermission(route)?.attrOwnership === "OWNER" &&
!leaveStore.statusDelete.includes(status)
!leaveStore.statusDelete.includes(status) &&
leaveStore.tabMenu === "1"
);
};
});
@ -281,17 +282,14 @@ function getStatusColor(statusText: string) {
}
function handleDelete(id: string) {
dialogRemove(q, async () => {
dialogRemove($q, async () => {
try {
showLoader();
const API =
leaveStore.tabMenu === "1"
? config.API.leaveList()
: config.API.leaveListDelete();
await http.delete(API + `/${id}`);
await http.delete(config.API.leaveList() + `/${id}`);
await props.getList?.();
success($q, "ลบข้อมูลสำเร็จ");
} catch (error) {
messageError(q, error);
messageError($q, error);
} finally {
hideLoader();
}
@ -356,7 +354,7 @@ onMounted(() => {
color="red"
@click.prevent="handleDelete(props.row.id)"
>
<q-tooltip>รายละเอยด</q-tooltip>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>
</q-td>
<q-td