Bladeren bron

修改内广批量创建界面效果

syh 5 jaren geleden
bovenliggende
commit
e957e00e44

+ 28 - 22
src/views/template/userorientation/modules/ByteDanceUserOrientationTemplateModal.vue

@@ -20,24 +20,24 @@
             <a-input v-model="name"></a-input>
 
         </a-form-item>
-<!--        <a-form-item label="地域" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
-<!--          <a-radio-group v-model="area" :defaultValue="0">-->
-<!--            <a-radio-button value="0">不限</a-radio-button>-->
-<!--            <a-radio-button value="按省市">按省市</a-radio-button>-->
-<!--            <a-radio-button value="按区县">按区县</a-radio-button>-->
-<!--          </a-radio-group>-->
-<!--        </a-form-item>-->
-<!--        <a-form-item-->
-<!--          label=" "-->
-<!--          :colon="false"-->
-<!--          :labelCol="labelCol"-->
-<!--          :wrapperCol="wrapperCol"-->
-<!--          class="else-width"-->
-<!--          v-if="area!='0'"-->
-<!--        >-->
-<!--          <transfer v-if="area == '按区县'" :checkData.sync="dataBox"></transfer>-->
-<!--          <transfer-city v-if="area == '按省市'" :checkData.sync="dataBox"></transfer-city>-->
-<!--        </a-form-item>-->
+        <a-form-item label="地域" :labelCol="labelCol" :wrapperCol="wrapperCol">
+          <a-radio-group v-model="areaType" :defaultValue="0">
+            <a-radio-button value="NONE">不限</a-radio-button>
+            <a-radio-button value="CITY">按省市</a-radio-button>
+            <a-radio-button value="COUNTY">按区县</a-radio-button>
+          </a-radio-group>
+        </a-form-item>
+        <a-form-item
+          label=" "
+          :colon="false"
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          class="else-width"
+          v-if="area!='NONE'"
+        >
+          <transfer-city v-if="areaType == 'CITY'" :checkData.sync="cityList"></transfer-city>
+          <transfer v-if="areaType == 'COUNTY'" :checkData.sync="areaList"></transfer>
+        </a-form-item>
 
         <a-form-item label="性别" :labelCol="labelCol" :wrapperCol="wrapperCol">
           <a-radio-group v-model="gender">
@@ -58,11 +58,11 @@
           <a-radio-group v-model="intrestType">
             <a-radio-button value="NONE">不限</a-radio-button>
             <a-radio-button value="SYSTEM_TJ">系统推荐</a-radio-button>
-            <!--<a-radio-button value="ZDY">自定义</a-radio-button>-->
+            <a-radio-button value="ZDY">自定义</a-radio-button>
           </a-radio-group>
         </a-form-item>
 
-        <!--<a-form-item
+        <a-form-item
           label=" "
           :colon="false"
           :labelCol="labelCol"
@@ -71,7 +71,7 @@
           v-if="intrestType=='ZDY'"
         >
           <intrest-category v-if="intrestType == 'ZDY'" :checkData.sync="intrestCategoryList"></intrest-category>
-        </a-form-item>-->
+        </a-form-item>
         <a-form-item label="平台" :labelCol="labelCol" :wrapperCol="wrapperCol">
           <a-radio-group v-model="platformType">
             <a-radio-button value="NONE">不限</a-radio-button>
