refactor(接口测试): 优化场景变量中不同的csv切换预览显示的问题
--bug=1028092 --user=王孝刚 【接口测试】接口自动化-场景变量-预览-切换-快速切换两次显示异常 https://www.tapd.cn/55049933/s/1396590
This commit is contained in:
parent
898feefec7
commit
f37a313e3e
|
@ -61,7 +61,8 @@
|
|||
</el-tab-pane>
|
||||
<el-tab-pane :label="$t('schema.preview')" name="preview">
|
||||
<div v-if="showMessage">{{ $t('variables.csv_message') }}</div>
|
||||
<el-table :data="previewData" style="width: 100%" height="200px" v-loading="loading">
|
||||
<el-table :data="previewData" style="width: 100%" height="200px" v-loading="loading"
|
||||
:key="editData.id">
|
||||
<!-- 自定义列的遍历-->
|
||||
<el-table-column
|
||||
v-for="(item, index) in columns"
|
||||
|
|
|
@ -37,11 +37,13 @@
|
|||
</el-input>
|
||||
</div>
|
||||
|
||||
<div style="float: right"
|
||||
<div
|
||||
style="float: right"
|
||||
v-permission="[
|
||||
'PROJECT_API_SCENARIO:READ+EDIT',
|
||||
'PROJECT_API_SCENARIO:READ+CREATE',
|
||||
'PROJECT_API_SCENARIO:READ+COPY',]">
|
||||
'PROJECT_API_SCENARIO:READ+COPY',
|
||||
]">
|
||||
<el-select
|
||||
v-model="selectType"
|
||||
:placeholder="$t('test_resource_pool.type')"
|
||||
|
@ -146,10 +148,17 @@
|
|||
<ms-edit-counter v-if="editData.type == 'COUNTER'" ref="counter" :editData.sync="editData" />
|
||||
<ms-edit-random v-if="editData.type == 'RANDOM'" ref="random" :editData.sync="editData" />
|
||||
<ms-edit-list-value v-if="editData.type == 'LIST'" ref="listValue" :editData="editData" />
|
||||
<ms-edit-csv v-if="editData.type === 'CSV' && !loading" ref="csv" :editData.sync="editData"
|
||||
<ms-edit-csv
|
||||
v-if="editData.type === 'CSV' && !loading"
|
||||
ref="csv"
|
||||
:editData.sync="editData"
|
||||
:disabled="disabled" />
|
||||
<div v-if="editData.type" style="float: right">
|
||||
<el-button size="small" style="margin-left: 10px" type="primary" @click="confirmVariable"
|
||||
<el-button
|
||||
size="small"
|
||||
style="margin-left: 10px"
|
||||
type="primary"
|
||||
@click="confirmVariable"
|
||||
v-permission="[
|
||||
'PROJECT_API_SCENARIO:READ+EDIT',
|
||||
'PROJECT_API_SCENARIO:READ+CREATE',
|
||||
|
@ -160,7 +169,11 @@
|
|||
<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"
|
||||
<el-button
|
||||
v-if="showDelete"
|
||||
size="small"
|
||||
style="margin-left: 10px"
|
||||
@click="deleteVariable"
|
||||
v-permission="[
|
||||
'PROJECT_API_SCENARIO:READ+EDIT',
|
||||
'PROJECT_API_SCENARIO:READ+CREATE',
|
||||
|
@ -203,12 +216,15 @@
|
|||
</el-tabs>
|
||||
<template v-slot:footer>
|
||||
<div>
|
||||
<el-button type="primary" @click="save"
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="save"
|
||||
v-permission="[
|
||||
'PROJECT_API_SCENARIO:READ+EDIT',
|
||||
'PROJECT_API_SCENARIO:READ+CREATE',
|
||||
'PROJECT_API_SCENARIO:READ+COPY',
|
||||
]">{{ $t('commons.confirm') }}
|
||||
]"
|
||||
>{{ $t('commons.confirm') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -240,7 +256,6 @@ import {getCustomTableHeader, getCustomTableWidth} from 'metersphere-frontend/sr
|
|||
import VariableImport from '@/business/automation/scenario/variable/VariableImport';
|
||||
import { hasPermissions } from 'metersphere-frontend/src/utils/permission';
|
||||
|
||||
|
||||
export default {
|
||||
name: 'MsVariableList',
|
||||
components: {
|
||||
|
@ -502,7 +517,6 @@ export default {
|
|||
this.visible = false;
|
||||
},
|
||||
close() {
|
||||
this.visible = false;
|
||||
let saveVariables = [];
|
||||
this.variables.forEach((item) => {
|
||||
item.hidden = undefined;
|
||||
|
@ -510,6 +524,11 @@ export default {
|
|||
item.showMore = false;
|
||||
saveVariables.push(item);
|
||||
}
|
||||
if (item.type === 'CSV' && item.files.length === 0) {
|
||||
this.$warning(this.$t('api_test.variable') + item.name + ' ' + this.$t('api_test.automation.csv_warning'));
|
||||
this.visible = true;
|
||||
return;
|
||||
}
|
||||
});
|
||||
this.selectVariable = '';
|
||||
this.searchType = '';
|
||||
|
@ -517,10 +536,12 @@ export default {
|
|||
this.editData = {};
|
||||
if (
|
||||
(diff(JSON.parse(JSON.stringify(this.variables)), this.variablesOld) ||
|
||||
diff(JSON.parse(JSON.stringify(this.headers)), this.headersOld))
|
||||
&& hasPermissions('PROJECT_API_SCENARIO:READ+EDIT',
|
||||
diff(JSON.parse(JSON.stringify(this.headers)), this.headersOld)) &&
|
||||
hasPermissions(
|
||||
'PROJECT_API_SCENARIO:READ+EDIT',
|
||||
'PROJECT_API_SCENARIO:READ+CREATE',
|
||||
'PROJECT_API_SCENARIO:READ+COPY')
|
||||
'PROJECT_API_SCENARIO:READ+COPY'
|
||||
)
|
||||
) {
|
||||
this.$emit('setVariables', saveVariables, this.headers);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue