|
@@ -1,14 +1,17 @@
|
|
|
<template>
|
|
|
- <div class="check-wrap" v-if="item" :style="{'display':slide?'block':'none'}">
|
|
|
- <!-- <p v-for="(it,index) in datas.questionDetailList" :key="it.id" class="list" @click="handleClick(it,index,'',true)"> -->
|
|
|
- <p v-for="(it,index) in datas.questionDetailList" :key="it.id" :class="['list',{'block':((it.description||it.name).indexOf('${'))!=-1}]" @click="handleClick(it,index,'',true)">
|
|
|
- <!-- <img :src="it.select==1?check:defaultPic"> -->
|
|
|
- <span v-if="((it.description||it.name).indexOf('${'))==-1" :class="['radioCheck',{'check':it.select==1},{'exclu':exclusion !==999 && it.exclusion !== exclusion}]">{{it.description||it.name}}</span>
|
|
|
+ <div class="check-wrap" v-if="item" :style="getStyle(detail,slide)">
|
|
|
+ <p v-for="(it,index) in datas.questionDetailList"
|
|
|
+ :key="it.id"
|
|
|
+ :class="['list',{'block':((it.description||it.name).indexOf('${'))!=-1}]" >
|
|
|
+ <span v-if="((it.description||it.name).indexOf('${'))==-1"
|
|
|
+ :class="['radioCheck',{'check':it.select==1},{'exclu':exclusion !==999 && it.exclusion !== exclusion}]"
|
|
|
+ @click="handleClick(it,index,'',true,false)"
|
|
|
+ >{{it.description||it.name}}</span>
|
|
|
<OptionInp v-else
|
|
|
:item="it"
|
|
|
ref="inp"
|
|
|
@handleInp="inpVal($event,index)"
|
|
|
- @handleSelec="handleClick(it,index,true,1)"
|
|
|
+ @handleSelec="handleClick(it,index,true,false,true)"
|
|
|
:exclu="exclusion !==999 && it.exclusion !== exclusion"
|
|
|
/>
|
|
|
</p>
|
|
@@ -29,6 +32,10 @@ import OptionInp from '../common/OptionInp.vue';
|
|
|
slide:{
|
|
|
default:false,
|
|
|
type:Boolean
|
|
|
+ },
|
|
|
+ detail:{
|
|
|
+ default:2,
|
|
|
+ type:Number||String
|
|
|
}
|
|
|
},
|
|
|
data(){
|
|
@@ -46,7 +53,18 @@ import OptionInp from '../common/OptionInp.vue';
|
|
|
this.resetExc();
|
|
|
},
|
|
|
methods:{
|
|
|
- handleClick(it,index,flag,flg){
|
|
|
+ getStyle(detail,slide){
|
|
|
+ if(detail == 1){
|
|
|
+ if(slide){
|
|
|
+ return {'display':'block','background-color': '#F9F9F9'}
|
|
|
+ }else{
|
|
|
+ return {'display':'none'}
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ return {'display':'block'}
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleClick(it,index,flag,flg,sign){
|
|
|
if(flg){
|
|
|
document.activeElement.blur();
|
|
|
document.activeElement.scrollIntoViewIfNeeded(true);
|
|
@@ -70,17 +88,40 @@ import OptionInp from '../common/OptionInp.vue';
|
|
|
this.exclusion = it.exclusion;
|
|
|
}
|
|
|
// 处理选中状态
|
|
|
- if(flag){//输入框反选
|
|
|
- data[index].select = 1;
|
|
|
- this.exclusion = it.exclusion;
|
|
|
+ if(sign){
|
|
|
+ for(let i=0;i<data.length; i++){
|
|
|
+ if(i==index){
|
|
|
+ if(data[i].value){
|
|
|
+ data[index].select = 1;
|
|
|
+ this.exclusion = it.exclusion;
|
|
|
+ }else{
|
|
|
+ data[i].select = 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}else{
|
|
|
- if(data[index].select){
|
|
|
- data[index].select = 0;
|
|
|
- }else{
|
|
|
- data[index].select = 1;
|
|
|
- this.exclusion = it.exclusion;
|
|
|
+ for(let i=0;i<data.length; i++){
|
|
|
+ if(i==index){
|
|
|
+ if(data[i].select == 1){
|
|
|
+ data[i].select = 0
|
|
|
+ }else{
|
|
|
+ data[index].select = 1;
|
|
|
+ this.exclusion = it.exclusion;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ // if(flag){//输入框反选
|
|
|
+ // data[index].select = 1;
|
|
|
+ // this.exclusion = it.exclusion;
|
|
|
+ // }else{
|
|
|
+ // if(data[index].select){
|
|
|
+ // data[index].select = 0;
|
|
|
+ // }else{
|
|
|
+ // data[index].select = 1;
|
|
|
+ // this.exclusion = it.exclusion;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
|
|
|
// 处理取消-互斥
|
|
|
const filArr1 = data.filter(it=>it.select==1);
|
|
@@ -144,8 +185,8 @@ import OptionInp from '../common/OptionInp.vue';
|
|
|
}
|
|
|
.list{
|
|
|
color: #colors[text];
|
|
|
- margin:0 .1rem .1rem 0;
|
|
|
- padding: .12rem .1rem .12rem 0;
|
|
|
+ margin:0 .1rem .05rem 0;
|
|
|
+ padding: .06rem .1rem .06rem 0;
|
|
|
display: inline-block;
|
|
|
white-space: nowrap;
|
|
|
overflow-x: hidden;
|
|
@@ -160,9 +201,9 @@ import OptionInp from '../common/OptionInp.vue';
|
|
|
}
|
|
|
.radioCheck {
|
|
|
display: inline-block;
|
|
|
- line-height: .52rem;
|
|
|
- min-width: 2rem;
|
|
|
- text-align: center;
|
|
|
+ line-height: .35rem;
|
|
|
+ // min-width: 2rem;
|
|
|
+ // text-align: center;
|
|
|
padding:.1rem .1rem;
|
|
|
box-sizing: border-box;
|
|
|
border-radius: .38rem;
|
|
@@ -176,5 +217,9 @@ import OptionInp from '../common/OptionInp.vue';
|
|
|
.exclu{
|
|
|
color:#colors[exclu];
|
|
|
}
|
|
|
+
|
|
|
+ .iptCheck {
|
|
|
+ color: #colors[theme];
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|