fix(接口定义): 修复case添加后置脚本,多次保存,内容还是上一次的缺陷

--bug=1022091 --user=王孝刚 【接口测试】github#21425,接口定义case,后置操作添加脚本,修改信息后仍是以前的结果 https://www.tapd.cn/55049933/s/1329383
This commit is contained in:
wxg0103 2023-01-31 16:13:41 +08:00 committed by wxg0103
parent a2a2bd0571
commit b04b7703b8
4 changed files with 9 additions and 19 deletions

View File

@ -436,7 +436,9 @@ export default {
close() {
this.dialogVisible = false;
this.form.cronValue = '';
this.$refs['from'].resetFields();
if (this.$refs['from']) {
this.$refs['from'].resetFields();
}
if (!this.schedule.value) {
this.$refs.crontabResult.resultList = [];
}

View File

@ -281,6 +281,7 @@ import { TYPE_TO_C } from '@/business/automation/scenario/Setting';
import ApiCaseHeader from './ApiCaseHeader';
import { deepClone } from 'metersphere-frontend/src/utils/tableUtils';
import { useApiStore } from '@/store';
import {TokenKey} from "metersphere-frontend/src/utils/constants";
const store = useApiStore();
export default {
@ -700,6 +701,8 @@ export default {
row.createTime = data.createTime;
row.updateTime = data.updateTime;
this.compare = [];
let user = JSON.parse(localStorage.getItem(TokenKey));
row.updateUser = user.name;
row.type = null;
this.$success(this.$t('commons.save_success'));
this.tagCount = 0;
@ -713,7 +716,6 @@ export default {
if (!hideAlert) {
this.$emit('refresh');
}
this.$emit('refreshCaseList',row.id);
},
(error) => {
this.isSave = false;

View File

@ -24,7 +24,6 @@
<api-case-item
:loading="(singleLoading && singleRunId === item.id) || batchLoadingIds.indexOf(item.id) > -1"
@refresh="refresh"
@refreshCaseList="refreshCaseList"
@singleRun="singleRun"
@stop="stop"
@refreshModule="refreshModule"
@ -442,21 +441,6 @@ export default {
refresh() {
this.$emit('refresh');
},
refreshCaseList(id) {
return new Promise((resolve) => {
let commonUseEnvironment = store.useEnvironment;
this.environment = commonUseEnvironment ? commonUseEnvironment : '';
getCaseById(id).then((response) => {
let apiCase = response.data;
if (apiCase) {
this.formatCase(apiCase);
apiCase.active = true;
this.apiCaseList = [apiCase];
}
resolve();
});
});
},
reLoadCase() {
this.$emit('reLoadCase');
},

View File

@ -463,7 +463,9 @@ export default {
setParameter() {
this.request.path = this.httpForm.path;
this.request.method = this.httpForm.method;
this.httpForm.request.useEnvironment = undefined;
if (this.httpForm && this.httpForm.request) {
this.httpForm.request.useEnvironment = undefined;
}
if (this.httpForm.tags instanceof Array) {
this.httpForm.tags = JSON.stringify(this.httpForm.tags);
}