refactor: 测试用例列表页面优化
This commit is contained in:
parent
53c2d6f7fa
commit
1ec251c65a
|
@ -5,6 +5,7 @@ import com.github.pagehelper.PageHelper;
|
|||
import io.metersphere.api.dto.ApiCaseBatchRequest;
|
||||
import io.metersphere.api.dto.definition.*;
|
||||
import io.metersphere.api.service.ApiTestCaseService;
|
||||
import io.metersphere.base.domain.ApiTestCase;
|
||||
import io.metersphere.base.domain.ApiTestCaseWithBLOBs;
|
||||
import io.metersphere.commons.constants.RoleConstants;
|
||||
import io.metersphere.commons.utils.PageUtils;
|
||||
|
@ -61,13 +62,13 @@ public class ApiTestCaseController {
|
|||
}
|
||||
|
||||
@PostMapping(value = "/create", consumes = {"multipart/form-data"})
|
||||
public void create(@RequestPart("request") SaveApiTestCaseRequest request, @RequestPart(value = "files") List<MultipartFile> bodyFiles) {
|
||||
apiTestCaseService.create(request, bodyFiles);
|
||||
public ApiTestCase create(@RequestPart("request") SaveApiTestCaseRequest request, @RequestPart(value = "files") List<MultipartFile> bodyFiles) {
|
||||
return apiTestCaseService.create(request, bodyFiles);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/update", consumes = {"multipart/form-data"})
|
||||
public void update(@RequestPart("request") SaveApiTestCaseRequest request, @RequestPart(value = "files") List<MultipartFile> bodyFiles) {
|
||||
apiTestCaseService.update(request, bodyFiles);
|
||||
public ApiTestCase update(@RequestPart("request") SaveApiTestCaseRequest request, @RequestPart(value = "files") List<MultipartFile> bodyFiles) {
|
||||
return apiTestCaseService.update(request, bodyFiles);
|
||||
}
|
||||
|
||||
@GetMapping("/delete/{id}")
|
||||
|
|
|
@ -116,10 +116,11 @@ public class ApiTestCaseService {
|
|||
return apiTestCaseMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public void create(SaveApiTestCaseRequest request, List<MultipartFile> bodyFiles) {
|
||||
public ApiTestCase create(SaveApiTestCaseRequest request, List<MultipartFile> bodyFiles) {
|
||||
List<String> bodyUploadIds = new ArrayList<>(request.getBodyUploadIds());
|
||||
ApiTestCase test = createTest(request);
|
||||
createBodyFiles(test, bodyUploadIds, bodyFiles);
|
||||
return test;
|
||||
}
|
||||
|
||||
private void checkQuota() {
|
||||
|
@ -129,13 +130,13 @@ public class ApiTestCaseService {
|
|||
}
|
||||
}
|
||||
|
||||
public void update(SaveApiTestCaseRequest request, List<MultipartFile> bodyFiles) {
|
||||
|
||||
public ApiTestCase update(SaveApiTestCaseRequest request, List<MultipartFile> bodyFiles) {
|
||||
deleteFileByTestId(request.getId());
|
||||
List<String> bodyUploadIds = new ArrayList<>(request.getBodyUploadIds());
|
||||
request.setBodyUploadIds(null);
|
||||
ApiTestCase test = updateTest(request);
|
||||
createBodyFiles(test, bodyUploadIds, bodyFiles);
|
||||
return test;
|
||||
}
|
||||
|
||||
private void createBodyFiles(ApiTestCase test, List<String> bodyUploadIds, List<MultipartFile> bodyFiles) {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
@click="active(apiCase)"/>
|
||||
<el-input v-if="!apiCase.id || isShowInput" size="small" v-model="apiCase.name" :name="index" :key="index"
|
||||
class="ms-api-header-select" style="width: 180px"
|
||||
@blur="saveTestCase(apiCase)" placeholder="请输入用例名称"/>
|
||||
@blur="saveTestCase(apiCase)" :placeholder="$t('commons.input_name')"/>
|
||||
<span v-else>
|
||||
{{ apiCase.id ? apiCase.name : '' }}
|
||||
<i class="el-icon-edit" style="cursor:pointer" @click="showInput(apiCase)" v-tester/>
|
||||
|
@ -211,9 +211,12 @@ export default {
|
|||
if (tmp.tags instanceof Array) {
|
||||
tmp.tags = JSON.stringify(tmp.tags);
|
||||
}
|
||||
this.$fileUpload(url, null, bodyFiles, tmp, () => {
|
||||
this.$fileUpload(url, null, bodyFiles, tmp, (response) => {
|
||||
let data = response.data;
|
||||
row.id = data.id;
|
||||
row.createTime = data.createTime;
|
||||
row.updateTime = data.updateTime;
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.$emit('refresh');
|
||||
});
|
||||
},
|
||||
showInput(row) {
|
||||
|
|
|
@ -3,12 +3,20 @@
|
|||
:modal="false" width="45%" :destroy-on-close="true">
|
||||
<span>{{ $t('api_test.automation.scenario_ref') }}:</span>
|
||||
<div class="refs" v-loading="scenarioLoading">
|
||||
<div v-for="(item, index) in scenarioRefs" :key="index" class="el-button--text">{{ item.name }}</div>
|
||||
<div v-for="(item, index) in scenarioRefs" :key="index" class="el-button--text">
|
||||
<router-link :to="{name: 'ApiAutomation', params: { dataSelectRange: 'edit:' + item.id }}">
|
||||
{{ item.name }}
|
||||
</router-link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<span>{{ $t('api_test.automation.plan_ref') }}:</span>
|
||||
<div class="refs">
|
||||
<div v-for="(item, index) in planRefs" :key="index" class="el-button--text">{{ item.name }}</div>
|
||||
<div v-for="(item, index) in planRefs" :key="index" class="el-button--text">
|
||||
<router-link :to="'/track/plan/view/' + item.id">
|
||||
{{ item.name }}
|
||||
</router-link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<template v-slot:footer>
|
||||
|
|
|
@ -3,17 +3,17 @@
|
|||
<el-header height="0">
|
||||
<div style="float: right">
|
||||
<div v-if="tipsType==='1'">
|
||||
🤔️天凉了,保温杯买了吗?
|
||||
🤔️ 天凉了,保温杯买了吗?
|
||||
</div>
|
||||
<div v-else-if="tipsType==='2'">
|
||||
😔觉得MeterSphere不好用就来
|
||||
😔 觉得MeterSphere不好用就来
|
||||
<el-link href="https://github.com/metersphere/metersphere/issues" target="_blank" style="color: black"
|
||||
type="primary">https://github.com/metersphere/metersphere/issues
|
||||
</el-link>
|
||||
吐个槽吧!
|
||||
</div>
|
||||
<div v-else-if="tipsType==='3'">
|
||||
😄觉得MeterSphere好用就来
|
||||
😄 觉得MeterSphere好用就来
|
||||
<el-link href="https://github.com/metersphere/metersphere" target="_blank" style="color: black"
|
||||
type="primary">https://github.com/metersphere/metersphere
|
||||
</el-link>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
.drag-bar {
|
||||
height: 1px;
|
||||
width: 100%;
|
||||
z-index: 9999;
|
||||
z-index: 1000;
|
||||
cursor: row-resize;
|
||||
position: fixed;
|
||||
background-color: #E6E6E6;
|
||||
|
|
Loading…
Reference in New Issue