|
@@ -1,8 +1,8 @@
|
|
|
<template>
|
|
|
- <div class="app-container">
|
|
|
- <div class="title h1" style="margin-top: 10px;">测试用例管理</div>
|
|
|
+ <div class="app-container" v-loading="loading">
|
|
|
+ <div class="title h1" style="margin-top: 10px;">众测执行</div>
|
|
|
<div class="filter-container">
|
|
|
- <el-select v-model="listQueryParam.selectedTaskCode" filterable :filter-method="dataFilter" @click.native="eqNoClick">
|
|
|
+ <el-select v-model="selectedTaskCode" filterable :filter-method="dataFilter" @click.native="eqNoClick">
|
|
|
<el-option
|
|
|
v-for="task in searchTasks"
|
|
|
:key="task.code"
|
|
@@ -10,382 +10,154 @@
|
|
|
:value="task.code"
|
|
|
/>
|
|
|
</el-select>
|
|
|
- <el-select v-model="listQueryParam.testStatus">
|
|
|
+ <el-select v-if="testStatusSearchShow" v-model="selectedTestStatus">
|
|
|
<el-option value="" label="---测试结论---"/>
|
|
|
<el-option value="WAIT" label="待测试"/>
|
|
|
<el-option value="PASS" label="通过"/>
|
|
|
<el-option value="NO_PASS" label="不通过"/>
|
|
|
</el-select>
|
|
|
- <el-select v-model="listQueryParam.examStatus" v-if="!testCaseCanEdit">
|
|
|
+ <el-select v-model="selectedExamStatus" v-if="!testCaseCanEdit && examStatusSearchShow">
|
|
|
<el-option value="" label="---审核结果---"/>
|
|
|
<el-option value="WAIT" label="待审核"/>
|
|
|
<el-option value="VALID" label="有效"/>
|
|
|
<el-option value="INVALID" label="无效"/>
|
|
|
</el-select>
|
|
|
-<!-- <el-input v-model="listQuery.title" placeholder="用例名" style="width: 200px;" class="filter-item" @keyup.enter.native="handleFilter" />-->
|
|
|
-<!-- <el-input v-model="listQuery.title" placeholder="用例编号" style="width: 200px;" class="filter-item" @keyup.enter.native="handleFilter" />-->
|
|
|
-<!-- <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="handleSearch">-->
|
|
|
-<!-- Search-->
|
|
|
-<!-- </el-button>-->
|
|
|
+ <el-upload style="display: inline-block;"
|
|
|
+ :action="uploadTestCasesFileUrl"
|
|
|
+ :on-success="handleUploadTestCasesFileSuccess"
|
|
|
+ :before-upload="beforeTestCasesFileUpload"
|
|
|
+ :on-error="handleUploadTestCasesFileError"
|
|
|
+ :show-file-list="false">
|
|
|
+ <el-button class="filter-item" style="margin-left: 10px;" type="primary" >上传测试用例</el-button>
|
|
|
+ </el-upload>
|
|
|
+ <el-upload style="display: inline-block;"
|
|
|
+ :action="uploadDefectsFileUrl"
|
|
|
+ :on-success="handleUploadDefectsFileSuccess"
|
|
|
+ :before-upload="beforeDefectsFileUpload"
|
|
|
+ :on-error="handleUploadDefectsFileError"
|
|
|
+ :show-file-list="false">
|
|
|
+ <el-button class="filter-item" style="margin-left: 10px;" type="primary" >上传缺陷报告</el-button>
|
|
|
+ </el-upload>
|
|
|
<el-button class="filter-item" style="margin-left: 10px;" type="primary" @click="handleCreate" v-if="testCaseCanEdit">
|
|
|
新增测试用例
|
|
|
</el-button>
|
|
|
+ <el-button class="filter-item" style="margin-left: 10px;" type="primary" @click="handleCreateTestEnv" v-if="testCaseCanEdit">
|
|
|
+ 新增测试环境
|
|
|
+ </el-button>
|
|
|
+ <el-button class="filter-item" style="margin-left: 10px;" type="primary" @click="handleCreateTestTool" v-if="testCaseCanEdit">
|
|
|
+ 新增测试工具
|
|
|
+ </el-button>
|
|
|
<el-button class="filter-item" style="margin-left: 10px;" type="success" @click="handleSubmitAudit" v-if="testCaseCanEdit">
|
|
|
提交审核
|
|
|
</el-button>
|
|
|
+ <el-link type="primary" style="margin-left: 20px" :href="templateDownloadUrl">文档模板下载</el-link>
|
|
|
<span style="display: block; float: right; color: indianred; margin-right: 20px">提交状态:{{isCommitted ? '已提交' : '未提交'}}</span>
|
|
|
</div>
|
|
|
|
|
|
- <el-table
|
|
|
- ref="testCaseTable"
|
|
|
- :key="tableKey"
|
|
|
- v-loading="listLoading"
|
|
|
- :data="testCaseDatas"
|
|
|
- border
|
|
|
- fit
|
|
|
- highlight-current-row
|
|
|
- style="width: 100%"
|
|
|
- >
|
|
|
- <el-table-column type="expand" align="center" min-width="1%">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <el-table
|
|
|
- :key="'innerTableKey' + row.id"
|
|
|
- :data="row.defects"
|
|
|
- border
|
|
|
- fit
|
|
|
- style="width: 100%"
|
|
|
- >
|
|
|
- <el-table-column label="编号" align="center" min-width="15%">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <span>{{ row.code }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="缺陷描述" align="center" :show-overflow-tooltip="true" min-width="35%">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <span>{{ row.descr }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="严重等级" align="center" min-width="12%">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <span>{{ toSeriousnessCn(row.seriousness) }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="优先级" align="center" min-width="10%">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <span>{{ toPriorityCn(row.priority) }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="缺陷类型" align="center" min-width="12%">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <span>{{ toDefectTypeCn(row.defectType) }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="操作步骤" align="center" :show-overflow-tooltip="true" min-width="35%">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <span>{{ row.opeSteps }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="输入数据" align="center" :show-overflow-tooltip="true" min-width="35%">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <span>{{ row.inputDatas }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="预期结果" align="center" :show-overflow-tooltip="true" min-width="35%">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <span>{{ row.expectedResult }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="测试结果" align="center" :show-overflow-tooltip="true" min-width="35%">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <span>{{ row.testResult }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" min-width="20%">
|
|
|
- <template slot-scope="{row,$index}">
|
|
|
- <i class="el-icon-tickets mini-margin" @click="handleDefectDetail(row)" v-if="!testCaseCanEdit" style="cursor: pointer;" title="查看详情"></i>
|
|
|
- <i class="el-icon-edit mini-margin " @click="handleUpdateDefect(row)" v-if="testCaseCanEdit" style="cursor: pointer;" title="编辑"></i>
|
|
|
- <i class="el-icon-delete mini-margin " @click="handleDeleteDefect(row,$index)" v-if="testCaseCanEdit" style="cursor: pointer;" title="删除"></i>
|
|
|
- <i class="el-icon-document-copy mini-margin " @click="handleCopyDefect(row)" v-if="testCaseCanEdit" style="cursor: pointer;" title="复制"></i>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="编号" prop="code" sortable="custom" align="center" min-width="3%">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <span>{{ row.code }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="用例名称" align="center" :show-overflow-tooltip="true" min-width="6%">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <span>{{ row.name }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="优先级" align="center" min-width="3%">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <span>{{ toPriorityCn(row.priority) }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="描述" align="center" :show-overflow-tooltip="true" min-width="10%">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <span>{{ row.descr }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="关联需求" align="center" :show-overflow-tooltip="true" min-width="10%">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <span>{{ row.demand }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="预期结果" align="center" :show-overflow-tooltip="true" min-width="8%">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <span>{{ row.expectedResult }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="测试结果" align="center" :show-overflow-tooltip="true" min-width="8%">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <span>{{ row.testResult }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="测试结论" align="center" min-width="4%">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <span>{{ toTestStatusCn(row.testStatus) }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="缺陷数量(个)" align="center" min-width="4%">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <a href="javascript:void(0)" @click="toogleExpand2(row)" style="color: indianred;">{{ row.defects.length }}</a>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="审核结果" align="center" min-width="4%" v-if="!testCaseCanEdit">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <span>{{ toExamStatusCn(row.examStatus) }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="审核结果说明" align="center" :show-overflow-tooltip="true" min-width="8%" v-if="!testCaseCanEdit">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <span>{{ row.examDescr }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
-<!-- <el-table-column v-if="showReviewer" label="Reviewer" width="110px" align="center">-->
|
|
|
-<!-- <template slot-scope="{row}">-->
|
|
|
-<!-- <span style="color:red;">{{ row.reviewer }}</span>-->
|
|
|
-<!-- </template>-->
|
|
|
-<!-- </el-table-column>-->
|
|
|
-<!-- <el-table-column label="Imp" width="80px">-->
|
|
|
-<!-- <template slot-scope="{row}">-->
|
|
|
-<!-- <svg-icon v-for="n in + row.importance" :key="n" icon-class="star" class="meta-item__icon" />-->
|
|
|
-<!-- </template>-->
|
|
|
-<!-- </el-table-column>-->
|
|
|
- <el-table-column label="操作" align="center" min-width="5%">
|
|
|
- <template slot-scope="{row,$index}">
|
|
|
- <i class="el-icon-tickets mini-margin" @click="handleDetail(row)" v-if="!testCaseCanEdit" style="cursor: pointer;" title="查看详情"></i>
|
|
|
- <i class="el-icon-edit mini-margin" @click="handleUpdate(row)" v-if="testCaseCanEdit" style="cursor: pointer;" title="编辑"></i>
|
|
|
- <i class="el-icon-delete mini-margin" @click="handleDelete(row,$index)" v-if="testCaseCanEdit" style="cursor: pointer;" title="删除"></i>
|
|
|
- <i class="el-icon-document-copy mini-margin" @click="handleCopy(row)" v-if="testCaseCanEdit" style="cursor: pointer;" title="复制"></i>
|
|
|
- <i class="el-icon-document-add mini-margin" @click="handleCreateDefect(row)" v-if="testCaseCanEdit && row.testStatus === 'NO_PASS'" style="cursor: pointer;" title="新增缺陷"></i>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
-
|
|
|
- <pagination v-show="total>0" :total="total" :page.sync="listQueryParam.pageNo" :limit.sync="listQueryParam.pageSize" @pagination="getList" />
|
|
|
-
|
|
|
- <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
|
|
|
- <testcase-form ref="testCaseForm" style="width: 600px;" :test-case-data="testCaseData" :read-only="!testCaseCanEdit"></testcase-form>
|
|
|
- <div slot="footer" class="dialog-footer">
|
|
|
- <el-button @click="dialogFormVisible = false">
|
|
|
- 取消
|
|
|
- </el-button>
|
|
|
- <el-button type="primary" @click="submitData()">
|
|
|
- 提交
|
|
|
- </el-button>
|
|
|
- </div>
|
|
|
- </el-dialog>
|
|
|
-
|
|
|
- <el-dialog :title="textMap[dialogStatus]" :visible.sync="defectDialogFormVisible">
|
|
|
- <defect-form ref="defectForm" style="width: 600px;" :defect-data="defectData"></defect-form>
|
|
|
- <div slot="footer" class="dialog-footer">
|
|
|
- <el-button @click="defectDialogFormVisible = false">
|
|
|
- 取消
|
|
|
- </el-button>
|
|
|
- <el-button type="primary" @click="submitDefectData()">
|
|
|
- 提交
|
|
|
- </el-button>
|
|
|
- </div>
|
|
|
- </el-dialog>
|
|
|
-
|
|
|
- <el-dialog title="用例详情" :visible.sync="testCaseDetailDialogFormVisible">
|
|
|
- <testcase-detail ref="testCaseDetail" style="width: 600px;" :test-case-data="testCaseData" :can-audit="false"></testcase-detail>
|
|
|
- <div slot="footer" class="dialog-footer">
|
|
|
- <el-button @click="testCaseDetailDialogFormVisible = false">
|
|
|
- 取消
|
|
|
- </el-button>
|
|
|
- </div>
|
|
|
- </el-dialog>
|
|
|
-
|
|
|
- <el-dialog title="缺陷详情" :visible.sync="defectDetailDialogFormVisible">
|
|
|
- <defect-detail ref="defectDetail" style="width: 600px;" :defect-data="defectData"></defect-detail>
|
|
|
- <div slot="footer" class="dialog-footer">
|
|
|
- <el-button @click="defectDetailDialogFormVisible = false">
|
|
|
- 取消
|
|
|
- </el-button>
|
|
|
- </div>
|
|
|
- </el-dialog>
|
|
|
+ <el-tabs v-model="tabActiveName" @tab-click="handleTabClick">
|
|
|
+ <el-tab-pane label="测试用例" name="testCases">
|
|
|
+ <test-case-list ref="testCaseList" :selected-task-code="selectedTaskCode" :selected-test-status="selectedTestStatus" :selected-exam-status="selectedExamStatus" :test-case-can-edit="testCaseCanEdit"></test-case-list>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="用例缺陷" name="defects">
|
|
|
+ <defect-list ref="defectList" :isContained="false" :test-case-can-edit="testCaseCanEdit" :selected-task-code="selectedTaskCode"/>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="测试环境" name="testEnvs">
|
|
|
+ <test-env-list ref="testEnvList" :test-case-can-edit="testCaseCanEdit" :selected-task-code="selectedTaskCode"></test-env-list>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="测试工具" name="testTools">
|
|
|
+ <test-tool-list ref="testToolList" :test-case-can-edit="testCaseCanEdit" :selected-task-code="selectedTaskCode"></test-tool-list>
|
|
|
+ </el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import waves from '@/directive/waves' // waves directive
|
|
|
-import Pagination from '@/components/Pagination' // secondary package based on el-pagination
|
|
|
-import TestcaseForm from './components/testcase_form'
|
|
|
-import DefectForm from './components/defect_form'
|
|
|
-import TestcaseDetail from './components/testcase_detail'
|
|
|
-import DefectDetail from './components/defect_detail'
|
|
|
+import TestCaseList from './components/test_case_list'
|
|
|
+import DefectList from './components/defect_list'
|
|
|
+import TestEnvList from './components/test_env_list'
|
|
|
+import TestToolList from './components/test_tool_list'
|
|
|
import Http from '@/js/http'
|
|
|
import Api from '@/js/api'
|
|
|
import {notify} from '@/constants'
|
|
|
-import TestCaseUtils from './utils'
|
|
|
+import { mapActions, mapGetters } from 'vuex'
|
|
|
|
|
|
export default {
|
|
|
- name: 'ComplexTable',
|
|
|
- components: { Pagination, TestcaseForm, DefectForm, TestcaseDetail, DefectDetail },
|
|
|
- directives: { waves },
|
|
|
+ name: 'TestCases',
|
|
|
+ components: { TestCaseList, DefectList, TestEnvList, TestToolList },
|
|
|
data () {
|
|
|
return {
|
|
|
- testCaseData: {},
|
|
|
- defectData: {},
|
|
|
- testCaseDatas: [],
|
|
|
- tableKey: 0,
|
|
|
- total: 0,
|
|
|
- listQueryParam: {
|
|
|
- pageNo: 1,
|
|
|
- pageSize: 20,
|
|
|
- selectedTaskCode: this.$route.params.taskCode,
|
|
|
- testStatus: '',
|
|
|
- examStatus: ''
|
|
|
- },
|
|
|
- listLoading: true,
|
|
|
- showReviewer: false,
|
|
|
- dialogFormVisible: false,
|
|
|
- defectDialogFormVisible: false,
|
|
|
- testCaseDetailDialogFormVisible: false,
|
|
|
- defectDetailDialogFormVisible: false,
|
|
|
- dialogStatus: '',
|
|
|
- textMap: {
|
|
|
- update: '编辑测试用例',
|
|
|
- create: '新建测试用例',
|
|
|
- create_defect: '新建缺陷',
|
|
|
- update_defect: '编辑缺陷',
|
|
|
- detail: '测试用例详情',
|
|
|
- defect_detail: '缺陷详情'
|
|
|
- },
|
|
|
- selectedTaskCode: '',
|
|
|
+ tabActiveName: 'testCases',
|
|
|
+ selectedTaskCode: this.$route.params.taskCode,
|
|
|
+ selectedTestStatus: '',
|
|
|
+ selectedExamStatus: '',
|
|
|
tasks: [],
|
|
|
searchTasks: [],
|
|
|
testCaseCanEdit: false,
|
|
|
- isCommitted: false
|
|
|
+ isCommitted: false,
|
|
|
+ testStatusSearchShow: true,
|
|
|
+ examStatusSearchShow: true,
|
|
|
+ loading: false,
|
|
|
+ templateDownloadUrl: process.env.OSS_URL + '%E6%96%87%E6%A1%A3%E6%A8%A1%E6%9D%BF.rar'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ uploadTestCasesFileUrl () {
|
|
|
+ return process.env.API_ROOT + Api.TESTCASE.UPLOAD_TEST_CASES_FILE.replace('{taskCode}', this.selectedTaskCode)
|
|
|
+ },
|
|
|
+ uploadDefectsFileUrl () {
|
|
|
+ return process.env.API_ROOT + Api.TESTCASE.UPLOAD_DEFECTS_FILE.replace('{taskCode}', this.selectedTaskCode)
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
- 'listQueryParam.selectedTaskCode': function (newVal, oldVal) {
|
|
|
+ 'selectedTaskCode': function (newVal, oldVal) {
|
|
|
this.getList()
|
|
|
this.handleStatus()
|
|
|
},
|
|
|
- 'listQueryParam.testStatus': function (newVal, oldVal) {
|
|
|
+ 'selectedTestStatus': function (newVal, oldVal) {
|
|
|
this.getList()
|
|
|
},
|
|
|
- 'listQueryParam.examStatus': function (newVal, oldVal) {
|
|
|
+ 'selectedExamStatus': function (newVal, oldVal) {
|
|
|
this.getList()
|
|
|
}
|
|
|
},
|
|
|
created () {
|
|
|
- this.initData()
|
|
|
- this.initDefectData()
|
|
|
this.getSimpleTaskDatas()
|
|
|
- this.getList()
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.setRefreshTestCaseListFunc(this.$refs.testCaseList.getList)
|
|
|
+ this.setRefreshDefectListFunc(this.$refs.defectList.getList)
|
|
|
+ })
|
|
|
},
|
|
|
methods: {
|
|
|
- ...TestCaseUtils,
|
|
|
- handleStatus () {
|
|
|
- let task = this.tasks.find(task => {
|
|
|
- return task.code === this.listQueryParam.selectedTaskCode
|
|
|
+ ...mapActions(['setRefreshTestCaseListFunc', 'setRefreshDefectListFunc']),
|
|
|
+ ...mapGetters(['getRefreshTestCaseListFunc', 'getRefreshDefectListFunc']),
|
|
|
+ getTestCaseListMethod () {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ return this.$refs.testCaseList.getList
|
|
|
})
|
|
|
- this.testCaseCanEdit = !(task.isCommitted) && task.status !== 5
|
|
|
- this.isCommitted = task.isCommitted && true
|
|
|
},
|
|
|
- getList () {
|
|
|
- this.showListLoading()
|
|
|
- let url = Api.TESTCASE.USER_TEST_CASES.replace('{taskCode}', this.listQueryParam.selectedTaskCode)
|
|
|
- .replace('{designerId}', '0')
|
|
|
- .replace('{pageNo}', this.listQueryParam.pageNo - 1)
|
|
|
- .replace('{pageSize}', this.listQueryParam.pageSize)
|
|
|
- if (this.listQueryParam.testStatus || this.listQueryParam.examStatus) {
|
|
|
- if (url.indexOf('?') === -1) {
|
|
|
- url = url + '?'
|
|
|
- }
|
|
|
- if (this.listQueryParam.testStatus) {
|
|
|
- url = url + 'testStatus=' + this.listQueryParam.testStatus + '&'
|
|
|
- }
|
|
|
- if (this.listQueryParam.examStatus) {
|
|
|
- url = url + 'examStatus=' + this.listQueryParam.examStatus + '&'
|
|
|
- }
|
|
|
- url = url.substring(0, url.length - 1)
|
|
|
- }
|
|
|
- Http.get(url).then((res) => {
|
|
|
- const testCasePage = res.data
|
|
|
- this.total = testCasePage.totalCount
|
|
|
- this.listQueryParam.pageNo = testCasePage.pageNo + 1
|
|
|
- this.listQueryParam.pageSize = testCasePage.pageSize
|
|
|
- this.testCaseDatas = testCasePage.datas
|
|
|
- }).catch((error) => {
|
|
|
- console.error(error)
|
|
|
- notify('error', '获取测试用例数据失败:' + error)
|
|
|
+ getDefectListMethod () {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ return this.$refs.defectList.getList
|
|
|
})
|
|
|
- this.hideListLoading()
|
|
|
},
|
|
|
- // handleSearch () {
|
|
|
- // this.listQueryParam.pageNo = 1
|
|
|
- // this.getList()
|
|
|
- // },
|
|
|
- initData () {
|
|
|
- this.testCaseData = {
|
|
|
- demand: '',
|
|
|
- descr: '',
|
|
|
- envConfig: '',
|
|
|
- evaCriteria: '',
|
|
|
- testStatus: '',
|
|
|
- expectedResult: '',
|
|
|
- files: [],
|
|
|
- id: undefined,
|
|
|
- inputDatas: '',
|
|
|
- name: '',
|
|
|
- opeSteps: '',
|
|
|
- others: '',
|
|
|
- preconditions: '',
|
|
|
- priority: '',
|
|
|
- screenshots: [],
|
|
|
- taskCode: '',
|
|
|
- testResult: ''
|
|
|
- }
|
|
|
+ getList () {
|
|
|
+ this.$refs.testCaseList.listQueryParam.selectedTaskCode = this.selectedTaskCode
|
|
|
+ this.$refs.testCaseList.listQueryParam.testStatus = this.selectedTestStatus
|
|
|
+ this.$refs.testCaseList.listQueryParam.examStatus = this.selectedExamStatus
|
|
|
+ this.$refs.defectList.listQueryParam.selectedTaskCode = this.selectedTaskCode
|
|
|
+ this.$refs.testEnvList.listQueryParam.selectedTaskCode = this.selectedTaskCode
|
|
|
+ this.$refs.testToolList.selectedTaskCode = this.selectedTaskCode
|
|
|
+ this.$refs.testCaseList.getList()
|
|
|
+ this.$refs.defectList.getList()
|
|
|
+ this.$refs.testEnvList.getList()
|
|
|
+ this.$refs.testToolList.getList()
|
|
|
},
|
|
|
- initDefectData () {
|
|
|
- this.defectData = {
|
|
|
- descr: '',
|
|
|
- envConfig: '',
|
|
|
- expectedResult: '',
|
|
|
- files: [],
|
|
|
- id: undefined,
|
|
|
- inputDatas: '',
|
|
|
- opeSteps: '',
|
|
|
- others: '',
|
|
|
- preconditions: '',
|
|
|
- priority: '',
|
|
|
- seriousness: '',
|
|
|
- defectType: '',
|
|
|
- screenshots: [],
|
|
|
- taskCode: '',
|
|
|
- testCaseCode: '',
|
|
|
- testResult: ''
|
|
|
- }
|
|
|
+ handleStatus () {
|
|
|
+ let task = this.tasks.find(task => {
|
|
|
+ return task.code === this.selectedTaskCode
|
|
|
+ })
|
|
|
+ this.testCaseCanEdit = !(task.isCommitted) && task.status !== 5
|
|
|
+ this.isCommitted = task.isCommitted && true
|
|
|
},
|
|
|
handleSubmitAudit () {
|
|
|
this.$confirm('提交任务之后将不能再编辑测试用例,您确定要提交该任务吗', '提示', {
|
|
@@ -395,197 +167,32 @@ export default {
|
|
|
center: true,
|
|
|
closeOnClickModal: false
|
|
|
}).then(() => {
|
|
|
- this.showListLoading()
|
|
|
- Http.put(Api.TASK.COMMIT_TASK.replace('{taskCode}', this.listQueryParam.selectedTaskCode), {}).then((res) => {
|
|
|
- this.hideListLoading()
|
|
|
+ Http.put(Api.TASK.COMMIT_TASK.replace('{taskCode}', this.selectedTaskCode), {}).then((res) => {
|
|
|
if (res.code === 20000) {
|
|
|
- this.$notify({
|
|
|
- title: 'Success',
|
|
|
- message: '提交成功',
|
|
|
- type: 'success',
|
|
|
- duration: 2000
|
|
|
- })
|
|
|
+ notify('success', '提交成功')
|
|
|
this.testCaseCanEdit = false
|
|
|
+ this.isCommitted = true
|
|
|
} else {
|
|
|
- this.$notify({
|
|
|
- title: 'Error',
|
|
|
- message: '提交失败:' + res.data,
|
|
|
- type: 'Error',
|
|
|
- duration: 2000
|
|
|
- })
|
|
|
+ notify('error', '提交失败:' + res.data)
|
|
|
}
|
|
|
}).catch((error) => {
|
|
|
this.hideListLoading()
|
|
|
- notify('error', '提交失败:' + error)
|
|
|
+ notify('error', '提交失败:系统异常')
|
|
|
})
|
|
|
}).catch(() => {
|
|
|
})
|
|
|
},
|
|
|
handleCreate () {
|
|
|
- this.initData()
|
|
|
- this.dialogStatus = 'create'
|
|
|
- this.dialogFormVisible = true
|
|
|
- this.testCaseData.taskCode = this.listQueryParam.selectedTaskCode
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs['testCaseForm'].clearValidate()
|
|
|
- })
|
|
|
- },
|
|
|
- handleCreateDefect (testCase) {
|
|
|
- this.initDefectData()
|
|
|
- this.dialogStatus = 'create_defect'
|
|
|
- this.defectDialogFormVisible = true
|
|
|
- this.defectData.taskCode = this.listQueryParam.selectedTaskCode
|
|
|
- this.defectData.testCaseCode = testCase.code
|
|
|
- this.defectData.priority = testCase.priority
|
|
|
- this.defectData.preconditions = testCase.preconditions
|
|
|
- this.defectData.envConfig = testCase.envConfig
|
|
|
- this.defectData.opeSteps = testCase.opeSteps
|
|
|
- this.defectData.inputDatas = testCase.inputDatas
|
|
|
- this.defectData.expectedResult = testCase.expectedResult
|
|
|
- this.defectData.testResult = testCase.testResult
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs['defectForm'].clearValidate()
|
|
|
- })
|
|
|
- },
|
|
|
- submitData () {
|
|
|
- let callback = null
|
|
|
- if (this.testCaseData.id) {
|
|
|
- callback = this.getList
|
|
|
- } else {
|
|
|
- callback = () => {
|
|
|
- this.listQueryParam.pageNo = Math.ceil((this.total + 1) / this.listQueryParam.pageSize)
|
|
|
- this.getList()
|
|
|
- }
|
|
|
- }
|
|
|
- this.$refs.testCaseForm.submitForm(callback)
|
|
|
- },
|
|
|
- submitDefectData () {
|
|
|
- this.$refs.defectForm.submitForm(this.getList)
|
|
|
- },
|
|
|
- handleDetail (row) {
|
|
|
- this.testCaseDetailDialogFormVisible = true
|
|
|
- this.deepClone(this.testCaseData, row)
|
|
|
- },
|
|
|
- handleDefectDetail (row) {
|
|
|
- this.defectDetailDialogFormVisible = true
|
|
|
- this.deepClone(this.defectData, row)
|
|
|
- },
|
|
|
- handleUpdate (row) {
|
|
|
- this.dialogStatus = 'update'
|
|
|
- this.dialogFormVisible = true
|
|
|
- this.deepClone(this.testCaseData, row)
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs['testCaseForm'].clearValidate()
|
|
|
- })
|
|
|
- },
|
|
|
- handleUpdateDefect (row) {
|
|
|
- this.dialogStatus = 'update_defect'
|
|
|
- this.defectDialogFormVisible = true
|
|
|
- this.deepClone(this.defectData, row)
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs['defectForm'].clearValidate()
|
|
|
- })
|
|
|
- console.log(this.defectData)
|
|
|
- },
|
|
|
- handleDelete (row, index) {
|
|
|
- this.$confirm('您确定要删除该条数据吗?', '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning',
|
|
|
- center: true,
|
|
|
- closeOnClickModal: false
|
|
|
- }).then(() => {
|
|
|
- this.showListLoading()
|
|
|
- Http.delete(Api.TESTCASE.DELETE.replace('{id}', row.id), {}).then((res) => {
|
|
|
- this.hideListLoading()
|
|
|
- if (res.code === 20000) {
|
|
|
- this.$notify({
|
|
|
- title: 'Success',
|
|
|
- message: '删除成功',
|
|
|
- type: 'success',
|
|
|
- duration: 2000
|
|
|
- })
|
|
|
- this.getList()
|
|
|
- } else {
|
|
|
- this.$notify({
|
|
|
- title: 'Error',
|
|
|
- message: '删除失败' + res.msg,
|
|
|
- type: 'Error',
|
|
|
- duration: 2000
|
|
|
- })
|
|
|
- }
|
|
|
- }).catch((error) => {
|
|
|
- this.hideListLoading()
|
|
|
- notify('error', '删除失败:' + error)
|
|
|
- })
|
|
|
- }).catch(() => {
|
|
|
- })
|
|
|
+ this.tabActiveName = 'testCases'
|
|
|
+ this.$refs.testCaseList.handleCreate()
|
|
|
},
|
|
|
- handleDeleteDefect (row, index) {
|
|
|
- this.$confirm('您确定要删除该条数据吗?', '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning',
|
|
|
- center: true,
|
|
|
- closeOnClickModal: false
|
|
|
- }).then(() => {
|
|
|
- this.showListLoading()
|
|
|
- Http.delete(Api.TESTCASE.DELETE_DEFECT.replace('{id}', row.id), {}).then((res) => {
|
|
|
- this.hideListLoading()
|
|
|
- if (res.code === 20000) {
|
|
|
- this.$notify({
|
|
|
- title: 'Success',
|
|
|
- message: '删除成功',
|
|
|
- type: 'success',
|
|
|
- duration: 2000
|
|
|
- })
|
|
|
- for (let i in this.testCaseDatas) {
|
|
|
- let testCase = this.testCaseDatas[i]
|
|
|
- if (testCase.defects.length > index) {
|
|
|
- if (testCase.defects[index].id === row.id) {
|
|
|
- testCase.defects.splice(index, 1)
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- this.$notify({
|
|
|
- title: 'Error',
|
|
|
- message: '删除失败' + res.msg,
|
|
|
- type: 'Error',
|
|
|
- duration: 2000
|
|
|
- })
|
|
|
- }
|
|
|
- }).catch((error) => {
|
|
|
- this.hideListLoading()
|
|
|
- notify('error', '删除失败:' + error)
|
|
|
- })
|
|
|
- }).catch(() => {
|
|
|
- })
|
|
|
- },
|
|
|
- handleCopy (row) {
|
|
|
- this.dialogStatus = 'create'
|
|
|
- this.dialogFormVisible = true
|
|
|
- this.deepClone(this.testCaseData, row)
|
|
|
- this.testCaseData.id = undefined
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs['testCaseForm'].clearValidate()
|
|
|
- })
|
|
|
- console.log(this.testCaseData)
|
|
|
- },
|
|
|
- handleCopyDefect (row) {
|
|
|
- this.dialogStatus = 'create_defect'
|
|
|
- this.defectDialogFormVisible = true
|
|
|
- this.deepClone(this.defectData, row)
|
|
|
- this.defectData.id = undefined
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs['defectForm'].clearValidate()
|
|
|
- })
|
|
|
- console.log(this.defectData)
|
|
|
+ handleCreateTestEnv () {
|
|
|
+ this.tabActiveName = 'testEnvs'
|
|
|
+ this.$refs.testEnvList.handleCreate()
|
|
|
},
|
|
|
- getSortClass: function (key) {
|
|
|
- const sort = this.listQuery.sort
|
|
|
- return sort === `+${key}` ? 'ascending' : 'descending'
|
|
|
+ handleCreateTestTool () {
|
|
|
+ this.tabActiveName = 'testTools'
|
|
|
+ this.$refs.testToolList.handleCreate()
|
|
|
},
|
|
|
dataFilter (val) {
|
|
|
if (val) {
|
|
@@ -612,54 +219,57 @@ export default {
|
|
|
this.searchTasks = this.tasks
|
|
|
this.handleStatus()
|
|
|
}).catch((error) => {
|
|
|
- this.hideLoading()
|
|
|
- notify('error', '获取任务数据失败:' + error.data)
|
|
|
+ notify('error', '获取任务数据失败:系统异常')
|
|
|
})
|
|
|
},
|
|
|
- deepClone: function (oldData, newData) {
|
|
|
- if (newData instanceof Array) {
|
|
|
- if (oldData.length !== newData.length) {
|
|
|
- oldData = new Array(newData.length)
|
|
|
- }
|
|
|
- for (var i = 0; i < newData.length; i++) {
|
|
|
- if (newData[i] instanceof Array) {
|
|
|
- oldData[i] = new Array(newData[i].length)
|
|
|
- this.deepClone(oldData[i], newData[i])
|
|
|
- } else if (newData[i] instanceof Object) {
|
|
|
- oldData[i] = {}
|
|
|
- this.deepClone(oldData[i], newData[i])
|
|
|
- } else {
|
|
|
- oldData[i] = newData[i]
|
|
|
- }
|
|
|
- }
|
|
|
- } else if (newData instanceof Object) {
|
|
|
- if (oldData.length > 0) {
|
|
|
- oldData = {}
|
|
|
- }
|
|
|
- for (var key in newData) {
|
|
|
- if (newData[key] instanceof Array) {
|
|
|
- oldData[key] = new Array(newData[key].length)
|
|
|
- this.deepClone(oldData[key], newData[key])
|
|
|
- } else if (newData[key] instanceof Object) {
|
|
|
- oldData[key] = {}
|
|
|
- this.deepClone(oldData[key], newData[key])
|
|
|
- } else {
|
|
|
- oldData[key] = newData[key]
|
|
|
- }
|
|
|
- }
|
|
|
+ handleTabClick (tab, event) {
|
|
|
+ if (tab.name === 'testCases') {
|
|
|
+ this.testStatusSearchShow = true
|
|
|
+ this.examStatusSearchShow = true
|
|
|
+ } else {
|
|
|
+ this.testStatusSearchShow = false
|
|
|
+ this.examStatusSearchShow = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ beforeTestCasesFileUpload (file) {
|
|
|
+ const isXLSX = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
|
|
+ if (!(isXLSX)) {
|
|
|
+ this.$message.error('上传文件只能是XLSX 格式!')
|
|
|
}
|
|
|
- console.log('deepClone')
|
|
|
- console.log(oldData)
|
|
|
+ if (isXLSX) {
|
|
|
+ this.loading = true
|
|
|
+ }
|
|
|
+ return isXLSX
|
|
|
+ },
|
|
|
+ handleUploadTestCasesFileSuccess (response, file, fileList) {
|
|
|
+ this.loading = false
|
|
|
+ notify('success', '上传成功')
|
|
|
+ this.getRefreshTestCaseListFunc()()
|
|
|
+ },
|
|
|
+ handleUploadTestCasesFileError (err, file, fileList) {
|
|
|
+ console.log(err)
|
|
|
+ this.loading = false
|
|
|
+ notify('error', '上传失败' + err)
|
|
|
},
|
|
|
- showListLoading () {
|
|
|
- this.listLoading = true
|
|
|
+ beforeDefectsFileUpload (file) {
|
|
|
+ const isXLSX = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
|
|
+ if (!(isXLSX)) {
|
|
|
+ this.$message.error('上传文件只能是XLSX 格式!')
|
|
|
+ }
|
|
|
+ if (isXLSX) {
|
|
|
+ this.loading = true
|
|
|
+ }
|
|
|
+ return isXLSX
|
|
|
},
|
|
|
- hideListLoading () {
|
|
|
- this.listLoading = false
|
|
|
+ handleUploadDefectsFileSuccess (response, file, fileList) {
|
|
|
+ this.loading = false
|
|
|
+ notify('success', '上传成功')
|
|
|
+ this.getRefreshDefectListFunc()()
|
|
|
},
|
|
|
- toogleExpand2 (row) {
|
|
|
- let testCaseTable = this.$refs.testCaseTable
|
|
|
- testCaseTable.toggleRowExpansion(row)
|
|
|
+ handleUploadDefectsFileError (err, file, fileList) {
|
|
|
+ console.log(err)
|
|
|
+ this.loading = false
|
|
|
+ notify('error', '上传失败' + err)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -670,16 +280,4 @@ export default {
|
|
|
margin-bottom: 4px;
|
|
|
padding-left: 6px;
|
|
|
}
|
|
|
- .mini-margin {
|
|
|
- margin-left: 6px;
|
|
|
- margin-right: 6px;
|
|
|
- }
|
|
|
-</style>
|
|
|
-<style>
|
|
|
-.el-table__expanded-cell {
|
|
|
- background-color: #eee!important;
|
|
|
-}
|
|
|
-.el-table__expanded-cell:hover {
|
|
|
- background-color: #eee!important;
|
|
|
-}
|
|
|
</style>
|