<el-table-column
prop="rulcon" label="规则条件" width="300">
<template slot-scope="scope">
<el-select clearable
v-model="dataList2[scope.$index].rulcon"
@change="changeByCustom"
style="width: 140px;"
>
<el-option label="重叠5%" value="1"></el-option>
<el-option label="不重叠" value="2"></el-option>
<el-option label="自定义比例" value="3" ></el-option>
</el-select>
<el-input
style="width: 160px;" v-if="linkvalue==3.0000 || dataList2[scope.$index].rulcon ==3.0000" v-model="dataList2[scope.$index].ruldata">
<template
slot="append"
>%</template
>
</el-input>
</template>
</el-table-column>
<el-table-column
prop="isvalide"
label="是否有效"
show-overflow-tooltip
width="200"
>
<template slot-scope="scope">
<el-switch
v-model="dataList2[scope.$index].isvalide"
active-text="有效"
inactive-text="无效"
active-color="#13ce66"
inactive-color="#ff4949"
on-value="1"
off-value="0"
@change="change(scope.$index)"
active-value="1"
inactive-value="0"
>
</el-switch>
</template>
</el-table-column>
方法:进行互斥规则的校验
// 规则互斥条件判断
change(val){
if(this.dataList[1].isvalide==1 && this.dataList[0].isvalide==1){
this.dataList[val].isvalide=0;
this.$message({
message: "规则互斥,不可以同时设置为有效",
type: "warning",
showClose: true,
});
return;
}
if(this.dataList[2].isvalide==1 && this.dataList[3].isvalide==1){
this.dataList[val].isvalide=0;
this.$message({
message: "规则互斥,不可以同时设置为有效",
type: "warning",
showClose: true,
});
return;
}
if(this.dataList1[1].isvalide==1 && this.dataList1[0].isvalide==1){
this.dataList1[val].isvalide=0;
this.$message({
message: "规则互斥,不可以同时设置为有效",
type: "warning",
showClose: true,
});
return;
}
if(this.dataList1[2].isvalide==1 && this.dataList1[3].isvalide==1){
this.dataList1[val].isvalide=0;
this.$message({
message: "规则互斥,不可以同时设置为有效",
type: "warning",
showClose: true,
});
return;
}
console.log(val,"val---------");
},
juge方法:
juge(newList){
let nary= newList.sort();
console.log(nary,"nary--------------")
j=1;
for(let i = 0;i<nary.length;i++){
if(nary[i]==nary[i+1]){
this.$message({
message: "互斥外包商id输入重复,或者你的本行的外包商id输入重复",
type: "error",
showClose: true,
duration:7000
});
j = 0;
}
}
},
|