diff --git a/src/api/leave/api.leave.ts b/src/api/leave/api.leave.ts index 86b790c..dbbf8be 100644 --- a/src/api/leave/api.leave.ts +++ b/src/api/leave/api.leave.ts @@ -27,7 +27,8 @@ export default { leaveCheck: () => `${leave}/user/check`, leaveReport: (id: string) => `${leave}/report/${id}`, leaveSendReport: () => `${leave}/report-template/docx`, - leaveDocumentId: (id: string) => `${leave}/user/file/document/${id}`, + leaveDocumentId: (id: string, docId: string) => + `${leave}/user/file/document/${id}/${docId}`, listHolidayHistoryYearMonth: (year: number, month: number) => `${holiday}${year}/${month}`, diff --git a/src/modules/05_leave/components/FormLeave/01_SickForm.vue b/src/modules/05_leave/components/FormLeave/01_SickForm.vue index b4fd5e7..1571a92 100644 --- a/src/modules/05_leave/components/FormLeave/01_SickForm.vue +++ b/src/modules/05_leave/components/FormLeave/01_SickForm.vue @@ -33,6 +33,10 @@ const props = defineProps({ type: Function, default: () => "", }, + clickDelete: { + type: Function, + default: () => "", + }, }); /** ข้อมูล v-model ของฟอร์ม */ @@ -158,26 +162,6 @@ async function fetchCheck() { }); } -//เเจ้งเตือนลบข้อมูล -const clickDelete = (id: string) => { - dialogRemove($q, () => onClickDelete(id)); -}; - -/** - * function ลบรายการ - * @param id - */ -const onClickDelete = async (id: string) => { - await http - .delete(config.API.leaveDocumentId(id)) - .then(async (res) => { - console.log("delete"); - }) - .catch((err) => { - messageError($q, err); - }); -}; - /** * ฟังก์ชั่นแปลงครึ่งวัน/ทั้งวัน */ @@ -210,6 +194,7 @@ const dateEndInputStyle = computed(() => { return !isLeave.value ? "input-alert" : ""; }); +const leaveId = ref(""); /** ตรวจสอบว่ามีการส่งข้อมูลเข้ามาที่ฟอร์มไหม เมื่อมีการส่งจะ map ข้อมูลเข้า v-model ของฟอร์ม */ const statusCheck = ref(""); watch(props.data, () => { @@ -243,6 +228,7 @@ onMounted(() => { leaveDocumentList.value = props.data.leaveDocument; formDataSick.leaveAddress = props.data.leaveAddress; statusCheck.value = props.data.status; + leaveId.value = props.data.id; } }); @@ -532,7 +518,7 @@ onMounted(() => {
(true); +const leaveId = ref(""); /** รับ props มาจากหน้าหลัก */ const props = defineProps({ @@ -31,6 +32,10 @@ const props = defineProps({ type: Function, default: () => "", }, + clickDelete: { + type: Function, + default: () => "", + }, }); /** ข้อมูล v-model ของฟอร์ม */ @@ -143,26 +148,6 @@ const dateEndInputStyle = computed(() => { return !isLeave.value ? "input-alert" : ""; }); -//เเจ้งเตือนลบข้อมูล -const clickDelete = (id: string) => { - dialogRemove($q, () => onClickDelete(id)); -}; - -/** - * function ลบรายการ - * @param id - */ -const onClickDelete = async (id: string) => { - await http - .delete(config.API.leaveDocumentId(id)) - .then(async (res) => { - console.log("delete"); - }) - .catch((err) => { - messageError($q, err); - }); -}; - /** ตรวจสอบว่ามีการส่งข้อมูลเข้ามาที่ฟอร์มไหม เมื่อมีการส่งจะ map ข้อมูลเข้า v-model ของฟอร์ม */ const leaveDocumentList = ref(); const statusCheck = ref(""); @@ -193,6 +178,7 @@ onMounted(() => { formDataBirth.leaveDetail = props.data.leaveDetail; leaveDocumentList.value = props.data.leaveDocument; statusCheck.value = props.data.status; + leaveId.value = props.data.id; } }); @@ -455,7 +441,7 @@ onMounted(() => {
(true); +const leaveId = ref(""); /** รับ props มาจากหน้าหลัก */ const props = defineProps({ @@ -41,28 +42,12 @@ const props = defineProps({ type: Function, default: () => "", }, + clickDelete: { + type: Function, + default: () => "", + }, }); -//เเจ้งเตือนลบข้อมูล -const clickDelete = (id: string) => { - dialogRemove($q, () => onClickDelete(id)); -}; - -/** - * function ลบรายการ - * @param id - */ -const onClickDelete = async (id: string) => { - await http - .delete(config.API.leaveDocumentId(id)) - .then(async (res) => { - console.log("delete"); - }) - .catch((err) => { - messageError($q, err); - }); -}; - /** ข้อมูล v-model ของฟอร์ม */ const formDataHelpWife = reactive({ type: dataStore.typeId, @@ -229,6 +214,7 @@ onMounted(() => { formDataHelpWife.leaveDetail = props.data.leaveDetail; leaveDocumentList.value = props.data.leaveDocument; statusCheck.value = props.data.status; + leaveId.value = props.data.id; } }); @@ -539,7 +525,7 @@ onMounted(() => {
(true); +const leaveId = ref(""); /** รับ props มาจากหน้าหลัก */ const props = defineProps({ @@ -34,6 +35,10 @@ const props = defineProps({ type: Function, default: () => "", }, + clickDelete: { + type: Function, + default: () => "", + }, }); /** ข้อมูล v-model ของฟอร์ม */ @@ -127,26 +132,6 @@ function onValidate() { } } -//เเจ้งเตือนลบข้อมูล -const clickDelete = (id: string) => { - dialogRemove($q, () => onClickDelete(id)); -}; - -/** - * function ลบรายการ - * @param id - */ -const onClickDelete = async (id: string) => { - await http - .delete(config.API.leaveDocumentId(id)) - .then(async (res) => { - console.log("delete"); - }) - .catch((err) => { - messageError($q, err); - }); -}; - /** * check ว่าลาได้ไหม จาก api * @param formData @@ -241,6 +226,7 @@ onMounted(() => { leaveDocumentList.value = props.data.leaveDocument; statusCheck.value = props.data.status; formDataVacation.leaveRange = props.data.leaveRange; + leaveId.value = props.data.id; // formDataVacation.leaveDocument = props.data.leaveDocument; } }); @@ -538,7 +524,7 @@ onMounted(() => {
(true); const files = ref(null); +const leaveId = ref(""); /** รับ props มาจากหน้าหลัก */ const props = defineProps({ @@ -39,6 +40,10 @@ const props = defineProps({ type: Function, default: () => "", }, + clickDelete: { + type: Function, + default: () => "", + }, }); /** ตัวแปร ref สำหรับแสดง validate */ @@ -250,29 +255,10 @@ onMounted(() => { formDataOrdination.leaveDetail = props.data.leaveDetail; leaveDocumentList.value = props.data.leaveDocument; statusCheck.value = props.data.status; + leaveId.value = props.data.id; // formDataOrdination.leaveDocument = props.data.leaveDocument; } }); - -//เเจ้งเตือนลบข้อมูล -const clickDelete = (id: string) => { - dialogRemove($q, () => onClickDelete(id)); -}; - -/** - * function ลบรายการ - * @param id - */ -const onClickDelete = async (id: string) => { - await http - .delete(config.API.leaveDocumentId(id)) - .then(async (res) => { - console.log("delete"); - }) - .catch((err) => { - messageError($q, err); - }); -}; @@ -720,7 +706,7 @@ const onClickDelete = async (id: string) => {
(true); const files = ref(null); +const leaveId = ref(""); /** ตัวแปร ref สำหรับแสดง validate */ const leaveWroteRef = ref(null); @@ -46,6 +47,10 @@ const props = defineProps({ type: Function, default: () => "", }, + clickDelete: { + type: Function, + default: () => "", + }, }); /** ข้อมูล v-model ของฟอร์ม */ @@ -185,28 +190,9 @@ onMounted(() => { leaveDocumentList.value = props.data.leaveDocument; statusCheck.value = props.data.status; // formDataHaji.leaveDocument = props.data.leaveDocument; + leaveId.value = props.data.id; } }); - -//เเจ้งเตือนลบข้อมูล -const clickDelete = (id: string) => { - dialogRemove($q, () => onClickDelete(id)); -}; - -/** - * function ลบรายการ - * @param id - */ -const onClickDelete = async (id: string) => { - await http - .delete(config.API.leaveDocumentId(id)) - .then(async (res) => { - console.log("delete"); - }) - .catch((err) => { - messageError($q, err); - }); -};