Kaynağa Gözat

'报表分析'

魏志佳 4 yıl önce
ebeveyn
işleme
7ae7b3c396

+ 6 - 0
src/views/modules/autoLaunch/autoLaunchList.vue

@@ -18,6 +18,7 @@ export default {
             currentStrategyId:'',
             currentPlanId:'',
             currentGroupId:'',
+            userId:'',
         }
     },
     components:{   
@@ -30,6 +31,11 @@ export default {
 
     mounted(){
        this.currentTabComponent='strategyList' 
+        let userInfo=localStorage.getItem('pro__Login_Userinfo');
+        let userId=''
+        if(userInfo){
+            this.userId=JSON.parse(userInfo).value.id
+        }
     },
     beforeDestroy() {
         this.currentTabComponent='strategyList' 

Dosya farkı çok büyük olduğundan ihmal edildi
+ 1651 - 0
src/views/modules/autoLaunch/autoLaunchReport.vue


+ 2 - 2
src/views/modules/autoLaunch/components/MultiCheckBox.vue

@@ -116,7 +116,7 @@ import { getAction, postAction, downFile, downFilePost } from '@/api/manage';
               currentList:this.curLayerNum>1? this.listArr : []
             })
           },
-            deep: true
+          deep: true
       },
 
       parentChecked: {
@@ -204,7 +204,7 @@ import { getAction, postAction, downFile, downFilePost } from '@/api/manage';
             value:'all',
             checked:e.target.checked,
             indeterminates:false,
-            parentCode:this.listArr[0].parentCode
+            parent:this.listArr[0].parent
         })
       },
       

+ 248 - 0
src/views/modules/autoLaunch/components/Treeselect.vue

