feat:删除风险提示

dev
zhushengzhe 2023-09-18 16:56:08 +08:00
parent 0336178b32
commit b9ad96f4b9
5 changed files with 108 additions and 5 deletions

View File

@ -27,7 +27,7 @@ export default class DeviceService extends BaseService<any>{
} }
public deleteByIds(params):Promise<AxiosResponse<ActionResult<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) return this.deleteBatch(url,params,{},true)
} }

View File

@ -35,7 +35,7 @@
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="showUpdateModel(scope.row,true)">查看</el-button> <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="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> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>

View File

@ -409,7 +409,7 @@ export default class DeviceManagerComponent extends BaseRecordComponent<any> {
} else if (data.value === "selectAll") { } else if (data.value === "selectAll") {
this.selectAll() this.selectAll()
} else if (data.value === "delete") { } else if (data.value === "delete") {
this.deleteData(this.selectData) this.deleteData(this.selectData.map((itm: any) => itm.id))
} else if (data.value === "add") { } else if (data.value === "add") {
this.isReadonly = false; this.isReadonly = false;
this.currentId = -1; this.currentId = -1;
@ -578,6 +578,41 @@ export default class DeviceManagerComponent extends BaseRecordComponent<any> {
this.showProject = false; this.showProject = false;
this.updateProParams = {} as any; 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> </script>
<style lang="scss" scoped src="../../../common.component.scss"></style> <style lang="scss" scoped src="../../../common.component.scss"></style>

View File

@ -659,8 +659,41 @@ export default class WorkManagerComponent extends BaseRecordComponent<any> {
public addWorkSteps() { public addWorkSteps() {
this.showSubUpdateModel(); 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> </script>
<style lang="scss" scoped src="../../../common.component.scss"></style> <style lang="scss" scoped src="../../../common.component.scss"></style>

View File

@ -578,6 +578,41 @@ export default class UnitManagerComponent extends BaseRecordComponent<any> {
public handleSelectionChange(data) { public handleSelectionChange(data) {
this.selectData = 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> </script>
<style lang="scss" scoped src="../../common.component.scss"></style> <style lang="scss" scoped src="../../common.component.scss"></style>