|
@@ -0,0 +1,417 @@
|
|
1
|
+<template>
|
|
2
|
+ <div>
|
|
3
|
+ <div class="screenBox_mini">
|
|
4
|
+ <Input ref="InputRef_text" title="关键词" placeholderTxt="关键词" @changeEvent="()=>init()" @clearEvent="()=>init()"/>
|
|
5
|
+ <Select ref="acRef"
|
|
6
|
+ title="账号"
|
|
7
|
+ selectWidth="160px"
|
|
8
|
+ @changeEvent="()=>init()" @clearEvent="()=>init()"
|
|
9
|
+ :isMultiple="true"
|
|
10
|
+ :optObj="{k:'account_id',la:'account_id',val:'account_id'}"
|
|
11
|
+ :options="pageInfo.acList"/>
|
|
12
|
+ <Select ref="statusRef"
|
|
13
|
+ title="状态"
|
|
14
|
+ selectWidth="160px"
|
|
15
|
+ @changeEvent="()=>init()" @clearEvent="()=>init()"
|
|
16
|
+ :options="pageInfo.statusList"/>
|
|
17
|
+ <TimeScreen title="时间" selectWidth="260px" :haveQuick="false" :clearFlag="true" :valueIsKong="true"
|
|
18
|
+ ref="timeRef"
|
|
19
|
+ @init="()=>init()"></TimeScreen>
|
|
20
|
+ <span class="pointer c-theme lMar10" @click="clearEvent">清空</span>
|
|
21
|
+ <el-button class="lMarauto" type="primary" @click="goNewPlanEvent">新建计划</el-button>
|
|
22
|
+ </div>
|
|
23
|
+ <div>
|
|
24
|
+ <div class="bMar10 flex">
|
|
25
|
+ <Dropdown title="批量操作" :list="tableInfo.moreList" @close="dropdownEvent" class="rMar10"
|
|
26
|
+ :disabledFlag="tableInfo.multipleSelection&&tableInfo.multipleSelection.length == 0"></Dropdown>
|
|
27
|
+ <div>已选 : <span>{{tableInfo.multipleSelection&&tableInfo.multipleSelection.length}}</span></div>
|
|
28
|
+<!-- <el-button class="lMarauto" type="primary" @click="customIndEvent">自定义指标</el-button>-->
|
|
29
|
+
|
|
30
|
+ <div class="lMarauto">
|
|
31
|
+ <Indicators type="media_base" @refresh="IndicatorsRefreshList"></Indicators>
|
|
32
|
+ </div>
|
|
33
|
+ </div>
|
|
34
|
+我是账户列表
|
|
35
|
+ <el-table v-loading="loading" ref="tableRef" :data="tableInfo.tableList"
|
|
36
|
+ :header-cell-style="tableHeaderStyle"
|
|
37
|
+ :key="tableInfo.updateKey" style="width: 100%"
|
|
38
|
+ border empty-text="暂无数据"
|
|
39
|
+ row-key="campaign_id"
|
|
40
|
+ max-height="calc(100vh - 294px)">
|
|
41
|
+ <el-table-column fixed width="80" >
|
|
42
|
+ <template #header>
|
|
43
|
+ <div class="flex">
|
|
44
|
+ <el-checkbox v-model="tableInfo.chooseAll" @change="allChooseCheckboxEvent"></el-checkbox>
|
|
45
|
+ <el-dropdown class="lMar10" @command="handleCommandChoosePage">
|
|
46
|
+ <el-icon color="#3173FF"><i-ep-ArrowDownBold /></el-icon>
|
|
47
|
+ <template #dropdown>
|
|
48
|
+ <el-dropdown-menu>
|
|
49
|
+ <el-dropdown-item command="1">当前页</el-dropdown-item>
|
|
50
|
+ <el-dropdown-item command="2">全部</el-dropdown-item>
|
|
51
|
+ </el-dropdown-menu>
|
|
52
|
+ </template>
|
|
53
|
+ </el-dropdown>
|
|
54
|
+ </div>
|
|
55
|
+ </template>
|
|
56
|
+ <template #default="scope">
|
|
57
|
+ <div class="checkBoxSelf flex"
|
|
58
|
+ @click="singleChooseCheckboxEvent(tableInfo.multipleSelection.findIndex(n=>n.campaign_id == scope.row.campaign_id),scope.row)"
|
|
59
|
+ :class="tableInfo.multipleSelection.findIndex(n=>n.campaign_id == scope.row.campaign_id)>=0 ? 'active' : ''">
|
|
60
|
+ <el-icon color="#fff" v-if="tableInfo.multipleSelection.findIndex(n=>n.campaign_id == scope.row.campaign_id)>=0"><i-ep-Check /></el-icon>
|
|
61
|
+ </div>
|
|
62
|
+ </template>
|
|
63
|
+ </el-table-column>
|
|
64
|
+ <template v-for="item in tableInfo.descol">
|
|
65
|
+ <el-table-column :fixed="item.isfixed" :min-width="item.minWidth ? item.minWidth : '80px'">
|
|
66
|
+ <template #header>
|
|
67
|
+ <div class="flex"
|
|
68
|
+ :style="{ justifyContent: item.alignSelf ? item.alignSelf : 'center' }"
|
|
69
|
+ :class="[tableInfo.sortKey == item.column ? 'active_css' : '',item.isSort ? 'pointer' : '']"
|
|
70
|
+ @click="item.isSort&&sortEvent(item.column)">
|
|
71
|
+ {{ item.name }}
|
|
72
|
+ <el-tooltip v-if="item.notes" effect="dark" :content="item.notes"><i-ep-QuestionFilled class="lMar5 c-999 f14 pointer" /></el-tooltip>
|
|
73
|
+ <div v-if="item.isSort">
|
|
74
|
+ <div class="sortItem"><el-icon :color="tableInfo.sortKey == item.column ? '#3173FF' : ''"><i-ep-CaretBottom /></el-icon></div>
|
|
75
|
+ </div>
|
|
76
|
+ </div>
|
|
77
|
+ </template>
|
|
78
|
+ <template #default="scope">
|
|
79
|
+ <div class="flex" :style="{ justifyContent: item.alignSelf ? item.alignSelf : 'center' }">
|
|
80
|
+
|
|
81
|
+ <div v-if="item.column == 'campaign_name'">
|
|
82
|
+ <span class="c-theme flex campaignName">
|
|
83
|
+ <span class="pointer" @click="goAdvertEvent(scope.row.campaign_id)">{{scope.row[item.column]}}</span>
|
|
84
|
+ <el-icon color="#3173FF" class="pointer lMarauto f16 icon" @click="edit_campaign_name_event(scope.row)"><i-ep-Edit /></el-icon>
|
|
85
|
+ </span>
|
|
86
|
+ </div>
|
|
87
|
+ <div v-else-if="item.column == 'configured_status'">
|
|
88
|
+ <span class="c-green" v-if="scope.row[item.column] == 'AD_STATUS_NORMAL'">正常</span>
|
|
89
|
+ <span class="c-red" v-else-if="scope.row[item.column] == 'AD_STATUS_SUSPEND'">暂停</span>
|
|
90
|
+ <span v-else>-</span>
|
|
91
|
+ </div>
|
|
92
|
+ <div v-else-if="item.column == 'speed_mode'">
|
|
93
|
+ <span v-if="scope.row[item.column] == 'SPEED_MODE_STANDARD'">标准投</span>
|
|
94
|
+ <span v-else-if="scope.row[item.column] == 'SPEED_MODE_FAST'">加速投放</span>
|
|
95
|
+ <span v-else>-</span>
|
|
96
|
+ </div>
|
|
97
|
+ <div v-else-if="item.column == 'operate'">
|
|
98
|
+ <div class="flex">
|
|
99
|
+ <span class="c-theme pointer" @click="editPlanEvent(scope.row)">修改</span>
|
|
100
|
+ <span class="lMar10"
|
|
101
|
+ :class="scope.row.configured_status == 'AD_STATUS_NORMAL' ? 'pointer-drop c-green-opa' : 'pointer c-green'"
|
|
102
|
+ @click="scope.row.configured_status == 'AD_STATUS_SUSPEND'&&batchPlanEvent(scope.row,1)">启用</span>
|
|
103
|
+ </div>
|
|
104
|
+ <div>
|
|
105
|
+ <span :class="scope.row.configured_status == 'AD_STATUS_SUSPEND' ? 'pointer-drop c-red-opa' : 'pointer c-red'"
|
|
106
|
+ @click="scope.row.configured_status == 'AD_STATUS_NORMAL'&&batchPlanEvent(scope.row,2)">暂停</span>
|
|
107
|
+ <Popconfirm key="dele" @confirm="batchPlanEvent(scope.row,3)" :slotFlag="true">
|
|
108
|
+ <template #con>
|
|
109
|
+ <span class="pointer lMar10">删除</span>
|
|
110
|
+ </template>
|
|
111
|
+ </Popconfirm>
|
|
112
|
+
|
|
113
|
+ </div>
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+ </div>
|
|
117
|
+ <div class="flex c-theme pointer" v-else-if="item.column == 'daily_budget'" @click="editPlanEvent(scope.row)">
|
|
118
|
+ {{scope.row[item.column] ? NumberHandle(scope.row[item.column]) : '不限'}}
|
|
119
|
+ </div>
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+ <div class="cellDiv" :class="tableInfo.sortKey == item.column ? 'active_css' : ''" v-else>
|
|
123
|
+ <el-tooltip :disabled="!(scope.row[item.column] && scope.row[item.column].length >30)" effect="dark" :content="scope.row[item.column]+''">
|
|
124
|
+ <div class="clampTwo line21" style="flex: 1">
|
|
125
|
+ {{ scope.row[item.column] || scope.row[item.column]==0 ?
|
|
126
|
+ (item.cancleForMat ? (scope.row[item.column] ? scope.row[item.column] : '-') : NumberHandle(scope.row[item.column])) : '-'}}
|
|
127
|
+ <span v-if="item.hasPercent&&(scope.row[item.column] || scope.row[item.column] ==0)">%</span>
|
|
128
|
+ </div>
|
|
129
|
+ </el-tooltip>
|
|
130
|
+ </div>
|
|
131
|
+ </div>
|
|
132
|
+ </template>
|
|
133
|
+ </el-table-column>
|
|
134
|
+ </template>
|
|
135
|
+ </el-table>
|
|
136
|
+
|
|
137
|
+ <div class="paginationBox flex" style="justify-content: center" v-if="Number(tableInfo.total) > 0">
|
|
138
|
+ <el-pagination
|
|
139
|
+ v-model:currentPage="tableInfo.currentPage"
|
|
140
|
+ v-model:page-size="tableInfo.pageSize"
|
|
141
|
+ background
|
|
142
|
+ :total="tableInfo.total"
|
|
143
|
+ @current-change="handleCurrentChange" />
|
|
144
|
+ </div>
|
|
145
|
+ </div>
|
|
146
|
+
|
|
147
|
+ <EditIpt ref="planEditIptRef" title="推广计划" @confirm="planEditConfirm"></EditIpt>
|
|
148
|
+ <TargetEdit ref="TargetEditRef" title="计划设置" @confirm="init"></TargetEdit>
|
|
149
|
+ </div>
|
|
150
|
+</template>
|
|
151
|
+<script setup lang="ts">
|
|
152
|
+import {getCurrentInstance, nextTick, onMounted, reactive, ref} from "vue";
|
|
153
|
+import Select from '@/components/capsulationMoudle/_select.vue'
|
|
154
|
+import TimeScreen from '@/components/capsulationMoudle/timeScreen.vue'
|
|
155
|
+import Input from '@/components/capsulationMoudle/_input.vue'
|
|
156
|
+import EditIpt from '@/components/businessMoudle/gdtList/dialog/editIpt.vue'
|
|
157
|
+import TargetEdit from '@/components/businessMoudle/gdtList/dialog/target.vue'
|
|
158
|
+import Dropdown from '@/components/capsulationMoudle/_dropdown.vue'
|
|
159
|
+import Popconfirm from '@/components/capsulationMoudle/_popconfirm.vue'
|
|
160
|
+import noData from '@/components/capsulationMoudle/noData.vue'
|
|
161
|
+import {listTs} from "@/components/businessMoudle/gdtList/ts/list";
|
|
162
|
+import {Api} from "@/api/api";
|
|
163
|
+import {ElMessage} from "element-plus";
|
|
164
|
+import {batchGdt_edit, batchGdt_list, reactiveTableAndAny} from "@/api/ApiModel";
|
|
165
|
+import Indicators from './indicators/index.vue'
|
|
166
|
+
|
|
167
|
+const { proxy } = getCurrentInstance() as any;
|
|
168
|
+// 全局方法定义
|
|
169
|
+const NumberHandle = proxy.$NumberHandle
|
|
170
|
+
|
|
171
|
+const emit = defineEmits<{
|
|
172
|
+ (event: "goNewPlan"): void;
|
|
173
|
+ (event: "goAdvert",campaign_id:any): void;
|
|
174
|
+}>();
|
|
175
|
+const goNewPlanEvent = () => {
|
|
176
|
+ emit('goNewPlan')
|
|
177
|
+}
|
|
178
|
+const goAdvertEvent = (campaign_id:any) => {
|
|
179
|
+ emit('goAdvert',campaign_id)
|
|
180
|
+}
|
|
181
|
+
|
|
182
|
+const loading = ref<boolean>(false)
|
|
183
|
+const tableInfo = reactive<reactiveTableAndAny>({
|
|
184
|
+ tableList:[],
|
|
185
|
+ tableList_all:[],
|
|
186
|
+ descol:[
|
|
187
|
+ { name:'计划名称',column:'campaign_name',slotFlag: true,isfixed:true,alignSelf:'left'},
|
|
188
|
+ { name:'操作',column:'operate',slotFlag: true,isfixed:true},
|
|
189
|
+ { name:'账号ID',column:'account_id',cancleForMat:true},
|
|
190
|
+ { name:'计划ID',column:'campaign_id',cancleForMat:true},
|
|
191
|
+ { name:'计划类型',column:'campaign_type'},
|
|
192
|
+ { name:'推广目标类型',column:'promoted_object_type'},
|
|
193
|
+ { name:'日预算(元)',column:'daily_budget',slotFlag: true},
|
|
194
|
+ // { name:'总预算',column:'total_budget'},
|
|
195
|
+ { name:'投放日期',column:'created_time'},
|
|
196
|
+ { name:'客户状态',column:'configured_status',slotFlag: true},
|
|
197
|
+ { name:'投放速度',column:'speed_mode',slotFlag: true},
|
|
198
|
+ ],
|
|
199
|
+ multipleSelection:[],
|
|
200
|
+ updateKey:1,
|
|
201
|
+ chooseAll:false,
|
|
202
|
+ sortKey:'',
|
|
203
|
+ moreList:[
|
|
204
|
+ {value:'1',label:'启用'},
|
|
205
|
+ {value:'2',label:'暂停'},
|
|
206
|
+ {value:'3',label:'删除'},
|
|
207
|
+ ],
|
|
208
|
+ currentPage:1,
|
|
209
|
+ pageSize:20,
|
|
210
|
+ total:0,
|
|
211
|
+ totalPages:0,//共多少页
|
|
212
|
+})
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+//批量操作
|
|
217
|
+const batchEvent = () => {
|
|
218
|
+
|
|
219
|
+}
|
|
220
|
+
|
|
221
|
+// 启用 暂停 删除
|
|
222
|
+const batchPlanApi = async (arr?:any,val?:any) => {
|
|
223
|
+ const paramsModel = reactive<batchGdt_edit>({
|
|
224
|
+ campaign_infos:JSON.stringify(arr),
|
|
225
|
+ flag:val?val:0
|
|
226
|
+ })
|
|
227
|
+ let res:any = await proxy.$http.post(Api.batchGdt_plan_batch_edit,paramsModel)
|
|
228
|
+ ElMessage.info(res.errMsg)
|
|
229
|
+ if(res&&res.errNo=='0'){
|
|
230
|
+ init()
|
|
231
|
+ tableInfo.multipleSelection = []
|
|
232
|
+ }else{
|
|
233
|
+ loading.value = false
|
|
234
|
+ }
|
|
235
|
+}
|
|
236
|
+const batchPlanEvent = async (row?:any,val?:any) => {
|
|
237
|
+ loading.value = true
|
|
238
|
+ let arr:any = []
|
|
239
|
+ arr.push({
|
|
240
|
+ account_id:row.account_id,
|
|
241
|
+ campaign_id:row.campaign_id
|
|
242
|
+ })
|
|
243
|
+ batchPlanApi(arr,val)
|
|
244
|
+
|
|
245
|
+}
|
|
246
|
+const dropdownEvent = (val: string | number | object) => {
|
|
247
|
+ loading.value = true
|
|
248
|
+ let arr:any = []
|
|
249
|
+ tableInfo.multipleSelection.forEach(item=>{
|
|
250
|
+ arr.push({
|
|
251
|
+ account_id:item.account_id,
|
|
252
|
+ campaign_id:item.campaign_id
|
|
253
|
+ })
|
|
254
|
+ })
|
|
255
|
+ batchPlanApi(arr,val)
|
|
256
|
+}
|
|
257
|
+
|
|
258
|
+//修改计划
|
|
259
|
+const editPlanEvent = (row:any) => {
|
|
260
|
+ nextTick(()=>{
|
|
261
|
+ TargetEditRef.value!.switchShow(true,row)
|
|
262
|
+ })
|
|
263
|
+}
|
|
264
|
+//修改计划名称
|
|
265
|
+const edit_campaign_name_event = (row:any) => {
|
|
266
|
+ nextTick(()=>{
|
|
267
|
+ planEditIptRef.value!.switchShow(true,row.campaign_name)
|
|
268
|
+ })
|
|
269
|
+}
|
|
270
|
+//推广计划 - 确定
|
|
271
|
+const planEditConfirm = () => {
|
|
272
|
+
|
|
273
|
+}
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+//排序
|
|
277
|
+const sortEvent = (row:any) => {
|
|
278
|
+
|
|
279
|
+}
|
|
280
|
+
|
|
281
|
+//列表
|
|
282
|
+const init = async (page?:any,totalPages?:any) => {
|
|
283
|
+ loading.value = true
|
|
284
|
+ const paramsModel = reactive<batchGdt_list>({
|
|
285
|
+ account_ids:acRef.value!.value,
|
|
286
|
+ keyword:InputRef_text.value!.value,
|
|
287
|
+ status:statusRef.value!.value,
|
|
288
|
+ start:timeRef.value!.dateVal&&timeRef.value!.dateVal[0],
|
|
289
|
+ end:timeRef.value!.dateVal&&timeRef.value!.dateVal[1],
|
|
290
|
+ page:page?page:1,
|
|
291
|
+ pageSize:totalPages ? totalPages : tableInfo.pageSize
|
|
292
|
+ })
|
|
293
|
+ let res:any = await proxy.$http.get(Api.batchGdt_plan_list,paramsModel)
|
|
294
|
+ loading.value = false
|
|
295
|
+ if(res&&res.errNo=='0'){
|
|
296
|
+ if(totalPages){
|
|
297
|
+ tableInfo.tableList_all = res.rst.data
|
|
298
|
+ }else{
|
|
299
|
+ tableInfo.tableList = res.rst.data
|
|
300
|
+ tableInfo.total = res.rst.pageInfo.total
|
|
301
|
+ tableInfo.totalPages = res.rst.pageInfo.total
|
|
302
|
+ }
|
|
303
|
+ }else{
|
|
304
|
+ ElMessage.error(res.errMsg)
|
|
305
|
+ }
|
|
306
|
+}
|
|
307
|
+
|
|
308
|
+//分页
|
|
309
|
+const handleCurrentChange = (val) => {
|
|
310
|
+ tableInfo.currentPage = val
|
|
311
|
+ init(val)
|
|
312
|
+}
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+//清空值
|
|
316
|
+const clearChooseVal = ()=>{
|
|
317
|
+ tableInfo.chooseAll = false
|
|
318
|
+ tableInfo.multipleSelection = []
|
|
319
|
+}
|
|
320
|
+//添加值
|
|
321
|
+const multipleSelection_add = (item?:any) => {
|
|
322
|
+ let idx:number = tableInfo.multipleSelection.findIndex(n=>n.campaign_id == item.campaign_id)
|
|
323
|
+ if(idx<0){
|
|
324
|
+ tableInfo.multipleSelection.push(item)
|
|
325
|
+ }
|
|
326
|
+}
|
|
327
|
+//删除值
|
|
328
|
+const multipleSelection_splice = (item?:any) => {
|
|
329
|
+ let idx:number = tableInfo.multipleSelection.findIndex(n=>n.campaign_id == item.campaign_id)
|
|
330
|
+ if(idx>=0){
|
|
331
|
+ tableInfo.multipleSelection.splice(idx,1)
|
|
332
|
+ }
|
|
333
|
+}
|
|
334
|
+const handleCommandChoosePage = async (command: string | number | object)=>{
|
|
335
|
+ let arr:any = tableInfo.tableList
|
|
336
|
+ clearChooseVal()
|
|
337
|
+ tableInfo.chooseAll = true
|
|
338
|
+ if(command == 2){ // 全部
|
|
339
|
+ await init(1,tableInfo.totalPages)
|
|
340
|
+ arr = tableInfo.tableList_all
|
|
341
|
+ }
|
|
342
|
+ arr.forEach(item=>{
|
|
343
|
+ multipleSelection_add(item)
|
|
344
|
+ })
|
|
345
|
+}
|
|
346
|
+//全选
|
|
347
|
+const allChooseCheckboxEvent = (val:string | number | boolean)=>{
|
|
348
|
+ tableInfo.tableList.forEach(item=>{
|
|
349
|
+ if(val){
|
|
350
|
+ multipleSelection_add(item)
|
|
351
|
+ }else{
|
|
352
|
+ tableInfo.multipleSelection = []
|
|
353
|
+ }
|
|
354
|
+ })
|
|
355
|
+}
|
|
356
|
+//单选
|
|
357
|
+const singleChooseCheckboxEvent = (idx:number,row:any)=>{
|
|
358
|
+ if(idx==-1){
|
|
359
|
+ tableInfo.multipleSelection.push(row)
|
|
360
|
+ }else{
|
|
361
|
+ tableInfo.multipleSelection.splice(idx,1)
|
|
362
|
+ tableInfo.chooseAll = false
|
|
363
|
+ }
|
|
364
|
+}
|
|
365
|
+
|
|
366
|
+const IndicatorsRefreshList = () => {
|
|
367
|
+ //这里刷新列表
|
|
368
|
+}
|
|
369
|
+
|
|
370
|
+const {
|
|
371
|
+ init_acList,
|
|
372
|
+ pageInfo,
|
|
373
|
+ timeRef,
|
|
374
|
+ acRef,
|
|
375
|
+ statusRef,
|
|
376
|
+ InputRef_text,
|
|
377
|
+ clearEvent,
|
|
378
|
+ tableHeaderStyle,
|
|
379
|
+ planEditIptRef,
|
|
380
|
+ TargetEditRef,
|
|
381
|
+ customIndEvent
|
|
382
|
+} = listTs()
|
|
383
|
+
|
|
384
|
+onMounted(()=>{
|
|
385
|
+ nextTick(async ()=>{
|
|
386
|
+ await init_acList()
|
|
387
|
+ await init()
|
|
388
|
+ })
|
|
389
|
+})
|
|
390
|
+</script>
|
|
391
|
+<style lang="scss" scoped>
|
|
392
|
+.campaignName{
|
|
393
|
+ .icon{
|
|
394
|
+ color: #3173FF;
|
|
395
|
+ opacity: 0;
|
|
396
|
+ }
|
|
397
|
+ &:hover{
|
|
398
|
+ .icon{
|
|
399
|
+ opacity: 1;
|
|
400
|
+ }
|
|
401
|
+ }
|
|
402
|
+}
|
|
403
|
+.checkBoxSelf{
|
|
404
|
+ width: 13px;
|
|
405
|
+ height: 13px;
|
|
406
|
+ border: 1px solid #d9d9d9;
|
|
407
|
+ border-radius: 2px;
|
|
408
|
+ &:hover{
|
|
409
|
+ cursor: pointer;
|
|
410
|
+ border: 1px solid #3173FF;
|
|
411
|
+ }
|
|
412
|
+ &.active{
|
|
413
|
+ border: 1px solid #3173FF;
|
|
414
|
+ background-color: #3173FF;
|
|
415
|
+ }
|
|
416
|
+}
|
|
417
|
+</style>
|