pathList.vue
6.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
<template>
<div>
<div class="scrm-sub-client-container">
<div class="pageContent">
<GLCombiForm ref="combiForm" :formObj="searchForm" :formData="clientManageFormList" @handleOk="searchTable" @handleRest="resetTable"></GLCombiForm>
<PathFlowChart :chartNodes="chartNodes" :chartLinks="chartLinks" />
</div>
</div>
</div>
</template>
<script>
import PathFlowChart from './components/PathFlowChart'
import { nodes, links, weeklyData } from './components/chartData'
const EVENT_OPTIONS = [
// App相关
{ label: 'App激活', value: 'App激活' },
{ label: 'App浏览页面', value: 'App浏览页面' },
{ label: 'App元素点击', value: 'App元素点击' },
{ label: 'App推送点击', value: 'App推送点击' },
// Web/小程序/微信
{ label: 'web浏览页面', value: 'web浏览页面' },
{ label: '小程序首次启动', value: '小程序首次启动' },
{ label: '小程序浏览页面', value: '小程序浏览页面' },
{ label: '微信端内活跃', value: '微信端内活跃' },
// 通用行为
{ label: '搜索', value: '搜索' },
{ label: '签到', value: '签到' },
{ label: '所有支付', value: '所有支付' }
]
export default {
name: 'pathList',
components: {
PathFlowChart
},
data() {
return {
chartNodes: [],
chartLinks: [],
searchForm: {
addWay: [],
customerName: '',
purchaseCar: ''
},
clientManageFormList: [
// {
// type: 'input',
// inputType: 'text',
// name: 'customerName',
// label: '客户名称',
// placeholder: '请输入客户名称'
// },
// {
// type: 'select',
// name: 'addWay',
// label: '事件选择',
// multiple: true,
// collapseTags: true,
// optionLabel: 'label',
// optionId: 'value',
// placeholder: '请选择事件',
// optionList: EVENT_OPTIONS
// },
{
type: 'datePicker',
name: 'purchaseCar',
label: '时间选择',
valueFormat: 'yyyy-MM-dd',
dateType: 'week',
attrs: {
format: 'yyyy 第 WW 周'
},
customPickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now() || time.getTime() < new Date('2017-12-31').getTime()
}
}
}
]
}
},
created() {
this.chartNodes = nodes
this.chartLinks = links
},
methods: {
//搜索表格
searchTable() {
// Check if filters are effectively empty
const isAddWayEmpty = !this.searchForm.addWay || this.searchForm.addWay.length === 0
const isDateEmpty = !this.searchForm.purchaseCar
if (isAddWayEmpty && isDateEmpty) {
// Show current data source
this.chartNodes = nodes
this.chartLinks = links
} else if (!isDateEmpty) {
// Try to find weekly data
// searchForm.purchaseCar is 'yyyy-MM-dd'
// We use fuzzy matching because the picker might return Sunday/Monday, and our keys are Mondays.
const selectedTime = new Date(this.searchForm.purchaseCar).getTime()
const matchedKey = Object.keys(weeklyData).find(key => {
const keyTime = new Date(key).getTime()
const diff = Math.abs(keyTime - selectedTime)
// Match if within 3.5 days (covers same week alignment issues)
return diff <= 3.5 * 24 * 60 * 60 * 1000
})
const data = matchedKey ? weeklyData[matchedKey] : null
if (data) {
this.chartNodes = data.nodes
this.chartLinks = data.links
} else {
// No data for this week
this.chartNodes = []
this.chartLinks = []
}
} else {
// Other filters (like addWay) but no date
this.chartNodes = []
this.chartLinks = []
}
// this.$refs.clientManage.refreshTable()
},
//重置表格
resetTable() {
this.searchForm = {
addWay: [],
customerName: '',
purchaseCar: ''
}
// Reset to original data
this.chartNodes = nodes
this.chartLinks = links
// this.$refs.clientManage.refreshTable()
},
},
mounted() {}
}
</script>
<style lang="scss" scoped>
@import '@/styles/variables.scss';
@import '@/styles/resetelement.scss';
// /deep/.el-table .el-table__header tr th{
// line-height: 30px;
// }
.expandImg {
display: flex;
// justify-content: center;
.smallFontSize {
margin-left: 2px;
height: 20px;
font-size: 12px;
letter-spacing: 0;
line-height: 20px;
font-weight: 400;
}
.imgEll {
margin-left: 6.5px;
cursor: pointer;
// margin-bottom:3px;
}
}
.pure-green-text {
color: #61cc43;
}
.pure-yello-text {
color: #fb8f28;
}
.scrm-sub-client-container {
.pageTitle {
margin-bottom: 20px;
position: relative;
height: 20px;
font-size: 20px;
font-weight: 700;
color: #333333;
line-height: 20px;
letter-spacing: 1px;
}
.pageContent {
.leadList {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 8px;
div {
text-align: center;
span:nth-child(1) {
font-weight: 600;
font-size: 16px;
}
}
/deep/ .el-button {
color: #08C489;
border: 1px solid #08C489;
}
}
padding: 20px 20px 30px;
background-color: #fff;
.el-button + .el-button {
margin-left: 10px;
}
.searchTop {
// margin-bottom: 20px;
}
.glsx-table {
// /deep/ .el-table__fixed {
// height: 100% !important; //设置高优先,以覆盖内联样式
// }
/deep/ .el-table__fixed,
/deep/ .el-table__fixed-right {
height: 100% !important; //设置高优先,以覆盖内联样式
}
}
.entmicro {
display: flex;
i {
color: #75acff;
margin-right: 3px;
font-size: 14px;
}
// }
}
.el-tag {
// margin-right: 10px;
max-width: 110px;
cursor: pointer;
background-color: #fff !important;
}
}
}
</style>