Compare commits
No commits in common. "dev" and "v1.1.109" have entirely different histories.
12 changed files with 69 additions and 249 deletions
|
|
@ -9,8 +9,6 @@
|
||||||
round
|
round
|
||||||
dense
|
dense
|
||||||
@click="close"
|
@click="close"
|
||||||
@keydown.enter.prevent
|
|
||||||
@keydown.space.prevent
|
|
||||||
style="color: #ff8080; background-color: #ffdede"
|
style="color: #ff8080; background-color: #ffdede"
|
||||||
/>
|
/>
|
||||||
</q-toolbar>
|
</q-toolbar>
|
||||||
|
|
|
||||||
|
|
@ -866,8 +866,7 @@ onMounted(() => {
|
||||||
outlined
|
outlined
|
||||||
dense
|
dense
|
||||||
:model-value="date2Thai(formData.dateEnd)"
|
:model-value="date2Thai(formData.dateEnd)"
|
||||||
clearable
|
:rules="[(val:string) => !!val || `${'กรุณาเลือก วันที่สิ้นสุด'}`]"
|
||||||
@clear="formData.dateEnd = null"
|
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
:label="`${'วันที่สิ้นสุด'}`"
|
:label="`${'วันที่สิ้นสุด'}`"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -589,7 +589,7 @@ onMounted(() => {
|
||||||
|
|
||||||
<div class="col-xs-6 col-sm-6 col-md-6">
|
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||||
<q-select
|
<q-select
|
||||||
:readonly="checkPermission($route)?.attrOwnership !== 'OWNER'"
|
readonly
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
use-input
|
use-input
|
||||||
|
|
@ -641,7 +641,7 @@ onMounted(() => {
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-6 col-sm-6 col-md-6">
|
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||||
<q-input
|
<q-input
|
||||||
:readonly="checkPermission($route)?.attrOwnership !== 'OWNER'"
|
readonly
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
lazy-rules
|
lazy-rules
|
||||||
|
|
@ -653,7 +653,7 @@ onMounted(() => {
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-6 col-sm-6 col-md-6">
|
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||||
<q-input
|
<q-input
|
||||||
:readonly="checkPermission($route)?.attrOwnership !== 'OWNER'"
|
readonly
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
lazy-rules
|
lazy-rules
|
||||||
|
|
@ -722,7 +722,7 @@ onMounted(() => {
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-6 col-sm-6 col-md-6">
|
<div class="col-xs-6 col-sm-6 col-md-6">
|
||||||
<q-select
|
<q-select
|
||||||
:readonly="checkPermission($route)?.attrOwnership !== 'OWNER'"
|
readonly
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
use-input
|
use-input
|
||||||
|
|
|
||||||
|
|
@ -316,10 +316,9 @@ onMounted(() => {
|
||||||
:model-value="
|
:model-value="
|
||||||
dateEnd !== null ? date2Thai(dateEnd) : null
|
dateEnd !== null ? date2Thai(dateEnd) : null
|
||||||
"
|
"
|
||||||
|
:rules="edit ? [(val:string) => !!val || `${'กรุณาเลือกตั้งแต่วัน'}`]:[]"
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
:label="`${'ถึงวันที่'}`"
|
:label="`${'ถึงวันที่'}`"
|
||||||
clearable
|
|
||||||
@clear="dateEnd = null"
|
|
||||||
>
|
>
|
||||||
<template v-slot:prepend>
|
<template v-slot:prepend>
|
||||||
<q-icon
|
<q-icon
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import type {
|
||||||
} from "@/modules/05_placement/interface/request/Main";
|
} from "@/modules/05_placement/interface/request/Main";
|
||||||
import type { FormOrderPlacementMainData } from "@/modules/05_placement/interface/request/Main";
|
import type { FormOrderPlacementMainData } from "@/modules/05_placement/interface/request/Main";
|
||||||
|
|
||||||
|
export const useProfileDataStore = defineStore("profilePlacenent", () => {
|
||||||
interface profile {
|
interface profile {
|
||||||
main: { columns: String[] };
|
main: { columns: String[] };
|
||||||
education: { columns: String[] };
|
education: { columns: String[] };
|
||||||
|
|
@ -28,7 +29,6 @@ interface profile {
|
||||||
document: { columns: String[] };
|
document: { columns: String[] };
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useProfileDataStore = defineStore("profilePlacenent", () => {
|
|
||||||
const birthDate = ref<Date>(new Date());
|
const birthDate = ref<Date>(new Date());
|
||||||
const retireText = ref<string | null>(null);
|
const retireText = ref<string | null>(null);
|
||||||
const changeRetireText = (val: string | null) => {
|
const changeRetireText = (val: string | null) => {
|
||||||
|
|
@ -87,15 +87,15 @@ export const useProfileDataStore = defineStore("profilePlacenent", () => {
|
||||||
changeRetireText,
|
changeRetireText,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
interface placement {
|
|
||||||
mappingPosition: { columns: String[] };
|
|
||||||
}
|
|
||||||
export const usePlacementDataStore = defineStore("placement", () => {
|
export const usePlacementDataStore = defineStore("placement", () => {
|
||||||
const mixin = useCounterMixin(); //เรียกฟังก์ชันกลาง
|
const mixin = useCounterMixin(); //เรียกฟังก์ชันกลาง
|
||||||
const tabsMain = ref<string>("probation");
|
const tabsMain = ref<string>("probation");
|
||||||
const isOfficer = ref<boolean | null>(null);
|
const isOfficer = ref<boolean | null>(null);
|
||||||
const isStaff = ref<boolean | null>(null);
|
const isStaff = ref<boolean | null>(null);
|
||||||
const { hideLoader } = mixin;
|
const { hideLoader } = mixin;
|
||||||
|
interface placement {
|
||||||
|
mappingPosition: { columns: String[] };
|
||||||
|
}
|
||||||
const placementData = ref<placement>({
|
const placementData = ref<placement>({
|
||||||
mappingPosition: { columns: [] },
|
mappingPosition: { columns: [] },
|
||||||
});
|
});
|
||||||
|
|
@ -218,10 +218,10 @@ export const usePlacementDataStore = defineStore("placement", () => {
|
||||||
isStaff,
|
isStaff,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
export const useOrderPlacementDataStore = defineStore("placementOrder", () => {
|
||||||
interface placementOrder {
|
interface placementOrder {
|
||||||
mappingPosition: { columns: String[] };
|
mappingPosition: { columns: String[] };
|
||||||
}
|
}
|
||||||
export const useOrderPlacementDataStore = defineStore("placementOrder", () => {
|
|
||||||
const placementOrderData = ref<placementOrder>({
|
const placementOrderData = ref<placementOrder>({
|
||||||
mappingPosition: { columns: [] },
|
mappingPosition: { columns: [] },
|
||||||
});
|
});
|
||||||
|
|
@ -369,8 +369,6 @@ export const useTransferDataStore = defineStore("transferDataStore", () => {
|
||||||
]);
|
]);
|
||||||
const statusOp = ref<DataOptions[]>(statusMainOp.value);
|
const statusOp = ref<DataOptions[]>(statusMainOp.value);
|
||||||
|
|
||||||
const statusDelete = ["REPORT", "WAITING", "DONE"];
|
|
||||||
|
|
||||||
const statusText = (val: string) => {
|
const statusText = (val: string) => {
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case "WAITTING":
|
case "WAITTING":
|
||||||
|
|
@ -440,6 +438,5 @@ export const useTransferDataStore = defineStore("transferDataStore", () => {
|
||||||
statusOp,
|
statusOp,
|
||||||
statusMainOp,
|
statusMainOp,
|
||||||
filterOption,
|
filterOption,
|
||||||
statusDelete,
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
import { ref, onMounted, computed } from "vue";
|
import { ref, onMounted, computed } from "vue";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
|
|
||||||
import { useRouter, useRoute } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import {
|
import {
|
||||||
checkPermission,
|
checkPermission,
|
||||||
checkPermissionList,
|
checkPermissionList,
|
||||||
|
|
@ -20,19 +20,11 @@ import DialogOrders from "@/modules/05_placement/components/Transfer/DialogOrder
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const route = useRoute();
|
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const store = useTransferDataStore();
|
const store = useTransferDataStore();
|
||||||
const { statusText, filterOption } = useTransferDataStore();
|
const { statusText, filterOption } = useTransferDataStore();
|
||||||
const {
|
const { date2Thai, messageError, showLoader, hideLoader, onSearchDataTable } =
|
||||||
date2Thai,
|
mixin;
|
||||||
messageError,
|
|
||||||
showLoader,
|
|
||||||
hideLoader,
|
|
||||||
onSearchDataTable,
|
|
||||||
dialogRemove,
|
|
||||||
success,
|
|
||||||
} = mixin;
|
|
||||||
|
|
||||||
const modal = ref<boolean>(false); //ส่งไปออกคำสั่ง
|
const modal = ref<boolean>(false); //ส่งไปออกคำสั่ง
|
||||||
const dataTransfer = ref<ResponseData[]>([]); //ช่อมูลรายการขอโอน
|
const dataTransfer = ref<ResponseData[]>([]); //ช่อมูลรายการขอโอน
|
||||||
|
|
@ -149,15 +141,6 @@ const visibleColumns = ref<string[]>([
|
||||||
"createdAt",
|
"createdAt",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const isPermissionDelete = computed(() => {
|
|
||||||
return (status: string) => {
|
|
||||||
return (
|
|
||||||
checkPermission(route)?.attrOwnership === "OWNER" &&
|
|
||||||
!store.statusDelete.includes(status)
|
|
||||||
);
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
/** ฟังก์ชันดึงข้อมูรายการขอโอน*/
|
/** ฟังก์ชันดึงข้อมูรายการขอโอน*/
|
||||||
async function fetchData() {
|
async function fetchData() {
|
||||||
showLoader();
|
showLoader();
|
||||||
|
|
@ -211,21 +194,6 @@ function onSearch() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleDelete(id: string) {
|
|
||||||
dialogRemove($q, async () => {
|
|
||||||
try {
|
|
||||||
showLoader();
|
|
||||||
await http.delete(config.API.transfer + `/admin/${id}`);
|
|
||||||
await fetchData();
|
|
||||||
success($q, "ลบข้อมูลสำเร็จ");
|
|
||||||
} catch (error) {
|
|
||||||
messageError($q, error);
|
|
||||||
} finally {
|
|
||||||
hideLoader();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ทำงานเมื่อ Components ถูกเรียกใช้งาน
|
* ทำงานเมื่อ Components ถูกเรียกใช้งาน
|
||||||
* จะเรียกใช้ fetchData เพื่อดึงข้อมูลรายการขอโอน
|
* จะเรียกใช้ fetchData เพื่อดึงข้อมูลรายการขอโอน
|
||||||
|
|
@ -369,18 +337,6 @@ onMounted(async () => {
|
||||||
>
|
>
|
||||||
<q-tooltip>รายละเอียด</q-tooltip>
|
<q-tooltip>รายละเอียด</q-tooltip>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
|
|
||||||
<q-btn
|
|
||||||
v-if="isPermissionDelete(props.row.status)"
|
|
||||||
flat
|
|
||||||
round
|
|
||||||
dense
|
|
||||||
icon="mdi-delete"
|
|
||||||
color="red"
|
|
||||||
@click.prevent="handleDelete(props.row.id)"
|
|
||||||
>
|
|
||||||
<q-tooltip>ลบข้อมูล</q-tooltip>
|
|
||||||
</q-btn>
|
|
||||||
</q-td>
|
</q-td>
|
||||||
<q-td v-for="col in props.cols" :key="col.id">
|
<q-td v-for="col in props.cols" :key="col.id">
|
||||||
<div v-if="col.name === 'no'">
|
<div v-if="col.name === 'no'">
|
||||||
|
|
|
||||||
|
|
@ -313,7 +313,7 @@ function openDelete(id: string) {
|
||||||
dialogRemove($q, async () => {
|
dialogRemove($q, async () => {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.delete(config.API.receiveData() + `/admin/${id}`)
|
.delete(config.API.receiveDataId(id))
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
await fecthlistRecevice();
|
await fecthlistRecevice();
|
||||||
await success($q, "ลบข้อมูลสำเร็จ");
|
await success($q, "ลบข้อมูลสำเร็จ");
|
||||||
|
|
@ -606,10 +606,8 @@ onMounted(async () => {
|
||||||
|
|
||||||
<q-item
|
<q-item
|
||||||
v-if="
|
v-if="
|
||||||
checkPermission($route)?.attrOwnership ===
|
checkPermission($route)?.attrIsDelete &&
|
||||||
'OWNER' &&
|
|
||||||
props.row.status !== 'REPORT' &&
|
props.row.status !== 'REPORT' &&
|
||||||
props.row.status !== 'WAITING' &&
|
|
||||||
props.row.status !== 'DONE'
|
props.row.status !== 'DONE'
|
||||||
"
|
"
|
||||||
clickable
|
clickable
|
||||||
|
|
|
||||||
|
|
@ -236,7 +236,8 @@ function openModalOrder() {
|
||||||
item.status == "APPROVE") &&
|
item.status == "APPROVE") &&
|
||||||
item.organizationPositionOld &&
|
item.organizationPositionOld &&
|
||||||
item.organization &&
|
item.organization &&
|
||||||
item.dateStart
|
item.dateStart &&
|
||||||
|
item.dateEnd
|
||||||
);
|
);
|
||||||
rows2.value = row;
|
rows2.value = row;
|
||||||
rows2Data.value = row;
|
rows2Data.value = row;
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,7 @@ const {
|
||||||
showLoader,
|
showLoader,
|
||||||
hideLoader,
|
hideLoader,
|
||||||
onSearchDataTable,
|
onSearchDataTable,
|
||||||
dialogRemove,
|
findOrgName,
|
||||||
success,
|
|
||||||
} = mixin;
|
} = mixin;
|
||||||
|
|
||||||
/** Table */
|
/** Table */
|
||||||
|
|
@ -258,21 +257,6 @@ function onSearch() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleDelete(id: string) {
|
|
||||||
dialogRemove($q, async () => {
|
|
||||||
try {
|
|
||||||
showLoader();
|
|
||||||
await http.delete(config.API.listResign() + `/admin/${id}`);
|
|
||||||
await fecthlist();
|
|
||||||
success($q, "ลบข้อมูลสำเร็จ");
|
|
||||||
} catch (error) {
|
|
||||||
messageError($q, error);
|
|
||||||
} finally {
|
|
||||||
hideLoader();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**Hook */
|
/**Hook */
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
status.value = stroeResign.formQurey.status;
|
status.value = stroeResign.formQurey.status;
|
||||||
|
|
@ -324,11 +308,7 @@ onMounted(async () => {
|
||||||
color="primary"
|
color="primary"
|
||||||
icon="mdi-account-arrow-right"
|
icon="mdi-account-arrow-right"
|
||||||
>
|
>
|
||||||
<q-tooltip>{{
|
<q-tooltip>{{ `ส่งไปออกคำสั่ง${stroeResign.mainTabs == '2'?"ยกเลิกการ":''}ลาออก` }}</q-tooltip>
|
||||||
`ส่งไปออกคำสั่ง${
|
|
||||||
stroeResign.mainTabs == "2" ? "ยกเลิกการ" : ""
|
|
||||||
}ลาออก`
|
|
||||||
}}</q-tooltip>
|
|
||||||
</q-btn>
|
</q-btn>
|
||||||
</div>
|
</div>
|
||||||
<q-space />
|
<q-space />
|
||||||
|
|
@ -413,26 +393,6 @@ onMounted(async () => {
|
||||||
>
|
>
|
||||||
<q-tooltip>แก้ไขข้อมูล</q-tooltip>
|
<q-tooltip>แก้ไขข้อมูล</q-tooltip>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
|
|
||||||
<q-btn
|
|
||||||
v-if="
|
|
||||||
checkPermission($route)?.attrOwnership === 'OWNER' &&
|
|
||||||
props.row.status !== 'REPORT' &&
|
|
||||||
props.row.status !== 'WAITING' &&
|
|
||||||
props.row.status !== 'DONE' &&
|
|
||||||
props.row.status !== 'CANCELING' &&
|
|
||||||
props.row.status !== 'CANCEL' &&
|
|
||||||
stroeResign.mainTabs === '1'
|
|
||||||
"
|
|
||||||
flat
|
|
||||||
dense
|
|
||||||
round
|
|
||||||
color="red"
|
|
||||||
icon="delete"
|
|
||||||
@click.prevent="handleDelete(props.row.id)"
|
|
||||||
>
|
|
||||||
<q-tooltip>ลบข้อมูล</q-tooltip>
|
|
||||||
</q-btn>
|
|
||||||
</q-td>
|
</q-td>
|
||||||
<q-td v-for="col in props.cols" :key="col.id">
|
<q-td v-for="col in props.cols" :key="col.id">
|
||||||
<div
|
<div
|
||||||
|
|
|
||||||
|
|
@ -27,15 +27,8 @@ const stroeResign = useDataStore();
|
||||||
const { statusText } = stroe;
|
const { statusText } = stroe;
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const {
|
const { messageError, date2Thai, showLoader, hideLoader, onSearchDataTable } =
|
||||||
messageError,
|
mixin;
|
||||||
date2Thai,
|
|
||||||
showLoader,
|
|
||||||
hideLoader,
|
|
||||||
onSearchDataTable,
|
|
||||||
dialogRemove,
|
|
||||||
success,
|
|
||||||
} = mixin;
|
|
||||||
|
|
||||||
/** Table */
|
/** Table */
|
||||||
const rows = ref<ResponseItems[]>([]);
|
const rows = ref<ResponseItems[]>([]);
|
||||||
|
|
@ -136,7 +129,7 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: "status",
|
field: "status",
|
||||||
format(val, row) {
|
format(val, row) {
|
||||||
return stroeResign.mainTabsEMP === "1"
|
return stroeResign.mainTabs === "1"
|
||||||
? statusText(row.status)
|
? statusText(row.status)
|
||||||
: statusText(row.status, "อนุญาต");
|
: statusText(row.status, "อนุญาต");
|
||||||
},
|
},
|
||||||
|
|
@ -259,21 +252,6 @@ function onSearch() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleDelete(id: string) {
|
|
||||||
dialogRemove($q, async () => {
|
|
||||||
try {
|
|
||||||
showLoader();
|
|
||||||
await http.delete(config.API.listResignEMP() + `/admin/${id}`);
|
|
||||||
await fecthlist();
|
|
||||||
success($q, "ลบข้อมูลสำเร็จ");
|
|
||||||
} catch (error) {
|
|
||||||
messageError($q, error);
|
|
||||||
} finally {
|
|
||||||
hideLoader();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**Hook */
|
/**Hook */
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
statusEMP.value = stroeResign.formQureyEMP.status;
|
statusEMP.value = stroeResign.formQureyEMP.status;
|
||||||
|
|
@ -413,26 +391,6 @@ onMounted(async () => {
|
||||||
>
|
>
|
||||||
<q-tooltip>แก้ไขข้อมูล</q-tooltip>
|
<q-tooltip>แก้ไขข้อมูล</q-tooltip>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
|
|
||||||
<q-btn
|
|
||||||
v-if="
|
|
||||||
checkPermission($route)?.attrOwnership === 'OWNER' &&
|
|
||||||
props.row.status !== 'REPORT' &&
|
|
||||||
props.row.status !== 'WAITING' &&
|
|
||||||
props.row.status !== 'DONE' &&
|
|
||||||
props.row.status !== 'CANCELING' &&
|
|
||||||
props.row.status !== 'CANCEL' &&
|
|
||||||
stroeResign.mainTabsEMP === '1'
|
|
||||||
"
|
|
||||||
flat
|
|
||||||
dense
|
|
||||||
round
|
|
||||||
color="red"
|
|
||||||
icon="delete"
|
|
||||||
@click.prevent="handleDelete(props.row.id)"
|
|
||||||
>
|
|
||||||
<q-tooltip>ลบข้อมูล</q-tooltip>
|
|
||||||
</q-btn>
|
|
||||||
</q-td>
|
</q-td>
|
||||||
<q-td v-for="col in props.cols" :key="col.id">
|
<q-td v-for="col in props.cols" :key="col.id">
|
||||||
<div
|
<div
|
||||||
|
|
|
||||||
|
|
@ -1,59 +1,17 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, computed } from "vue";
|
import { ref, onMounted, watch } from "vue";
|
||||||
import { useQuasar } from "quasar";
|
|
||||||
import type { QTableProps } from "quasar";
|
import type { QTableProps } from "quasar";
|
||||||
import { useRouter, useRoute } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
|
|
||||||
import { checkPermission } from "@/utils/permissions";
|
import { checkPermission } from "@/utils/permissions";
|
||||||
import { useLeavelistDataStore } from "@/modules/09_leave/stores/LeaveStore";
|
import { useLeavelistDataStore } from "@/modules/09_leave/stores/LeaveStore";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
|
||||||
import http from "@/plugins/http";
|
|
||||||
import config from "@/app.config";
|
|
||||||
|
|
||||||
const $q = useQuasar();
|
|
||||||
const leaveStore = useLeavelistDataStore();
|
const leaveStore = useLeavelistDataStore();
|
||||||
const route = useRoute();
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { showLoader, hideLoader, messageError, dialogRemove, success } =
|
|
||||||
useCounterMixin();
|
|
||||||
|
|
||||||
const total = defineModel<number>("total", { required: true });
|
const total = defineModel<number>("total", { required: true });
|
||||||
const totalList = defineModel<number>("totalList", { required: true });
|
const totalList = defineModel<number>("totalList", { required: true });
|
||||||
const pagination = defineModel<any>("pagination", { required: true });
|
const pagination = defineModel<any>("pagination", { required: true });
|
||||||
const props = defineProps({
|
|
||||||
getList: Function,
|
|
||||||
rows: {
|
|
||||||
type: Object,
|
|
||||||
require: true,
|
|
||||||
},
|
|
||||||
page: {
|
|
||||||
type: Number,
|
|
||||||
require: true,
|
|
||||||
},
|
|
||||||
rowsPerPage: {
|
|
||||||
type: Number,
|
|
||||||
require: true,
|
|
||||||
},
|
|
||||||
maxPage: {
|
|
||||||
type: Number,
|
|
||||||
require: true,
|
|
||||||
},
|
|
||||||
totalList: {
|
|
||||||
type: Number,
|
|
||||||
require: true,
|
|
||||||
},
|
|
||||||
dataToobar: Object,
|
|
||||||
});
|
|
||||||
|
|
||||||
const isPermissionDelete = computed(() => {
|
|
||||||
return (status: string) => {
|
|
||||||
return (
|
|
||||||
checkPermission(route)?.attrOwnership === "OWNER" &&
|
|
||||||
!leaveStore.statusDelete.includes(status) &&
|
|
||||||
leaveStore.tabMenu === "1"
|
|
||||||
);
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
/** ข้อมูลหัวตาราง รายการลา */
|
/** ข้อมูลหัวตาราง รายการลา */
|
||||||
const columnsLeave = ref<QTableProps["columns"]>([
|
const columnsLeave = ref<QTableProps["columns"]>([
|
||||||
|
|
@ -254,6 +212,31 @@ const visibleReject = ref<string[]>([
|
||||||
"status",
|
"status",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
getList: Function,
|
||||||
|
rows: {
|
||||||
|
type: Object,
|
||||||
|
require: true,
|
||||||
|
},
|
||||||
|
page: {
|
||||||
|
type: Number,
|
||||||
|
require: true,
|
||||||
|
},
|
||||||
|
rowsPerPage: {
|
||||||
|
type: Number,
|
||||||
|
require: true,
|
||||||
|
},
|
||||||
|
maxPage: {
|
||||||
|
type: Number,
|
||||||
|
require: true,
|
||||||
|
},
|
||||||
|
totalList: {
|
||||||
|
type: Number,
|
||||||
|
require: true,
|
||||||
|
},
|
||||||
|
dataToobar: Object,
|
||||||
|
});
|
||||||
|
|
||||||
/** ไปหน้ารายละเอียด */
|
/** ไปหน้ารายละเอียด */
|
||||||
function redirectToDetail(id: string) {
|
function redirectToDetail(id: string) {
|
||||||
const routePrefix = leaveStore.tabMenu === "1" ? "/leave" : "/leave-reject";
|
const routePrefix = leaveStore.tabMenu === "1" ? "/leave" : "/leave-reject";
|
||||||
|
|
@ -281,21 +264,6 @@ function getStatusColor(statusText: string) {
|
||||||
return statusMap[statusText.toUpperCase()] ?? "";
|
return statusMap[statusText.toUpperCase()] ?? "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleDelete(id: string) {
|
|
||||||
dialogRemove($q, async () => {
|
|
||||||
try {
|
|
||||||
showLoader();
|
|
||||||
await http.delete(config.API.leaveList() + `/${id}`);
|
|
||||||
await props.getList?.();
|
|
||||||
success($q, "ลบข้อมูลสำเร็จ");
|
|
||||||
} catch (error) {
|
|
||||||
messageError($q, error);
|
|
||||||
} finally {
|
|
||||||
hideLoader();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Hook*/
|
/** Hook*/
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (leaveStore.tabMenu === "1") {
|
if (leaveStore.tabMenu === "1") {
|
||||||
|
|
@ -345,17 +313,6 @@ onMounted(() => {
|
||||||
>
|
>
|
||||||
<q-tooltip>รายละเอียด</q-tooltip>
|
<q-tooltip>รายละเอียด</q-tooltip>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
<q-btn
|
|
||||||
v-if="isPermissionDelete(props.row.statusText)"
|
|
||||||
flat
|
|
||||||
round
|
|
||||||
dense
|
|
||||||
icon="mdi-delete"
|
|
||||||
color="red"
|
|
||||||
@click.prevent="handleDelete(props.row.id)"
|
|
||||||
>
|
|
||||||
<q-tooltip>ลบข้อมูล</q-tooltip>
|
|
||||||
</q-btn>
|
|
||||||
</q-td>
|
</q-td>
|
||||||
<q-td
|
<q-td
|
||||||
v-for="col in props.cols"
|
v-for="col in props.cols"
|
||||||
|
|
|
||||||
|
|
@ -44,8 +44,6 @@ export const useLeavelistDataStore = defineStore("leave", () => {
|
||||||
|
|
||||||
const leaveType = ref<LeaveType[]>([]);
|
const leaveType = ref<LeaveType[]>([]);
|
||||||
|
|
||||||
const statusDelete = ["APPROVE", "DELETING", "DELETE"];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ฟังก์ชั่น fetchListLeave
|
* ฟังก์ชั่น fetchListLeave
|
||||||
* @param data รับข้อมูลจาก Page
|
* @param data รับข้อมูลจาก Page
|
||||||
|
|
@ -266,6 +264,5 @@ export const useLeavelistDataStore = defineStore("leave", () => {
|
||||||
leaveTypeOption,
|
leaveTypeOption,
|
||||||
leaveTypeList,
|
leaveTypeList,
|
||||||
fetchKeycloakPosition,
|
fetchKeycloakPosition,
|
||||||
statusDelete,
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue