Browse Source

'批量2.0定向模板支持修改'

魏志佳 4 years ago
parent
commit
a83c073326
2 changed files with 29 additions and 6 deletions
  1. 27 4
      src/views/modules/kuaishouapp/crossAccount/templateModal.vue
  2. 2 2
      vue.config.js

+ 27 - 4
src/views/modules/kuaishouapp/crossAccount/templateModal.vue

@@ -42,7 +42,9 @@
       </a-form>
     </a-spin>
     <template slot="footer">
-      <a-button type="primary" @click="handleSubmit" :loading="loading"> 确定 </a-button>
+      <!-- <a-button type="primary" @click="handleSubmit" :loading="loading"> 确定 </a-button> -->
+      <a-button type="default" @click="()=>{this.visible=false}" :loading="loading"> 取消 </a-button>
+      <a-button type="primary" @click="handleSubmit" :loading="loading"> {{this.type=='add'?'确定':'修改'}} </a-button>
     </template>
   </a-modal>
 </template>
@@ -68,6 +70,7 @@ export default {
 
       populationData: {},
       accountId: '',
+      templateId:undefined,
       type: 'add',
       loading: false,
     }
@@ -87,6 +90,8 @@ export default {
       this.type = type
       var params = {}
       params.templateId = templateId
+      this.templateId=templateId;
+      this.accountId = accountId
       getAction('/batch/kuaishouTemplateTarget/getDetailByTemplateId', params).then((res) => {
         if (res.success) {
           var dataJson = {
@@ -159,14 +164,14 @@ export default {
       this.$refs.population.handleSubmit()
       this.form.validateFieldsAndScroll((err, values) => {
         if (!err) {
-          this.loading = true
+          // this.loading = true
 
           var params = {
             ...this.populationData,
             templateName: values.templateName,
             accountId: this.accountId,
           }
-
+          console.log(params)
           if (this.type == 'add') {
             postAction('/batch/kuaishouTemplate/createTemplate', params).then((res) => {
               if (res.success) {
@@ -186,7 +191,25 @@ export default {
               }
             })
           } else if (this.type == 'look') {
-            this.visible = false
+            params.templateId=this.templateId
+            this.visible = false;
+            postAction('/batch/kuaishouTemplate/updateTemplate', params).then((res) => {
+              if (res.success) {
+                this.visible = false
+                this.loading = false
+
+                getAction('/batch/kuaishouTemplate/getTemplateByAccountId', {
+                  accountId: this.accountId,
+                }).then((res) => {
+                  if (res.success) {
+                    this.$emit('getData', this.accountId)
+                  }
+                })
+              } else {
+                this.loading = false
+                this.$message.error(res.result.message)
+              }
+            })
           }
         }
       })

+ 2 - 2
vue.config.js

@@ -68,7 +68,7 @@ module.exports = {
     open : true,
     proxy: {
       '/jeecg-boot': {
-         target: 'http://192.168.1.8:8080', //请求本地 需要jeecg-boot后台项目  蒙蒙
+        //  target: 'http://192.168.1.8:8080', //请求本地 需要jeecg-boot后台项目  蒙蒙
         // target: 'http://192.168.0.59:8088', //请求本地 需要jeecg-boot后台项目  英豪
         // target: 'http://192.168.1.188:8088', //请求本地 需要jeecg-boot后台项目  英豪
         // target: 'http://192.168.2.115:8080', //请求本地 需要jeecg-boot后台项目  祚云
@@ -85,7 +85,7 @@ module.exports = {
         //  target: 'http://adsp.tjyourong.com.cn/', //请求本地 需要jeecg-boot后台项目
         // target: 'http://192.168.1.251/', //请求本地 需要jeecg-boot后台项目
         // target:'http://118.24.244.213:8804',
-        // target:'http://139.186.151.174:8804', //测试
+        target:'http://139.186.151.174:8804', //测试
 
         ws: false,