Ver Fonte

表单传值修改

zhaoke há 1 ano atrás
pai
commit
b5a53aabe9

+ 11 - 0
src/components/publicPageForm/index.vue

@@ -371,6 +371,16 @@ export default {
         })
       }
     },
+    formatDataNull () {
+      for (const key in this.tableForm) {
+        if (Object.hasOwnProperty.call(this.tableForm, key)) {
+          const element = this.tableForm[key]
+          if (!element) {
+            this.tableForm[key] = null
+          }
+        }
+      }
+    },
     // 新增/编辑-确认
     submitClickHandler () {
       let flag = false
@@ -380,6 +390,7 @@ export default {
       if (nload?.length) this.addTypeUpload(nload)
       if (ndata?.length) this.addTypePassWord(ndata)
       if (npass) { this.formatPass(npass) }
+      this.formatDataNull()
       this.$refs["ruleForm"].validate((valid) => {
         if (valid) {
           flag = true

+ 11 - 0
src/views/dataAccessPage/components/accessPageForm.vue

@@ -202,9 +202,20 @@ export default {
     restForm () {
       this.$refs['ruleForm'].resetFields()
     },
+    formatDataNull () {
+      for (const key in this.tableForm) {
+        if (Object.hasOwnProperty.call(this.tableForm, key)) {
+          const element = this.tableForm[key]
+          if (!element) {
+            this.tableForm[key] = null
+          }
+        }
+      }
+    },
     // 新增/编辑-确认
     submitClickHandler () {
       let flag = false
+      this.formatDataNull()
       this.$refs["ruleForm"].validate((valid) => {
         if (valid) {
           flag = true