ScenarioExtendBtns.vue 2.6 KB
Newer Older
Q
q4speed 已提交
1
<template>
2 3 4 5 6 7 8 9 10 11 12
  <div>
    <el-dropdown @command="handleCommand" class="scenario-ext-btn">
      <el-link type="primary" :underline="false">
        <el-icon class="el-icon-more"></el-icon>
      </el-link>
      <el-dropdown-menu slot="dropdown">
        <el-dropdown-item command="ref">{{ $t('api_test.automation.view_ref') }}</el-dropdown-item>
        <el-dropdown-item command="schedule" v-tester>{{ $t('api_test.automation.schedule') }}</el-dropdown-item>
        <el-dropdown-item command="create_performance" v-tester>{{ $t('api_test.create_performance_test') }}</el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown>
13
    <ms-reference-view @openScenario="openScenario" ref="viewRef"/>
14 15 16
    <ms-schedule-maintain ref="scheduleMaintain" @refreshTable="refreshTable"/>

  </div>
Q
q4speed 已提交
17 18 19
</template>

<script>
20
  import MsReferenceView from "@/business/components/api/automation/scenario/ReferenceView";
21
  import MsScheduleMaintain from "@/business/components/api/automation/schedule/ScheduleMaintain"
22
  import {getCurrentProjectID, getUUID} from "@/common/js/utils";
Q
q4speed 已提交
23

24 25
  export default {
    name: "MsScenarioExtendButtons",
26
    components: {MsReferenceView, MsScheduleMaintain},
27 28
    props: {
      row: Object
Q
q4speed 已提交
29
    },
30 31 32 33 34 35
    methods: {
      handleCommand(cmd) {
        switch (cmd) {
          case  "ref":
            this.$refs.viewRef.open(this.row);
            break;
36 37 38
          case "schedule":
            this.$refs.scheduleMaintain.open(this.row);
            break;
39 40 41
          case "create_performance":
            this.createPerformance(this.row);
            break;
42 43
        }
      },
44 45
      createPerformance(row) {
        this.infoDb = false;
46
        let url = "/api/automation/genPerformanceTestJmx";
47 48 49 50
        let run = {};
        let scenarioIds = [];
        scenarioIds.push(row.id);
        run.projectId = getCurrentProjectID();
C
chenjianxing 已提交
51
        run.ids = scenarioIds;
52 53 54
        run.id = getUUID();
        run.name = row.name;
        this.$post(url, run, response => {
55 56 57
          let jmxObj = {};
          jmxObj.name = response.data.name;
          jmxObj.xml = response.data.xml;
58 59
          jmxObj.attachFiles = response.data.attachFiles;
          jmxObj.attachByteFiles = response.data.attachByteFiles;
S
song.tianyang 已提交
60
          jmxObj.scenarioId = row.id;
61 62 63 64 65 66 67
          this.$store.commit('setTest', {
            name: row.name,
            jmx: jmxObj
          })
          this.$router.push({
            path: "/performance/test/create"
          })
68 69
        });
      },
70 71 72
      openScenario (item) {
        this.$emit('openScenario', item)
      },
73
      refreshTable() {
74 75

      }
76
    }
Q
q4speed 已提交
77 78 79 80
  }
</script>

<style scoped>
81 82 83
  .scenario-ext-btn {
    margin-left: 10px;
  }
Q
q4speed 已提交
84
</style>