|
@@ -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
|
|
|
})
|