From 226972e7a80d1f048cecbf4ad3bf1dd2ffacf5f7 Mon Sep 17 00:00:00 2001 From: caoyang Date: Thu, 10 Mar 2022 15:05:44 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../documentManage/tags/dialog/dicList.vue | 120 ++++++++++-------- .../documentManage/tags/tabs/tagContent.vue | 16 ++- 2 files changed, 74 insertions(+), 62 deletions(-) diff --git a/jero-web/src/views/documentManage/tags/dialog/dicList.vue b/jero-web/src/views/documentManage/tags/dialog/dicList.vue index 3ed82de1d..d56b33642 100644 --- a/jero-web/src/views/documentManage/tags/dialog/dicList.vue +++ b/jero-web/src/views/documentManage/tags/dialog/dicList.vue @@ -257,64 +257,70 @@ }, //保存 hideModal(){ - if(this.dictVal=='list') { - let params = { - ...this.form, - dictId: this.record.id - } - if (this.isEdit) { - putAction(`sys/dictItem/edit`, params).then(res => { - if (res.success) { - this.$message.success(this.$t('OperationSuccessful')) - this.form={} - this.loadData() - this.newVisible = false + + this.$refs.ruleForm.validate(valid => { + if (valid) { + if(this.dictVal=='list') { + let params = { + ...this.form, + dictId: this.record.id + } + if (this.isEdit) { + putAction(`sys/dictItem/edit`, params).then(res => { + if (res.success) { + this.$message.success(this.$t('OperationSuccessful')) + this.form = {} + this.loadData() + this.newVisible = false + } else { + this.$message.warning(this.$t('operationFailed')) + } + }) } else { - this.$message.warning(this.$t('operationFailed')) + postAction(`sys/dictItem/add`, params).then(res => { + if (res.success) { + this.$message.success(this.$t('OperationSuccessful')) + this.form = {} + this.loadData() + this.newVisible = false + } else { + this.$message.warning(this.$t('operationFailed')) + } + }) } - }) - } else { - postAction(`sys/dictItem/add`, params).then(res => { - if (res.success) { - this.$message.success(this.$t('OperationSuccessful')) - this.form={} - this.loadData() - this.newVisible = false + } else if (this.dictVal == 'tree') { + console.log('tree1111') + let params = { + ...this.form, + sysDictId: this.record.id + } + if (this.isEdit) { + putAction(`sys/category/edit`, params).then(res => { + if (res.success) { + this.$message.success(this.$t('OperationSuccessful')) + this.form = {} + this.loadData() + this.newVisible = false + } else { + this.$message.warning(this.$t('operationFailed')) + } + }) } else { - this.$message.warning(this.$t('operationFailed')) + //新增 + postAction(`sys/category/add`, params).then(res => { + if (res.success) { + this.$message.success(this.$t('OperationSuccessful')) + this.form = {} + this.loadData() + this.newVisible = false + } else { + this.$message.warning(this.$t('operationFailed')) + } + }) } - }) + } } - }else if(this.dictVal=='tree'){ - let params = { - ...this.form, - sysDictId: this.record.id - } - if (this.isEdit) { - putAction(`sys/category/edit`,params).then(res=>{ - if(res.success){ - this.$message.success(this.$t('OperationSuccessful')) - this.form={} - this.loadData() - this.newVisible = false - }else { - this.$message.warning(this.$t('operationFailed')) - } - }) - }else{ - //新增 - postAction(`sys/category/add`, params).then(res => { - if (res.success) { - this.$message.success(this.$t('OperationSuccessful')) - this.form={} - this.loadData() - this.newVisible = false - } else { - this.$message.warning(this.$t('operationFailed')) - } - }) - } - } + }) }, //取消 cancelModel(){ @@ -355,7 +361,7 @@ deleteAction(`sys/dictItem/delete`, params).then(res => { if(res.success) { this.$message.success(this.$t('OperationSuccessful')); - if(this.tableData&&this.tableData.length==1){ + if(this.tableData&&this.tableData.length==1&&this.queryParams.pageNo!=1){ this.queryParams.pageNo=this.queryParams.pageNo-1 } this.loadData() @@ -385,9 +391,11 @@ onOk: async () => { if(this.dictVal=='list'){ - deleteAction(`sys/dictItem/logicdeleteBatch`, params).then(res => { + deleteAction(`sys/dictItem/logicDeleteBatch`, params).then(res => { if(res.success){ - this.queryParams.pageNo=1 + if(this.ids.length==this.tableData.length&&this.queryParams.pageNo!=1){ + this.queryParams.pageNo=this.queryParams.pageNo-1 + } this.loadData() this.$message.success(this.$t('OperationSuccessful')) }else{ diff --git a/jero-web/src/views/documentManage/tags/tabs/tagContent.vue b/jero-web/src/views/documentManage/tags/tabs/tagContent.vue index 439ef15d2..8bbffce84 100644 --- a/jero-web/src/views/documentManage/tags/tabs/tagContent.vue +++ b/jero-web/src/views/documentManage/tags/tabs/tagContent.vue @@ -109,6 +109,7 @@ pageNo:1, pageSize:10 }, + ids:[], selectedRowKeys: [], contentVisible:false, tableData:[], @@ -263,7 +264,7 @@ deleteAction(`sys/dict/logicDelete`, param).then(res => { if (res.success) { this.$message.success(this.$t('OperationSuccessful')) - if(this.tableData&&this.tableData.length==1){ + if(this.tableData&&this.tableData.length==1&&this.queryParams.pageNo!=1){ this.queryParams.pageNo=this.queryParams.pageNo-1 } this.loadData() @@ -275,25 +276,28 @@ }) }, onSelectChange(selectedRowKeys) { - console.log('selectedRowKeys changed: ', selectedRowKeys); + // console.log('selectedRowKeys changed: ', selectedRowKeys); this.selectedRowKeys = selectedRowKeys; + this.ids = this.selectedRowKeys; }, //批量删除 batDelete(){ let params={ - ids:this.selectedRowKeys.join(',') + ids:this.ids.join(',') } - if(this.selectedRowKeys){ + if(this.ids&&this.ids.length>0){ this.$confirm({ title: this.$t('ConfirmDelete'), content: '', onOk: async () => { - deleteAction(`sys/dict/logicdeleteBatch`, params).then(res => { + deleteAction(`sys/dict/logicDeleteBatch`, params).then(res => { if (res.success) { this.$message.success(this.$t('OperationSuccessful')) - + if(this.ids.length==this.tableData.length&&this.queryParams.pageNo!=1){ + this.queryParams.pageNo=this.queryParams.pageNo-1 + } this.loadData() postAction(`online/cgform/api/doDbSynch/48308196e7b04761b533dc31bc899707/normal `,{}).then(res=>{