diff --git a/src/modules/02_transfer/views/AddTransfer.vue b/src/modules/02_transfer/views/AddTransfer.vue index c8edbc7..8e3af26 100644 --- a/src/modules/02_transfer/views/AddTransfer.vue +++ b/src/modules/02_transfer/views/AddTransfer.vue @@ -40,6 +40,7 @@ label="เอกสารเพิ่มเติม" type="file" @added="fileUploadDoc" + @removed="filesNull" /> @@ -87,6 +88,10 @@ onMounted(() => { } }) +const filesNull = () => { + files.value = null +} + const saveData = async () => { console.log(myform.value) if (myform.value != null) { @@ -109,12 +114,14 @@ const saveTransfer = () => { persistent: true, }) .onOk(async () => { - createTransfer() + if (files.value == undefined) { + fails($q, "กรุณากรอกอัพโหลดเอกสารเพิ่มเติม") + } else { + createTransfer() + } }) .onCancel(() => {}) - .onDismiss(() => { - fails($q, "กรุณากรอกอัพโหลดเอกสารเพิ่มเติม") - }) + .onDismiss(() => {}) } const createTransfer = async () => { diff --git a/src/modules/03_leave/views/AddLeave.vue b/src/modules/03_leave/views/AddLeave.vue index bf71d0a..59cf9e8 100644 --- a/src/modules/03_leave/views/AddLeave.vue +++ b/src/modules/03_leave/views/AddLeave.vue @@ -99,6 +99,7 @@ label="เอกสารเพิ่มเติม" type="file" @added="fileUploadDoc" + @removed="filesNull" style="max-width: px" /> @@ -155,6 +156,7 @@ {{ dataDetail.oligarchRejectDate !== null ? date2Thai(dataDetail.oligarchRejectDate) : "-" }} + {{ files }}
ความคิดเห็นและเหตุผล
@@ -240,6 +242,10 @@ const statusOrder = (val: boolean) => { } } +const filesNull = () => { + files.value = null +} + onMounted(() => { if (route.params.id !== undefined) { id.value = route.params.id.toString() @@ -258,6 +264,13 @@ const saveData = async () => { } } +const fileUploadDoc = async (file: any) => { + fileDocDataUpload.value.push(file) + nameFile.value = file[0].name + files.value = file + console.log(files.value) +} + const saveResing = () => { $q.dialog({ title: "ยืนยันการยื่นข้อมูลแบบสอบถาม", @@ -269,11 +282,18 @@ const saveResing = () => { persistent: true, }) .onOk(async () => { - createFormresign() + console.log("ok") + if (files.value == undefined) { + fails($q, "กรุณากรอกอัพโหลดเอกสารเพิ่มเติม") + } else { + createFormresign() + } + }) + .onCancel(() => { + console.log("test") }) - .onCancel(() => {}) .onDismiss(() => { - fails($q, "กรุณากรอกอัพโหลดเอกสารเพิ่มเติม") + console.log("dis") }) } @@ -361,10 +381,4 @@ const fectDataresign = async (id: string) => { hideLoader() }) } - -const fileUploadDoc = async (file: any) => { - fileDocDataUpload.value.push(file) - nameFile.value = file[0].name - files.value = file -} diff --git a/src/modules/03_leave/views/result.vue b/src/modules/03_leave/views/result.vue index 636686d..3d31e6f 100644 --- a/src/modules/03_leave/views/result.vue +++ b/src/modules/03_leave/views/result.vue @@ -24,7 +24,7 @@ const adjust = ref([]) const timeThink = ref([]) const realReason = ref("") const notExitFactor = ref("") -const haveJob = ref("") +const haveJob = ref([]) const suggestFriends = ref([]) const futureWork = ref([]) const suggestion = ref("") @@ -105,24 +105,28 @@ const adjust_option = ref([ { label: "อื่น ๆ (ระบุ) ", value: 15 }, ]) const saveForm = () => { + console.log(reasonWork.value.filter((x: any) => x == 12)) + console.log(reasonWork.value) + console.log(haveJob.value.length) + let hasError = false if ( - (reasonWork.value === 0 && - reasonWorkOther.value.length < 1) || - timeThink.value === 0 || - (exitFactor.value === 0 && - exitFactorOther.value.length < 1) || - (adjust.value === 0 && - adjustOther.value.length < 1 ) || - realReason.value.length < 1 || - notExitFactor.value.length < 1 || - (haveJob.value === null && - haveJobReason.value.length < 1 )|| - (suggestFriends.value === null && - suggestFriendsReason.value.length < 1) || - (futureWork.value === null && - futureWorkReason.value.length < 1 )|| - suggestion.value.length < 1 + reasonWork.value.length === 0 || + (reasonWork.value.filter((x: any) => x == 12).length > 0 && (reasonWorkOther.value == null || reasonWorkOther.value == "")) || + timeThink.value.length === 0 || + exitFactor.value.length === 0 || + (exitFactor.value.filter((x: any) => x == 15).length > 0 && (exitFactorOther.value == null || exitFactorOther.value == "")) || + adjust.value.length === 0 || + (adjust.value.filter((x: any) => x == 15).length > 0 && (adjustOther.value == null || adjustOther.value == "")) || + realReason.value.length < 1 || + notExitFactor.value.length < 1 || + haveJob.value.length === 0 || + (haveJob.value === 0 && (haveJobReason.value == null || haveJobReason.value == "")) || + suggestFriends.value.length === 0 || + (suggestFriends.value === 1 && (suggestFriendsReason.value == null || suggestFriendsReason.value == "")) || + futureWork.value.length === 0 || + (futureWork.value === 1 && (futureWorkReason.value == null || futureWorkReason.value == "")) || + suggestion.value.length < 1 ) { hasError = true } else { @@ -185,7 +189,7 @@ const createResult = async () => { SuggestFriendsReason: suggestFriendsReason.value, FutureWork: futureWork.value, FutureWorkReason: futureWorkReason.value, - Suggestion:suggestion.value + Suggestion: suggestion.value, } await http .post(config.API.listquestionnaire(), data)