แก้ เงื่อนไข fix bug

This commit is contained in:
AnandaTon 2023-09-07 12:51:59 +07:00
parent 0bbf5cde0b
commit 855b4b6be8
3 changed files with 56 additions and 31 deletions

View file

@ -40,6 +40,7 @@
label="เอกสารเพิ่มเติม"
type="file"
@added="fileUploadDoc"
@removed="filesNull"
/>
</div>
</div>
@ -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 () => {

View file

@ -99,6 +99,7 @@
label="เอกสารเพิ่มเติม"
type="file"
@added="fileUploadDoc"
@removed="filesNull"
style="max-width: px"
/>
</div>
@ -155,6 +156,7 @@
{{ dataDetail.oligarchRejectDate !== null ? date2Thai(dataDetail.oligarchRejectDate) : "-" }}
</div>
</div>
{{ files }}
<div class="col-xs-12 row items-start">
<div class="col-12 text-top">ความคดเหนและเหตผล</div>
<div class="col-12 text-detail" v-if="dataDetail.oligarchReject == false">
@ -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
}
</script>

View file

@ -24,7 +24,7 @@ const adjust = ref<any>([])
const timeThink = ref<any>([])
const realReason = ref<any>("")
const notExitFactor = ref<any>("")
const haveJob = ref<any>("")
const haveJob = ref<any>([])
const suggestFriends = ref<any>([])
const futureWork = ref<any>([])
const suggestion = ref<any>("")
@ -105,24 +105,28 @@ const adjust_option = ref<any>([
{ 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)