crowdDetail.vue
9.95 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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
<template>
<div class="scrm-sub-client-container">
<div class="container">
<div>
<div class="title">人群详情</div>
<div class="info-box gl-form-page">
<el-form class="create-form" :model="crowdForm" :rules="crowdRules">
<div class="el-form-line">
<el-form-item label="人群名称:" prop="crowdName" class="label-word">
<div class="color-3">{{ crowdForm.crowdName }}</div>
</el-form-item>
</div>
<div class="el-form-line">
<el-form-item label="人群描述:" prop="groupNameRule" class="label-word">
<div class="color-3">{{ crowdForm.crowdDesc }}</div>
</el-form-item>
</div>
<div class="el-form-line">
<el-form-item label="标签筛选:" prop="groupNameRule" class="label-word">
<div class="flex">
<div class="font-14 color-58 mr2 hand" @click="open('dialogRuleVisible')">人群规则说明</div>
<div class="font-14 color-58 hand" @click="open('dialogLogicVisible')">人群规则逻辑</div>
</div>
</el-form-item>
</div>
<div class="el-form-line">
<el-form-item label="已选标签:" prop="groupNameRule" class="label-word">
<div class="pageContent" style="display: flex;">
<GLTable :tableData="selectedArray" :hasNum="hasNum" :hasPage="hasPage" :tableParams="tableParams" :headerStyle="{ height: '54px', background: '#F4F6FC', color: '#333333', fontSize: '14px' }">
<span slot="labelUnitList" slot-scope="scope">
<div class="allTagsWrap flex">
<template v-for="(item, index) in scope.scope.labelUnitList">
<span :class="['label', 'color-6', 'white-hide', 'mt10']" :key="index">
{{ item.labelName }}
</span>
</template>
</div>
</span>
</GLTable>
</div>
</el-form-item>
</div>
</el-form>
</div>
</div>
</div>
<GLDialog title="人群规则说明" :visible.sync="dialogRuleVisible" :hasFooter="false">
<div class="crowd-dialog-wrap color-3">
<div class="condition font-14">
<b>说明:</b>
<br />
<span>
标签组内已选标签取
<b>并集(或)</b>
,即满足一个条件即可、标签组之间取
<b>交集(且)</b>
,即同时满足标签组条件。
</span>
</div>
<div class="flex-between">
<div class="static-image">
<img src="@/assets/crowdManage/sum.png" alt="" />
</div>
<div class="static-image">
<img src="@/assets/crowdManage/intersection.png" alt="" />
</div>
</div>
</div>
</GLDialog>
<GLDialog title="人群规则逻辑" class="crowd-logic-dialog" :visible.sync="dialogLogicVisible" :hasFooter="false">
<div class="crowd-logic-dialog-wrap">
<div :class="{ 'crowd-flex': true }" v-if="this.selectedArray.length > 1">
<div class="crowd-line" id="lineHeight"></div>
<div class="moreover">且</div>
<div class="crowd-line" id="lineHeight2"></div>
</div>
<div class="crowd-logic-wrap" id="crowd-logic-wrap" :style="{ 'margin-left': this.selectedArray.length > 1 ? '20px' : '55px' }">
<div class="crowd-logic-labels" v-for="(logicTag, index) in this.selectedArray" :key="index">
<div class="crowd-logic-label-group-name font-14 color-3">{{ logicTag.groupName }}:</div>
<div class="flex">
<template v-for="(tag, id) in logicTag.labelUnitList">
<div class="crowd-logic-tag color-6 font-14" :key="id">{{ tag.labelName }}</div>
<template v-if="id < logicTag.labelUnitList.length - 1">
<div class="color-3 perhaps" :key="id">或</div>
</template>
</template>
</div>
</div>
</div>
</div>
</GLDialog>
</div>
</template>
<script>
export default {
name: 'crowdDetail',
data() {
return {
crowdForm: {
crowdName: '',
crowdDesc: ''
},
crowdId: this.$route.params.id ? this.$route.params.id : '',
crowdPage: this.$route.query.crowdType ? this.$route.query.crowdType : '',
tableTotal: '',
isShowCloseBtn: true,
dialogRuleVisible: false,
dialogLogicVisible: false,
tableData: [],
hasPage: false,
hasNum: true,
page: {},
tableParams: {
tableColumns: [
{
label: '标签组',
prop: 'groupName',
width: 230,
align: 'left'
},
{
label: '标签组类型',
prop: 'groupType',
width: 220,
formatter: cellValue => {
return cellValue.groupType == '企业标签' && this.$globalState.session.merchantModel == 1 ? '集团标签' : cellValue.groupType
},
align: 'left'
},
{
label: '标签',
prop: 'labelUnitList',
addHtml: 'labelUnitList',
align: 'left'
}
]
},
crowdRules: {
crowdName: [{ required: true }]
},
selectedArray: []
}
},
created() {
// 通过人群Id查询人群详情
this.getCrowdDetails()
},
mounted() {
},
methods: {
goBack() {
this.$router.push({
path: '/crowdManage/index',
query: {
selectTab: this.crowdPage
}
})
},
//获取标签数据
getCrowdDetails() {
let params = {
'req.crowdId': this.crowdId
}
this.$apis.crowdManage.getCrowdDetails(params).then(res => {
if (res.code == 0) {
this.crowdForm.crowdName = res.data.crowdName
this.crowdForm.crowdDesc = res.data.crowdDesc
this.selectedArray = res.data.tagCombine ? JSON.parse(res.data.tagCombine) : []
}
})
},
handleClose() {
this.dialogRuleVisible = false
this.dialogLogicVisible = false
},
open(value) {
this[value] = true
if (this.dialogLogicVisible == true && this.selectedArray.length > 1) {
this.$nextTick(() => {
let height = document.getElementById('crowd-logic-wrap').offsetHeight
if (height >= 650) {
document.getElementById('lineHeight').style.height = 308 + 'px'
document.getElementById('lineHeight2').style.height = 308 + 'px'
this.logicFix = true
} else {
let lineHeight = (height - 35) / 2
document.getElementById('lineHeight').style.height = lineHeight + 'px'
document.getElementById('lineHeight2').style.height = lineHeight + 'px'
}
})
}
}
}
}
</script>
<style lang="scss" scoped>
@import '@/styles/variables.scss';
/deep/.glsx-table{
width: 100%;
}
.container {
background: #ffffff;
height: calc(100vh - 164px);
overflow-y: auto;
// padding: 20px;
.title {
padding: 20px 0 17px 20px;
font-size: 16px;
color: #333;
font-weight: 600;
border-bottom: 1px solid #d8d8d8;
&::after {
content: '';
}
}
.info-box {
width: 100%;
padding: 30px 0;
box-sizing: border-box;
.create-form {
width: 100%;
box-sizing: border-box;
padding: 0 30px;
}
.el-form-line {
margin-bottom: 20px;
.label-word {
/deep/ .el-form-item__content {
line-height: 20px;
}
/deep/ .el-form-item__label {
line-height: 20px;
margin-right: 0;
}
}
}
.mr2 {
margin-right: 20px;
}
.allTagsWrap {
.label {
background: #f4f6fc;
border-radius: 4px;
border: 1px solid #e8e8ea;
text-align: center;
margin-right: 4px;
margin-top: 4px;
position: relative;
padding: 0 8px;
height: 26px;
line-height: 26px;
box-sizing: border-box;
display: inline-block;
}
.isChecked {
border: 1px solid #5850ff !important;
color: #5850ff;
.select-icon {
width: 16px;
height: 16px;
position: absolute;
top: 0;
right: 0;
}
}
}
}
}
.crowd-dialog-wrap {
.condition {
margin-bottom: 16px;
line-height: 21px;
b {
color: #666666;
}
span {
white-space: nowrap;
}
}
.static-image {
width: 335px;
height: 325px;
img {
width: 100%;
}
}
}
.crowd-logic-dialog-wrap {
display: flex;
.crowd-flex {
display: flex;
flex-direction: column;
align-items: center;
}
.crowd-line {
width: 1px;
background: #5850ff;
}
.moreover {
text-align: center;
font-size: 16px;
font-weight: 500;
color: #5850ff;
line-height: 35px;
width: 35px;
height: 35px;
background: #efeeff;
border-radius: 4px;
border: 1px solid #5850ff;
}
.crowd-logic-wrap {
width: 100%;
height: auto;
.crowd-logic-labels {
width: 625px;
background: #ffffff;
border-radius: 4px;
border: 1px solid #e5e5e5;
padding: 10px;
box-sizing: border-box;
margin-top: 10px;
.crowd-logic-label-group-name {
line-height: 21px;
}
.crowd-logic-tag {
padding: 1px 8px;
line-height: 24px;
height: 26px;
background: #f4f6fc;
border-radius: 4px;
border: 1px solid #e8e8ea;
margin-top: 8px;
margin-right: 8px;
}
.perhaps {
margin-top: 8px;
margin-right: 8px;
font-weight: 400;
}
}
}
.crowd-logic-wrap :nth-child(1) {
margin-top: 0;
}
}
</style>