完成防汛抗旱队伍管理和人员信息管理的CRUD,导入导出功能

main
15036302109 12 months ago
parent 37069a1bc2
commit 9a7f72026c

@ -0,0 +1,144 @@
package com.ruoyi.web.controller.ehs;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.ExcelExp;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ExcelExportUtil;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.ehsFloodDroughtTeam.domain.EhsFloodDroughtTeam;
import com.ruoyi.ehsFloodDroughtTeam.domain.FloodDroughtTeamImportTemplate;
import com.ruoyi.ehsFloodDroughtTeam.service.IEhsFloodDroughtTeamService;
import com.ruoyi.ehsFloodDroughtWorker.domain.EhsFloodDroughtWorker;
import com.ruoyi.ehsFloodDroughtWorker.service.IEhsFloodDroughtWorkerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Controller
*
* @author ruoyi
* @date 2023-12-14
*/
@Api(tags = "防汛抗旱队伍管理管理")
@RestController
@RequestMapping("/ehs/ehsFloodDroughtTeam")
public class EhsFloodDroughtTeamController extends BaseController {
@Autowired
private IEhsFloodDroughtTeamService ehsFloodDroughtTeamService;
@Autowired
private IEhsFloodDroughtWorkerService workerService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('ehs:ehsFloodDroughtTeam:list')")
@GetMapping("/list")
public TableDataInfo list(EhsFloodDroughtTeam ehsFloodDroughtTeam) {
startPage();
List<EhsFloodDroughtTeam> list = ehsFloodDroughtTeamService.selectEhsFloodDroughtTeamList(ehsFloodDroughtTeam);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ehs:ehsFloodDroughtTeam:export')")
@Log(title = "防汛抗旱队伍管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, EhsFloodDroughtTeam ehsFloodDroughtTeam) {
List<EhsFloodDroughtTeam> list = ehsFloodDroughtTeamService.selectEhsFloodDroughtTeamList(ehsFloodDroughtTeam);
ExcelUtil<EhsFloodDroughtTeam> util = new ExcelUtil<EhsFloodDroughtTeam>(EhsFloodDroughtTeam.class);
util.exportExcel(response, list, "防汛抗旱队伍管理数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ehs:ehsFloodDroughtTeam:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(ehsFloodDroughtTeamService.selectEhsFloodDroughtTeamById(id));
}
/**
*
*/
@ApiOperation("新增防汛抗旱队伍管理")
@PreAuthorize("@ss.hasPermi('ehs:ehsFloodDroughtTeam:add')")
@Log(title = "防汛抗旱队伍管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody EhsFloodDroughtTeam ehsFloodDroughtTeam) {
return toAjax(ehsFloodDroughtTeamService.save(ehsFloodDroughtTeam));
}
/**
*
*/
@ApiOperation("修改防汛抗旱队伍管理")
@PreAuthorize("@ss.hasPermi('ehs:ehsFloodDroughtTeam:edit')")
@Transactional
@Log(title = "防汛抗旱队伍管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EhsFloodDroughtTeam ehsFloodDroughtTeam) {
// 更新防汛抗旱队伍信息
ehsFloodDroughtTeamService.updateById(ehsFloodDroughtTeam);
// 更新防汛抗旱队伍中人员信息
boolean result = workerService.updateWorkerByTeamId(ehsFloodDroughtTeam);
return toAjax(result);
}
/**
*
*/
@ApiOperation("删除防汛抗旱队伍管理")
@PreAuthorize("@ss.hasPermi('ehs:ehsFloodDroughtTeam:remove')")
@Transactional
@Log(title = "防汛抗旱队伍管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
ehsFloodDroughtTeamService.removeByIds(Arrays.asList(ids));
boolean result = workerService.removeWorkerByTeamIds(Arrays.asList(ids));
return toAjax(result);
}
/**
*
*/
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response) throws IOException {
List<EhsFloodDroughtTeam> ehsFloodDroughtTeams = new ArrayList<>();
String[] header =
{"队伍名称#",
"队伍级别#",
"备注#"};
ExcelExp e1 = new ExcelExp("防汛抗旱队伍信息", header, ehsFloodDroughtTeams, EhsFloodDroughtTeam.class);
List<ExcelExp> mysheet = new ArrayList<>();
mysheet.add(e1);
ExcelExportUtil.exportManySheetExcel("防汛抗旱队伍信息批量导入模板", mysheet, response);
}
//批量导入
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file, Boolean updateSupport) throws Exception {
ExcelUtil<FloodDroughtTeamImportTemplate> util = new ExcelUtil<>(FloodDroughtTeamImportTemplate.class);
List<FloodDroughtTeamImportTemplate> list = util.importExcel(file.getInputStream());
String message = ehsFloodDroughtTeamService.importData(list, updateSupport);
return AjaxResult.success(message);
}
}

@ -0,0 +1,147 @@
package com.ruoyi.web.controller.ehs;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.ExcelExp;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ExcelExportUtil;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.ehsFloodDroughtTeam.service.IEhsFloodDroughtTeamService;
import com.ruoyi.ehsFloodDroughtTeam.vo.FloodDroughtTeamVo;
import com.ruoyi.ehsFloodDroughtWorker.domain.EhsFloodDroughtWorker;
import com.ruoyi.ehsFloodDroughtWorker.domain.FloodDroughtWorkerImportTemplate;
import com.ruoyi.ehsFloodDroughtWorker.service.IEhsFloodDroughtWorkerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Controller
*
* @author ruoyi
* @date 2023-12-14
*/
@Api(tags = "防汛抗旱队伍人员信息管理")
@RestController
@RequestMapping("/ehs/ehsFloodDroughtWorker")
public class EhsFloodDroughtWorkerController extends BaseController {
@Autowired
private IEhsFloodDroughtWorkerService ehsFloodDroughtWorkerService;
@Autowired
private IEhsFloodDroughtTeamService ehsFloodDroughtTeamService;
/**
*
*/
//@PreAuthorize("@ss.hasPermi('ehs:ehsFloodDroughtWorker:list')")
@GetMapping("/list")
public TableDataInfo list(EhsFloodDroughtWorker ehsFloodDroughtWorker) {
startPage();
List<EhsFloodDroughtWorker> list = ehsFloodDroughtWorkerService.selectEhsFloodDroughtWorkerList(ehsFloodDroughtWorker);
return getDataTable(list);
}
/**
* id
*/
@GetMapping(value = "/getTeamInfo/{teamId}")
public AjaxResult getTeamInfo(@PathVariable("teamId") Long teamId) {
FloodDroughtTeamVo teamResponseVo = ehsFloodDroughtTeamService.getTeamInfoByTeamId(teamId);
return success(teamResponseVo);
}
/**
*
*/
//@PreAuthorize("@ss.hasPermi('ehs:ehsFloodDroughtWorker:export')")
@Log(title = "防汛抗旱队伍人员信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, EhsFloodDroughtWorker ehsFloodDroughtWorker) {
List<EhsFloodDroughtWorker> list = ehsFloodDroughtWorkerService.selectEhsFloodDroughtWorkerList(ehsFloodDroughtWorker);
ExcelUtil<EhsFloodDroughtWorker> util = new ExcelUtil<EhsFloodDroughtWorker>(EhsFloodDroughtWorker.class);
util.exportExcel(response, list, "防汛抗旱队伍人员信息数据");
}
/**
*
*/
//@PreAuthorize("@ss.hasPermi('ehs:ehsFloodDroughtWorker:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(ehsFloodDroughtWorkerService.selectEhsFloodDroughtWorkerById(id));
}
/**
*
*/
@ApiOperation("新增防汛抗旱队伍人员信息")
//@PreAuthorize("@ss.hasPermi('ehs:ehsFloodDroughtWorker:add')")
@Log(title = "防汛抗旱队伍人员信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody EhsFloodDroughtWorker ehsFloodDroughtWorker) {
return toAjax(ehsFloodDroughtWorkerService.save(ehsFloodDroughtWorker));
}
/**
*
*/
@ApiOperation("修改防汛抗旱队伍人员信息")
//@PreAuthorize("@ss.hasPermi('ehs:ehsFloodDroughtWorker:edit')")
@Log(title = "防汛抗旱队伍人员信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EhsFloodDroughtWorker ehsFloodDroughtWorker) {
return toAjax(ehsFloodDroughtWorkerService.updateById(ehsFloodDroughtWorker));
}
/**
*
*/
@ApiOperation("删除防汛抗旱队伍人员信息")
//@PreAuthorize("@ss.hasPermi('ehs:ehsFloodDroughtWorker:remove')")
@Log(title = "防汛抗旱队伍人员信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(ehsFloodDroughtWorkerService.removeByIds(Arrays.asList(ids)));
}
/**
*
*/
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response) throws IOException {
List<EhsFloodDroughtWorker> workerList = new ArrayList<>();
String[] header =
{"人员姓名#",
"性别(0-男,1-女)#",
"出生年月(格式为:2023-12-12)#",
"身份证号#",
"联系方式#",
"工作年限#",
"技能特长#",
"备注#"};
ExcelExp e1 = new ExcelExp("防汛抗旱队伍人员信息", header, workerList, EhsFloodDroughtWorker.class);
List<ExcelExp> mysheet = new ArrayList<>();
mysheet.add(e1);
ExcelExportUtil.exportManySheetExcel("防汛抗旱队伍人员信息导入模板", mysheet, response);
}
//批量导入 params是防汛抗旱队伍id
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file, Boolean updateSupport, Long params) throws Exception {
ExcelUtil<FloodDroughtWorkerImportTemplate> util = new ExcelUtil<>(FloodDroughtWorkerImportTemplate.class);
List<FloodDroughtWorkerImportTemplate> list = util.importExcel(file.getInputStream());
String message = ehsFloodDroughtWorkerService.importData(list, updateSupport, params);
return AjaxResult.success(message);
}
}

