Browse Source

定向修改

朱鑫波 4 năm trước cách đây
mục cha
commit
50ea4eadd7

+ 2 - 2
src/views/modules/Statistics/components/Treeselect.vue

@@ -201,9 +201,9 @@ export default {
                       return {
                         id: i.accountId,
                         label:
-                          (i.userName.length == 2
+                          (i.userName&&i.userName.length == 2
                             ? i.userName + '\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0'
-                            : i.userName.length == 3
+                            : i.userName&&i.userName.length == 3
                             ? i.userName + '\xa0\xa0\xa0\xa0'
                             : i.userName) +
                           '\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0' +

+ 54 - 18
src/views/modules/Statistics/components/selectPagination.vue

@@ -20,37 +20,68 @@
   text-align: center;
 }
 </style>
+<style lang="scss" scoped>
+.require-check {
+  /deep/ .ant-form-item-label {
+    label::before {
+      display: inline-block;
+      margin-right: 4px;
+      color: #f5222d;
+      font-size: 14px;
+      font-family: SimSun, sans-serif;
+      line-height: 1;
+      content: '*';
+    }
+  }
+}
+</style>
 <template>
   <a-form-item
     label="项目名称"
     :label-col="labelCol"
     :wrapper-col="wrapperCol"
     v-clickoutside="handleClose"
-    style="width:100%"
+    style="width: 100%"
     class="select-table"
+    :class="{'require-check':requireCheck} "
   >
-    <a-input placeholder="请输入项目名称或者账户名称" @focus="topMiddle = true" v-model="keyValue" @change="getData" :disabled="disabled"/>
+    <a-input
+      placeholder="请输入项目名称或者账户名称"
+      @focus="topMiddle = true"
+      v-model="keyValue"
+      @change="getData"
+      :disabled="disabled"
+    />
     <div
       v-show="topMiddle"
       v-infinite-scroll="handleInfiniteOnLoad"
-      style="background:white;padding:10px;box-shadow: 0 2px 8px 0 rgba(0,0,0,.15);position:absolute;z-index:1000;width:100%"
+      style="
+        background: white;
+        padding: 10px;
+        box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.15);
+        position: absolute;
+        z-index: 1000;
+        width: 100%;
+      "
       class="demo-infinite-container"
       :infinite-scroll-disabled="busy"
       :infinite-scroll-distance="80"
     >
       <a-list :data-source="data">
         <a-list-item slot="renderItem" slot-scope="item" @click="showProject(item)">
-          <a-list-item-meta :description="'广告主名称:'+item.advertiserName">
+          <a-list-item-meta :description="'广告主名称:' + item.advertiserName">
             <a slot="title">项目名称:{{ item.projectName }}</a>
           </a-list-item-meta>
           <div>
-            {{item.mediaId == '1'
-            ? '头条'
-            : item.mediaId == '2'
-            ? '快手'
-            : item.mediaId == '3'
-            ? '头条内广'
-            : '快手内广'}}
+            {{
+              item.mediaId == '1'
+                ? '头条'
+                : item.mediaId == '2'
+                ? '快手'
+                : item.mediaId == '3'
+                ? '头条内广'
+                : '快手内广'
+            }}
           </div>
         </a-list-item>
         <div v-if="loading && !busy" class="demo-loading-container">
@@ -98,7 +129,7 @@ export default {
   directives: { clickoutside, infiniteScroll },
   props: {
     projectId: {
-      type: [String,Number],
+      type: [String, Number],
       default() {
         return ''
       },
@@ -110,14 +141,19 @@ export default {
           xs: { span: 24 },
           sm: { span: 5 },
         }
-      }
+      },
     },
     disabled: {
       type: Boolean,
       default() {
         return false
-      }
-
+      },
+    },
+    requireCheck: {
+      type: Boolean,
+      default() {
+        return false
+      },
     }
   },
 