@@ -159,6 +159,8 @@ export default {
   },
   data() {
     return {
+      cityList:[],
+      areaList:[],
       name:"",
       netType:[],
       platformType:"NONE",
@@ -194,7 +196,7 @@ export default {
       articleCategoryList: [],
       isArticleCategory: "NONE",
       zdyrq: [],
-      area: "0",
+      areaType: "NONE",
       value: undefined,
       model1: {},
       model2: {},
@@ -335,6 +337,10 @@ export default {
           params.isMobileBrand = this.isMobileBrand;
           params.mobileType = this.mobileType;
           params.name = this.name;
+          params.areaType = this.areaType;
+          params.cityList = this.cityList;
+          params.areaList = this.areaList;
+          params.intrestCategoryList = this.intrestCategoryList;
 
           console.log(params);
           postAction(this.url.insertUrl,params).then((res)=>{

+ 34 - 7
src/views/template/userorientation/modules/IntrestCategory.vue

@@ -68,6 +68,7 @@ p {
     <div class="transfer-box">
       <div class="content-box">
         <p class="content-title">兴趣分类</p>
+
         <div class="content">
           <p>
             <input type="checkbox" class="select_all" @change="checkAllBox" v-model="checkAll" /> 全选
@@ -132,7 +133,8 @@ p {
           已选
           <span
             style="float:right;font-weight:normal;color:blue;cursor: pointer;font-size:14px"
-            @click="clear">清空</span>
+            @click="clear"
+          >清空</span>
         </p>
         <div class="content">
           <p v-for="(item,index) of checkData" :key="index">
@@ -153,7 +155,7 @@ import { JeecgListMixin } from '@/mixins/JeecgListMixin'
 import { getProvince } from '@/api/manage'
 import $ from 'jquery'
 export default {
-  name: 'ByteDanceIntrestCategoryList',
+  name: 'ByteDanceUserOrientationTemplateList',
   components: {},
   data() {
     return {
@@ -182,7 +184,6 @@ export default {
   methods: {
     getData() {
       getProvince(this.CityData, { parentCode: '' }).then(res => {
-        console.log(res)
         if (res.code == '0') {
           //   this.province.push(...res.result.records)
           this.province = res.result.records.map(item => {
@@ -242,16 +243,34 @@ export default {
     },
     checkOne(item, index) {
       if (this.checkMatched.indexOf(item.value) == -1) {
-        var index = this.checkData.findIndex(v => v.value === item.value)
-        this.checkData.splice(index, 1)
+        var index1 = this.checkData.findIndex(v => v.value === item.value)
+        this.checkData.splice(index1, 1)
         if (this.nowProvince) {
           if (this.nowProvince.value == item.value) {
             this.checkMatchedCity = []
           }
         }
-        this.checkAll = false
       } else {
         this.checkData.push(item)
+        var data = []
+        getProvince(this.CityData, { parentCode: item.value }).then(res => {
+          if (res.code == '0') {
+            data = res.result.records.map(item => {
+              return {
+                label: item.name,
+                value: item.id
+              }
+            })
+            for (var i = 0; i < this.checkData.length; i++) {
+              for (let j = 0; j < data.length; j++) {
+                if (this.checkData[i].value == data[j].value) {
+                  this.checkData.splice(i, 1)
+                }
+              }
+            }
+          }
+        })
+
         if (this.nowProvince) {
           if (item.value == this.nowProvince.value) {
             this.checkMatchedCity = this.city.map(item => {
@@ -260,8 +279,10 @@ export default {
           }
         }
       }
-      if (this.checkData.length == this.province.length) {
+      if (this.checkMatched.length == this.province.length) {
         this.checkAll = true
+      } else {
+        this.checkAll = false
       }
       this.$emit('update:checkData', this.checkData)
     },
@@ -306,12 +327,18 @@ export default {
         if (allCity.length != this.city.length) {
           this.checkData.push(item)
         }
+        if (this.checkMatched.length == this.province.length) {
+          this.checkAll = true
+        } else {
+          this.checkAll = false
+        }
       } else {
         if (this.checkMatched.indexOf(this.nowProvince.value) != -1) {
           var index1 = this.checkData.findIndex(v => v.value === this.nowProvince.value)
           var index2 = this.checkMatched.findIndex(v => v === this.nowProvince.value)
           this.checkData.splice(index1, 1)
           this.checkMatched.splice(index2, 1)
+          this.checkAll = false
           var data = this.city.filter(v => {
             return v.value != item.value
           })