@@ -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)