From a200c37cb828d6049fc1a4bbaebe16eff149ecfd Mon Sep 17 00:00:00 2001 From: zhaomeijing <3223191529@qq.com> Date: Fri, 6 May 2022 23:50:31 +0800 Subject: [PATCH] =?UTF-8?q?[update]=20=E8=AE=A4=E8=AF=81=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E6=94=B6=E9=9B=86-=E7=B7=A8=E8=BC=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/TaskParameterCollection.vue | 26 ++- .../dialog/ParameterTemplate.vue | 175 +++++++++--------- 2 files changed, 108 insertions(+), 93 deletions(-) diff --git a/jero-web/src/views/projectManagement/components/TaskParameterCollection.vue b/jero-web/src/views/projectManagement/components/TaskParameterCollection.vue index 33d7c7a9c..8ad340c2c 100644 --- a/jero-web/src/views/projectManagement/components/TaskParameterCollection.vue +++ b/jero-web/src/views/projectManagement/components/TaskParameterCollection.vue @@ -68,7 +68,8 @@ /> - + @@ -137,6 +138,7 @@ list: 'params/manifest/page', add: 'params/manifest/add', edit: 'params/manifest/edit', + queryById: 'params/manifest/queryById', deleteBatch: 'params/manifest/delete', deleteAll: 'params/manifest/deleteBatch', }, @@ -147,6 +149,10 @@ pageSize: 10, total: 0, selectedRowKeysArray: '', + templatetitle: '', + templatetitleId: '', + rowId: '', + version: 0 } }, mounted() { @@ -190,7 +196,23 @@ this.selectedRowKeysArray = val.join(',') }, edit(edit){ - + this.areaVisible = true + let _this = this + let query = { + id: edit.id + } + getAction(_this.url.queryById, query).then((res) => { + if (res.success) { + console.log(res,'res..') + this.templatetitle = res.result.title + this.selectedRowKeys = res.result.paramsTemplateId.split(',') + this.rowId = res.result.id + this.version = res.result.paramsTemplatePublishVersion + console.log(this.selectedRowKeys,'this.selectedRowKeys') + console.log(typeof this.version) + } else { + } + }) }, handleExport(){ diff --git a/jero-web/src/views/projectManagement/dialog/ParameterTemplate.vue b/jero-web/src/views/projectManagement/dialog/ParameterTemplate.vue index 4ccb88b4f..16bc52c35 100644 --- a/jero-web/src/views/projectManagement/dialog/ParameterTemplate.vue +++ b/jero-web/src/views/projectManagement/dialog/ParameterTemplate.vue @@ -13,24 +13,24 @@ + v-model='templatetitle' /> - {{$t('query')}} - {{$t('reset')}} + {{ $t('query') }} + {{ $t('reset') }} - - + + :triggerChange='false' :dictCode="'region'" /> @@ -62,9 +62,9 @@ v-has="'area:delete'">{{ $t('delete') }} -
- {{$t('cancel')}} - {{$t('submit')}} +
+ {{ $t('cancel') }} + {{ $t('submit') }}
@@ -77,13 +77,10 @@ export default { components: {}, data() { return { - templatetitle: '', title: this.$t('add'), total: 0, - selectedRowKeys: [], selectedRowKeysDate: {}, loading: false, - ipagination: true, editId: '', columns: [ { @@ -118,10 +115,33 @@ export default { areaTable: [], flag: false, //表单提交标识 spinLoading: false, - confirmLoading: false + confirmLoading: false, + templatetitle: '', + selectedRowKeys: [] + } + }, + props: { + templateTitle: { + type: String, + default: '', + required: false + }, + selectedRowKeyS: { + type: Array, + default: '', + required: false + }, + rowId: { + type: String, + default: '', + required: false + }, + version: { + type: Number, + default: '', + required: false } }, - props: {}, mounted() { this.loadData() }, @@ -141,16 +161,16 @@ export default { }) }, searchQuery() { - this.loadData() + this.loadData() }, searchReset() { - this.form = {} - this.loadData() + this.form = {} + this.loadData() }, handleCancel() { - this.$emit('areaVisible',false) + this.$emit('areaVisible', false) }, - onSelectChange(selectedRowKeys,selectedRowKeysDate) { + onSelectChange(selectedRowKeys, selectedRowKeysDate) { this.selectedRowKeysDate = selectedRowKeysDate this.selectedRowKeys = selectedRowKeys }, @@ -163,62 +183,31 @@ export default { }, //新增 handleSubmit() { - if(this.selectedRowKeys.length == 0) { + if (this.selectedRowKeys.length == 0) { this.$message.warning(this.$t('pleaseSelectData')) - } else if(this.selectedRowKeys.length > 1) { + } else if (this.selectedRowKeys.length > 1) { this.$message.warning(this.$t('OnlyOneSelected')) } else { this.$refs.ruleForm.validate(valid => { if (valid) { this.flag = true this.spinLoading = true - //编辑 - if (this.form.id) { - // putAction(`tag/onlCgformArea/edit`, this.form).then((res) => { - // if (res.success) { - // this.$message.success(this.$t('OperationSuccessful')) - // this.loadData() - // this.form = { - // isModel: '', - // showArea: '', - // enName: '', - // sort: '' - // } - // } else { - // this.$message.warning(res.message) - // this.form = { - // isModel: '', - // showArea: '', - // enName: '', - // sort: '' - // } - // } - // }).finally(() => { - // this.flag = false - // this.spinLoading = false - // this.newVisible = false - // this.form = { - // isModel: '', - // showArea: '', - // enName: '', - // sort: '' - // } - // }) - } else { - // 新增之前 判断 标题唯一 - getAction(`params/manifest/verifyTitle?projectId=${this.$route.query.id}&title=${this.templatetitle}`, {}).then(res => { - if (res.success) { - console.log(this.selectedRowKeys[0]) - let postDate = { - title: this.templatetitle, - paramsTemplateId : this.selectedRowKeysDate[0].id, - paramsTemplatePublishVersion: this.selectedRowKeysDate[0].version - } - //新增 - postAction(`params/manifest/add`, postDate).then(res => { + // 新增編輯之前 判断 标题唯一 + getAction(`params/manifest/verifyTitle?projectId=${this.$route.query.id} + &title=${this.templatetitle}`, {}) + .then(res => { + if (res.success) { + let postDate = { + title: this.templatetitle, + paramsTemplateId: this.rowId || this.selectedRowKeysDate[0].id, + paramsTemplatePublishVersion: this.version || this.selectedRowKeysDate[0].version + } + if (this.rowId) { + //编辑 + postAction(`params/manifest/edit`, postDate).then(res => { if (res.success) { this.newVisible = false - this.$emit('areaVisible',false) + this.$emit('areaVisible', false) this.$message.success(this.$t('OperationSuccessful')) } else { this.$message.warning(res.message) @@ -230,12 +219,28 @@ export default { this.newVisible = false }) } else { - this.$message.warning(res.message) + //新增 + 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 + }) } - }).finally(() => { - this.loading = false - }) - } + } else { + this.$message.warning(res.message) + } + }).finally(() => { + this.loading = false + }) } else { return false } @@ -286,29 +291,17 @@ export default { } }) + } + }, + watch: { + templateTitle(val) { + this.templatetitle = val }, - //点击页数 - onChangePage(page, pageSize) { - this.queryParams.pageNo = page - this.loadData() - }, - //一页显示条数 - SizeChange(page, pageSize) { - this.queryParams.pageSize = pageSize - this.queryParams.pageNo = 1 - this.loadData() - }, - //正则替换小数点 - limitNumber(value) { - if (typeof value === 'string') { - return !isNaN(Number(value)) ? value.replace(/\./g, '') : 0 - } else if (typeof value === 'number') { - return !isNaN(value) ? String(value).replace(/\./g, '') : 0 - } else { - return 0 - } + selectedRowKeyS(val) { + this.selectedRowKeys = val } } + }