refactor: 用例列表全屏显示

This commit is contained in:
chenjianxing 2021-01-13 15:02:14 +08:00
parent 6f67e89a9d
commit b4d1b25cdf
2 changed files with 66 additions and 25 deletions

View File

@ -817,21 +817,23 @@
} }
}) })
// csv // csv
this.currentScenario.variables.forEach(param => { if (this.currentScenario.variables) {
if (param.type === 'CSV' && param.files) { this.currentScenario.variables.forEach(param => {
param.files.forEach(item => { if (param.type === 'CSV' && param.files) {
if (item.file) { param.files.forEach(item => {
if (!item.id) { if (item.file) {
let fileId = getUUID().substring(0, 12); if (!item.id) {
item.name = item.file.name; let fileId = getUUID().substring(0, 12);
item.id = fileId; item.name = item.file.name;
item.id = fileId;
}
obj.bodyUploadIds.push(item.id);
bodyUploadFiles.push(item.file);
} }
obj.bodyUploadIds.push(item.id); })
bodyUploadFiles.push(item.file); }
} })
}) }
}
})
return bodyUploadFiles; return bodyUploadFiles;
}, },
editScenario(showMessage) { editScenario(showMessage) {
@ -869,18 +871,20 @@
this.currentEnvironmentId = obj.environmentId; this.currentEnvironmentId = obj.environmentId;
this.currentScenario.variables = []; this.currentScenario.variables = [];
let index = 1; let index = 1;
obj.variables.forEach(item => { if (obj.variables) {
// obj.variables.forEach(item => {
if (item.name) { //
if (!item.type) { if (item.name) {
item.type = "CONSTANT"; if (!item.type) {
item.id = getUUID(); item.type = "CONSTANT";
item.id = getUUID();
}
item.num = index;
this.currentScenario.variables.push(item);
index++;
} }
item.num = index; })
this.currentScenario.variables.push(item); }
index++;
}
})
this.enableCookieShare = obj.enableCookieShare; this.enableCookieShare = obj.enableCookieShare;
this.scenarioDefinition = obj.hashTree; this.scenarioDefinition = obj.hashTree;
} }

View File

@ -8,6 +8,8 @@
<div class="ms-drawer-header"> <div class="ms-drawer-header">
<slot name="header"></slot> <slot name="header"></slot>
<i class="el-icon-close" @click="close"/> <i class="el-icon-close" @click="close"/>
<font-awesome-icon v-if="!isFullScreen && showFullScreen" class="alt-ico" :icon="['fa', 'expand-alt']" size="lg" @click="fullScreen"/>
<font-awesome-icon v-if="isFullScreen && showFullScreen" class="alt-ico" :icon="['fa', 'compress-alt']" size="lg" @click="unFullScreen"/>
</div> </div>
<div class="ms-drawer-body"> <div class="ms-drawer-body">
<slot></slot> <slot></slot>
@ -32,6 +34,9 @@
h: 100, h: 100,
directionStyle: 'left-style', directionStyle: 'left-style',
dragBarDirection: 'vertical', dragBarDirection: 'vertical',
isFullScreen: false,
originalW: 100,
originalH: 100,
} }
}, },
props: { props: {
@ -52,6 +57,12 @@
default() { default() {
return 40; return 40;
} }
},
showFullScreen: {
type: Boolean,
default() {
return true;
}
} }
}, },
mounted() { mounted() {
@ -101,6 +112,18 @@
getHeightPercentage(per) { getHeightPercentage(per) {
return document.body.clientHeight * per / 100.0; return document.body.clientHeight * per / 100.0;
}, },
fullScreen() {
this.originalW = this.w;
this.originalH = this.h;
this.w = document.body.clientWidth;
this.h = document.body.clientHeight;
this.isFullScreen = true;
},
unFullScreen() {
this.w = this.originalW;
this.h = this.originalH;
this.isFullScreen = false;
},
close() { close() {
this.$emit('close') this.$emit('close')
} }
@ -177,4 +200,18 @@
color: red; color: red;
} }
.alt-ico {
position: absolute;
font-size: 15px;
right: 40px;
top: 15px;
color: #8c939d;
}
.alt-ico:hover {
color: black;
font-size: 18px;
}
</style> </style>