@ -124,10 +124,15 @@ public class EhsRescueTeamController extends BaseController {
*/
@ApiOperation("修改应急救援队伍管理")
@PreAuthorize("@ss.hasPermi('ehs:ehsRescueTeam:edit')")
@Transactional
@Log(title = "应急救援队伍管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EhsRescueTeam ehsRescueTeam) {
return toAjax(ehsRescueTeamService.updateById(ehsRescueTeam));
// 更新应急救援队伍信息
ehsRescueTeamService.updateById(ehsRescueTeam);
// 更新应急救援队伍人员信息
boolean result = ehsRescueTeamWorkerService.updateWorkerByTeamId(ehsRescueTeam);
return toAjax(result);
}
/**

@ -49,12 +49,10 @@ public class EhsDocumentServiceImpl extends ServiceImpl<EhsDocumentMapper, EhsDo
*/
@Override
public List<EhsDocument> selectEhsDocumentList(EhsDocument ehsDocument) {
// 如果登录用户不是超级管理员,并且他的部门不是唐河县应急管理局(根节点),那么只能查询当前登录用户他的部门创建的公文
// 如果登录用户不是县级部门(即不是根节点parent_id=0),那么只能查询本部门的;县级部门(根节点)则查询全部
SysUser currentUser = SecurityUtils.getLoginUser().getUser();
List<Long> roleIds = currentUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList());
Long deptParentId = currentUser.getDept().getParentId();
if (!roleIds.contains(1L) &&
deptParentId != null &&
if (deptParentId != null &&
deptParentId.longValue() != 0) {
ehsDocument.setDeptId(currentUser.getDept().getDeptId().longValue());
}

@ -0,0 +1,48 @@
package com.ruoyi.ehsFloodDroughtTeam.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* ehs_flood_drought_team
*
* @author ruoyi
* @date 2023-12-14
*/
@Data
@ToString
@NoArgsConstructor
@Accessors(chain = true)
@TableName("ehs_flood_drought_team")
public class EhsFloodDroughtTeam extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
@TableId(type= IdType.AUTO)
private Long id;
/** 队伍名称 */
@Excel(name = "队伍名称")
private String teamName;
/** 队伍级别 */
@Excel(name = "队伍级别")
private String teamLevel;
/**
*
*/
@Excel(name = "救援人员数量")
@TableField(exist = false)
private Long rescueWorkerNum;
}

@ -0,0 +1,19 @@
package com.ruoyi.ehsFloodDroughtTeam.domain;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;
@Data
public class FloodDroughtTeamImportTemplate {
/** 队伍名称 */
@Excel(name = "队伍名称",type = Excel.Type.ALL)
private String teamName;
/** 队伍级别 */
@Excel(name = "队伍级别",type = Excel.Type.ALL)
private String teamLevel;
/** 备注 */
@Excel(name = "备注",type = Excel.Type.ALL)
private String remark;
}

@ -0,0 +1,44 @@
package com.ruoyi.ehsFloodDroughtTeam.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.ehsFloodDroughtTeam.domain.EhsFloodDroughtTeam;
import com.ruoyi.ehsFloodDroughtTeam.vo.FloodDroughtTeamVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Mapper
*
* @author ruoyi
* @date 2023-12-14
*/
public interface EhsFloodDroughtTeamMapper extends BaseMapper<EhsFloodDroughtTeam> {
/**
*
*
* @param id
* @return
*/
public EhsFloodDroughtTeam selectEhsFloodDroughtTeamById(Long id);
/**
*
*
* @param ehsFloodDroughtTeam
* @return
*/
public List<EhsFloodDroughtTeam> selectEhsFloodDroughtTeamList(EhsFloodDroughtTeam ehsFloodDroughtTeam);
/**
* :id
*/
public FloodDroughtTeamVo getTeamInfoByTeamId(Long teamId);
/**
* id
* @param id
* @return
*/
public Long getWorkerNumByTeamId(@Param("id") Long id);
}

@ -0,0 +1,46 @@
package com.ruoyi.ehsFloodDroughtTeam.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.ehsFloodDroughtTeam.domain.EhsFloodDroughtTeam;
import com.ruoyi.ehsFloodDroughtTeam.domain.FloodDroughtTeamImportTemplate;
import com.ruoyi.ehsFloodDroughtTeam.vo.FloodDroughtTeamVo;
/**
* Service
*
* @author ruoyi
* @date 2023-12-14
*/
public interface IEhsFloodDroughtTeamService extends IService<EhsFloodDroughtTeam> {
/**
*
*
* @param id
* @return
*/
public EhsFloodDroughtTeam selectEhsFloodDroughtTeamById(Long id);
/**
*
*
* @param ehsFloodDroughtTeam
* @return
*/
public List<EhsFloodDroughtTeam> selectEhsFloodDroughtTeamList(EhsFloodDroughtTeam ehsFloodDroughtTeam);
/**
*
* @param list
* @param updateSupport
* @return
*/
public String importData(List<FloodDroughtTeamImportTemplate> list, Boolean updateSupport) throws Exception;
/**
* :id
*/
public FloodDroughtTeamVo getTeamInfoByTeamId(Long teamId);
}

@ -0,0 +1,114 @@
package com.ruoyi.ehsFloodDroughtTeam.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.ehsFloodDroughtTeam.domain.FloodDroughtTeamImportTemplate;
import com.ruoyi.ehsFloodDroughtTeam.vo.FloodDroughtTeamVo;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import com.ruoyi.common.utils.StringUtils;
import java.util.List;
import java.util.Map;
import com.ruoyi.ehsFloodDroughtTeam.mapper.EhsFloodDroughtTeamMapper;
import com.ruoyi.ehsFloodDroughtTeam.domain.EhsFloodDroughtTeam;
import com.ruoyi.ehsFloodDroughtTeam.service.IEhsFloodDroughtTeamService;
/**
* Service
*
* @author ruoyi
* @date 2023-12-14
*/
@Service
public class EhsFloodDroughtTeamServiceImpl extends ServiceImpl<EhsFloodDroughtTeamMapper, EhsFloodDroughtTeam> implements IEhsFloodDroughtTeamService {
@Autowired
private EhsFloodDroughtTeamMapper ehsFloodDroughtTeamMapper;
/**
*
*
* @param id
* @return
*/
@Override
public EhsFloodDroughtTeam selectEhsFloodDroughtTeamById(Long id) {
return ehsFloodDroughtTeamMapper.selectEhsFloodDroughtTeamById(id);
}
/**
*
*
* @param ehsFloodDroughtTeam
* @return
*/
@Override
public List<EhsFloodDroughtTeam> selectEhsFloodDroughtTeamList(EhsFloodDroughtTeam ehsFloodDroughtTeam) {
List<EhsFloodDroughtTeam> teamList = ehsFloodDroughtTeamMapper.selectEhsFloodDroughtTeamList(ehsFloodDroughtTeam);
teamList.stream().forEach(item -> {
Long count = ehsFloodDroughtTeamMapper.getWorkerNumByTeamId(item.getId());
if (count != null){
item.setRescueWorkerNum(count);
}
});
return teamList;
}
/**
* :id
*/
@Override
public FloodDroughtTeamVo getTeamInfoByTeamId(Long teamId) {
return ehsFloodDroughtTeamMapper.getTeamInfoByTeamId(teamId);
}
@Override
public String importData(List<FloodDroughtTeamImportTemplate> list, Boolean updateSupport) throws Exception {
if (StringUtils.isNull(list) || list.size() == 0) {
throw new Exception("导入防汛抗旱队伍信息数据不能为空!");
}
int successNum = 0;
int failureNum = 0;
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
for (FloodDroughtTeamImportTemplate floodDroughtTeamTemplate : list) {
EhsFloodDroughtTeam temp = new EhsFloodDroughtTeam();
// temp.setId(IdUtils.fastSimpleUUID());
temp.setTeamName(floodDroughtTeamTemplate.getTeamName()); //队伍名称
temp.setTeamLevel(floodDroughtTeamTemplate.getTeamLevel()); //队伍级别
temp.setRemark(floodDroughtTeamTemplate.getRemark()); // 备注
try {
//插入数据
this.save(temp);
successNum++;
successMsg.append("<br />" + successNum + "、防汛抗旱队伍信息" + temp.getTeamName() + "导入成功");
} catch (Exception e) {
e.printStackTrace();
log.error(e.getLocalizedMessage());
failureNum++;
successMsg.append("<br /><font color='red'>" + failureNum + "、防汛抗旱队伍信息" + temp.getTeamName() + "导入异常,请联系管理员!</font>");
continue;
}
}
return successMsg.toString();
}
private LambdaQueryWrapper<EhsFloodDroughtTeam> buildQueryWrapper(EhsFloodDroughtTeam query) {
Map<String, Object> params = query.getParams();
LambdaQueryWrapper<EhsFloodDroughtTeam> lqw = Wrappers.lambdaQuery();
lqw.like(StringUtils.isNotBlank(query.getTeamName()), EhsFloodDroughtTeam::getTeamName, query.getTeamName());
lqw.eq(StringUtils.isNotBlank(query.getTeamLevel()), EhsFloodDroughtTeam::getTeamLevel, query.getTeamLevel());
lqw.orderByDesc(EhsFloodDroughtTeam::getCreateTime);
lqw.eq(query.getDeptId() != null, EhsFloodDroughtTeam::getDeptId, query.getDeptId());
return lqw;
}
}

@ -0,0 +1,9 @@
package com.ruoyi.ehsFloodDroughtTeam.vo;
import lombok.Data;
@Data
public class FloodDroughtTeamVo {
private Long teamId;
private String teamName;
}

@ -0,0 +1,71 @@
package com.ruoyi.ehsFloodDroughtWorker.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* ehs_flood_drought_worker
*
* @author ruoyi
* @date 2023-12-14
*/
@Data
@ToString
@NoArgsConstructor
@Accessors(chain = true)
@TableName("ehs_flood_drought_worker")
public class EhsFloodDroughtWorker extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
@TableId(type= IdType.AUTO)
private Long id;
/** 防汛抗旱队伍id */
private Long teamId;
/** 防汛抗旱队伍名称 */
@Excel(name = "防汛抗旱队伍名称")
private String teamName;
/** 人员姓名 */
@Excel(name = "人员姓名")
private String workerName;
/** 性别 */
@Excel(name = "性别(0-男,1-女)")
private Integer gender;
/** 出生年月日 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "出生年月(格式为:2023-12-12)", width = 30, dateFormat = "yyyy-MM-dd")
private Date birthday;
/** 身份证号 */
@Excel(name = "身份证号")
private String idCard;
/** 联系方式 */
@Excel(name = "联系方式")
private String phone;
/** 工作年限 */
@Excel(name = "工作年限")
private String workYear;
/** 技能特长 */
@Excel(name = "技能特长")
private String speciality;
}

@ -0,0 +1,28 @@
package com.ruoyi.ehsFloodDroughtWorker.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;
import java.util.Date;
@Data
public class FloodDroughtWorkerImportTemplate {
@Excel(name = "人员姓名", type = Excel.Type.ALL)
private String workerName;
@Excel(name = "性别(0-男,1-女)", type = Excel.Type.ALL)
private Integer gender;
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "出生年月(格式为:2023-12-12)", width = 30, dateFormat = "yyyy-MM-dd", type = Excel.Type.ALL)
private Date birthday;
@Excel(name = "身份证号", type = Excel.Type.ALL)
private String idCard;
@Excel(name = "联系方式", type = Excel.Type.ALL)
private String phone;
@Excel(name = "工作年限", type = Excel.Type.ALL)
private String workYear;
@Excel(name = "技能特长", type = Excel.Type.ALL)
private String speciality;
@Excel(name = "备注", type = Excel.Type.ALL)
private String remark;
}

