diff --git a/src/api/modules/permissionProcess.js b/src/api/modules/permissionProcess.js index 8d2bc33..ad5507c 100644 --- a/src/api/modules/permissionProcess.js +++ b/src/api/modules/permissionProcess.js @@ -17,4 +17,11 @@ export default { data: data }) }, + deletReport(data){ + return request({ + url: '/api/report/powerApply/deleteAct', + method: 'post', + data: data + }) + } } diff --git a/src/views/permissionApplication/components/reportTable.vue b/src/views/permissionApplication/components/reportTable.vue index 22edbab..61752b9 100644 --- a/src/views/permissionApplication/components/reportTable.vue +++ b/src/views/permissionApplication/components/reportTable.vue @@ -15,7 +15,7 @@ @@ -135,15 +135,11 @@ export default { }, selectAllEvent ({ checked }) { const records = this.$refs.xTable.getCheckboxRecords() - this.checkIds = records.map(item => { - return item.reportId - }) + this.checkIds = records }, selectChangeEvent ({ checked }) { const records = this.$refs.xTable.getCheckboxRecords() - this.checkIds = records.map(item => { - return item.reportId - }) + this.checkIds = records }, addReport () { this.$refs.reportDialog.show() @@ -151,27 +147,88 @@ export default { deleteAll () { this.reportDelete(this.checkIds) }, - reportDelete (id) { + reportDelete (row) { // 删除报告 假删除 - if (typeof id === 'string') { - this.$confirm('此操作将删除所选数据, 是否继续?', '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning' - }).then(() => { - this.$emit('updateTable', this.value.filter(item => item.reportId !== id)) - }) - } else { - if (Array.isArray(id)) { + + if (Array.isArray(row)) { this.$confirm('此操作将删除所选数据, 是否继续?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => { - this.$emit('updateTable', this.value.filter(item => id.indexOf(item.reportId) === -1)) + if (this.$route.query.taskDefinitionKey == 'aid4' ){ + // 有idde + console.log(this.value) + debugger + let idsList=this.checkIds.filter(item=>{ + if(item.id && item.id !=''){ + return item + } + }) + let reportList=this.checkIds.filter(item=>{ + if(!item.id ){ + return item + } + }) + + let newValue=[] + if(idsList.length>0){ + idsList=idsList.map(item=>{ + return item.id + }) + reportList=reportList.map(item=>{ + return item.reportId + }) + this.$api.permissionProcess.deletReport({ids:idsList}).then(()=>{ + if(reportList.length>0){ + let reportids= row.map(item=>item.reportId) + newValue=this.value.filter(item => + reportids.indexOf(item.reportId)==-1 + ) + this.$emit('updateTable', newValue) + } + }) + }else{ + if(reportList.length>0){ + reportList=reportList.map(item=>{ + return item.reportId + }) + newValue=this.value.filter(item => reportList.indexOf(item.reportId)>-1 + ) + this.$emit('updateTable', newValue) + } + } + + } + else{ + let id=row.map(item=>item.reportId) + this.$emit('updateTable', this.value.filter(item => id.indexOf(item.reportId) === -1)) + } }) } - } + else{ + this.$confirm('此操作将删除所选数据, 是否继续?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + if (this.$route.query.taskDefinitionKey == 'aid4' ){ + if(row.id && row.id !=''){ + this.$api.permissionProcess.deletReport({ids:[row.id]}).then(()=>{ + this.$message.success("删除成功") + this.$emit('updateTable',this.value.filter(item => item.id !== row.id)) + }) + }else{ + this.$emit('updateTable', this.value.filter(item => item.reportId !== row.reportId)) + } + + }else{ + this.$emit('updateTable', this.value.filter(item => item.reportId !== row.reportId)) + } + + }) + } + } } }