Conformance: Have activity Log Results chart, Effect done.
This commit is contained in:
@@ -6,15 +6,17 @@ import 'vue-toast-notification/dist/theme-sugar.css';
|
||||
|
||||
const loading = loadingStore(pinia);
|
||||
const $toast = useToast();
|
||||
|
||||
// Delay loading and toast 待模組化
|
||||
let delay = (s = 0) => new Promise((resolve, reject) => setTimeout(resolve, s));
|
||||
|
||||
export default defineStore('conformanceStore', {
|
||||
state: () => ({
|
||||
conformanceLogId: null,
|
||||
conformanceLogTempCheckerId: null,
|
||||
conformanceTempCheckerId: null,
|
||||
conformanceFilterId: null,
|
||||
allConformanceTask: [],
|
||||
allConformanceTempReportData: null,
|
||||
selectedRuleType: 'Have activity', // radio
|
||||
selectedActivitySequence: 'Start & End', // radio
|
||||
selectedMode: 'Directly follows', // radio
|
||||
@@ -24,7 +26,10 @@ export default defineStore('conformanceStore', {
|
||||
}),
|
||||
getters: {
|
||||
conformanceTask: state => {
|
||||
return state.allConformanceTask;
|
||||
return state.allConformanceTask.map(i => i.label);
|
||||
},
|
||||
conformanceTempReportData: state => {
|
||||
return state.allConformanceTempReportData;
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
@@ -50,16 +55,14 @@ export default defineStore('conformanceStore', {
|
||||
/**
|
||||
* Creates a new temporary checker for a log.
|
||||
*/
|
||||
async addLogConformanceTempCheckerId() {
|
||||
async addLogConformanceTempCheckerId(data) {
|
||||
let logId = this.conformanceLogId;
|
||||
const api = `/api/temp-log-checkers?log_id=${logId}`;
|
||||
|
||||
try {
|
||||
const response = await this.$axios.post(api);
|
||||
console.log(response);
|
||||
this.conformanceLogTempCheckerId = response.data.id;
|
||||
const response = await this.$axios.post(api, data);
|
||||
this.conformanceTempCheckerId = response.data.id;
|
||||
} catch(error) {
|
||||
console.log(error);
|
||||
await delay();
|
||||
loading.isLoading = true;
|
||||
await delay(1000);
|
||||
@@ -67,6 +70,26 @@ export default defineStore('conformanceStore', {
|
||||
await delay(500);
|
||||
$toast.default('Failed to add the Temporary Checker for a log.',{position: 'bottom'});
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Get the Temporary Log Conformance Report
|
||||
*/
|
||||
async getLogConformanceTempReport() {
|
||||
let checkerId = this.conformanceTempCheckerId;
|
||||
const api = `/api/temp-log-checkers/${checkerId}/report`;
|
||||
|
||||
try {
|
||||
const response = await this.$axios.get(api);
|
||||
this.allConformanceTempReportData = response.data;
|
||||
} catch(error) {
|
||||
await delay();
|
||||
loading.isLoading = true;
|
||||
await delay(1000);
|
||||
loading.isLoading = false;
|
||||
await delay(500);
|
||||
$toast.default('Failed to Get the Temporary Log Conformance Report.',{position: 'bottom'});
|
||||
|
||||
}
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user