美文网首页
判断2个for循环,需要符合条件提示,否则不提示

判断2个for循环,需要符合条件提示,否则不提示

作者: 流泪手心_521 | 来源:发表于2021-07-14 10:30 被阅读0次
image.png
    //添加
    add() {
      //添加一个字段operationType 1 add  2 edit
      this.ruleForm = Object.assign(this.ruleForm, {
        operationType: 1, // 1 add  2 edit
      });
        let arrCode=["K1001","K1003","K1005","K1008","K1010","L1003","L1005","L1008","L1007","D1002","-1","courier9002","so9002","K1002","K1007","L1002","D1002"]
        if (this.ruleForm.auths.length > 0) {
//注意,这里不能写map和some,否则return不出来,因为return只是结束本次循环而已
            for( let i=0 ; i<this.ruleForm.auths.length; i++ ) {
                for (let k = 0; k < arrCode.length; k++) {
                    if (this.ruleForm.auths[i].authCode.indexOf(arrCode[k]) != -1 || this.ruleForm.auths[i].hasCourierOrOperator == true) {
                        return this.$confirm(
                            "您本次发布的公告包含快递员、操作工群体,请确认是否继续发布?",
                            "提示",
                            {
                                confirmButtonText: "确定",
                                cancelButtonText: "取消",
                                closeOnClickModal: false,
                                type: "warning",
                            }
                        ).then(() => {
                            this.addSubmit(this.ruleForm);//调新增接口
                        });
                    }
                }
            }
        }else{
            //默认不选时,应该是全部,需要有提示
            return this.$confirm(
                "您本次发布的公告包含快递员、操作工群体,请确认是否继续发布?",
                "提示",
                {
                    confirmButtonText: "确定",
                    cancelButtonText: "取消",
                    closeOnClickModal: false,
                    type: "warning",
                }
            ).then(() => {
                this.addSubmit(this.ruleForm);//调新增接口
            });
        }
        this.addSubmit(this.ruleForm);//调新增接口
    },

相关文章

网友评论

      本文标题:判断2个for循环,需要符合条件提示,否则不提示

      本文链接:https://www.haomeiwen.com/subject/shfypltx.html