marketingPlan.vue
6.7 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
<template>
<div class="scrm-sub-client-container">
<div class="pageContent">
<GLCombiForm :rowNumber="1" :formObj="searchForm" :formData="searchFormList" @handleOk="searchTable" @handleRest="resetTable"></GLCombiForm>
<GLTable :hasNum="true" @setTableFinishFun="setTableFinishFun" :beforeSearchFn="beforeSearchFn" ref="marketingPlan" :getListApi="getListApi" :searchForm="searchForm" :pageConf="pageConf" :tableParams="tableParams">
<template slot="options" slot-scope="scope">
<el-button v-if="scope.scope.sopStatus != 1" type="text" @click="handleJump(scope.scope.id)">SOP分析</el-button>
<el-button v-if="scope.scope.sopStatus == 2" type="text" @click="handleEnd(scope.scope)">结束</el-button>
<el-button v-if="scope.scope.sopStatus != 3" type="text" @click="handleEdit(scope.scope)">编辑</el-button>
<el-button v-if="scope.scope.sopStatus == 1" type="text" @click="handleDelete(scope.scope)">删除</el-button>
</template>
</GLTable>
</div>
</div>
</template>
<script>
import { getSopInfoListApi } from '@/api/modules/clientDataOverview'
export default {
props: ['crowdGroupId'],
data() {
return {
searchForm: {
crowdGroupId: this.crowdGroupId
},
searchFormList: [
{
type: 'input',
inputType: 'text',
name: 'crowdName',
label: '人群名称'
},
{
type: 'select',
name: 'sopStatus',
label: '营销状态',
optionLabel: 'label',
optionId: 'value',
optionList: [
{
label: '全部',
value: ''
},
{
label: '未开始',
value: '1'
},
{
label: '进行中',
value: '2'
},
{
label: '已结束',
value: '3'
}
],
placeholder: '请选择'
}
],
baseData: {
sopStatusList: [
{
confId: 1,
confName: '未开始'
},
{
confId: 2,
confName: '进行中'
},
{
confId: 3,
confName: '已结束'
}
]
},
getListApi: getSopInfoListApi,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
tableParams: {
listName: 'list',
tableColumns: [
{
label: '人群名称',
prop: 'crowdName'
// line: 1,
// width: 220
},
{
label: 'SOP名称',
prop: 'sopName'
// width: 240,
// line: 1
},
{
label: '营销时间',
prop: 'startDate',
width: 220,
line: 1
},
{
label: '营销状态',
prop: 'sopStatus',
formatter: cellValue => {
return this.baseData.sopStatusList.map(item => item.confId).includes(cellValue.sopStatus) ? this.baseData.sopStatusList.find(item => item.confId == cellValue.sopStatus).confName : '-'
}
},
{
label: '完成度',
prop: 'sopStatistics',
formatter: cellValue => {
return cellValue.sopStatistics ? Math.round((cellValue.sopStatistics.finishEventCount / cellValue.sopStatistics.eventCount) * 100).toFixed(0) + '%' : '-'
}
},
{
label: '操作',
prop: 'options',
addHtml: 'options',
width: 180
}
]
}
}
},
mounted() {
//没数据的时候要算高度
},
methods: {
// 结束
handleEnd(row) {
this.secondConfirm('结束', '结束SOP后,将不再进行营销任务自动推送,且不可恢复。是否确定结束?', 'clientDataOverview', 'endSopEventApi', { sopId: row.id })
},
handleDelete(row) {
this.secondConfirm('删除', 'SOP删除后,不可恢复。是否确定删除?', 'clientDataOverview', 'deleteSopEventApi', { sopId: row.id })
},
secondConfirm(title, txt, apiModule, apiName, apiParams, fn) {
this.$confirm(txt, title, {
confirmButtonText: '确定',
cancelButtonText: '取消',
customClass: 'gl-message-box',
type: 'warning',
callback: action => {
if (action == 'confirm') {
this.$apis[apiModule][apiName](apiParams).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
fn && fn()
this.searchTable()
}
})
}
}
})
},
// 跳转SOP分析
handleJump(id) {
const { crowdGroupName, crowdGroupDesc } = this.$route.query
let query = JSON.stringify({
crowdId: this.crowdGroupId,
crowdGroupDesc,
selectTab: 'second',
crowdGroupName
})
if (this.$route.query && this.$route.query.flag == 1) {
query = JSON.stringify({
crowdId: this.crowdGroupId,
crowdGroupDesc,
crowdGroupName,
selectTab: 'second',
flag: 1
})
}
this.$history.push(`/marketing/sop/sopAnalysisList?fromPage=${encodeURI(`/custom/clientDataOverview/marketingPeople?crowQuery=${query}`)}&id=${id}`)
},
// 跳转到编辑营销SOP
handleEdit(row) {
const { crowdGroupName, crowdGroupDesc } = this.$route.query
let query = JSON.stringify({
crowdId: this.crowdGroupId,
selectTab: 'second',
crowdGroupDesc,
crowdGroupName
})
this.$history.push(`/marketing/sop/editSop?fromPage=${encodeURI(`/custom/clientDataOverview/marketingPeople?crowQuery=${query}`)}&addOrEdit=edit&id=${row.id}&$title=编辑SOP`)
},
setTableFinishFun() {
this.$refs.marketingPlan.data.length ? (this.$refs.marketingPlan.tableHeightValues = '') : this.$refs.marketingPlan.setTableHeightFun()
},
setTableHeightEvent() {
this.$refs.marketingPlan.setTableHeightFun()
},
// 搜索表格
searchTable() {
this.$refs.marketingPlan.refreshTable()
},
//重置表格
resetTable() {
this.searchForm = {
crowdGroupId: this.crowdGroupId
}
this.$refs.marketingPlan.refreshTable()
}
}
}
</script>
<style lang="scss" scoped>
.gl-footer {
z-index: 100;
}
/deep/ .el-tabs__content {
margin-bottom: 64px;
}
.pageContent {
padding: 20px 20px 30px;
background-color: #fff;
}
</style>