ElementUIchange事件使用,进行数据不可以同时选中校验和不可以重复的判断

    <!--  //给行添加鼠标点击事件 -->
          <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;
    }
  }

},

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

有时间指导毕业设计

觉得写的好的话可以给我打赏

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值