bug修改

This commit is contained in:
caoyang
2022-03-10 15:05:44 +08:00
parent 90a1ee53eb
commit 226972e7a8
2 changed files with 74 additions and 62 deletions
@@ -257,6 +257,9 @@
}, },
//保存 //保存
hideModal(){ hideModal(){
this.$refs.ruleForm.validate(valid => {
if (valid) {
if(this.dictVal=='list') { if(this.dictVal=='list') {
let params = { let params = {
...this.form, ...this.form,
@@ -266,7 +269,7 @@
putAction(`sys/dictItem/edit`, params).then(res => { putAction(`sys/dictItem/edit`, params).then(res => {
if (res.success) { if (res.success) {
this.$message.success(this.$t('OperationSuccessful')) this.$message.success(this.$t('OperationSuccessful'))
this.form={} this.form = {}
this.loadData() this.loadData()
this.newVisible = false this.newVisible = false
} else { } else {
@@ -277,7 +280,7 @@
postAction(`sys/dictItem/add`, params).then(res => { postAction(`sys/dictItem/add`, params).then(res => {
if (res.success) { if (res.success) {
this.$message.success(this.$t('OperationSuccessful')) this.$message.success(this.$t('OperationSuccessful'))
this.form={} this.form = {}
this.loadData() this.loadData()
this.newVisible = false this.newVisible = false
} else { } else {
@@ -285,28 +288,29 @@
} }
}) })
} }
}else if(this.dictVal=='tree'){ } else if (this.dictVal == 'tree') {
console.log('tree1111')
let params = { let params = {
...this.form, ...this.form,
sysDictId: this.record.id sysDictId: this.record.id
} }
if (this.isEdit) { if (this.isEdit) {
putAction(`sys/category/edit`,params).then(res=>{ putAction(`sys/category/edit`, params).then(res => {
if(res.success){ if (res.success) {
this.$message.success(this.$t('OperationSuccessful')) this.$message.success(this.$t('OperationSuccessful'))
this.form={} this.form = {}
this.loadData() this.loadData()
this.newVisible = false this.newVisible = false
}else { } else {
this.$message.warning(this.$t('operationFailed')) this.$message.warning(this.$t('operationFailed'))
} }
}) })
}else{ } else {
//新增 //新增
postAction(`sys/category/add`, params).then(res => { postAction(`sys/category/add`, params).then(res => {
if (res.success) { if (res.success) {
this.$message.success(this.$t('OperationSuccessful')) this.$message.success(this.$t('OperationSuccessful'))
this.form={} this.form = {}
this.loadData() this.loadData()
this.newVisible = false this.newVisible = false
} else { } else {
@@ -315,6 +319,8 @@
}) })
} }
} }
}
})
}, },
//取消 //取消
cancelModel(){ cancelModel(){
@@ -355,7 +361,7 @@
deleteAction(`sys/dictItem/delete`, params).then(res => { deleteAction(`sys/dictItem/delete`, params).then(res => {
if(res.success) { if(res.success) {
this.$message.success(this.$t('OperationSuccessful')); 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.queryParams.pageNo=this.queryParams.pageNo-1
} }
this.loadData() this.loadData()
@@ -385,9 +391,11 @@
onOk: onOk:
async () => { async () => {
if(this.dictVal=='list'){ if(this.dictVal=='list'){
deleteAction(`sys/dictItem/logicdeleteBatch`, params).then(res => { deleteAction(`sys/dictItem/logicDeleteBatch`, params).then(res => {
if(res.success){ 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.loadData()
this.$message.success(this.$t('OperationSuccessful')) this.$message.success(this.$t('OperationSuccessful'))
}else{ }else{
@@ -109,6 +109,7 @@
pageNo:1, pageNo:1,
pageSize:10 pageSize:10
}, },
ids:[],
selectedRowKeys: [], selectedRowKeys: [],
contentVisible:false, contentVisible:false,
tableData:[], tableData:[],
@@ -263,7 +264,7 @@
deleteAction(`sys/dict/logicDelete`, param).then(res => { deleteAction(`sys/dict/logicDelete`, param).then(res => {
if (res.success) { if (res.success) {
this.$message.success(this.$t('OperationSuccessful')) 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.queryParams.pageNo=this.queryParams.pageNo-1
} }
this.loadData() this.loadData()
@@ -275,25 +276,28 @@
}) })
}, },
onSelectChange(selectedRowKeys) { onSelectChange(selectedRowKeys) {
console.log('selectedRowKeys changed: ', selectedRowKeys); // console.log('selectedRowKeys changed: ', selectedRowKeys);
this.selectedRowKeys = selectedRowKeys; this.selectedRowKeys = selectedRowKeys;
this.ids = this.selectedRowKeys;
}, },
//批量删除 //批量删除
batDelete(){ batDelete(){
let params={ let params={
ids:this.selectedRowKeys.join(',') ids:this.ids.join(',')
} }
if(this.selectedRowKeys){ if(this.ids&&this.ids.length>0){
this.$confirm({ this.$confirm({
title: this.$t('ConfirmDelete'), title: this.$t('ConfirmDelete'),
content: '', content: '',
onOk: onOk:
async () => { async () => {
deleteAction(`sys/dict/logicdeleteBatch`, params).then(res => { deleteAction(`sys/dict/logicDeleteBatch`, params).then(res => {
if (res.success) { if (res.success) {
this.$message.success(this.$t('OperationSuccessful')) 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() this.loadData()
postAction(`online/cgform/api/doDbSynch/48308196e7b04761b533dc31bc899707/normal postAction(`online/cgform/api/doDbSynch/48308196e7b04761b533dc31bc899707/normal
`,{}).then(res=>{ `,{}).then(res=>{