refactor(系统设置): 全局前后置脚本新增变更历史功能优化

This commit is contained in:
junhong 2022-02-14 22:42:07 +08:00 committed by zhangdahai112
parent 4290ece1a0
commit 9311cd828a
3 changed files with 24 additions and 24 deletions

View File

@ -5,6 +5,10 @@
<el-form-item prop="name" :label="$t('api_test.environment.name')">
<el-input v-model="environment.name" :disabled="isReadOnly" :placeholder="this.$t('commons.input_name')"
clearable/>
<ms-dialog-header class="ms-opt-btn"
:btn-size="'medium'"
@cancel="cancel"
@confirm="save()"/>
</el-form-item>
@ -30,7 +34,7 @@
:is-read-only="isReadOnly"/>
</el-tab-pane>
<el-tab-pane :label="$t('api_test.definition.request.all_pre_script')" name="prescript">
<div style="padding-bottom: 20px;">
<div style="padding-bottom: 20px;" v-if="!ifCreate">
<el-link style="float: right;" type="primary" @click="openHis">
{{ $t('operating_log.change_history') }}
</el-link>
@ -47,7 +51,7 @@
@updateGlobalScript="updateGlobalScript"/>
</el-tab-pane>
<el-tab-pane :label="$t('api_test.definition.request.all_post_script')" name="postscript">
<div style="padding-bottom: 20px;">
<div style="padding-bottom: 20px;" v-if="!ifCreate">
<el-link style="float: right;" type="primary" @click="openHis">
{{ $t('operating_log.change_history') }}
</el-link>
@ -138,6 +142,10 @@ export default {
type: Boolean,
default: false
},
ifCreate: {
type: Boolean,
default: false
},
},
data() {
return {
@ -382,20 +390,11 @@ export default {
<style scoped>
.el-main {
border: solid 1px #EBEEF5;
margin-left: 200px;
min-height: 400px;
max-height: 550px;
}
.el-row {
margin-bottom: 15px;
}
.environment-footer {
margin-top: 15px;
float: right;
.ms-opt-btn {
position: fixed;
right: 290px;
z-index: 10;
top: 80px;
}
span {

View File

@ -58,7 +58,7 @@
<!-- 创建编辑复制环境时的对话框 -->
<el-dialog :visible.sync="dialogVisible" :close-on-click-modal="false" :title="dialogTitle" width="66%" top="50px">
<environment-edit :environment="currentEnvironment" ref="environmentEdit" @close="close"
<environment-edit :if-create="ifCreate" :environment="currentEnvironment" ref="environmentEdit" @close="close"
:project-id="currentProjectId" @refreshAfterSave="refresh">
</environment-edit>
</el-dialog>
@ -162,6 +162,7 @@ export default {
projectIds: [], //id
projectFilters: [],
screenHeight: 'calc(100vh - 195px)',
ifCreate: false, //
}
},
created() {
@ -253,6 +254,7 @@ export default {
this.dialogVisible = true;
this.currentEnvironment = new Environment();
this.currentEnvironment.projectId = this.currentProjectId;
this.ifCreate = true;
},
search() {
this.list()
@ -265,6 +267,7 @@ export default {
parseEnvironment(temEnv); //parseEnvironment
this.currentEnvironment = temEnv;
this.dialogVisible = true;
this.ifCreate = false;
},
copyEnv(environment) {

View File

@ -63,11 +63,6 @@
<!-- 创建编辑复制环境时的对话框 -->
<el-dialog :visible.sync="dialogVisible" :close-on-click-modal="false" :title="dialogTitle" top="50px" width="66%">
<ms-dialog-header
style="margin-bottom: 10px; float: right;"
:btn-size="'medium'"
@cancel="close"
@confirm="save()"/>
<el-form label-width="80px" :rules="rules" style="display: flow-root">
<el-form-item class="project-item" prop="currentProjectId" :label="$t('project.select')">
<el-select @change="handleProjectChange" v-model="currentProjectId" filterable clearable>
@ -75,7 +70,7 @@
</el-select>
</el-form-item>
</el-form>
<environment-edit :environment="currentEnvironment" ref="environmentEdit" @close="close"
<environment-edit :if-create="ifCreate" :environment="currentEnvironment" ref="environmentEdit" @close="close"
:project-id="currentProjectId" @refreshAfterSave="refresh">
</environment-edit>
</el-dialog>
@ -196,7 +191,8 @@ export default {
{
name: this.$t('workspace.env_group.batch_add_to_ws'), handleClick: this.batchAddToGroup
},
]
],
ifCreate: false, //
};
},
created() {
@ -301,6 +297,7 @@ export default {
this.currentProjectId = '';
this.dialogTitle = this.$t('api_test.environment.create');
this.dialogVisible = true;
this.ifCreate = true;
this.currentEnvironment = new Environment();
},
search() {
@ -314,6 +311,7 @@ export default {
parseEnvironment(temEnv); //parseEnvironment
this.currentEnvironment = temEnv;
this.dialogVisible = true;
this.ifCreate = false;
},
save(){
this.$refs.environmentEdit.save();