wenbobowen 4 سال پیش
والد
کامیت
08bd4ae5a6

+ 1 - 1
src/router/newRouter.js

@@ -197,7 +197,7 @@ const layout = [
         name: '测试用例',
         icon: 'test-case',
         cutOff: true,
-        component: () => import('@/views/Platform/useCasePage'),
+        component: () => import('@/views/useCase'),
         meta: { title: '测试用例' }
       },
       {

+ 0 - 3
src/views/Platform/useCasePage.vue

@@ -213,9 +213,6 @@ export default {
     this.im_File = document.getElementById('im_File')
     this.initWindow()
   },
-  activated() {
-    this.updateCaseListData()
-  },
   methods: {
     // 左侧导航栏
     AllQueryFolderData(e) {

+ 68 - 0
src/views/useCase/components/requirementCase.vue

@@ -0,0 +1,68 @@
+<template>
+  <section v-if="bizId !== -1" class="case-main">
+    <iframe
+      ref="useCaseIframe"
+      class="useCaseIframe"
+      frameborder="0"
+      scrolling="no"
+      :src="src"
+      @load="loaded"
+    />
+  </section>
+</template>
+<script>
+import { mapGetters } from 'vuex'
+import { EncryptId } from '@/utils/crypto-js.js'
+export default {
+  data() {
+    return {
+      ifr: null,
+      srcHost: 'http://10.96.83.94:9000/index.html#/case/caseList/zhihui/'
+    }
+  },
+  computed: {
+    ...mapGetters(['bizId']),
+    src() {
+      const bizId = EncryptId(`${this.bizId}`)
+      const src = `${this.srcHost}${bizId}`
+      return src
+    }
+  },
+  watch: {
+    bizId: {
+      handler(newV) {
+        if (newV === -1) return
+        this.matchObj = { params: { product_id: newV }}
+      },
+      immediate: true
+    }
+  },
+  mounted() {
+    if (this.$refs.useCaseIframe) {
+      console.log(this.$refs.useCaseIframe.contentWindow)
+      this.ifr = this.$refs.useCaseIframe.contentWindow
+    }
+  },
+  methods: {
+    loaded() {
+      console.log(this.ifr)
+      if (this.ifr) {
+        console.log(111, this.ifr)
+        this.ifr.postMessage({ user: localStorage.getItem('username') }, '*')
+      }
+    }
+  }
+}
+</script>
+<style lang="scss" scoped>
+.case-main {
+  // padding: 20px 0 20px 18px;
+  margin: 10px;
+  // border-radius: 10px;
+  overflow: scroll;
+}
+.useCaseIframe {
+  width: 100%;
+  height: 100vh;
+}
+</style>

+ 58 - 0
src/views/useCase/index.vue

@@ -0,0 +1,58 @@
+<template>
+  <section class="all-useCase">
+    <div class="control-pages">
+      <span class="control-item" :class="{'is-active':isActive === 1}" @click="isActive=1">需求用例</span>
+      <span class="control-item" :class="{'is-active':isActive === 2}" @click="isActive=2">老版用例</span>
+    </div>
+    <keep-alive>
+      <requirement-case v-if="isActive === 1" />
+      <test-use-case v-if="isActive === 2" />
+    </keep-alive>
+  </section>
+</template>
+<script>
+import requirementCase from '@/views/useCase/components/requirementCase'
+import testUseCase from '@/views/Platform/useCasePage'
+export default {
+  components: {
+    requirementCase,
+    testUseCase
+  },
+  data() {
+    return {
+      isActive: 1
+    }
+  },
+  watch: {
+    isActive: {
+      handler(newV) {
+        newV > 0
+          ? this.$router.replace({ path: this.$route.path, query: { ...this.$route.query, page: newV }})
+          : this.$router.replace({ path: this.$route.path, query: { ...this.$route.query, page: 1 }})
+      }
+    }
+  },
+  created() {
+    this.$nextTick(() => {
+      this.isActive = this.$route.query.page ? Number(this.$route.query.page) : 1
+    })
+  }
+}
+</script>
+<style scoped lang="scss">
+.control-pages {
+  margin: 10px 10px 0 10px;
+  padding: 10px 20px 10px 20px;
+  border-radius: 4px;
+  background-color: #ffffff;
+  .control-item {
+    margin-right: 30px;
+    padding-bottom: 10px;
+    cursor: pointer;
+  }
+  .is-active {
+    color:#4099ff;
+    border-bottom: 1px solid #4099ff;
+  }
+}
+</style>

+ 4 - 1
src/views/workbench/components/statisticsSection.vue

@@ -34,7 +34,7 @@
               </el-tooltip>
             </el-radio-button>
           </el-radio-group>
-          <h3 @click="getAll()">总数:<span>{{ totalTask }}</span></h3>
+          <h3 class="mt5" @click="getAll()">总数:<span>{{ totalTask }}</span></h3>
           <div class="chart-contain">
             <status-stay-chart :chart-data="echartsOption" @onClick="chartChange" />
             <!-- <normal-echart v-if="echartsOption" :chart-id="type+title" :option="echartsOption" @onClick="chartChange" /> -->
@@ -319,6 +319,9 @@ export default {
   }
 }
 .statistics-chart {
+  .mt5 {
+    margin-top: 5px;
+  }
   .two-title {
     width: 100%;
     display: grid;