From 7c3a919ff6d67b92513fd5cf6fa88bd670561cf1 Mon Sep 17 00:00:00 2001 From: zhaomeijing Date: Wed, 8 Jun 2022 14:39:43 +0800 Subject: [PATCH] =?UTF-8?q?[update]=20=E5=8F=82=E6=95=B0=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=20=E5=A4=8D=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dialog/ParameterTemplateAdd.vue | 140 +++++++----------- 1 file changed, 51 insertions(+), 89 deletions(-) diff --git a/jero-web/src/views/projectManagement/dialog/ParameterTemplateAdd.vue b/jero-web/src/views/projectManagement/dialog/ParameterTemplateAdd.vue index 4b1706c9c..dea089535 100644 --- a/jero-web/src/views/projectManagement/dialog/ParameterTemplateAdd.vue +++ b/jero-web/src/views/projectManagement/dialog/ParameterTemplateAdd.vue @@ -20,8 +20,6 @@ - - @@ -130,7 +128,8 @@ export default { confirmLoading: false, selectedRowKeys: [], pageNo: 1, - pageSize: 10 + pageSize: 10, + row: {} } }, props: { @@ -189,34 +188,6 @@ export default { handleCancel() { this.$emit('areaVisible', false) }, - // onGetCheckboxProps(val,value) { - // let _val = {} - // // 新增时没有 - // if(this.formData.id === undefined) { - // props : {} - // } else { - // // 编辑 - // props : { - // disabled: val.id === 'ce879dab56a243fd99119553d3899e62' - // } - // } - // console.log(this.formData.id,'this.formData.id') - // console.log(val) - // return(_val - // // { - // // props: { - // // - // // // console.log(value,'value') - // // // // 全部默认禁止选中 - // // // // disabled: true, - // // // // 某几项默认禁止选中(R: 当state等于1时) - // // disabled: val.id === 'ce879dab56a243fd99119553d3899e62' - // // // // 某几项默认选中(R: 当state等于1时) - // // // // defaultChecked: record.state == 1, - // // } - // // } - // ) - // }, onSelectChange(selectedRowKeys, selectedRowKeysDate) { this.selectedRowKeysDate = selectedRowKeysDate this.selectedRowKeys = selectedRowKeys @@ -230,12 +201,14 @@ export default { this.form = {} }, editData(edit) { - + // 编辑一行的数据 + this.row = edit this.formData = {...edit} this.selectedRowKeys = edit.paramsTemplateId.split(',') }, //新增 handleSubmit() { + console.log(this.row.version,'this.row.versionthis.row.version') if (this.selectedRowKeys.length == 0) { this.$message.warning(this.$t('pleaseSelectData')) } else if (this.selectedRowKeys.length > 1) { @@ -245,64 +218,53 @@ export default { if (valid) { this.flag = true this.spinLoading = true - // 新增編輯之前 判断 标题唯一 - getAction(`params/manifest/verifyTitle?projectId=${this.$route.query.id} - &title=${this.formData.title}`, {}) - .then(res => { - if (res.result) { - let postDate = { - title: this.formData.title, - paramsTemplateId: this.paramsTemplateId || this.selectedRowKeys[0], - paramsTemplatePublishVersion: this.selectedRowKeysDate[0].version, - projectId: this.projectId - } - if (this.formData.id) { - //编辑 - postDate = { - id : this.formData.id, - ...postDate - } - postAction(`params/manifest/edit`, postDate).then(res => { - if (res.success) { - this.newVisible = false - this.$emit('areaVisible', false) - this.$message.success(this.$t('OperationSuccessful')) - } else { - this.$message.warning(res.message) - } - } - ).finally(() => { - this.flag = false - this.spinLoading = false - this.newVisible = false - }) - } else { - //新增 - postAction(`params/manifest/add`, postDate).then(res => { - if (res.success) { - this.newVisible = false - this.$emit('areaVisible', false) - this.$message.success(this.$t('OperationSuccessful')) - } else { - this.$message.warning(res.message) - } - } - ).finally(() => { - this.flag = false - this.spinLoading = false - this.newVisible = false - }) - } - } else { - this.$message.warning(this.$t('changeTheTitle')) - this.spinLoading = false + let postDate = { + title: this.formData.title, + paramsTemplateId: this.paramsTemplateId || this.selectedRowKeys[0], + paramsTemplatePublishVersion: this.row.version, + projectId: this.projectId + } + if (this.formData.id) { + //编辑 + postDate = { + id : this.formData.id, + ...postDate } - }).finally(() => { - this.loading = false - }) - } else { - return false - } + postAction(`params/manifest/edit`, postDate).then(res => { + if (res.success) { + this.newVisible = false + this.$emit('areaVisible', false) + this.$message.success(this.$t('OperationSuccessful')) + } else { + this.$message.warning(res.message) + } + } + ).finally(() => { + this.flag = false + this.spinLoading = false + this.newVisible = false + }) + } else { + //新增 + postAction(`params/manifest/add`, postDate).then(res => { + if (res.success) { + this.newVisible = false + this.$emit('areaVisible', false) + this.$message.success(this.$t('OperationSuccessful')) + } else { + this.$message.warning(res.message) + } + } + ).finally(() => { + this.flag = false + this.spinLoading = false + this.newVisible = false + }) + } + } else { + this.$message.warning(this.$t('changeTheTitle')) + this.spinLoading = false + } }) } },