应急救援队伍管理和人员信息功能完成,人员信息缺个导入功能

main
15036302109 12 months ago
parent 16e5c64ae0
commit d5653a35b8

@ -0,0 +1,148 @@
package com.ruoyi.web.controller.ehs;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Arrays;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.ExcelExp;
import com.ruoyi.common.utils.ExcelExportUtil;
import com.ruoyi.ehsRescueTeam.domain.RescueTeamImportTemplate;
import com.ruoyi.ehsRescueTeamWorker.service.IEhsRescueTeamWorkerService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.ehsRescueTeam.domain.EhsRescueTeam;
import com.ruoyi.ehsRescueTeam.service.IEhsRescueTeamService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/**
* Controller
*
* @author ruoyi
* @date 2023-12-11
*/
@Api(tags = "应急救援队伍管理管理")
@RestController
@RequestMapping("/ehs/ehsRescueTeam")
public class EhsRescueTeamController extends BaseController {
@Autowired
private IEhsRescueTeamService ehsRescueTeamService;
@Autowired
private IEhsRescueTeamWorkerService ehsRescueTeamWorkerService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('ehs:ehsRescueTeam:list')")
@GetMapping("/list")
public TableDataInfo list(EhsRescueTeam ehsRescueTeam) {
startPage();
List<EhsRescueTeam> list = ehsRescueTeamService.selectEhsRescueTeamList(ehsRescueTeam);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ehs:ehsRescueTeam:export')")
@Log(title = "应急救援队伍管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, EhsRescueTeam ehsRescueTeam) {
List<EhsRescueTeam> list = ehsRescueTeamService.selectEhsRescueTeamList(ehsRescueTeam);
ExcelUtil<EhsRescueTeam> util = new ExcelUtil<EhsRescueTeam>(EhsRescueTeam.class);
util.exportExcel(response, list, "应急救援队伍管理数据");
}
/**
*
*/
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response) throws IOException {
List<EhsRescueTeam> ehsRescueTeamList = new ArrayList<>();
String[] header =
{"队伍名称#",
"队伍级别#",
"备注#"};
ExcelExp e1 = new ExcelExp("应急救援队伍信息", header, ehsRescueTeamList, EhsRescueTeam.class);
List<ExcelExp> mysheet = new ArrayList<>();
mysheet.add(e1);
ExcelExportUtil.exportManySheetExcel("应急救援队伍信息批量导入模板", mysheet, response);
}
/**
*
*/
@PostMapping("/importData")
public AjaxResult importHubManage(MultipartFile file, Boolean updateSupport) throws Exception {
ExcelUtil<RescueTeamImportTemplate> util = new ExcelUtil<>(RescueTeamImportTemplate.class);
List<RescueTeamImportTemplate> list = util.importExcel(file.getInputStream());
String message = ehsRescueTeamService.importRescueTeam(list, updateSupport);
return AjaxResult.success(message);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ehs:ehsRescueTeam:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(ehsRescueTeamService.selectEhsRescueTeamById(id));
}
/**
*
*/
@ApiOperation("新增应急救援队伍管理")
@PreAuthorize("@ss.hasPermi('ehs:ehsRescueTeam:add')")
@Log(title = "应急救援队伍管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody EhsRescueTeam ehsRescueTeam) {
return toAjax(ehsRescueTeamService.save(ehsRescueTeam));
}
/**
*
*/
@ApiOperation("修改应急救援队伍管理")
@PreAuthorize("@ss.hasPermi('ehs:ehsRescueTeam:edit')")
@Log(title = "应急救援队伍管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EhsRescueTeam ehsRescueTeam) {
return toAjax(ehsRescueTeamService.updateById(ehsRescueTeam));
}
/**
*
*/
@ApiOperation("删除应急救援队伍管理")
@PreAuthorize("@ss.hasPermi('ehs:ehsRescueTeam:remove')")
@Log(title = "应急救援队伍管理", businessType = BusinessType.DELETE)
@Transactional
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
// 根据队伍ids删除队伍
ehsRescueTeamService.removeByIds(Arrays.asList(ids));
// 根据队伍ids删除队伍中的队员
boolean result = ehsRescueTeamWorkerService.removeWorkerByTeamIds(Arrays.asList(ids));
return toAjax(result);
}
}

