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,64 +257,70 @@
}, },
//保存 //保存
hideModal(){ hideModal(){
if(this.dictVal=='list') {
let params = { this.$refs.ruleForm.validate(valid => {
...this.form, if (valid) {
dictId: this.record.id if(this.dictVal=='list') {
} let params = {
if (this.isEdit) { ...this.form,
putAction(`sys/dictItem/edit`, params).then(res => { dictId: this.record.id
if (res.success) { }
this.$message.success(this.$t('OperationSuccessful')) if (this.isEdit) {
this.form={} putAction(`sys/dictItem/edit`, params).then(res => {
this.loadData() if (res.success) {
this.newVisible = false this.$message.success(this.$t('OperationSuccessful'))
this.form = {}
this.loadData()
this.newVisible = false
} else {
this.$message.warning(this.$t('operationFailed'))
}
})
} else { } 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 if (this.dictVal == 'tree') {
} else { console.log('tree1111')
postAction(`sys/dictItem/add`, params).then(res => { let params = {
if (res.success) { ...this.form,
this.$message.success(this.$t('OperationSuccessful')) sysDictId: this.record.id
this.form={} }
this.loadData() if (this.isEdit) {
this.newVisible = false 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 { } 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(){ 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=>{