|
@@ -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>
|
|
@@ -62,20 +78,40 @@
|
|
|
<div class="partWaring">
|
|
|
<ul>
|
|
|
<li v-for="i in 5" :key="i">
|
|
|
- <template v-for="item in poolDetailList[i]">
|
|
|
- <p class="partDetail" v-show="item.controlType != 1" :key="item.id + '1'">
|
|
|
- {{1}}
|
|
|
- </p>
|
|
|
- <p class="partDetail" v-show="item.controlType != 2" :key="item.id + '2'">
|
|
|
- {{2}}
|
|
|
- </p>
|
|
|
- </template>
|
|
|
+ <p v-for="item in poolDetailListTips[i]" class="partDetail tipsWrap" v-show="1||2||3||4||5||6||7||8||9" :key="item">
|
|
|
+ <span class="tips" v-if="item == 1">1111</span>
|
|
|
+ <span class="tips" v-if="item == 2">2222</span>
|
|
|
+ <span class="tips" v-if="item == 3">3333</span>
|
|
|
+ <span class="tips" v-if="item == 4">4444</span>
|
|
|
+ <span class="tips" v-if="item == 5">5555</span>
|
|
|
+ <span class="tips" v-if="item == 6">6666</span>
|
|
|
+ <span class="tips" v-if="item == 7">7777</span>
|
|
|
+ <span class="tips" v-if="item == 8">8888</span>
|
|
|
+ <span class="tips" v-if="item == 9">9999</span>
|
|
|
+ <span class="tips" v-if="item == 10">1010</span>
|
|
|
+ </p>
|
|
|
</li>
|
|
|
-
|
|
|
</ul>
|
|
|
</div>
|
|
|
</div>
|
|
|
<span class="mutex">互斥项</span>
|
|
|
+ <!-- <el-form-item
|
|
|
+ label="选择标签成文顺序:"
|
|
|
+ prop="order"
|
|
|
+ >
|
|
|
+ <el-select
|
|
|
+ v-model="form.order"
|
|
|
+ placeholder="选择标签成文顺序"
|
|
|
+ @change="changeType"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in labelTypes"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.val"
|
|
|
+ :key="item.id"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item> -->
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
@@ -97,28 +133,29 @@ export default {
|
|
|
type: String
|
|
|
},
|
|
|
choose: {
|
|
|
- default: 'single', //multiple多选
|
|
|
+ default: 'single', //multiple 多选 single 单选
|
|
|
type: String
|
|
|
},
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- currentDetail: {}, //当前点击的标签对应的展开数据
|
|
|
- poolDetailList: [ //默认6个部分
|
|
|
- [], [], [], [], [], []
|
|
|
- ],
|
|
|
+ poolDetailList: [[],[],[],[],[],[]], //默认6个部分
|
|
|
+ poolDetailListTips: [[],[],[],[],[],[]], //6个部分对应的提示
|
|
|
poolDetailListAll:[], //默认6个部分转化为一维数组
|
|
|
- activePart: '-1', //选中part第几个
|
|
|
+ activePart: '-1', //选中part第几个
|
|
|
+ activePartSon:'-1', //选中第几个part中的元素了
|
|
|
selectArr: [false, false, false, false, false, false], //右侧选中part状态
|
|
|
- select: '', //右侧选中的项
|
|
|
+ form:{
|
|
|
+ order:'', //标签成文顺序
|
|
|
+ },
|
|
|
|
|
|
- styles:{
|
|
|
- background:'#eae7e7'
|
|
|
- }, //选中单条样式
|
|
|
+ styles:{background:'#eae7e7'}, //选中单条样式
|
|
|
+ styleR:{color:'red !important'},
|
|
|
searchVal: '', //搜索值
|
|
|
currentPool: [], //标签池数据
|
|
|
currentLis:[], //选中单条ID组合(多选)
|
|
|
notIds:[], //去重IDs
|
|
|
+ multipleItem:[], //右侧选中的单条标签
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
@@ -127,30 +164,119 @@ export default {
|
|
|
this.currentPool = newVal
|
|
|
}
|
|
|
},
|
|
|
+ sign(newVal, preVal) {
|
|
|
+ if (JSON.stringify(newVal) != JSON.stringify(preVal)) {
|
|
|
+ this.poolDetailList = [[],[],[],[],[],[]]
|
|
|
+ this.poolDetailListTips = [[],[],[],[],[],[]]
|
|
|
+ this.poolDetailListAll=[]
|
|
|
+ this.activePart='-1'
|
|
|
+ this.activePartSon='-1'
|
|
|
+ this.selectArr = [false, false, false, false, false, false]
|
|
|
+ this.searchVal= ''
|
|
|
+ this.currentPool= []
|
|
|
+ this.currentLis=[]
|
|
|
+ this.notIds=[]
|
|
|
+ this.multipleItem=[]
|
|
|
+ }
|
|
|
+ },
|
|
|
searchVal(newVal, preVal){
|
|
|
if(newVal.trim() == ''){
|
|
|
- this.searchTagList()
|
|
|
+ this.searchTagList();
|
|
|
}else if(newVal.trim() != preVal.trim()){
|
|
|
- this.searchTagList()
|
|
|
+ this.searchTagList();
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ selectTagOne(e,id,n){
|
|
|
+ e.stopPropagation()
|
|
|
+ this.activePartSon = n
|
|
|
+ this.activePart = -1
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+ this.getPoolDetailListTips();
|
|
|
+ },
|
|
|
toRightPool(){
|
|
|
-
|
|
|
+ if(this.currentLis.length == 0){
|
|
|
+ this.$message({
|
|
|
+ showClose: true,
|
|
|
+ message: '请选择标签池标签',
|
|
|
+ type: 'warning'
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(this.choose == 'multiple'){
|
|
|
+ this.getRightListDes();
|
|
|
+ }
|
|
|
},
|
|
|
- toLeftPool(){
|
|
|
-
|
|
|
+ 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 = [];
|
|
|
+ this.getPoolDetailListTips();
|
|
|
+ }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 = [];
|
|
|
+ this.getPoolDetailListTips();
|
|
|
+ }else{
|
|
|
+ let tmparr = [],tmpArr = this.poolDetailList[this.activePartSon],tmpArrR = [];
|
|
|
+ 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 = [];
|
|
|
+ this.getPoolDetailListTips();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getPoolDetailListTips(){
|
|
|
+ let list = this.poolDetailList;
|
|
|
+ let poolDetailListTips = [[],[],[],[],[],[]];
|
|
|
+ for(let i = 0;i < list.length;i++){
|
|
|
+ let tmpLis = list[i];
|
|
|
+ if(tmpLis.length > 0){
|
|
|
+ for(let j = 0;j < tmpLis.length;j++){
|
|
|
+ let tmpLi = list[i][j];
|
|
|
+ if(!utils.filterArr(poolDetailListTips[i],tmpLi.controlType,2)){
|
|
|
+ poolDetailListTips[i].push(tmpLi.controlType)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.poolDetailListTips = poolDetailListTips
|
|
|
},
|
|
|
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 +291,7 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
selectPart(idx) {
|
|
|
+ this.multipleItem = []
|
|
|
let tmpFst1 = this.selectArr[0],
|
|
|
tmpFst2 = this.selectArr[1],
|
|
|
tmpFst3 = this.selectArr[2],
|
|
@@ -217,54 +344,85 @@ 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();
|
|
|
+ this.getPoolDetailListTips();
|
|
|
}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里面是不是有数据,没有直接添加
|
|
|
- tmp.push(currentDetail);
|
|
|
- this.poolDetailList[i] = tmp;
|
|
|
+ this.poolDetailList[i] = tmpArr;
|
|
|
this.poolDetailListAll = Array.prototype.concat.apply([],this.poolDetailList);
|
|
|
this.searchTagList();
|
|
|
+ this.getPoolDetailListTips();
|
|
|
+ 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();
|
|
|
+ this.getPoolDetailListTips();
|
|
|
+ }else{
|
|
|
+ ++num;
|
|
|
+ if(num == 6){
|
|
|
+ for(let i = 1;i < this.poolDetailList.length;i++){
|
|
|
+ let ids = [];
|
|
|
+ if(this.poolDetailList[i].length == 0){ //判断part里面是不是有数据,没有直接添加
|
|
|
+ this.poolDetailList[i] = tmpArr;
|
|
|
+ this.poolDetailListAll = Array.prototype.concat.apply([],this.poolDetailList);
|
|
|
+ this.searchTagList();
|
|
|
+ this.getPoolDetailListTips();
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ this.currentLis = []
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
- },
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
@@ -278,6 +436,16 @@ export default {
|
|
|
.desTitle {
|
|
|
padding-bottom: 10px;
|
|
|
}
|
|
|
+ .tipsWrap {
|
|
|
+ display: inline-block;
|
|
|
+ text-align: center;
|
|
|
+ border: 1px solid @icssBorder;
|
|
|
+ padding: 2px 3px;
|
|
|
+ border-radius: 5px;
|
|
|
+ margin: 0 3px 3px 0;
|
|
|
+ .tips {
|
|
|
+ }
|
|
|
+ }
|
|
|
.pubList {
|
|
|
height: @icssHeight;
|
|
|
overflow: auto;
|
|
@@ -287,6 +455,9 @@ export default {
|
|
|
line-height: 30px;
|
|
|
padding: 0 8px;
|
|
|
}
|
|
|
+ .pubLiStyleWrap {
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
.pubLiStyleWrap:hover {
|
|
|
background-color: #f5f5f5;
|
|
|
}
|
|
@@ -331,12 +502,13 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
.bottomPartMid {
|
|
|
- width: 10%;
|
|
|
+ width: 8%;
|
|
|
margin-top: 60px;
|
|
|
p {
|
|
|
width: 100%;
|
|
|
text-align: center;
|
|
|
span {
|
|
|
+ cursor: pointer;
|
|
|
display: inline-block;
|
|
|
width: 30px;
|
|
|
height: 40px;
|
|
@@ -349,7 +521,7 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
.bottomPartRight {
|
|
|
- width: 60%;
|
|
|
+ width: 62%;
|
|
|
.partWaring {
|
|
|
li {
|
|
|
float: left;
|
|
@@ -363,6 +535,7 @@ export default {
|
|
|
}
|
|
|
.onlyTop {
|
|
|
border-bottom: 1px solid @icssBorder;
|
|
|
+ cursor: pointer;
|
|
|
.hzx{
|
|
|
padding: 0 30px 0 0;
|
|
|
}
|
|
@@ -375,6 +548,7 @@ export default {
|
|
|
width: 20%;
|
|
|
height: @icssHeight;
|
|
|
overflow: auto;
|
|
|
+ cursor: pointer;
|
|
|
.partDetail {
|
|
|
padding: 3px 5px;
|
|
|
}
|