qinzhipeng_v 5 жил өмнө
parent
commit
89707482e5

+ 6 - 4
src/views/Platform/useCase/createUse.vue

@@ -147,7 +147,7 @@ export default {
   data() {
     return {
       data: [{ description: '', expectedResult: '', remark: '', accessory: '' }],
-      userNames: localStorage.getItem('realname'),
+      userNames: localStorage.getItem('username'),
       bizJson: localStorage.getItem('key'),
       startId: '',
       caseFolderId: '',
@@ -198,11 +198,13 @@ export default {
       if (this.$route.query.id) { // 编辑
         this.titleName = '编辑'
         this.form_Query = true
-        this.startId = this.$route.query.id
         this.plus = false
-        queryCasesData({ caseFolderId: this.startId }).then(res => {
+        this.url = window.location.href // 获取url中"?"符后的字串
+        this.id = this.url.split('?id=')
+        this.startId = this.id[1]
+        queryCasesData({ caseFolderId: this.id[1] }).then(res => {
           for (var el of res.data.list) {
-            el.caseFolderId === this.startId ? this.caseData = el : ''
+            el.caseFolderId === Number(this.id[1]) ? this.caseData = el : ''
             if (this.caseData.accessory !== '') {
               var obj = JSON.parse(this.caseData.accessory.split('{}')[0])
               for (var a of obj) {

+ 9 - 12
src/views/Platform/useCase/queryUse.vue

@@ -41,7 +41,7 @@
           </el-form-item>
         </el-form>
         <div align="center" style="margin: 5% 0;">
-          <el-button @click="Return">返 回</el-button>
+          <el-button @click="$router.go(-1)">返 回</el-button>
         </div>
       </el-main>
     </el-container>
@@ -56,7 +56,8 @@ export default {
       formLabelAlign: {},
       caseFolderId: '',
       id: '',
-      uptataKey: []
+      uptataKey: [],
+      url: ''
     }
   },
   created() {
@@ -65,24 +66,20 @@ export default {
 
   methods: {
     initCode() {
-      this.id = this.$route.query.data.id
-      this.caseFolderId = this.$route.query.data.caseFolderId
-      queryCase({ id: this.id, caseFolderId: this.caseFolderId }).then(res => {
+      this.url = window.location.href // 获取url中"?"符后的字串
+      this.caseFolderId = this.url.split('&caseFolderId=')
+      this.id = this.caseFolderId[0].split('?id=')
+      queryCase({ id: this.id[1], caseFolderId: this.caseFolderId[1] }).then(res => {
         for (var el of res.data.list) {
-          el.id === this.id ? this.formLabelAlign = el : ''
+          el.id === Number(this.id[1]) ? this.formLabelAlign = el : ''
+          console.log(this.formLabelAlign)
           var obj = JSON.parse(this.formLabelAlign.accessory.split('{}')[0])
           for (var a of obj) {
             this.uptataKey.push(a)
           }
-          console.log(this.uptataKey)
           break
         }
       })
-    },
-
-    // 返回
-    Return() {
-      this.$router.go(-1)
     }
   }
 }

+ 1 - 5
src/views/Platform/useCasePage.vue

@@ -390,11 +390,7 @@ export default {
     },
     // 查看
     queryGetShow(ele) {
-      var data = {
-        id: ele.id,
-        caseFolderId: ele.caseFolderId
-      }
-      this.$router.push({ path: '/Platform/useCasePage/queryUse', query: { data: data }})
+      this.$router.push({ path: '/Platform/useCasePage/queryUse', query: { id: ele.id, caseFolderId: ele.caseFolderId }})
     },
     // 编辑
     updateGetShow(ele) {