forked from xxhjsb/hbt-prevention-ui
feat:删除风险提示
parent
0336178b32
commit
b9ad96f4b9
|
@ -27,7 +27,7 @@ export default class DeviceService extends BaseService<any>{
|
|||
}
|
||||
|
||||
public deleteByIds(params):Promise<AxiosResponse<ActionResult<any>>>{
|
||||
const url = this.prefix.prevention +'/device/inventory/delete';
|
||||
const url = this.prefix.prevention +'/device/inventory';
|
||||
return this.deleteBatch(url,params,{},true)
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="showUpdateModel(scope.row,true)">查看</el-button>
|
||||
<el-button type="text" @click="showUpdateModel(scope.row)">修改</el-button>
|
||||
<el-button type="text" @click="deleteData([scope.row])">删除</el-button>
|
||||
<el-button type="text" @click="deleteData([scope.row.id])">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
|
@ -409,7 +409,7 @@ export default class DeviceManagerComponent extends BaseRecordComponent<any> {
|
|||
} 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<any> {
|
|||
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(() => {
|
||||
//
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped src="../../../common.component.scss"></style>
|
||||
|
|
|
@ -659,8 +659,41 @@ export default class WorkManagerComponent extends BaseRecordComponent<any> {
|
|||
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(() => {
|
||||
//
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped src="../../../common.component.scss"></style>
|
||||
|
|
|
@ -578,6 +578,41 @@ export default class UnitManagerComponent extends BaseRecordComponent<any> {
|
|||
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(() => {
|
||||
//
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped src="../../common.component.scss"></style>
|
||||
|
|
Loading…
Reference in New Issue