应急救援队伍管理和人员信息功能完成,人员信息缺个导入功能
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,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需要处理,如果id是String类型,那么生成个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,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…
Reference in New Issue