diff --git a/src/modules/05_placement/store.ts b/src/modules/05_placement/store.ts index af28e52c2..2dd18e96d 100644 --- a/src/modules/05_placement/store.ts +++ b/src/modules/05_placement/store.ts @@ -10,25 +10,25 @@ import type { } from "@/modules/05_placement/interface/request/Main"; import type { FormOrderPlacementMainData } from "@/modules/05_placement/interface/request/Main"; -export const useProfileDataStore = defineStore("profilePlacenent", () => { - interface profile { - main: { columns: String[] }; - education: { columns: String[] }; - certicate: { columns: String[] }; - train: { columns: String[] }; - insignia: { columns: String[] }; - coined: { columns: String[] }; - assessment: { columns: String[] }; - salary: { columns: String[] }; - discipline: { columns: String[] }; - leave: { columns: String[] }; - talent: { columns: String[] }; - work: { columns: String[] }; - record: { columns: String[] }; - other: { columns: String[] }; - document: { columns: String[] }; - } +interface profile { + main: { columns: String[] }; + education: { columns: String[] }; + certicate: { columns: String[] }; + train: { columns: String[] }; + insignia: { columns: String[] }; + coined: { columns: String[] }; + assessment: { columns: String[] }; + salary: { columns: String[] }; + discipline: { columns: String[] }; + leave: { columns: String[] }; + talent: { columns: String[] }; + work: { columns: String[] }; + record: { columns: String[] }; + other: { columns: String[] }; + document: { columns: String[] }; +} +export const useProfileDataStore = defineStore("profilePlacenent", () => { const birthDate = ref(new Date()); const retireText = ref(null); const changeRetireText = (val: string | null) => { @@ -87,15 +87,15 @@ export const useProfileDataStore = defineStore("profilePlacenent", () => { changeRetireText, }; }); +interface placement { + mappingPosition: { columns: String[] }; +} export const usePlacementDataStore = defineStore("placement", () => { const mixin = useCounterMixin(); //เรียกฟังก์ชันกลาง const tabsMain = ref("probation"); const isOfficer = ref(null); const isStaff = ref(null); const { hideLoader } = mixin; - interface placement { - mappingPosition: { columns: String[] }; - } const placementData = ref({ mappingPosition: { columns: [] }, }); @@ -218,10 +218,10 @@ export const usePlacementDataStore = defineStore("placement", () => { isStaff, }; }); +interface placementOrder { + mappingPosition: { columns: String[] }; +} export const useOrderPlacementDataStore = defineStore("placementOrder", () => { - interface placementOrder { - mappingPosition: { columns: String[] }; - } const placementOrderData = ref({ mappingPosition: { columns: [] }, }); @@ -369,6 +369,8 @@ export const useTransferDataStore = defineStore("transferDataStore", () => { ]); const statusOp = ref(statusMainOp.value); + const statusDelete = ["REPORT", "WAITING", "DONE"]; + const statusText = (val: string) => { switch (val) { case "WAITTING": @@ -438,5 +440,6 @@ export const useTransferDataStore = defineStore("transferDataStore", () => { statusOp, statusMainOp, filterOption, + statusDelete, }; }); diff --git a/src/modules/05_placement/views/02_transferMain.vue b/src/modules/05_placement/views/02_transferMain.vue index efd36dc90..181222caa 100644 --- a/src/modules/05_placement/views/02_transferMain.vue +++ b/src/modules/05_placement/views/02_transferMain.vue @@ -2,7 +2,7 @@ import { ref, onMounted, computed } from "vue"; import { useQuasar } from "quasar"; -import { useRouter } from "vue-router"; +import { useRouter, useRoute } from "vue-router"; import { checkPermission, checkPermissionList, @@ -20,11 +20,19 @@ import DialogOrders from "@/modules/05_placement/components/Transfer/DialogOrder const $q = useQuasar(); const router = useRouter(); +const route = useRoute(); const mixin = useCounterMixin(); const store = useTransferDataStore(); const { statusText, filterOption } = useTransferDataStore(); -const { date2Thai, messageError, showLoader, hideLoader, onSearchDataTable } = - mixin; +const { + date2Thai, + messageError, + showLoader, + hideLoader, + onSearchDataTable, + dialogRemove, + success, +} = mixin; const modal = ref(false); //ส่งไปออกคำสั่ง const dataTransfer = ref([]); //ช่อมูลรายการขอโอน @@ -141,6 +149,15 @@ const visibleColumns = ref([ "createdAt", ]); +const isPermissionDelete = computed(() => { + return (status: string) => { + return ( + checkPermission(route)?.attrOwnership === "OWNER" && + !store.statusDelete.includes(status) + ); + }; +}); + /** ฟังก์ชันดึงข้อมูรายการขอโอน*/ async function fetchData() { showLoader(); @@ -194,6 +211,21 @@ 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 ถูกเรียกใช้งาน * จะเรียกใช้ fetchData เพื่อดึงข้อมูลรายการขอโอน @@ -337,6 +369,18 @@ onMounted(async () => { > รายละเอียด + + + ลบข้อมูล +
diff --git a/src/modules/05_placement/views/03_receiveMain.vue b/src/modules/05_placement/views/03_receiveMain.vue index ddfa21175..2541ce000 100644 --- a/src/modules/05_placement/views/03_receiveMain.vue +++ b/src/modules/05_placement/views/03_receiveMain.vue @@ -313,7 +313,7 @@ function openDelete(id: string) { dialogRemove($q, async () => { showLoader(); await http - .delete(config.API.receiveDataId(id)) + .delete(config.API.receiveData() + `/admin/${id}`) .then(async () => { await fecthlistRecevice(); await success($q, "ลบข้อมูลสำเร็จ"); @@ -606,8 +606,10 @@ onMounted(async () => { { + try { + showLoader(); + await http.delete(config.API.listResign() + `/admin/${id}`); + await fecthlist(); + success($q, "ลบข้อมูลสำเร็จ"); + } catch (error) { + messageError($q, error); + } finally { + hideLoader(); + } + }); +} + /**Hook */ onMounted(async () => { status.value = stroeResign.formQurey.status; @@ -308,7 +324,11 @@ onMounted(async () => { color="primary" icon="mdi-account-arrow-right" > - {{ `ส่งไปออกคำสั่ง${stroeResign.mainTabs == '2'?"ยกเลิกการ":''}ลาออก` }} + {{ + `ส่งไปออกคำสั่ง${ + stroeResign.mainTabs == "2" ? "ยกเลิกการ" : "" + }ลาออก` + }}
@@ -393,6 +413,26 @@ onMounted(async () => { > แก้ไขข้อมูล + + + ลบข้อมูล +
([]); @@ -129,7 +136,7 @@ const columns = ref([ sortable: true, field: "status", format(val, row) { - return stroeResign.mainTabs === "1" + return stroeResign.mainTabsEMP === "1" ? statusText(row.status) : statusText(row.status, "อนุญาต"); }, @@ -252,6 +259,21 @@ 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 */ onMounted(async () => { statusEMP.value = stroeResign.formQureyEMP.status; @@ -391,6 +413,26 @@ onMounted(async () => { > แก้ไขข้อมูล + + + ลบข้อมูล +
("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)" > - รายละเอียด + ลบข้อมูล