@ -0,0 +1,150 @@
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.ehsRescueTeam.domain.EhsRescueTeam;
import com.ruoyi.ehsRescueTeam.domain.RescueTeamImportTemplate;
import com.ruoyi.ehsRescueTeam.service.IEhsRescueTeamService;
import com.ruoyi.ehsRescueTeam.vo.TeamResponseVo;
import com.ruoyi.ehsRescueTeamWorker.domain.EhsRescueTeamWorker;
import com.ruoyi.ehsRescueTeamWorker.service.IEhsRescueTeamWorkerService;
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-11
*/
@Api(tags = "应急救援队人员信息管理")
@RestController
@RequestMapping("/ehs/ehsRescueTeamWorker")
public class EhsRescueTeamWorkerController extends BaseController {
@Autowired
private IEhsRescueTeamWorkerService ehsRescueTeamWorkerService;
@Autowired
private IEhsRescueTeamService ehsRescueTeamService;
/**
*
*/
//@PreAuthorize("@ss.hasPermi('ehs:ehsRescueTeamWorker:list')")
@GetMapping("/list")
public TableDataInfo list(EhsRescueTeamWorker ehsRescueTeamWorker) {
startPage();
List<EhsRescueTeamWorker> list = ehsRescueTeamWorkerService.selectEhsRescueTeamWorkerList(ehsRescueTeamWorker);
return getDataTable(list);
}
/**
*
*/
//@PreAuthorize("@ss.hasPermi('ehs:ehsRescueTeamWorker:export')")
@Log(title = "应急救援队人员信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, EhsRescueTeamWorker ehsRescueTeamWorker) {
List<EhsRescueTeamWorker> list = ehsRescueTeamWorkerService.selectEhsRescueTeamWorkerList(ehsRescueTeamWorker);
ExcelUtil<EhsRescueTeamWorker> util = new ExcelUtil<EhsRescueTeamWorker>(EhsRescueTeamWorker.class);
util.exportExcel(response, list, "应急救援队人员信息数据");
}
/**
*
*/
//@PreAuthorize("@ss.hasPermi('ehs:ehsRescueTeamWorker:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(ehsRescueTeamWorkerService.selectEhsRescueTeamWorkerById(id));
}
/**
* id
*/
@GetMapping(value = "/getTeamInfo/{rescueTeamId}")
public AjaxResult getTeamInfo(@PathVariable("rescueTeamId") Long rescueTeamId) {
TeamResponseVo teamResponseVo = ehsRescueTeamService.getTeamInfoByTeamId(rescueTeamId);
return success(teamResponseVo);
}
/**
*
*/
@ApiOperation("新增应急救援队人员信息")
//@PreAuthorize("@ss.hasPermi('ehs:ehsRescueTeamWorker:add')")
@Log(title = "应急救援队人员信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody EhsRescueTeamWorker ehsRescueTeamWorker) {
return toAjax(ehsRescueTeamWorkerService.save(ehsRescueTeamWorker));
}
/**
*
*/
@ApiOperation("修改应急救援队人员信息")
//@PreAuthorize("@ss.hasPermi('ehs:ehsRescueTeamWorker:edit')")
@Log(title = "应急救援队人员信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EhsRescueTeamWorker ehsRescueTeamWorker) {
return toAjax(ehsRescueTeamWorkerService.updateById(ehsRescueTeamWorker));
}
/**
*
*/
@ApiOperation("删除应急救援队人员信息")
//@PreAuthorize("@ss.hasPermi('ehs:ehsRescueTeamWorker:remove')")
@Log(title = "应急救援队人员信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(ehsRescueTeamWorkerService.removeByIds(Arrays.asList(ids)));
}
/**
*
*/
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response) throws IOException {
List<EhsRescueTeamWorker> teamWorkerList = new ArrayList<>();
String[] header =
{"人员姓名#",
"性别(0男 1女)#",
"出生年月(格式为2023-12-12)#",
"身份证号#",
"联系方式#",
"工作年限#",
"救援技能特长#",
"备注#"};
ExcelExp e1 = new ExcelExp("应急救援队伍人员信息", header, teamWorkerList, EhsRescueTeamWorker.class);
List<ExcelExp> mysheet = new ArrayList<>();
mysheet.add(e1);
ExcelExportUtil.exportManySheetExcel("应急救援队伍人员信息批量导入模板", mysheet, response);
}
/**
*
*/
@PostMapping("/importData")
public AjaxResult importHubManage(MultipartFile file, Boolean updateSupport) throws Exception {
ExcelUtil<RescueTeamImportTemplate> util = new ExcelUtil<>(RescueTeamImportTemplate.class);
List<RescueTeamImportTemplate> list = util.importExcel(file.getInputStream());
String message = ehsRescueTeamService.importRescueTeam(list, updateSupport);
return AjaxResult.success(message);
}
}

@ -0,0 +1,21 @@
package com.ruoyi.common.core.domain;
import lombok.Data;
import java.util.List;
@Data
public class ExcelExp {
private String fileName;// sheet的名称
private String[] handers;// sheet里的标题
private List dataset;// sheet里的数据集
private Class clazz;
public ExcelExp(String fileName, String[] handers, List dataset, Class clazz) {
this.fileName = fileName;
this.handers = handers;
this.dataset = dataset;
this.clazz=clazz;
}
}

