refactor(项目设置): 创建环境 不需要选择项目,环境名称一行显示
--story=1003804 --user=lyh 12.项目设置下 创建环境 不需要选择项目,环境名称一行显示 https://www.tapd.cn/55049933/s/1063853
This commit is contained in:
parent
52e4c2ffa8
commit
265de173b8
|
@ -1,9 +1,8 @@
|
||||||
<template>
|
<template>
|
||||||
<el-main v-loading="result.loading" class="environment-edit" style="margin-left: 0px">
|
<el-main v-loading="result.loading" class="environment-edit" style="margin-left: 0px">
|
||||||
<el-form :model="environment" :rules="rules" ref="environment">
|
<el-form :model="environment" :rules="rules" ref="environment" label-width="80px">
|
||||||
|
|
||||||
<span>{{$t('api_test.environment.name')}}</span>
|
<el-form-item prop="name" :label="$t('api_test.environment.name')">
|
||||||
<el-form-item prop="name">
|
|
||||||
<el-input v-model="environment.name" :disabled="isReadOnly" :placeholder="this.$t('commons.input_name')" clearable/>
|
<el-input v-model="environment.name" :disabled="isReadOnly" :placeholder="this.$t('commons.input_name')" clearable/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,8 @@
|
||||||
:delete-permission="['PROJECT_ENVIRONMENT:READ+DELETE']"
|
:delete-permission="['PROJECT_ENVIRONMENT:READ+DELETE']"
|
||||||
@editClick="editEnv(scope.row)" @deleteClick="deleteEnv(scope.row)">
|
@editClick="editEnv(scope.row)" @deleteClick="deleteEnv(scope.row)">
|
||||||
<template v-slot:middle>
|
<template v-slot:middle>
|
||||||
<ms-table-operator-button v-permission="['PROJECT_ENVIRONMENT:READ+COPY']" :tip="$t('commons.copy')"
|
<ms-table-operator-button v-permission="['PROJECT_ENVIRONMENT:READ+COPY']"
|
||||||
|
:tip="$t('commons.copy')"
|
||||||
@exec="copyEnv(scope.row)"
|
@exec="copyEnv(scope.row)"
|
||||||
icon="el-icon-document-copy" type="info"/>
|
icon="el-icon-document-copy" type="info"/>
|
||||||
</template>
|
</template>
|
||||||
|
@ -57,14 +58,6 @@
|
||||||
|
|
||||||
<!-- 创建、编辑、复制环境时的对话框 -->
|
<!-- 创建、编辑、复制环境时的对话框 -->
|
||||||
<el-dialog :visible.sync="dialogVisible" :close-on-click-modal="false" :title="dialogTitle" width="66%">
|
<el-dialog :visible.sync="dialogVisible" :close-on-click-modal="false" :title="dialogTitle" width="66%">
|
||||||
<div class="project-item">
|
|
||||||
<span>
|
|
||||||
{{$t('project.select')}}
|
|
||||||
</span>
|
|
||||||
<el-select style="width: 50%" @change="handleProjectChange" v-model="currentProjectId" filterable clearable>
|
|
||||||
<el-option v-for="item in projectList" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
|
||||||
</el-select>
|
|
||||||
</div>
|
|
||||||
<environment-edit :environment="currentEnvironment" ref="environmentEdit" @close="close"
|
<environment-edit :environment="currentEnvironment" ref="environmentEdit" @close="close"
|
||||||
:project-id="currentProjectId" @refreshAfterSave="refresh">
|
:project-id="currentProjectId" @refreshAfterSave="refresh">
|
||||||
</environment-edit>
|
</environment-edit>
|
||||||
|
@ -78,7 +71,8 @@
|
||||||
{{ getUrl(row) }}
|
{{ getUrl(row) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="type" :label="$t('api_test.environment.condition_enable')" show-overflow-tooltip min-width="100px">
|
<el-table-column prop="type" :label="$t('api_test.environment.condition_enable')" show-overflow-tooltip
|
||||||
|
min-width="100px">
|
||||||
<template v-slot:default="{row}">
|
<template v-slot:default="{row}">
|
||||||
{{ getName(row) }}
|
{{ getName(row) }}
|
||||||
</template>
|
</template>
|
||||||
|
@ -88,7 +82,8 @@
|
||||||
{{ getDetails(row) }}
|
{{ getDetails(row) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="createTime" show-overflow-tooltip min-width="120px" :label="$t('commons.create_time')">
|
<el-table-column prop="createTime" show-overflow-tooltip min-width="120px"
|
||||||
|
:label="$t('commons.create_time')">
|
||||||
<template v-slot:default="{row}">
|
<template v-slot:default="{row}">
|
||||||
<span>{{ row.time | timestampFormatDate }}</span>
|
<span>{{ row.time | timestampFormatDate }}</span>
|
||||||
</template>
|
</template>
|
||||||
|
@ -147,7 +142,7 @@
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
idNameMap: new Map(),
|
idNameMap: new Map(),
|
||||||
dialogTitle: '',
|
dialogTitle: '',
|
||||||
currentProjectId: '', //复制、创建、编辑环境时所选择项目的id
|
currentProjectId: getCurrentProjectID(), //复制、创建、编辑环境时所选择项目的id
|
||||||
selectRows: [],
|
selectRows: [],
|
||||||
isTesterPermission: false,
|
isTesterPermission: false,
|
||||||
domainVisible: false,
|
domainVisible: false,
|
||||||
|
@ -167,19 +162,6 @@
|
||||||
this.list();
|
this.list();
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
|
||||||
//当创建及复制环境所选择的项目变化时,改变当前环境对应的projectId
|
|
||||||
currentProjectId() {
|
|
||||||
// el-select什么都不选时值为'',为''的话也会被当成有效的projectId传给后端,转化使其无效
|
|
||||||
if (this.currentProjectId === '') {
|
|
||||||
this.currentEnvironment.projectId = null;
|
|
||||||
} else {
|
|
||||||
this.currentEnvironment.projectId = this.currentProjectId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
showInfo(row) {
|
showInfo(row) {
|
||||||
const config = JSON.parse(row.config);
|
const config = JSON.parse(row.config);
|
||||||
|
@ -250,10 +232,10 @@
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
createEnv() {
|
createEnv() {
|
||||||
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.currentEnvironment = new Environment();
|
this.currentEnvironment = new Environment();
|
||||||
|
this.currentEnvironment.projectId = this.currentProjectId;
|
||||||
},
|
},
|
||||||
search() {
|
search() {
|
||||||
this.list()
|
this.list()
|
||||||
|
@ -367,8 +349,7 @@
|
||||||
}
|
}
|
||||||
} else if (config.httpConfig.conditions.length > 1) {
|
} else if (config.httpConfig.conditions.length > 1) {
|
||||||
return "SHOW_INFO";
|
return "SHOW_INFO";
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -380,7 +361,6 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue