fix: Issues #213 done.
This commit is contained in:
@@ -201,6 +201,9 @@ export default {
|
|||||||
* Save button' modal
|
* Save button' modal
|
||||||
*/
|
*/
|
||||||
async saveModal() {
|
async saveModal() {
|
||||||
|
// 協助判斷 MAP, CONFORMANCE 儲存有「送出」或「取消」。
|
||||||
|
let isSaved;
|
||||||
|
|
||||||
// 傳給 Map,通知 Sidebar 要關閉。
|
// 傳給 Map,通知 Sidebar 要關閉。
|
||||||
this.$emitter.emit('saveModal', false);
|
this.$emitter.emit('saveModal', false);
|
||||||
// 判斷在哪個子頁面
|
// 判斷在哪個子頁面
|
||||||
@@ -212,16 +215,16 @@ export default {
|
|||||||
await this.allMapDataStore.updataFilter();
|
await this.allMapDataStore.updataFilter();
|
||||||
if(this.isUpdataFilter) await savedSuccessfully(this.filterName);
|
if(this.isUpdataFilter) await savedSuccessfully(this.filterName);
|
||||||
}else if(this.logId){
|
}else if(this.logId){
|
||||||
await saveFilter(this.allMapDataStore.addFilterId);
|
isSaved = await saveFilter(this.allMapDataStore.addFilterId);
|
||||||
// 存檔後為 filterID,換網址不跳頁,使用 push 記錄歷史路由
|
// 存檔後為 filterID,換網址不跳頁,使用 push 記錄歷史路由
|
||||||
await this.$router.push(`/discover/filter/${this.createFilterId}/map`);
|
if(isSaved) await this.$router.push(`/discover/filter/${this.createFilterId}/map`);
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case 'CheckMap':
|
case 'CheckMap':
|
||||||
// 無論 parentLog, parentFilter,做新 filter 皆另存新檔
|
// 無論 parentLog, parentFilter,做新 filter 皆另存新檔
|
||||||
await saveFilter(this.allMapDataStore.addFilterId);
|
isSaved = await saveFilter(this.allMapDataStore.addFilterId);
|
||||||
// 存檔後為 filterID,換網址不跳頁,使用 push 記錄歷史路由
|
// 存檔後為 filterID,換網址不跳頁,使用 push 記錄歷史路由
|
||||||
await this.$router.push(`/discover/filter/${this.createFilterId}/map`);
|
if(isSaved) await this.$router.push(`/discover/filter/${this.createFilterId}/map`);
|
||||||
break;
|
break;
|
||||||
case 'Conformance':
|
case 'Conformance':
|
||||||
case 'CheckConformance':
|
case 'CheckConformance':
|
||||||
@@ -231,10 +234,12 @@ export default {
|
|||||||
await this.conformanceStore.updataConformance();
|
await this.conformanceStore.updataConformance();
|
||||||
if(this.isUpdataConformance) await savedSuccessfully(this.conformanceFileName);
|
if(this.isUpdataConformance) await savedSuccessfully(this.conformanceFileName);
|
||||||
} else {
|
} else {
|
||||||
await saveConformance(this.conformanceStore.addConformanceCreateCheckId);
|
isSaved = await saveConformance(this.conformanceStore.addConformanceCreateCheckId);
|
||||||
// 存檔後為 checkID,換網址不跳頁,使用 push 記錄歷史路由
|
// 存檔後為 checkID,換網址不跳頁,使用 push 記錄歷史路由
|
||||||
if(this.conformanceLogId) await this.$router.push(`/discover/conformance/log/${this.conformanceLogCreateCheckId}/conformance`);
|
if(isSaved) {
|
||||||
else if(this.conformanceFilterId) await this.$router.push(`/discover/conformance/filter/${this.conformanceFilterCreateCheckId}/conformance`);
|
if(this.conformanceLogId) await this.$router.push(`/discover/conformance/log/${this.conformanceLogCreateCheckId}/conformance`);
|
||||||
|
else if(this.conformanceFilterId) await this.$router.push(`/discover/conformance/filter/${this.conformanceFilterCreateCheckId}/conformance`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,12 +41,17 @@ export async function saveFilter(addFilterId) {
|
|||||||
cancelButtonColor: '#94a3b8',
|
cancelButtonColor: '#94a3b8',
|
||||||
customClass: customClass,
|
customClass: customClass,
|
||||||
});
|
});
|
||||||
// 存檔成功
|
// 透過回傳值判斷要不要轉址
|
||||||
if(isConfirmed) await addFilterId(fileName);
|
if(isConfirmed) { // 存檔成功
|
||||||
// 顯示儲存完成
|
await addFilterId(fileName);
|
||||||
if (value) savedSuccessfully(value);
|
// 顯示儲存完成
|
||||||
// 清空欄位
|
if (value) savedSuccessfully(value);
|
||||||
fileName = '';
|
// 清空欄位
|
||||||
|
fileName = '';
|
||||||
|
return true;
|
||||||
|
} else { // 點擊取消或空白處,為存檔失敗。
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Saved Success
|
* Saved Success
|
||||||
@@ -128,12 +133,17 @@ export async function saveConformance(addConformanceCreateCheckId) {
|
|||||||
cancelButtonColor: '#94a3b8',
|
cancelButtonColor: '#94a3b8',
|
||||||
customClass: customClass,
|
customClass: customClass,
|
||||||
});
|
});
|
||||||
// 存檔成功
|
// 透過回傳值判斷要不要轉址
|
||||||
if(isConfirmed) await addConformanceCreateCheckId(fileName);
|
if(isConfirmed) { // 存檔成功
|
||||||
// 顯示儲存完成
|
await addConformanceCreateCheckId(fileName);
|
||||||
if (value) savedSuccessfully(value);
|
// 顯示儲存完成
|
||||||
// 清空欄位
|
if (value) savedSuccessfully(value);
|
||||||
fileName = '';
|
// 清空欄位
|
||||||
|
fileName = '';
|
||||||
|
return true;
|
||||||
|
} else { // 點擊取消或空白處,為存檔失敗。
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* leave Conformance page
|
* leave Conformance page
|
||||||
|
|||||||
Reference in New Issue
Block a user