DISCOVER: sidevarFilter Reset button done.
This commit is contained in:
@@ -153,6 +153,7 @@ export default {
|
|||||||
//若第一次選擇 start, 則 end 連動改變,若第一次選擇 end, 則 start 連動改變
|
//若第一次選擇 start, 則 end 連動改變,若第一次選擇 end, 則 start 連動改變
|
||||||
isStartSelected: null,
|
isStartSelected: null,
|
||||||
isEndSelected: null,
|
isEndSelected: null,
|
||||||
|
isActAllTask: true,
|
||||||
rowData: [],
|
rowData: [],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -164,21 +165,7 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
// All Task
|
// All Task
|
||||||
filterTaskData: function() {
|
filterTaskData: function() {
|
||||||
let list = [];
|
return this.isActAllTask? this.setHaveAct(this.filterTasks) : this.filterTaskData;
|
||||||
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;
|
|
||||||
},
|
},
|
||||||
// Start and End Task
|
// Start and End Task
|
||||||
filterStartData: function() {
|
filterStartData: function() {
|
||||||
@@ -217,6 +204,20 @@ export default {
|
|||||||
progressWidth(value){
|
progressWidth(value){
|
||||||
return `width:${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 的內容
|
// 調整 filterStartData / filterEndData / filterStartToEndData / filterEndToStartData 的內容
|
||||||
/**
|
/**
|
||||||
* @param {array} array filterStartToEnd / filterEndToStart
|
* @param {array} array filterStartToEnd / filterEndToStart
|
||||||
@@ -256,8 +257,8 @@ export default {
|
|||||||
* @param {array} e Update List Seq
|
* @param {array} e Update List Seq
|
||||||
*/
|
*/
|
||||||
onUpdateListSeq(listSeq) {
|
onUpdateListSeq(listSeq) {
|
||||||
console.log(this.listSeq);
|
|
||||||
this.listSeq = listSeq;
|
this.listSeq = listSeq;
|
||||||
|
this.isActAllTask = false;
|
||||||
},
|
},
|
||||||
// 在 Start & End 若第一次選擇 start, 則 end 連動改變,若第一次選擇 end, 則 start 連動改變
|
// 在 Start & End 若第一次選擇 start, 則 end 連動改變,若第一次選擇 end, 則 start 連動改變
|
||||||
/**
|
/**
|
||||||
@@ -299,26 +300,6 @@ export default {
|
|||||||
occurrences: Number(item.occurrences).toLocaleString('en-US'),
|
occurrences: Number(item.occurrences).toLocaleString('en-US'),
|
||||||
occurrence_ratio: this.getPercentLabel(item.occurrence_ratio),
|
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.listSeq = [];
|
||||||
this.isStartSelected = null;
|
this.isStartSelected = null;
|
||||||
this.isEndSelected = null;
|
this.isEndSelected = null;
|
||||||
// this.rowData = [];
|
this.isActAllTask = true;
|
||||||
console.log('reset');
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,6 +77,14 @@ export default {
|
|||||||
data: this.filterTaskData,
|
data: this.filterTaskData,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
listSeq(newval){
|
||||||
|
this.listSequence = newval;
|
||||||
|
},
|
||||||
|
filterTaskData(newval){
|
||||||
|
this.data = newval;
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onEnd() {
|
onEnd() {
|
||||||
this.$emit('update:listSeq', this.listSequence);
|
this.$emit('update:listSeq', this.listSequence);
|
||||||
|
|||||||
@@ -62,6 +62,11 @@ export default {
|
|||||||
components: {
|
components: {
|
||||||
Search,
|
Search,
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
tableSelect(newval){
|
||||||
|
this.select = newval;
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onRowSelect(e) {
|
onRowSelect(e) {
|
||||||
this.$emit('on-row-select', e)
|
this.$emit('on-row-select', e)
|
||||||
|
|||||||
@@ -72,6 +72,11 @@ export default {
|
|||||||
components: {
|
components: {
|
||||||
Search,
|
Search,
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
tableSelect(newval){
|
||||||
|
this.select = newval;
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onRowSelect() {
|
onRowSelect() {
|
||||||
this.$emit('on-row-select', this.select);
|
this.$emit('on-row-select', this.select);
|
||||||
|
|||||||
Reference in New Issue
Block a user