@@ -184,13 +220,13 @@ export default {
       })
     },
     getData() {
-      if(this.keyValue == ''){
-        this.$emit('update:projectId', "")
+      if (this.keyValue == '') {
+        this.$emit('update:projectId', '')
       }
       this.ipagination.current = 1
       getAction('/ctop/projectMember/participateListV2', {
         userId: this.userInfo().id,
-        pageNo:  this.ipagination.current,
+        pageNo: this.ipagination.current,
         projectName: this.keyValue,
       }).then((res) => {
         if (res.code == 0) {

+ 3 - 0
src/views/modules/autoLaunch/directional/components/targetedPopulation.vue

@@ -1160,6 +1160,9 @@ export default {
           }
           this.$emit('update:populationData', dataJson)
         }
+        else {
+          
+        }
       })
     },
     handleConfirmValue(rule, value, callback) {

+ 83 - 51
src/views/modules/autoLaunch/directional/components/templateModal.vue

@@ -23,27 +23,42 @@
   top: -0.5px;
   margin: 0 8px 0 2px;
 }
+.ant-form-item-required::before {
+  display: inline-block;
+  margin-right: 4px;
+  color: #f5222d;
+  font-size: 14px;
+  font-family: SimSun, sans-serif;
+  line-height: 1;
+  content: '*';
+}
+</style>
+<style lang="scss" scoped>
+.require-check {
+  /deep/ .ant-form-item-label {
+    label::before {
+      display: inline-block;
+      margin-right: 4px;
+      color: #f5222d;
+      font-size: 14px;
+      font-family: SimSun, sans-serif;
+      line-height: 1;
+      content: '*';
+    }
+  }
+}
 </style>
 <template>
-  <a-modal v-model="visible" title="定向模板" :width="1100" v-if="visible">
+  <a-modal v-model="visible" :title="type === 'add' ? '新建定向包' : '修改定向包'" :width="1100" v-if="visible">
     <a-spin :spinning="spinning">
       <a-form @submit="handleSubmit" :form="form">
-        <a-form-item
-          label="模板名称"
-          :labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"
-          :wrapperCol="{ lg: { span: 12 }, sm: { span: 12 } }"
-        >
-          <a-input
-            v-decorator="['templateName', { rules: [{ required: true, message: '模板名称必填' }] }]"
-            :disabled="type == 'look'"
-          ></a-input>
-        </a-form-item>
         <a-row :gutter="24">
           <a-col :md="24" :sm="24" :xxl="24">
             <selectTable
               :projectId.sync="projectId"
               :labelCol="labelCol"
               :disabled="disabled"
+              :requireCheck="true"
               v-if="!disabled"
             ></selectTable>
             <a-form-item
@@ -51,11 +66,23 @@
               label="项目名称"
               :labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"
               :wrapperCol="{ lg: { span: 12 }, sm: { span: 12 } }"
+              class="require-check"
             >
               <a-input v-model="projectName" :disabled="disabled"></a-input>
             </a-form-item>
           </a-col>
         </a-row>
+        <a-form-item
+          label="模板名称"
+          :labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"
+          :wrapperCol="{ lg: { span: 12 }, sm: { span: 12 } }"
+        >
+          <a-input
+            v-decorator="['templateName', { rules: [{ required: true, message: '模板名称必填' }] }]"
+            :disabled="type == 'look'"
+          ></a-input>
+        </a-form-item>
+
         <targeted-population ref="population" :populationData.sync="populationData" />
       </a-form>
     </a-spin>
@@ -72,7 +99,7 @@
         取消
       </a-button>
       <a-button type="primary" @click="handleSubmit" :loading="loading">
-        {{ this.type == 'add' ? '确定' : '修改' }}
+        {{ type == 'add' ? '确定' : '修改' }}
       </a-button>
     </template>
   </a-modal>
@@ -123,10 +150,10 @@ export default {
       this.visible = true
       this.type = type
       var params = {}
-      params.id = item.id;
-      this.templateId = item.id;
-      this.projectName = item.projectName;
-      this.projectId = item.projectId;
+      params.id = item.id
+      this.templateId = item.id
+      this.projectName = item.projectName
+      this.projectId = item.projectId
       getAction('/kuaishouDirectionalPackage/queryById', params).then((res) => {
         if (res.success) {
           var dataJson = {
@@ -151,7 +178,6 @@ export default {
           this.populationData.behavior = dataJson.label
           this.populationData.interest = dataJson.interestLabel
 
-
           this.populationData.sceneType = dataJson.sceneType ? JSON.parse(dataJson.sceneType) : []
           this.populationData.allForm = {}
           this.populationData.allForm.regionType =
@@ -184,7 +210,7 @@ export default {
           this.populationData.allForm.checkArr =
             this.populationData.allForm.appType == '2' ? JSON.parse(dataJson.appIds) : []
           this.populationData.projectId = dataJson.projectId + ''
-          
+
           this.disabled = true
 
           this.$nextTick(() => {
@@ -203,42 +229,48 @@ export default {
 
       e.preventDefault()
       this.$refs.population.handleSubmit()
-      this.form.validateFieldsAndScroll((err, values) => {
+      this.$refs.population.formAll.validateFields((err, value) => {
         if (!err) {
-          // this.loading = true
-
-          var params = {
-            ...this.populationData,
-            templateName: values.templateName,
-            projectId: this.projectId,
-          }
-          params.label = JSON.stringify(params.behavior)
-          params.interestLabel = JSON.stringify(params.interest)
-          if (this.type == 'add') {
-            postAction('/kuaishouDirectionalPackage/createDirectionalPackage', params).then((res) => {
-              if (res.success) {
-                this.visible = false
-                this.loading = false
-                this.$emit('getData')
+          this.form.validateFieldsAndScroll((err, values) => {
+            if (!err) {
+              // this.loading = true
+              if (this.projectId) {
+                var params = {
+                  ...this.populationData,
+                  templateName: values.templateName,
+                  projectId: this.projectId,
+                }
+                params.label = JSON.stringify(params.behavior)
+                params.interestLabel = JSON.stringify(params.interest)
+                if (this.type == 'add') {
+                  postAction('/kuaishouDirectionalPackage/createDirectionalPackage', params).then((res) => {
+                    if (res.success) {
+                      this.visible = false
+                      this.loading = false
+                      this.$emit('getData')
+                    } else {
+                      this.loading = false
+                      this.$message.error(res.message)
+                    }
+                  })
+                } else if (this.type == 'edit') {
+                  params.id = this.templateId
+                  postAction('/kuaishouDirectionalPackage/updateDirectionalPackage', params).then((res) => {
+                    this.visible = false
+                    if (res.success) {
+                      this.loading = false
+                      this.$emit('getData')
+                    } else {
+                      this.loading = false
+                      this.$message.error(res.message)
+                    }
+                  })
+                }
               } else {
-                this.loading = false
-                this.$message.error(res.result.message)
+                this.$message.error('请选择项目')
               }
-            })
-          } else if (this.type == 'edit') {
-            params.id = this.templateId
-            postAction('/kuaishouDirectionalPackage/updateDirectionalPackage', params).then((res) => {
-              this.visible = false
-              if (res.success) {
-                this.loading = false
-                this.$emit('getData')
-               
-              } else {
-                this.loading = false
-                this.$message.error(res.result.message)
-              }
-            })
-          }
+            }
+          })
         }
       })
     },

+ 4 - 3
src/views/modules/autoLaunch/directional/components/tree-select.vue

@@ -16,14 +16,14 @@
                             @check="onCheck"
                             @expand="onExpand"
                         />
-                        <a-pagination
+                        <!-- <a-pagination
                             class="pagin-table-class"
                             :total="totalAll"
                             :show-total="total => `共 ${totalAll} 条`"
                             size="small"
                             @change="onShowSizeChange"
                             @showSizeChange="onShowSizeChange"
-                        />
+                        /> -->
                     </template>
                     <div class="example">
                         <a-spin :spinning="spinning"/>
@@ -95,7 +95,7 @@ export default {
             leftTreeNoData: false,
             tablePag: {
                 page: 1,
-                size: 20
+                size: 100
             },
         };
     },
@@ -124,6 +124,7 @@ export default {
                         return {
                             key: item.accountId,
                             title: item.authName,
+                            disabled: item.state === 1,
                             children: null
                         };
                     });

+ 19 - 11
src/views/modules/autoLaunch/directional/directional-service.js

@@ -12,13 +12,15 @@
             {
                 title: '账户名称',
                 dataIndex: 'authName',
-                width: '50%'
+                width: '50%',
+                align: 'center'
             },
             {
-                title: '操作',
+                title: '编辑',
                 dataIndex: 'action',
                 scopedSlots: {customRender: 'action'},
-                width: '50%'
+                width: '50%',
+                align: 'center'
             }
         ]
     }
@@ -27,25 +29,29 @@
     setCauseColumns() {
         return [
             {
-                title: '项目名称',
+                title: '账户名称',
                 dataIndex: 'authName',
-                width: '25%'
+                width: '25%',
+                align: 'center'
             },
             {
                 title: '推送结果',
                 dataIndex: 'result',
-                width: '25%'
+                width: '25%',
+                align: 'center'
             },
             {
-                title: '原因',
+                title: '失败原因',
                 dataIndex: 'message',
-                width: '25%'
+                width: '25%',
+                align: 'center'
             },
             {
                 title: '操作',
                 dataIndex: 'action',
                 scopedSlots: {customRender: 'action'},
-                width: '25%'
+                width: '25%',
+                align: 'center'
             }
         ]
     }
@@ -56,12 +62,14 @@
             {
                 title: '广告组名称',
                 dataIndex: 'unitName',
-                width: '50%'
+                width: '50%',
+                align: 'center'
             },
             {
                 title: '所属账户',
                 dataIndex: 'accountName',
-                width: '50%'
+                width: '50%',
+                align: 'center'
             }
         ]
     }

+ 35 - 7
src/views/modules/autoLaunch/directional/directional.vue

@@ -7,7 +7,7 @@
                 <a-row :gutter="24">
                     <a-col :md="8" :sm="8" :xxl="6">
                         <!-- <a-form-item label="项目名称"> -->
-                        <selectTable :projectId.sync="projectId" ref="selectTable"></selectTable>
+                        <selectTable :projectId.sync="projectId" ref="selectTable" :requireCheck="false"></selectTable>
                     </a-col>
 
                     <a-col :md="8" :sm="8" :xxl="6">
@@ -175,6 +175,15 @@
         >
             <div>
                 <div class="cause-modal-table-class">
+                         <a-select
+                            style="width:200px;margin-bottom:10px"
+                            v-model="resultHistory"
+                            placeholder="请选择"
+                            allow-clear
+                        >
+                            <a-select-option :value="1">推送成功</a-select-option>
+                            <a-select-option :value="0">推送失败</a-select-option>
+                        </a-select>
                     <a-table :columns="causeColumns" :data-source="causeData" bordered :pagination="false">
                         <span slot="action" slot-scope="text, record">
                             <a-popconfirm
@@ -215,7 +224,8 @@
                 </a-table>
             </div>
             <div v-else>
-                <a-table :columns="depColumns" :data-source="acountData" bordered>
+                <AcountSearch :appId.sync="unitAccountId" :multiple="false"  request="2,4"   ref="treeSelect" style="margin-bottom:8px;width:300px " />   
+                <a-table :columns="depColumns" :data-source="acountData" bordered :pagination="accountIpagination">
                 </a-table>
             </div>
         </a-modal>
@@ -359,6 +369,8 @@ export default {
             excludeSelectedKeys: [],
             excludeSelectedRowKeys: [],
             //自定义人群参数结束
+            resultHistory: null,
+            unitAccountId: "",
             activeKey: "",
             setPersonVisible: false,
             setPersonLoading: false,
@@ -391,6 +403,7 @@ export default {
             populationTypeTasks: AppMarketService.setPopulationTypeTasks(), // 人群包类型
             platform: AppMarketService.setPlatform(), // 状态枚举
             relaxStatus: '',
+            relaxData: null,
             causeData: [], // 原因的table列表数据,
             depData: [], // 相关项目的table列表数据,
             acountData: [], // 相关账户的table列表数据,
@@ -433,7 +446,7 @@ export default {
                     // 当在页面定义change事件时,切记要把此处的事件清除,因为这两个事件重叠了,可能到时候会导致一些莫名的bug
                     this.accountIpagination.current = current;
                     this.accountIpagination.pageSize= pageSize;
-                    this.handleGetTableList()
+                    this.handleAcountRelax(this.relaxStatus  ,this.relaxData)
                 }
             },
             columns: [
@@ -508,6 +521,11 @@ export default {
             causeDetailData: {}
         };
     },
+    watch: {
+        unitAccountId: function(n,o) {
+            this.handleAcountRelax(this.relaxStatus  ,this.relaxData)
+        }
+    },
     computed: {
         hasSelected() {
             return this.selectedRowKeys.length > 0;
@@ -785,7 +803,7 @@ export default {
             let that = this
             this.$confirm({
                 title: '删除提示',
-                content: '确定要删除这一条吗?',
+                content: '是否删除该定向包?',
                 onOk() {
                     getAction('/kuaishouDirectionalPackage/delete', {id: data.id}).then(result => {
                         if (result.code === 200) {
@@ -803,14 +821,22 @@ export default {
         },
         handleAcountRelax(txt, recd) {
             this.relaxStatus = txt;
+            this.relaxData = recd;
             this.relaxVisible = true;
             let params = {};
             params.id = recd.id;
             params.type = txt === 'unit' ? 2 : 1;
+            params.pageNo = this.accountIpagination.current;
+            params.pageSize = this.accountIpagination.pageSize;
+            if(txt === 'unit') {
+                params.accountId = this.unitAccountId;
+            }
+            
             // acountData
             getAction('/kuaishouDirectionalPackage/getRelatedAccountGroup', params).then( res => {
                 if(res.success) {
-                    this.acountData = res.result.list
+                    this.acountData = res.result.list;
+                    this.accountIpagination.total = res.result.total;
                 }
             })
         },
@@ -826,7 +852,8 @@ export default {
             const paramsData = {
                 id: id,
                 pageNo: this.causePag.page,
-                pageSize: this.causePag.size
+                pageSize: this.causePag.size,
+                status: this.resultHistory
             };
             postAction('/kuaishouDirectionalPackage/queryPushResults', paramsData).then(result => {
                 if (result.code === 200) {
@@ -863,6 +890,7 @@ export default {
             this.$refs.templateModal.handleOk(val, 'edit')
         },
         handlePush(val) {
+            this.finallyRightTree = [];
             this.tableSelectList = val;
             this.pushVisible = true;
         },
@@ -899,7 +927,7 @@ export default {
             postAction('/kuaishouDirectionalPackage/pushDirectionalPackage' ,params).then(res => {
                 this.setPersonLoading = false;
                 if(res.success) {
-                    this.$message.success('推送成功')
+                    this.$message.success('推送中,请稍候')
                     this.handlePersonCancel()
                 }
                 else {