班组管理-删除逻辑修改 12.8

zhc4dev
zhc077 2 years ago
parent 1b4aa086a6
commit bcae9c7b05
  1. 20
      ant-design-vue-jeecg/src/views/team/GroupxList.vue
  2. 53
      ant-design-vue-jeecg/src/views/team/StationList.vue
  3. 8
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/team/controller/StationController.java
  4. 1
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/team/service/IStationService.java
  5. 20
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/team/service/impl/StationServiceImpl.java

@ -207,27 +207,16 @@ export default {
this.$message.error("请设置url.delete属性!") this.$message.error("请设置url.delete属性!")
return return
} }
let dataTotal = 0;
let param = { let param = {
groupxId: id groupxId: id
} }
getAction(this.url.groupxMemberList, param).then((res) => { getAction(this.url.groupxMemberList, param).then((res) => {
console.log(JSON.stringify(res)); console.log(JSON.stringify(res));
if (res.success) { if (res.success) {
dataTotal = res.result.total; if (res.result.total > 0) {
console.log("the listSize=",dataTotal); this.$message.warning("暂不可删除,子模块正在使用!");
if (dataTotal > 0) {
// alert("nononon");
that.$message.warning("不能删除!");
return; return;
} } else {
}
})
// debugger;
// if (dataTotal > 0) {
// alert("nononon");
// that.$message.warning("!");
// }
var that = this; var that = this;
deleteAction(that.url.delete, {id: id}).then((res) => { deleteAction(that.url.delete, {id: id}).then((res) => {
if (res.success) { if (res.success) {
@ -239,6 +228,9 @@ export default {
that.$message.warning(res.message); that.$message.warning(res.message);
} }
}); });
}
}
})
}, },
} }
} }

@ -7,9 +7,9 @@
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :xl="6" :lg="7" :md="8" :sm="24"> <a-col :xl="6" :lg="7" :md="8" :sm="24">
<!-- <a-form-item label="车间ID">--> <!-- <a-form-item label="车间ID">-->
<!-- <a-input placeholder="请输入车间ID" v-model="queryParam.departId"></a-input>--> <!-- <a-input placeholder="请输入车间ID" v-model="queryParam.departId"></a-input>-->
<!-- </a-form-item>--> <!-- </a-form-item>-->
<a-form-model-item label="车间编号"> <a-form-model-item label="车间编号">
<!-- <a-input placeholder="请输入部门编号" v-model="model.departId"/>--> <!-- <a-input placeholder="请输入部门编号" v-model="model.departId"/>-->
<j-select-depart placeholder="请选择车间" v-model="queryParam.departId"/> <j-select-depart placeholder="请选择车间" v-model="queryParam.departId"/>
@ -26,10 +26,10 @@
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button> <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button> <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
<!-- <a @click="handleToggleSearch" style="margin-left: 8px">--> <!-- <a @click="handleToggleSearch" style="margin-left: 8px">-->
<!-- {{ toggleSearchStatus ? '收起' : '展开' }}--> <!-- {{ toggleSearchStatus ? '收起' : '展开' }}-->
<!-- <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>--> <!-- <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>-->
<!-- </a>--> <!-- </a>-->
</span> </span>
</a-col> </a-col>
@ -85,10 +85,10 @@
</span> </span>
<span slot="action" slot-scope="text, record"> <span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">编辑</a> <a @click="handleEdit(record)">编辑</a>
<!-- <a-divider type="vertical"/>--> <!-- <a-divider type="vertical"/>-->
<!-- <a @click="handleDetail(record)">详情</a>--> <!-- <a @click="handleDetail(record)">详情</a>-->
<a-divider type="vertical"/> <a-divider type="vertical"/>
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete2(record.id)">
<a>删除</a> <a>删除</a>
</a-popconfirm> </a-popconfirm>
</span> </span>
@ -106,6 +106,7 @@ import '@/assets/less/TableExpand.less'
import {mixinDevice} from '@/utils/mixin' import {mixinDevice} from '@/utils/mixin'
import StationModal from './modules/StationModal' import StationModal from './modules/StationModal'
import {JeecgListMixin} from '@/mixins/JeecgListMixin' import {JeecgListMixin} from '@/mixins/JeecgListMixin'
import {deleteAction, getAction} from "@api/manage";
export default { export default {
name: "StationList", name: "StationList",
@ -171,6 +172,7 @@ export default {
], ],
url: { url: {
list: "/team/station/list", list: "/team/station/list",
queryIsCanDelete: "/team/station/queryIsCanDelete",
delete: "/team/station/delete", delete: "/team/station/delete",
deleteBatch: "/team/station/deleteBatch", deleteBatch: "/team/station/deleteBatch",
exportXlsUrl: "/team/station/exportXls", 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);
}
});
}
}
})
},
} }
} }
</script> </script>

@ -82,6 +82,14 @@ public class StationController extends JeecgController<Station, IStationService>
return Result.OK(pageList); return Result.OK(pageList);
} }
@ApiOperation(value = "车间工位管理-查询车间工位能否删除", notes = "车间工位管理-查询车间工位能否删除")
@GetMapping(value = "/queryIsCanDelete")
public Result<?> queryIsCanDelete(Station station,
HttpServletRequest req) {
return Result.OK(stationService.queryIsCanDelete(station));
}
/** /**
* 添加 * 添加
* *

@ -12,4 +12,5 @@ import org.jeecg.modules.team.entity.Station;
*/ */
public interface IStationService extends IService<Station> { public interface IStationService extends IService<Station> {
int queryIsCanDelete(Station station);
} }

@ -1,10 +1,17 @@
package org.jeecg.modules.team.service.impl; package org.jeecg.modules.team.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 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.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.mapper.StationMapper;
import org.jeecg.modules.team.service.IStationMachineService;
import org.jeecg.modules.team.service.IStationService; 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; import org.springframework.stereotype.Service;
/** /**
@ -16,4 +23,17 @@ import org.springframework.stereotype.Service;
@Service @Service
public class StationServiceImpl extends ServiceImpl<StationMapper, Station> implements IStationService { public class StationServiceImpl extends ServiceImpl<StationMapper, Station> implements IStationService {
@Autowired
private IStationMachineService iStationMachineService;
@Autowired
private IStationToolService iStationToolService;
public int queryIsCanDelete(Station station) {
int count = iStationToolService.count((new LambdaQueryWrapper<StationTool>().in(StationTool::getStationId, station.getId())));
if (count == 0) {
int machineCount = iStationMachineService.count((new LambdaQueryWrapper<StationMachine>().in(StationMachine::getStationId, station.getId())));
count += machineCount;
}
return count;
}
} }

Loading…
Cancel
Save