panhui 6 éve
szülő
commit
9ba9bb4031
1 módosított fájl, 13 hozzáadás és 10 törlés
  1. 13 10
      src/main/vue/src/components/VuforiaImageInfo.vue

+ 13 - 10
src/main/vue/src/components/VuforiaImageInfo.vue

@@ -269,22 +269,25 @@ export default {
     },
     submit() {
       var data = {};
-      if(this.formData.id){
-        data.id=this.formData.id
+      if (this.formData.id) {
+        data.id = this.formData.id
       }
-      for (var key in this.formData) {
-        if (this.formData[key] != this.originalData[key]) {
-          data[key] = this.formData[key];
+      if (this.formData.id) {
+        for (var key in this.formData) {
+          if (this.formData[key] != this.originalData[key]) {
+            data[key] = this.formData[key];
 
-          if (key == 'posX' || key == 'posY') {
-            if (this.formData.posX && this.formData.posY && Number(this.formData.posX) < Number(this.$refs.drugAreaContent.width) && Number(this.formData.posY) < Number(this.$refs.drugAreaContent.height)) {
-              data.mapIndex = Number(this.formData.posX) * Number(this.$refs.drugAreaContent.width) + Number(this.formData.posY);
+            if (key == 'posX' || key == 'posY') {
+              if (this.formData.posX && this.formData.posY && Number(this.formData.posX) < Number(this.$refs.drugAreaContent.width) && Number(this.formData.posY) < Number(this.$refs.drugAreaContent.height)) {
+                data.mapIndex = Number(this.formData.posX) * Number(this.$refs.drugAreaContent.width) + Number(this.formData.posY);
+              }
             }
           }
         }
       }
-
-
+      else {
+        data = { ...this.formData }
+      }
 
       this.$http.post({
         url: this.formData.id ? '/vuforiaImageInfo/update' : '/vuforiaImageInfo/save',