@ -0,0 +1,81 @@
package com.ruoyi.common.utils;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.core.domain.ExcelExp;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.VerticalAlignment;
import javax.servlet.http.HttpServletResponse;
import java.net.URLEncoder;
import java.util.Collections;
import java.util.List;
/**
* sheet
*/
public class ExcelExportUtil {
public static void exportManySheetExcel(String fileName, List<ExcelExp> mysheets, HttpServletResponse response) {
HSSFWorkbook wb = new HSSFWorkbook();//创建工作薄
List<ExcelExp> sheets = mysheets;
//表头样式
HSSFCellStyle style = wb.createCellStyle();
style.setVerticalAlignment(VerticalAlignment.CENTER);// 垂直
style.setAlignment(HorizontalAlignment.CENTER);// 水平
//字体样式
HSSFFont fontStyle = wb.createFont();
fontStyle.setFontName("微软雅黑");
fontStyle.setFontHeightInPoints((short) 12);
style.setFont(fontStyle);
for (ExcelExp excel : sheets) {
//新建一个sheet
HSSFSheet sheet = wb.createSheet(excel.getFileName());//获取该sheet名称
String[] handers = excel.getHanders();//获取sheet的标题名
String[] header = new String[handers.length];
String[] code = new String[handers.length];
for (int i = 0; i < handers.length; i++) {
String[] temp = handers[i].split("#");//由两部分组成
header[i] = temp[0];//#号之前的是标题汉字
if (temp.length > 1) {
code[i] = temp[1]; //#号之后的是查询出得映射字段
}
}
HSSFRow rowFirst = sheet.createRow(0);//第一个sheet的第一行为标题
//写标题
for (int i = 0; i < header.length; i++) {
//获取第一行的每个单元格
HSSFCell cell = rowFirst.createCell(i);
//往单元格里写数据
cell.setCellValue(header[i]);
cell.setCellStyle(style); //加样式
sheet.setColumnWidth(i, 10000); //设置每列的列宽
}
//写数据集
List clazz = Collections.singletonList(excel.getClazz());
clazz = excel.getDataset();
for (int i = 0; i < clazz.size(); i++) { //获取多少行
HSSFRow row = sheet.createRow(i + 1); //设置行
String json = JSONUtil.parse(clazz.get(i)).toString();
JSONObject jsonObject = JSONObject.parseObject(json); //转换成json
for (int j = 0; j < header.length; j++) {
row.createCell(j).setCellValue((String) jsonObject.get(code[j])); //填充指定的单元格
}
}
}
//下载
try {
HSSFWorkbook hssfWorkbook = new HSSFWorkbook();
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName + ".xls", "utf-8"));
response.setHeader("Cache-Control", "No-cache");
response.flushBuffer();
wb.write(response.getOutputStream());
wb.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}

