แก้อัพไฟล์
This commit is contained in:
parent
f4d11d6686
commit
81cfb48b8e
4 changed files with 28 additions and 28 deletions
|
|
@ -535,7 +535,7 @@ async function addEditData(editStatus: boolean = false) {
|
|||
try {
|
||||
await http[method](url, reqBody).then(async (res) => {
|
||||
if ((fileUpload.value && id.value) || res.data.result) {
|
||||
await uploadProfile(id.value);
|
||||
await uploadProfile(editStatus ? id.value:res.data.result);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -568,7 +568,7 @@ async function uploadProfile(id: string) {
|
|||
)
|
||||
.then(async (res) => {
|
||||
uploadUrl.value = res.data["เอกสารหลักฐาน"].uploadUrl;
|
||||
await uploadFileURL(uploadUrl.value, fileUpload.value);
|
||||
await uploadFileURL(uploadUrl.value, fileUpload.value,id);
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
@ -580,7 +580,7 @@ async function uploadProfile(id: string) {
|
|||
* @param uploadUrl Path อัปโหลดไฟล์
|
||||
* @param file ไฟล์เอกสาร
|
||||
*/
|
||||
async function uploadFileURL(uploadUrl: string, file: any) {
|
||||
async function uploadFileURL(uploadUrl: string, file: any,id:string) {
|
||||
await axios
|
||||
.put(uploadUrl, file, {
|
||||
headers: {
|
||||
|
|
@ -589,7 +589,7 @@ async function uploadFileURL(uploadUrl: string, file: any) {
|
|||
})
|
||||
.then(async (res) => {
|
||||
if (res.status == 200) {
|
||||
await isUploadFn();
|
||||
await isUploadFn(id);
|
||||
}
|
||||
fileUpload.value = null;
|
||||
})
|
||||
|
|
@ -598,9 +598,9 @@ async function uploadFileURL(uploadUrl: string, file: any) {
|
|||
});
|
||||
}
|
||||
|
||||
async function isUploadFn() {
|
||||
async function isUploadFn(id:string) {
|
||||
await http
|
||||
.patch(config.API.profileNewInsignById(id.value, empType.value), {
|
||||
.patch(config.API.profileNewInsignById(id, empType.value), {
|
||||
isUpload: fileUpload.value ? true : false,
|
||||
})
|
||||
.then(async (res) => {})
|
||||
|
|
|
|||
|
|
@ -301,7 +301,7 @@ async function addEditData(editStatus: boolean = false) {
|
|||
try {
|
||||
await http[method](url, reqBody).then(async (res) => {
|
||||
if ((fileUpload.value && id.value) || res.data.result) {
|
||||
await uploadProfile(id.value);
|
||||
await uploadProfile(editStatus ? id.value:res.data.result);
|
||||
}
|
||||
});
|
||||
await fetchData();
|
||||
|
|
@ -338,7 +338,7 @@ async function uploadProfile(id: string) {
|
|||
)
|
||||
.then(async (res) => {
|
||||
uploadUrl.value = res.data["เอกสารหลักฐาน"].uploadUrl;
|
||||
await uploadFileURL(uploadUrl.value, fileUpload.value);
|
||||
await uploadFileURL(uploadUrl.value, fileUpload.value,id);
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
@ -350,7 +350,7 @@ async function uploadProfile(id: string) {
|
|||
* @param uploadUrl Path อัปโหลดไฟล์
|
||||
* @param file ไฟล์เอกสาร
|
||||
*/
|
||||
async function uploadFileURL(uploadUrl: string, file: any) {
|
||||
async function uploadFileURL(uploadUrl: string, file: any,id:string) {
|
||||
await axios
|
||||
.put(uploadUrl, file, {
|
||||
headers: {
|
||||
|
|
@ -359,7 +359,7 @@ async function uploadFileURL(uploadUrl: string, file: any) {
|
|||
})
|
||||
.then(async (res) => {
|
||||
if (res.status == 200) {
|
||||
await isUploadFn();
|
||||
await isUploadFn(id);
|
||||
}
|
||||
fileUpload.value = null;
|
||||
})
|
||||
|
|
@ -368,9 +368,9 @@ async function uploadFileURL(uploadUrl: string, file: any) {
|
|||
});
|
||||
}
|
||||
|
||||
async function isUploadFn() {
|
||||
async function isUploadFn(id:string) {
|
||||
await http
|
||||
.patch(config.API.profileNewHonorById(id.value, empType.value), {
|
||||
.patch(config.API.profileNewHonorById(id, empType.value), {
|
||||
isUpload: fileUpload.value ? true : false,
|
||||
isDate: declHonorForm.isDate === "true" ? true : false,
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue