From e9554cfbe214ce3dc182996a85731b70eb59c8c9 Mon Sep 17 00:00:00 2001 From: sunFlower <787203167@qq.com> Date: Mon, 17 Oct 2022 14:51:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B8=83=E5=B1=80=E9=A1=B9=E7=9B=AE=E5=BA=93?= =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/changeExtensionModel.vue | 40 ++++++++++++------- .../projectLibrary/index.vue | 2 +- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/jero-web/src/views/projectManagement/projectLibrary/components/changeExtensionModel.vue b/jero-web/src/views/projectManagement/projectLibrary/components/changeExtensionModel.vue index 645b46d43..4702d7eaa 100644 --- a/jero-web/src/views/projectManagement/projectLibrary/components/changeExtensionModel.vue +++ b/jero-web/src/views/projectManagement/projectLibrary/components/changeExtensionModel.vue @@ -70,13 +70,13 @@ trigger: 'blur' } ], - projectVersion:[ + projectVersion: [ { required: true, message: this.$t('projectVersion') + this.$t('cannotEmpty'), trigger: 'blur' } - ], + ] }, disabled: false, projectNameList: [], @@ -98,7 +98,28 @@ }, editModel(value) { this.visible = true - this.formInline = value + this.formInline.id = value.id + if (!value.children) { + this.formInline.projectVersion = '01' + } else if (value.children && value.children.length > 0) { + let projectVersion = value.children[value.children.length - 1].projectVersion + if (projectVersion.slice(0, 1) == '0') { + let num = projectVersion.slice(1, 2) + let numIndex = parseInt(num) + 1 + if (numIndex.length == 1) { + this.formInline.projectVersion = '0' + numIndex + } else { + this.formInline.projectVersion = numIndex + } + } else { + let index = parseInt(projectVersion) + 1 + if (index.length == 1) { + this.formInline.projectVersion = '0' + index + } else { + this.formInline.projectVersion = index + } + } + } this.formInline = { ...this.formInline } this.$nextTick(() => { this.$refs.ruleForm.clearValidate() @@ -110,15 +131,6 @@ handleSubmit() { this.$refs.ruleForm.validate(valid => { if (valid) { - let url = '' - let Action - if (this.formInline.id) { - url = this.url.edit - Action = putAction - } else { - url = this.url.add - Action = postAction - } let query = JSON.parse(JSON.stringify(this.formInline)) Object.keys(query).forEach(res => { if (query[res] && query[res] instanceof Array) { @@ -126,12 +138,12 @@ } }) this.confirmLoading = true - Action(url, query).then((res) => { + postAction('/project/projectLibraryBase/addChild', query).then((res) => { if (res.success) { this.confirmLoading = false this.$message.success(this.$t('OperationSuccessful')) this.visible = false - this.$emit('addModelList') + this.$emit('changeExtensionForm') } else { this.$message.warning(res.message) this.confirmLoading = false diff --git a/jero-web/src/views/projectManagement/projectLibrary/index.vue b/jero-web/src/views/projectManagement/projectLibrary/index.vue index 767b76a02..64b5a9793 100644 --- a/jero-web/src/views/projectManagement/projectLibrary/index.vue +++ b/jero-web/src/views/projectManagement/projectLibrary/index.vue @@ -272,7 +272,7 @@ this.toggleSearchStatus = !this.toggleSearchStatus }, changeExtensionClick(val) { - this.$refs.changeExtensionModelRef.addModel(JSON.parse(JSON.stringify(val))) + this.$refs.changeExtensionModelRef.editModel(JSON.parse(JSON.stringify(val))) }, changeExtensionForm() {