diff --git a/src/modules/11_discipline/components/1_Complaint/Form.vue b/src/modules/11_discipline/components/1_Complaint/Form.vue index fa2465987..2a683e665 100644 --- a/src/modules/11_discipline/components/1_Complaint/Form.vue +++ b/src/modules/11_discipline/components/1_Complaint/Form.vue @@ -74,12 +74,6 @@ const props = defineProps({ }, }); -const fileListOj = reactive({ - id: "", - pathName: "", - fileName: "", -}); - const formData = reactive({ id: "", respondentType: "", @@ -261,20 +255,20 @@ async function fileUploadDoc(documentFile: any) { */ function selectLevel(val: string) { let dayNum = 0; - if (val == "3") { + if (val == "VERY_URGENT") { dayNum = 15; // ด่วนมาก - } else if (val == "1") { + } else if (val == "URGENT") { dayNum = 30; // ด่วน } else { dayNum = 45; // ปกติ } // วันแจ้งเตือนล่วงหน้า - if (formData.dateConsideration) { - const currentDate = new Date(formData.dateConsideration); + if (formData.dateReceived) { + const currentDate = new Date(formData.dateReceived); const newDate = new Date( currentDate.getTime() + dayNum * 24 * 60 * 60 * 1000 ); - formData.dateNotification = newDate; + formData.dateConsideration = newDate; } } @@ -410,6 +404,7 @@ function upLoadFileDoc() { async function addPerson(data: any) { toggleModal(); + changeFormData(); await complainstStore.fetchComplainstAdd(data); } @@ -425,20 +420,24 @@ function deletePerson(id: string) { } function removePerson(id: string) { - isSave.value = true; + changeFormData(); const dataRow = complainstStore.rowsAdd; const updatedRows = dataRow.filter((item: any) => item.personId !== id); complainstStore.rowsAdd = updatedRows; } -function getList() { +function getListChannel() { http.get(config.API.complaintListOp()).then((res) => { complaintFromtoptions.value = res.data.result.data; }); } +function changeFormData() { + isSave.value = props.data != null ?? true; +} + onMounted(() => { - getList(); + getListChannel(); getOc(); complainstStore.columns = columns.value; complainstStore.visibleColumns = visibleColumns.value; @@ -487,6 +486,7 @@ onMounted(() => { @filter="(inputValue: any, doneFn: Function) => filterSelector(inputValue, doneFn, 'filterrespondentType' )" + @update:model-value="changeFormData()" >