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

View File

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

View File

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