diff --git a/src/service/device.service.ts b/src/service/device.service.ts index b769c2e..943879d 100644 --- a/src/service/device.service.ts +++ b/src/service/device.service.ts @@ -27,7 +27,7 @@ export default class DeviceService extends BaseService{ } public deleteByIds(params):Promise>>{ - const url = this.prefix.prevention +'/device/inventory/delete'; + const url = this.prefix.prevention +'/device/inventory'; return this.deleteBatch(url,params,{},true) } diff --git a/src/views/risk/assessment/device/device.component.html b/src/views/risk/assessment/device/device.component.html index 2ecb11e..df6d266 100644 --- a/src/views/risk/assessment/device/device.component.html +++ b/src/views/risk/assessment/device/device.component.html @@ -35,7 +35,7 @@ diff --git a/src/views/risk/assessment/device/device.component.vue b/src/views/risk/assessment/device/device.component.vue index da13238..75848ef 100644 --- a/src/views/risk/assessment/device/device.component.vue +++ b/src/views/risk/assessment/device/device.component.vue @@ -409,7 +409,7 @@ export default class DeviceManagerComponent extends BaseRecordComponent { } else if (data.value === "selectAll") { this.selectAll() } else if (data.value === "delete") { - this.deleteData(this.selectData) + this.deleteData(this.selectData.map((itm: any) => itm.id)) } else if (data.value === "add") { this.isReadonly = false; this.currentId = -1; @@ -578,6 +578,41 @@ export default class DeviceManagerComponent extends BaseRecordComponent { this.showProject = false; this.updateProParams = {} as any; } + + //删除 + public deleteData(ids: any) { + if (!ids.length) { + return + } else { + this.$confirm("确认删除所选数据?", "确认数据", { + type: 'warning' + }).then(() => { + this.tableService.deleteByIds(ids).then((res: any) => { + if (res.data.type === 0) { + this.$message.success("删除成功!"); + this.getTableData() + } else { + let title = ''; + if (res.data.names.length > 3) { + title = '“' + res.data.names.slice(0, 3).join('”,“') + '” 等' + } else { + title = '“' + res.data.names.join('”,“') + '”' + } + this.$confirm(`${title}设备设施下存在评估数据,请先删除对应数据`, "", { + type: 'warning', + showConfirmButton: false + }).then(() => { + // + }).catch(() => { + // + }) + } + }) + }).catch(() => { + // + }) + } + } } diff --git a/src/views/risk/assessment/work/work.component.vue b/src/views/risk/assessment/work/work.component.vue index 71a82e2..e1760be 100644 --- a/src/views/risk/assessment/work/work.component.vue +++ b/src/views/risk/assessment/work/work.component.vue @@ -659,8 +659,41 @@ export default class WorkManagerComponent extends BaseRecordComponent { public addWorkSteps() { this.showSubUpdateModel(); } - - + + //删除 + public deleteData(ids: any) { + if (!ids.length) { + return + } else { + this.$confirm("确认删除所选数据?", "确认数据", { + type: 'warning' + }).then(() => { + this.tableService.deleteByIds(ids).then((res: any) => { + if (res.data.type === 0) { + this.$message.success("删除成功!"); + this.getTableData() + } else { + let title = ''; + if (res.data.names.length > 3) { + title = '“' + res.data.names.slice(0, 3).join('”,“') + '” 等' + } else { + title = '“' + res.data.names.join('”,“') + '”' + } + this.$confirm(`${title}作业活动下存在评估数据,请先删除对应数据`, "", { + type: 'warning', + showConfirmButton: false + }).then(() => { + // + }).catch(() => { + // + }) + } + }) + }).catch(() => { + // + }) + } + } } diff --git a/src/views/risk/unit/unit.component.vue b/src/views/risk/unit/unit.component.vue index f79b85e..b87f5a3 100644 --- a/src/views/risk/unit/unit.component.vue +++ b/src/views/risk/unit/unit.component.vue @@ -578,6 +578,41 @@ export default class UnitManagerComponent extends BaseRecordComponent { public handleSelectionChange(data) { this.selectData = data; } + + //删除 + public deleteData(ids: any) { + if (!ids.length) { + return + } else { + this.$confirm("确认删除所选数据?", "确认数据", { + type: 'warning' + }).then(() => { + this.tableService.deleteByIds(ids).then((res: any) => { + if (res.data.type === 0) { + this.$message.success("删除成功!"); + this.getTableData() + } else { + let title = ''; + if (res.data.names.length > 3) { + title = '“' + res.data.names.slice(0, 3).join('”,“') + '” 等' + } else { + title = '“' + res.data.names.join('”,“') + '”' + } + this.$confirm(`${title}单元下存在作业活动或者(和)设备设施数据,请先删除对应数据`, "", { + type: 'warning', + showConfirmButton: false + }).then(() => { + // + }).catch(() => { + // + }) + } + }) + }).catch(() => { + // + }) + } + } }