ui/api รายการเหรียญจักรพรรดิมาลา

This commit is contained in:
AnandaTon 2023-08-08 21:37:33 +07:00
parent 453726204c
commit 3055a08dba
5 changed files with 887 additions and 36 deletions

View file

@ -208,7 +208,7 @@ const edit = ref<boolean>(false);
const dateStart = ref<Date>(new Date());
const dateEnd = ref<Date>(new Date());
const yearly = ref<number>(new Date().getFullYear());
const files = ref<File[]>([]);
const files = ref<any>();
const fileDocDataUpload = ref<File[]>([]);
const roundInsig = ref<string>("");
const datelast = ref<number>(1);
@ -257,30 +257,6 @@ const updateYear = async (e: number) => {
yearly.value = e;
};
const uploadDocData = async () => {
const formData = new FormData();
if (fileDocDataUpload.value.length > 0) {
fileDocDataUpload.value.forEach((file: any) => {
formData.append("", file);
});
showLoader();
await http
.put(config.API.RoundInsignia(id.value), formData)
.then((res) => {})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
hideLoader();
success($q, "บันทึกข้อมูลสำเร็จ");
clickBack();
});
} else {
success($q, "บันทึกข้อมูลสำเร็จ");
clickBack();
}
};
const editData = async (id: string) => {
const formData = new FormData();
formData.append("Name", roundInsig.value);
@ -292,14 +268,15 @@ const editData = async (id: string) => {
if (dateEnd.value !== null) {
formData.append("endDate", dateToISO(dateEnd.value));
}
formData.append("file", files.value.toString());
// files.value.forEach((file: any) => {
// formData.append("file", file);
// });
formData.append("file", files.value);
console.log(formData);
showLoader();
await http
.put(config.API.editRoundInsignia(id))
.then(async () => {
await uploadDocData();
})
.then(async () => {})
.catch((e) => {
messageError($q, e);
})
@ -345,17 +322,17 @@ const addData = async () => {
if (dateEnd.value !== null) {
formData.append("endDate", dateToISO(dateEnd.value));
}
formData.append("file", files.value.toString());
console.log(formData);
console.log(files.value);
// files.value.forEach((file: any) => {
// formData.append("file", file);
// });
formData.append("file", files.value);
console.log(files.value);
showLoader();
await http
.post(config.API.listRoundInsignia("insignia"), formData)
.then(async (res) => {
const data = res.data.result;
id.value = data.id;
await uploadDocData();
})
.then(async (res) => {})
.catch((e) => {
messageError($q, e);
})

View file

@ -406,6 +406,10 @@ const clickAdd = () => {
router.push({ name: "roundAdd" });
};
const clickProposals = (id: string) => {
// window.open(config.API.exportInsigniaDoc(id));
};
//
const filterKeyword = ref<string>("");
const filterRef = ref<any>(null);