xuezizhuo 2 years ago
parent
commit
e43e14ed6e

+ 13 - 8
ruoyi-ui/src/views/tool/datasheet/index.vue

@@ -108,11 +108,11 @@ export default {
             experienceData: [{
                 fieldName: '',
                 fieldType: '',
-                fieldLength: 10,
+                fieldLength: undefined,
                 isNull: false,
                 isPrimary: false,
                 fieldDescription: '',
-                isAuto:false
+                isAuto: false
             },],
             dataBase: {}
 
@@ -127,11 +127,11 @@ export default {
             let obj = {
                 fieldName: '',
                 fieldType: '',
-                fieldLength: 10,
+                fieldLength: undefined,
                 isNull: false,
                 isPrimary: false,
                 fieldDescription: '',
-                isAuto:false
+                isAuto: false
             };
 
             this.experienceData.push(obj);
@@ -147,8 +147,10 @@ export default {
             this.experienceData.splice(index, 1)
         },
         add() {
-            this.experienceData.forEach((field)=>{
-                field.fieldType = `${field.fieldType}(${field.fieldLength})`
+            this.experienceData.forEach((field) => {
+                if (field.fieldLength) {
+                    field.fieldType = `${field.fieldType}(${field.fieldLength})`
+                }
             })
 
             let query = {
@@ -157,6 +159,7 @@ export default {
                 field: this.experienceData
             }
             createDatabase(query).then(res => {
+
                 this.$modal.msgSuccess(res.msg);
                 if (res.code === 200) {
                     this.visible = false;
@@ -165,13 +168,15 @@ export default {
                     this.experienceData = [{
                         fieldName: '',
                         fieldType: '',
-                        fieldLength: 10,
+                        fieldLength: undefined,
                         isNull: false,
                         isPrimary: false,
                         fieldDescription: '',
-                        isAuto:false
+                        isAuto: false
                     }]
                 }
+            }).catch(err=>{
+                console.log(err);
             })
 
         }

+ 5 - 3
ruoyi-ui/src/views/tool/datasheet/sqlServer.vue

@@ -108,7 +108,7 @@ export default {
             experienceData: [{
                 fieldName: '',
                 fieldType: '',
-                fieldLength: 10,
+                fieldLength: undefined,
                 isNull: false,
                 isPrimary: false,
                 fieldDescription: '',
@@ -127,7 +127,7 @@ export default {
             let obj = {
                 fieldName: '',
                 fieldType: '',
-                fieldLength: 10,
+                fieldLength: undefined,
                 isNull: false,
                 isPrimary: false,
                 fieldDescription: '',
@@ -161,13 +161,15 @@ export default {
                     this.experienceData = [{
                         fieldName: '',
                         fieldType: '',
-                        fieldLength: 10,
+                        fieldLength: undefined,
                         isNull: false,
                         isPrimary: false,
                         fieldDescription: '',
                         isAuto:false
                     }]
                 }
+            }).catch(err=>{
+                console.log(err);
             })
         }