@ -0,0 +1,53 @@
package com.ruoyi.ehsRescueTeam.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_rescue_team
*
* @author ruoyi
* @date 2023-12-11
*/
@Data
@ToString
@NoArgsConstructor
@Accessors(chain = true)
@TableName("ehs_rescue_team")
public class EhsRescueTeam 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,20 @@
package com.ruoyi.ehsRescueTeam.domain;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;
@Data
public class RescueTeamImportTemplate {
/** 队伍名称 */
@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.ehsRescueTeam.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.ehsRescueTeam.domain.EhsRescueTeam;
import com.ruoyi.ehsRescueTeam.vo.TeamResponseVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Mapper
*
* @author ruoyi
* @date 2023-12-11
*/
public interface EhsRescueTeamMapper extends BaseMapper<EhsRescueTeam> {
/**
*
*
* @param id
* @return
*/
public EhsRescueTeam selectEhsRescueTeamById(Long id);
/**
*
*
* @param ehsRescueTeam
* @return
*/
public List<EhsRescueTeam> selectEhsRescueTeamList(EhsRescueTeam ehsRescueTeam);
/**
* id
* @param id
* @return
*/
Long getWorkerNumByTeamId(@Param("id") Long id);
/**
* id
*/
TeamResponseVo getTeamInfoByTeamId(Long rescueTeamId);
}

@ -0,0 +1,46 @@
package com.ruoyi.ehsRescueTeam.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.ehsRescueTeam.domain.EhsRescueTeam;
import com.ruoyi.ehsRescueTeam.domain.RescueTeamImportTemplate;
import com.ruoyi.ehsRescueTeam.vo.TeamResponseVo;
import java.util.List;
/**
* Service
*
* @author ruoyi
* @date 2023-12-11
*/
public interface IEhsRescueTeamService extends IService<EhsRescueTeam> {
/**
*
*
* @param id
* @return
*/
public EhsRescueTeam selectEhsRescueTeamById(Long id);
/**
*
*
* @param ehsRescueTeam
* @return
*/
public List<EhsRescueTeam> selectEhsRescueTeamList(EhsRescueTeam ehsRescueTeam);
/**
*
* @param list
* @param updateSupport
* @return
*/
public String importRescueTeam(List<RescueTeamImportTemplate> list, Boolean updateSupport) throws Exception;
/**
* id
*/
TeamResponseVo getTeamInfoByTeamId(Long rescueTeamId);
}

@ -0,0 +1,123 @@
package com.ruoyi.ehsRescueTeam.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.ehsRescueTeam.domain.EhsRescueTeam;
import com.ruoyi.ehsRescueTeam.domain.RescueTeamImportTemplate;
import com.ruoyi.ehsRescueTeam.mapper.EhsRescueTeamMapper;
import com.ruoyi.ehsRescueTeam.service.IEhsRescueTeamService;
import com.ruoyi.ehsRescueTeam.vo.TeamResponseVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* Service
*
* @author ruoyi
* @date 2023-12-11
*/
@Service
public class EhsRescueTeamServiceImpl extends ServiceImpl<EhsRescueTeamMapper, EhsRescueTeam> implements IEhsRescueTeamService {
@Autowired
private EhsRescueTeamMapper ehsRescueTeamMapper;
/**
*
*
* @param id
* @return
*/
@Override
public EhsRescueTeam selectEhsRescueTeamById(Long id) {
return ehsRescueTeamMapper.selectEhsRescueTeamById(id);
}
/**
*
*
* @param ehsRescueTeam
* @return
*/
@Override
public List<EhsRescueTeam> selectEhsRescueTeamList(EhsRescueTeam ehsRescueTeam) {
List<EhsRescueTeam> ehsRescueTeamList = ehsRescueTeamMapper.selectEhsRescueTeamList(ehsRescueTeam);
ehsRescueTeamList.stream().forEach(item->{
Long count = ehsRescueTeamMapper.getWorkerNumByTeamId(item.getId());
if (count != null){
item.setRescueWorkerNum(count);
}
});
return ehsRescueTeamList;
}
/**
* id
*/
@Override
public TeamResponseVo getTeamInfoByTeamId(Long rescueTeamId) {
return ehsRescueTeamMapper.getTeamInfoByTeamId(rescueTeamId);
}
/**
*
* @param list
* @param updateSupport
* @return
*/
@Override
public String importRescueTeam(List<RescueTeamImportTemplate> 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 (RescueTeamImportTemplate rescueTeamTemplate : list) {
EhsRescueTeam temp = new EhsRescueTeam();
/**
* ,id,idString,uuid
* id,,id
*/
// temp.setId(IdUtils.fastSimpleUUID());
temp.setTeamName(rescueTeamTemplate.getTeamName()); //队伍名称
temp.setTeamLevel(rescueTeamTemplate.getTeamLevel()); //队伍级别
temp.setRemark(rescueTeamTemplate.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<EhsRescueTeam> buildQueryWrapper(EhsRescueTeam query) {
Map<String, Object> params = query.getParams();
LambdaQueryWrapper<EhsRescueTeam> lqw = Wrappers.lambdaQuery();
lqw.like(StringUtils.isNotBlank(query.getTeamName()), EhsRescueTeam::getTeamName, query.getTeamName());
lqw.like(StringUtils.isNotBlank(query.getTeamLevel()), EhsRescueTeam::getTeamLevel, query.getTeamLevel());
lqw.orderByDesc(EhsRescueTeam::getCreateTime);
return lqw;
}
}

@ -0,0 +1,10 @@
package com.ruoyi.ehsRescueTeam.vo;
import lombok.Data;
@Data
public class TeamResponseVo {
private Long rescueTeamId;
private String rescueTeamName;
}

@ -0,0 +1,92 @@
package com.ruoyi.ehsRescueTeamWorker.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_rescue_team_worker
*
* @author ruoyi
* @date 2023-12-11
*/
@Data
@ToString
@NoArgsConstructor
@Accessors(chain = true)
@TableName("ehs_rescue_team_worker")
public class EhsRescueTeamWorker extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId(type = IdType.AUTO)
private Long id;
/**
* id
*/
@Excel(name = "应急救援队伍id")
private Long rescueTeamId;
/**
*
*/
@Excel(name = "应急救援队伍名称")
private String rescueTeamName;
/**
*
*/
@Excel(name = "人员姓名")
private String workerName;
/**
*
*/
@Excel(name = "性别")
private Integer gender;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "出生年月", 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,33 @@
package com.ruoyi.ehsRescueTeamWorker.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.ehsRescueTeamWorker.domain.EhsRescueTeamWorker;
import java.util.List;
/**
* Mapper
*
* @author ruoyi
* @date 2023-12-11
*/
public interface EhsRescueTeamWorkerMapper extends BaseMapper<EhsRescueTeamWorker> {
/**
*
*
* @param id
* @return
*/
public EhsRescueTeamWorker selectEhsRescueTeamWorkerById(Long id);
/**
*
*
* @param ehsRescueTeamWorker
* @return
*/
public List<EhsRescueTeamWorker> selectEhsRescueTeamWorkerList(EhsRescueTeamWorker ehsRescueTeamWorker);
// 根据队伍ids删除队伍中的队员
boolean removeWorkerByTeamIds(List<Long> teamIds);
}

@ -0,0 +1,34 @@
package com.ruoyi.ehsRescueTeamWorker.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.ehsRescueTeamWorker.domain.EhsRescueTeamWorker;
/**
* Service
*
* @author ruoyi
* @date 2023-12-11
*/
public interface IEhsRescueTeamWorkerService extends IService<EhsRescueTeamWorker> {
/**
*
*
* @param id
* @return
*/
public EhsRescueTeamWorker selectEhsRescueTeamWorkerById(Long id);
/**
*
*
* @param ehsRescueTeamWorker
* @return
*/
public List<EhsRescueTeamWorker> selectEhsRescueTeamWorkerList(EhsRescueTeamWorker ehsRescueTeamWorker);
// 根据队伍ids删除队伍中的队员
boolean removeWorkerByTeamIds(List<Long> teamIds);
}

@ -0,0 +1,74 @@
package com.ruoyi.ehsRescueTeamWorker.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 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.ehsRescueTeamWorker.mapper.EhsRescueTeamWorkerMapper;
import com.ruoyi.ehsRescueTeamWorker.domain.EhsRescueTeamWorker;
import com.ruoyi.ehsRescueTeamWorker.service.IEhsRescueTeamWorkerService;
/**
* Service
*
* @author ruoyi
* @date 2023-12-11
*/
@Service
public class EhsRescueTeamWorkerServiceImpl extends ServiceImpl<EhsRescueTeamWorkerMapper, EhsRescueTeamWorker> implements IEhsRescueTeamWorkerService {
@Autowired
private EhsRescueTeamWorkerMapper ehsRescueTeamWorkerMapper;
/**
*
*
* @param id
* @return
*/
@Override
public EhsRescueTeamWorker selectEhsRescueTeamWorkerById(Long id) {
return ehsRescueTeamWorkerMapper.selectEhsRescueTeamWorkerById(id);
}
/**
*
*
* @param ehsRescueTeamWorker
* @return
*/
@Override
public List<EhsRescueTeamWorker> selectEhsRescueTeamWorkerList(EhsRescueTeamWorker ehsRescueTeamWorker) {
return ehsRescueTeamWorkerMapper.selectEhsRescueTeamWorkerList(ehsRescueTeamWorker);
}
// 根据队伍ids删除队伍中的队员
@Override
public boolean removeWorkerByTeamIds(List<Long> teamIds) {
return ehsRescueTeamWorkerMapper.removeWorkerByTeamIds(teamIds);
}
private LambdaQueryWrapper<EhsRescueTeamWorker> buildQueryWrapper(EhsRescueTeamWorker query) {
Map<String, Object> params = query.getParams();
LambdaQueryWrapper<EhsRescueTeamWorker> lqw = Wrappers.lambdaQuery();
lqw.eq(query.getRescueTeamId() != null, EhsRescueTeamWorker::getRescueTeamId, query.getRescueTeamId());
lqw.like(StringUtils.isNotBlank(query.getRescueTeamName()), EhsRescueTeamWorker::getRescueTeamName, query.getRescueTeamName());
lqw.like(StringUtils.isNotBlank(query.getWorkerName()), EhsRescueTeamWorker::getWorkerName, query.getWorkerName());
lqw.eq(query.getGender() != null, EhsRescueTeamWorker::getGender, query.getGender());
lqw.eq(query.getBirthday() != null, EhsRescueTeamWorker::getBirthday, query.getBirthday());
lqw.eq(StringUtils.isNotBlank(query.getIdCard()), EhsRescueTeamWorker::getIdCard, query.getIdCard());
lqw.eq(StringUtils.isNotBlank(query.getPhone()), EhsRescueTeamWorker::getPhone, query.getPhone());
lqw.eq(StringUtils.isNotBlank(query.getWorkYear()), EhsRescueTeamWorker::getWorkYear, query.getWorkYear());
lqw.eq(StringUtils.isNotBlank(query.getSpeciality()), EhsRescueTeamWorker::getSpeciality, query.getSpeciality());
lqw.orderByDesc(EhsRescueTeamWorker::getCreateTime);
return lqw;
}
}

@ -0,0 +1,56 @@
<?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.ehsRescueTeam.mapper.EhsRescueTeamMapper">
<resultMap type="EhsRescueTeam" id="EhsRescueTeamResult">
<result property="id" column="id" />
<result property="teamName" column="team_name" />
<result property="teamLevel" column="team_level" />
<!--<result property="rescueWorkerNum" column="rescue_worker_num" />-->
<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="selectEhsRescueTeamVo">
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_rescue_team
</sql>
<select id="selectEhsRescueTeamList" parameterType="EhsRescueTeam" resultMap="EhsRescueTeamResult">
<include refid="selectEhsRescueTeamVo"/>
<where>
<if test="teamName != null and teamName != ''"> and team_name like concat('%', #{teamName}, '%')</if>
<if test="teamLevel != null and teamLevel != ''"> and team_level like concat('%', #{teamLevel}, '%')</if>
</where>
</select>
<select id="selectEhsRescueTeamById" parameterType="Long" resultMap="EhsRescueTeamResult">
<include refid="selectEhsRescueTeamVo"/>
where id = #{id}
</select>
<select id="getWorkerNumByTeamId" resultType="java.lang.Long">
SELECT IFNULL(
(SELECT COUNT(1) FROM
ehs_rescue_team t,
ehs_rescue_team_worker w
WHERE
t.id = w.rescue_team_id
AND t.id = #{id}
GROUP BY
t.id), 0)
</select>
<select id="getTeamInfoByTeamId" resultType="com.ruoyi.ehsRescueTeam.vo.TeamResponseVo">
SELECT id as rescueTeamId,team_name as rescueTeamName
FROM ehs_rescue_team
WHERE id = #{rescueTeamId}
</select>
</mapper>

@ -0,0 +1,62 @@
<?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.ehsRescueTeamWorker.mapper.EhsRescueTeamWorkerMapper">
<resultMap type="EhsRescueTeamWorker" id="EhsRescueTeamWorkerResult">
<result property="id" column="id" />
<result property="rescueTeamId" column="rescue_team_id" />
<result property="rescueTeamName" column="rescue_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="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>
<select id="selectEhsRescueTeamWorkerList" parameterType="EhsRescueTeamWorker" resultMap="EhsRescueTeamWorkerResult">
<include refid="selectEhsRescueTeamWorkerVo"/>
<where>
<if test="rescueTeamId != null "> and rescue_team_id = #{rescueTeamId}</if>
<if test="rescueTeamName != null and rescueTeamName != ''"> and rescue_team_name like concat('%', #{rescueTeamName}, '%')</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>
</where>
</select>
<select id="selectEhsRescueTeamWorkerById" parameterType="Long" resultMap="EhsRescueTeamWorkerResult">
<include refid="selectEhsRescueTeamWorkerVo"/>
where id = #{id}
</select>
<delete id="removeWorkerByTeamIds">
delete from ehs_rescue_team_worker
where rescue_team_id in
<foreach collection="list" separator="," open="(" close=")" item="items">
#{items}
</foreach>
</delete>
</mapper>

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询应急救援队伍管理列表
export function listEhsRescueTeam(query) {
return request({
url: '/ehs/ehsRescueTeam/list',
method: 'get',
params: query
})
}
// 查询应急救援队伍管理详细
export function getEhsRescueTeam(id) {
return request({
url: '/ehs/ehsRescueTeam/' + id,
method: 'get'
})
}
// 新增应急救援队伍管理
export function addEhsRescueTeam(data) {
return request({
url: '/ehs/ehsRescueTeam',
method: 'post',
data: data
})
}
// 修改应急救援队伍管理
export function updateEhsRescueTeam(data) {
return request({
url: '/ehs/ehsRescueTeam',
method: 'put',
data: data
})
}
// 删除应急救援队伍管理
export function delEhsRescueTeam(id) {
return request({
url: '/ehs/ehsRescueTeam/' + id,
method: 'delete'
})
}

@ -0,0 +1,52 @@
import request from '@/utils/request'
// 查询应急救援队人员信息列表
export function listEhsRescueTeamWorker(query) {
return request({
url: '/ehs/ehsRescueTeamWorker/list',
method: 'get',
params: query
})
}
// 查询应急救援队人员信息详细
export function getEhsRescueTeamWorker(id) {
return request({
url: '/ehs/ehsRescueTeamWorker/' + id,
method: 'get'
})
}
// 新增会话框查询队伍信息
export function getTeamInfo(rescueTeamId) {
return request({
url: '/ehs/ehsRescueTeamWorker/getTeamInfo/' + rescueTeamId,
method: 'get'
})
}
// 新增应急救援队人员信息
export function addEhsRescueTeamWorker(data) {
return request({
url: '/ehs/ehsRescueTeamWorker',
method: 'post',
data: data
})
}
// 修改应急救援队人员信息
export function updateEhsRescueTeamWorker(data) {
return request({
url: '/ehs/ehsRescueTeamWorker',
method: 'put',
data: data
})
}
// 删除应急救援队人员信息
export function delEhsRescueTeamWorker(id) {
return request({
url: '/ehs/ehsRescueTeamWorker/' + id,
method: 'delete'
})
}

@ -0,0 +1,107 @@
<template>
<el-dialog
:title="upload.title"
:visible.sync="upload.open"
width="400px"
append-to-body
>
<el-upload
ref="upload"
:limit="3"
accept=".xlsx, .xls"
:headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:auto-upload="false"
drag
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div class="el-upload__tip text-center" slot="tip">
<div class="el-upload__tip" slot="tip">
<el-checkbox v-model="upload.updateSupport" />
是否更新已经存在的用户数据
</div>
<span>仅允许导入xlsxlsx格式文件</span>
<el-link
type="primary"
:underline="false"
style="font-size: 12px; vertical-align: baseline"
@click="importTemplate"
>下载模板</el-link
>
</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm"> </el-button>
<el-button @click="upload.open = false"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { getToken } from "@/utils/auth";
export default {
data() {
return {
//
upload: {
//
open: false,
//
title: "",
//
isUploading: false,
//
updateSupport: false,
//
headers: { Authorization: "Bearer " + getToken() },
//
url: process.env.VUE_APP_BASE_API + "/system/user/importData",
},
};
},
props: {
downUrl: {
type: String,
},
temName: {
type: String,
},
},
created() {},
methods: {
/** 下载模板操作 */
importTemplate() {
this.download(this.downUrl, {}, `${this.temName}.xls`);
},
//
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true;
},
//
handleFileSuccess(response, file, fileList) {
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.$alert(
"<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
response.msg +
"</div>",
"导入结果",
{ dangerouslyUseHTMLString: true }
);
// this.getList();
this.$emit("ok");
},
//
submitFileForm() {
this.$refs.upload.submit();
},
},
};
</script>
<style></style>

@ -215,15 +215,6 @@
</template>
</el-table-column>
<!-- <el-table-column label="流转状态" align="center" prop="docTransferStatus">
&lt;!&ndash; <template slot-scope="scope">
<dict-tag :options="dict.type.doc_status" :value="scope.row.docTransferStatus"/>
</template>&ndash;&gt;
&lt;!&ndash; <el-select v-model="docTransferStatus" placeholder="请选择流转状态" clearable>
<el-option label="未处理" value="0"> </el-option>
<el-option label="已处理" value="1"> </el-option>
</el-select>&ndash;&gt;
</el-table-column>-->
<el-table-column label="流转状态" align="center" prop="docTransferStatus">
<template slot-scope="scope">
<span v-if="scope.row.docTransferStatus == '0'"></span>
@ -238,27 +229,26 @@
<!--公文借出会话框-->
<el-dialog :title="title2" :visible.sync="open2" width="600px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form :disabled="true" ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="公文名称" prop="documentName">
<el-input v-model="form.documentName" placeholder="请输入公文名称"/>
</el-form-item>
<el-form label-width="80px" :model="form">
<el-form-item label="流转人" prop="transferName">
<el-input v-model="form.transferName" placeholder="请输入流转人"/>
</el-form-item>
<!--<el-form-item label="拟稿部门" prop="draftDept">
<el-input v-model="form.draftDept" placeholder="请输入拟稿部门" />
</el-form-item>-->
<el-form-item label="流转时间" prop="transferTime">
<el-date-picker clearable
v-model="form.transferTime"
type="date"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择流转时间"
>
</el-date-picker>
</el-form-item>
</el-form>
</el-form>
<div slot="footer" class="dialog-footer">
@ -432,11 +422,6 @@ export default {
this.$modal.msgSuccess('归还成功')
this.getList()
})
/* lendEhsDoc(this.form).then(response => {
this.$modal.msgSuccess('借出成功')
this.open2 = false
this.getList()
}) */
},
/** 流转记录按钮操作 */
transferRecord(row) {

@ -0,0 +1,373 @@
<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:ehsRescueTeam: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:ehsRescueTeam: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:ehsRescueTeam: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:ehsRescueTeam: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="ehsRescueTeamList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="主键" align="center" prop="id" />-->
<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="getWorker(scope.row)"
>人员信息</el-button>-->
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="getWorker(scope.row)"
>人员信息</el-button>
<!-- <el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['ehs:ehsRescueTeam:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['ehs:ehsRescueTeam:remove']"
>删除</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"></tdh>
</el-drawer>
<!-- 导入 -->
<importUpload
ref="uploadRef"
@ok="upLoadOk"
downUrl="/ehs/ehsRescueTeam/importTemplate"
temName="应急救援队伍导入模板"
></importUpload>
</div>
</template>
<script>
import { listEhsRescueTeam, getEhsRescueTeam, delEhsRescueTeam, addEhsRescueTeam, updateEhsRescueTeam } from "@/api/ehs/ehsRescueTeam";
import { listEhsRescueTeamWorker, getEhsRescueTeamWorker, delEhsRescueTeamWorker, addEhsRescueTeamWorker, updateEhsRescueTeamWorker } from "@/api/ehs/ehsRescueTeamWorker";
import importUpload from "@/components/upload/upload";
import tdh from "../ehsRescueTeamWorker/index.vue"
export default {
name: "EhsRescueTeam",
components: {
importUpload,
tdh,
},
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
ehsRescueTeamList: [],
//
title: "",
//
open: false,
// id
//rescueTeamId: "",
//
//rescueTeamName: "",
id: "",
drawer1: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
teamName: null,
teamLevel: null,
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询应急救援队伍管理列表 */
getList() {
this.loading = true;
listEhsRescueTeam(this.queryParams).then(response => {
this.ehsRescueTeamList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
teamName: null,
teamLevel: null,
rescueWorkerNum: 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();
this.open = true;
this.title = "添加应急救援队伍管理";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getEhsRescueTeam(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) {
updateEhsRescueTeam(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addEhsRescueTeam(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 delEhsRescueTeam(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('ehs/ehsRescueTeam/export', {
...this.queryParams
}, `ehsRescueTeam_${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/ehsRescueTeam/importData";
},
/** 导入成功 */
upLoadOk() {
// console.log("")
this.getList();
},
/** 人员信息 */
getWorker(row) {
console.log(row);
this.id = row.id;
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}})
}, */
}
};
</script>

@ -0,0 +1,461 @@
<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="应急救援队伍id" prop="rescueTeamId">
<el-input
v-model="queryParams.rescueTeamId"
placeholder="请输入应急救援队伍id"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<el-form-item label="应急救援队伍名称" prop="rescueTeamName">
<el-input
v-model="queryParams.rescueTeamName"
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="birthday">
<el-date-picker clearable
v-model="queryParams.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="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 label="救援技能特长" prop="speciality">
<el-input
v-model="queryParams.speciality"
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:ehsRescueTeamWorker: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:ehsRescueTeamWorker: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:ehsRescueTeamWorker: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:ehsRescueTeamWorker: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="ehsRescueTeamWorkerList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="主键" align="center" prop="id" />-->
<el-table-column label="序号" align="center">
<template slot-scope="scope">
<span>{{ Number(scope.$index) + 1 }}</span>
</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="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:ehsRescueTeamWorker:edit']"-->
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button>
<!--v-hasPermi="['ehs:ehsRescueTeamWorker: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" label-width="80px" :disabled="true">
<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-input v-model="form.rescueTeamName" 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/ehsRescueTeamWorker/importTemplate"
temName="应急救援队伍人员导入模板"
></importUpload>
</div>
</template>
<script>
import {
listEhsRescueTeamWorker,
getEhsRescueTeamWorker,
delEhsRescueTeamWorker,
addEhsRescueTeamWorker,
updateEhsRescueTeamWorker,
getTeamInfo
} from '@/api/ehs/ehsRescueTeamWorker'
import importUpload from "@/components/upload/upload";
export default {
name: "EhsRescueTeamWorker",
components: {
importUpload,
},
dicts: ['sys_user_sex'],
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
ehsRescueTeamWorkerList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
rescueTeamId: null,
rescueTeamName: null,
workerName: null,
gender: null,
birthday: null,
idCard: null,
phone: null,
workYear: null,
speciality: null,
},
//
form: {},
//
rules: {
}
};
},
props: {
// rescueTeamId
id: {
type: Number
}
},
created() {
this.queryParams.rescueTeamId =this.id;
this.form.rescueTeamId = this.id;
this.getList();
},
methods: {
/** 查询应急救援队人员信息列表 */
getList() {
this.loading = true;
listEhsRescueTeamWorker(this.queryParams).then(response => {
this.ehsRescueTeamWorkerList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
rescueTeamId: null,
rescueTeamName: 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();
//this.open = true;
//this.title = "";
const rescueTeamId = this.id;
getTeamInfo(rescueTeamId).then(response => {
this.form = response.data;
this.open = true;
this.title = "新增应急救援队人员信息";
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getEhsRescueTeamWorker(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) {
updateEhsRescueTeamWorker(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addEhsRescueTeamWorker(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 delEhsRescueTeamWorker(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('ehs/ehsRescueTeamWorker/export', {
...this.queryParams
}, `ehsRescueTeamWorker_${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/ehsRescueTeamWorker/importData";
},
/** 导入成功 */
upLoadOk() {
// console.log("")
this.getList();
},
}
};
</script>
Loading…
Cancel
Save