diff --git a/src/modules/02_organizationalNew/components/DialogFormPosition.vue b/src/modules/02_organizationalNew/components/DialogFormPosition.vue index c82cea922..cadb32bd5 100644 --- a/src/modules/02_organizationalNew/components/DialogFormPosition.vue +++ b/src/modules/02_organizationalNew/components/DialogFormPosition.vue @@ -41,7 +41,7 @@ const isReadonly = ref(false); // อ่านได้อย่าง const isDisValidate = ref(false); const isPosition = ref(false); const succession = ref(false); -const dataCopy = ref() +const dataCopy = ref(); const $q = useQuasar(); const mixin = useCounterMixin(); const { @@ -51,7 +51,7 @@ const { messageError, success, dialogRemove, - dialogMessageNotify + dialogMessageNotify, } = mixin; const selected = ref([]); const search = ref(""); @@ -315,31 +315,31 @@ function validateForm() { } } if (hasError.every((result) => result === true)) { - if(rows.value.length == 0 ){ - dialogMessageNotify($q,'กรุณาเลือกตำแหน่งอย่างน้อย 1 ตำแหน่ง') - }else{ + if (rows.value.length == 0) { + dialogMessageNotify($q, "กรุณาเลือกตำแหน่งอย่างน้อย 1 ตำแหน่ง"); + } else { onSubmit(); } - } + } } /** ฟังก์ชั่นตรวจสอบความถูกต้องของข้อมูลในฟอร์ม */ -function validateFormPositionEdit() { - isDisValidate.value = false; - const hasError = []; - for (const key in objectPositionSelectRef) { - if (Object.prototype.hasOwnProperty.call(objectPositionSelectRef, key)) { - const property = objectPositionSelectRef[key]; - if (property.value && typeof property.value.validate === "function") { - const isValid = property.value.validate(); - hasError.push(isValid); - } - } - } - if (hasError.every((result) => result === true)) { - onSubmitSelectEdit(); - } -} +// function validateFormPositionEdit() { +// isDisValidate.value = false; +// const hasError = []; +// for (const key in objectPositionSelectRef) { +// if (Object.prototype.hasOwnProperty.call(objectPositionSelectRef, key)) { +// const property = objectPositionSelectRef[key]; +// if (property.value && typeof property.value.validate === "function") { +// const isValid = property.value.validate(); +// hasError.push(isValid); +// } +// } +// } +// if (hasError.every((result) => result === true)) { +// onSubmitSelectEdit(); +// } +// } /** ฟังชั่น บันทึก */ function onSubmit() { @@ -363,6 +363,7 @@ function onSubmit() { orgChild3Id: props.orgLevel === 3 ? props.treeId : null, orgChild4Id: props.orgLevel === 4 ? props.treeId : null, positions: positionsData, + succession: succession.value, }; showLoader(); props.actionType === "ADD" @@ -404,46 +405,46 @@ function onSubmit() { }); } /** ฟังชั่น บันทึก */ -function onSubmitSelectEdit() { - dialogConfirm( - $q, - async () => { - showLoader(); - const body = { - posDictName: formPositionSelect.positionName, - posDictField: formPositionSelect.positionField, //สายงาน - posTypeId: formPositionSelect.positionType, //*ประเภทตำแหน่ง - posLevelId: formPositionSelect.positionLevel, //*ระดับตำแหน่ง - posExecutiveId: - formPositionSelect.positionExecutive !== "" - ? formPositionSelect.positionExecutive - : null, //ตำแหน่งทางการบริหาร - posDictExecutiveField: formPositionSelect.positionExecutiveField, //ด้านทางการบริหาร - posDictArea: formPositionSelect.positionArea, //ด้าน/สาขา - }; - await http - .post(config.API.orgPosPosition, body) - .then(() => { - success($q, "เพิ่มข้อมูลสำเร็จ"); +// function onSubmitSelectEdit() { +// dialogConfirm( +// $q, +// async () => { +// showLoader(); +// const body = { +// posDictName: formPositionSelect.positionName, +// posDictField: formPositionSelect.positionField, //สายงาน +// posTypeId: formPositionSelect.positionType, //*ประเภทตำแหน่ง +// posLevelId: formPositionSelect.positionLevel, //*ระดับตำแหน่ง +// posExecutiveId: +// formPositionSelect.positionExecutive !== "" +// ? formPositionSelect.positionExecutive +// : null, //ตำแหน่งทางการบริหาร +// posDictExecutiveField: formPositionSelect.positionExecutiveField, //ด้านทางการบริหาร +// posDictArea: formPositionSelect.positionArea, //ด้าน/สาขา +// }; +// await http +// .post(config.API.orgPosPosition, body) +// .then(() => { +// success($q, "เพิ่มข้อมูลสำเร็จ"); - clearFormPositionSelect(); - }) - .catch((err) => { - messageError($q, err); - }) - .finally(() => { - hideLoader(); - }); - }, - "ยืนยันการเพิ่มตำแหน่ง", - "ต้องการยืนยันการเพิ่มตำแหน่งนี้ใช่หรือไม่?" - ); -} +// clearFormPositionSelect(); +// }) +// .catch((err) => { +// messageError($q, err); +// }) +// .finally(() => { +// hideLoader(); +// }); +// }, +// "ยืนยันการเพิ่มตำแหน่ง", +// "ต้องการยืนยันการเพิ่มตำแหน่งนี้ใช่หรือไม่?" +// ); +// } /** input ค้นหา */ const searchRef = ref(null); async function searchInput() { - console.log(1) + console.log(1); searchRef.value.validate(); if (!searchRef.value.hasError) { showLoader(); @@ -464,24 +465,23 @@ async function searchInput() { } } -function updateSelectType(val: string) { - const listLevel = dataLevel.value.find((e: any) => e.id === val); - levelOpsMain.value = listLevel.posLevels.map((e: OptionLevel) => ({ - id: e.id, - name: e.posLevelName, - })); - levelOps.value = levelOpsMain.value; - formPositionSelect.positionLevel = ""; -} +// function updateSelectType(val: string) { +// const listLevel = dataLevel.value.find((e: any) => e.id === val); +// levelOpsMain.value = listLevel.posLevels.map((e: OptionLevel) => ({ +// id: e.id, +// name: e.posLevelName, +// })); +// levelOps.value = levelOpsMain.value; +// formPositionSelect.positionLevel = ""; +// } /** * คัดลอกข้อมูล * @param data ข้อมูลตำแหน่ง */ function copyDetiail(data: RowDetailPositions) { - - modalAdd.value = true - dataCopy.value = data + modalAdd.value = true; + dataCopy.value = data; } /** @@ -573,8 +573,8 @@ function close() { async function emitSearch(keyword: string, typeSelect: string) { search.value = await keyword; type.value = await typeSelect; - - await searchInput(); + + await searchInput(); } @@ -708,11 +708,7 @@ async function emitSearch(keyword: string, typeSelect: string) { - diff --git a/src/modules/02_organizationalNew/components/DialogSelectPerson.vue b/src/modules/02_organizationalNew/components/DialogSelectPerson.vue index 03cc140c9..d99de44ee 100644 --- a/src/modules/02_organizationalNew/components/DialogSelectPerson.vue +++ b/src/modules/02_organizationalNew/components/DialogSelectPerson.vue @@ -555,11 +555,6 @@ watch([() => page.value, () => pageSize.value], () => { option-value="id" lazy-rules hide-bottom-space - :rules=" - !isDisValidate - ? [(val) => !!val || `${'กรุณาเลือกประเภทตำแหน่ง'}`] - : [] - " >