From c273d73467d7bea0883abc5c6caf1657cd638ce3 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Tue, 28 Dec 2021 15:58:49 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E5=BA=94=E7=94=A8=E7=AE=A1=E7=90=86):?= =?UTF-8?q?=20=E6=A0=B7=E5=BC=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project/menu/appmanage/AppManage.vue | 235 +++++++----------- .../settings/common/AppManageItem.vue | 112 +++++++++ 2 files changed, 207 insertions(+), 140 deletions(-) create mode 100644 frontend/src/business/components/settings/common/AppManageItem.vue diff --git a/frontend/src/business/components/project/menu/appmanage/AppManage.vue b/frontend/src/business/components/project/menu/appmanage/AppManage.vue index a2db59c250..baaa1d2fa5 100644 --- a/frontend/src/business/components/project/menu/appmanage/AppManage.vue +++ b/frontend/src/business/components/project/menu/appmanage/AppManage.vue @@ -2,95 +2,92 @@
- - - - - {{ this.$t('commons.my_workstation') }} - - -
- - - {{ this.$t('commons.enable_settings') }} - - -
-
- {{ - this.$t('project.public') - }} - {{ this.$t('project.public_info') }} - - -
- {{ - this.$t('project.test_case_custom_id') - }} - {{ this.$t('project.test_case_custom_id_info') }} - -
-
-
-
-
- - - - - {{ this.$t('commons.enable_settings') }} - - -
- {{ - this.$t('project.repeatable') - }} - {{ this.$t('project.repeatable_info') }} - - - {{ this.$t('project.scenario_custom_id') }} - {{ this.$t('project.scenario_custom_id_info') }} - - - {{ 'TCP Mock Port' }} - - -
-
-
- - - {{ this.$t('commons.view_settings') }} - - -
- {{ - this.$t('api_test.definition.api_quick_button') - }} - + + + + {{ $t('commons.my_workstation') }} + + + + + {{ this.$t('commons.enable_settings') }} + + + + + + + + + + + + + + + + + {{ $t('commons.enable_settings') }} + + + + + + + + + + + + + + + + + {{ $t('commons.view_settings') }} + + + + + + + + + - {{ - this.$t('commons.performance') - }} - - - + + + {{ this.$t('commons.enable_settings') }} + + + +
@@ -105,16 +102,16 @@ import MsMainContainer from "@/business/components/common/components/MsMainConta import { getCurrentProjectID, - getCurrentUser, getCurrentUserId, getCurrentWorkspaceId, - getUUID, hasLicense, - hasPermission + hasLicense, } from "@/common/js/utils"; +import AppManageItem from "@/business/components/settings/common/AppManageItem"; export default { name: "appManage", components: { + AppManageItem, MsMainContainer, MsContainer }, @@ -122,34 +119,14 @@ export default { return { activeName: 'test_track', form: {}, - labelWidth: '400px', count: 0, isXpack: false, result: {} }; }, created() { - this.result = this.$get('/project/get/' + this.projectId, res => { - this.form = res.data; - this.count = 0 - }) - if (hasLicense()) { - this.isXpack = true; - } else { - this.isXpack = false; - } - - }, - watch: { - form: { - handler(val, oldVal) { - this.count++; - if (this.count > 1) { - this.submitForm(); - } - }, - deep: true - } + this.init(); + this.isXpack = !!hasLicense(); }, computed: { projectId() { @@ -157,48 +134,26 @@ export default { }, }, methods: { - handleClick() { - - }, - submitForm() { + chooseChange() { this.form.workspaceId = getCurrentWorkspaceId(); this.form.createUser = getCurrentUserId(); - this.form.id = getCurrentProjectID(); - this.result = this.$post("/project/update", this.form, () => { + this.form.id = this.projectId; + this.$post("/project/update", this.form, () => { this.$success(this.$t('commons.save_success')); + this.init(); + }, () => { + this.init(); }); }, - chengeMockTcpSwitch(value) { - if (value && this.form.mockTcpPort === 0) { - this.result = this.$get('/project/genTcpMockPort/' + this.form.id, res => { - let port = res.data; - this.form.mockTcpPort = port; - }) - } + init() { + this.result = this.$get('/project/get/' + this.projectId, res => { + this.form = res.data; + }) } - } }; diff --git a/frontend/src/business/components/settings/common/AppManageItem.vue b/frontend/src/business/components/settings/common/AppManageItem.vue new file mode 100644 index 0000000000..590bc57c80 --- /dev/null +++ b/frontend/src/business/components/settings/common/AppManageItem.vue @@ -0,0 +1,112 @@ + + + + +