This commit is contained in:
Viet An
2026-05-20 15:48:05 +07:00
parent 087b05a0b8
commit a52c33706a
20 changed files with 86 additions and 106 deletions

View File

@@ -284,11 +284,11 @@ async function onUploaded(uploadedFiles) {
if (attachedCount > 0) {
loadImages();
$snackbar(`Đã thêm ${attachedCount} ảnh thành công`, "Thành công", "Success");
$snackbar(`Đã thêm ${attachedCount} ảnh thành công`, "Success");
}
} catch (error) {
console.error("Error attaching images:", error);
$snackbar("Không thể thêm ảnh, vui lòng thử lại", "Lỗi", "Error");
$snackbar("Không thể thêm ảnh, vui lòng thử lại", "Error");
}
}
@@ -297,10 +297,10 @@ async function deleteImage(image) {
await $deleteapi(isForProduct.value ? "productfile" : "projectfile", image.id);
await $deleteapi("file", image.file);
loadImages();
$snackbar("Đã xóa ảnh thành công", "Thành công", "Success");
$snackbar("Đã xóa ảnh thành công", "Success");
} catch (error) {
console.error("Error deleting image:", error);
$snackbar("Xóa ảnh không thành công", "Lỗi", "Error");
$snackbar("Xóa ảnh không thành công", "Error");
}
}
@@ -317,7 +317,7 @@ async function excel() {
found.url = "exportcsv/File/";
found.params.filter = { code__in: images.value.map((v) => v.file__code) };
const rs = await $getapi([found]);
if (rs === "error") return $snackbar("Đã xảy ra lỗi. Vui lòng thử lại.");
if (rs === "error") return $snackbar("Đã xảy ra lỗi. Vui lòng thử lại.", "Error");
const url = window.URL.createObjectURL(new Blob([rs[0].data]));
const link = document.createElement("a");
const fileName = `${$dayjs(new Date()).format("YYYYMMDDhhmmss")}-data.csv`;