|
@@ -34,27 +34,43 @@
|
|
|
class="onlyTop pubLiStyle"
|
|
|
:class="selectArr[0]?'activeBgc':null"
|
|
|
@click="selectPart(0)"
|
|
|
+ v-if="choose == 'single'"
|
|
|
>
|
|
|
<template v-for="item in poolDetailList[0]">
|
|
|
- <span class="hzx" v-for="part in item.questionDetailList" :key="part.id">{{part.name}}</span>
|
|
|
+ <span class="hzx ellipsis" v-for="part in item.questionDetailList" :title="'[ '+item.name+' ]'" :key="part.id">{{part.name}}</span>
|
|
|
</template>
|
|
|
</div>
|
|
|
+ <div
|
|
|
+ class="onlyTop pubLiStyle"
|
|
|
+ :class="selectArr[0]?'activeBgc':null"
|
|
|
+ @click="selectPart(0)"
|
|
|
+ v-else
|
|
|
+ >
|
|
|
+ <span class="hzx ellipsis" v-for="item in poolDetailList[0]" :title="'[ '+item.name+' ]'" v-show="choose == 'multiple'" :key="item.id">{{item.name}}</span>
|
|
|
+ </div>
|
|
|
<div class="onlyBottom pubList">
|
|
|
<ul class="clearfix">
|
|
|
<li v-for="n in 5"
|
|
|
:key="n + 'part'"
|
|
|
- class="onlyBottomPart"
|
|
|
+ class="onlyBottomPart "
|
|
|
:class="selectArr[n]?'activeBgc':null"
|
|
|
:style="{borderRight:n==5?'0':''}"
|
|
|
@click="selectPart(n)"
|
|
|
>
|
|
|
- <ul>
|
|
|
+ <ul v-if="choose == 'single'">
|
|
|
<template v-for="item in poolDetailList[n]">
|
|
|
- <li class="partDetail" v-for="part in item.questionDetailList" :key="part.id">
|
|
|
+ <li class="partDetail ellipsis" v-for="part in item.questionDetailList" :title="'[ '+item.name+' ]'" :key="part.id">
|
|
|
{{part.name}}
|
|
|
</li>
|
|
|
</template>
|
|
|
</ul>
|
|
|
+ <ul v-else>
|
|
|
+ <template>
|
|
|
+ <li class="partDetail ellipsis" v-for="item in poolDetailList[n]" :style="getStyleR(item.id)?styleR:null" :title="'[ '+item.name+' ]'" :key="item.id" @click="selectTagOne($event,item.id,n)">
|
|
|
+ [ {{item.name}} ]
|
|
|
+ </li>
|
|
|
+ </template>
|
|
|
+ </ul>
|
|
|
</li>
|
|
|
</ul>
|
|
|
</div>
|
|
@@ -71,7 +87,6 @@
|
|
|
</p>
|
|
|
</template>
|
|
|
</li>
|
|
|
-
|
|
|
</ul>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -97,28 +112,27 @@ export default {
|
|
|
type: String
|
|
|
},
|
|
|
choose: {
|
|
|
- default: 'single', //multiple多
|
|
|
+ default: 'multiple', //multiple 多选 single 单
|
|
|
type: String
|
|
|
},
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- currentDetail: {}, //当前点击的标签对应的展开数据
|
|
|
- poolDetailList: [ //默认6个部分
|
|
|
- [], [], [], [], [], []
|
|
|
- ],
|
|
|
+ currentDetail: [], //当前点击的标签对应的展开数据
|
|
|
+ poolDetailList: [[],[],[],[],[],[]], //默认6个部分
|
|
|
+ poolDetailListTips: [[],[],[],[],[],[]], //6个部分对应的提示
|
|
|
poolDetailListAll:[], //默认6个部分转化为一维数组
|
|
|
- activePart: '-1', //选中part第几个
|
|
|
+ activePart: '-1', //选中part第几个
|
|
|
+ activePartSon:'-1', //选中第几个part中的元素了
|
|
|
selectArr: [false, false, false, false, false, false], //右侧选中part状态
|
|
|
- select: '', //右侧选中的项
|
|
|
|
|
|
- styles:{
|
|
|
- background:'#eae7e7'
|
|
|
- }, //选中单条样式
|
|
|
+ styles:{background:'#eae7e7'}, //选中单条样式
|
|
|
+ styleR:{color:'red !important'},
|
|
|
searchVal: '', //搜索值
|
|
|
currentPool: [], //标签池数据
|
|
|
currentLis:[], //选中单条ID组合(多选)
|
|
|
notIds:[], //去重IDs
|
|
|
+ multipleItem:[], //右侧选中的单条标签
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
@@ -129,28 +143,113 @@ export default {
|
|
|
},
|
|
|
searchVal(newVal, preVal){
|
|
|
if(newVal.trim() == ''){
|
|
|
- this.searchTagList()
|
|
|
+ this.searchTagList();
|
|
|
}else if(newVal.trim() != preVal.trim()){
|
|
|
- this.searchTagList()
|
|
|
+ this.searchTagList();
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ showTips(n){
|
|
|
+ let arr = this.poolDetailList[n],tmpControlType=[];
|
|
|
+ arr.map((item)=>{
|
|
|
+ if(utils.filterArr(this.tmpControlType,item.controlType,2)){
|
|
|
+ return
|
|
|
+ }else{
|
|
|
+ tmpControlType.push(item.controlType)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ console.log(tmpControlType)
|
|
|
+ return tmpControlType;
|
|
|
+ },
|
|
|
+ selectTagOne(e,id,n){
|
|
|
+ e.stopPropagation()
|
|
|
+ this.activePartSon = n
|
|
|
+ this.selectArr = [false, false, false, false, false, false]
|
|
|
+ this.poolDetailListAll = Array.prototype.concat.apply([],this.poolDetailList); //二维转一维
|
|
|
+ if(utils.filterArr(this.multipleItem,id,2)){
|
|
|
+ let tmpArr = utils.filterArr(this.multipleItem,id,1);
|
|
|
+ this.multipleItem = tmpArr;
|
|
|
+ }else{
|
|
|
+ let tmpArr = this.multipleItem;
|
|
|
+ tmpArr.push(id)
|
|
|
+ this.multipleItem = tmpArr
|
|
|
+ }
|
|
|
+ },
|
|
|
toRightPool(){
|
|
|
-
|
|
|
+ if(this.currentLis.length == 0){
|
|
|
+ this.$message({
|
|
|
+ showClose: true,
|
|
|
+ message: '请选择标签池标签',
|
|
|
+ type: 'warning'
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(this.choose == 'multiple'){
|
|
|
+ this.getRightListDes();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ toLeftPool(){ //往左返回数据
|
|
|
+ if(this.choose == 'single' && utils.filterArr(this.selectArr,true,2) && this.poolDetailList[this.activePart].length > 0){
|
|
|
+ let tmparr = this.poolDetailList;
|
|
|
+ tmparr[this.activePart] = []
|
|
|
+ this.poolDetailList = tmparr;
|
|
|
+ this.poolDetailListAll = Array.prototype.concat.apply([],this.poolDetailList); //二维转一维
|
|
|
+ this.searchTagList();
|
|
|
+ this.currentLis = [];
|
|
|
+ }else if((this.choose == 'multiple') && (utils.filterArr(this.selectArr,true,2) && this.poolDetailList[this.activePart].length > 0) || (this.multipleItem.length > 0)){
|
|
|
+ if(this.activePart != -1){
|
|
|
+ let tmparr = this.poolDetailList;
|
|
|
+ tmparr[this.activePart] = []
|
|
|
+ this.poolDetailList = tmparr;
|
|
|
+ this.poolDetailListAll = Array.prototype.concat.apply([],this.poolDetailList); //二维转一维
|
|
|
+ this.searchTagList();
|
|
|
+ this.currentLis = [];
|
|
|
+ }else{
|
|
|
+ let tmparr = [],tmpArr = this.poolDetailList[this.activePartSon],tmpArrR = [];
|
|
|
+ console.log(tmpArr)
|
|
|
+ this.multipleItem.map((id)=>{
|
|
|
+ this.poolDetailListAll = utils.filterArr(this.poolDetailListAll,id,1,1)
|
|
|
+ this.multipleItem = []
|
|
|
+ tmpArr = utils.filterArr(tmpArr,id,1,1)
|
|
|
+ })
|
|
|
+ this.poolDetailList[this.activePartSon] = tmpArr
|
|
|
+ this.searchTagList();
|
|
|
+ this.currentLis = [];
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
- toLeftPool(){
|
|
|
+ getPoolDetailListTips(list){
|
|
|
+ let poolDetailListTips = this.poolDetailListTips;
|
|
|
+ // list.map((item,index)=>{
|
|
|
+ // (item.length > 0) && item.map((part,idx)=>{
|
|
|
+ // if(utils.filterArr(poolDetailListTips[index],part.id,2)){
|
|
|
+
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // })
|
|
|
+ for(let i = 0;i < list.length;i++){
|
|
|
+ if(item.length > 0){
|
|
|
+ for(let j = 0;j < list[i].length;j++){
|
|
|
+ if(utils.filterArr(poolDetailListTips[index],part.id,2)){
|
|
|
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
getStyle(id){ //左侧选中状态
|
|
|
return utils.filterArr(this.currentLis,id,2)
|
|
|
},
|
|
|
+ getStyleR(id){ //右侧选中状态
|
|
|
+ return utils.filterArr(this.multipleItem,id,2)
|
|
|
+ },
|
|
|
searchTagList() {
|
|
|
let ids = [];
|
|
|
this.poolDetailListAll.map((value)=>{
|
|
|
ids.push(value.id)
|
|
|
- this.notIds = ids;
|
|
|
})
|
|
|
+ this.notIds = ids;
|
|
|
let param = {
|
|
|
"tagName": this.searchVal || '',
|
|
|
"type": this.type,
|
|
@@ -165,6 +264,7 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
selectPart(idx) {
|
|
|
+ this.multipleItem = []
|
|
|
let tmpFst1 = this.selectArr[0],
|
|
|
tmpFst2 = this.selectArr[1],
|
|
|
tmpFst3 = this.selectArr[2],
|
|
@@ -217,42 +317,68 @@ export default {
|
|
|
let tmpIds = [];
|
|
|
tmpIds.push(id);
|
|
|
this.currentLis = tmpIds;
|
|
|
+ this.getRightListDes();
|
|
|
}else{ //多选
|
|
|
- // let tmpIds = this.currentLis;
|
|
|
- // if(utils.filterArr(tmpIds,id,2)){
|
|
|
- // return;
|
|
|
- // }else{
|
|
|
- // tmpIds.push(id);
|
|
|
- // }
|
|
|
- // this.currentLis = tmpIds;
|
|
|
+ let tmpIds = this.currentLis;
|
|
|
+ if(utils.filterArr(tmpIds,id,2)){
|
|
|
+ tmpIds = utils.filterArr(tmpIds,id,1)
|
|
|
+ }else{
|
|
|
+ tmpIds.push(id);
|
|
|
+ }
|
|
|
+ this.currentLis = tmpIds;
|
|
|
}
|
|
|
-
|
|
|
+ },
|
|
|
+ getRightListDes(){
|
|
|
+ let idStr = this.currentLis.join(',');
|
|
|
let param = {
|
|
|
// "age": 0,
|
|
|
- "ids": id,
|
|
|
+ "ids": idStr,
|
|
|
// "sexType": 3
|
|
|
}
|
|
|
api.detailsTagList(param).then((res) => { //右侧展开内容
|
|
|
if (res.data.code === '0') {
|
|
|
- const currentDetail = res.data.data[id];
|
|
|
- this.currentDetail = currentDetail;
|
|
|
- let num = 0;
|
|
|
if(this.choose == 'single'){ //判断是单选
|
|
|
+ let num = 0,tmpArr = [];
|
|
|
+ tmpArr.push(res.data.data[idStr]);
|
|
|
this.selectArr.map((flg,idx)=>{ //判断右侧有没有选中
|
|
|
if(flg){ //有选中
|
|
|
- let tmp = [],ids = [];
|
|
|
- tmp.push(currentDetail);
|
|
|
- this.poolDetailList[idx] = tmp;
|
|
|
+ let ids = [];
|
|
|
+ this.poolDetailList[idx] = tmpArr;
|
|
|
this.poolDetailListAll = Array.prototype.concat.apply([],this.poolDetailList); //二维转一维
|
|
|
this.searchTagList();
|
|
|
}else{ //没选中,按順序第二个开始添加
|
|
|
++num;
|
|
|
if(num == 6){
|
|
|
for(let i = 1;i < this.poolDetailList.length;i++){
|
|
|
- let tmp = [],ids = [];
|
|
|
+ let ids = [];
|
|
|
+ if(this.poolDetailList[i].length == 0){ //判断part里面是不是有数据,没有直接添加
|
|
|
+ this.poolDetailList[i] = tmpArr;
|
|
|
+ this.poolDetailListAll = Array.prototype.concat.apply([],this.poolDetailList);
|
|
|
+ this.searchTagList();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.currentLis = []; //左侧选中数据清空
|
|
|
+ })
|
|
|
+ }else{ //判断是多选
|
|
|
+ let num = 0,tmpArr = [];
|
|
|
+ this.currentLis.map((id)=>{
|
|
|
+ tmpArr.push(res.data.data[id]);
|
|
|
+ })
|
|
|
+ this.selectArr.map((flg,idx)=>{ //判断右侧有没有选中
|
|
|
+ if(flg){ //有选中
|
|
|
+ this.poolDetailList[idx] = tmpArr;
|
|
|
+ this.poolDetailListAll = Array.prototype.concat.apply([],this.poolDetailList); //二维转一维
|
|
|
+ this.searchTagList();
|
|
|
+ }else{
|
|
|
+ ++num;
|
|
|
+ if(num == 6){
|
|
|
+ for(let i = 1;i < this.poolDetailList.length;i++){
|
|
|
+ let ids = [];
|
|
|
if(this.poolDetailList[i].length == 0){ //判断part里面是不是有数据,没有直接添加
|
|
|
- tmp.push(currentDetail);
|
|
|
- this.poolDetailList[i] = tmp;
|
|
|
+ this.poolDetailList[i] = tmpArr;
|
|
|
this.poolDetailListAll = Array.prototype.concat.apply([],this.poolDetailList);
|
|
|
this.searchTagList();
|
|
|
return;
|
|
@@ -260,11 +386,12 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ this.currentLis = []
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
- },
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
@@ -375,6 +502,7 @@ export default {
|
|
|
width: 20%;
|
|
|
height: @icssHeight;
|
|
|
overflow: auto;
|
|
|
+ cursor: pointer;
|
|
|
.partDetail {
|
|
|
padding: 3px 5px;
|
|
|
}
|