@ -0,0 +1,41 @@
package com.ruoyi.ehsFloodDroughtWorker.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.ehsFloodDroughtTeam.domain.EhsFloodDroughtTeam;
import com.ruoyi.ehsFloodDroughtWorker.domain.EhsFloodDroughtWorker;
import java.util.List;
/**
* Mapper
*
* @author ruoyi
* @date 2023-12-14
*/
public interface EhsFloodDroughtWorkerMapper extends BaseMapper<EhsFloodDroughtWorker> {
/**
*
*
* @param id
* @return
*/
public EhsFloodDroughtWorker selectEhsFloodDroughtWorkerById(Long id);
/**
*
*
* @param ehsFloodDroughtWorker
* @return
*/
public List<EhsFloodDroughtWorker> selectEhsFloodDroughtWorkerList(EhsFloodDroughtWorker ehsFloodDroughtWorker);
/**
* ids
* @param teamIds ids
* @return
*/
public boolean removeWorkerByTeamIds(List<Long> teamIds);
// 根据teamId更新防汛抗旱人员信息
public boolean updateWorkerByTeamId(EhsFloodDroughtWorker ehsFloodDroughtWorker);
}

@ -0,0 +1,48 @@
package com.ruoyi.ehsFloodDroughtWorker.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.ehsFloodDroughtTeam.domain.EhsFloodDroughtTeam;
import com.ruoyi.ehsFloodDroughtWorker.domain.EhsFloodDroughtWorker;
import com.ruoyi.ehsFloodDroughtWorker.domain.FloodDroughtWorkerImportTemplate;
import java.util.List;
/**
* Service
*
* @author ruoyi
* @date 2023-12-14
*/
public interface IEhsFloodDroughtWorkerService extends IService<EhsFloodDroughtWorker> {
/**
*
*
* @param id
* @return
*/
public EhsFloodDroughtWorker selectEhsFloodDroughtWorkerById(Long id);
/**
*
*
* @param ehsFloodDroughtWorker
* @return
*/
public List<EhsFloodDroughtWorker> selectEhsFloodDroughtWorkerList(EhsFloodDroughtWorker ehsFloodDroughtWorker);
/**
* ids
*
* @param teamIds ids
* @return
*/
public boolean removeWorkerByTeamIds(List<Long> teamIds);
// 根据teamId更新防汛抗旱人员信息
public boolean updateWorkerByTeamId(EhsFloodDroughtTeam ehsFloodDroughtTeam);
//批量导入 params是防汛抗旱队伍id
public String importData(List<FloodDroughtWorkerImportTemplate> list, Boolean updateSupport, Long params) throws Exception;
}

@ -0,0 +1,138 @@
package com.ruoyi.ehsFloodDroughtWorker.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.ehsFloodDroughtTeam.domain.EhsFloodDroughtTeam;
import com.ruoyi.ehsFloodDroughtTeam.mapper.EhsFloodDroughtTeamMapper;
import com.ruoyi.ehsFloodDroughtTeam.vo.FloodDroughtTeamVo;
import com.ruoyi.ehsFloodDroughtWorker.domain.FloodDroughtWorkerImportTemplate;
import com.ruoyi.ehsRescueTeamWorker.domain.EhsRescueTeamWorker;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import com.ruoyi.common.utils.StringUtils;
import java.util.List;
import java.util.Map;
import com.ruoyi.ehsFloodDroughtWorker.mapper.EhsFloodDroughtWorkerMapper;
import com.ruoyi.ehsFloodDroughtWorker.domain.EhsFloodDroughtWorker;
import com.ruoyi.ehsFloodDroughtWorker.service.IEhsFloodDroughtWorkerService;
/**
* Service
*
* @author ruoyi
* @date 2023-12-14
*/
@Service
public class EhsFloodDroughtWorkerServiceImpl extends ServiceImpl<EhsFloodDroughtWorkerMapper, EhsFloodDroughtWorker> implements IEhsFloodDroughtWorkerService {
@Autowired
private EhsFloodDroughtWorkerMapper ehsFloodDroughtWorkerMapper;
@Autowired
private EhsFloodDroughtTeamMapper floodDroughtTeamMapper;
/**
*
*
* @param id
* @return
*/
@Override
public EhsFloodDroughtWorker selectEhsFloodDroughtWorkerById(Long id) {
return ehsFloodDroughtWorkerMapper.selectEhsFloodDroughtWorkerById(id);
}
/**
*
*
* @param ehsFloodDroughtWorker
* @return
*/
@Override
public List<EhsFloodDroughtWorker> selectEhsFloodDroughtWorkerList(EhsFloodDroughtWorker ehsFloodDroughtWorker) {
return ehsFloodDroughtWorkerMapper.selectEhsFloodDroughtWorkerList(ehsFloodDroughtWorker);
}
/**
* ids
* @param teamIds ids
* @return
*/
@Override
public boolean removeWorkerByTeamIds(List<Long> teamIds) {
return ehsFloodDroughtWorkerMapper.removeWorkerByTeamIds(teamIds);
}
// 根据teamId更新防汛抗旱人员信息
@Override
public boolean updateWorkerByTeamId(EhsFloodDroughtTeam ehsFloodDroughtTeam) {
EhsFloodDroughtWorker worker = new EhsFloodDroughtWorker();
worker.setTeamId(ehsFloodDroughtTeam.getId());
worker.setTeamName(ehsFloodDroughtTeam.getTeamName());
return ehsFloodDroughtWorkerMapper.updateWorkerByTeamId(worker);
}
//批量导入 params是防汛抗旱队伍id
@Override
public String importData(List<FloodDroughtWorkerImportTemplate> list, Boolean updateSupport, Long params) throws Exception {
if (StringUtils.isNull(list) || list.size() == 0) {
throw new Exception("导入防汛抗旱队伍人员信息数据不能为空!");
}
int successNum = 0;
int failureNum = 0;
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
for (FloodDroughtWorkerImportTemplate workerTemplate : list) {
EhsFloodDroughtWorker temp = new EhsFloodDroughtWorker();
// temp.setId(IdUtils.fastSimpleUUID());
temp.setTeamId(params);// 队伍id
FloodDroughtTeamVo floodDroughtTeamVo = floodDroughtTeamMapper.getTeamInfoByTeamId(params);
temp.setTeamName(floodDroughtTeamVo.getTeamName());// 队伍名称
temp.setWorkerName(workerTemplate.getWorkerName());// 人员姓名
temp.setGender(workerTemplate.getGender());// 性别
temp.setBirthday(workerTemplate.getBirthday());// 出生年月
temp.setIdCard(workerTemplate.getIdCard());// 身份证号
temp.setPhone(workerTemplate.getPhone());// 联系方式
temp.setWorkYear(workerTemplate.getWorkYear());// 工作年限
temp.setSpeciality(workerTemplate.getSpeciality());// 特长
temp.setRemark(workerTemplate.getRemark());// 备注
try {
//插入数据
this.save(temp);
successNum++;
successMsg.append("<br />" + successNum + "、防汛抗旱队伍信息" + temp.getTeamName() + "导入成功");
} catch (Exception e) {
e.printStackTrace();
log.error(e.getLocalizedMessage());
failureNum++;
successMsg.append("<br /><font color='red'>" + failureNum + "、防汛抗旱队伍信息" + temp.getTeamName() + "导入异常,请联系管理员!</font>");
continue;
}
}
return successMsg.toString();
}
private LambdaQueryWrapper<EhsFloodDroughtWorker> buildQueryWrapper(EhsFloodDroughtWorker query) {
Map<String, Object> params = query.getParams();
LambdaQueryWrapper<EhsFloodDroughtWorker> lqw = Wrappers.lambdaQuery();
lqw.eq(query.getTeamId() != null, EhsFloodDroughtWorker::getTeamId, query.getTeamId());
lqw.like(StringUtils.isNotBlank(query.getTeamName()), EhsFloodDroughtWorker::getTeamName, query.getTeamName());
lqw.like(StringUtils.isNotBlank(query.getWorkerName()), EhsFloodDroughtWorker::getWorkerName, query.getWorkerName());
lqw.eq(query.getGender() != null, EhsFloodDroughtWorker::getGender, query.getGender());
lqw.eq(query.getBirthday() != null, EhsFloodDroughtWorker::getBirthday, query.getBirthday());
lqw.eq(StringUtils.isNotBlank(query.getIdCard()), EhsFloodDroughtWorker::getIdCard, query.getIdCard());
lqw.eq(StringUtils.isNotBlank(query.getPhone()), EhsFloodDroughtWorker::getPhone, query.getPhone());
lqw.eq(StringUtils.isNotBlank(query.getWorkYear()), EhsFloodDroughtWorker::getWorkYear, query.getWorkYear());
lqw.eq(StringUtils.isNotBlank(query.getSpeciality()), EhsFloodDroughtWorker::getSpeciality, query.getSpeciality());
lqw.orderByDesc(EhsFloodDroughtWorker::getCreateTime);
lqw.eq(query.getDeptId() != null, EhsFloodDroughtWorker::getDeptId, query.getDeptId());
return lqw;
}
}

