|
@@ -116,7 +116,8 @@
|
|
|
formData: [],
|
|
|
dataUrl: [],
|
|
|
agentList: [],
|
|
|
- brandList: [] //品牌
|
|
|
+ brandList: [], //品牌
|
|
|
+ nameList:""
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
@@ -145,20 +146,23 @@
|
|
|
"vtweg": "10"
|
|
|
},
|
|
|
}).then(res => {
|
|
|
- // console.log(res)
|
|
|
if (res.data.code == 0) {
|
|
|
this.agentList = res.data.Data.data
|
|
|
// 从经销商里里面抽取品牌
|
|
|
- const list = this.agentList.map((item,index) => {
|
|
|
- return item.brandList;
|
|
|
+ const list = this.agentList.map((item, index) => {
|
|
|
+ return item.brandList;
|
|
|
}).join(",").split(',')
|
|
|
//去重
|
|
|
- const list2=[...new Set(list)]
|
|
|
+ const list2 = [...new Set(list)]
|
|
|
//根据复选框的数据结构重组数组
|
|
|
- this.brandList = list2.reduce((res,item)=>{
|
|
|
- res.push({name:item,checked:false,disabled: false})
|
|
|
+ this.brandList = list2.reduce((res, item) => {
|
|
|
+ res.push({
|
|
|
+ name: item,
|
|
|
+ checked: false,
|
|
|
+ disabled: false
|
|
|
+ })
|
|
|
return res;
|
|
|
- },[]);
|
|
|
+ }, []);
|
|
|
}
|
|
|
if (res.data.code == 500) {
|
|
|
this.$u.toast(res.data.msg);
|
|
@@ -175,6 +179,19 @@
|
|
|
getCooperation() {
|
|
|
if (this.cooperations != null) {
|
|
|
this.form.cooperation = this.cooperations.toString();
|
|
|
+ let coopList = this.form.cooperation.split(",")
|
|
|
+
|
|
|
+ let a=this.agentList.forEach((item,index, array)=>
|
|
|
+ {
|
|
|
+ for (let i = 0; i < array[index].brandList.length; i++) {
|
|
|
+ for (let j = 0; j < coopList.length; j++) {
|
|
|
+ if(coopList[j] == array[index].brandList[i]){
|
|
|
+ this.nameList+=array[index].name+','
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.nameList=[...new Set(this.nameList.split(',').filter(item => item))]
|
|
|
this.show = false
|
|
|
} else {
|
|
|
console.log("至少选择一项")
|