Conformance: Have activity More done.
This commit is contained in:
@@ -3,6 +3,8 @@ import loadingStore from "./loading";
|
||||
import pinia from '@/stores/main.js';
|
||||
import {useToast} from 'vue-toast-notification';
|
||||
import 'vue-toast-notification/dist/theme-sugar.css';
|
||||
import moment from "moment";
|
||||
import { Decimal } from 'decimal.js';
|
||||
|
||||
const loading = loadingStore(pinia);
|
||||
const $toast = useToast();
|
||||
@@ -13,10 +15,13 @@ let delay = (s = 0) => new Promise((resolve, reject) => setTimeout(resolve, s))
|
||||
export default defineStore('conformanceStore', {
|
||||
state: () => ({
|
||||
conformanceLogId: null,
|
||||
conformanceTempCheckerId: null,
|
||||
conformanceFilterId: null,
|
||||
conformanceTempCheckerId: null,
|
||||
allConformanceTask: [],
|
||||
allConformanceTempReportData: null,
|
||||
allIssueTraces: null,
|
||||
allTaskSeq: null,
|
||||
allCases: null,
|
||||
selectedRuleType: 'Have activity', // radio
|
||||
selectedActivitySequence: 'Start & End', // radio
|
||||
selectedMode: 'Directly follows', // radio
|
||||
@@ -30,7 +35,36 @@ export default defineStore('conformanceStore', {
|
||||
},
|
||||
conformanceTempReportData: state => {
|
||||
return state.allConformanceTempReportData;
|
||||
}
|
||||
},
|
||||
issueTraces: state => {
|
||||
return state.allIssueTraces;
|
||||
},
|
||||
taskSeq: state => {
|
||||
return state.allTaskSeq;
|
||||
},
|
||||
cases: state => {
|
||||
if(state.allCases !== null){
|
||||
state.allCases.map(c => {
|
||||
c.started_at = moment(c.started_at).format('YYYY/MM/DD HH:MM');
|
||||
c.completed_at = moment(c.completed_at).format('YYYY/MM/DD HH:MM');
|
||||
c.attributes.map(att => {
|
||||
switch (att.type) {
|
||||
case 'date':
|
||||
att.value = att.value !== null ? moment(att.value).format('YYYY/MM/DD HH:MM:ss') : null;
|
||||
break;
|
||||
case 'float':
|
||||
att.value = att.value !== null ? new Decimal(att.value).toFixed(2) : null;
|
||||
break
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return att;
|
||||
})
|
||||
return c;
|
||||
});
|
||||
};
|
||||
return state.allCases;
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
/**
|
||||
@@ -91,5 +125,46 @@ export default defineStore('conformanceStore', {
|
||||
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Get the detail of a temporary log conformance issue.
|
||||
*/
|
||||
async getLogConformanceIssue(issueNo) {
|
||||
let checkerId = this.conformanceTempCheckerId;
|
||||
const api = `/api/temp-log-checkers/${checkerId}/issues/${issueNo}`;
|
||||
|
||||
try {
|
||||
const response = await this.$axios.get(api);
|
||||
this.allIssueTraces = response.data.traces;
|
||||
} catch(error) {
|
||||
await delay();
|
||||
loading.isLoading = true;
|
||||
await delay(1000);
|
||||
loading.isLoading = false;
|
||||
await delay(500);
|
||||
$toast.default('Failed to Get the detail of a temporary log conformance issue.',{position: 'bottom'});
|
||||
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Get the Trace Details of a Temporary Log Conformance lssue.
|
||||
*/
|
||||
async getLogConformanceTraceDetail(issueNo, traceId) {
|
||||
let checkerId = this.conformanceTempCheckerId;
|
||||
const api = `/api/temp-log-checkers/${checkerId}/issues/${issueNo}/traces/${traceId}`;
|
||||
|
||||
try {
|
||||
const response = await this.$axios.get(api);
|
||||
this.allTaskSeq = response.data.task_seq;
|
||||
this.allCases = response.data.cases;
|
||||
} catch(error) {
|
||||
await delay();
|
||||
loading.isLoading = true;
|
||||
await delay(1000);
|
||||
loading.isLoading = false;
|
||||
await delay(500);
|
||||
$toast.default('Failed to Get the detail of a temporary log conformance issue.',{position: 'bottom'});
|
||||
|
||||
}
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user