@ -35,10 +35,10 @@ public interface EhsRescueTeamMapper extends BaseMapper<EhsRescueTeam> {
* @param id
* @return
*/
Long getWorkerNumByTeamId(@Param("id") Long id);
public Long getWorkerNumByTeamId(@Param("id") Long id);
/**
* id
* :id
*/
TeamResponseVo getTeamInfoByTeamId(Long rescueTeamId);
public TeamResponseVo getTeamInfoByTeamId(Long rescueTeamId);
}

@ -40,7 +40,7 @@ public interface IEhsRescueTeamService extends IService<EhsRescueTeam> {
public String importRescueTeam(List<RescueTeamImportTemplate> list, Boolean updateSupport) throws Exception;
/**
* id
* :id
*/
TeamResponseVo getTeamInfoByTeamId(Long rescueTeamId);
public TeamResponseVo getTeamInfoByTeamId(Long rescueTeamId);
}

@ -59,7 +59,7 @@ public class EhsRescueTeamServiceImpl extends ServiceImpl<EhsRescueTeamMapper, E
}
/**
* id
* :id
*/
@Override
public TeamResponseVo getTeamInfoByTeamId(Long rescueTeamId) {

@ -30,4 +30,7 @@ public interface EhsRescueTeamWorkerMapper extends BaseMapper<EhsRescueTeamWorke
// 根据队伍ids删除队伍中的队员
boolean removeWorkerByTeamIds(List<Long> teamIds);
// 根据teamId更新应急救援人员信息
public boolean updateWorkerByTeamId(EhsRescueTeamWorker worker);
}

@ -3,6 +3,7 @@ package com.ruoyi.ehsRescueTeamWorker.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.ehsRescueTeam.domain.EhsRescueTeam;
import com.ruoyi.ehsRescueTeamWorker.domain.EhsRescueTeamWorker;
import com.ruoyi.ehsRescueTeamWorker.domain.RescueTeamWorkerImportTemplate;
@ -35,4 +36,7 @@ public interface IEhsRescueTeamWorkerService extends IService<EhsRescueTeamWorke
// 批量导入数据
public String importRescueTeamWorker(List<RescueTeamWorkerImportTemplate> list, Boolean updateSupport, Long params) throws Exception;
// 根据teamId更新应急救援人员信息
public boolean updateWorkerByTeamId(EhsRescueTeam ehsRescueTeam);
}

