feat: Upload Alert done.
This commit is contained in:
@@ -4,6 +4,7 @@ import ConformanceStore from '@/stores/conformance.js';
|
||||
import LoginStore from '@/stores/login.js';
|
||||
|
||||
const customClass = {
|
||||
container: '!z-[99999]',
|
||||
popup: '!w-[564px]',
|
||||
title: '!text-xl !font-semibold !mb-2',
|
||||
htmlContainer: '!text-sm !font-normal !h-full !mb-4 !leading-5',
|
||||
@@ -165,36 +166,70 @@ export async function leaveConformance(next, addConformanceCreateCheckId, toPath
|
||||
logOut ? null : next(false);
|
||||
}
|
||||
};
|
||||
|
||||
// 登出 button 規則,暫時沒用到
|
||||
export async function logoutLeave(addFilterId) {
|
||||
const allMapDataStore = AllMapDataStore();
|
||||
const loginStore = LoginStore();
|
||||
/**
|
||||
* Upload failde
|
||||
* @param { string } value
|
||||
*/
|
||||
export async function uploadFailde(value) {
|
||||
value = value ? value : '';
|
||||
await Swal.fire({
|
||||
title: 'UPLOAD FAILED',
|
||||
html: `(錯誤樣態由前後端自行確認,呈現於此處) e.g.您的資料格式錯誤,請檢查資料後再重新上傳。`,
|
||||
timer: 5000, // 停留5秒後自動關閉
|
||||
showConfirmButton: false,
|
||||
icon: 'error',
|
||||
iconColor: '#FF3366',
|
||||
customClass: customClass
|
||||
})
|
||||
};
|
||||
/**
|
||||
* Upload Success
|
||||
* @param { string } value
|
||||
*/
|
||||
export async function uploadSuccess() {
|
||||
await Swal.fire({
|
||||
title: 'UPLOAD COMPLETED',
|
||||
timer: 5000, // 停留5秒後自動關閉
|
||||
showConfirmButton: false,
|
||||
icon: 'success',
|
||||
iconColor: '#0099FF',
|
||||
customClass: customClass
|
||||
})
|
||||
};
|
||||
/**
|
||||
* Confirm whether to upload the file */
|
||||
export async function uploadConfirm() {
|
||||
const result = await Swal.fire({
|
||||
title: 'ARE YOU SURE TO LEAVE MAP?',
|
||||
html: 'Filter settings have not been saved.</br>Click “Save as” to save filtered results, “OK” to leave map.',
|
||||
title: 'ARE YOU SURE?',
|
||||
html: 'After uploading, you won’t be able to modify labels.',
|
||||
icon: 'warning',
|
||||
iconColor: '#FF3366',
|
||||
reverseButtons:true,
|
||||
confirmButtonText: 'Save as',
|
||||
confirmButtonText: 'Yes',
|
||||
confirmButtonColor: '#FF3366',
|
||||
showCancelButton: true,
|
||||
cancelButtonText: 'OK',
|
||||
cancelButtonText: 'No',
|
||||
cancelButtonColor: '#94a3b8',
|
||||
customClass: customClass
|
||||
})
|
||||
if(result.isConfirmed) {
|
||||
await saveFilter(addFilterId);
|
||||
// allMapDataStore.tempFilterId = await null;
|
||||
// allMapDataStore.temporaryData = await [];
|
||||
// allMapDataStore.postRuleData = await [];
|
||||
// allMapDataStore.ruleData = await [];
|
||||
// await loginStore.logOut()
|
||||
uploadloader(); // 跑馬燈
|
||||
} else if(result.dismiss === 'cancel') {
|
||||
allMapDataStore.tempFilterId = await null;
|
||||
// allMapDataStore.temporaryData = await [];
|
||||
// allMapDataStore.postRuleData = await [];
|
||||
// allMapDataStore.ruleData = await [];
|
||||
await loginStore.logOut()
|
||||
// 什麼都不做
|
||||
} else if(result.dismiss === 'backdrop') {
|
||||
// 什麼都不做
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Upload loader
|
||||
*/
|
||||
export async function uploadloader() {
|
||||
await Swal.fire({
|
||||
html: '<span class="loaderBar mt-7"></span>',
|
||||
timer: 5000, // 停留5秒後自動關閉
|
||||
showConfirmButton: false,
|
||||
allowOutsideClick: false,
|
||||
// allowOutsideClick: () => !Swal.isLoading()
|
||||
customClass: customClass
|
||||
})
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user