|
@@ -3,18 +3,19 @@
|
|
|
<el-form :model="form">
|
|
|
<div class="operation-row">
|
|
|
<el-checkbox-group size="small" v-model="form.defaultCheckeds" @change="emitValues">
|
|
|
- <el-checkbox-button v-for="(it,i) in rows" v-if="focusOn==i||(focusOn==-1&&i==0)" :label="i">默认选中</el-checkbox-button>
|
|
|
+ <el-checkbox-button v-for="(it,i) in rows" v-if="focusOn==i||(focusOn==-1&&i==0)" :key="i" :label="i" :disabled="(form.defaultCheckeds[0]!=undefined&&form.defaultCheckeds[0]!=i)||form.sameToNones[0]==i||form.sameToBans[0]==i">默认选中</el-checkbox-button>
|
|
|
</el-checkbox-group>
|
|
|
<el-checkbox-group size="small" v-model="form.sameToNones" @change="emitValues">
|
|
|
- <el-checkbox-button v-for="(it,i) in rows" v-if="focusOn==i||(focusOn==-1&&i==0)" :label="i">同“无”类型</el-checkbox-button>
|
|
|
+ <el-checkbox-button v-for="(it,i) in rows" v-if="focusOn==i||(focusOn==-1&&i==0)" :key="i" :label="i" :disabled="(form.sameToNones[0]!=undefined&&form.sameToNones[0]!=i)||form.defaultCheckeds[0]==i||form.sameToBans[0]==i">同“无”类型</el-checkbox-button>
|
|
|
</el-checkbox-group>
|
|
|
<el-checkbox-group size="small" v-model="form.sameToBans" @change="emitValues">
|
|
|
- <el-checkbox-button v-for="(it,i) in rows" v-if="focusOn==i||(focusOn==-1&&i==0)" :label="i">同“伴”类型</el-checkbox-button>
|
|
|
+ <el-checkbox-button v-for="(it,i) in rows" v-if="focusOn==i||(focusOn==-1&&i==0)" :key="i" :label="i" :disabled="(form.sameToBans[0]!=undefined&&form.sameToBans[0]!=i)||form.sameToNones[0]==i||form.defaultCheckeds[0]==i">同“伴”类型</el-checkbox-button>
|
|
|
</el-checkbox-group>
|
|
|
<el-button type="danger" size="small" class="del" @click="delRow">删除</el-button>
|
|
|
</div>
|
|
|
<div class="main-area">
|
|
|
<el-input v-for="(it,i) in rows"
|
|
|
+ :key="i"
|
|
|
v-model="form.options[i]"
|
|
|
v-bind:class="{select:focusOn==i}"
|
|
|
@focus="selectRow(i)"
|
|
@@ -29,6 +30,11 @@
|
|
|
.el-checkbox-button--small .el-checkbox-button__inner{
|
|
|
font-size: 14px;
|
|
|
}
|
|
|
+ .el-checkbox-button.is-disabled:first-child .el-checkbox-button__inner{
|
|
|
+ border-color: @disableColor;
|
|
|
+ border-left-color: @disableColor;
|
|
|
+ color: @disableColor;
|
|
|
+ }
|
|
|
.el-checkbox-button:last-child .el-checkbox-button__inner{
|
|
|
border-radius: 3px;
|
|
|
border-color: @adminBase;
|
|
@@ -72,6 +78,7 @@
|
|
|
props:['type'],
|
|
|
data(){
|
|
|
return {
|
|
|
+ argus:['defaultCheckeds','sameToNones','sameToBans'],
|
|
|
form:{
|
|
|
options:[],
|
|
|
defaultCheckeds:[],
|
|
@@ -82,42 +89,25 @@
|
|
|
focusOn:-1
|
|
|
}
|
|
|
},
|
|
|
- /*watch:{
|
|
|
- defaultChecked:function(next){
|
|
|
- if(this.focusOn==-1){
|
|
|
- this.defaultChecked = false;
|
|
|
- this.$message({
|
|
|
- message: '请先选择要操作的行',
|
|
|
- type: 'warning'
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- this.form.defaultChecked=next?this.focusOn:-1;console.log(this.form)
|
|
|
- this.emitValues();
|
|
|
- },
|
|
|
- sameToNone:function(next){
|
|
|
- if(this.focusOn==-1){
|
|
|
- this.sameToNone = false;
|
|
|
- this.$message({
|
|
|
- message: '请先选择要操作的行',
|
|
|
- type: 'warning'
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- this.form.sameToNone=next?this.focusOn:-1;
|
|
|
- this.emitValues();
|
|
|
- },
|
|
|
- sameToBan:function(next){
|
|
|
- if(this.focusOn==-1){
|
|
|
- this.sameToBan = false;
|
|
|
- this.$message({
|
|
|
- message: '请先选择要操作的行',
|
|
|
- type: 'warning'
|
|
|
- });
|
|
|
- return;
|
|
|
+ /*computed:{
|
|
|
+ isDisable:function(){ //属性按钮是否可用
|
|
|
+ return function(type,i){
|
|
|
+ if(this.form[type][0]!=undefined&&this.form[type][0]!=i){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ if(this.form[type][0] == i){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ for(let x=0;x<this.argus.length;x++){
|
|
|
+ if([...this.form.defaultCheckeds,...this.form.sameToNones,...this.form.sameToBans].length==0||this.form[this.argus[x]][0]==i){
|
|
|
+ return false;
|
|
|
+ }else{
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
}
|
|
|
- this.form.sameToBan=next?this.focusOn:-1;
|
|
|
- this.emitValues();
|
|
|
}
|
|
|
},*/
|
|
|
methods:{
|
|
@@ -141,9 +131,8 @@
|
|
|
|
|
|
},
|
|
|
emitValues(){
|
|
|
- //console.log(this.form)
|
|
|
- const items = utils.simpleOptionData(this.form);
|
|
|
- //this.$emit('pushValues',items);
|
|
|
+ const items = utils.simpleOptionData(this.form);console.log(111,items)
|
|
|
+ this.$emit('pushValues',items);
|
|
|
},
|
|
|
delRow(){
|
|
|
if(this.focusOn==-1){
|