@ -115,6 +115,15 @@ public class EhsRescueTeamWorkerServiceImpl extends ServiceImpl<EhsRescueTeamWor
return successMsg.toString();
}
// 根据teamId更新应急救援人员信息
@Override
public boolean updateWorkerByTeamId(EhsRescueTeam ehsRescueTeam) {
EhsRescueTeamWorker worker = new EhsRescueTeamWorker();
worker.setRescueTeamId(ehsRescueTeam.getId());
worker.setRescueTeamName(ehsRescueTeam.getTeamName());
return ehsRescueTeamWorkerMapper.updateWorkerByTeamId(worker);
}
private LambdaQueryWrapper<EhsRescueTeamWorker> buildQueryWrapper(EhsRescueTeamWorker query) {
Map<String, Object> params = query.getParams();

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.ehsFloodDroughtTeam.mapper.EhsFloodDroughtTeamMapper">
<resultMap type="EhsFloodDroughtTeam" id="EhsFloodDroughtTeamResult">
<result property="id" column="id"/>
<result property="teamName" column="team_name"/>
<result property="teamLevel" column="team_level"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
<result property="deptId" column="dept_id"/>
<result property="createUserId" column="create_user_id"/>
<result property="updateUserId" column="update_user_id"/>
</resultMap>
<sql id="selectEhsFloodDroughtTeamVo">
select id, team_name, team_level, create_by, create_time, update_by, update_time, remark, dept_id, create_user_id, update_user_id from ehs_flood_drought_team
</sql>
<select id="selectEhsFloodDroughtTeamList" parameterType="EhsFloodDroughtTeam"
resultMap="EhsFloodDroughtTeamResult">
<include refid="selectEhsFloodDroughtTeamVo"/>
<where>
<if test="teamName != null and teamName != ''">and team_name like concat('%', #{teamName}, '%')</if>
<if test="teamLevel != null and teamLevel != ''">and team_level = #{teamLevel}</if>
<if test="deptId != null ">and dept_id = #{deptId}</if>
</where>
</select>
<select id="selectEhsFloodDroughtTeamById" parameterType="Long" resultMap="EhsFloodDroughtTeamResult">
<include refid="selectEhsFloodDroughtTeamVo"/>
where id = #{id}
</select>
<select id="getTeamInfoByTeamId" resultType="com.ruoyi.ehsFloodDroughtTeam.vo.FloodDroughtTeamVo">
SELECT id as teamId,team_name as teamName
FROM ehs_flood_drought_team
WHERE id = #{teamId}
</select>
<select id="getWorkerNumByTeamId" resultType="java.lang.Long">
SELECT IFNULL(
(SELECT COUNT(1) FROM
ehs_flood_drought_team t,
ehs_flood_drought_worker w
WHERE
t.id = w.team_id
AND t.id = #{id}
GROUP BY
t.id), 0)
</select>
</mapper>

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.ehsFloodDroughtWorker.mapper.EhsFloodDroughtWorkerMapper">
<resultMap type="EhsFloodDroughtWorker" id="EhsFloodDroughtWorkerResult">
<result property="id" column="id"/>
<result property="teamId" column="team_id"/>
<result property="teamName" column="team_name"/>
<result property="workerName" column="worker_name"/>
<result property="gender" column="gender"/>
<result property="birthday" column="birthday"/>
<result property="idCard" column="id_card"/>
<result property="phone" column="phone"/>
<result property="workYear" column="work_year"/>
<result property="speciality" column="speciality"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
<result property="deptId" column="dept_id"/>
<result property="createUserId" column="create_user_id"/>
<result property="updateUserId" column="update_user_id"/>
</resultMap>
<sql id="selectEhsFloodDroughtWorkerVo">
select id, team_id, team_name, worker_name, gender, birthday, id_card, phone, work_year, speciality, create_by, create_time, update_by, update_time, remark, dept_id, create_user_id, update_user_id from ehs_flood_drought_worker
</sql>
<select id="selectEhsFloodDroughtWorkerList" parameterType="EhsFloodDroughtWorker"
resultMap="EhsFloodDroughtWorkerResult">
<include refid="selectEhsFloodDroughtWorkerVo"/>
<where>
<if test="teamId != null ">and team_id = #{teamId}</if>
<if test="teamName != null and teamName != ''">and team_name like concat('%', #{teamName}, '%')</if>
<if test="workerName != null and workerName != ''">and worker_name like concat('%', #{workerName}, '%')
</if>
<if test="gender != null ">and gender = #{gender}</if>
<if test="birthday != null ">and birthday = #{birthday}</if>
<if test="idCard != null and idCard != ''">and id_card = #{idCard}</if>
<if test="phone != null and phone != ''">and phone = #{phone}</if>
<if test="workYear != null and workYear != ''">and work_year = #{workYear}</if>
<if test="speciality != null and speciality != ''">and speciality = #{speciality}</if>
<if test="deptId != null ">and dept_id = #{deptId}</if>
</where>
</select>
<select id="selectEhsFloodDroughtWorkerById" parameterType="Long" resultMap="EhsFloodDroughtWorkerResult">
<include refid="selectEhsFloodDroughtWorkerVo"/>
where id = #{id}
</select>
<update id="updateWorkerByTeamId">
update ehs_flood_drought_worker
<set>
<if test="teamName != null and teamName != ''">
team_name = #{teamName},
</if>
</set>
where team_id = #{teamId}
</update>
<delete id="removeWorkerByTeamIds">
delete from ehs_flood_drought_worker
where team_id in
<foreach collection="list" open="(" close=")" separator="," item="items">
#{items}
</foreach>
</delete>
</mapper>

@ -28,6 +28,15 @@
<sql id="selectEhsRescueTeamWorkerVo">
select id, rescue_team_id, rescue_team_name, worker_name, gender, birthday, id_card, phone, work_year, speciality, create_by, create_time, update_by, update_time, remark, dept_id, create_user_id, update_user_id from ehs_rescue_team_worker
</sql>
<update id="updateWorkerByTeamId">
update ehs_rescue_team_worker
<set>
<if test="rescueTeamName != null and rescueTeamName != ''">
rescue_team_name = #{rescueTeamName},
</if>
</set>
where rescue_team_id = #{rescueTeamId}
</update>
<select id="selectEhsRescueTeamWorkerList" parameterType="EhsRescueTeamWorker" resultMap="EhsRescueTeamWorkerResult">
<include refid="selectEhsRescueTeamWorkerVo"/>

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询防汛抗旱队伍管理列表
export function listEhsFloodDroughtTeam(query) {
return request({
url: '/ehs/ehsFloodDroughtTeam/list',
method: 'get',
params: query
})
}
// 查询防汛抗旱队伍管理详细
export function getEhsFloodDroughtTeam(id) {
return request({
url: '/ehs/ehsFloodDroughtTeam/' + id,
method: 'get'
})
}
// 新增防汛抗旱队伍管理
export function addEhsFloodDroughtTeam(data) {
return request({
url: '/ehs/ehsFloodDroughtTeam',
method: 'post',
data: data
})
}
// 修改防汛抗旱队伍管理
export function updateEhsFloodDroughtTeam(data) {
return request({
url: '/ehs/ehsFloodDroughtTeam',
method: 'put',
data: data
})
}
// 删除防汛抗旱队伍管理
export function delEhsFloodDroughtTeam(id) {
return request({
url: '/ehs/ehsFloodDroughtTeam/' + id,
method: 'delete'
})
}

@ -0,0 +1,52 @@
import request from '@/utils/request'
// 查询防汛抗旱队伍人员信息列表
export function listEhsFloodDroughtWorker(query) {
return request({
url: '/ehs/ehsFloodDroughtWorker/list',
method: 'get',
params: query
})
}
// 查询防汛抗旱队伍人员信息详细
export function getEhsFloodDroughtWorker(id) {
return request({
url: '/ehs/ehsFloodDroughtWorker/' + id,
method: 'get'
})
}
// 新增会话框查询防汛抗旱队伍信息
export function getFloodDroughtTeamInfo(teamId) {
return request({
url: '/ehs/ehsFloodDroughtWorker/getTeamInfo/' + teamId,
method: 'get'
})
}
// 新增防汛抗旱队伍人员信息
export function addEhsFloodDroughtWorker(data) {
return request({
url: '/ehs/ehsFloodDroughtWorker',
method: 'post',
data: data
})
}
// 修改防汛抗旱队伍人员信息
export function updateEhsFloodDroughtWorker(data) {
return request({
url: '/ehs/ehsFloodDroughtWorker',
method: 'put',
data: data
})
}
// 删除防汛抗旱队伍人员信息
export function delEhsFloodDroughtWorker(id) {
return request({
url: '/ehs/ehsFloodDroughtWorker/' + id,
method: 'delete'
})
}

@ -0,0 +1,341 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="队伍名称" prop="teamName">
<el-input
v-model="queryParams.teamName"
placeholder="请输入队伍名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="队伍级别" prop="teamLevel">
<el-input
v-model="queryParams.teamLevel"
placeholder="请输入队伍级别"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['ehs:ehsFloodDroughtTeam:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['ehs:ehsFloodDroughtTeam:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['ehs:ehsFloodDroughtTeam:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['ehs:ehsFloodDroughtTeam:export']"
>导出</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-upload2"
size="mini"
@click="handleImport"
>批量导入</el-button
>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="ehsFloodDroughtTeamList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center">
<template slot-scope="scope">
<span>{{ Number(scope.$index) + 1 }}</span>
</template>
</el-table-column>
<el-table-column label="队伍名称" align="center" prop="teamName" />
<el-table-column label="队伍级别" align="center" prop="teamLevel" />
<el-table-column label="救援人员数量" align="center" prop="rescueWorkerNum" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<!-- <el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['ehs:ehsFloodDroughtTeam:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['ehs:ehsFloodDroughtTeam:remove']"
>删除</el-button>-->
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="getWorker(scope.row)"
>人员信息</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改防汛抗旱队伍管理对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="队伍名称" prop="teamName">
<el-input v-model="form.teamName" placeholder="请输入队伍名称" />
</el-form-item>
<el-form-item label="队伍级别" prop="teamLevel">
<el-input v-model="form.teamLevel" placeholder="请输入队伍级别" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 人员信息 -->
<el-drawer
title="防汛抗旱队伍人员信息"
:visible.sync="drawer1"
size="70%"
v-if="drawer1"
>
<tdh :id="id" @flood="flood"></tdh>
</el-drawer>
<!-- 导入 -->
<importUpload
ref="uploadRef"
@ok="upLoadOk"
downUrl="/ehs/ehsFloodDroughtTeam/importTemplate"
temName="防汛抗旱队伍导入模板"
></importUpload>
</div>
</template>
<script>
import { listEhsFloodDroughtTeam, getEhsFloodDroughtTeam, delEhsFloodDroughtTeam, addEhsFloodDroughtTeam, updateEhsFloodDroughtTeam } from "@/api/ehs/ehsFloodDroughtTeam";
import importUpload from "@/components/upload/upload";
import tdh from "../ehsFloodDroughtWorker/index.vue";
export default {
name: "EhsFloodDroughtTeam",
components: {
importUpload,
tdh,
},
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
ehsFloodDroughtTeamList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
teamName: null,
teamLevel: null,
deptId: null,
},
//
form: {},
//
rules: {
},
// teamId
id: "",
drawer1: false,
};
},
created() {
this.getList();
},
methods: {
flood(){
this.resetQuery()
},
/** 查询防汛抗旱队伍管理列表 */
getList() {
this.loading = true;
listEhsFloodDroughtTeam(this.queryParams).then(response => {
this.ehsFloodDroughtTeamList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
teamName: null,
teamLevel: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
rescueWorkerNum: null,
remark: null,
deptId: null,
createUserId: null,
updateUserId: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加防汛抗旱队伍管理";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getEhsFloodDroughtTeam(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改防汛抗旱队伍管理";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateEhsFloodDroughtTeam(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addEhsFloodDroughtTeam(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除防汛抗旱队伍管理编号为"' + ids + '"的数据项?').then(function() {
return delEhsFloodDroughtTeam(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('ehs/ehsFloodDroughtTeam/export', {
...this.queryParams
}, `防汛抗旱队伍信息_${new Date().getTime()}.xlsx`)
},
/** 批量导入 */
handleImport() {
console.log(this.$refs.uploadRef.upload);
this.$refs.uploadRef.upload.open = true;
this.$refs.uploadRef.upload.title = "防汛抗旱队伍导入";
this.$refs.uploadRef.upload.url =
process.env.VUE_APP_BASE_API + "/ehs/ehsFloodDroughtTeam/importData";
},
/** 导入成功 */
upLoadOk() {
// console.log("")
this.getList();
},
/** 人员信息 */
getWorker(row) {
this.id = row.id;// teamId
console.log(this.id);
this.drawer1 = true;
},
}
};
</script>

@ -0,0 +1,429 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="队伍名称" prop="teamName">
<el-input
v-model="queryParams.teamName"
placeholder="请输入防汛抗旱队伍名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="人员姓名" prop="workerName">
<el-input
v-model="queryParams.workerName"
placeholder="请输入人员姓名"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="性别" prop="gender">
<el-select v-model="queryParams.gender" placeholder="请选择性别" clearable>
<el-option
v-for="dict in dict.type.sys_user_sex"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<!-- <el-form-item label="身份证号" prop="idCard">
<el-input
v-model="queryParams.idCard"
placeholder="请输入身份证号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<el-form-item label="联系方式" prop="phone">
<el-input
v-model="queryParams.phone"
placeholder="请输入联系方式"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="工作年限" prop="workYear">
<el-input
v-model="queryParams.workYear"
placeholder="请输入工作年限"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<!--v-hasPermi="['ehs:ehsFloodDroughtWorker:add']"-->
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<!--v-hasPermi="['ehs:ehsFloodDroughtWorker:edit']"-->
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<!--v-hasPermi="['ehs:ehsFloodDroughtWorker:remove']"-->
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<!--v-hasPermi="['ehs:ehsFloodDroughtWorker:export']"-->
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-upload2"
size="mini"
@click="handleImport"
>批量导入</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="ehsFloodDroughtWorkerList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center">
<template slot-scope="scope">
<span>{{ Number(scope.$index) + 1 }}</span>
</template>
</el-table-column>
<el-table-column label="队伍名称" align="center" prop="teamName" />
<el-table-column label="人员姓名" align="center" prop="workerName" />
<el-table-column label="性别" align="center" prop="gender">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_user_sex" :value="scope.row.gender"/>
</template>
</el-table-column>
<el-table-column label="出生年月" align="center" prop="birthday" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.birthday, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="身份证号" align="center" prop="idCard" />
<el-table-column label="联系方式" align="center" prop="phone" />
<el-table-column label="工作年限" align="center" prop="workYear" />
<el-table-column label="技能特长" align="center" prop="speciality" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<!--v-hasPermi="['ehs:ehsFloodDroughtWorker:edit']"-->
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button>
<!--v-hasPermi="['ehs:ehsFloodDroughtWorker:remove']"-->
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改防汛抗旱队伍人员信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" :disabled="true" label-width="80px">
<!-- <el-form-item label="防汛抗旱队伍id" prop="teamId">
<el-input v-model="form.teamId" placeholder="请输入防汛抗旱队伍id" />
</el-form-item>-->
<el-form-item label="队伍名称" prop="teamName">
<el-input v-model="form.teamName" placeholder="请输入防汛抗旱队伍名称" />
</el-form-item>
<el-form label-width="80px" :model="form">
<el-form-item label="人员姓名" prop="workerName">
<el-input v-model="form.workerName" placeholder="请输入人员姓名" />
</el-form-item>
<el-form-item label="性别" prop="gender">
<el-select v-model="form.gender" placeholder="请选择性别">
<el-option
v-for="dict in dict.type.sys_user_sex"
:key="dict.value"
:label="dict.label"
:value="parseInt(dict.value)"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="出生年月" prop="birthday">
<el-date-picker clearable
v-model="form.birthday"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择出生年月日">
</el-date-picker>
</el-form-item>
<el-form-item label="身份证号" prop="idCard">
<el-input v-model="form.idCard" placeholder="请输入身份证号" />
</el-form-item>
<el-form-item label="联系方式" prop="phone">
<el-input v-model="form.phone" placeholder="请输入联系方式" />
</el-form-item>
<el-form-item label="工作年限" prop="workYear">
<el-input v-model="form.workYear" placeholder="请输入工作年限" />
</el-form-item>
<el-form-item label="技能特长" prop="speciality">
<el-input v-model="form.speciality" placeholder="请输入技能特长" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
</el-form>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 导入 -->
<importUpload
ref="uploadRef"
@ok="upLoadOk"
downUrl="/ehs/ehsFloodDroughtWorker/importTemplate"
temName="防汛抗旱队伍人员信息导入模板"
></importUpload>
</div>
</template>
<script>
import { listEhsFloodDroughtWorker, getEhsFloodDroughtWorker, delEhsFloodDroughtWorker, addEhsFloodDroughtWorker, updateEhsFloodDroughtWorker,getFloodDroughtTeamInfo } from "@/api/ehs/ehsFloodDroughtWorker";
import importUpload from "@/components/upload/upload";
export default {
name: "EhsFloodDroughtWorker",
dicts: ['sys_user_sex'],
components: {
importUpload,
},
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
ehsFloodDroughtWorkerList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
teamId: null,
teamName: null,
workerName: null,
gender: null,
birthday: null,
idCard: null,
phone: null,
workYear: null,
speciality: null,
deptId: null,
},
//
form: {},
//
rules: {
}
};
},
props: {
// idteamId
id: {
type: Number
}
},
created() {
this.queryParams.teamId = this.id;
this.form.teamId = this.id;
this.getList();
},
methods: {
/** 查询防汛抗旱队伍人员信息列表 */
getList() {
this.loading = true;
listEhsFloodDroughtWorker(this.queryParams).then(response => {
this.ehsFloodDroughtWorkerList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
teamId: null,
teamName: null,
workerName: null,
gender: null,
birthday: null,
idCard: null,
phone: null,
workYear: null,
speciality: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null,
deptId: null,
createUserId: null,
updateUserId: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
const teamId = this.id;
getFloodDroughtTeamInfo(teamId).then(response => {
this.form = response.data;
this.open = true;
this.title = "添加防汛抗旱队伍人员信息";
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getEhsFloodDroughtWorker(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改防汛抗旱队伍人员信息";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateEhsFloodDroughtWorker(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addEhsFloodDroughtWorker(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
this.$emit('flood')
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除防汛抗旱队伍人员信息编号为"' + ids + '"的数据项?').then(function() {
return delEhsFloodDroughtWorker(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
this.$emit('flood');
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('ehs/ehsFloodDroughtWorker/export', {
...this.queryParams
}, `防汛抗旱人员信息_${new Date().getTime()}.xlsx`)
},
/** 批量导入 */
handleImport() {
console.log(this.$refs.uploadRef.upload);
this.$refs.uploadRef.upload.open = true;
this.$refs.uploadRef.upload.title = "防汛抗旱队伍人员信息导入";
this.$refs.uploadRef.upload.params = this.id;// teamId
this.$refs.uploadRef.upload.url =
process.env.VUE_APP_BASE_API + "/ehs/ehsFloodDroughtWorker/importData";
},
/** 导入成功 */
upLoadOk() {
// console.log("")
this.getList();
},
}
};
</script>

@ -93,12 +93,6 @@
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<!-- <el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="getWorker(scope.row)"
>人员信息</el-button>-->
<el-button
size="mini"
type="text"
@ -156,7 +150,7 @@
size="70%"
v-if="drawer1"
>
<tdh :id="id"></tdh>
<tdh :id="id" @rescue="rescue"></tdh>
</el-drawer>
<!-- 导入 -->
@ -200,10 +194,7 @@ export default {
title: "",
//
open: false,
// id
//rescueTeamId: "",
//
//rescueTeamName: "",
// teamId
id: "",
drawer1: false,
//
@ -224,6 +215,9 @@ export default {
this.getList();
},
methods: {
rescue() {
this.resetQuery();
},
/** 查询应急救援队伍管理列表 */
getList() {
this.loading = true;
@ -322,7 +316,7 @@ export default {
handleExport() {
this.download('ehs/ehsRescueTeam/export', {
...this.queryParams
}, `ehsRescueTeam_${new Date().getTime()}.xlsx`)
}, `应急救援队伍信息_${new Date().getTime()}.xlsx`)
},
/** 批量导入 */
handleImport() {
@ -339,31 +333,10 @@ export default {
},
/** 人员信息 */
getWorker(row) {
console.log(row);
this.id = row.id;
this.id = row.id;// teamId
console.log(this.id);
//this.rescueTeamId = row.id;
//this.rescueTeamName = row.teamName;
this.drawer1 = true;
// this.$router.push({
// path: "/smModel/tdh",
// query: {
// id: row.id,
// },
// });
},
/* getWorker(row) {
const id = Math.ceil(Math.random()*1000) ;
const rescueTeamId = row.id;
const rescueTeamName = row.teamName;
console.log(rescueTeamId)
console.log(rescueTeamName)
//this.$router.push({path:'/ehs/ehsRescueTeamWorker/index/' + id,query:{rescueTeamId:rescueTeamId,rescueTeamName:rescueTeamName}})
//this.$router.push({path:'/ehs/ehsRescueTeamWorker/index'})
//this.$router.push({path:'/ehsTeam/ehsRescueTeamWorker/index'})
//this.$router.push({path:'/ehs/ehsRescueTeamWorker/index'})
this.$router.push({path:'/ehs/ehsRescueTeamWorker/index/' + id,query:{rescueTeamId:rescueTeamId,rescueTeamName:rescueTeamName}})
}, */

@ -9,7 +9,7 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<el-form-item label="应急救援队伍名称" prop="rescueTeamName">
<el-form-item label="队伍名称" prop="rescueTeamName">
<el-input
v-model="queryParams.rescueTeamName"
placeholder="请输入应急救援队伍名称"
@ -150,7 +150,7 @@
</template>
</el-table-column>
<!-- <el-table-column label="应急救援队伍id" align="center" prop="rescueTeamId" />-->
<el-table-column label="应急救援队伍名称" align="center" prop="rescueTeamName" />
<el-table-column label="队伍名称" align="center" prop="rescueTeamName" />
<el-table-column label="人员姓名" align="center" prop="workerName" />
<el-table-column label="性别" align="center" prop="gender">
<template slot-scope="scope">
@ -203,7 +203,7 @@
<!-- <el-form-item label="应急救援队伍id" prop="rescueTeamId">
<el-input v-model="form.rescueTeamId" placeholder="请输入应急救援队伍id" />
</el-form-item>-->
<el-form-item label="应急救援队伍名称" prop="rescueTeamName">
<el-form-item label="队伍名称" prop="rescueTeamName">
<el-input v-model="form.rescueTeamName" placeholder="请输入应急救援队伍名称" />
</el-form-item>
<el-form label-width="80px" :model="form">
@ -426,6 +426,7 @@ export default {
}
}
});
this.$emit('rescue');
},
/** 删除按钮操作 */
handleDelete(row) {
@ -435,13 +436,14 @@ export default {
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
this.$emit('rescue');
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('ehs/ehsRescueTeamWorker/export', {
...this.queryParams
}, `ehsRescueTeamWorker_${new Date().getTime()}.xlsx`)
}, `应急救援人员信息_${new Date().getTime()}.xlsx`)
},
/** 批量导入 */
handleImport() {

Loading…
Cancel
Save