后台管理系统表单校验

      <el-form  :model="ThreeParams" ref="threeAddFun" :rules="rules3" class="demo-form-inline">
        <el-form-item label="功能名称" prop="functionName" class="funcName">
          <el-input v-model="ThreeParams.functionName" placeholder="请输入"></el-input>
        </el-form-item>
        <el-form-item label="所属应用id" prop="ownerApplicationId">
          <el-select v-model="ThreeParams.ownerApplicationId" placeholder="Select" @change="appChange">
            <el-option v-for="item in appOption" :label="item.name" :key="item.guid" :value="item.guid"></el-option>
          </el-select>
        </el-form-item>
      rules3: {
        functionName: [
          { required: true, message: "功能名称不能为空", trigger: "blur" },
        ],
        ownerApplicationId: [
          { required: true, message: "所属应用id不能为空", trigger: "blur" },
        ],
        ownerFunctionId: [
          { required: true, message: "所属功能id不能为空", trigger: "blur" },
        ],
        configHardware: [
          { required: true, message: "是否配备硬件不能为空", trigger: "blur" },
        ],
        functionDesc: [
          { required: true, message: "功能介绍不能为空", trigger: "blur" },
        ],
      },
    // 添加配置功能确定按钮
    addSureFun() {
      this.$refs["threeAddFun"].validate((valid) => {
        if (valid) {
          this.ThreeParams.productId = this.guid;
          let params = {
            functionName: this.ThreeParams.functionName,
            productId: this.guid,
            ownerApplicationId: this.ThreeParams.ownerApplicationId,
            ownerFunctionId: this.ThreeParams.ownerFunctionId,
            defaultOptional: parseInt(this.ThreeParams.defaultOptional),
            businessStatement: '说明',
            functionDesc: this.ThreeParams.functionDesc,
            configHardware: parseInt(this.ThreeParams.configHardware),
            configVirtualSpace: 1,
            configRedPacket: 1,
          }
          if (this.threeFunName == '新增功能') {
            addFunc(params).then(res => {
              if (res.code == 200) {
                this.funParams.productId = this.guid;
                funList(this.funParams).then((res) => {
                  this.functionData = res.rows
                  this.msgSuccess("新增成功");
                  this.addThreeFun = false
                });
              }
            })
          } else {
            params.guid = this.FuncGuid
            updateFunc(params).then(res => {
              if (res.code == 200) {
                this.funParams.productId = this.guid;
                funList(this.funParams).then((res) => {
                  this.functionData = res.rows
                  this.msgSuccess("编辑成功");
                  this.addThreeFun = false
                });
              }
            })
          }
        } else {
        }
      });
    },
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值