DISCOVER: sidevarFilter Reset button done.
This commit is contained in:
@@ -153,6 +153,7 @@ export default {
|
||||
//若第一次選擇 start, 則 end 連動改變,若第一次選擇 end, 則 start 連動改變
|
||||
isStartSelected: null,
|
||||
isEndSelected: null,
|
||||
isActAllTask: true,
|
||||
rowData: [],
|
||||
}
|
||||
},
|
||||
@@ -164,21 +165,7 @@ export default {
|
||||
computed: {
|
||||
// All Task
|
||||
filterTaskData: function() {
|
||||
let list = [];
|
||||
this.filterTasks.forEach((task, index) => {
|
||||
let data = {
|
||||
label: task.label,
|
||||
occ_value: Number(task.occurrence_ratio * 100),
|
||||
occurrences: Number(task.occurrences).toLocaleString('en-US'),
|
||||
occurrence_ratio: this.getPercentLabel(task.occurrence_ratio),
|
||||
case_value: Number(task.case_ratio * 100),
|
||||
cases: task.cases.toLocaleString('en-US'),
|
||||
case_ratio: this.getPercentLabel(task.case_ratio),
|
||||
};
|
||||
list.push(data);
|
||||
});
|
||||
list.sort((x, y) => y.occurrences - x.occurrences);
|
||||
return list;
|
||||
return this.isActAllTask? this.setHaveAct(this.filterTasks) : this.filterTaskData;
|
||||
},
|
||||
// Start and End Task
|
||||
filterStartData: function() {
|
||||
@@ -217,6 +204,20 @@ export default {
|
||||
progressWidth(value){
|
||||
return `width:${value}%;`
|
||||
},
|
||||
//設定 Have activity(s) 內容
|
||||
setHaveAct(data){
|
||||
return data.map(task => {
|
||||
return {
|
||||
label: task.label,
|
||||
occ_value: Number(task.occurrence_ratio * 100),
|
||||
occurrences: Number(task.occurrences).toLocaleString('en-US'),
|
||||
occurrence_ratio: this.getPercentLabel(task.occurrence_ratio),
|
||||
case_value: Number(task.case_ratio * 100),
|
||||
cases: task.cases.toLocaleString('en-US'),
|
||||
case_ratio: this.getPercentLabel(task.case_ratio),
|
||||
};
|
||||
}).sort((x, y) => y.occurrences - x.occurrences);
|
||||
},
|
||||
// 調整 filterStartData / filterEndData / filterStartToEndData / filterEndToStartData 的內容
|
||||
/**
|
||||
* @param {array} array filterStartToEnd / filterEndToStart
|
||||
@@ -256,8 +257,8 @@ export default {
|
||||
* @param {array} e Update List Seq
|
||||
*/
|
||||
onUpdateListSeq(listSeq) {
|
||||
console.log(this.listSeq);
|
||||
this.listSeq = listSeq;
|
||||
this.isActAllTask = false;
|
||||
},
|
||||
// 在 Start & End 若第一次選擇 start, 則 end 連動改變,若第一次選擇 end, 則 start 連動改變
|
||||
/**
|
||||
@@ -299,26 +300,6 @@ export default {
|
||||
occurrences: Number(item.occurrences).toLocaleString('en-US'),
|
||||
occurrence_ratio: this.getPercentLabel(item.occurrence_ratio),
|
||||
}));
|
||||
// 以下是優化前的程式碼:
|
||||
// let list = [];
|
||||
// eventData.forEach((task) => {
|
||||
// if(task.label === rowData.label) {
|
||||
// task[event].forEach(item => {
|
||||
// const filterData = event === 'sinks' ? this.filterEndToStart : this.filterStartToEnd;
|
||||
// const element = filterData.find(ele => ele.label === item);
|
||||
// if (element !== undefined) {
|
||||
// const data = {
|
||||
// label: element.label,
|
||||
// occ_value: Number(element.occurrence_ratio * 100),
|
||||
// occurrences: Number(element.occurrences).toLocaleString('en-US'),
|
||||
// occurrence_ratio: this.getPercentLabel(element.occurrence_ratio),
|
||||
// };
|
||||
// list.push(data);
|
||||
// };
|
||||
// })
|
||||
// };
|
||||
// });
|
||||
// return list;
|
||||
},
|
||||
/**
|
||||
* 清空選項
|
||||
@@ -332,8 +313,8 @@ export default {
|
||||
this.listSeq = [];
|
||||
this.isStartSelected = null;
|
||||
this.isEndSelected = null;
|
||||
// this.rowData = [];
|
||||
console.log('reset');
|
||||
this.isActAllTask = true;
|
||||
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
@@ -77,6 +77,14 @@ export default {
|
||||
data: this.filterTaskData,
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
listSeq(newval){
|
||||
this.listSequence = newval;
|
||||
},
|
||||
filterTaskData(newval){
|
||||
this.data = newval;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onEnd() {
|
||||
this.$emit('update:listSeq', this.listSequence);
|
||||
|
||||
@@ -62,6 +62,11 @@ export default {
|
||||
components: {
|
||||
Search,
|
||||
},
|
||||
watch: {
|
||||
tableSelect(newval){
|
||||
this.select = newval;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onRowSelect(e) {
|
||||
this.$emit('on-row-select', e)
|
||||
|
||||
@@ -72,6 +72,11 @@ export default {
|
||||
components: {
|
||||
Search,
|
||||
},
|
||||
watch: {
|
||||
tableSelect(newval){
|
||||
this.select = newval;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onRowSelect() {
|
||||
this.$emit('on-row-select', this.select);
|
||||
|
||||
Reference in New Issue
Block a user