@@ -0,0 +1,248 @@
+<style lang="scss" scoped>
+.select-project {
+  width: 50%;
+}
+</style>
+<template>
+  <div class="select-project">
+    <treeselect
+      :multiple="multiple"
+      :disable-branch-nodes="!multiple"
+      :options="options"
+      :load-options="loadOptions"
+      placeholder="请选择项目以及账户"
+      v-model="value"
+      :value-consists-of="valueConsistsOf"
+      :auto-load-root-options="false"
+      @select="update"
+      @input="emitValue"
+      :limit="2"
+      :default-options="true"
+      :limitText="
+        count => {
+          return '隐藏' + count + '条'
+        }
+      "
+      noChildrenText="该项目下暂无账号"
+      :noOptionsText="showLoading"
+    />
+  </div>
+</template>
+
+<script>
+//   @open="getParticipateList"
+// import the component
+import Treeselect from '@riophae/vue-treeselect'
+// import the styles
+import '@riophae/vue-treeselect/dist/vue-treeselect.css'
+import { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
+
+import { getAction, postAction } from '@/api/manage'
+import { mapGetters } from 'vuex'
+// We just use `setTimeout()` here to simulate an async operation
+// instead of requesting a real API server for demo purpose.
+let called = false
+export default {
+  data: () => ({
+    value: null,
+    valueConsistsOf: 'LEAF_PRIORITY',
+    options: [],
+    showLoading: 'loading...',
+  }),
+  props: {
+    //是否多选
+    multiple: {
+      type: Boolean,
+      default() {
+        return true
+      },
+    },
+    appId: {
+      
+      default() {
+        return ''
+      },
+    },
+    //判断媒体类型
+    request: {
+      type: String,
+      default() {
+        return '2,4'
+      },
+    },
+    //一级请求接口
+    reqUrl: {
+      type: String,
+      default() {
+        return '/ctop/projectMember/participateListByMediaId'
+      },
+    },
+  },
+  components: {
+    Treeselect,
+  },
+  watch: {
+    $route(n, o) {},
+      appId: {
+        handler(n, o) {
+          console.log(n)
+          if (n.length == 0) {
+            if (this.multiple) {
+              this.value = []
+            } else {
+              this.value = undefined
+            }
+          }else{
+            this.value=this.appId
+          }
+        },
+        deep: true
+      }
+  },
+  methods: {
+    ...mapGetters(['nickname', 'avatar', 'userInfo']),
+    update(node, id) {
+      // console.log(node)
+      // getAction('/ctop/userAllocation/getAccountListByProjectId', {
+      //   projectId: node.id,
+      // }).then((res) => {
+      //   // console.log(res)
+      //   if (res.code == 0) {
+      //     if (res.result.length > 0) {
+      //       node.children = res.result.map((item) => {
+      //         return {
+      //           id: item.accountId,
+      //           label: item.userName + '         ' + item.authName,
+      //         }
+      //       })
+      //     } else {
+      //     }
+      //   } else {
+      //     new Error('Failed to load options: network error.')
+      //   }
+      // })
+    },
+    emitValue() {
+      this.$emit('update:appId', this.value)
+    },
+    loadOptions({ action, parentNode, callback }) {
+      // Typically, do the AJAX stuff here.
+      // Once the server has responded,
+      // assign children options to the parent node & call the callback.
+      if (action === LOAD_CHILDREN_OPTIONS) {
+        // getAction('/ctop/userAllocation/getAccountListByProjectId', {
+        //   projectId: parentNode.id,
+        // }).then((res) => {
+        //   if (res.code == 0) {
+        //     if (res.result.length > 0) {
+        //       parentNode.children = res.result.map((item) => {
+        //         return {
+        //           id: item.accountId,
+        //           label: item.userName + '\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0' + item.authName,
+        //         }
+        //       })
+        //       callback()
+        //     } else {
+        //       parentNode.children = []
+        //       callback()
+        //     }
+        //   } else {
+        //     callback(new Error('Failed to load options: network error.'))
+        //   }
+        // })
+      }
+    },
+    getParticipateList() {
+      //我参与的
+      //   toutiaoParticipateList
+      var params = {}
+      params.userId = this.userInfo().id
+
+      if (this.request == '1,3') {
+        params.type = 'bytedance'
+      } else if (this.request == '2,4') {
+        params.type = 'kuaishou'
+      }
+
+      if (this.reqUrl == '/ctop/projectMember/participateListByMediaId') {
+        postAction(this.reqUrl, params).then((res) => {
+          if (res.success) {
+            this.options = res.result.map((item) => {
+              return {
+                id: item.projectId + 'projectId',
+                label: item.projectName + '\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0' + item.advertiserName,
+                children: item.accountList
+                  ? item.accountList.map((i) => {
+                      return {
+                        id: i.accountId,
+                        label:
+                          (i.userName.length==2?i.userName+'\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0':i.userName.length==3?i.userName+'\xa0\xa0\xa0\xa0':i.userName) +
+                          '\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0' +
+                          i.accountId +
+                          '\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0' +
+                          i.authName,
+                      }
+                    })
+                  : [],
+              }
+            })
+          }
+        })
+      } else if(this.reqUrl == '/ctop/userAllocation/getAccountIdsByUserId'){
+          getAction(this.reqUrl, {
+            userId: this.userInfo().id,
+          }).then((res) => {
+            if (res.success) {
+              if (res.result.length > 0) {
+                res.result.forEach((element,index) => {
+                  if(element){                  
+                      this.options.push({});                    
+                    
+                        this.options.label=element.auth_name+'_('+element.project_name+')'
+                        this.options.id=element.account_id;
+                        this.options.key=element.account_id;                  
+                  }      
+                });
+              } else {
+                this.showLoading = '暂无数据'
+              }
+            }
+          })
+      }else {
+        getAction(this.reqUrl, {
+          userId: this.userInfo().id,
+        }).then((res) => {
+          if (res.code == 0) {
+            if (res.result.length > 0) {
+              var arr = this.request.split(',')
+              var dataTwo = []
+              var data = res.result.filter((item) => {
+                return item.mediaId == arr[0]
+              })
+              if (arr.length > 1) {
+                dataTwo = res.result.filter((item) => {
+                  return item.mediaId == arr[1]
+                })
+              }
+              var allData = data.concat(dataTwo)
+              this.options = allData.map((item) => {
+                return {
+                  id: item.projectId,
+                  label: item.projectName + '\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0' + item.advertiserName,
+                  children: null,
+                }
+              })
+            } else {
+              this.showLoading = '暂无数据'
+            }
+          }
+        })
+      }
+    },
+  },
+
+  mounted() {
+    this.getParticipateList()
+  },
+}
+</script>

+ 90 - 65
src/views/modules/autoLaunch/components/linkMultiSelect.vue

@@ -73,27 +73,28 @@
           
           let childrensArr = Array.from(this.$refs.mycheckBox.children)
           setTimeout(() => {
-            // console.log(val, index)
+            console.log(val, index)
             // console.log(val.data.checked)
             if (index == 1 || this.clickKey == 1) {
                 this.$refs.mycheckBox.style.width = '100%'
-                if(val.data.hasChild){
+                if(val.data.code&&this.maxLayers>index){
                     getAction(this.listUrl,{
-                        parentCode:val.data.code,
-                        level:this.maxLayers
+                        parent:val.data.code,
+                        // level:2
                     }).then((res)=>{
                         // console.log(res);
                         if(res.success){
-                            if(res.data.length>0){
-                                res.data.forEach((item,index)=>{
+                            if(res.result.length>0){
+                                res.result.forEach((item,index)=>{
                                     
-                                    item.value=item.code
+                                    item.value=item.regionId
+                                    item.code=item.regionId
                                     item.checked=val.data.checked;
                                     item.indeterminates=false;
                                 })
                                 // console.log(this.checkedShowList)
                                 this.checkedShowList.forEach((ele)=>{
-                                  res.data.forEach((item)=>{
+                                  res.result.forEach((item)=>{
                                       if(ele.code==item.code){
                                             item.checked=true;
                                             return
@@ -110,40 +111,50 @@
                                 this.parentChecked1 = val.data.checked
                                 this.parentChecked2 = val.data.checked
                                 this.parentChecked3 = val.data.checked
-                                this.listArr2=res.data
+                                this.listArr2=res.result
                                 this.title2 = val.data.name
-                            }                    
+                            }else{
+                                this.listArr3 = []
+                                this.title3 = ''
+                                this.listArr4 = []
+                                this.title4 = ''
+                                this.listArr2 = []
+                                this.title2 = ''
+                                this.resetStyle(childrensArr, index)
+                            }                      
                         };
                         
                     })  
-                }else{
-                    this.listArr3 = []
-                    this.title3 = ''
-                    this.listArr4 = []
-                    this.title4 = ''
-                    this.listArr2 = []
-                    this.title2 = ''
-                    this.resetStyle(childrensArr, index)
-                }  
                 
+                }
+                if(val.data.value=='all'){
+                  this.listArr3 = []
+                  this.title3 = ''
+                  this.listArr4 = []
+                  this.title4 = ''
+                  this.listArr2 = []
+                  this.title2 = ''
+                  this.resetStyle(childrensArr, index)
+                }
                 //  this.checkedShowList=val.checkList     
             } else if (index == 2 || this.clickKey == 2) {
-                if(val.data.hasChild){
+                if(val.data.code&&this.maxLayers>index){
                     getAction(this.listUrl,{
-                        parentCode:val.data.code,
-                        level:this.maxLayers
+                        parent:val.data.code,
+                      //  level:3
                     }).then((res)=>{
                         // console.log(res);
                         if(res.success){
-                            if(res.data.length>0){
-                                res.data.forEach((item,index)=>{
-                                    item.value=item.code
+                            if(res.result.length>0){
+                                res.result.forEach((item,index)=>{
+                                    item.value=item.regionId
+                                    item.code=item.regionId
                                     item.checked=val.data.checked;
                                     item.indeterminates=false;
                                 
                                 })
                                 this.checkedShowList.forEach((ele)=>{
-                                  res.data.forEach((item)=>{
+                                  res.result.forEach((item)=>{
                                       if(ele.code==item.code){
                                             item.checked=true;
                                         }
@@ -157,25 +168,33 @@
                                 this.styleHandle(childrensArr, index)
                                 this.parentChecked2 = val.data.checked
                                 this.parentChecked3 = val.data.checked
-                                this.listArr3=res.data
+                                this.listArr3=res.result
                                 this.title3 = val.data.name
+                            }else{
+                              this.listArr4 = []
+                              this.title4 = ''
+                              this.listArr3 = []
+                              this.title3 = ''
+                              this.$refs.mycheckBox.style.width = '100%'
+                              this.resetStyle(childrensArr, index)
                             }                    
                         };
                         
                     })
-                }else{
+                }
+                if(val.data.value=='all'){
                     this.listArr4 = []
                     this.title4 = ''
                     this.listArr3 = []
                     this.title3 = ''
                     this.$refs.mycheckBox.style.width = '100%'
                     this.resetStyle(childrensArr, index)
-                }  
-                 
+                }
+               
               
                 let ind=-1
                 this.listArr1.forEach((ele,i)=>{                       
-                    if(ele.code==val.data.parentCode){
+                    if(ele.code==val.data.parent){
                         ind=i
                         // console.log(ind)
                     }                        
@@ -187,48 +206,53 @@
                 
             } else if (index == 3 || this.clickKey == 3) {
 
-                if(val.data.hasChild){
+                if(val.data.code&&this.maxLayers>index){
                     getAction(this.listUrl,{
-                        parentCode:val.data.code,
-                        level:this.maxLayers
+                        parent:val.data.code,
+                        // level:4
                     }).then((res)=>{
                         // console.log(res);
                         if(res.success){
-                            if(res.data.length>0){
-                                res.data.forEach((item,index)=>{
-                                    item.value=item.code
+                            if(res.result.length>0){
+                                res.result.forEach((item,index)=>{
+                                    item.value=item.regionId
+                                    item.code=item.regionId
                                     item.checked=val.data.checked;
                                     item.indeterminates=false;
                                 
                                 })
                                 this.checkedShowList.forEach((ele)=>{
-                                  res.data.forEach((item)=>{
+                                  res.result.forEach((item)=>{
                                       if(ele.code==item.code){
                                             item.checked=true;
                                         }
                                   })
                                         
                                 })
-                                this.listArr4 = res.data
+                                this.listArr4 = res.result
                                 this.title4 = val.data.name
                                 this.$refs.mycheckBox.style.width = '200%'
                                 this.styleHandle(childrensArr, index)
                                 this.parentChecked3 = val.data.checked
                                 
+                            }else{
+                              this.$refs.mycheckBox.style.width = '150%'
+                              this.resetStyle(childrensArr, index)
                             }                    
                         };
                         
                     })
-                }else{
+                 }
+                 if(val.data.value=='all'){
                     this.$refs.mycheckBox.style.width = '150%'
                     this.resetStyle(childrensArr, index)
-                }  
-
+                }
+               
                 let ind=-1;
                 if(this.listArr2){
                     // console.log(this.listArr2)                                      
                     this.listArr2.forEach((ele,i)=>{                       
-                      if(ele.code==val.data.parentCode){
+                      if(ele.code==val.data.parent){
                           ind=i
                           // console.log(ind)
                       }                                           
@@ -240,7 +264,7 @@
                 }
                      let z=-1          
                     this.listArr1.forEach((element,num)=>{                        
-                      if(element.code==this.listArr2[ind].parentCode){
+                      if(element.code==this.listArr2[ind].parent){
                           z=num
                           // console.log(ind)
                       }
@@ -260,7 +284,7 @@
                     let ind=-1
                     this.listArr3.forEach((ele,i)=>{
                         
-                        if(item.code==val.data.parentCode){
+                        if(item.code==val.data.parent){
                             ind=i
                             // console.log(ind)
                         }
@@ -277,14 +301,14 @@
                     let ind=-1
                     this.listArr3.forEach((ele,i)=>{
                         
-                        if(item.code==val.data.parentCode){
+                        if(item.code==val.data.parent){
                             ind=i
                             // console.log(ind)
                         }
                                             
                     })   
                     this.listArr2.forEach((element,num)=>{
-                        if(item.code==this.listArr3[ind].parentCode){
+                        if(item.code==this.listArr3[ind].parent){
                             ind=num
                             // console.log(ind)
                         }                        
@@ -301,7 +325,7 @@
                         let z=-1;
                         this.listArr1.forEach((element,num)=>{
                             
-                            if(item.code==this.listArr2[ind].parentCode){
+                            if(item.code==this.listArr2[ind].parent){
                                 z=num
                                 // console.log(z)
                             }
@@ -367,13 +391,13 @@
           if(item.level==2){
               // console.log('------------------------------------');
               let childList=this.checkedShowList.filter((element,index) => {
-                  return element.parentCode==item.parentCode;
+                  return element.parent==item.parent;
               });
               let data=[]
               let checkList=[];
               let plainOptions=[]
               this.listArr1.forEach((ele)=>{
-                  if(ele.code==item.parentCode){
+                  if(ele.code==item.parent){
                       data=ele;
                   }
                   if(ele.checked){
@@ -473,12 +497,12 @@
           
         }else if(val.curLayerNum==2){
           this.checkedShowList=this.checkedShowList.filter((item)=>{
-              return item.code!=val.currentList[0].parentCode
+              return item.code!=val.currentList[0].parent
           })
           
           if(val.checkList.length>0&&val.checkList.length<val.currentList.length){
             this.checkedShowList=this.checkedShowList.filter((item)=>{
-              return item.parentCode!=val.currentList[0].parentCode
+              return item.parent!=val.currentList[0].parent
             })
             // console.log(this.checkedShowList)
             val.checkList.forEach((ele)=>{
@@ -499,27 +523,27 @@
             // console.log(this.checkedShowList)
           }else if(val.checkList.length==0){
             this.checkedShowList=this.checkedShowList.filter((item)=>{
-              return item.parentCode!=val.currentList[0].parentCode
+              return item.parent!=val.currentList[0].parent
 
             })
           }else if(val.checkList.length==val.currentList.length){
             this.checkedShowList=this.checkedShowList.filter((item)=>{
-              return item.parentCode!=val.currentList[0].parentCode
+              return item.parent!=val.currentList[0].parent
             })
             this.listArr1.forEach((item)=>{
-                if(item.code==val.currentList[0].parentCode){
+                if(item.code==val.currentList[0].parent){
                     this.checkedShowList.push(item)
                 }
             })
           }
         }else if(val.curLayerNum==3){
           this.checkedShowList=this.checkedShowList.filter((item)=>{
-              return item.code!=val.currentList[0].parentCode
+              return item.code!=val.currentList[0].parent
           })
           
           if(val.checkList.length>0&&val.checkList.length<val.currentList.length){
             this.checkedShowList=this.checkedShowList.filter((item)=>{
-              return item.parentCode!=val.currentList[0].parentCode
+              return item.parent!=val.currentList[0].parent
             })
             // console.log(this.checkedShowList)
             val.checkList.forEach((ele)=>{
@@ -540,15 +564,15 @@
             // console.log(this.checkedShowList)
           }else if(val.checkList.length==0){
             this.checkedShowList=this.checkedShowList.filter((item)=>{
-              return item.parentCode!=val.currentList[0].parentCode
+              return item.parent!=val.currentList[0].parent
               
             })
           }else if(val.checkList.length==val.currentList.length){
             this.checkedShowList=this.checkedShowList.filter((item)=>{
-              return item.parentCode!=val.currentList[0].parentCode
+              return item.parent!=val.currentList[0].parent
             })
             this.listArr2.forEach((item)=>{
-                if(item.code==val.currentList[0].parentCode){
+                if(item.code==val.currentList[0].parent){
                     this.checkedShowList.push(item)
                 }
             })
@@ -566,19 +590,20 @@
         // console.log(this.listUrl)
         if(this.listUrl){
             getAction(this.listUrl,{
-                parentCode:0,
-                level:this.maxLayers
+                parent:0,
+                level:1
             }).then((res)=>{
                 console.log(res);
                 if(res.success){
-                    res.data.forEach((item,index)=>{
-                        item.value=item.code
+                    res.result.forEach((item,index)=>{
+                        item.value=item.regionId
+                        item.code=item.regionId
                         item.checked=false;
                         item.indeterminates=false;
                         
                     })
                 };
-                this.listArr1=res.data
+                this.listArr1=res.result
             })
         }
 

+ 1 - 0
src/views/modules/autoLaunch/createStrategy.vue

@@ -412,6 +412,7 @@ export default {
   li {
     margin: 0;
     padding: 0;
+    
   }
   .moduler {
     background: #fff;

+ 145 - 127
src/views/modules/autoLaunch/groupList.vue

@@ -99,7 +99,7 @@
                     
                 >
                    
-                    <span slot="campaignStatus" slot-scope="text,record">
+                    <span slot="switchStatus" slot-scope="text,record">
                         <a-spin :spinning="record.spin" size="small" >
                             <div class="spin-content">
                                 <a-switch size="default" :checked=text  @change="switchChange(text,record)"/>
@@ -150,7 +150,9 @@
                     <span slot="time" slot-scope="text,record">
                         {{record.startTime}}至{{record.endTime}}
                     </span>
-                    
+                    <span slot="status" slot-scope="text">
+                      {{text | handlerStatus}}
+                    </span>
                 </a-table>
             </div>
         </div>
@@ -175,42 +177,45 @@ let typeValue='预算'
 const groupColumns = [
   {
     title: '开关',
-    dataIndex: 'campaignStatus',
-    key: 'campaignStatus',
+    dataIndex: 'switchStatus',
+    key: 'switchStatus',
     align: 'center',
-    scopedSlots: { customRender: 'campaignStatus' },
+    scopedSlots: { customRender: 'switchStatus' },
     fixed: 'left' ,
+    width:80,
   },
   {
     title: '广告组名称',
-    dataIndex: 'name',
-    key: 'name',
+    dataIndex: 'unitName',
+    key: 'unitName',
     align: 'center',
-    scopedSlots: { customRender: 'name' },
+    scopedSlots: { customRender: 'unitName' },
     fixed: 'left' ,
+    width:150,
   },
   {
     title: '广告组ID',
-    dataIndex: 'namde',
-    key: 'namde',
+    dataIndex: 'unitId',
+    key: 'unitId',
     align: 'center',
-    scopedSlots: { customRender: 'namde' },
+    scopedSlots: { customRender: 'unitId' },
     fixed: 'left' ,
+     width:100,
   },
   
   {
     title: '所属计划',
-    dataIndex: 'campaignCreateTime',
-    key: 'campaignCreateTime',
+    dataIndex: 'campaignName',
+    key: 'campaignName',
     align: 'center',
-    scopedSlots: { customRender: 'campaignCreateTime' },   
+    scopedSlots: { customRender: 'campaignName' },   
   },
   {
     title: '状态',
-    dataIndex: 'campaignCreateTime',
-    key: 'campaignCreateTime',
+    dataIndex: 'status',
+    key: 'status',
     align: 'center',
-    scopedSlots: { customRender: 'campaignCreateTime' },    
+    scopedSlots: { customRender: 'status' },    
   },
  
 ];
@@ -223,7 +228,7 @@ const publicColumns = [
           tip: '广告在投放期间的花费总额',
           align: 'center',
           scopedSlots: { customRender: 'cost' },
-          sorter: () => {}
+        //   sorter: () => {}
         },
         {
           title: '封面曝光数',
@@ -231,7 +236,7 @@ const publicColumns = [
           tip: '广告在瀑布流被观看次数',
           align: 'center',       
           scopedSlots: { customRender: 'photoShow' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
           title: '封面点击数',
@@ -240,25 +245,25 @@ const publicColumns = [
           align: 'center',
         
           scopedSlots: { customRender: 'photoClick' },
-          sorter: () => {}
+        //   sorter: () => {}
         },
         {
           title: '素材曝光数',
-          dataIndex: 'aClick',
+          dataIndex: 'aclick',
           tip: '用户进入视频播放页观看的次数(数据会进行反作弊去重)',
           align: 'center',
        
           scopedSlots: { customRender: 'aClick' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
           title: '行为数',
-          dataIndex: 'bClick',
+          dataIndex: 'bclick',
           tip: '用户在视频播放页单击转化按钮的次数/展示数*100%',
           align: 'center',
         
           scopedSlots: { customRender: 'bClick' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
           title: '封面点击率',
@@ -266,7 +271,7 @@ const publicColumns = [
           tip: '封面点击数占封面展示数百分比',
           align: 'center',    
           scopedSlots: { customRender: 'clickRate' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
           title: '行为率',
@@ -274,7 +279,7 @@ const publicColumns = [
           tip: '行为数占素材曝光数百分比',
           align: 'center',    
           scopedSlots: { customRender: 'bClickRate' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
           title: '平均千次封面曝光花费(元)',
@@ -282,7 +287,7 @@ const publicColumns = [
           tip: '花费/封面曝光数*1000',
           align: 'center',    
           scopedSlots: { customRender: 'cpm' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
           title: '平均封面点击单价(元)',
@@ -290,23 +295,16 @@ const publicColumns = [
           tip: '花费/封面点击数',
           align: 'center',    
           scopedSlots: { customRender: 'cpc' },
-          sorter:() => {}
-        },
-        {
-          title: '平均行为单价(元)',
-          dataIndex: 'cpb',
-          tip: '总花费/行为数',
-          align: 'center',    
-          scopedSlots: { customRender: 'cpb' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
+        
         {
           title: '激活数',
           dataIndex: 'active',
           tip: '广告主回传的应用激活次数',
           align: 'center',    
           scopedSlots: { customRender: 'active' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
           title: '激活单价',
@@ -314,7 +312,7 @@ const publicColumns = [
           tip: '花费/激活数',
           align: 'center',    
           scopedSlots: { customRender: 'activeCost' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
           title: '下载完成激活率',
@@ -322,7 +320,7 @@ const publicColumns = [
           tip: '激活数/安卓下载完成数',
           align: 'center',    
           scopedSlots: { customRender: 'activeRate' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
           title: '注册数',
@@ -330,7 +328,7 @@ const publicColumns = [
           tip: '付费金额/当日消耗',
           align: 'center',    
           scopedSlots: { customRender: 'register' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
           title: '注册成本',
@@ -338,7 +336,7 @@ const publicColumns = [
           tip: '当日消耗/当日回传注册数',
           align: 'center',    
           scopedSlots: { customRender: 'activeRegisterCost' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
           title: '注册率',
@@ -346,7 +344,7 @@ const publicColumns = [
           tip: '当日回传注册数/当日激活数',
           align: 'center',    
           scopedSlots: { customRender: 'activeRegisterRate' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
             title: '次留数',
@@ -354,7 +352,7 @@ const publicColumns = [
             tip: '前一日激活用户在次日继续访问的PV',
             align: 'center',    
             scopedSlots: { customRender: 'nextDayOpen' },
-            sorter:() => {}
+            // sorter:() => {}
         },
         
         {
@@ -363,7 +361,7 @@ const publicColumns = [
             tip: '前一日激活用户在次日继续访问的PV/前一日激活数',
             align: 'center',    
             scopedSlots: { customRender: 'nextDayOpenRate' },
-            sorter:() => {}
+            // sorter:() => {}
         },
 ]
 
@@ -376,7 +374,7 @@ export default {
     // mixins: [JeecgListMixin],
     data() {
         return {
-            groupId:'',
+            groupId:undefined,
             groupName:'',
             groupStatus:undefined,
             scrollX:3500,
@@ -421,7 +419,7 @@ export default {
            
             //主页的表格
             data:[],
-            columns:[...strategyColumns,...publicColumns],
+            columns:[...groupColumns,...publicColumns],
             selectedRowKeys:[],
             selectedRows:[],
             loading:false,
@@ -431,11 +429,9 @@ export default {
 
             
             url: {
-                campaignList: "/ctop/byteDanceCampaign/list",
-                planList: "/kuaishou/batch/getUnitList",
-                creativeList: "/ctop/byteDanceCreative/list",
-          
-                strategyList:'/jeecg-boot/kuaishouStrategy/list'
+                planList: "/ai/list/pageCampaign",
+                groupList:'/ai/list/pageUnit',
+                strategyList:'/ai/list/pageStrategy'
 
             },
 
@@ -475,8 +471,9 @@ export default {
 
         },
         goPlanList(){
-            this.$parent.currentTabComponent='strategyList';
+            this.$parent.currentTabComponent='planList';
             this.$parent.currentGroupId='';
+            this.$parent.currentPlanId='';
 
         },
         
@@ -500,6 +497,7 @@ export default {
         
         //查询按钮事件
         search(){
+            this.ipagination.current=1
            this.getGroupList() 
         },
         //点击分页
@@ -508,52 +506,34 @@ export default {
             this.ipagination.current=pagination.current;
 
             this.ipagination.pageSize=pagination.pageSize;
-            this.search()
+            this.getGroupList()
         },
       
         //状态改变
         switchChange(text,record){
             // this.spinning=true;
             console.log(text,record);
-            let recordData=JSON.parse(JSON.stringify(record))
+            
             record.spin=true;
-            if(this.tabkey=='group'){
-                let ids=record.id;
-                let status=text?'disable':'enable';
-                postAction('/ctop/byteDanceCampaign/editStatus',qs.stringify({
-                    accountId:this.accountID,
-                    ids:`${ids}`,
-                    status:status,
-                })).then((res)=>{
-                    //    console.log(res);
-                        // this.spinning=false;
-                        record.spin=false;
-                    if(res.success){
-                        this.refreshCampaignList({
-                                accountId:this.accountID,
-                                name:this.optionId,
-                                status:this.statusValue,
-                                startDate:this.dateString[0],
-                                endDate:this.dateString[1],
-                                pageNo:this.ipagination.current,
-                                pageSize:this.ipagination.pageSize,
-                                
-                            })
-                        this.$message.success(res.message)
-                    }else{
-                        this.$message.error(res.message)
-                    }
-                })
-            }else if(this.tabkey=='plan'){
 
-                if(text){
-                    recordData.optStatus='AD_STATUS_DISABLE';
+            
+            let ids=record.id;
+            let putStatus=text?2:1;
+            postAction('/kuaishou/batch/batchUpdateUnitStatus',{
+                    accountId:record.accountId,
+                    putStatus,
+                    unitIds:[record.id],
+                    userId:this.$parent.userId
+            }).then((res)=>{
+                    
+                    record.spin=false;
+                if(res.success){
+                    this.getplanList()
+                    this.$message.success(res.message)
                 }else{
-                    recordData.optStatus='AD_STATUS_ENABLE'
+                    this.$message.error(res.message)
                 }
-                this.batchEditHttp('status',[recordData])
-
-            }
+            })
         },
 
 
@@ -631,39 +611,40 @@ export default {
             
                 if(this.optValue=='pause'){   
                     this.loading=true;
-                    if(this.tabkey=='group'){
-                        console.log(this.selectedRows);                       
-                        this.editGroupStatus('/ctop/byteDanceCampaign/editStatus')
 
-                    }else if(this.tabkey=='plan'){
-                        // console.log(0)
-                        this.loading=true;
-                        if(this.selectedRowKeys.length>0){
-                            this.selectedRows.forEach((item)=>{
-                                item.optStatus='AD_STATUS_DISABLE'
-                            })
+                    postAction('/kuaishou/batch/batchUpdateUnitStatus',{
+                            accountId:record.accountId,
+                            putStatus:2,
+                            unitIds:this.selectedRowKeys,
+                            userId:this.$parent.userId
+                    }).then((res)=>{
+                            
+                            record.spin=false;
+                        if(res.success){
+                            this.getGroupList()
+                            this.$message.success(res.message)
+                        }else{
+                            this.$message.error(res.message)
                         }
-                        console.log(0)
-                        this.batchEditHttp('status',this.selectedRows)
-                    }else if(this.tabkey=='idea'){
-                        this.loading=true;
-                        this.editGroupStatus('/ctop/byteDanceCreative/editStatus')
-                    }
+                    })
 
                 }else if(this.optValue=='open'){
                     this.loading=true;
-                    if(this.tabkey=='group'){
-                        this.editGroupStatus('/ctop/byteDanceCampaign/editStatus');
-                    }else if(this.tabkey=='plan'){
-                        if(this.selectedRowKeys.length>0){
-                            this.selectedRows.forEach((item)=>{
-                                item.optStatus='AD_STATUS_ENABLE'
-                            })
+                    postAction('/kuaishou/batch/batchUpdateUnitStatus',{
+                        accountId:record.accountId,
+                        putStatus:1,
+                        unitIds:this.selectedRowKeys,
+                        userId:this.$parent.userId
+                    }).then((res)=>{
+                            
+                        record.spin=false;
+                        if(res.success){
+                            this.getGroupList()
+                            this.$message.success(res.message)
+                        }else{
+                            this.$message.error(res.message)
                         }
-                        this.batchEditHttp('status',this.selectedRows)
-                    }else if(this.tabkey=='idea'){
-                         this.editGroupStatus('/ctop/byteDanceCreative/editStatus');
-                    }
+                    })
 
                 }
               
@@ -705,12 +686,12 @@ export default {
         },
 
         getGroupList(){
-
-            getAction(this.url.strategyList,{
-                planId:this.$parent.currentPlanId,
-                groupId:this.groupId,
-                groupName:this.groupName,
-                groupStatus:this.groupStatus==undefined?'':this.groupStatus,               
+            this.loading=true;
+            postAction(this.url.groupList,{
+                campaignId:this.$parent.currentPlanId,
+                unitId:this.groupId,
+                campaignName:this.groupName,
+                campaignStatus:this.groupStatus,               
                 pageNo:this.ipagination.current,
                 pageSize:this.ipagination.pageSize
             }).then((res)=>{
@@ -718,18 +699,18 @@ export default {
                 console.log(res)
                 this.loading = false
                 if(res.success){
-
                     this.ipagination.total = res.result.total
                     
-                    res.result.records.forEach((item)=>{
+                    res.result.list.forEach((item)=>{
                         item.key=item.id
                     })
 
-                    this.data = res.result.records.map(item=>{
+                    this.data = res.result.list.map(item=>{
 
                         return {
                             ...item,
-                            spin:false
+                            spin:false,
+                            switchStatus:item.strategyState=='1'?true:false,
                         }
                     });
                     // console.log(this.data)
@@ -740,11 +721,11 @@ export default {
         
     },
     mounted() {
-       
+       this.getGroupList()
     },
     
     activated() {
-        // this.accountHttp()
+         this.getGroupList()
     },
     beforeDestroy() {
        
@@ -838,11 +819,48 @@ export default {
                 return '-'
             }
 
+        },
+
+        handlerStatus(val){
+            let str=''
+            switch (val) {
+                case 1:
+                    str='投放中'
+                    break;
+                case 1:
+                    str='已暂停'
+                    break;
+                case 1:
+                    str='已删除'
+                    break;
+            
+                default:
+                    break;
+            }
+            return str
         }
     }
 }
 </script>
+<style lang="less">
+    .toutiaoBatch{
+        .ant-timeline-item-head{
+            background: rgb(240,242,245);
+        }
+        .muen{
+            cursor: pointer;
+        }
+        .muen:hover{
+            color: #1890ff;
+        }
+
+        .ant-steps-item-content{
+            width: 160px;
+        }
+    }
+</style>
 <style lang="scss">
+
     #closeIcon{
          color: #0E74D2;
     }

+ 145 - 152
src/views/modules/autoLaunch/planList.vue

@@ -3,7 +3,7 @@
         <div>
             <p class="breadcrumb">
                 <a-breadcrumb style="display:block;width:100%">
-                    <a-breadcrumb-item ><span class="muen" @click="goStrategyList()">策略列表</span></a-breadcrumb-item>
+                    <a-breadcrumb-item ><span class="muen" @click="goStrategyList()" >策略列表</span></a-breadcrumb-item>
                     <a-breadcrumb-item>计划列表</a-breadcrumb-item>
                 </a-breadcrumb>
             </p>
@@ -98,7 +98,7 @@
                     
                 >
                    
-                    <span slot="campaignStatus" slot-scope="text,record">
+                    <span slot="switchStatus" slot-scope="text,record">
                         <a-spin :spinning="record.spin" size="small" >
                             <div class="spin-content">
                                 <a-switch size="default" :checked=text  @change="switchChange(text,record)"/>
@@ -152,6 +152,9 @@
                     <span slot="operator" slot-scope="text,record">
                         <a href="javascript:;"  @click="goGroupList(record)">详情</a>
                     </span>
+                    <span slot="status" slot-scope="text">
+                      {{text | handlerStatus}}
+                    </span>
                 </a-table>
             </div>
         </div>
@@ -167,7 +170,7 @@ import moment from 'moment';
 import { getAction, postAction, downFile, downFilePost } from '@/api/manage';
 // import { JeecgListMixin } from '@/mixins/ipagination'
 // import editableCell from './editableCell'
-import Treeselect from '@/views/modules/Statistics/components/Treeselect.vue'
+import Treeselect from './components/Treeselect.vue'
 import qs from 'qs'
 let typeValue='预算'
 
@@ -176,50 +179,54 @@ let typeValue='预算'
 const planColumns = [
   {
     title: '开关',
-    dataIndex: 'campaignStatus',
-    key: 'campaignStatus',
+    dataIndex: 'switchStatus',
+    key: 'switchStatus',
     align: 'center',
-    scopedSlots: { customRender: 'campaignStatus' },
+    scopedSlots: { customRender: 'switchStatus' },
     fixed: 'left' ,
+    width:80,
   },
   {
     title: '广告计划名称',
-    dataIndex: 'name',
-    key: 'name',
+    dataIndex: 'campaignName',
+    key: 'campaignName',
     align: 'center',
-    scopedSlots: { customRender: 'name' },
+    scopedSlots: { customRender: 'campaignName' },
     fixed: 'left' ,
+    width:150,
   },
   {
     title: '广告计划ID',
-    dataIndex: 'ID',
-    key: 'ID',
+    dataIndex: 'campaignId',
+    key: 'campaignId',
     align: 'center',
-    scopedSlots: { customRender: 'ID' },
+    scopedSlots: { customRender: 'campaignId' },
     fixed: 'left' ,
+     width:100,
   },
   
   {
     title: '操作',
-    dataIndex: 'campaignCreateTime',
-    key: 'campaignCreateTime',
+    dataIndex: 'operator',
+    key: 'operator',
     align: 'center',
-    scopedSlots: { customRender: 'campaignCreateTime' },
+    scopedSlots: { customRender: 'operator' },
     fixed: 'left' ,
+    width:100,
   },
   {
     title: '所属策略',
-    dataIndex: 'campaignCreateTime',
-    key: 'campaignCreateTime',
+    dataIndex: 'strategyName',
+    key: 'strategyName',
     align: 'center',
-    scopedSlots: { customRender: 'campaignCreateTime' },   
+    scopedSlots: { customRender: 'strategyName' },   
   },
   {
     title: '状态',
-    dataIndex: 'campaignCreateTime',
-    key: 'campaignCreateTime',
+    dataIndex: 'status',
+    key: 'status',
     align: 'center',
-    scopedSlots: { customRender: 'campaignCreateTime' },    
+    scopedSlots: { customRender: 'status' },    
   },
  
 ];
@@ -232,7 +239,7 @@ const publicColumns = [
           tip: '广告在投放期间的花费总额',
           align: 'center',
           scopedSlots: { customRender: 'cost' },
-          sorter: () => {}
+        //   sorter: () => {}
         },
         {
           title: '封面曝光数',
@@ -240,7 +247,7 @@ const publicColumns = [
           tip: '广告在瀑布流被观看次数',
           align: 'center',       
           scopedSlots: { customRender: 'photoShow' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
           title: '封面点击数',
@@ -249,25 +256,25 @@ const publicColumns = [
           align: 'center',
         
           scopedSlots: { customRender: 'photoClick' },
-          sorter: () => {}
+        //   sorter: () => {}
         },
         {
           title: '素材曝光数',
-          dataIndex: 'aClick',
+          dataIndex: 'aclick',
           tip: '用户进入视频播放页观看的次数(数据会进行反作弊去重)',
           align: 'center',
        
           scopedSlots: { customRender: 'aClick' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
           title: '行为数',
-          dataIndex: 'bClick',
+          dataIndex: 'bclick',
           tip: '用户在视频播放页单击转化按钮的次数/展示数*100%',
           align: 'center',
         
           scopedSlots: { customRender: 'bClick' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
           title: '封面点击率',
@@ -275,7 +282,7 @@ const publicColumns = [
           tip: '封面点击数占封面展示数百分比',
           align: 'center',    
           scopedSlots: { customRender: 'clickRate' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
           title: '行为率',
@@ -283,7 +290,7 @@ const publicColumns = [
           tip: '行为数占素材曝光数百分比',
           align: 'center',    
           scopedSlots: { customRender: 'bClickRate' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
           title: '平均千次封面曝光花费(元)',
@@ -291,7 +298,7 @@ const publicColumns = [
           tip: '花费/封面曝光数*1000',
           align: 'center',    
           scopedSlots: { customRender: 'cpm' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
           title: '平均封面点击单价(元)',
@@ -299,23 +306,16 @@ const publicColumns = [
           tip: '花费/封面点击数',
           align: 'center',    
           scopedSlots: { customRender: 'cpc' },
-          sorter:() => {}
-        },
-        {
-          title: '平均行为单价(元)',
-          dataIndex: 'cpb',
-          tip: '总花费/行为数',
-          align: 'center',    
-          scopedSlots: { customRender: 'cpb' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
+       
         {
           title: '激活数',
           dataIndex: 'active',
           tip: '广告主回传的应用激活次数',
           align: 'center',    
           scopedSlots: { customRender: 'active' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
           title: '激活单价',
@@ -323,7 +323,7 @@ const publicColumns = [
           tip: '花费/激活数',
           align: 'center',    
           scopedSlots: { customRender: 'activeCost' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
           title: '下载完成激活率',
@@ -331,7 +331,7 @@ const publicColumns = [
           tip: '激活数/安卓下载完成数',
           align: 'center',    
           scopedSlots: { customRender: 'activeRate' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
           title: '注册数',
@@ -339,7 +339,7 @@ const publicColumns = [
           tip: '付费金额/当日消耗',
           align: 'center',    
           scopedSlots: { customRender: 'register' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
           title: '注册成本',
@@ -347,7 +347,7 @@ const publicColumns = [
           tip: '当日消耗/当日回传注册数',
           align: 'center',    
           scopedSlots: { customRender: 'activeRegisterCost' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
           title: '注册率',
@@ -355,7 +355,7 @@ const publicColumns = [
           tip: '当日回传注册数/当日激活数',
           align: 'center',    
           scopedSlots: { customRender: 'activeRegisterRate' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
             title: '次留数',
@@ -363,7 +363,7 @@ const publicColumns = [
             tip: '前一日激活用户在次日继续访问的PV',
             align: 'center',    
             scopedSlots: { customRender: 'nextDayOpen' },
-            sorter:() => {}
+            // sorter:() => {}
         },
         
         {
@@ -372,7 +372,7 @@ const publicColumns = [
             tip: '前一日激活用户在次日继续访问的PV/前一日激活数',
             align: 'center',    
             scopedSlots: { customRender: 'nextDayOpenRate' },
-            sorter:() => {}
+            // sorter:() => {}
         },
 ]
 
@@ -437,15 +437,14 @@ export default {
 
             
             url: {
-                campaignList: "/ctop/byteDanceCampaign/list",
-                planList: "/kuaishou/batch/getUnitList",
-                groupList:'/kuaishou/batch/getUnitList',
-               strategyList:'/jeecg-boot/kuaishouStrategy/list'
+                 planList: "/ai/list/pageCampaign",
+                groupList:'/ai/list/pageUnit',
+                strategyList:'/ai/list/pageStrategy'
 
             },
 
 
-           planId:'',
+           planId:undefined,
            planName:'',
            planStatus:undefined,
         }
@@ -483,7 +482,8 @@ export default {
         },
         goGroupList(record){
             console.log(record);
-            
+            this.$parent.currentPlanId=record.campaignId
+            this.$parent.currentTabComponent='groupList'
         },
         // getGroupList(){
         //     getAction(this.url.groupList,{
@@ -495,12 +495,12 @@ export default {
         //     })
         // },
         getplanList(){
-
-            getAction(this.url.planList,{
+            this.loading=true
+            postAction(this.url.planList,{
                 strategyId:this.$parent.currentStrategyId,
-                planId:this.planId,
+                planId:this.planId==''?null:this.planId,
                 planName:this.planName,
-                planStatus:this.planStatus==undefined?'':this.planStatus,
+                planStatus:this.planStatus==''?null:this.planStatus,
                 pageNo:this.ipagination.current,
                 pageSize:this.ipagination.pageSize
             }).then((res)=>{
@@ -511,15 +511,16 @@ export default {
 
                     this.ipagination.total = res.result.total
                     
-                    res.result.records.forEach((item)=>{
+                    res.result.list.forEach((item)=>{
                         item.key=item.id
                     })
 
-                    this.data = res.result.records.map(item=>{
+                    this.data = res.result.list.map(item=>{
 
                         return {
                             ...item,
-                            spin:false
+                            spin:false,
+                            switchStatus:item.strategyState=='1'?true:false,
                         }
                     });
                     // console.log(this.data)
@@ -545,6 +546,7 @@ export default {
         
         //查询按钮事件
         search(){
+            this.ipagination.current=1
             this.getplanList()
         },
         //点击分页
@@ -553,81 +555,33 @@ export default {
             this.ipagination.current=pagination.current;
 
             this.ipagination.pageSize=pagination.pageSize;
-            this.search()
+            this.getplanList()
         },
        
         //状态改变
         switchChange(text,record){
             // this.spinning=true;
-            // console.log(text,record);
-            let recordData=JSON.parse(JSON.stringify(record))
+            console.log(text,record);
+            
             record.spin=true;
-            if(this.tabkey=='group'){
+            
                 let ids=record.id;
-                let status=text?'disable':'enable';
-                postAction('/ctop/byteDanceCampaign/editStatus',qs.stringify({
-                    accountId:this.accountID,
-                    ids:`${ids}`,
-                    status:status,
-                })).then((res)=>{
-                    //    console.log(res);
-                        // this.spinning=false;
+                let putStatus=text?'2':'1';
+                postAction('/kuaishou/batch/batchUpdateStatus',{
+                    accountId:record.accountId,
+                    putStatus,
+                    campaignIds:[record.id],
+                    userId:this.$parent.userId
+                }).then((res)=>{
+                    
                         record.spin=false;
                     if(res.success){
-                        this.refreshCampaignList({
-                                accountId:this.accountID,
-                                name:this.optionId,
-                                status:this.statusValue,
-                                startDate:this.dateString[0],
-                                endDate:this.dateString[1],
-                                pageNo:this.ipagination.current,
-                                pageSize:this.ipagination.pageSize,
-                                
-                            })
+                        this.getplanList()
                         this.$message.success(res.message)
                     }else{
                         this.$message.error(res.message)
                     }
                 })
-           }else if(this.tabkey=='plan'){
-
-                if(text){
-                    recordData.optStatus='AD_STATUS_DISABLE';
-                }else{
-                    recordData.optStatus='AD_STATUS_ENABLE'
-                }
-                this.batchEditHttp('status',[recordData])
-
-           }else if(this.tabkey=='idea'){
-               let ids=record.id;
-               let status=text?'disable':'enable';
-                postAction('/ctop//byteDanceCreative/editStatus',qs.stringify({
-                   accountId:this.accountID,
-                   ids:`${ids}`,
-                   status:status,
-               })).then((res)=>{
-                //    console.log(res);
-                
-                    if(res.success){
-                        //    this.data=[];
-                        record.spin=false;
-                            this.refreshCreativeList({
-                                accountId:this.accountID,
-                                name:this.optionId,
-                                status:this.statusValue,
-                                startDate:this.dateString[0],
-                                endDate:this.dateString[1],
-                                pageNo:this.ipagination.current,
-                                pageSize:this.ipagination.pageSize,
-                                planId:this.currentPlan.id,
-                                
-                            })
-                    }else{
-                        record.spin=false;
-                        this.$message.error(res.message)
-                    }
-               })
-           }
 
         },
 
@@ -706,39 +660,39 @@ export default {
             
                 if(this.optValue=='pause'){   
                     this.loading=true;
-                    if(this.tabkey=='group'){
-                        console.log(this.selectedRows);                       
-                        this.editGroupStatus('/ctop/byteDanceCampaign/editStatus')
-
-                    }else if(this.tabkey=='plan'){
-                        // console.log(0)
-                        this.loading=true;
-                        if(this.selectedRowKeys.length>0){
-                            this.selectedRows.forEach((item)=>{
-                                item.optStatus='AD_STATUS_DISABLE'
-                            })
+                    postAction('/kuaishou/batch/batchUpdateStatus',{
+                        accountId:record.accountId,
+                        putStatus:2,
+                        campaignIds:this.selectedRowKeys,
+                        userId:this.$parent.userId
+                    }).then((res)=>{
+                        
+                            record.spin=false;
+                        if(res.success){
+                            this.getplanList()
+                            this.$message.success(res.message)
+                        }else{
+                            this.$message.error(res.message)
                         }
-                        console.log(0)
-                        this.batchEditHttp('status',this.selectedRows)
-                    }else if(this.tabkey=='idea'){
-                        this.loading=true;
-                        this.editGroupStatus('/ctop/byteDanceCreative/editStatus')
-                    }
+                    })
 
                 }else if(this.optValue=='open'){
                     this.loading=true;
-                    if(this.tabkey=='group'){
-                        this.editGroupStatus('/ctop/byteDanceCampaign/editStatus');
-                    }else if(this.tabkey=='plan'){
-                        if(this.selectedRowKeys.length>0){
-                            this.selectedRows.forEach((item)=>{
-                                item.optStatus='AD_STATUS_ENABLE'
-                            })
+                    postAction('/kuaishou/batch/batchUpdateStatus',{
+                        accountId:record.accountId,
+                        putStatus:1,
+                        campaignIds:this.selectedRowKeys,
+                        userId:this.$parent.userId
+                    }).then((res)=>{
+                        
+                            record.spin=false;
+                        if(res.success){
+                            this.getplanList()
+                            this.$message.success(res.message)
+                        }else{
+                            this.$message.error(res.message)
                         }
-                        this.batchEditHttp('status',this.selectedRows)
-                    }else if(this.tabkey=='idea'){
-                         this.editGroupStatus('/ctop/byteDanceCreative/editStatus');
-                    }
+                    })
 
                 }
               
@@ -783,11 +737,11 @@ export default {
        
     },
     mounted() {
-        
+        this.getplanList()
     },
     
     activated() {
-        
+        this.getplanList()
     },
     beforeDestroy() {
         
@@ -881,11 +835,47 @@ export default {
                 return '-'
             }
 
+        },
+        handlerStatus(val){
+            let str=''
+            switch (val) {
+                case 1:
+                    str='投放中'
+                    break;
+                case 1:
+                    str='已暂停'
+                    break;
+                case 1:
+                    str='已删除'
+                    break;
+            
+                default:
+                    break;
+            }
+            return str
         }
     }
 }
 </script>
+<style lang="less">
+    .toutiaoBatch{
+        .ant-timeline-item-head{
+            background: rgb(240,242,245);
+        }
+        .muen{
+            cursor: pointer;
+        }
+        .muen:hover{
+            color: #1890ff;
+        }
+
+        .ant-steps-item-content{
+            width: 160px;
+        }
+    }
+</style>
 <style lang="scss">
+
     #closeIcon{
          color: #0E74D2;
     }
@@ -953,6 +943,9 @@ export default {
             font-weight: 400;
             color: #000000;
             line-height: 22px;
+            .muen{
+
+            }
         }
     background-color: #fff;
     padding: 10px 20px;

+ 167 - 50
src/views/modules/autoLaunch/setDirectional.vue

@@ -93,10 +93,35 @@
                                 <span v-if="convertId&&!convert" style="display:block;font-size:16px">已选择转化目标: {{convertId.label}}</span>
                                 <a-button type="primary" @click="showConvert">{{convertId?'更换转化目标':'选择转化目标'}}</a-button>
                             </a-form-item>
-                        
+                            <div style="margin-top:10px">
+                                <a-form-item v-if="sysType==1" >
+
+                                    <a-checkbox v-decorator="[
+                                    'useAppMarket',
+                                    {
+                                        valuePropName: 'checked',
+                                        initialValue: false,
+                                    },
+                                    ]">
+                                    优先从系统应用商店下载
+                                    </a-checkbox>
+                                </a-form-item>
+                                <a-form-item  v-if="sysType==1&&getData('useAppMarket')">
+                                    请勾选投放应用已上架的应用商店(默认全选)
+                                    <a-checkbox-group v-model="appStore">
+                                    <a-checkbox value="huawei">华为</a-checkbox>
+                                    <a-checkbox value="oppo">OPPO</a-checkbox>
+                                    <a-checkbox value="vivo">VIVO</a-checkbox>
+                                    <a-checkbox value="xiaomi">小米</a-checkbox>
+                                    <a-checkbox value="meizu">魅族</a-checkbox>
+                                    <a-checkbox value="smartisan">锤子</a-checkbox>
+                                    </a-checkbox-group>
+                                </a-form-item>
+                            </div>
                         </div>
                     </div>
-                </div>   
+
+                </div>        
              
         </div>
         <div class="moduler">
@@ -128,7 +153,7 @@
                                     
                                 </a-radio-group>
                             </a-form-item>
-                            <div class="region" v-show="district!='NONE'">
+                            <div class="region" style="margin-top:20px" v-show="district!='NONE'">
                                 <!-- 省市 -->
                                 <div class="provincyCity" v-if="district=='CITY'">                                                                 
                                     <linkMultiSelect title='省份' :listArr='[]' :maxLayers='2' :listUrl='regionCityListUrl' @getSelectedArr='getSelectedCityArr'/>
@@ -165,7 +190,7 @@
                         </div>
                         <div class="input-item">
                             <a-form-item>
-                                <radioCheck :checkArr='ageArr' @getSonValue='getAgeSelect'  />
+                                <radioCheck :checkArr='ageArr' @getSonValue='getAgeSelect'   />
                             </a-form-item>
                         </div>
                     </div>
@@ -598,7 +623,7 @@
                         </div>
                         <div class="input-item">
                         <a-form-item>
-                            <a-input v-decorator="['clickTrackUrl', {rules:validationRules.url}]" />
+                            <a-input v-decorator="['clickTrackUrl']" />
                         </a-form-item>
                         </div>
                     </div>
@@ -610,7 +635,7 @@
                         </div>
                         <div class="input-item">
                         <a-form-item>
-                            <a-input v-decorator="['impressionUrl', {rules:validationRules.url}]" />
+                            <a-input v-decorator="['impressionUrl']" />
                         </a-form-item>
                         </div>
                     </div>
@@ -622,13 +647,53 @@
                         </div>
                         <div class="input-item">
                         <a-form-item>
-                            <a-input v-decorator="['actionbarClickUrl', {rules:validationRules.url}]" />
+                            <a-input v-decorator="['actionbarClickUrl']" />
+                        </a-form-item>
+                        </div>
+                    </div>
+                    <div class="row-item">
+                        <div class="hint-item"></div>
+                        <div class="label-item">
+                        <div class="text-item">创意分类</div>
+                        <!-- <div class="required-item"></div> -->
+                        </div>
+                        <div class="input-item">
+                        <a-form-item>
+                            <a-cascader
+                                :options="createOptions"
+                                v-decorator="['creativeCategory']"
+                                :fieldNames="fieldNames"
+                                placeholder="请选择创意分类"
+                                style="width:300px"
+                            />
+                        </a-form-item>
+                        </div>
+                    </div>
+                    <div class="row-item">
+                        <div class="hint-item"></div>
+                        <div class="label-item">
+                        <div class="text-item">创意分类</div>
+                        <!-- <div class="required-item"></div> -->
+                        </div>
+                        <div class="input-item">
+                        <a-form-item>
+                            <a-select
+                            mode="tags"
+                            style="width: 100%"
+                            placeholder="按回车生成标签"
+                            v-decorator="['creativeTag', { validator: creativeTagValid }]"
+                            dropdownClassName="display-none-selset"
+                            :token-separators="[',', ' ', ',']"
+                            >
+                            </a-select>
+                            <span v-if="getData('creativeTag')&&getData('creativeTag').length > 10" style="color:red">创意标签最多填写10个,请删减</span>
                         </a-form-item>
                         </div>
                     </div>
                 </div>
              
         </div>
+        
 
         </a-form>    
             
@@ -723,7 +788,7 @@ import linkMultiSelect from './components/linkMultiSelect'
 import singleLayersSelecte from './components/singleLayerSelecte'
 import scheduleTime from '@/components/formComponents/toutiaoTime'
 import qs from 'qs'
-import { filter } from 'vue/types/umd';
+// import { filter } from 'vue/types/umd';
 var str = ""
 for (let i = 0; i < 7*24; i++) {
  str+='0'
@@ -842,6 +907,13 @@ export default {
     },
     data() {
         return {
+            fieldNames: {
+                label: 'category_name',
+                value: 'category_id',
+                children: 'child',
+            },
+            createOptions: [],
+            appStore: ['huawei', 'oppo', 'vivo', 'xiaomi', 'meizu', 'smartisan'],
             sysType:1,
             indeterminateDirectional:false,
             checkAllDirectional:false,
@@ -884,8 +956,8 @@ export default {
             ageArr,//受众年龄
             region:[],
             agesRange:[],
-            regionCityListUrl:'ctop/bytedanceAreaInfo/list',
-            regionCountyListUrl:'ctop/bytedanceAreaInfo/list',
+            regionCityListUrl:'/kuaishou/batch/getRegion',
+            regionCountyListUrl:'/kuaishou/batch/getRegion',
 
             // 自定义人群
             // 自定义人群参数
@@ -991,6 +1063,13 @@ export default {
             },
     },
     methods: {
+        creativeTagValid(rule, value, callback) {
+            if (value.length > 10) {
+                callback('创意标签最多填写10个,请删减')
+            } else {
+                callback()
+            }
+        },
         directionalChange(checkedList) {
             // console.log(checkedList)
             this.indeterminateDirectional = !!checkedList.length && checkedList.length < this.directionalList.length;
@@ -1259,11 +1338,18 @@ export default {
         
         // 保存并新建创意
         goNext() {
+
         this.$nextTick(()=>{
+
+            if((!this.getFormData('creativeCategory')&&this.getFormData('creativeTag')) ||  (this.getFormData('creativeCategory')&&!this.getFormData('creativeTag')) ){
+                this.$message.error('创意分类和标签必须同时填写或者同时不填写')
+                return 
+            }
             
+
             this.form.validateFields((err, values) => {
                 if (!err) {
-
+                    
                     this.goNextloading=true;
                     if(this.district!='NONE'){
                         values.district=this.district
@@ -1311,26 +1397,43 @@ export default {
                         return item.id
                     })
                     values.strategyState='1'
+                    values.useAppMarket=values.useAppMarket?'1':'0'
                     console.log('Received values of form: ', values)
+                    
+                    if(this.useDirectional==0){
+                        values.templateId=this.directionalCheckedList
+                    }
+                    if(this.sysType==1&&this.getData('useAppMarket')){
+                        values.appStore=this.appStore
+                    }
+                    if(values.cpaBid){
+                        values.cpaBid=parseInt(values.cpaBid*1000)
+                    }
+                    if(values.bid){
+                        values.bid=parseInt(values.bid*1000)
+                    }
+                    if(values.creativeCategory&&values.creativeCategory.length>0){
+                        values.creativeCategory=values.creativeCategory[2]
+                    }
+                    // this.$parent.currentTabComponent='previewStrategy'
+                    // this.$parent.strategyInfo={
+                    //     ...this.$parent.strategyInfo,
+                    //     ...values,
+                    // }
                     let params={
                         ...values,
                         ...this.strategyInfo
                     }
-                    if(this.useDirectional==0){
-                        values.templateId=this.directionalCheckedList
-                    }
-                    
-                    this.$parent.currentTabComponent='previewStrategy'
-                    // postAction('/kuaishouStrategy/add',params).then(res=>{
-                    //     console.log(res)
-                    //     this.goNextloading=false
-                    //     if(res.success){
-                    //         // this.$router.replace('/autoLaunch/autoLaunchList')
-                    //         // this.$bus.$emit('remove', '/autoLaunch/newStrategy')
-                    //         // this.$parent.strategyInfo={}
+                    postAction('/kuaishouStrategy/add',params).then(res=>{
+                        console.log(res)
+                        this.goNextloading=false
+                        if(res.success){
+                            // this.$router.replace('/autoLaunch/autoLaunchList')
+                            // this.$bus.$emit('remove', '/autoLaunch/newStrategy')
+                            this.$parent.strategyInfo={}
                             
-                    //     }
-                    // })
+                        }
+                    })
 
                 
                 }else{
@@ -1354,20 +1457,19 @@ export default {
                         key: index
                     }
                 })
-                // if(this.sysType==1){
-                //     this.appList=this.appListAll.filter(item=>{
-                //         return  item.platform==1||item.platform==2
-                //     })
-                // }else if(this.sysType==2){
-                //      this.appList=this.appListAll.filter(item=>{
-                //         return  item.platform==3||item.platform==4
-                //     })
-                // }
+                if(this.sysType==1){
+                    this.appList=this.appListAll.filter(item=>{
+                        return  item.platform==1||item.platform==2
+                    })
+                }else if(this.sysType==2){
+                     this.appList=this.appListAll.filter(item=>{
+                        return  item.platform==3||item.platform==4
+                    })
+                }
             }
             })
         },
 
-        
 
         convertChange() {
             this.convertId = ""
@@ -1390,15 +1492,19 @@ export default {
         },
         sysTypeChange(e){
             console.log(e.target.value);
-            // if(this.sysType==1){
-            //     this.appList=this.appListAll.filter(item=>{
-            //         return  (item.platform==1 || item.platform==2)
-            //     })
-            // }else if(this.sysType==2){
-            //         this.appList=this.appListAll.filter(item=>{
-            //         return  (item.platform==3||item.platform==4)
-            //     })
-            // }
+            this.form.setFieldsValue({
+                appIds:[],
+            })
+            this.appIdChange()
+            if(this.sysType==1){
+                this.appList=this.appListAll.filter(item=>{
+                    return  (item.platform==1 || item.platform==2)
+                })
+            }else if(this.sysType==2){
+                    this.appList=this.appListAll.filter(item=>{
+                    return  (item.platform==3||item.platform==4)
+                })
+            }
         },
         getPlatForm(appId) {
             if (appId) {
@@ -1447,7 +1553,7 @@ export default {
             }
             
         },
-
+       
     },
     
     mounted() {
@@ -1459,7 +1565,16 @@ export default {
                 accountId: this.accountInfo.value
             }).then(res => {
                 if (res.success) {
-                this.groupTypeData = res.result
+                 this.groupTypeData = res.result
+                }
+            })
+
+             getAction('/kuaishou/batch/getCreativeCategory', {
+                accountId:this.accountInfo.value,
+            }).then((res) => {
+                if (res.success) {
+                    console.log(res)
+                    this.createOptions = res.result
                 }
             })
     },
@@ -1547,13 +1662,15 @@ export default {
 </script>
 <style lang="scss">
 .setProjectDirectional{
-  .ant-btn-danger {
-    background-color: #ff4d4f !important; 
-  }
+    .ant-btn-danger {
+        background-color: #ff4d4f !important; 
+    }
     .ant-checkbox-group{
         width: 100%;
     }
-  
+    .display-none-selset {
+        display: none !important;
+    }
 }
 
 // 标题选择

+ 198 - 311
src/views/modules/autoLaunch/strategyList.vue

@@ -9,13 +9,30 @@
             </p>
         </div>
         
-        <div class="toolbox-automate-rules-create-content_title"><h3>广告策略</h3></div>
+        <div class="toolbox-automate-rules-create-content_title">
+            <h3>广告策略</h3>
+            <a-button type='primary' @click="goCreateStrategy" class="goCreateStrategy">新建策略</a-button>
+        </div>
         
         <div class="topOptions">
-            
+            <span class="OptinItem ">
+                <!-- reqUrl='/ctop/userAllocation/getAccountIdListByUserId' -->
+                <!-- <Treeselect :appId.sync="accountIds" :multiple="true" request="2,4" reqUrl='/ctop/userAllocation/getAccountIdsByUserId'  ref="treeSelect" style="margin-bottom:8px " /> -->
+                <a-select mode="multiple"
+                    v-model="accountIds"
+                    style="width: 400px"
+                    placeholder="请选择账户"
+                    :maxTagCount='1'
+                    allowClear
+                    >
+                    <a-select-option v-for="item in accountList" :key="item.account_id" :value='item.account_id'>
+                    {{ item.auth_name+'_('+(item.project_name||"无所属项目")+')' }}
+                    </a-select-option>
+                </a-select>
+            </span>
             <span class="OptinItem">
-                <a-select  style="width: 200px" v-model="strategyStatus" @change="statusChange" placeholder="请选择策略状态">
-                    <a-select-option value="" >
+                <a-select  style="width: 180px" v-model="strategyStatus" @change="statusChange" placeholder="请选择策略状态">
+                    <a-select-option :value='3' >
                         不限
                     </a-select-option>
                     <a-select-option :value="1" >
@@ -28,14 +45,14 @@
             </span>
 
             <span class="OptinItem">
-                <a-input-search placeholder="策略名称" v-model="strategyName" style="width: 300px"  />
+                <a-input-search placeholder="策略名称" v-model="strategyName" style="width: 280px"  />
             </span>
             <span class="OptinItem">
-                <a-input-search placeholder="策略ID" v-model="strategyId" style="width: 300px"  />
+                <a-input-search placeholder="策略ID" v-model="strategyId" style="width: 280px"  />
             </span>
-            <span class="OptinItem">
+            <!-- <span class="OptinItem">
                 <a-input-search placeholder="所属账户" v-model="accountId" style="width: 300px"  />
-            </span>
+            </span> -->
             <span class="optionBtn">
                 <a-button type='primary' @click="search" class="searchBtn">查询</a-button>
                 <!-- <a-button type='default' @click="reset">重置</a-button> -->
@@ -60,9 +77,9 @@
                         <a-select-option value="pause">
                             暂停
                         </a-select-option>
-                        <a-select-option value="delete">
+                        <!-- <a-select-option value="delete">
                             删除
-                        </a-select-option>
+                        </a-select-option> -->
                     </a-select>
                 </span>
                  <span class="OptinItem">
@@ -94,7 +111,7 @@
                     
                 >
                    
-                    <span slot="campaignStatus" slot-scope="text,record">
+                    <span slot="switchStatus" slot-scope="text,record">
                         <a-spin :spinning="record.spin" size="small" >
                             <div class="spin-content">
                                 <a-switch size="default" :checked=text  @change="switchChange(text,record)"/>
@@ -103,22 +120,7 @@
                         
                     </span>
 
-                    <span slot="createStatus" slot-scope="text,record">
-                         <a-spin :spinning="record.spin" size="small" >
-                            <div class="spin-content">
-                                <a-switch size="default" :checked=text  @change="switchChange(text,record)"/>
-                            </div>
-                        </a-spin>
-                        
-                    </span>
-                    <span slot="planStatus" slot-scope="text,record">
-                        <a-spin :spinning="record.spin" size="small" >
-                            <div class="spin-content">
-                                <a-switch size="default" :checked=text  @change="switchChange(text,record)"/>
-                            </div>
-                        </a-spin>
-                        
-                    </span>
+                   
                    
                     <span slot="createImg" slot-scope="text,record">
                         
@@ -148,6 +150,9 @@
                     <span slot="operator" slot-scope="text,record">
                         <a href="javascript:;"  @click="goPlanList(record)">详情</a>
                     </span>
+                    <span slot="scenes" slot-scope="text">
+                        <span>{{text|scensFilter}}</span>
+                    </span>
                     
                 </a-table>
             </div>
@@ -172,19 +177,19 @@ let typeValue='预算'
 const strategyColumns = [
   {
     title: '开关',
-    dataIndex: 'campaignStatus',
-    key: 'campaignStatus',
+    dataIndex: 'switchStatus',
+    key: 'switchStatus',
     align: 'center',
-    scopedSlots: { customRender: 'campaignStatus' },
+    scopedSlots: { customRender: 'switchStatus' },
     width:80,
     fixed: 'left' ,
   },
   {
     title: '广告策略名称',
-    dataIndex: 'name',
-    key: 'name',
+    dataIndex: 'strategyName',
+    key: 'strategyName',
     align: 'center',
-    scopedSlots: { customRender: 'name' },
+    scopedSlots: { customRender: 'strategyName' },
     width:150,
     fixed: 'left' ,
   },
@@ -213,36 +218,36 @@ const strategyColumns = [
         key: 'createTime',
         align: 'center',
         scopedSlots: { customRender: 'createTime' },
-        width:100,
+        
   },
   
   {
     title: '所属账户',
-    dataIndex: 'campaignCreateTime',
-    key: 'campaignCreateTime',
+    dataIndex: 'accountId',
+    key: 'accountId',
     align: 'center',
-    scopedSlots: { customRender: 'campaignCreateTime' },   
+    scopedSlots: { customRender: 'accountId' },   
   },
   {
     title: '状态',
-    dataIndex: 'campaignCreateTime',
-    key: 'campaignCreateTime',
+    dataIndex: 'status',
+    key: 'status',
     align: 'center',
-    scopedSlots: { customRender: 'campaignCreateTime' },    
+    scopedSlots: { customRender: 'status' },    
   },
   {
     title: '创建场景',
-    dataIndex: 'campaignCreateTime',
-    key: 'campaignCreateTime',
+    dataIndex: 'scenes',
+    key: 'scenes',
     align: 'center',
-    scopedSlots: { customRender: 'campaignCreateTime' },   
+    scopedSlots: { customRender: 'scenes' },   
   },
   {
     title: '策略预算',
-    dataIndex: 'cpaignCreateTime',
-    key: 'campaignCateTime',
+    dataIndex: 'budget',
+    key: 'budget',
     align: 'center',
-    scopedSlots: { customRender: 'campaignCrteTime' },   
+    scopedSlots: { customRender: 'budget' },   
   },
 
 ];
@@ -255,7 +260,7 @@ const publicColumns = [
           tip: '广告在投放期间的花费总额',
           align: 'center',
           scopedSlots: { customRender: 'cost' },
-          sorter: () => {}
+        //   sorter: () => {}
         },
         {
           title: '封面曝光数',
@@ -263,7 +268,7 @@ const publicColumns = [
           tip: '广告在瀑布流被观看次数',
           align: 'center',       
           scopedSlots: { customRender: 'photoShow' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
           title: '封面点击数',
@@ -272,25 +277,25 @@ const publicColumns = [
           align: 'center',
         
           scopedSlots: { customRender: 'photoClick' },
-          sorter: () => {}
+        //   sorter: () => {}
         },
         {
           title: '素材曝光数',
-          dataIndex: 'aClick',
+          dataIndex: 'aclick',
           tip: '用户进入视频播放页观看的次数(数据会进行反作弊去重)',
           align: 'center',
        
           scopedSlots: { customRender: 'aClick' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
           title: '行为数',
-          dataIndex: 'bClick',
+          dataIndex: 'bclick',
           tip: '用户在视频播放页单击转化按钮的次数/展示数*100%',
           align: 'center',
         
           scopedSlots: { customRender: 'bClick' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
           title: '封面点击率',
@@ -298,7 +303,7 @@ const publicColumns = [
           tip: '封面点击数占封面展示数百分比',
           align: 'center',    
           scopedSlots: { customRender: 'clickRate' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
           title: '行为率',
@@ -306,7 +311,7 @@ const publicColumns = [
           tip: '行为数占素材曝光数百分比',
           align: 'center',    
           scopedSlots: { customRender: 'bClickRate' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
           title: '平均千次封面曝光花费(元)',
@@ -314,7 +319,7 @@ const publicColumns = [
           tip: '花费/封面曝光数*1000',
           align: 'center',    
           scopedSlots: { customRender: 'cpm' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
           title: '平均封面点击单价(元)',
@@ -322,23 +327,16 @@ const publicColumns = [
           tip: '花费/封面点击数',
           align: 'center',    
           scopedSlots: { customRender: 'cpc' },
-          sorter:() => {}
-        },
-        {
-          title: '平均行为单价(元)',
-          dataIndex: 'cpb',
-          tip: '总花费/行为数',
-          align: 'center',    
-          scopedSlots: { customRender: 'cpb' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
+        
         {
           title: '激活数',
           dataIndex: 'active',
           tip: '广告主回传的应用激活次数',
           align: 'center',    
           scopedSlots: { customRender: 'active' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
           title: '激活单价',
@@ -346,7 +344,7 @@ const publicColumns = [
           tip: '花费/激活数',
           align: 'center',    
           scopedSlots: { customRender: 'activeCost' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
           title: '下载完成激活率',
@@ -354,7 +352,7 @@ const publicColumns = [
           tip: '激活数/安卓下载完成数',
           align: 'center',    
           scopedSlots: { customRender: 'activeRate' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
           title: '注册数',
@@ -362,7 +360,7 @@ const publicColumns = [
           tip: '付费金额/当日消耗',
           align: 'center',    
           scopedSlots: { customRender: 'register' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
           title: '注册成本',
@@ -370,7 +368,7 @@ const publicColumns = [
           tip: '当日消耗/当日回传注册数',
           align: 'center',    
           scopedSlots: { customRender: 'activeRegisterCost' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
           title: '注册率',
@@ -378,7 +376,7 @@ const publicColumns = [
           tip: '当日回传注册数/当日激活数',
           align: 'center',    
           scopedSlots: { customRender: 'activeRegisterRate' },
-          sorter:() => {}
+        //   sorter:() => {}
         },
         {
             title: '次留数',
@@ -386,7 +384,7 @@ const publicColumns = [
             tip: '前一日激活用户在次日继续访问的PV',
             align: 'center',    
             scopedSlots: { customRender: 'nextDayOpen' },
-            sorter:() => {}
+            // sorter:() => {}
         },
         
         {
@@ -395,7 +393,7 @@ const publicColumns = [
             tip: '前一日激活用户在次日继续访问的PV/前一日激活数',
             align: 'center',    
             scopedSlots: { customRender: 'nextDayOpenRate' },
-            sorter:() => {}
+            // sorter:() => {}
         },
 ]
 
@@ -408,10 +406,11 @@ export default {
     // mixins: [JeecgListMixin],
     data() {
         return {
+            accountList:[],
             strategyStatus:undefined,
             strategyName:'',
-            strategyId:'',
-            accountId:'',
+            strategyId:undefined,
+            accountIds:[],
             scrollX:3500,
             ipagination: {
                 current: 1,
@@ -435,14 +434,11 @@ export default {
             spinning:false,
             moment,
            
-         
-           
-           
             optionId:'',//input输入的id或关键词
           
            
             selectDisable:true,
-            optValue:'',//操作设置的值 删除 暂停 开启
+            optValue:undefined,//操作设置的值 删除 暂停 开启
             visible: false,//出价里的弹出框
 
             //主页的表格
@@ -452,16 +448,11 @@ export default {
             selectedRows:[],
             loading:false,
             editID:0,
-            
-
-            
-            url: {
-                
-                planList: "/kuaishou/batch/getUnitList",
-                groupList:'/kuaishou/batch/getUnitList',
-
-                strategyList:'/jeecg-boot/kuaishouStrategy/list'
 
+            url: {               
+                planList: "/ai/list/pageCampaign",
+                groupList:'/ai/list/pageUnit',
+                strategyList:'/ai/list/pageStrategy'
             },
 
 
@@ -492,12 +483,16 @@ export default {
         },
     },
     methods: {
+        goCreateStrategy(){
+            this.$router.push('/autoLaunch/newStrategy')
+        },
         goPlanList(record){
             console.log(record)
-
+            this.$parent.currentStrategyId=record.id;
+            this.$parent.currentTabComponent='planList'
         },
 
-        
+
         //状态改变
         statusChange(value){
             console.log(value);
@@ -506,90 +501,40 @@ export default {
         
         //查询按钮事件
         search(){
-            this.getStrategyList()
-            
+            this.ipagination.current=1;
+            this.getStrategyList()            
         },
         //点击分页
         sort(pagination, filters, sorter, { currentDataSource }){
-            
+            console.log(pagination)
             this.ipagination.current=pagination.current;
 
             this.ipagination.pageSize=pagination.pageSize;
-            this.search()
+            this.getStrategyList()
         },
         
         //状态改变
         switchChange(text,record){
             // this.spinning=true;
-            // console.log(text,record);
-            let recordData=JSON.parse(JSON.stringify(record))
+            console.log(text,record)
             record.spin=true;
-            if(this.tabkey=='group'){
-                let ids=record.id;
-                let status=text?'disable':'enable';
-                postAction('/ctop/byteDanceCampaign/editStatus',qs.stringify({
-                    accountId:this.accountID,
-                    ids:`${ids}`,
-                    status:status,
-                })).then((res)=>{
-                    //    console.log(res);
-                        // this.spinning=false;
-                        record.spin=false;
-                    if(res.success){
-                        this.refreshCampaignList({
-                                accountId:this.accountID,
-                                name:this.optionId,
-                                status:this.statusValue,
-                                startDate:this.dateString[0],
-                                endDate:this.dateString[1],
-                                pageNo:this.ipagination.current,
-                                pageSize:this.ipagination.pageSize,
-                                
-                            })
-                        this.$message.success(res.message)
-                    }else{
-                        this.$message.error(res.message)
-                    }
-                })
-           }else if(this.tabkey=='plan'){
-
-                if(text){
-                    recordData.optStatus='AD_STATUS_DISABLE';
+            
+            let ids=record.id;
+            let state=text?'2':'1';
+            postAction('/kuaishouStrategy/edit',{
+                ids:[record.id],
+                state
+            }).then((res)=>{
+                
+                    record.spin=false;
+                if(res.success){
+                    this.getStrategyList()
+                    this.$message.success(res.message)
                 }else{
-                    recordData.optStatus='AD_STATUS_ENABLE'
+                    this.$message.error(res.message)
                 }
-                this.batchEditHttp('status',[recordData])
-
-           }else if(this.tabkey=='idea'){
-               let ids=record.id;
-               let status=text?'disable':'enable';
-                postAction('/ctop//byteDanceCreative/editStatus',qs.stringify({
-                   accountId:this.accountID,
-                   ids:`${ids}`,
-                   status:status,
-               })).then((res)=>{
-                //    console.log(res);
-                
-                    if(res.success){
-                        //    this.data=[];
-                        record.spin=false;
-                            this.refreshCreativeList({
-                                accountId:this.accountID,
-                                name:this.optionId,
-                                status:this.statusValue,
-                                startDate:this.dateString[0],
-                                endDate:this.dateString[1],
-                                pageNo:this.ipagination.current,
-                                pageSize:this.ipagination.pageSize,
-                                planId:this.currentPlan.id,
-                                
-                            })
-                    }else{
-                        record.spin=false;
-                        this.$message.error(res.message)
-                    }
-               })
-           }
+            })
+           
 
         },
 
@@ -603,110 +548,40 @@ export default {
             // console.log(value)
             this.optValue=value;
         },
-        editGroupStatus(url){
-            let ids='';
-            this.selectedRows.forEach((item,index)=>{
-                if(index==0){
-                    ids=`${item.id}`
-                }else{
-                        ids+=`,${item.id}`
-                }
-
-            })
-            let status=''
-            if(this.optValue=='pause'){
-                status='disable'
-            }else if(this.optValue=='open'){
-                status='enable'
-            }else if(this.optValue=='delete'){
-                status='delete'
-            }
-            postAction(url,qs.stringify({
-                accountId:this.accountID,
-                ids,
-                status,
-            })).then((res)=>{
-                console.log(res);
-                // this.loading=false
-                this.optValue=undefined;
-                if(res.success){
-                    this.$message.success(res.message)
-                    // this.data=[];
-                    this.refreshCampaignList({
-                        accountId:this.accountID,
-                        name:this.optionId,
-                        status:this.statusValue,
-                        startDate:this.dateString[0],
-                        endDate:this.dateString[1],
-                        pageNo:this.ipagination.current,
-                        pageSize:this.ipagination.pageSize,
-                    })
-                }else{
-                    this.loading=false
-                    // if(this.selectedRows.length>0){
-                    //     this.selectedRows.forEach(item=>{
-                    //         item.spin=false;
-                    //     })
-                    // }
-                    this.selectedRowKeys=[];
-                    this.selectedRows=[];
-                    this.optValue=undefined;
-                    this.$message.error(res.message)
-                }
-                
-                
-                
-            })
-        },
+        
         //批量操作的确定按钮
         isOkHandle(){
-            console.log(this.optValue&&this.selectedRowKeys.length>0)
+            console.log(this.optValue,this.selectedRowKeys)
             if(this.optValue&&this.selectedRowKeys.length>0){
                 // this.selectedRows.forEach(item=>{
                 //     item.spin=true;
                 // })
-            
+                let params   ={}
                 if(this.optValue=='pause'){   
-                    this.loading=true;
-                    if(this.tabkey=='group'){
-                        console.log(this.selectedRows);                       
-                        this.editGroupStatus('/ctop/byteDanceCampaign/editStatus')
-
-                    }else if(this.tabkey=='plan'){
-                        // console.log(0)
-                        this.loading=true;
-                        if(this.selectedRowKeys.length>0){
-                            this.selectedRows.forEach((item)=>{
-                                item.optStatus='AD_STATUS_DISABLE'
-                            })
-                        }
-                        console.log(0)
-                        this.batchEditHttp('status',this.selectedRows)
-                    }else if(this.tabkey=='idea'){
-                        this.loading=true;
-                        this.editGroupStatus('/ctop/byteDanceCreative/editStatus')
-                    }
-
+                    this.loading=true;                  
+                       
+                        // if(this.selectedRowKeys.length>0){
+                        //     this.selectedRows.forEach((item)=>{
+                        //         item.optStatus='AD_STATUS_DISABLE'
+                        //     })
+                        // }  
+                        params['ids']= this.selectedRowKeys
+                        params.state='2'       
+                        this.batchEditHttp(params)
                 }else if(this.optValue=='open'){
                     this.loading=true;
-                    if(this.tabkey=='group'){
-                        this.editGroupStatus('/ctop/byteDanceCampaign/editStatus');
-                    }else if(this.tabkey=='plan'){
-                        if(this.selectedRowKeys.length>0){
-                            this.selectedRows.forEach((item)=>{
-                                item.optStatus='AD_STATUS_ENABLE'
-                            })
-                        }
-                        this.batchEditHttp('status',this.selectedRows)
-                    }else if(this.tabkey=='idea'){
-                         this.editGroupStatus('/ctop/byteDanceCreative/editStatus');
-                    }
-
+                   
+                        // if(this.selectedRowKeys.length>0){
+                        //     this.selectedRows.forEach((item)=>{
+                        //         item.optStatus='AD_STATUS_ENABLE'
+                        //     })
+                        // }
+                        params['ids']= this.selectedRowKeys
+                        params.state='1'    
+                        this.batchEditHttp(params)
+                    
                 }
-              
-                // this.selectedRows=[];
-                // this.selectedRowKeys=[];
-                
+         
             }
             
         },
@@ -716,19 +591,15 @@ export default {
                 this.loading=true;
                 if(this.optValue=='delete'){
                     
-                     if(this.tabkey=='group'){
-                         this.editGroupStatus('/ctop/byteDanceCampaign/editStatus')
-                    }else if(this.tabkey=='plan'){
-                        if(this.selectedRowKeys.length>0){
-                            this.selectedRows.forEach((item)=>{
-                                item.optStatus='AD_STATUS_DELETE'
-                            })
-                        }
-                        this.batchEditHttp('status',this.selectedRows)
+                   
+                        // if(this.selectedRowKeys.length>0){
+                        //     this.selectedRows.forEach((item)=>{
+                        //         item.optStatus='AD_STATUS_DELETE'
+                        //     })
+                        // }
+                        this.batchEditHttp(this.selectedRows)
                         this.$message.success('删除成功');
-                    }else if(this.tabkey=='idea'){
-                        this.editGroupStatus('/ctop/byteDanceCreative/editStatus');
-                    }
+                   
 
                 }
 
@@ -736,30 +607,17 @@ export default {
 
         },
         
-        batchEditHttp(type,params){
-            postAction(`/ctop/byteDanceAdvertisePlan/batchEdit/${type}`,params).then((res)=>{
+        batchEditHttp(params){
+            postAction(`/kuaishouStrategy/edit`,params).then((res)=>{
                 // console.log(res);
                 this.optValue=undefined;
                 if(res.success){
-                    if(res.result.length>0){
-                        this.modifyTableData=[]
-                        this.modifyTableData=res.result
-                        
-                        this.getplanList({
-                            accountId:this.accountID,
-                            name:this.optionId,
-                            status:this.statusValue,
-                            startDate:this.dateString[0],
-                            endDate:this.dateString[1],
-                            pageNo:this.ipagination.current,
-                            pageSize:this.ipagination.pageSize,
-                            campaignId:this.currentGroup.id
-                        })
-                    }
+                    
+                    this.getStrategyList()
                     // params.spin=false;
-                    params.forEach(item=>{
-                        item.spin=false;
-                    })
+                    // params.forEach(item=>{
+                    //     item.spin=false;
+                    // })
                     this.optValue=undefined;
                     this.selectedRowKeys=[];
                     this.$message.success(res.message)
@@ -769,31 +627,21 @@ export default {
                     //     item.spin=false;
                     // })
                     this.loading=false;
-                    this.getplanList({
-                        accountId:this.accountID,
-                        name:this.optionId,
-                        status:this.statusValue,
-                        startDate:this.dateString[0],
-                        endDate:this.dateString[1],
-                        pageNo:this.ipagination.current,
-                        pageSize:this.ipagination.pageSize,
-                        campaignId:this.currentGroup.id
-                    })
+                    this.getStrategyList()
                     this.$message.error(res.message)
                 }
             })
         },
         
 
-       
 
         getStrategyList(){
-
-            getAction(this.url.strategyList,{
-                strategyId:this.strategyId,
+            this.loading = true
+            postAction(this.url.strategyList,{
+                strategyId:this.strategyId==undefined?null:this.strategyId,
                 strategyName:this.strategyName,
-                strategyStatus:this.strategyStatus==undefined?'':this.strategyStatus,
-                accountId:this.accountId,
+                strategyStatus:this.strategyStatus==3?null:this.strategyStatus,
+                accountIds:this.accountIds,
                 pageNo:this.ipagination.current,
                 pageSize:this.ipagination.pageSize
             }).then((res)=>{
@@ -804,15 +652,16 @@ export default {
 
                     this.ipagination.total = res.result.total
                     
-                    res.result.records.forEach((item)=>{
+                    res.result.list.forEach((item)=>{
                         item.key=item.id
                     })
 
-                    this.data = res.result.records.map(item=>{
+                    this.data = res.result.list.map(item=>{
 
                         return {
                             ...item,
-                            spin:false
+                            spin:false,
+                            switchStatus:item.strategyState=='1'?true:false,
                         }
                     });
                     // console.log(this.data)
@@ -821,18 +670,31 @@ export default {
             })
         },
       
-        
+        getAccountList(){
+            let userInfo=localStorage.getItem('pro__Login_Userinfo');
+            let userId=''
+            if(userInfo){
+                userId=JSON.parse(userInfo).value.id
+            }
+            getAction('/ctop/userAllocation/getAccountIdsByUserId',{
+                userId,
+            }).then(res=>{
+                console.log(res)
+                if(res.success){
+                    this.accountList=res.result
+                }
+            })
+        }
     },
     mounted() {
-        
+        this.getAccountList()
+        this.getStrategyList()
     },
     
     activated() {
-        // this.accountHttp()
+        this.getStrategyList()
     },
     beforeDestroy() {
-        
-       
 
     },
     filters: {
@@ -922,6 +784,24 @@ export default {
                 return '-'
             }
 
+        },
+        scensFilter(val){
+            let str='';
+            switch (val) {
+                case '1':
+                     str='素材+出价'
+                    break;
+                case '2':
+                     str='素材+定向'
+                    break;
+                case '3':
+                     str='时间+出价'
+                    break;
+            
+                default:
+                    break;
+            }
+            return str
         }
     }
 }
@@ -1002,6 +882,7 @@ export default {
     .OptinItem{
         display: inline-block;
         margin-right: 15px;
+        margin-top: 15px;
         .ok{
             margin-right: 15px;
         }
@@ -1020,7 +901,7 @@ export default {
         // display: inline-block;
         float: right;
         .searchBtn{
-            margin-right: 10px;
+            // margin-right: 10px;
         }
     }
     .tableArea{
@@ -1035,6 +916,7 @@ export default {
         justify-content: flex-start;
         align-items: center;
         margin-bottom: 28px;
+        position: relative;
         h3 {
             font-size: 22px;
             margin: 0;
@@ -1042,6 +924,11 @@ export default {
             height: 30px;
             line-height: 30px;
         }
+        .goCreateStrategy{
+            position: absolute;
+            right: 0;
+            top: 4px;
+        }
     }
 
 }