diff --git a/src/api/13_salary/api.salary.ts b/src/api/13_salary/api.salary.ts index 1ebcbf9e1..ab445d5f8 100644 --- a/src/api/13_salary/api.salary.ts +++ b/src/api/13_salary/api.salary.ts @@ -73,6 +73,12 @@ export default { salaryPeriodStatusEmp: (type: string, periodId: string, rootId: string) => `${salaryPeriodEmp}/${type}/approve/${periodId}/${rootId}`, - salaryPeriodStatusCommentEmp: (type: string, periodId: string, rootId: string) => - `${salaryPeriodEmp}/${type}/comment/${periodId}/${rootId}`, + salaryPeriodStatusCommentEmp: ( + type: string, + periodId: string, + rootId: string + ) => `${salaryPeriodEmp}/${type}/comment/${periodId}/${rootId}`, + + salaryUploadFile: (name: string, group: string, id: string, subId: string) => + `${salary}/file/${name}/${group}/${id}/${subId}`, }; diff --git a/src/modules/13_salary/components/SalaryEmployeeLists/ProcessStep.vue b/src/modules/13_salary/components/SalaryEmployeeLists/ProcessStep.vue index 346d04a65..2e0cf21a7 100644 --- a/src/modules/13_salary/components/SalaryEmployeeLists/ProcessStep.vue +++ b/src/modules/13_salary/components/SalaryEmployeeLists/ProcessStep.vue @@ -21,7 +21,7 @@ const props = defineProps({ }); const sendStep = ref(1); -const fileUpload = ref(null); +const fileUpload = ref([]); const document = ref(""); const type = ref(""); /** @@ -29,27 +29,41 @@ const type = ref(""); * @param event file */ async function uploadFile(event: any) { + console.log(event); + const fileName = event.map((e: any) => ({ fileName: e.name })); + dialogConfirm( $q, async () => { const selectedFile = event; const formdata = new FormData(); formdata.append("Document", selectedFile); - // await http - // .put(config.API.uploadfileOnlyInsignia(requestId.value), formdata) - // .then(async () => { - // await fecthInsigniaByOc( - // round.value, - // DataStore.agency, - // "officer", - // tab.value - // ); - // success($q, "อัปโหลดไฟล์สำเร็จ"); - // fileUpload.value = null; - // }) - // .catch((err) => { - // messageError($q, err); - // }), + http + .post( + config.API.salaryUploadFile( + "ระบบเงินเดือน", + "เลื่อนค่าจ้าง", + props.periodId ? props.periodId : "", + props.rootId ? props.rootId : "" + ), + { + replace: false, //อัพทับที่เดิมไหม + fileList: fileName, + } + ) + .then(async () => { + // await fecthInsigniaByOc( + // round.value, + // DataStore.agency, + // "officer", + // tab.value + // ); + // success($q, "อัปโหลดไฟล์สำเร็จ"); + // fileUpload.value = null; + }) + .catch((err) => { + messageError($q, err); + }); }, "ยืนยันการอัปโหลดไฟล์", "ต้องการยืนยันการอัปโหลดไฟล์นี้หรือไม่ ?" @@ -141,6 +155,7 @@ function sendAndRecommend(title: string, typeOrder: string) { v-model="fileUpload" accept=".pdf" label="อัปโหลดไฟล์" + multiple >