Discover: Fix SidebarFilter Funnel.

This commit is contained in:
chiayin
2023-04-25 10:47:59 +08:00
parent 280da0731d
commit cbde7b2d4c
4 changed files with 33 additions and 21 deletions

View File

@@ -45,24 +45,25 @@
import Search from '@/components/Search.vue'; import Search from '@/components/Search.vue';
export default { export default {
props: { props: ['tableTitle', 'tableData', 'tableSelect', 'progressWidth'],
tableTitle: { // {
type: String, // tableTitle: {
require: true, // type: String,
}, // require: true,
tableData: { // },
type: Array, // tableData: {
require: true, // type: Array,
}, // require: true,
tableSelect: { // },
type: Array, // tableSelect: {
require: true, // type: Array,
}, // require: true,
progressWidth: { // },
type: Function, // progressWidth: {
require: false, // type: Function,
} // require: false,
}, // }
// },
data() { data() {
return { return {
select: this.tableSelect, select: this.tableSelect,

View File

@@ -1,6 +1,10 @@
<template> <template>
<div class=" w-full h-full"> <div class=" w-full h-full">
<div class="h-[calc(100%_-_58px)] border-b border-neutral-400 mb-2 overflow-y-auto overflow-x-auto scrollbar"> <div class="h-[calc(100%_-_58px)] border-b border-neutral-400 mb-2 overflow-y-auto overflow-x-auto scrollbar">
temporaryData:{{ temporaryData }}<br/>
postRuleData:{{ postRuleData }}<br/>
isRuleData:{{ isRuleData }}<br/>
ruleData:{{ ruleData }}<br/>
<div v-if="this.temporaryData.length === 0" class="h-full flex justify-center items-center"> <div v-if="this.temporaryData.length === 0" class="h-full flex justify-center items-center">
<span class="text-neutral-500">No Filter.</span> <span class="text-neutral-500">No Filter.</span>
</div> </div>
@@ -76,6 +80,7 @@ export default {
// header:Funnel 發送暫存的選取資料 // header:Funnel 發送暫存的選取資料
async submitAll() { async submitAll() {
this.postRuleData = this.temporaryData.filter(item => item !== 0); // 取得 submit 的資料,有 toggle button 的話,找出並刪除陣列中為 0 的項目 this.postRuleData = this.temporaryData.filter(item => item !== 0); // 取得 submit 的資料,有 toggle button 的話,找出並刪除陣列中為 0 的項目
if(!this.postRuleData?.length) return this.$toast.error('Not selected');
await this.allMapDataStore.checkHasResult(); await this.allMapDataStore.checkHasResult();
if(this.hasResultRule === null) return; if(this.hasResultRule === null) return;

View File

@@ -64,7 +64,7 @@
<div class="space-y-2 w-[calc(100%_-_240px)] h-[calc(100%_-_106px)]"> <div class="space-y-2 w-[calc(100%_-_240px)] h-[calc(100%_-_106px)]">
<p class="h2 ml-1">Activity Select</p> <p class="h2 ml-1">Activity Select</p>
<!-- Filter task Data--> <!-- Filter task Data-->
<ActOccCase v-if="selectValue[0] === 'Sequence' && selectValue[1] === 'Have activity(s)'" :tableTitle="'Activity List'" :tableData="filterTaskData" :tableSelect="selectFilterTask" :progressWidth ="progressWidth" @on-row-select="onRowAct"></ActOccCase> <ActOccCase v-if="selectValue[0] === 'Sequence' && selectValue[1] === 'Have activity(s)'" :tableTitle="'Activity List'" :tableData="filterAllTaskData" :tableSelect="selectFilterTask" :progressWidth ="progressWidth" @on-row-select="onRowAct"></ActOccCase>
<!-- Filter Start Data --> <!-- Filter Start Data -->
<ActOcc v-if="selectValue[0] === 'Sequence' && selectValue[1] === 'Start activity / end activity' && selectValue[2] === 'Start'" :tableTitle="'Start activity'" :tableData="filterStartData" :tableSelect="selectFilterStart" :progressWidth ="progressWidth" @on-row-select="onRowStart"></ActOcc> <ActOcc v-if="selectValue[0] === 'Sequence' && selectValue[1] === 'Start activity / end activity' && selectValue[2] === 'Start'" :tableTitle="'Start activity'" :tableData="filterStartData" :tableSelect="selectFilterStart" :progressWidth ="progressWidth" @on-row-select="onRowStart"></ActOcc>
<!-- Filter End Data --> <!-- Filter End Data -->
@@ -151,8 +151,12 @@ export default {
}, },
computed: { computed: {
// All Task // All Task
filterAllTaskData: function() {
return this.setHaveAct([...this.filterTasks]);
},
// Act And Seq
filterTaskData: function() { filterTaskData: function() {
return this.isActAllTask? this.setHaveAct(this.filterTasks) : this.filterTaskData; return this.isActAllTask? this.setHaveAct([...this.filterTasks]) : this.filterTaskData;
}, },
// Start and End Task // Start and End Task
filterStartData: function() { filterStartData: function() {
@@ -433,8 +437,9 @@ export default {
this.isRuleData = Array.from(this.temporaryData); this.isRuleData = Array.from(this.temporaryData);
this.ruleData = this.isRuleData.map(e => this.setRule(e)); this.ruleData = this.isRuleData.map(e => this.setRule(e));
}else { }else {
this.temporaryData.push(...postData);
this.isRuleData.push(...postData); this.isRuleData.push(...postData);
this.ruleData = this.isRuleData.map(e => this.setRule(e)); this.ruleData.push(this.setRule(...postData));
} }
this.reset(false); this.reset(false);
this.isLoading = true; this.isLoading = true;

View File

@@ -34,6 +34,7 @@
</label> </label>
</div> </div>
<!-- Other Page: Save and Download --> <!-- Other Page: Save and Download -->
<!-- Save data 跳重新命名沒有 data 跳要不要儲存沒有跳動都不跳 -->
<div v-else class="space-x-4"> <div v-else class="space-x-4">
<button class="btn btn-sm btn-neutral">Save</button> <button class="btn btn-sm btn-neutral">Save</button>
<button class="btn btn-sm btn-neutral">Download</button> <button class="btn btn-sm btn-neutral">Download</button>