feat(通用设置): 环境配置中环境删除时需增加提示信息
--user=郭雨琦 --bug=1008105 https://www.tapd.cn/55049933/prong/stories/view/1155049933001008105
This commit is contained in:
parent
59b6e5e556
commit
c0b9e7dcb8
|
@ -1,30 +1,44 @@
|
||||||
<template>
|
<template>
|
||||||
|
<div>
|
||||||
<el-dialog :close-on-click-modal="false" :title="$t('api_test.environment.environment_config')"
|
<el-dialog :close-on-click-modal="false" :title="$t('api_test.environment.environment_config')"
|
||||||
:visible.sync="visible" class="environment-dialog" width="60%"
|
:visible.sync="visible" class="environment-dialog" width="60%"
|
||||||
@close="close" append-to-body ref="environmentConfig">
|
@close="close" append-to-body destroy-on-close ref="environmentConfig">
|
||||||
<el-container v-loading="result.loading">
|
<el-container v-loading="result.loading">
|
||||||
<ms-aside-item :enable-aside-hidden="false" :title="$t('api_test.environment.environment_list')"
|
<ms-aside-item :enable-aside-hidden="false" :title="$t('api_test.environment.environment_list')"
|
||||||
:env-add-permission="['PROJECT_ENVIRONMENT:READ+CREATE']"
|
:env-add-permission="['PROJECT_ENVIRONMENT:READ+CREATE']"
|
||||||
:data="environments" :item-operators="environmentOperators" :add-fuc="addEnvironment"
|
:data="environments" :item-operators="environmentOperators" :add-fuc="addEnvironment"
|
||||||
:delete-fuc="deleteEnvironment" @itemSelected="environmentSelected" ref="environmentItems"/>
|
:delete-fuc="openDelEnv" @itemSelected="environmentSelected" ref="environmentItems"/>
|
||||||
<environment-edit :if-create="ifCreate" :environment="currentEnvironment" ref="environmentEdit" @close="close" :is-read-only="isReadOnly"/>
|
<environment-edit :if-create="ifCreate" :environment="currentEnvironment" ref="environmentEdit" @close="close"
|
||||||
|
:is-read-only="isReadOnly"/>
|
||||||
</el-container>
|
</el-container>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
<el-dialog
|
||||||
|
:visible.sync="delDialogVisible"
|
||||||
|
append-to-body
|
||||||
|
width="30%">
|
||||||
|
<span style="color: #de9d1c; font-size: 18px;padding-right: 5px"><i class="el-icon-warning"/></span><span
|
||||||
|
style="font-size: 18px">{{ $t('commons.confirm_delete') + currentEnvironment.name }}</span>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="delDialogVisible = false">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="delEnvironment">确 定</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import MsApiCollapse from "../collapse/ApiCollapse";
|
import MsApiCollapse from "../collapse/ApiCollapse";
|
||||||
import MsApiCollapseItem from "../collapse/ApiCollapseItem";
|
import MsApiCollapseItem from "../collapse/ApiCollapseItem";
|
||||||
import draggable from 'vuedraggable';
|
import draggable from 'vuedraggable';
|
||||||
import MsContainer from "../../../../common/components/MsContainer";
|
import MsContainer from "../../../../common/components/MsContainer";
|
||||||
import MsAsideContainer from "../../../../common/components/MsAsideContainer";
|
import MsAsideContainer from "../../../../common/components/MsAsideContainer";
|
||||||
import MsMainContainer from "../../../../common/components/MsMainContainer";
|
import MsMainContainer from "../../../../common/components/MsMainContainer";
|
||||||
import MsAsideItem from "../../../../common/components/MsAsideItem";
|
import MsAsideItem from "../../../../common/components/MsAsideItem";
|
||||||
import EnvironmentEdit from "./EnvironmentEdit";
|
import EnvironmentEdit from "./EnvironmentEdit";
|
||||||
import {deepClone, hasPermission, listenGoBack, removeGoBackListener} from "@/common/js/utils";
|
import {hasPermission, listenGoBack, removeGoBackListener} from "@/common/js/utils";
|
||||||
import {Environment, parseEnvironment} from "../../model/EnvironmentModel";
|
import {Environment, parseEnvironment} from "../../model/EnvironmentModel";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ApiEnvironmentConfig",
|
name: "ApiEnvironmentConfig",
|
||||||
components: {
|
components: {
|
||||||
EnvironmentEdit,
|
EnvironmentEdit,
|
||||||
|
@ -52,6 +66,8 @@
|
||||||
],
|
],
|
||||||
selectEnvironmentId: '',
|
selectEnvironmentId: '',
|
||||||
ifCreate: false, //是否是创建环境
|
ifCreate: false, //是否是创建环境
|
||||||
|
delDialogVisible: false,
|
||||||
|
currentIndex: -1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -68,15 +84,21 @@
|
||||||
listenGoBack(this.close);
|
listenGoBack(this.close);
|
||||||
},
|
},
|
||||||
deleteEnvironment(environment, index) {
|
deleteEnvironment(environment, index) {
|
||||||
|
alert(this.delDialogVisible);
|
||||||
|
if (this.delDialogVisible === false) {
|
||||||
|
this.delDialogVisible = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.ifCreate = false;
|
this.ifCreate = false;
|
||||||
if (environment.id) {
|
if (environment.id) {
|
||||||
this.result = this.$get('/api/environment/delete/' + environment.id, () => {
|
this.result = this.$get('/api/environment/delete/' + environment.id, () => {
|
||||||
this.$success(this.$t('commons.delete_success'));
|
this.$success(this.$t('commons.delete_success'));
|
||||||
this.getEnvironments();
|
this.getEnvironments();
|
||||||
|
this.delDialogVisible = false;
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
this.environments.splice(index, 1);
|
this.environments.splice(index, 1);
|
||||||
|
this.delDialogVisible = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
copyEnvironment(environment) {
|
copyEnvironment(environment) {
|
||||||
|
@ -151,7 +173,7 @@
|
||||||
getEnvironment(environment) {
|
getEnvironment(environment) {
|
||||||
parseEnvironment(environment);
|
parseEnvironment(environment);
|
||||||
this.currentEnvironment = environment;
|
this.currentEnvironment = environment;
|
||||||
if(this.currentEnvironment.name){
|
if (this.currentEnvironment.name) {
|
||||||
this.ifCreate = false;
|
this.ifCreate = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -160,24 +182,32 @@
|
||||||
this.visible = false;
|
this.visible = false;
|
||||||
this.$refs.environmentEdit.clearValidate();
|
this.$refs.environmentEdit.clearValidate();
|
||||||
removeGoBackListener(this.close);
|
removeGoBackListener(this.close);
|
||||||
|
},
|
||||||
|
openDelEnv(environment, index) {
|
||||||
|
this.currentEnvironment = environment;
|
||||||
|
this.currentIndex = index;
|
||||||
|
this.delDialogVisible = true
|
||||||
|
},
|
||||||
|
delEnvironment() {
|
||||||
|
this.deleteEnvironment(this.currentEnvironment, this.currentIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
.environment-dialog >>> .el-dialog__body {
|
.environment-dialog >>> .el-dialog__body {
|
||||||
padding-top: 20px;
|
padding-top: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-container {
|
.el-container {
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ms-aside-container {
|
.ms-aside-container {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,33 +1,47 @@
|
||||||
<template>
|
<template>
|
||||||
|
<div>
|
||||||
<el-dialog :close-on-click-modal="false" :title="$t('api_test.environment.environment_config')"
|
<el-dialog :close-on-click-modal="false" :title="$t('api_test.environment.environment_config')"
|
||||||
:visible.sync="visible" class="environment-dialog" width="80%" top="50px"
|
:visible.sync="visible" class="environment-dialog" width="60%"
|
||||||
@close="close" append-to-body destroy-on-close ref="environmentConfig">
|
@close="close" append-to-body destroy-on-close ref="environmentConfig">
|
||||||
<el-container v-loading="result.loading">
|
<el-container v-loading="result.loading">
|
||||||
<ms-aside-item :enable-aside-hidden="false" :title="$t('api_test.environment.environment_list')"
|
<ms-aside-item :enable-aside-hidden="false" :title="$t('api_test.environment.environment_list')"
|
||||||
:data="environments" :item-operators="environmentOperators" :add-fuc="addEnvironment"
|
:data="environments" :item-operators="environmentOperators" :add-fuc="addEnvironment"
|
||||||
:env-add-permission="ENV_CREATE"
|
:env-add-permission="ENV_CREATE"
|
||||||
:delete-fuc="deleteEnvironment" @itemSelected="environmentSelected" ref="environmentItems"/>
|
:delete-fuc="openDelEnv" @itemSelected="environmentSelected" ref="environmentItems"/>
|
||||||
<environment-edit :if-create="ifCreate" :project-id="projectId" :environment="currentEnvironment" ref="environmentEdit" :is-read-only="isReadOnly"
|
<environment-edit :if-create="ifCreate" :project-id="projectId" :environment="currentEnvironment"
|
||||||
|
ref="environmentEdit" :is-read-only="isReadOnly"
|
||||||
@confirm="save"
|
@confirm="save"
|
||||||
@close="close"/>
|
@close="close"/>
|
||||||
</el-container>
|
</el-container>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
<el-dialog
|
||||||
|
:visible.sync="delDialogVisible"
|
||||||
|
append-to-body
|
||||||
|
width="30%">
|
||||||
|
<span style="color: #de9d1c; font-size: 18px;padding-right: 5px"><i class="el-icon-warning"/></span><span
|
||||||
|
style="font-size: 18px">{{ $t('commons.confirm_delete') + currentEnvironment.name }}</span>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="delDialogVisible = false">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="delEnvironment">确 定</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import MsApiCollapse from "./collapse/ApiCollapse";
|
import MsApiCollapse from "./collapse/ApiCollapse";
|
||||||
import MsApiCollapseItem from "./collapse/ApiCollapseItem";
|
import MsApiCollapseItem from "./collapse/ApiCollapseItem";
|
||||||
import draggable from 'vuedraggable';
|
import draggable from 'vuedraggable';
|
||||||
import MsContainer from "../../../common/components/MsContainer";
|
import MsContainer from "../../../common/components/MsContainer";
|
||||||
import MsAsideContainer from "../../../common/components/MsAsideContainer";
|
import MsAsideContainer from "../../../common/components/MsAsideContainer";
|
||||||
import MsMainContainer from "../../../common/components/MsMainContainer";
|
import MsMainContainer from "../../../common/components/MsMainContainer";
|
||||||
import MsAsideItem from "../../../common/components/MsAsideItem";
|
import MsAsideItem from "../../../common/components/MsAsideItem";
|
||||||
import EnvironmentEdit from "./environment/EnvironmentEdit";
|
import EnvironmentEdit from "./environment/EnvironmentEdit";
|
||||||
import {deepClone, hasPermission, listenGoBack, removeGoBackListener} from "../../../../../common/js/utils";
|
import {hasPermission, listenGoBack, removeGoBackListener} from "../../../../../common/js/utils";
|
||||||
import {Environment, parseEnvironment} from "../model/EnvironmentModel";
|
import {Environment, parseEnvironment} from "../model/EnvironmentModel";
|
||||||
import MsDialogHeader from "@/business/components/common/components/MsDialogHeader";
|
import MsDialogHeader from "@/business/components/common/components/MsDialogHeader";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ApiEnvironmentConfig",
|
name: "ApiEnvironmentConfig",
|
||||||
components: {
|
components: {
|
||||||
EnvironmentEdit,
|
EnvironmentEdit,
|
||||||
|
@ -57,6 +71,8 @@
|
||||||
],
|
],
|
||||||
selectEnvironmentId: '',
|
selectEnvironmentId: '',
|
||||||
ifCreate: false, //是否是创建环境
|
ifCreate: false, //是否是创建环境
|
||||||
|
delDialogVisible: false,
|
||||||
|
currentIndex: -1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
@ -91,16 +107,22 @@
|
||||||
listenGoBack(this.close);
|
listenGoBack(this.close);
|
||||||
},
|
},
|
||||||
deleteEnvironment(environment, index) {
|
deleteEnvironment(environment, index) {
|
||||||
|
if (this.delDialogVisible === false) {
|
||||||
|
this.delDialogVisible = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.ifCreate = false;
|
this.ifCreate = false;
|
||||||
if (environment.id) {
|
if (environment.id) {
|
||||||
this.result = this.$get('/api/environment/delete/' + environment.id, () => {
|
this.result = this.$get('/api/environment/delete/' + environment.id, () => {
|
||||||
this.$success(this.$t('commons.delete_success'));
|
this.$success(this.$t('commons.delete_success'));
|
||||||
this.getEnvironments();
|
this.getEnvironments();
|
||||||
|
this.delDialogVisible = false;
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
this.environments.splice(index, 1);
|
this.environments.splice(index, 1);
|
||||||
|
this.delDialogVisible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
copyEnvironment(environment) {
|
copyEnvironment(environment) {
|
||||||
this.ifCreate = false;
|
this.ifCreate = false;
|
||||||
|
@ -176,11 +198,11 @@
|
||||||
getEnvironment(environment) {
|
getEnvironment(environment) {
|
||||||
parseEnvironment(environment);
|
parseEnvironment(environment);
|
||||||
this.currentEnvironment = environment;
|
this.currentEnvironment = environment;
|
||||||
if(this.currentEnvironment.name){
|
if (this.currentEnvironment.name) {
|
||||||
this.ifCreate = false;
|
this.ifCreate = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
save(){
|
save() {
|
||||||
this.$refs.environmentEdit.save();
|
this.$refs.environmentEdit.save();
|
||||||
},
|
},
|
||||||
close() {
|
close() {
|
||||||
|
@ -188,24 +210,32 @@
|
||||||
this.visible = false;
|
this.visible = false;
|
||||||
this.$refs.environmentEdit.clearValidate();
|
this.$refs.environmentEdit.clearValidate();
|
||||||
removeGoBackListener(this.close);
|
removeGoBackListener(this.close);
|
||||||
|
},
|
||||||
|
openDelEnv(environment, index) {
|
||||||
|
this.currentEnvironment = environment;
|
||||||
|
this.currentIndex = index;
|
||||||
|
this.delDialogVisible = true
|
||||||
|
},
|
||||||
|
delEnvironment() {
|
||||||
|
this.deleteEnvironment(this.currentEnvironment, this.currentIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
.environment-dialog >>> .el-dialog__body {
|
.environment-dialog >>> .el-dialog__body {
|
||||||
padding-top: 20px;
|
padding-top: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-container {
|
.el-container {
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ms-aside-container {
|
.ms-aside-container {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue