refactor(接口测试): 优化场景变量保存提示 (#12783)
--bug=1012377 --user=王孝刚 [接口测试]github#12753优化场景变量保存提示 https://www.tapd.cn/55049933/s/1138564 Co-authored-by: wxg0103 <727495428@qq.com>
This commit is contained in:
parent
c5c5e76fed
commit
8b85321494
|
@ -26,14 +26,17 @@
|
|||
</div>
|
||||
|
||||
<div style="float: right">
|
||||
<el-select v-model="selectType" :placeholder="$t('test_resource_pool.type')" style="width: 90px" size="small" @change="filter">
|
||||
<el-select v-model="selectType" :placeholder="$t('test_resource_pool.type')" style="width: 90px"
|
||||
size="small" @change="filter">
|
||||
<el-option value="CONSTANT" :label="$t('api_test.automation.constant')"></el-option>
|
||||
<el-option value="LIST" :label="$t('test_track.case.list')"></el-option>
|
||||
<el-option value="CSV" label="CSV"></el-option>
|
||||
<el-option value="COUNTER" :label="$t('api_test.automation.counter')"></el-option>
|
||||
<el-option value="RANDOM" :label="$t('api_test.automation.random')"></el-option>
|
||||
</el-select>
|
||||
<el-button size="small" style="margin-left: 10px" type="primary" @click="addVariable">{{ $t('commons.add') }}</el-button>
|
||||
<el-button size="small" style="margin-left: 10px" type="primary" @click="addVariable">
|
||||
{{ $t('commons.add') }}
|
||||
</el-button>
|
||||
<el-link @click="batchAddParameter" type="primary" :disabled="disabled" style="margin-left: 10px">
|
||||
{{ $t("commons.batch_add") }}
|
||||
</el-link>
|
||||
|
@ -102,9 +105,16 @@
|
|||
<ms-edit-list-value v-if="editData.type=='LIST'" ref="listValue" :editData="editData"/>
|
||||
<ms-edit-csv v-if="editData.type=='CSV'" ref="csv" :editData.sync="editData"/>
|
||||
<div v-if="editData.type" style="float: right">
|
||||
<el-button size="small" style="margin-left: 10px" type="primary" @click="confirmVariable">{{ $t('commons.confirm') }}</el-button>
|
||||
<el-button size="small" style="margin-left: 10px" @click="cancelVariable">{{ $t('commons.cancel') }}</el-button>
|
||||
<el-button v-if="showDelete" size="small" style="margin-left: 10px" @click="deleteVariable">{{ $t('commons.delete') }}</el-button>
|
||||
<el-button size="small" style="margin-left: 10px" type="primary" @click="confirmVariable">
|
||||
{{ $t('commons.confirm') }}
|
||||
</el-button>
|
||||
<el-button size="small" style="margin-left: 10px" @click="cancelVariable">{{
|
||||
$t('commons.cancel')
|
||||
}}
|
||||
</el-button>
|
||||
<el-button v-if="showDelete" size="small" style="margin-left: 10px" @click="deleteVariable">
|
||||
{{ $t('commons.delete') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
@ -142,28 +152,30 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import MsEditConstant from "./EditConstant";
|
||||
import MsDialogFooter from "../../../../common/components/MsDialogFooter";
|
||||
import MsTableHeader from "@/business/components/common/components/MsTableHeader";
|
||||
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
|
||||
import MsEditCounter from "./EditCounter";
|
||||
import MsEditRandom from "./EditRandom";
|
||||
import MsEditListValue from "./EditListValue";
|
||||
import MsEditCsv from "./EditCsv";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
import MsApiKeyValue from "../../../definition/components/ApiKeyValue";
|
||||
import BatchAddParameter from "../../../definition/components/basis/BatchAddParameter";
|
||||
import {KeyValue} from "../../../definition/model/ApiTestModel";
|
||||
import {REQUEST_HEADERS} from "@/common/js/constants";
|
||||
import MsEditConstant from "./EditConstant";
|
||||
import MsDialogFooter from "../../../../common/components/MsDialogFooter";
|
||||
import MsTableHeader from "@/business/components/common/components/MsTableHeader";
|
||||
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
|
||||
import MsEditCounter from "./EditCounter";
|
||||
import MsEditRandom from "./EditRandom";
|
||||
import MsEditListValue from "./EditListValue";
|
||||
import MsEditCsv from "./EditCsv";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
import MsApiKeyValue from "../../../definition/components/ApiKeyValue";
|
||||
import BatchAddParameter from "../../../definition/components/basis/BatchAddParameter";
|
||||
import {KeyValue} from "../../../definition/model/ApiTestModel";
|
||||
import {REQUEST_HEADERS} from "@/common/js/constants";
|
||||
|
||||
import MsTable from "@/business/components/common/components/table/MsTable";
|
||||
import MsTableColumn from "@/business/components/common/components/table/MsTableColumn";
|
||||
import {
|
||||
import MsTable from "@/business/components/common/components/table/MsTable";
|
||||
import MsTableColumn from "@/business/components/common/components/table/MsTableColumn";
|
||||
import {
|
||||
getCustomTableWidth,
|
||||
getCustomTableHeader
|
||||
} from "@/common/js/tableUtils";
|
||||
} from "@/common/js/tableUtils";
|
||||
|
||||
export default {
|
||||
const jsondiffpatch = require('jsondiffpatch');
|
||||
|
||||
export default {
|
||||
name: "MsVariableList",
|
||||
components: {
|
||||
MsEditConstant,
|
||||
|
@ -183,6 +195,8 @@
|
|||
return {
|
||||
variables: [],
|
||||
headers: [],
|
||||
variablesOld: [],
|
||||
headersOld: [],
|
||||
activeName: "variable",
|
||||
searchType: "",
|
||||
selectVariable: "",
|
||||
|
@ -310,7 +324,7 @@
|
|||
this.updateFiles();
|
||||
let datas = [];
|
||||
this.variables.forEach(item => {
|
||||
if(item.id === v.id){
|
||||
if (item.id === v.id) {
|
||||
item = v;
|
||||
}
|
||||
datas.push(item);
|
||||
|
@ -327,6 +341,8 @@
|
|||
if (headers) {
|
||||
this.headers = headers;
|
||||
}
|
||||
this.variablesOld = JSON.parse(JSON.stringify(this.variables));
|
||||
this.headersOld = JSON.parse(JSON.stringify(this.headers));
|
||||
this.visible = true;
|
||||
this.disabled = disabled;
|
||||
},
|
||||
|
@ -344,10 +360,12 @@
|
|||
});
|
||||
this.selectVariable = "";
|
||||
this.searchType = "";
|
||||
if (jsondiffpatch.diff(JSON.parse(JSON.stringify(this.variables)), this.variablesOld) || jsondiffpatch.diff(JSON.parse(JSON.stringify(this.headers)), this.headersOld)) {
|
||||
this.$emit('setVariables', saveVariables, this.headers);
|
||||
}
|
||||
},
|
||||
addVariable() {
|
||||
this.editData = {delimiter: ",", quotedData: 'false',files:[]};
|
||||
this.editData = {delimiter: ",", quotedData: 'false', files: []};
|
||||
this.editData.type = this.selectType;
|
||||
this.showDelete = false;
|
||||
this.$refs.variableTable.cancelCurrentRow();
|
||||
|
@ -358,9 +376,9 @@
|
|||
return;
|
||||
}
|
||||
// 更新场景,修改左边数据
|
||||
if(this.showDelete){
|
||||
if (this.showDelete) {
|
||||
this.updateParameters(this.editData);
|
||||
}else{
|
||||
} else {
|
||||
// 新增场景,往左边新加
|
||||
this.addParameters(this.editData);
|
||||
this.addVariable();
|
||||
|
@ -454,7 +472,7 @@
|
|||
} else {
|
||||
item.hidden = undefined;
|
||||
}
|
||||
if(this.searchType === 'ALL' && !((this.selectVariable && this.selectVariable != ""))){
|
||||
if (this.searchType === 'ALL' && !((this.selectVariable && this.selectVariable != ""))) {
|
||||
item.hidden = undefined;
|
||||
}
|
||||
datas.push(item);
|
||||
|
@ -472,44 +490,44 @@
|
|||
this.updateFiles();
|
||||
this.showDelete = true;
|
||||
},
|
||||
updateFiles(){
|
||||
updateFiles() {
|
||||
this.variables.forEach(item => {
|
||||
if(item.id === this.editData.id){
|
||||
if (item.id === this.editData.id) {
|
||||
this.editData.files = item.files
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.ms-variable-hidden-row {
|
||||
.ms-variable-hidden-row {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.ms-variable-header {
|
||||
.ms-variable-header {
|
||||
background: #783887;
|
||||
color: white;
|
||||
height: 18px;
|
||||
border-radius: 42%;
|
||||
}
|
||||
}
|
||||
|
||||
.ms-variable-link {
|
||||
.ms-variable-link {
|
||||
float: right;
|
||||
margin-right: 45px;
|
||||
}
|
||||
}
|
||||
|
||||
fieldset {
|
||||
fieldset {
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
min-width: 100%;
|
||||
min-inline-size: 0px;
|
||||
border: 0px;
|
||||
}
|
||||
}
|
||||
|
||||
.ms-select {
|
||||
.ms-select {
|
||||
width: 100px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue