Selaa lähdekoodia

修复提交表单图片缓存的问题

linyk 2 vuotta sitten
vanhempi
commit
d40391f61a

+ 1 - 1
src/components/file/FileUpload.vue

@@ -52,7 +52,7 @@ export default {
           this.fileList = []
           this.files.map(file => {
             let fileName = file.substring(file.lastIndexOf('/') + 1)
-            fileName = fileName.substring(0, fileName.indexOf('_')) + fileName.substring(fileName.lastIndexOf('.'))
+            fileName = fileName.substring(0, fileName.lastIndexOf('_', fileName.lastIndexOf('_') - 1)) + fileName.substring(fileName.lastIndexOf('.'))
             this.fileList.push({ name: fileName, url: file })
           })
         }

+ 1 - 1
src/components/file/ImgUpload.vue

@@ -47,7 +47,7 @@ export default {
           this.fileList = []
           this.files.map(file => {
             this.fileList.push({ url: file })
-          })
+            })
         }
       }
     }

+ 3 - 0
src/pages/TestCase/components/defect_form.vue

@@ -139,6 +139,9 @@ export default {
         screenshots: []
       }
     },
+    clearDefect () {
+      this.defect = this.init()
+    },
     submitForm (callback) {
       this.$refs['defectForm'].validate(valid => {
         if (valid) {

+ 9 - 0
src/pages/TestCase/components/defect_list.vue

@@ -151,6 +151,15 @@ export default {
       this.getList()
     }
   },
+  watch: {
+    dialogFormVisible: {
+      handler (nv, ov) {
+        if (!nv) {
+          this.$refs.defectForm.clearDefect()
+        }
+      }
+    }
+  },
   methods: {
     ...TestCaseUtils,
     ...mapGetters(['getRefreshTestCaseListFunc', 'getRefreshDefectListFunc']),

+ 9 - 0
src/pages/TestCase/components/test_case_list.vue

@@ -186,6 +186,15 @@ export default {
     this.initData()
     this.getList()
   },
+  watch: {
+    dialogFormVisible: {
+      handler (nv, ov) {
+        if (!nv) {
+          this.$refs.testCaseForm.clearTestCaseData()
+        }
+      }
+    }
+  },
   methods: {
     ...TestCaseUtils,
     ...mapGetters(['getRefreshTestCaseListFunc', 'getRefreshDefectListFunc']),

+ 3 - 0
src/pages/TestCase/components/testcase_form.vue

@@ -167,6 +167,9 @@ export default {
         associatedCode: ''
       }
     },
+    clearTestCaseData () {
+      this.testCase = this.init()
+    },
     getList () {
       let url = Api.TESTCASE.USER_TEST_CASES.replace('{taskCode}', this.testCase.taskCode)
         .replace('{designerId}', this.testCase.designerId)