liuxiaona 1 year ago
parent
commit
c9aa918e4a

+ 4 - 1
src/api/ApiModel.ts

@@ -6,6 +6,9 @@ import {getCookie} from "@/common/common";
6 6
 export interface Objectof<v>{ // 对象类型
7 7
     [_:string]:v
8 8
 }
9
+export interface ANYELSE {
10
+    [propName:string]:any
11
+}
9 12
 export class descolObjectItem{
10 13
     name?: string;
11 14
     column?: string;
@@ -154,7 +157,7 @@ export interface directPacket extends pageParams{
154 157
     type?:string,
155 158
     targeting_id?:string
156 159
 }
157
-export interface ruleConfig{
160
+export interface ruleConfig extends ANYELSE{
158 161
     account_assign?:string|number,
159 162
     assign_type?:string|number,
160 163
     campaign_name?:string|number,

+ 27 - 13
src/components/businessMoudle/batchGdt/configArea/directPacket/newDirecPacket.vue

@@ -14,6 +14,7 @@
14 14
         {{id}}
15 15
 
16 16
         <Input class="bMar20" ref="InputRef_name" spanTitleWidth="112px" :showTitle="true" title="定向包名称" inputWidth="400px" maxLength="15"/>
17
+
17 18
         <template v-for="item in pageInfo.jsonInfo">
18 19
           {{item.value}}
19 20
           <CheckGroup v-if="item.isMultiple" :checkList="item.list"
@@ -21,17 +22,17 @@
21 22
                       :haveFlex="item.haveFlex"
22 23
                       :title="item.name"
23 24
                       :key="item.EgName"
24
-                      :echoVal="item.value"
25
+                      :echoVal="item.radioVal"
25 26
                       :id="id"
26
-                      @returnEvent="(val,flag)=>reEventCheck(val,item,flag)"></CheckGroup>
27
+                      @returnEvent="val=>{item.radioVal = val;getEstimation()}"></CheckGroup>
27 28
           <RadioGroup v-else :radioList="item.list"
28 29
                       :title="item.name"
29 30
                       :haveNotes="item.haveNotes"
30 31
                       :haveFlex="item.haveFlex"
31 32
                       :key="item.EgName"
32
-                      :echoVal="item.value"
33
+                      :echoVal="item.radioVal"
33 34
                       :id="id"
34
-                      @returnEvent="(val,flag)=>reEvent(val,item,flag)">
35
+                      @returnEvent="val=>reEventRadio(val,item)">
35 36
             <template v-if="item.EgName=='geo_location'" v-slot:appoint>
36 37
               <div class="tMar20">
37 38
                 <el-checkbox-group v-model="pageInfo.locationCheckList">
@@ -42,7 +43,7 @@
42 43
 
43 44
             <template v-if="item.EgName=='age'" v-slot:appoint>
44 45
               <div class="tMar20">
45
-                <el-input-number v-model="age_min" :min="14" :max="66" @change="ageEvent(item)"/> - <el-input-number v-model="age_max" :min="63" :max="66"  @change="ageEvent(item)"/>
46
+                <el-input-number v-model="item.value.min" :min="14" :max="66" @change="getEstimation"/> - <el-input-number v-model="item.value.min" :min="63" :max="66"  @change="getEstimation"/>
46 47
               </div>
47 48
             </template>
48 49
 
@@ -86,7 +87,7 @@
86 87
 </template>
87 88
 <script setup lang="ts">
88 89
 import {computed, getCurrentInstance, inject, nextTick, onMounted, reactive, ref} from "vue";
89
-import { directPacket, reactiveTableAndAny} from "@/api/ApiModel";
90
+import {directPacket, menuParam, reactiveTableAndAny} from "@/api/ApiModel";
90 91
 import Dialog from '@/components/capsulationMoudle/_dialog.vue'
91 92
 import RadioGroup from '@/components/businessMoudle/batchGdt/configArea/radioGroup.vue'
92 93
 import CheckGroup from '@/components/businessMoudle/batchGdt/configArea/checkGroup.vue'
@@ -120,6 +121,7 @@ const props = withDefaults(defineProps<{
120 121
 //得到上边传来的值
121 122
 const inject_accountId = inject('accountId')
122 123
 
124
+
123 125
 const pageInfo = reactive<reactiveTableAndAny>({
124 126
   transformation_behavior_list:[],
125 127
   locationCheckList:[],
@@ -133,40 +135,47 @@ const pageInfo = reactive<reactiveTableAndAny>({
133 135
   jsonInfo:[
134 136
     {
135 137
       isMultiple:false,
136
-      value:{},
137 138
       name:'地域',
138 139
       EgName:'geo_location',
139 140
       list:[
140 141
         {name:'不限',value:'unlimited'},
141 142
         {name:'指定区域',value:'appoint'},
142
-      ]
143
+      ],
144
+      radioVal:'unlimited',
145
+      value:[],
143 146
     },
144 147
     {
145 148
       isMultiple:false,
146
-      value:{},
147 149
       name:'年龄',
148 150
       EgName:'age',
149 151
       list:[
150 152
         {name:'不限',value:'unlimited'},
151 153
         {name:'指定',value:'appoint'},
152
-      ]
154
+      ],
155
+      radioVal:'unlimited',
156
+      value:[{
157
+        min:14,
158
+        max:63
159
+      }],
153 160
     },
154 161
     {
155 162
       isMultiple:false,
156
-      value:{},
157 163
       name:'性别',
158 164
       EgName:'gender',
159 165
       list:[
160 166
         {name:'不限',value:'unlimited'},
161 167
         {name:'男性',value:'MALE'},
162 168
         {name:'女性',value:'FEMALE'},
163
-      ]
169
+      ],
170
+      radioVal:'unlimited',
171
+      value:[],
164 172
     },
165 173
     {
166 174
       isMultiple:true,
167 175
       value:[],
168 176
       name:'学历',
169 177
       EgName:'education',
178
+      radioVal:'',
170 179
       list:[
171 180
         {name:'博士',value:'DOCTOR'},
172 181
         {name:'硕士',value:'MASTER'},
@@ -330,7 +339,7 @@ const InputRef_name = ref<{value:string}>()
330 339
 const age_min = ref<number>(14)
331 340
 const age_max = ref<number>(66)
332 341
 const ageEvent = (item:any) => {
333
-  item.value.subValue = age_min.value + '至' + age_max.value + '岁'
342
+  // item.value.subValue = age_min.value + '至' + age_max.value + '岁'
334 343
   getEstimation()
335 344
 }
336 345
 //排除已转化用户
@@ -340,6 +349,11 @@ const behaviorEvent = (val:any,item:any) => {
340 349
   getEstimation()
341 350
 }
342 351
 
352
+//回显值 RadioGroup
353
+const reEventRadio = (val:string,item:any) => {
354
+  item.radioVal = val
355
+  getEstimation()
356
+}
343 357
 
344 358
 //回显值 RadioGroup
345 359
 const reEvent = (val:any,item:any,flag?:boolean) => {

+ 15 - 3
src/components/businessMoudle/batchGdt/configArea/index.vue

@@ -64,7 +64,7 @@
64 64
   </div>
65 65
 
66 66
   <!--规则配置-->
67
-  <RuleConfig ref="RuleConfigRef"></RuleConfig>
67
+  <RuleConfig ref="RuleConfigRef" @ExposeEvent="val=>pageInfo.RuleConfigObj = val"></RuleConfig>
68 68
 
69 69
 <!-- 广告基本信息 -->
70 70
 <BasicInfo :visible="basicInfoData.visible" :dataFillBack="basicInfoData.fillBack" @close="basicInfoClose"></BasicInfo>
@@ -72,7 +72,7 @@
72 72
 </template>
73 73
 <script setup lang="ts">
74 74
 import {getCurrentInstance, nextTick, onMounted, reactive, ref, provide, computed,toRef} from "vue";
75
-import {adqParam, reactiveTableAndAny} from "@/api/ApiModel";
75
+import {adqParam, reactiveTableAndAny, ruleConfig} from "@/api/ApiModel";
76 76
 import Select from '@/components/capsulationMoudle/_select.vue'
77 77
 import DirectPacketExhibition from '@/components/businessMoudle/batchGdt/configArea/directPacket/echoIndex.vue'
78 78
 import RuleConfig from '@/components/businessMoudle/batchGdt/configArea/ruleConfig/index.vue'
@@ -89,7 +89,6 @@ const { proxy } = getCurrentInstance() as any;
89 89
 const NumberHandle = proxy.$NumberHandle
90 90
 
91 91
 
92
-
93 92
 const pageInfo = reactive<reactiveTableAndAny>({
94 93
   adNum:0,
95 94
   targetList:[],
@@ -108,6 +107,7 @@ const pageInfo = reactive<reactiveTableAndAny>({
108 107
   accountList:[],
109 108
   accIdsList:[],//选中的格式化后的账户列表
110 109
   directObj:{},//定向包展示的数据
110
+  RuleConfigObj:{},//规则配置的值
111 111
 })
112 112
 
113 113
 
@@ -209,9 +209,21 @@ onMounted(()=>{
209 209
   nextTick(()=>{
210 210
     get_account_list()
211 211
     getAdPresetsInfo(); // 广告预存信息获取
212
+    get_ruleConfig_info() //规则配置获取
212 213
   })
213 214
 })
214 215
 
216
+// 得到规则配置的值
217
+const get_ruleConfig_info = async () => {
218
+  let res:any = await proxy.$http.get(Api.ruleConfig_get)
219
+  if(res&&res.errNo=='0'){
220
+    let resNew:any = res.rst
221
+    pageInfo.RuleConfigObj = resNew
222
+  }else{
223
+    ElMessage.error(res.errMsg)
224
+  }
225
+}
226
+
215 227
 /**广告基础信息回调 */
216 228
 const basicInfoClose = (obj) => {
217 229
   if(obj?.type=='update'){

+ 11 - 35
src/components/businessMoudle/batchGdt/configArea/radioGroup.vue

@@ -6,7 +6,7 @@
6 6
       <template v-if="radioList&&radioList.length>0">
7 7
         <div :class="haveFlex ? 'haveFlex' : ''">
8 8
           <div class="flex">
9
-            <el-radio-group v-model="value" @change="val=>returnValueEvent(true)">
9
+            <el-radio-group v-model="value" @change="val=>returnValueEvent">
10 10
               <el-radio-button v-for="item in radioList" :label="item.value" :disabled="item.disabled" :title="item.disTitle">{{item.name}}</el-radio-button>
11 11
             </el-radio-group>
12 12
             <Tooltip v-if="toolTipsVal" :notes="toolTipsVal" effect="light" popperClass="wid400"/>
@@ -27,11 +27,11 @@
27 27
 
28 28
 </template>
29 29
 <script lang="ts" setup>
30
-import {nextTick, onMounted, ref, watch} from "vue";
30
+import { ref, watch} from "vue";
31 31
 import Tooltip from '@/components/capsulationMoudle/_tooltip.vue'
32 32
 
33 33
 const emit = defineEmits<{
34
-  (event: "returnEvent", val: string | number | boolean,flag?:boolean): void;
34
+  (event: "returnEvent", val: string | number | boolean): void;
35 35
 }>();
36 36
 
37 37
 const value=ref('')
@@ -47,7 +47,7 @@ const props = withDefaults(defineProps<{
47 47
   alignItems?:string,
48 48
   haveFlex?:boolean,
49 49
   toolTipsVal?:string,
50
-  echoVal?:any,
50
+  echoVal?:string,
51 51
   id?:string|number,
52 52
 }>(),{
53 53
   spanTitleWidth: '',
@@ -60,44 +60,20 @@ const props = withDefaults(defineProps<{
60 60
   alignItems:'center',
61 61
   haveFlex:false,
62 62
   toolTipsVal:'',
63
-  echoVal:{},
63
+  echoVal:'',
64 64
   id:''
65 65
 })
66 66
 
67
-
68
-
69 67
 //返回值
70
-const returnValueEvent = (flag?:boolean)=>{
71
-  let reVal:any = {}
72
-  props.radioList.forEach(item=>{
73
-    if(value.value == item.value){
74
-      reVal = item
75
-    }
76
-  })
77
-  emit('returnEvent',reVal,flag)
68
+const returnValueEvent = ()=>{
69
+  emit('returnEvent',value.value)
78 70
 }
79 71
 
80
-
81
-// 暴露自己的属性供父组件使用
82
-defineExpose({
83
-  value
84
-});
85
-
86
-onMounted(()=>{
87
-  nextTick(()=>{
88
-    if(props.radioList&&props.radioList.length>0){
89
-      value.value = props.radioList[0].value
90
-      if(!props.id) {
91
-        returnValueEvent(false)
92
-      }
93
-    }
94
-  })
95
-})
96
-
97
-watch(()=>props.id,()=>{
98
-  value.value = props.echoVal ? props.echoVal.value : props.radioList[0].value
99
-  // returnValueEvent(true)
72
+watch(()=>props.echoVal,()=>{
73
+  value.value = props.echoVal ? props.echoVal : props.radioList[0].value
74
+  emit('returnEvent',value.value)
100 75
 },{immediate:true,deep:true})
76
+
101 77
 </script>
102 78
 
103 79
 <style lang="scss" scoped>

+ 17 - 2
src/components/businessMoudle/batchGdt/configArea/ruleConfig/index.vue

@@ -2,7 +2,7 @@
2 2
   <Dialog
3 3
       :dialogVisible="dialogShow"
4 4
       @confirm="confirmEvent"
5
-      @close="dialogShow = false"
5
+      @close="closeEvent"
6 6
       width="700px"
7 7
       height="calc(100vh - 190px)"
8 8
       top="8px"
@@ -93,7 +93,7 @@
93 93
   </Dialog>
94 94
 </template>
95 95
 <script setup lang="ts">
96
-import {getCurrentInstance, nextTick, onMounted, reactive, ref} from "vue";
96
+import {getCurrentInstance, nextTick, onMounted, reactive, ref,watch} from "vue";
97 97
 import {reactiveTableAndAny, ruleConfig} from "@/api/ApiModel";
98 98
 import RadioGroup from '@/components/businessMoudle/batchGdt/configArea/radioGroup.vue'
99 99
 import Tooltip from '@/components/capsulationMoudle/_tooltip.vue'
@@ -106,6 +106,10 @@ const { proxy } = getCurrentInstance() as any;
106 106
 // 全局方法定义
107 107
 const NumberHandle = proxy.$NumberHandle
108 108
 
109
+const emit = defineEmits<{
110
+  (event: "ExposeEvent",val:ruleConfig): void;
111
+}>();
112
+
109 113
 const WildcardList = [
110 114
   {name:'定向包名',value:''},
111 115
   {name:'素材名',value:''},
@@ -123,6 +127,9 @@ const WildcardList = [
123 127
   {name:'账户ID',value:''},
124 128
 ]
125 129
 
130
+//处理抛出去的值
131
+const ExposeValue = ref<ruleConfig>({})
132
+//页面的值
126 133
 const pageInfo = reactive<reactiveTableAndAny>({
127 134
   jsonInfo:[
128 135
     {
@@ -304,6 +311,7 @@ const confirmEvent = async () => {
304 311
   ElMessage.info(res.errMsg)
305 312
   if(res&&res.errNo=='0'){
306 313
     let resNew:any = res.rst
314
+    ExposeValue.value = paramsModel
307 315
     dialogShow.value = false
308 316
   }
309 317
 }
@@ -315,6 +323,7 @@ const echoValue = async () => {
315 323
   loading.value = false
316 324
   if(res&&res.errNo=='0'){
317 325
     let resNew:any = res.rst
326
+    ExposeValue.value = resNew
318 327
     pageInfo.jsonInfo.forEach(item=>{
319 328
       let subValue:string|number = resNew[item.EgName]
320 329
       let key:string = item.EgName
@@ -341,6 +350,11 @@ const echoValue = async () => {
341 350
     ElMessage.error(res.errMsg)
342 351
   }
343 352
 }
353
+//关闭
354
+const closeEvent = () => {
355
+  dialogShow.value = false
356
+  emit('ExposeEvent',ExposeValue.value)
357
+}
344 358
 
345 359
 // 切换显隐
346 360
 const dialogShow = ref<boolean>(false)
@@ -350,6 +364,7 @@ const switchShow = (val:boolean)=>{
350 364
     echoValue()
351 365
   }
352 366
 }
367
+
353 368
 // 父组件共享值
354 369
 defineExpose({
355 370
   switchShow,