diff --git a/ant-design-vue-jeecg/src/views/team/GroupxList.vue b/ant-design-vue-jeecg/src/views/team/GroupxList.vue index b4e78362..1c9b3ccb 100644 --- a/ant-design-vue-jeecg/src/views/team/GroupxList.vue +++ b/ant-design-vue-jeecg/src/views/team/GroupxList.vue @@ -207,38 +207,30 @@ export default { this.$message.error("请设置url.delete属性!") return } - let dataTotal = 0; let param = { groupxId: id } getAction(this.url.groupxMemberList, param).then((res) => { console.log(JSON.stringify(res)); if (res.success) { - dataTotal = res.result.total; - console.log("the listSize=",dataTotal); - if (dataTotal > 0) { - // alert("nononon"); - that.$message.warning("不能删除!"); + if (res.result.total > 0) { + this.$message.warning("暂不可删除,子模块正在使用!"); return; + } else { + var that = this; + deleteAction(that.url.delete, {id: id}).then((res) => { + if (res.success) { + //重新计算分页问题 + that.reCalculatePage(1) + that.$message.success(res.message); + that.loadData(); + } else { + that.$message.warning(res.message); + } + }); } } }) - // debugger; - // if (dataTotal > 0) { - // alert("nononon"); - // that.$message.warning("不能删除!"); - // } - var that = this; - deleteAction(that.url.delete, {id: id}).then((res) => { - if (res.success) { - //重新计算分页问题 - that.reCalculatePage(1) - that.$message.success(res.message); - that.loadData(); - } else { - that.$message.warning(res.message); - } - }); }, } } diff --git a/ant-design-vue-jeecg/src/views/team/StationList.vue b/ant-design-vue-jeecg/src/views/team/StationList.vue index 94297b92..9814c0df 100644 --- a/ant-design-vue-jeecg/src/views/team/StationList.vue +++ b/ant-design-vue-jeecg/src/views/team/StationList.vue @@ -7,9 +7,9 @@ - - - + + + @@ -26,10 +26,10 @@ 查询 重置 - - - - + + + + @@ -85,10 +85,10 @@ 编辑 - - + + - + 删除 @@ -106,6 +106,7 @@ import '@/assets/less/TableExpand.less' import {mixinDevice} from '@/utils/mixin' import StationModal from './modules/StationModal' import {JeecgListMixin} from '@/mixins/JeecgListMixin' +import {deleteAction, getAction} from "@api/manage"; export default { name: "StationList", @@ -171,6 +172,7 @@ export default { ], url: { list: "/team/station/list", + queryIsCanDelete: "/team/station/queryIsCanDelete", delete: "/team/station/delete", deleteBatch: "/team/station/deleteBatch", exportXlsUrl: "/team/station/exportXls", @@ -203,6 +205,37 @@ export default { }, }); }, + handleDelete2: function (id) { + if (!this.url.queryIsCanDelete) { + this.$message.error("请设置url.delete属性!") + return + } + // let dataTotal = 0; + let param = { + id: id + } + getAction(this.url.queryIsCanDelete, param).then((res) => { + console.log("queryIsCanDelete res:" + JSON.stringify(res)); + if (res.success) { + if (res.result > 0) { + this.$message.warning("暂不可删除,子模块正在使用!"); + return; + } else { + var that = this; + deleteAction(that.url.delete, param).then((res) => { + if (res.success) { + //重新计算分页问题 + that.reCalculatePage(1) + that.$message.success(res.message); + that.loadData(); + } else { + that.$message.warning(res.message); + } + }); + } + } + }) + }, } } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/team/controller/StationController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/team/controller/StationController.java index ec7c9e73..1344bf53 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/team/controller/StationController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/team/controller/StationController.java @@ -82,6 +82,14 @@ public class StationController extends JeecgController return Result.OK(pageList); } + + @ApiOperation(value = "车间工位管理-查询车间工位能否删除", notes = "车间工位管理-查询车间工位能否删除") + @GetMapping(value = "/queryIsCanDelete") + public Result queryIsCanDelete(Station station, + HttpServletRequest req) { + return Result.OK(stationService.queryIsCanDelete(station)); + } + /** * 添加 * diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/team/service/IStationService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/team/service/IStationService.java index 4fdd4da6..b610b3f7 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/team/service/IStationService.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/team/service/IStationService.java @@ -12,4 +12,5 @@ import org.jeecg.modules.team.entity.Station; */ public interface IStationService extends IService { + int queryIsCanDelete(Station station); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/team/service/impl/StationServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/team/service/impl/StationServiceImpl.java index deb585da..4976de9e 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/team/service/impl/StationServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/team/service/impl/StationServiceImpl.java @@ -1,10 +1,17 @@ package org.jeecg.modules.team.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.system.entity.SysDepart; import org.jeecg.modules.team.entity.Station; +import org.jeecg.modules.team.entity.StationMachine; +import org.jeecg.modules.team.entity.StationTool; import org.jeecg.modules.team.mapper.StationMapper; +import org.jeecg.modules.team.service.IStationMachineService; import org.jeecg.modules.team.service.IStationService; +import org.jeecg.modules.team.service.IStationToolService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** @@ -16,4 +23,17 @@ import org.springframework.stereotype.Service; @Service public class StationServiceImpl extends ServiceImpl implements IStationService { + @Autowired + private IStationMachineService iStationMachineService; + @Autowired + private IStationToolService iStationToolService; + + public int queryIsCanDelete(Station station) { + int count = iStationToolService.count((new LambdaQueryWrapper().in(StationTool::getStationId, station.getId()))); + if (count == 0) { + int machineCount = iStationMachineService.count((new LambdaQueryWrapper().in(StationMachine::getStationId, station.getId()))); + count += machineCount; + } + return count; + } }