update isupload
This commit is contained in:
parent
32deed4e9a
commit
2f6b495d43
3 changed files with 84 additions and 9 deletions
|
|
@ -141,7 +141,6 @@ const baseVisibleColumns = ref<string[]>([
|
||||||
"lastUpdateFullName",
|
"lastUpdateFullName",
|
||||||
"lastUpdatedAt",
|
"lastUpdatedAt",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const rows = ref<ResponseObject[]>([]); //รายการใบอนุญาตประกอบวิชาชีพ
|
const rows = ref<ResponseObject[]>([]); //รายการใบอนุญาตประกอบวิชาชีพ
|
||||||
const rowsMain = ref<ResponseObject[]>([]); //รายการใบอนุญาตประกอบวิชาชีพ
|
const rowsMain = ref<ResponseObject[]>([]); //รายการใบอนุญาตประกอบวิชาชีพ
|
||||||
const keyword = ref<string>(""); //คำค้นหา
|
const keyword = ref<string>(""); //คำค้นหา
|
||||||
|
|
@ -154,7 +153,6 @@ const visibleColumns = ref<string[]>(
|
||||||
const pagination = ref({
|
const pagination = ref({
|
||||||
sortBy: "lastUpdatedAt",
|
sortBy: "lastUpdatedAt",
|
||||||
});
|
});
|
||||||
|
|
||||||
//Table ประวัติแก้ไขใบอนุญาตประกอบวิชาชีพ
|
//Table ประวัติแก้ไขใบอนุญาตประกอบวิชาชีพ
|
||||||
const historyId = ref<string>("");
|
const historyId = ref<string>("");
|
||||||
const columnsHistory = ref<QTableColumn[]>(baseColumns.value);
|
const columnsHistory = ref<QTableColumn[]>(baseColumns.value);
|
||||||
|
|
@ -169,10 +167,10 @@ const profesLicenseData = reactive<RequestItemsObject>({
|
||||||
profileId: id.value,
|
profileId: id.value,
|
||||||
});
|
});
|
||||||
|
|
||||||
const fileGroup = ref<string>("เอกสารใบอนุญาตประกอบวิชาชีพ");
|
const fileGroup = ref<string>("เอกสารใบอนุญาตประกอบวิชาชีพ"); //กลุ่มไฟล์
|
||||||
const fileUpload = ref<File | null>(null);
|
const fileUpload = ref<File | null>(null); //ไฟล์อัพโหล
|
||||||
const fileData = ref<ResFileData | null>(null);
|
const fileData = ref<ResFileData | null>(null); //ข้อมูลไฟล์
|
||||||
const isUpload = ref<boolean>(false);
|
const isUpload = ref<boolean>(false); //สถานะการอัพโหล
|
||||||
|
|
||||||
/** ยืนยันการบันทึกข้อมูล*/
|
/** ยืนยันการบันทึกข้อมูล*/
|
||||||
function onSubmit() {
|
function onSubmit() {
|
||||||
|
|
@ -193,6 +191,7 @@ function onSubmit() {
|
||||||
...profesLicenseData,
|
...profesLicenseData,
|
||||||
issueDate: convertDateToAPI(profesLicenseData.issueDate),
|
issueDate: convertDateToAPI(profesLicenseData.issueDate),
|
||||||
expireDate: convertDateToAPI(profesLicenseData.expireDate),
|
expireDate: convertDateToAPI(profesLicenseData.expireDate),
|
||||||
|
isUpload: !isEdit ? undefined : isUpload.value,
|
||||||
profileId: isEdit
|
profileId: isEdit
|
||||||
? undefined
|
? undefined
|
||||||
: empType.value === ""
|
: empType.value === ""
|
||||||
|
|
@ -209,6 +208,7 @@ function onSubmit() {
|
||||||
const isId = isEdit ? editId.value : res.data.result;
|
const isId = isEdit ? editId.value : res.data.result;
|
||||||
await uploadfile(isId);
|
await uploadfile(isId);
|
||||||
}
|
}
|
||||||
|
|
||||||
await fetchData(id.value);
|
await fetchData(id.value);
|
||||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
closeDialog();
|
closeDialog();
|
||||||
|
|
@ -225,21 +225,44 @@ function onSubmit() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ฟังก์ชันอัพโหลไฟล์
|
||||||
|
* @param subId id รายการที่อัพโหลไฟล์
|
||||||
|
*/
|
||||||
async function uploadfile(subId: string) {
|
async function uploadfile(subId: string) {
|
||||||
try {
|
try {
|
||||||
|
//สร้าง Path url อัพโหลด
|
||||||
const uploadUrl = await createPathUploadFlie(
|
const uploadUrl = await createPathUploadFlie(
|
||||||
fileGroup.value,
|
fileGroup.value,
|
||||||
id.value,
|
id.value,
|
||||||
subId
|
subId
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//อัพโหลไฟล์
|
||||||
await uploadFile(uploadUrl, fileUpload.value);
|
await uploadFile(uploadUrl, fileUpload.value);
|
||||||
fileUpload.value = null;
|
await updateIsUpload();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** ฟังก์ชันอัพเดทสถานะอัพโหลด*/
|
||||||
|
async function updateIsUpload() {
|
||||||
|
await http
|
||||||
|
.patch(
|
||||||
|
config.API.profileNewCertificateByCertificateId(
|
||||||
|
editId.value,
|
||||||
|
empType.value
|
||||||
|
),
|
||||||
|
{
|
||||||
|
isUpload: fileUpload.value ? true : false,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then(() => {
|
||||||
|
fileUpload.value = null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/** fetch ข้อมูลรายการใบอนุญาตประกอบวิชาชีพ*/
|
/** fetch ข้อมูลรายการใบอนุญาตประกอบวิชาชีพ*/
|
||||||
async function fetchData(id: string) {
|
async function fetchData(id: string) {
|
||||||
showLoader();
|
showLoader();
|
||||||
|
|
@ -295,6 +318,10 @@ async function editForm(row: ResponseObject) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ฟังก์ชันดูประวัติการแก้ไขข้อมูล
|
||||||
|
* @param id รายการที่ต้องการดูประวัติการแก้ไข
|
||||||
|
*/
|
||||||
function onViewHistory(id: string) {
|
function onViewHistory(id: string) {
|
||||||
historyId.value = id;
|
historyId.value = id;
|
||||||
historyDialog.value = true;
|
historyDialog.value = true;
|
||||||
|
|
@ -318,11 +345,16 @@ async function fetchDataHistory() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ฟังก์ชันโหลดไฟล์
|
||||||
|
* @param subId id รายการที่ต้องการโหลดไฟล์
|
||||||
|
*/
|
||||||
async function onDownloadFile(subId: string) {
|
async function onDownloadFile(subId: string) {
|
||||||
const data = await getPathUploadFlie(fileGroup.value, id.value, subId);
|
const data = await getPathUploadFlie(fileGroup.value, id.value, subId);
|
||||||
window.open(data.downloadUrl, "_blank");
|
window.open(data.downloadUrl, "_blank");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** ฟังก์ชันค้นหาข้อมูลในตาราง*/
|
||||||
function serchDataTable() {
|
function serchDataTable() {
|
||||||
rows.value = onSearchDataTable(
|
rows.value = onSearchDataTable(
|
||||||
keyword.value,
|
keyword.value,
|
||||||
|
|
|
||||||
|
|
@ -350,6 +350,7 @@ function onSubmit() {
|
||||||
...disciplineData,
|
...disciplineData,
|
||||||
date: convertDateToAPI(disciplineData.date),
|
date: convertDateToAPI(disciplineData.date),
|
||||||
refCommandDate: convertDateToAPI(disciplineData.refCommandDate),
|
refCommandDate: convertDateToAPI(disciplineData.refCommandDate),
|
||||||
|
isUpload: !edit.value ? undefined : isUpload.value,
|
||||||
profileId: edit.value
|
profileId: edit.value
|
||||||
? undefined
|
? undefined
|
||||||
: empType.value === ""
|
: empType.value === ""
|
||||||
|
|
@ -384,21 +385,45 @@ function onSubmit() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ฟังก์ชันอัพโหลไฟล์
|
||||||
|
* @param id id รายการที่อัพโหลไฟล์
|
||||||
|
*/
|
||||||
async function uploadfile(id: string) {
|
async function uploadfile(id: string) {
|
||||||
try {
|
try {
|
||||||
|
//สร้าง Path url อัพโหลด
|
||||||
const uploadUrl = await createPathUploadFlie(
|
const uploadUrl = await createPathUploadFlie(
|
||||||
fileGroup.value,
|
fileGroup.value,
|
||||||
profileId.value,
|
profileId.value,
|
||||||
id
|
id
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//อัพโหลไฟล์
|
||||||
await uploadFile(uploadUrl, fileUpload.value);
|
await uploadFile(uploadUrl, fileUpload.value);
|
||||||
fileUpload.value = null;
|
await updateIsUpload();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** ฟังก์ชันอัพเดทสถานะอัพโหลด*/
|
||||||
|
async function updateIsUpload() {
|
||||||
|
await http
|
||||||
|
.patch(
|
||||||
|
config.API.profileNewDisciplineByDisciplineId(id.value, empType.value),
|
||||||
|
{
|
||||||
|
isUpload: fileUpload.value ? true : false,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then(() => {
|
||||||
|
fileUpload.value = null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ฟังก์ชันโหลดไฟล์
|
||||||
|
* @param id id รายการที่ต้องการโหลดไฟล์
|
||||||
|
*/
|
||||||
async function onDownloadFile(id: string) {
|
async function onDownloadFile(id: string) {
|
||||||
const data = await getPathUploadFlie(fileGroup.value, profileId.value, id);
|
const data = await getPathUploadFlie(fileGroup.value, profileId.value, id);
|
||||||
window.open(data.downloadUrl, "_blank");
|
window.open(data.downloadUrl, "_blank");
|
||||||
|
|
|
||||||
|
|
@ -185,6 +185,7 @@ function onSubmit() {
|
||||||
...formData,
|
...formData,
|
||||||
date: convertDateToAPI(formData.date),
|
date: convertDateToAPI(formData.date),
|
||||||
refCommandDate: convertDateToAPI(formData.refCommandDate),
|
refCommandDate: convertDateToAPI(formData.refCommandDate),
|
||||||
|
isUpload: !isStatusEdit.value ? undefined : isUpload.value,
|
||||||
profileId: isStatusEdit.value
|
profileId: isStatusEdit.value
|
||||||
? undefined
|
? undefined
|
||||||
: empType.value === ""
|
: empType.value === ""
|
||||||
|
|
@ -214,21 +215,38 @@ function onSubmit() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ฟังก์ชันอัพโหลไฟล์
|
||||||
|
* @param id id รายการที่อัพโหลไฟล์
|
||||||
|
*/
|
||||||
async function uploadfile(id: string) {
|
async function uploadfile(id: string) {
|
||||||
try {
|
try {
|
||||||
|
//สร้าง Path url อัพโหลด
|
||||||
const uploadUrl = await createPathUploadFlie(
|
const uploadUrl = await createPathUploadFlie(
|
||||||
fileGroup.value,
|
fileGroup.value,
|
||||||
profileId.value,
|
profileId.value,
|
||||||
id
|
id
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//อัพโหลไฟล์
|
||||||
await uploadFile(uploadUrl, fileUpload.value);
|
await uploadFile(uploadUrl, fileUpload.value);
|
||||||
fileUpload.value = null;
|
await updateIsUpload();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** ฟังก์ชันอัพเดทสถานะอัพโหลด*/
|
||||||
|
async function updateIsUpload() {
|
||||||
|
await http
|
||||||
|
.patch(config.API.profileNewNoPaidById(id.value, empType.value), {
|
||||||
|
isUpload: fileUpload.value ? true : false,
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
fileUpload.value = null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* function เปิด Didalig บันทึกวันที่ไม่ได้รับเงินเดือนฯ
|
* function เปิด Didalig บันทึกวันที่ไม่ได้รับเงินเดือนฯ
|
||||||
* @param StatusEdit แก้ไข , เพิ่ม
|
* @param StatusEdit แก้ไข , เพิ่ม
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue