vue reren-fast 新增无问题,修改的时候通用代码块传了一个参数null,找不到是哪个

表单提交的时候,'id': this.dataForm.id || undefined  如果注释掉,则会传到后台null
// 表单提交
dataFormSubmit () {
  this.$refs['dataForm'].validate((valid) => {
    if (valid) {
      this.$http({
        url: this.$http.adornUrl(`/sms/provinceinoutconfig/${!this.dataForm.id ? 'save' : 'update'}`),
        method: 'post',
        data: this.$http.adornData({
          'id': this.dataForm.id || undefined, 注释掉,新增无问题,修改传到后台null,通用修改函数无法使用。
          'gwkind': this.dataForm.gwkind,
          'province': this.dataForm.province,
          'params': this.dataForm.params
          // 'createTime': this.dataForm.createTime,
          // 'updateTime': this.dataForm.updateTime
        })
      }).then(({data}) => {
        if (data && data.code === 0) {
          this.$message({
            message: '操作成功',
            type: 'success',
            duration: 1500,
            onClose: () => {
              this.visible = false
              this.$emit('refreshDataList')
            }
          })
        } else {
          this.$message.error(data.msg)
        }
      })
    }
  })
}
发布了39 篇原创文章 · 获赞 10 · 访问量 10万+

猜你喜欢

转载自blog.csdn.net/shenlf_bk/article/details/104515625