From cf343f7b8f8971e2206632dacb584707ed6e2c1e Mon Sep 17 00:00:00 2001 From: Kittapath Date: Tue, 11 Jul 2023 10:41:31 +0700 Subject: [PATCH] no message --- .../04_registry/components/Assessment.vue | 102 +- src/modules/04_registry/components/Coin.vue | 94 +- .../04_registry/components/Discipline.vue | 98 +- .../04_registry/components/Document.vue | 94 +- .../04_registry/components/Education.vue | 152 +- .../components/Information/Address.vue | 51 +- .../components/Information/Certicate.vue | 48 +- .../components/Information/Family.vue | 66 +- .../components/Information/Information.vue | 59 +- .../04_registry/components/Insignia.vue | 128 +- src/modules/04_registry/components/Leave.vue | 138 +- src/modules/04_registry/components/Other.vue | 78 +- src/modules/04_registry/components/Record.vue | 94 +- src/modules/04_registry/components/Salary.vue | 154 +- .../04_registry/components/SalaryEmployee.vue | 144 +- .../components/SalaryEmployeeTemp.vue | 3217 ++++++++--------- src/modules/04_registry/components/Talent.vue | 86 +- src/modules/04_registry/components/Train.vue | 110 +- src/modules/04_registry/components/Work.vue | 98 +- 19 files changed, 2595 insertions(+), 2416 deletions(-) diff --git a/src/modules/04_registry/components/Assessment.vue b/src/modules/04_registry/components/Assessment.vue index de8f0a5ae..5d42ad985 100644 --- a/src/modules/04_registry/components/Assessment.vue +++ b/src/modules/04_registry/components/Assessment.vue @@ -597,34 +597,36 @@ onMounted(async () => { }); const fetchData = async () => { - loaderPage(true); - await http - .get(config.API.profileAssessmentId(profileId.value)) - .then((res) => { - let data = res.data.result; - rows.value = []; - data.map((e: ResponseObject) => { - rows.value.push({ - id: e.id, - name: e.name, - point1Total: e.point1Total, - point1: e.point1, - point2Total: e.point2Total, - point2: e.point2, - pointSumTotal: e.pointSumTotal, - pointSum: e.pointSum, - date: new Date(e.date), - createdAt: new Date(e.createdAt), - createdFullName: e.createdFullName, + if (profileId.value) { + loaderPage(true); + await http + .get(config.API.profileAssessmentId(profileId.value)) + .then((res) => { + let data = res.data.result; + rows.value = []; + data.map((e: ResponseObject) => { + rows.value.push({ + id: e.id, + name: e.name, + point1Total: e.point1Total, + point1: e.point1, + point2Total: e.point2Total, + point2: e.point2, + pointSumTotal: e.pointSumTotal, + pointSum: e.pointSum, + date: new Date(e.date), + createdAt: new Date(e.createdAt), + createdFullName: e.createdFullName, + }); }); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + loaderPage(false); }); - }) - .catch((e) => { - messageError($q, e); - }) - .finally(() => { - loaderPage(false); - }); + } }; /** @@ -714,29 +716,31 @@ const clickSave = async () => { * บันทึกเพิ่มข้อมูล */ const saveData = async () => { - loaderPage(true); - await http - .post(config.API.profileAssessmentId(profileId.value), { - id: id.value, - name: name.value, - point1Total: point1Total.value, - point1: point1.value, - point2Total: point2Total.value, - point2: point2.value, - pointSumTotal: pointSumTotal.value, - pointSum: pointSum.value, - date: dateToISO(date.value), - }) - .then((res) => { - success($q, "บันทึกข้อมูลสำเร็จ"); - modal.value = false; - }) - .catch((e) => { - messageError($q, e); - }) - .finally(async () => { - await fetchData(); - }); + if (profileId.value) { + loaderPage(true); + await http + .post(config.API.profileAssessmentId(profileId.value), { + id: id.value, + name: name.value, + point1Total: point1Total.value, + point1: point1.value, + point2Total: point2Total.value, + point2: point2.value, + pointSumTotal: pointSumTotal.value, + pointSum: pointSum.value, + date: dateToISO(date.value), + }) + .then((res) => { + success($q, "บันทึกข้อมูลสำเร็จ"); + modal.value = false; + }) + .catch((e) => { + messageError($q, e); + }) + .finally(async () => { + await fetchData(); + }); + } }; /** diff --git a/src/modules/04_registry/components/Coin.vue b/src/modules/04_registry/components/Coin.vue index df57bec8e..a478b85b7 100644 --- a/src/modules/04_registry/components/Coin.vue +++ b/src/modules/04_registry/components/Coin.vue @@ -489,32 +489,34 @@ onMounted(async () => { }); const fetchData = async () => { - loaderPage(true); - await http - .get(config.API.profileHonorId(profileId.value)) - .then((res) => { - let data = res.data.result; - rows.value = []; - data.map((e: ResponseObject) => { - rows.value.push({ - id: e.id, - issuer: e.issuer, - detail: e.detail, - issueDate: new Date(e.issueDate), - refCommandNo: e.refCommandNo, - refCommandDate: - e.refCommandDate == null ? null : new Date(e.refCommandDate), - createdAt: new Date(e.createdAt), - createdFullName: e.createdFullName, + if (profileId.value) { + loaderPage(true); + await http + .get(config.API.profileHonorId(profileId.value)) + .then((res) => { + let data = res.data.result; + rows.value = []; + data.map((e: ResponseObject) => { + rows.value.push({ + id: e.id, + issuer: e.issuer, + detail: e.detail, + issueDate: new Date(e.issueDate), + refCommandNo: e.refCommandNo, + refCommandDate: + e.refCommandDate == null ? null : new Date(e.refCommandDate), + createdAt: new Date(e.createdAt), + createdFullName: e.createdFullName, + }); }); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + loaderPage(false); }); - }) - .catch((e) => { - messageError($q, e); - }) - .finally(() => { - loaderPage(false); - }); + } }; /** @@ -601,27 +603,29 @@ const clickSave = async () => { * บันทึกเพิ่มข้อมูล */ const saveData = async () => { - loaderPage(true); - await http - .post(config.API.profileHonorId(profileId.value), { - id: id.value, - issuer: issuer.value, - detail: detail.value, - issueDate: dateToISO(issueDate.value), - refCommandNo: refCommandNo.value, - refCommandDate: - refCommandDate.value == null ? null : dateToISO(refCommandDate.value), - }) - .then((res) => { - success($q, "บันทึกข้อมูลสำเร็จ"); - modal.value = false; - }) - .catch((e) => { - messageError($q, e); - }) - .finally(async () => { - await fetchData(); - }); + if (profileId.value) { + loaderPage(true); + await http + .post(config.API.profileHonorId(profileId.value), { + id: id.value, + issuer: issuer.value, + detail: detail.value, + issueDate: dateToISO(issueDate.value), + refCommandNo: refCommandNo.value, + refCommandDate: + refCommandDate.value == null ? null : dateToISO(refCommandDate.value), + }) + .then((res) => { + success($q, "บันทึกข้อมูลสำเร็จ"); + modal.value = false; + }) + .catch((e) => { + messageError($q, e); + }) + .finally(async () => { + await fetchData(); + }); + } }; /** diff --git a/src/modules/04_registry/components/Discipline.vue b/src/modules/04_registry/components/Discipline.vue index 77dbd1879..ae43a8383 100644 --- a/src/modules/04_registry/components/Discipline.vue +++ b/src/modules/04_registry/components/Discipline.vue @@ -589,33 +589,35 @@ const filterSelector = (val: string, update: Function, refData: string) => { }; const fetchData = async () => { - loaderPage(true); - await http - .get(config.API.profileDisId(profileId.value)) - .then((res) => { - let data = res.data.result; - rows.value = []; - data.map((e: ResponseObject) => { - rows.value.push({ - id: e.id, - level: e.level, - detail: e.detail, - unStigma: e.unStigma, - refCommandNo: e.refCommandNo, - refCommandDate: - e.refCommandDate == null ? null : new Date(e.refCommandDate), - date: new Date(e.date), - createdFullName: e.createdFullName, - createdAt: new Date(e.createdAt), + if (profileId.value) { + loaderPage(true); + await http + .get(config.API.profileDisId(profileId.value)) + .then((res) => { + let data = res.data.result; + rows.value = []; + data.map((e: ResponseObject) => { + rows.value.push({ + id: e.id, + level: e.level, + detail: e.detail, + unStigma: e.unStigma, + refCommandNo: e.refCommandNo, + refCommandDate: + e.refCommandDate == null ? null : new Date(e.refCommandDate), + date: new Date(e.date), + createdFullName: e.createdFullName, + createdAt: new Date(e.createdAt), + }); }); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + loaderPage(false); }); - }) - .catch((e) => { - messageError($q, e); - }) - .finally(() => { - loaderPage(false); - }); + } }; /** @@ -703,28 +705,30 @@ const clickSave = async () => { * บันทึกเพิ่มข้อมูล */ const saveData = async () => { - loaderPage(true); - await http - .post(config.API.profileDisId(profileId.value), { - id: id.value, - level: level.value, - detail: detail.value, - unStigma: unStigma.value, - refCommandNo: refCommandNo.value, - refCommandDate: - refCommandDate.value == null ? null : dateToISO(refCommandDate.value), - date: dateToISO(date.value), - }) - .then((res) => { - success($q, "บันทึกข้อมูลสำเร็จ"); - modal.value = false; - }) - .catch((e) => { - messageError($q, e); - }) - .finally(async () => { - await fetchData(); - }); + if (profileId.value) { + loaderPage(true); + await http + .post(config.API.profileDisId(profileId.value), { + id: id.value, + level: level.value, + detail: detail.value, + unStigma: unStigma.value, + refCommandNo: refCommandNo.value, + refCommandDate: + refCommandDate.value == null ? null : dateToISO(refCommandDate.value), + date: dateToISO(date.value), + }) + .then((res) => { + success($q, "บันทึกข้อมูลสำเร็จ"); + modal.value = false; + }) + .catch((e) => { + messageError($q, e); + }) + .finally(async () => { + await fetchData(); + }); + } }; /** diff --git a/src/modules/04_registry/components/Document.vue b/src/modules/04_registry/components/Document.vue index 74e4c1a48..4b6bfe21b 100644 --- a/src/modules/04_registry/components/Document.vue +++ b/src/modules/04_registry/components/Document.vue @@ -176,19 +176,21 @@ onMounted(async () => { }); const getData = async () => { - loaderPage(true); - await http - .get(config.API.profilePaperId(profileId.value)) - .then((res) => { - const data = res.data.result; - files.value = data; - }) - .catch((e) => { - messageError($q, e); - }) - .finally(() => { - loaderPage(false); - }); + if (profileId.value) { + loaderPage(true); + await http + .get(config.API.profilePaperId(profileId.value)) + .then((res) => { + const data = res.data.result; + files.value = data; + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + loaderPage(false); + }); + } }; const deleteData = async (id: string) => { @@ -207,39 +209,41 @@ const deleteData = async (id: string) => { }; const uploadData = async () => { - if (file.value.length > 0) { - const blob = file.value.slice(0, file.value[0].size); - const newFile = new File(blob, name.value, { - type: file.value[0].type, - }); - const formData = new FormData(); - formData.append("avatar", newFile); - formData.append("moss", "newFile"); - console.log(formData); - loaderPage(true); - await http - .post(config.API.profilePaperId(profileId.value), formData) - .then((res) => { - const data = res.data.result; - success($q, "บันทึกข้อมูลสำเร็จ"); - }) - .catch((e) => { - messageError($q, e); - }) - .finally(async () => { - uploader.value.reset(); - name.value = ""; - edit.value = false; - emit("update:statusEdit", false); - await getData(); + if (profileId.value) { + if (file.value.length > 0) { + const blob = file.value.slice(0, file.value[0].size); + const newFile = new File(blob, name.value, { + type: file.value[0].type, }); - } else { - // modalError( - // $q, - // "ไม่สามารถอัปโหลดไฟล์ได้", - // "กรุณาเลือกไฟล์ที่ต้องการอัปโหลด" - // ); - getData(); + const formData = new FormData(); + formData.append("avatar", newFile); + formData.append("moss", "newFile"); + console.log(formData); + loaderPage(true); + await http + .post(config.API.profilePaperId(profileId.value), formData) + .then((res) => { + const data = res.data.result; + success($q, "บันทึกข้อมูลสำเร็จ"); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(async () => { + uploader.value.reset(); + name.value = ""; + edit.value = false; + emit("update:statusEdit", false); + await getData(); + }); + } else { + // modalError( + // $q, + // "ไม่สามารถอัปโหลดไฟล์ได้", + // "กรุณาเลือกไฟล์ที่ต้องการอัปโหลด" + // ); + getData(); + } } }; diff --git a/src/modules/04_registry/components/Education.vue b/src/modules/04_registry/components/Education.vue index b47d3567f..b5956d931 100644 --- a/src/modules/04_registry/components/Education.vue +++ b/src/modules/04_registry/components/Education.vue @@ -1112,45 +1112,47 @@ const filterSelector = (val: any, update: Function, refData: string) => { }; const fetchData = async () => { - loaderPage(true); - await http - .get(config.API.profileEduId(profileId.value)) - .then((res) => { - let data = res.data.result; - rows.value = []; - data.map((e: ResponseObject) => { - rows.value.push({ - id: e.id, - level: e.educationLevel, - levelId: e.educationLevelId, - positionPath: e.positionPath, - isEducation: e.isEducation, - institute: e.institute, - degree: e.degree, - field: e.field, - gpa: e.gpa, - country: e.country, - duration: e.duration, - durationYear: e.durationYear, - other: e.other, - fundName: e.fundName, - isDate: e.isDate.toString(), - finishDate: new Date(e.finishDate), - startDate: new Date(e.startDate).getFullYear(), - endDate: new Date(e.endDate).getFullYear(), - startDate2: new Date(e.startDate), - endDate2: new Date(e.endDate), - createdFullName: e.createdFullName, - createdAt: new Date(e.createdAt), + if (profileId.value) { + loaderPage(true); + await http + .get(config.API.profileEduId(profileId.value)) + .then((res) => { + let data = res.data.result; + rows.value = []; + data.map((e: ResponseObject) => { + rows.value.push({ + id: e.id, + level: e.educationLevel, + levelId: e.educationLevelId, + positionPath: e.positionPath, + isEducation: e.isEducation, + institute: e.institute, + degree: e.degree, + field: e.field, + gpa: e.gpa, + country: e.country, + duration: e.duration, + durationYear: e.durationYear, + other: e.other, + fundName: e.fundName, + isDate: e.isDate.toString(), + finishDate: new Date(e.finishDate), + startDate: new Date(e.startDate).getFullYear(), + endDate: new Date(e.endDate).getFullYear(), + startDate2: new Date(e.startDate), + endDate2: new Date(e.endDate), + createdFullName: e.createdFullName, + createdAt: new Date(e.createdAt), + }); }); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + loaderPage(false); }); - }) - .catch((e) => { - messageError($q, e); - }) - .finally(() => { - loaderPage(false); - }); + } }; /** @@ -1255,43 +1257,45 @@ const saveData = async () => { // const filterPositionPath = OpsFilter.value.positionPathOptions.filter( // (r: any) => r.id == isEducation.value // ); - loaderPage(true); - await http - .post(config.API.profileEduId(profileId.value), { - id: id.value, - // educationLevel: filter[0].name, - educationLevelId: levelId.value, - isEducation: isEducation.value, - institute: institute.value, - degree: degree.value, - field: field.value, - gpa: gpa.value, - country: country.value, - duration: duration.value, - durationYear: durationYear.value, - other: other.value, - fundName: fundName.value, - isDate: isDate.value == "true" ? true : false, - finishDate: dateToISO(finishDate.value), - startDate: - isDate.value == "true" - ? dateToISO(startDate2.value) - : new Date(`${startDate.value}-01-01`), - endDate: - isDate.value == "true" - ? dateToISO(endDate2.value) - : new Date(`${endDate.value}-01-01`), - }) - .then((res) => { - success($q, "บันทึกข้อมูลสำเร็จ"); - modal.value = false; - }) - .catch((e) => { - messageError($q, e); - }) - .finally(async () => { - await fetchData(); - }); + if (profileId.value) { + loaderPage(true); + await http + .post(config.API.profileEduId(profileId.value), { + id: id.value, + // educationLevel: filter[0].name, + educationLevelId: levelId.value, + isEducation: isEducation.value, + institute: institute.value, + degree: degree.value, + field: field.value, + gpa: gpa.value, + country: country.value, + duration: duration.value, + durationYear: durationYear.value, + other: other.value, + fundName: fundName.value, + isDate: isDate.value == "true" ? true : false, + finishDate: dateToISO(finishDate.value), + startDate: + isDate.value == "true" + ? dateToISO(startDate2.value) + : new Date(`${startDate.value}-01-01`), + endDate: + isDate.value == "true" + ? dateToISO(endDate2.value) + : new Date(`${endDate.value}-01-01`), + }) + .then((res) => { + success($q, "บันทึกข้อมูลสำเร็จ"); + modal.value = false; + }) + .catch((e) => { + messageError($q, e); + }) + .finally(async () => { + await fetchData(); + }); + } }; /** diff --git a/src/modules/04_registry/components/Information/Address.vue b/src/modules/04_registry/components/Information/Address.vue index 111cda831..8b8ffbf67 100644 --- a/src/modules/04_registry/components/Information/Address.vue +++ b/src/modules/04_registry/components/Information/Address.vue @@ -5,11 +5,12 @@ header="ข้อมูลที่อยู่" icon="mdi-map-marker" :save="saveData" - :history="true" + :history="!statusAdd()" :changeBtn="changeBtn" :disable="statusEdit" :cancel="refreshData" :historyClick="clickHistory" + :addEmployee="statusAdd()" />
@@ -311,6 +312,10 @@ const props = defineProps({ type: Boolean, required: true, }, + statusAdd: { + type: Boolean, + default: false, + }, }); const emit = defineEmits(["update:statusEdit"]); @@ -507,8 +512,28 @@ const visibleColumnsHistory = ref([ onMounted(async () => { await getNewData(); emit("update:statusEdit", false); + defaultAdd(); }); +const statusAdd = () => props.statusAdd; + +const defaultAdd = () => { + if (props.statusAdd) { + edit.value = props.statusAdd; + addressData.value = { + address: null, + provinceId: null, + districtId: null, + subdistrictId: null, + addressC: null, + provinceIdC: null, + districtIdC: null, + subdistrictIdC: null, + same: "0", + }; + } +}; + const filterSelector = (val: any, update: Function, refData: string) => { switch (refData) { case "provinceOps": @@ -675,10 +700,32 @@ const editData = async () => { }); }; +const addData = async () => { + // loaderPage(true); + // await http + // .put(config.API.profileInforId(route.params.id.toString()), body) + // .then((res) => { + // success($q, "บันทึกข้อมูลสำเร็จ"); + // }) + // .catch((e) => { + // messageError($q, e); + // }) + // .finally(async () => { + // edit.value = false; + // emit("update:statusEdit", false); + // await fetchData(); + // await changeBirth(informaData.value.birthDate ?? new Date()); + // }); +}; + const saveData = async () => { await myform.value.validate().then(async (success: boolean) => { if (success) { - await editData(); + if (props.statusAdd) { + await addData(); + } else { + await editData(); + } } else { } }); diff --git a/src/modules/04_registry/components/Information/Certicate.vue b/src/modules/04_registry/components/Information/Certicate.vue index 3706fb326..d08e8c3b2 100644 --- a/src/modules/04_registry/components/Information/Certicate.vue +++ b/src/modules/04_registry/components/Information/Certicate.vue @@ -486,31 +486,33 @@ onMounted(async () => { }); const fetchData = async () => { - loaderPage(true); - await http - .get(config.API.profileCertId(profileId.value)) - .then((res) => { - let data = res.data.result; - rows.value = []; - data.map((e: ResponseObject) => { - rows.value.push({ - id: e.id, - certificateNo: e.certificateNo, - issuer: e.issuer, - issueDate: new Date(e.issueDate), - expireDate: new Date(e.expireDate), - certificateType: e.certificateType, - createdFullName: e.createdFullName, - createdAt: new Date(e.createdAt), + if (profileId.value) { + loaderPage(true); + await http + .get(config.API.profileCertId(profileId.value)) + .then((res) => { + let data = res.data.result; + rows.value = []; + data.map((e: ResponseObject) => { + rows.value.push({ + id: e.id, + certificateNo: e.certificateNo, + issuer: e.issuer, + issueDate: new Date(e.issueDate), + expireDate: new Date(e.expireDate), + certificateType: e.certificateType, + createdFullName: e.createdFullName, + createdAt: new Date(e.createdAt), + }); }); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + loaderPage(false); }); - }) - .catch((e) => { - messageError($q, e); - }) - .finally(() => { - loaderPage(false); - }); + } }; /** diff --git a/src/modules/04_registry/components/Information/Family.vue b/src/modules/04_registry/components/Information/Family.vue index 8c49f6c88..8b9eaf90c 100644 --- a/src/modules/04_registry/components/Information/Family.vue +++ b/src/modules/04_registry/components/Information/Family.vue @@ -5,11 +5,12 @@ header="ข้อมูลครอบครัว" icon="mdi-account-group" :save="saveData" - :history="true" + :history="!statusAdd()" :changeBtn="changeBtn" :disable="statusEdit" :cancel="refreshData" :historyClick="historyData" + :addEmployee="statusAdd()" />
@@ -1114,6 +1115,10 @@ const props = defineProps({ type: Function, default: () => console.log("not function"), }, + statusAdd: { + type: Boolean, + default: false, + }, }); const emit = defineEmits(["update:statusEdit"]); @@ -1171,8 +1176,43 @@ onMounted(async () => { await fetchPrefix(); await fetchData(); emit("update:statusEdit", false); + defaultAdd(); }); +const statusAdd = () => props.statusAdd; + +const defaultAdd = () => { + if (props.statusAdd) { + edit.value = props.statusAdd; + familyData.value = { + prefixC: null, + prefixIdC: null, + firstnameC: null, + lastnameC: null, + lastnameCOld: null, + occupationC: null, + citizenIdC: null, + liveC: null, + prefixM: null, + prefixIdM: null, + firstnameM: null, + lastnameM: null, + occupationM: null, + citizenIdM: null, + liveM: null, + prefixF: null, + prefixIdF: null, + firstnameF: null, + lastnameF: null, + occupationF: null, + citizenIdF: null, + liveF: null, + same: "0", + childrens: [], + }; + } +}; + const historyData = async () => { await fetchHistory(); }; @@ -1400,10 +1440,32 @@ const editData = async () => { }); }; +const addData = async () => { + // loaderPage(true); + // await http + // .put(config.API.profileInforId(route.params.id.toString()), body) + // .then((res) => { + // success($q, "บันทึกข้อมูลสำเร็จ"); + // }) + // .catch((e) => { + // messageError($q, e); + // }) + // .finally(async () => { + // edit.value = false; + // emit("update:statusEdit", false); + // await fetchData(); + // await changeBirth(informaData.value.birthDate ?? new Date()); + // }); +}; + const saveData = async () => { await myform.value?.validate().then(async (success: boolean) => { if (success) { - await editData(); + if (props.statusAdd) { + await addData(); + } else { + await editData(); + } } else { } }); diff --git a/src/modules/04_registry/components/Information/Information.vue b/src/modules/04_registry/components/Information/Information.vue index 2ffe97cbb..ec7a1440b 100644 --- a/src/modules/04_registry/components/Information/Information.vue +++ b/src/modules/04_registry/components/Information/Information.vue @@ -5,11 +5,12 @@ header="ข้อมูลส่วนตัว" icon="mdi-account" :save="saveData" - :history="true" + :history="!statusAdd()" :changeBtn="changeBtn" :disable="statusEdit" :cancel="onCancel" :historyClick="clickHistory" + :addEmployee="statusAdd()" />
@@ -439,6 +440,10 @@ const props = defineProps({ type: Function, default: () => console.log("not function"), }, + statusAdd: { + type: Boolean, + default: false, + }, }); const emit = defineEmits(["update:statusEdit"]); @@ -693,8 +698,36 @@ onMounted(async () => { await fetchPerson(); await fetchData(); emit("update:statusEdit", false); + defaultAdd(); }); +const statusAdd = () => props.statusAdd; + +const defaultAdd = () => { + if (props.statusAdd) { + edit.value = props.statusAdd; + informaData.value = { + cardid: null, + age: null, + prefix: null, + prefixId: null, + firstname: null, + lastname: null, + birthDate: new Date(), + genderId: null, + bloodId: null, + nationality: null, + ethnicity: null, + statusId: null, + religionId: null, + tel: null, + employeeType: null, + employeeClass: null, + profileType: null, + }; + } +}; + const onCancel = async () => { if (myform.value != null) { myform.value.reset(); @@ -1045,11 +1078,33 @@ const editData = async () => { }); }; +const addData = async () => { + // loaderPage(true); + // await http + // .put(config.API.profileInforId(route.params.id.toString()), body) + // .then((res) => { + // success($q, "บันทึกข้อมูลสำเร็จ"); + // }) + // .catch((e) => { + // messageError($q, e); + // }) + // .finally(async () => { + // edit.value = false; + // emit("update:statusEdit", false); + // await fetchData(); + // await changeBirth(informaData.value.birthDate ?? new Date()); + // }); +}; + const saveData = async () => { if (myform.value != null) { await myform.value.validate().then(async (success: boolean) => { if (success) { - await editData(); + if (props.statusAdd) { + await addData(); + } else { + await editData(); + } } else { } }); diff --git a/src/modules/04_registry/components/Insignia.vue b/src/modules/04_registry/components/Insignia.vue index efd170a76..fb97d8513 100644 --- a/src/modules/04_registry/components/Insignia.vue +++ b/src/modules/04_registry/components/Insignia.vue @@ -939,41 +939,43 @@ const fetchInsignia = async () => { }; const fetchData = async () => { - loaderPage(true); - await http - .get(config.API.profileInsignId(profileId.value)) - .then((res) => { - let data = res.data.result; - rows.value = []; - data.map((e: ResponseObject) => { - rows.value.push({ - id: e.id, - insignia: e.insignia, - insigniaId: e.insigniaId, - insigniaType: e.insigniaType, - year: e.year, - no: e.no, - issue: e.issue, - volumeNo: e.volumeNo, - volume: e.volume, - section: e.section, - page: e.page, - receiveDate: new Date(e.receiveDate), - dateAnnounce: new Date(e.dateAnnounce), - refCommandNo: e.refCommandNo, - refCommandDate: - e.refCommandDate == null ? null : new Date(e.refCommandDate), - createdFullName: e.createdFullName, - createdAt: new Date(e.createdAt), + if (profileId.value) { + loaderPage(true); + await http + .get(config.API.profileInsignId(profileId.value)) + .then((res) => { + let data = res.data.result; + rows.value = []; + data.map((e: ResponseObject) => { + rows.value.push({ + id: e.id, + insignia: e.insignia, + insigniaId: e.insigniaId, + insigniaType: e.insigniaType, + year: e.year, + no: e.no, + issue: e.issue, + volumeNo: e.volumeNo, + volume: e.volume, + section: e.section, + page: e.page, + receiveDate: new Date(e.receiveDate), + dateAnnounce: new Date(e.dateAnnounce), + refCommandNo: e.refCommandNo, + refCommandDate: + e.refCommandDate == null ? null : new Date(e.refCommandDate), + createdFullName: e.createdFullName, + createdAt: new Date(e.createdAt), + }); }); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + loaderPage(false); }); - }) - .catch((e) => { - messageError($q, e); - }) - .finally(() => { - loaderPage(false); - }); + } }; /** @@ -1068,35 +1070,37 @@ const clickSave = async () => { * บันทึกเพิ่มข้อมูล */ const saveData = async () => { - loaderPage(true); - await http - .post(config.API.profileInsignId(profileId.value), { - id: id.value, - insigniaId: insigniaId.value, - insigniaType: insigniaType.value, - year: year.value, - no: no.value, - issue: issue.value, - volumeNo: volumeNo.value, - volume: volume.value, - section: section.value, - page: page.value, - receiveDate: dateToISO(receiveDate.value), - dateAnnounce: dateToISO(dateAnnounce.value), - refCommandNo: refCommandNo.value, - refCommandDate: - refCommandDate.value == null ? null : dateToISO(refCommandDate.value), - }) - .then((res) => { - success($q, "บันทึกข้อมูลสำเร็จ"); - modal.value = false; - }) - .catch((e) => { - messageError($q, e); - }) - .finally(async () => { - await fetchData(); - }); + if (profileId.value) { + loaderPage(true); + await http + .post(config.API.profileInsignId(profileId.value), { + id: id.value, + insigniaId: insigniaId.value, + insigniaType: insigniaType.value, + year: year.value, + no: no.value, + issue: issue.value, + volumeNo: volumeNo.value, + volume: volume.value, + section: section.value, + page: page.value, + receiveDate: dateToISO(receiveDate.value), + dateAnnounce: dateToISO(dateAnnounce.value), + refCommandNo: refCommandNo.value, + refCommandDate: + refCommandDate.value == null ? null : dateToISO(refCommandDate.value), + }) + .then((res) => { + success($q, "บันทึกข้อมูลสำเร็จ"); + modal.value = false; + }) + .catch((e) => { + messageError($q, e); + }) + .finally(async () => { + await fetchData(); + }); + } }; /** diff --git a/src/modules/04_registry/components/Leave.vue b/src/modules/04_registry/components/Leave.vue index 2bed01b6d..1c3ecf5fe 100644 --- a/src/modules/04_registry/components/Leave.vue +++ b/src/modules/04_registry/components/Leave.vue @@ -717,33 +717,35 @@ onMounted(async () => { const fetchData = async () => { rows.value = []; - loaderPage(true); - await http - .get(config.API.profileLeaveId(profileId.value)) - .then((res) => { - const data = res.data.result; - // console.log(data); - data.map((e: ResponseObject) => { - rows.value.push({ - id: e.id, - typeLeave: e.typeLeave, - dateStartLeave: new Date(e.dateStartLeave), - dateEndLeave: new Date(e.dateEndLeave), - numLeave: e.numLeave, - sumLeave: e.sumLeave, - totalLeave: e.totalLeave, - status: e.status, - reason: e.reason, - typeLeaveId: e.typeLeaveId, + if (profileId.value) { + loaderPage(true); + await http + .get(config.API.profileLeaveId(profileId.value)) + .then((res) => { + const data = res.data.result; + // console.log(data); + data.map((e: ResponseObject) => { + rows.value.push({ + id: e.id, + typeLeave: e.typeLeave, + dateStartLeave: new Date(e.dateStartLeave), + dateEndLeave: new Date(e.dateEndLeave), + numLeave: e.numLeave, + sumLeave: e.sumLeave, + totalLeave: e.totalLeave, + status: e.status, + reason: e.reason, + typeLeaveId: e.typeLeaveId, + }); }); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + loaderPage(false); }); - }) - .catch((e) => { - messageError($q, e); - }) - .finally(() => { - loaderPage(false); - }); + } }; const filterSelector = (val: any, update: Function, filtername: string) => { @@ -966,28 +968,30 @@ const clickSave = async () => { const saveData = async () => { const sum = Number(numLeave.value) + Number(numUsedLeave.value); - loaderPage(true); - await http - .post(config.API.profileLeaveId(profileId.value), { - dateStartLeave: dateToISO(dateRange.value[0]), - dateEndLeave: dateToISO(dateRange.value[1]), - numLeave: numLeave.value, - sumLeave: numUsedLeave.value, - totalLeave: sum, - status: statLeave.value, - reason: reason.value, - typeLeaveId: typeLeave.value, - }) - .then((res) => { - success($q, "บันทึกข้อมูลสำเร็จ"); - modalAdd.value = false; - }) - .catch((e) => { - messageError($q, e); - }) - .finally(async () => { - await fetchData(); - }); + if (profileId.value) { + loaderPage(true); + await http + .post(config.API.profileLeaveId(profileId.value), { + dateStartLeave: dateToISO(dateRange.value[0]), + dateEndLeave: dateToISO(dateRange.value[1]), + numLeave: numLeave.value, + sumLeave: numUsedLeave.value, + totalLeave: sum, + status: statLeave.value, + reason: reason.value, + typeLeaveId: typeLeave.value, + }) + .then((res) => { + success($q, "บันทึกข้อมูลสำเร็จ"); + modalAdd.value = false; + }) + .catch((e) => { + messageError($q, e); + }) + .finally(async () => { + await fetchData(); + }); + } }; // /** @@ -1187,27 +1191,29 @@ const addData = async () => { */ const clickTotal = async () => { rowsTotal.value = []; - loaderPage(true); - await http - .get(config.API.profileLeaveTotalId(profileId.value)) - .then((res) => { - let data = res.data.result; - data.map((e: ResponseTotalObject) => { - rowsTotal.value.push({ - typeLeaveId: e.typeLeaveId, - totalLeave: e.totalLeave, - limitLeave: e.limitLeave, - remainLeave: e.remainLeave, - typeLeave: e.typeLeave, + if (profileId.value) { + loaderPage(true); + await http + .get(config.API.profileLeaveTotalId(profileId.value)) + .then((res) => { + let data = res.data.result; + data.map((e: ResponseTotalObject) => { + rowsTotal.value.push({ + typeLeaveId: e.typeLeaveId, + totalLeave: e.totalLeave, + limitLeave: e.limitLeave, + remainLeave: e.remainLeave, + typeLeave: e.typeLeave, + }); }); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + loaderPage(false); }); - }) - .catch((e) => { - messageError($q, e); - }) - .finally(() => { - loaderPage(false); - }); + } }; // /** diff --git a/src/modules/04_registry/components/Other.vue b/src/modules/04_registry/components/Other.vue index 08b75d635..715ce6256 100644 --- a/src/modules/04_registry/components/Other.vue +++ b/src/modules/04_registry/components/Other.vue @@ -304,28 +304,30 @@ onMounted(async () => { }); const fetchData = async () => { - loaderPage(true); - await http - .get(config.API.profileOtherId(profileId.value)) - .then((res) => { - let data = res.data.result; - rows.value = []; - data.map((e: ResponseObject) => { - rows.value.push({ - id: e.id, - date: new Date(e.date), - detail: e.detail, - createdFullName: e.createdFullName, - createdAt: new Date(e.createdAt), + if (profileId.value) { + loaderPage(true); + await http + .get(config.API.profileOtherId(profileId.value)) + .then((res) => { + let data = res.data.result; + rows.value = []; + data.map((e: ResponseObject) => { + rows.value.push({ + id: e.id, + date: new Date(e.date), + detail: e.detail, + createdFullName: e.createdFullName, + createdAt: new Date(e.createdAt), + }); }); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + loaderPage(false); }); - }) - .catch((e) => { - messageError($q, e); - }) - .finally(() => { - loaderPage(false); - }); + } }; /** @@ -409,23 +411,25 @@ const clickSave = async () => { * บันทึกเพิ่มข้อมูล */ const saveData = async () => { - loaderPage(true); - await http - .post(config.API.profileOtherId(profileId.value), { - id: id.value, - date: date.value, - detail: detail.value, - }) - .then((res) => { - success($q, "บันทึกข้อมูลสำเร็จ"); - modal.value = false; - }) - .catch((e) => { - messageError($q, e); - }) - .finally(async () => { - await fetchData(); - }); + if (profileId.value) { + loaderPage(true); + await http + .post(config.API.profileOtherId(profileId.value), { + id: id.value, + date: date.value, + detail: detail.value, + }) + .then((res) => { + success($q, "บันทึกข้อมูลสำเร็จ"); + modal.value = false; + }) + .catch((e) => { + messageError($q, e); + }) + .finally(async () => { + await fetchData(); + }); + } }; /** diff --git a/src/modules/04_registry/components/Record.vue b/src/modules/04_registry/components/Record.vue index 4eac4635c..5de5d5494 100644 --- a/src/modules/04_registry/components/Record.vue +++ b/src/modules/04_registry/components/Record.vue @@ -478,32 +478,34 @@ onMounted(async () => { }); const fetchData = async () => { - loaderPage(true); - await http - .get(config.API.profileNopaidId(profileId.value)) - .then((res) => { - let data = res.data.result; - rows.value = []; - data.map((e: ResponseObject) => { - rows.value.push({ - id: e.id, - date: new Date(e.date), - detail: e.detail, - reference: e.reference, - refCommandNo: e.refCommandNo, - refCommandDate: - e.refCommandDate == null ? null : new Date(e.refCommandDate), - createdFullName: e.createdFullName, - createdAt: new Date(e.createdAt), + if (profileId.value) { + loaderPage(true); + await http + .get(config.API.profileNopaidId(profileId.value)) + .then((res) => { + let data = res.data.result; + rows.value = []; + data.map((e: ResponseObject) => { + rows.value.push({ + id: e.id, + date: new Date(e.date), + detail: e.detail, + reference: e.reference, + refCommandNo: e.refCommandNo, + refCommandDate: + e.refCommandDate == null ? null : new Date(e.refCommandDate), + createdFullName: e.createdFullName, + createdAt: new Date(e.createdAt), + }); }); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + loaderPage(false); }); - }) - .catch((e) => { - messageError($q, e); - }) - .finally(() => { - loaderPage(false); - }); + } }; /** @@ -590,27 +592,29 @@ const clickSave = async () => { * บันทึกเพิ่มข้อมูล */ const saveData = async () => { - loaderPage(true); - await http - .post(config.API.profileNopaidId(profileId.value), { - id: id.value, - date: dateToISO(date.value), - detail: detail.value, - reference: reference.value, - refCommandNo: refCommandNo.value, - refCommandDate: - refCommandDate.value == null ? null : dateToISO(refCommandDate.value), - }) - .then((res) => { - success($q, "บันทึกข้อมูลสำเร็จ"); - modal.value = false; - }) - .catch((e) => { - messageError($q, e); - }) - .finally(async () => { - await fetchData(); - }); + if (profileId.value) { + loaderPage(true); + await http + .post(config.API.profileNopaidId(profileId.value), { + id: id.value, + date: dateToISO(date.value), + detail: detail.value, + reference: reference.value, + refCommandNo: refCommandNo.value, + refCommandDate: + refCommandDate.value == null ? null : dateToISO(refCommandDate.value), + }) + .then((res) => { + success($q, "บันทึกข้อมูลสำเร็จ"); + modal.value = false; + }) + .catch((e) => { + messageError($q, e); + }) + .finally(async () => { + await fetchData(); + }); + } }; /** diff --git a/src/modules/04_registry/components/Salary.vue b/src/modules/04_registry/components/Salary.vue index e57d96705..1f2a9c562 100644 --- a/src/modules/04_registry/components/Salary.vue +++ b/src/modules/04_registry/components/Salary.vue @@ -909,7 +909,9 @@ const tittleHistory = ref("ประวัติแก้ไขตำแ const filterHistory = ref(""); //search data table history const modalHistory = ref(false); //modal ประวัติการแก้ไขข้อมูล const checkValidate = ref(false); //validate data ผ่านหรือไม่ -const profileId = ref(route.params.id ? route.params.id.toString() : ""); +const profileId = ref( + route.params.id ? route.params.id.toString() : "" +); const rows = ref([]); const filter = ref(""); //search data table const visibleColumns = ref([]); @@ -1512,51 +1514,53 @@ const fetchPosition = async () => { }; const fetchData = async () => { - loaderPage(true); - await http - .get(config.API.profileSalaryId(profileId.value)) - .then((res) => { - let data = res.data.result; - rows.value = []; - data.map((e: ResponseObject) => { - rows.value.push({ - id: e.id, - date: new Date(e.date), - amount: e.amount, - positionSalaryAmount: e.positionSalaryAmount, - mouthSalaryAmount: e.mouthSalaryAmount, - oc: e.oc, - ocId: e.ocId, - position: e.position, - positionId: e.positionId, - posNo: e.posNo, - posNoId: e.posNoId, - positionLine: e.positionLine, - positionLineId: e.positionLineId, - positionPathSide: e.positionPathSide, - positionPathSideId: e.positionPathSideId, - positionType: e.positionType, - positionTypeId: e.positionTypeId, - positionLevel: e.positionLevel, - positionLevelId: e.positionLevelId, - positionExecutive: e.positionExecutive, - positionExecutiveId: e.positionExecutiveId, - positionExecutiveSide: e.positionExecutiveSide, - positionExecutiveSideId: e.positionExecutiveSideId, - salaryClass: e.salaryClass, - salaryRef: e.salaryRef, - refCommandNo: e.refCommandNo, - createdFullName: e.createdFullName, - createdAt: new Date(e.createdAt), + if (profileId.value) { + loaderPage(true); + await http + .get(config.API.profileSalaryId(profileId.value)) + .then((res) => { + let data = res.data.result; + rows.value = []; + data.map((e: ResponseObject) => { + rows.value.push({ + id: e.id, + date: new Date(e.date), + amount: e.amount, + positionSalaryAmount: e.positionSalaryAmount, + mouthSalaryAmount: e.mouthSalaryAmount, + oc: e.oc, + ocId: e.ocId, + position: e.position, + positionId: e.positionId, + posNo: e.posNo, + posNoId: e.posNoId, + positionLine: e.positionLine, + positionLineId: e.positionLineId, + positionPathSide: e.positionPathSide, + positionPathSideId: e.positionPathSideId, + positionType: e.positionType, + positionTypeId: e.positionTypeId, + positionLevel: e.positionLevel, + positionLevelId: e.positionLevelId, + positionExecutive: e.positionExecutive, + positionExecutiveId: e.positionExecutiveId, + positionExecutiveSide: e.positionExecutiveSide, + positionExecutiveSideId: e.positionExecutiveSideId, + salaryClass: e.salaryClass, + salaryRef: e.salaryRef, + refCommandNo: e.refCommandNo, + createdFullName: e.createdFullName, + createdAt: new Date(e.createdAt), + }); }); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + loaderPage(false); }); - }) - .catch((e) => { - messageError($q, e); - }) - .finally(() => { - loaderPage(false); - }); + } }; const onSelected = async (id: string) => { @@ -1762,36 +1766,38 @@ const clickSave = async () => { * บันทึกเพิ่มข้อมูล */ const saveData = async () => { - loaderPage(true); - await http - .post(config.API.profileSalaryId(profileId.value), { - date: dateToISO(date.value), - amount: amount.value, - positionSalaryAmount: positionSalaryAmount.value, - mouthSalaryAmount: mouthSalaryAmount.value, - ocId: selected.value, - positionId: positionId.value, - posNoId: posNoId.value, - positionLineId: positionLineId.value, - positionPathSideId: positionPathSideId.value, - positionTypeId: positionTypeId.value, - positionLevelId: positionLevelId.value, - positionExecutiveId: positionExecutiveId.value, - positionExecutiveSideId: positionExecutiveSideId.value, - salaryClass: salaryClass.value, - salaryRef: salaryRef.value, - refCommandNo: refCommandNo.value, - }) - .then((res) => { - success($q, "บันทึกข้อมูลสำเร็จ"); - modal.value = false; - }) - .catch((e) => { - messageError($q, e); - }) - .finally(async () => { - await fetchData(); - }); + if (profileId.value) { + loaderPage(true); + await http + .post(config.API.profileSalaryId(profileId.value), { + date: dateToISO(date.value), + amount: amount.value, + positionSalaryAmount: positionSalaryAmount.value, + mouthSalaryAmount: mouthSalaryAmount.value, + ocId: selected.value, + positionId: positionId.value, + posNoId: posNoId.value, + positionLineId: positionLineId.value, + positionPathSideId: positionPathSideId.value, + positionTypeId: positionTypeId.value, + positionLevelId: positionLevelId.value, + positionExecutiveId: positionExecutiveId.value, + positionExecutiveSideId: positionExecutiveSideId.value, + salaryClass: salaryClass.value, + salaryRef: salaryRef.value, + refCommandNo: refCommandNo.value, + }) + .then((res) => { + success($q, "บันทึกข้อมูลสำเร็จ"); + modal.value = false; + }) + .catch((e) => { + messageError($q, e); + }) + .finally(async () => { + await fetchData(); + }); + } }; /** diff --git a/src/modules/04_registry/components/SalaryEmployee.vue b/src/modules/04_registry/components/SalaryEmployee.vue index 51dddd43b..b38af4d3d 100644 --- a/src/modules/04_registry/components/SalaryEmployee.vue +++ b/src/modules/04_registry/components/SalaryEmployee.vue @@ -918,7 +918,9 @@ const tittleHistory = ref("ประวัติแก้ไขตำแ const filterHistory = ref(""); //search data table history const modalHistory = ref(false); //modal ประวัติการแก้ไขข้อมูล const checkValidate = ref(false); //validate data ผ่านหรือไม่ -const profileId = ref(route.params.id ? route.params.id.toString() : ""); +const profileId = ref( + route.params.id ? route.params.id.toString() : "" +); const rows = ref([]); const filter = ref(""); //search data table const visibleColumns = ref([]); @@ -1466,48 +1468,50 @@ const filterSelector = (val: any, update: Function, filtername: string) => { }; const fetchData = async () => { - loaderPage(true); - await http - .get(config.API.profileSalaryEmployeeId(profileId.value)) - .then((res) => { - const data = res.data.result; - // console.log(data); - rows.value = []; - data.map((e: ResponseObjectEmployee) => { - rows.value.push({ - id: e.id, - date: new Date(e.date), - amount: e.amount, - positionSalaryAmount: e.positionSalaryAmount, - mouthSalaryAmount: e.mouthSalaryAmount, - oc: e.oc, - ocId: e.ocId, - posNo: e.posNo, - posNoId: e.posNoId, - posNoEmployee: e.posNoEmployee, - positionEmployeeGroup: e.positionEmployeeGroup, - positionEmployeeGroupId: e.positionEmployeeGroupId, - positionEmployeeLevel: e.positionEmployeeLevel, - positionEmployeeLevelId: e.positionEmployeeLevelId, - positionEmployeePosition: e.positionEmployeePosition, - positionEmployeePositionId: e.positionEmployeePositionId, - positionEmployeePositionSide: e.positionEmployeePositionSide, - positionEmployeePositionSideId: e.positionEmployeePositionSideId, - salaryClass: e.salaryClass, - salaryRef: e.salaryRef, - refCommandNo: e.refCommandNo, - // refCommandDate: new Date(e.refCommandDate), - createdFullName: e.createdFullName, - createdAt: new Date(e.createdAt), + if (profileId.value) { + loaderPage(true); + await http + .get(config.API.profileSalaryEmployeeId(profileId.value)) + .then((res) => { + const data = res.data.result; + // console.log(data); + rows.value = []; + data.map((e: ResponseObjectEmployee) => { + rows.value.push({ + id: e.id, + date: new Date(e.date), + amount: e.amount, + positionSalaryAmount: e.positionSalaryAmount, + mouthSalaryAmount: e.mouthSalaryAmount, + oc: e.oc, + ocId: e.ocId, + posNo: e.posNo, + posNoId: e.posNoId, + posNoEmployee: e.posNoEmployee, + positionEmployeeGroup: e.positionEmployeeGroup, + positionEmployeeGroupId: e.positionEmployeeGroupId, + positionEmployeeLevel: e.positionEmployeeLevel, + positionEmployeeLevelId: e.positionEmployeeLevelId, + positionEmployeePosition: e.positionEmployeePosition, + positionEmployeePositionId: e.positionEmployeePositionId, + positionEmployeePositionSide: e.positionEmployeePositionSide, + positionEmployeePositionSideId: e.positionEmployeePositionSideId, + salaryClass: e.salaryClass, + salaryRef: e.salaryRef, + refCommandNo: e.refCommandNo, + // refCommandDate: new Date(e.refCommandDate), + createdFullName: e.createdFullName, + createdAt: new Date(e.createdAt), + }); }); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + loaderPage(false); }); - }) - .catch((e) => { - messageError($q, e); - }) - .finally(() => { - loaderPage(false); - }); + } }; const fetchPositionNumber = async (id: string) => { @@ -1691,34 +1695,36 @@ const clickSave = async () => { * บันทึกเพิ่มข้อมูล */ const saveData = async () => { - loaderPage(true); - await http - .post(config.API.profileSalaryEmployeeId(profileId.value), { - amount: amount.value, - date: dateToISO(date.value), - positionSalaryAmount: positionSalaryAmount.value, - mouthSalaryAmount: mouthSalaryAmount.value, - ocId: agencyId.value, - // posNoId: posNoId.value, - posNoEmployee: posNoEmployee.value, - positionEmployeeGroupId: employeeGroupId.value, - positionEmployeeLevelId: employeeLevelId.value, - positionEmployeePositionId: employeePositionId.value, - positionEmployeePositionSideId: employeePositionSideId.value, - salaryClass: salaryClass.value, - salaryRef: salaryRef.value, - refCommandNo: refCommandNo.value, - }) - .then((res) => { - success($q, "บันทึกข้อมูลสำเร็จ"); - modal.value = false; - }) - .catch((e) => { - messageError($q, e); - }) - .finally(async () => { - await fetchData(); - }); + if (profileId.value) { + loaderPage(true); + await http + .post(config.API.profileSalaryEmployeeId(profileId.value), { + amount: amount.value, + date: dateToISO(date.value), + positionSalaryAmount: positionSalaryAmount.value, + mouthSalaryAmount: mouthSalaryAmount.value, + ocId: agencyId.value, + // posNoId: posNoId.value, + posNoEmployee: posNoEmployee.value, + positionEmployeeGroupId: employeeGroupId.value, + positionEmployeeLevelId: employeeLevelId.value, + positionEmployeePositionId: employeePositionId.value, + positionEmployeePositionSideId: employeePositionSideId.value, + salaryClass: salaryClass.value, + salaryRef: salaryRef.value, + refCommandNo: refCommandNo.value, + }) + .then((res) => { + success($q, "บันทึกข้อมูลสำเร็จ"); + modal.value = false; + }) + .catch((e) => { + messageError($q, e); + }) + .finally(async () => { + await fetchData(); + }); + } }; /** diff --git a/src/modules/04_registry/components/SalaryEmployeeTemp.vue b/src/modules/04_registry/components/SalaryEmployeeTemp.vue index a999160aa..f3cda3a29 100644 --- a/src/modules/04_registry/components/SalaryEmployeeTemp.vue +++ b/src/modules/04_registry/components/SalaryEmployeeTemp.vue @@ -1,197 +1,175 @@