累计跟新

main
liukewei 11 months ago
parent e1da5981ce
commit d2c41810c4

@ -2,7 +2,14 @@ package com.ruoyi.web.controller.ehs;
import java.util.List; import java.util.List;
import java.util.Arrays; import java.util.Arrays;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.ehsRescueTeam.domain.RescueTeamImportTemplate;
import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.system.service.ISysDictDataService;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -23,6 +30,7 @@ import com.ruoyi.ehsEnterprise.domain.EhsEnterprise;
import com.ruoyi.ehsEnterprise.service.IEhsEnterpriseService; import com.ruoyi.ehsEnterprise.service.IEhsEnterpriseService;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/** /**
* Controller * Controller
@ -37,7 +45,8 @@ public class EhsEnterpriseController extends BaseController
{ {
@Autowired @Autowired
private IEhsEnterpriseService ehsEnterpriseService; private IEhsEnterpriseService ehsEnterpriseService;
@Autowired
private ISysDictDataService dictDataService;
/** /**
* *
*/ */
@ -108,4 +117,19 @@ public class EhsEnterpriseController extends BaseController
{ {
return toAjax(ehsEnterpriseService.removeByIds(Arrays.asList(enterpriseIds))); return toAjax(ehsEnterpriseService.removeByIds(Arrays.asList(enterpriseIds)));
} }
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response) throws Exception {
ExcelUtil<EhsEnterprise> util = new ExcelUtil<EhsEnterprise>(EhsEnterprise.class);
util.importComboTemplateExcel(response, "企业信息信息数据");
}
/**
*
*/
@PostMapping("/importData")
public AjaxResult importHubManage(MultipartFile file, Boolean updateSupport) throws Exception {
ExcelUtil<EhsEnterprise> util = new ExcelUtil<>(EhsEnterprise.class);
List<EhsEnterprise> list = util.importExcel(file.getInputStream());
String message = ehsEnterpriseService.importEnterprise(list, updateSupport);
return AjaxResult.success(message);
}
} }

@ -5,6 +5,7 @@ import java.util.Arrays;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.ehsRisk.domain.EhsRisk;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -25,6 +26,7 @@ import com.ruoyi.ehsHiddenDanger.domain.EhsHiddenDanger;
import com.ruoyi.ehsHiddenDanger.service.IEhsHiddenDangerService; import com.ruoyi.ehsHiddenDanger.service.IEhsHiddenDangerService;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/** /**
* Controller * Controller
@ -62,7 +64,7 @@ public class EhsHiddenDangerController extends BaseController
{ {
List<EhsHiddenDanger> list = ehsHiddenDangerService.selectEhsHiddenDangerList(ehsHiddenDanger); List<EhsHiddenDanger> list = ehsHiddenDangerService.selectEhsHiddenDangerList(ehsHiddenDanger);
ExcelUtil<EhsHiddenDanger> util = new ExcelUtil<EhsHiddenDanger>(EhsHiddenDanger.class); ExcelUtil<EhsHiddenDanger> util = new ExcelUtil<EhsHiddenDanger>(EhsHiddenDanger.class);
util.exportExcel(response, list, "隐患信息数据"); util.exportExcel(response, list, "隐患信息数据", "隐患信息数据");
} }
/** /**
@ -139,4 +141,33 @@ public class EhsHiddenDangerController extends BaseController
{ {
return toAjax(ehsHiddenDangerService.assistEhsHiddenDanger(ehsHiddenDanger)); return toAjax(ehsHiddenDangerService.assistEhsHiddenDanger(ehsHiddenDanger));
} }
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response) throws Exception {
ExcelUtil<EhsHiddenDanger> util = new ExcelUtil<EhsHiddenDanger>(EhsHiddenDanger.class);
util.importComboTemplateExcel(response, "隐患信息数据");
}
/**
*
*/
@PostMapping("/importData")
public AjaxResult importHubManage(MultipartFile file, Boolean updateSupport) throws Exception {
ExcelUtil<EhsHiddenDanger> util = new ExcelUtil<>(EhsHiddenDanger.class);
List<EhsHiddenDanger> list = util.importExcel(file.getInputStream());
String message = ehsHiddenDangerService.importHiddenDanger(list, updateSupport);
return AjaxResult.success(message);
}
/**
*
* @return
* @throws Exception
*/
@PostMapping("/selectEhsHiddenDangerOverTime")
public AjaxResult selectEhsHiddenDangerOverTime(MultipartFile file, Boolean updateSupport) throws Exception {
ExcelUtil<EhsHiddenDanger> util = new ExcelUtil<>(EhsHiddenDanger.class);
List<EhsHiddenDanger> list = util.importExcel(file.getInputStream());
String message = ehsHiddenDangerService.importHiddenDanger(list, updateSupport);
return AjaxResult.success(message);
}
} }

@ -3,6 +3,8 @@ package com.ruoyi.ehsMaterial.controller;
import java.util.List; import java.util.List;
import java.util.Arrays; import java.util.Arrays;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.ehsRisk.domain.EhsRisk;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -23,6 +25,7 @@ import com.ruoyi.ehsMaterial.domain.EhsMaterial;
import com.ruoyi.ehsMaterial.service.IEhsMaterialService; import com.ruoyi.ehsMaterial.service.IEhsMaterialService;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/** /**
* Controller * Controller
@ -108,4 +111,20 @@ public class EhsMaterialController extends BaseController
{ {
return toAjax(ehsMaterialService.removeByIds(Arrays.asList(materialIds))); return toAjax(ehsMaterialService.removeByIds(Arrays.asList(materialIds)));
} }
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response) throws Exception {
ExcelUtil<EhsMaterial> util = new ExcelUtil<EhsMaterial>(EhsMaterial.class);
util.importComboTemplateExcel(response, "物资信息数据");
}
/**
*
*/
@PostMapping("/importData/{classType}")
public AjaxResult importHubManage(@PathVariable String classType,MultipartFile file, Boolean updateSupport) throws Exception {
ExcelUtil<EhsMaterial> util = new ExcelUtil<>(EhsMaterial.class);
List<EhsMaterial> list = util.importExcel(file.getInputStream());
String message = ehsMaterialService.importMaterial(list,classType, updateSupport);
return AjaxResult.success(message);
}
} }

@ -3,6 +3,8 @@ package com.ruoyi.web.controller.ehs;
import java.util.List; import java.util.List;
import java.util.Arrays; import java.util.Arrays;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.ehsEnterprise.domain.EhsEnterprise;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -23,6 +25,7 @@ import com.ruoyi.ehsRisk.domain.EhsRisk;
import com.ruoyi.ehsRisk.service.IEhsRiskService; import com.ruoyi.ehsRisk.service.IEhsRiskService;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/** /**
* Controller * Controller
@ -60,7 +63,7 @@ public class EhsRiskController extends BaseController
{ {
List<EhsRisk> list = ehsRiskService.selectEhsRiskList(ehsRisk); List<EhsRisk> list = ehsRiskService.selectEhsRiskList(ehsRisk);
ExcelUtil<EhsRisk> util = new ExcelUtil<EhsRisk>(EhsRisk.class); ExcelUtil<EhsRisk> util = new ExcelUtil<EhsRisk>(EhsRisk.class);
util.exportExcel(response, list, "风险信息数据"); util.exportExcel(response, list, "风险信息数据", "风险信息数据");
} }
/** /**
@ -108,4 +111,19 @@ public class EhsRiskController extends BaseController
{ {
return toAjax(ehsRiskService.removeByIds(Arrays.asList(riskIds))); return toAjax(ehsRiskService.removeByIds(Arrays.asList(riskIds)));
} }
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response) throws Exception {
ExcelUtil<EhsRisk> util = new ExcelUtil<EhsRisk>(EhsRisk.class);
util.importComboTemplateExcel(response, "风险信息信息数据");
}
/**
*
*/
@PostMapping("/importData")
public AjaxResult importHubManage(MultipartFile file, Boolean updateSupport) throws Exception {
ExcelUtil<EhsRisk> util = new ExcelUtil<>(EhsRisk.class);
List<EhsRisk> list = util.importExcel(file.getInputStream());
String message = ehsRiskService.importRisk(list, updateSupport);
return AjaxResult.success(message);
}
} }

@ -0,0 +1,201 @@
package com.ruoyi.web.controller.ehs;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson2.JSONObject;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.ruoyi.materialClass.domain.MaterialClass;
import com.ruoyi.materialClass.domain.MaterialClassSub;
import com.ruoyi.materialClass.service.IMaterialClassSubService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
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.materialClass.domain.MaterialClassMaster;
import com.ruoyi.materialClass.service.IMaterialClassMasterService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author ruoyi
* @date 2024-01-05
*/
@Api(tags="物资分类一级分类管理")
@RestController
@RequestMapping("/materialClass/materialClassMaster")
public class MaterialClassMasterController extends BaseController
{
@Autowired
private IMaterialClassMasterService materialClassMastService;
@Autowired
private IMaterialClassSubService materialClassSubService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('materialClass:materialClassMaster:list')")
@GetMapping("/list")
public TableDataInfo list(MaterialClassMaster materialClassMast)
{
startPage();
List<MaterialClassMaster> list = materialClassMastService.selectMaterialClassMastList(materialClassMast);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('materialClass:materialClassMaster:export')")
@Log(title = "物资分类一级分类", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, MaterialClassMaster materialClassMast)
{
List<MaterialClassMaster> list = materialClassMastService.selectMaterialClassMastList(materialClassMast);
ExcelUtil<MaterialClassMaster> util = new ExcelUtil<MaterialClassMaster>(MaterialClassMaster.class);
util.exportExcel(response, list, "物资分类一级分类数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('materialClass:materialClassMaster:query')")
@GetMapping(value = "/{classMastId}")
public AjaxResult getInfo(@PathVariable("classMastId") String classMastId)
{
return success(materialClassMastService.selectMaterialClassMastByClassMastId(classMastId));
}
/**
*
*/
@ApiOperation("新增物资分类一级分类")
@PreAuthorize("@ss.hasPermi('materialClass:materialClassMaster:add')")
@Log(title = "物资分类一级分类", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MaterialClassMaster materialClassMast)
{
return toAjax(materialClassMastService.insertMaterialClassMast(materialClassMast));
}
/**
*
*/
@ApiOperation("修改物资分类一级分类")
@PreAuthorize("@ss.hasPermi('materialClass:materialClassMaster:edit')")
@Log(title = "物资分类一级分类", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MaterialClassMaster materialClassMast)
{
return toAjax(materialClassMastService.updateMaterialClassMast(materialClassMast));
}
/**
*
*/
@ApiOperation("删除物资分类一级分类")
@PreAuthorize("@ss.hasPermi('materialClass:materialClassMaster:remove')")
@Log(title = "物资分类一级分类", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(materialClassMastService.deleteMaterialClassMastByClassMastIds(ids));
}
/**
*
*/
@ApiOperation("获取分类的json字符串")
@GetMapping(value = "/getMaterialClassJson/{id}")
public String getMaterialClassJson(@PathVariable String id) throws JsonProcessingException {
MaterialClassMaster msm = new MaterialClassMaster();
msm.setClassMastType(id);
List<MaterialClassMaster> list = materialClassMastService.selectMaterialClassMastList(msm);
List<MaterialClass> mcList = new ArrayList<>();
for(MaterialClassMaster mcm :list){
MaterialClass mc = new MaterialClass();
mc.setLabel(mcm.getClassNameMast());
mc.setValue(mcm.getClassMastId());
MaterialClassSub mcs = new MaterialClassSub();
mcs.setMastId(mcm.getId());
List<MaterialClassSub> sublist = materialClassSubService.selectMaterialClassSubList(mcs);
List<MaterialClass> mcSubList = new ArrayList<>();
for(MaterialClassSub mcss:sublist){
MaterialClass mcsub = new MaterialClass();
mcsub.setLabel(mcss.getClassNameSub());
mcsub.setValue(mcss.getClassSubId());
mcSubList.add(mcsub);
}
mc.setChildren(mcSubList);
mcList.add(mc);
}
//String jsion = JSONUtil.toJsonStr(list);
ObjectMapper objectMapper = new ObjectMapper();
String jsonStr = objectMapper.writeValueAsString(mcList);
System.out.println(jsonStr);
return jsonStr;
}
@ApiOperation("获取分类的json字符串")
@PostMapping(value = "/setMaterialClassJson")
public String setMaterialClassJson(MaterialClassMaster materialClassMaster) throws IOException {
String jsonStr = materialClassMaster.getClassNameMast();
/*for(MaterialClass mc :mcList){
MaterialClassMaster mcm = new MaterialClassMaster();
mcm.setClassMastType(id);
mcm.setClassMastId(mc.getValue());
mcm.setClassNameMast(mc.getLabel());
}*/
for(int m=2;m<=8;m++) {
InputStreamReader isr = new InputStreamReader(new FileInputStream("C:\\materialClass"+m+".json"), "utf8");
BufferedReader br = new BufferedReader(isr);
StringBuffer resposeBuffer = new StringBuffer("");
String lineTxt = null;
String s = "";
//将文件内容全部拼接到 字符串s
while ((lineTxt = br.readLine()) != null) {
s += lineTxt;
}
JSONArray array = (JSONArray) JSONUtil.parseArray(s); // 将JSON字符串转换为JSONArray对象
for (int i = 0; i < array.size(); i++) {
cn.hutool.json.JSONObject obj = array.getJSONObject(i);
MaterialClassMaster mcm = new MaterialClassMaster();
mcm.setClassMastType(String.valueOf(m));
mcm.setClassMastId(obj.getStr("value"));
mcm.setClassNameMast(obj.getStr("label"));
materialClassMastService.insertMaterialClassMast(mcm);
JSONArray subArray = obj.getJSONArray("children");
for (int j = 0; j < subArray.size(); j++) {
cn.hutool.json.JSONObject subObj = subArray.getJSONObject(j);
MaterialClassSub sub = new MaterialClassSub();
sub.setClassMastId(obj.getStr("value"));
sub.setClassSubId(subObj.getStr("value"));
sub.setClassNameSub(subObj.getStr("label"));
sub.setClassMastType(mcm.getClassMastType());
sub.setMastId(mcm.getId());
materialClassSubService.save(sub);
}
}
}
return "ok";
}
}

@ -37,7 +37,7 @@ public class BaseEntity implements Serializable
@TableField(fill = FieldFill.INSERT) @TableField(fill = FieldFill.INSERT)
private Long deptId; private Long deptId;
/** 上报部门 */ /** 上报部门 */
@Excel(name = "上报部门") @Excel(name = "上报部门" , type = Excel.Type.EXPORT)
@TableField(exist = false) @TableField(exist = false)
private String deptName; private String deptName;
/** 创建时间 */ /** 创建时间 */
@ -63,8 +63,9 @@ public class BaseEntity implements Serializable
@TableField(exist = false) @TableField(exist = false)
@JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonInclude(JsonInclude.Include.NON_EMPTY)
private Map<String, Object> params; private Map<String, Object> params;
/** 请求参数 */
@TableField(exist = false)
private Integer classCount;
public Map<String, Object> getParams() public Map<String, Object> getParams()

@ -5,9 +5,7 @@ import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.lang.reflect.Field; import java.lang.reflect.*;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.time.LocalDate; import java.time.LocalDate;
@ -24,6 +22,8 @@ import java.util.Set;
import java.util.UUID; import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.entity.SysDictData;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.RegExUtils; import org.apache.commons.lang3.RegExUtils;
import org.apache.commons.lang3.reflect.FieldUtils; import org.apache.commons.lang3.reflect.FieldUtils;
@ -589,6 +589,7 @@ public class ExcelUtil<T>
importTemplateExcel(response, sheetName, StringUtils.EMPTY); importTemplateExcel(response, sheetName, StringUtils.EMPTY);
} }
/** /**
* listexcel * listexcel
* *
@ -1755,4 +1756,91 @@ public class ExcelUtil<T>
} }
return method; return method;
} }
/**
*
* @param param
* @param list
* @param clazz
* @throws Exception
*/
public static void setCombo(String param, List<String> list, Class clazz) throws Exception {
// 通过反射 获取目标实体类的属性成员-即办公室号号字段
Field file = clazz.getDeclaredField(param);
// 获取该字段的上叫Excel的注解
Excel annotation = file.getAnnotation(Excel.class);
InvocationHandler h = Proxy.getInvocationHandler(annotation);
Field hField = h.getClass().getDeclaredField("memberValues");
// 设置私有可访问
hField.setAccessible(true);
Map memberValues = (Map) hField.get(h);
// 集合转数组
String[] combo = list.toArray(new String[list.size()]);
// 修改属性值
memberValues.put("combo", combo);
}
/**
* dictType readConverterExp
* @param response
* @param sheetName
*/
public void importComboTemplateExcel(HttpServletResponse response, String sheetName)throws Exception
{
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8");
this.init(null, sheetName, title, Type.IMPORT);
setCombo();
exportExcel(response);
}
/**
* excel dictType readConverterExp
* @throws Exception
*/
private void setCombo() throws Exception {
for (Object[] os : fields) {
Field field = (Field) os[0]; //字段属性
Excel excel = (Excel) os[1]; //combo dicttype 等excel注解属性
if(StringUtils.isNotEmpty( excel.dictType())){
List<String> dicDucation = DictUtils.getDictCache( excel.dictType()).stream().map(SysDictData::getDictLabel).collect(Collectors.toList());
InvocationHandler h = Proxy.getInvocationHandler(os[1]);
Field hField = h.getClass().getDeclaredField("memberValues");
// 设置私有可访问
hField.setAccessible(true);
Map memberValues = (Map) hField.get(h);
// 集合转数组
String[] combo = dicDucation.toArray(new String[dicDucation.size()]);
// 修改属性值
memberValues.put("combo", combo);
}else if(StringUtils.isNotEmpty( excel.readConverterExp())){
String[] temp = excel.readConverterExp().split(",");
String[] combo = new String[temp.length];
for(int i=0;i<temp.length;i++){
combo[i] = temp[i].split("=")[1].trim();
}
InvocationHandler h = Proxy.getInvocationHandler(os[1]);
Field hField = h.getClass().getDeclaredField("memberValues");
// 设置私有可访问
hField.setAccessible(true);
Map memberValues = (Map) hField.get(h);
// 修改属性值
memberValues.put("combo", combo);
}
}
/* // 通过反射 获取目标实体类的属性成员-即办公室号号字段
Field file = this.clazz.getDeclaredField(param);
// 获取该字段的上叫Excel的注解
Excel annotation = file.getAnnotation(Excel.class);
InvocationHandler h = Proxy.getInvocationHandler(annotation);
Field hField = h.getClass().getDeclaredField("memberValues");
// 设置私有可访问
hField.setAccessible(true);
Map memberValues = (Map) hField.get(h);
// 集合转数组
String[] combo = list.toArray(new String[list.size()]);
// 修改属性值
memberValues.put("combo", combo);*/
}
} }

@ -67,7 +67,7 @@ public class EhsEnterprise extends BaseEntity
private String businessProjects; private String businessProjects;
/** 企业现状0停业、1正常经营 */ /** 企业现状0停业、1正常经营 */
@Excel(name = "企业现状", readConverterExp = "0=停业、1正常经营") @Excel(name = "企业现状", readConverterExp = "0=停业,1=正常经营")
private String enterpriseStatus; private String enterpriseStatus;
/** 分管安全副职姓名 */ /** 分管安全副职姓名 */
@ -78,10 +78,10 @@ public class EhsEnterprise extends BaseEntity
@Excel(name = "分管安全副职电话") @Excel(name = "分管安全副职电话")
private String safetyManagerTel; private String safetyManagerTel;
@Excel(name = "行政区域") @Excel(name = "行政区域", dictType = "area_id")
private String areaId; private String areaId;
@Excel(name = "经济类型") @Excel(name = "经济类型" , dictType = "economic_type")
private String economicType; private String economicType;
@Excel(name = "企业规模") @Excel(name = "企业规模", dictType = "enterprise_scale")
private String enterpriseScale; private String enterpriseScale;
} }

@ -3,6 +3,7 @@ package com.ruoyi.ehsEnterprise.service;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.ehsEnterprise.domain.EhsEnterprise; import com.ruoyi.ehsEnterprise.domain.EhsEnterprise;
import com.ruoyi.ehsRisk.domain.EhsRisk;
/** /**
* Service * Service
@ -27,5 +28,5 @@ public interface IEhsEnterpriseService extends IService<EhsEnterprise> {
* @return * @return
*/ */
public List<EhsEnterprise> selectEhsEnterpriseList(EhsEnterprise ehsEnterprise); public List<EhsEnterprise> selectEhsEnterpriseList(EhsEnterprise ehsEnterprise);
public String importEnterprise(List<EhsEnterprise> riskList, Boolean isUpdateSupport );
} }

@ -3,7 +3,10 @@ package com.ruoyi.ehsEnterprise.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.bean.BeanValidators;
import com.ruoyi.ehsRisk.domain.EhsRisk;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
@ -13,6 +16,8 @@ import com.ruoyi.ehsEnterprise.mapper.EhsEnterpriseMapper;
import com.ruoyi.ehsEnterprise.domain.EhsEnterprise; import com.ruoyi.ehsEnterprise.domain.EhsEnterprise;
import com.ruoyi.ehsEnterprise.service.IEhsEnterpriseService; import com.ruoyi.ehsEnterprise.service.IEhsEnterpriseService;
import javax.validation.Validator;
/** /**
* Service * Service
* *
@ -24,7 +29,8 @@ public class EhsEnterpriseServiceImpl extends ServiceImpl<EhsEnterpriseMapper, E
@Autowired @Autowired
private EhsEnterpriseMapper ehsEnterpriseMapper; private EhsEnterpriseMapper ehsEnterpriseMapper;
@Autowired
protected Validator validator;
/** /**
* *
* *
@ -53,7 +59,54 @@ public class EhsEnterpriseServiceImpl extends ServiceImpl<EhsEnterpriseMapper, E
return ehsEnterpriseMapper.selectEhsEnterpriseList(ehsEnterprise); return ehsEnterpriseMapper.selectEhsEnterpriseList(ehsEnterprise);
} }
/**
*
*
* @param list
* @param isUpdateSupport
* @return
*/
@Override
public String importEnterprise(List<EhsEnterprise> list, Boolean isUpdateSupport )
{
if (StringUtils.isNull(list) || list.size() == 0)
{
throw new ServiceException("导入数据不能为空!");
}
int successNum = 0;
int failureNum = 0;
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
int i =0;
for (EhsEnterprise obj : list)
{
i++;
try
{
BeanValidators.validateWithException(validator, obj);
ehsEnterpriseMapper.insert(obj);
successNum++;
successMsg.append("<br/>" + successNum + "、第 " + i + " 行记录导入成功");
}
catch (Exception e)
{
failureNum++;
String msg = "<br/>" + failureNum + "、第 " +i + " 行记录导入失败:";
failureMsg.append(msg + e.getMessage());
log.error(msg, e);
}
}
if (failureNum > 0)
{
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
throw new ServiceException(failureMsg.toString());
}
else
{
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
}
return successMsg.toString();
}
private LambdaQueryWrapper<EhsEnterprise> buildQueryWrapper(EhsEnterprise query) { private LambdaQueryWrapper<EhsEnterprise> buildQueryWrapper(EhsEnterprise query) {
Map<String, Object> params = query.getParams(); Map<String, Object> params = query.getParams();
LambdaQueryWrapper<EhsEnterprise> lqw = Wrappers.lambdaQuery(); LambdaQueryWrapper<EhsEnterprise> lqw = Wrappers.lambdaQuery();

@ -38,7 +38,7 @@ public class EhsHiddenDanger extends BaseEntity
private String enterpriseName; private String enterpriseName;
/** 企业现状0停业、1正常经营 */ /** 企业现状0停业、1正常经营 */
@Excel(name = "企业现状", readConverterExp = "0=停业、1正常经营") @Excel(name = "企业现状", readConverterExp = "0=停业,1=正常经营")
private String enterpriseStatus; private String enterpriseStatus;
/** 行业 字典 */ /** 行业 字典 */
@ -54,11 +54,11 @@ public class EhsHiddenDanger extends BaseEntity
private Date checkTime; private Date checkTime;
/** 排查方式 */ /** 排查方式 */
@Excel(name = "排查方式") @Excel(name = "排查方式", dictType = "check_type")
private String checkType; private String checkType;
/** 隐患照片 */ /** 隐患照片 */
@Excel(name = "隐患照片") // @Excel(name = "隐患照片" )
private String hiddenDangerImg; private String hiddenDangerImg;
/** 整改措施 */ /** 整改措施 */
@ -66,7 +66,7 @@ public class EhsHiddenDanger extends BaseEntity
private String rectifyMeasure; private String rectifyMeasure;
/** 整改进度 */ /** 整改进度 */
@Excel(name = "整改进度") @Excel(name = "整改进度", dictType = "hidden_danger_status")
private String status; private String status;
/** 整改时间 */ /** 整改时间 */
@ -78,7 +78,7 @@ public class EhsHiddenDanger extends BaseEntity
private String principalName; private String principalName;
/** 整改照片 */ /** 整改照片 */
@Excel(name = "整改照片") //@Excel(name = "整改照片")
private String rectifyImg; private String rectifyImg;
/** 监管部门 */ /** 监管部门 */
@ -90,21 +90,21 @@ public class EhsHiddenDanger extends BaseEntity
private String regulatoryName; private String regulatoryName;
/** 隐患级别 */ /** 隐患级别 */
@Excel(name = "隐患级别") @Excel(name = "隐患级别", dictType = "hidden_danger_grade" )
private String hiddenDangerGrade; private String hiddenDangerGrade;
/** 隐患类型 */ /** 隐患类型 */
@Excel(name = "隐患类型") @Excel(name = "隐患类型", dictType = "hidden_danger_type")
private String hiddenDangerType; private String hiddenDangerType;
/** 标签 */ /** 标签 */
@Excel(name = "标签") //@Excel(name = "标签")
private String hiddenDangerLabel; private String hiddenDangerLabel;
@Excel(name = "是否督办") @Excel(name = "是否督办" , dictType = "ehs_yes_no")
private Long isSupervise; private Long isSupervise;
@Excel(name = "协办部门列表") //@Excel(name = "协办部门列表" , type = Excel.Type.EXPORT)
private String assistDept; private String assistDept;
@Excel(name = "督办结果") @Excel(name = "督办结果")
@ -118,6 +118,7 @@ public class EhsHiddenDanger extends BaseEntity
private String assistDeptName; private String assistDeptName;
@TableField(exist = false) @TableField(exist = false)
//@Excel(name = "标签", dictType = "hidden_danger_label")
private String[] hiddenDangerLabelArray; private String[] hiddenDangerLabelArray;
@Excel(name = "整改期限", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "整改期限", width = 30, dateFormat = "yyyy-MM-dd")
@ -127,13 +128,19 @@ public class EhsHiddenDanger extends BaseEntity
@Excel(name = "整改资金") @Excel(name = "整改资金")
private BigDecimal rectifyMoney; private BigDecimal rectifyMoney;
@Excel(name = "行政区域") @Excel(name = "行政区域", dictType = "area_id")
private String areaId; private String areaId;
@Excel(name = "经济类型") @Excel(name = "经济类型" , dictType = "economic_type")
private String economicType; private String economicType;
@Excel(name = "企业规模") @Excel(name = "企业规模", dictType = "enterprise_scale")
private String enterpriseScale; private String enterpriseScale;
@Excel(name = "是否乡镇(街道)", dictType = "ehs_yes_no")
private String isTowns;
@TableField(exist = false) @TableField(exist = false)
private String isOverTime;//是否超时未整改 private String isOverTime;//是否超时未整改
@Excel(name = "标签")
@TableField(exist = false)
private String hiddenDangerLabelName;//是否超时未整改
@TableField(exist = false)
private Integer overTime;//是否超时未整改
} }

@ -18,7 +18,7 @@ public interface EhsHiddenDangerMapper extends BaseMapper<EhsHiddenDanger> {
* @return * @return
*/ */
public EhsHiddenDanger selectEhsHiddenDangerByHiddenDangerId(Long hiddenDangerId); public EhsHiddenDanger selectEhsHiddenDangerByHiddenDangerId(Long hiddenDangerId);
public EhsHiddenDanger selectEhsHiddenDangerOverTime(EhsHiddenDanger ehsHiddenDanger);
/** /**
* *
* *

@ -3,6 +3,7 @@ package com.ruoyi.ehsHiddenDanger.service;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.ehsHiddenDanger.domain.EhsHiddenDanger; import com.ruoyi.ehsHiddenDanger.domain.EhsHiddenDanger;
import com.ruoyi.ehsRisk.domain.EhsRisk;
/** /**
* Service * Service
@ -39,4 +40,8 @@ public interface IEhsHiddenDangerService extends IService<EhsHiddenDanger> {
* @param ehsHiddenDanger ID * @param ehsHiddenDanger ID
*/ */
public int assistEhsHiddenDanger(EhsHiddenDanger ehsHiddenDanger); public int assistEhsHiddenDanger(EhsHiddenDanger ehsHiddenDanger);
public String importHiddenDanger(List<EhsHiddenDanger> list, Boolean isUpdateSupport );
public EhsHiddenDanger selectEhsHiddenDangerOverTime(EhsHiddenDanger ehsHiddenDanger);
} }

@ -5,7 +5,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DictUtils;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.bean.BeanValidators;
import com.ruoyi.ehsRisk.domain.EhsRisk;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
@ -15,6 +19,8 @@ import com.ruoyi.ehsHiddenDanger.mapper.EhsHiddenDangerMapper;
import com.ruoyi.ehsHiddenDanger.domain.EhsHiddenDanger; import com.ruoyi.ehsHiddenDanger.domain.EhsHiddenDanger;
import com.ruoyi.ehsHiddenDanger.service.IEhsHiddenDangerService; import com.ruoyi.ehsHiddenDanger.service.IEhsHiddenDangerService;
import javax.validation.Validator;
/** /**
* Service * Service
* *
@ -26,7 +32,8 @@ public class EhsHiddenDangerServiceImpl extends ServiceImpl<EhsHiddenDangerMappe
@Autowired @Autowired
private EhsHiddenDangerMapper ehsHiddenDangerMapper; private EhsHiddenDangerMapper ehsHiddenDangerMapper;
@Autowired
protected Validator validator;
/** /**
* *
* *
@ -112,4 +119,61 @@ public class EhsHiddenDangerServiceImpl extends ServiceImpl<EhsHiddenDangerMappe
public int assistEhsHiddenDanger(EhsHiddenDanger ehsHiddenDanger){ public int assistEhsHiddenDanger(EhsHiddenDanger ehsHiddenDanger){
return ehsHiddenDangerMapper.assistEhsHiddenDanger(ehsHiddenDanger); return ehsHiddenDangerMapper.assistEhsHiddenDanger(ehsHiddenDanger);
} }
/**
*
*
* @param list
* @param isUpdateSupport
* @return
*/
@Override
public String importHiddenDanger(List<EhsHiddenDanger> list, Boolean isUpdateSupport )
{
if (StringUtils.isNull(list) || list.size() == 0)
{
throw new ServiceException("导入用户数据不能为空!");
}
int successNum = 0;
int failureNum = 0;
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
int i =0;
for (EhsHiddenDanger obj : list)
{
i++;
try
{
BeanValidators.validateWithException(validator, obj);
if(StringUtils.isNotEmpty(obj.getHiddenDangerLabelName()) ){
String s = DictUtils.getDictValue("hidden_danger_label", obj.getHiddenDangerLabelName(), ",");
obj.setHiddenDangerLabel(s);
}
ehsHiddenDangerMapper.insert(obj);
successNum++;
successMsg.append("<br/>" + successNum + "、第 " + i + " 行记录导入成功");
}
catch (Exception e)
{
failureNum++;
String msg = "<br/>" + failureNum + "、第 " +i + " 行记录导入失败:";
failureMsg.append(msg + e.getMessage());
log.error(msg, e);
}
}
if (failureNum > 0)
{
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
throw new ServiceException(failureMsg.toString());
}
else
{
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
}
return successMsg.toString();
}
public EhsHiddenDanger selectEhsHiddenDangerOverTime(EhsHiddenDanger ehsHiddenDanger){
return ehsHiddenDangerMapper.selectEhsHiddenDangerOverTime(ehsHiddenDanger);
}
} }

@ -31,11 +31,11 @@ public class EhsMaterial extends BaseEntity
private Long materialId; private Long materialId;
/** 性质 */ /** 性质 */
@Excel(name = "性质") @Excel(name = "性质", readConverterExp = "1=自储,2=社会代储")
private Long materialType; private Long materialType;
/** 类别 */ /** 类别 */
@Excel(name = "类别") @Excel(name = "物资分类", dictType = "material_class_fast")
private Long classFirst; private Long classFirst;
/** 类别 */ /** 类别 */
@ -66,7 +66,8 @@ public class EhsMaterial extends BaseEntity
@Excel(name = "联系电话") @Excel(name = "联系电话")
private String tel; private String tel;
/** 上报部门 */ /** 上报部门 */
@Excel(name = "待处理出库") // @Excel(name = "待处理出库")
@TableField(exist = false)
private String sendQuantity; private String sendQuantity;

@ -3,6 +3,7 @@ package com.ruoyi.ehsMaterial.service;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.ehsMaterial.domain.EhsMaterial; import com.ruoyi.ehsMaterial.domain.EhsMaterial;
import com.ruoyi.ehsRisk.domain.EhsRisk;
/** /**
* Service * Service
@ -27,5 +28,6 @@ public interface IEhsMaterialService extends IService<EhsMaterial> {
* @return * @return
*/ */
public List<EhsMaterial> selectEhsMaterialList(EhsMaterial ehsMaterial); public List<EhsMaterial> selectEhsMaterialList(EhsMaterial ehsMaterial);
public String importMaterial(List<EhsMaterial> list,String classType, Boolean isUpdateSupport);
} }

@ -3,16 +3,27 @@ package com.ruoyi.ehsMaterial.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.bean.BeanValidators;
import com.ruoyi.ehsRisk.domain.EhsRisk;
import com.ruoyi.materialClass.domain.MaterialClassMaster;
import com.ruoyi.materialClass.domain.MaterialClassSub;
import com.ruoyi.materialClass.mapper.MaterialClassMasterMapper;
import com.ruoyi.materialClass.mapper.MaterialClassSubMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
import com.ruoyi.ehsMaterial.mapper.EhsMaterialMapper; import com.ruoyi.ehsMaterial.mapper.EhsMaterialMapper;
import com.ruoyi.ehsMaterial.domain.EhsMaterial; import com.ruoyi.ehsMaterial.domain.EhsMaterial;
import com.ruoyi.ehsMaterial.service.IEhsMaterialService; import com.ruoyi.ehsMaterial.service.IEhsMaterialService;
import javax.validation.Validator;
/** /**
* Service * Service
* *
@ -24,7 +35,10 @@ public class EhsMaterialServiceImpl extends ServiceImpl<EhsMaterialMapper, EhsMa
@Autowired @Autowired
private EhsMaterialMapper ehsMaterialMapper; private EhsMaterialMapper ehsMaterialMapper;
@Autowired
private MaterialClassSubMapper materialClassSubMapper;
@Autowired
protected Validator validator;
/** /**
* *
* *
@ -69,5 +83,68 @@ public class EhsMaterialServiceImpl extends ServiceImpl<EhsMaterialMapper, EhsMa
lqw.orderByDesc(EhsMaterial::getCreateTime); lqw.orderByDesc(EhsMaterial::getCreateTime);
return lqw; return lqw;
} }
/**
*
*
* @param list
* @param isUpdateSupport
* @return
*/
@Override
public String importMaterial(List<EhsMaterial> list,String classType, Boolean isUpdateSupport)
{
if (StringUtils.isNull(list) || list.size() == 0)
{
throw new ServiceException("导入用户数据不能为空!");
}
int successNum = 0;
int failureNum = 0;
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
MaterialClassSub msm = new MaterialClassSub();
msm.setClassMastType(classType);
List<MaterialClassSub> mlist = materialClassSubMapper.selectMaterialClassSubList(msm);
Map<String, String> map = mlist.stream()
.collect(Collectors.toMap(MaterialClassSub::getClassNameSub, MaterialClassSub::getClassSubId));
int i =0;
for (EhsMaterial obj : list)
{
i++;
try
{
if(StringUtils.isNotEmpty(obj.getMaterialName()) && map.containsKey(obj.getMaterialName())) {
BeanValidators.validateWithException(validator, obj);
String SbuId = map.get(obj.getMaterialName());
String mSid = SbuId.split("-")[0];
obj.setClassSecond(mSid);
obj.setMaterialName(SbuId);
ehsMaterialMapper.insert(obj);
successNum++;
successMsg.append("<br/>" + successNum + "、第 " + i + " 行记录导入成功");
}else{
failureNum++;
String msg = "<br/>" + failureNum + "、第 " +i + " 行记录导入失败,物资名称未找到或为空:"+obj.getMaterialName();
failureMsg.append( msg);
}
}
catch (Exception e)
{
failureNum++;
String msg = "<br/>" + failureNum + "、第 " +i + " 行记录导入失败:";
failureMsg.append(msg + e.getMessage());
log.error(msg, e);
}
}
if (failureNum > 0)
{
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
throw new ServiceException(failureMsg.toString());
}
else
{
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
}
return successMsg.toString();
}
} }

@ -31,15 +31,15 @@ public class EhsRisk extends BaseEntity
private Long riskId; private Long riskId;
/** 风险点等级 */ /** 风险点等级 */
@Excel(name = "风险点等级") @Excel(name = "风险点等级" , dictType = "risk_grade")
private Long riskGrade; private Long riskGrade;
/** 风险点类型 字典 */ /** 风险点类型 字典 */
@Excel(name = "风险点类型 字典 ") @Excel(name = "风险点类型" , dictType = "risk_report_address_type")
private String reportAddressType; private String reportAddressType;
/** 风险点位置,用分号“;”分隔 */ /** 风险点位置,用分号“;”分隔 */
@Excel(name = "风险点位置,用分号“;”分隔") @Excel(name = "风险点位置")
private String riskLocation; private String riskLocation;
/** 风险点概况 */ /** 风险点概况 */
@ -47,7 +47,7 @@ public class EhsRisk extends BaseEntity
private String riskDesc; private String riskDesc;
/** 涉及群众数量,用分号“;”分隔 */ /** 涉及群众数量,用分号“;”分隔 */
@Excel(name = "涉及群众数量,用分号“;”分隔") @Excel(name = "涉及群众数量")
private String peopleQuantity; private String peopleQuantity;
/** 抢险救援物资保障地点 */ /** 抢险救援物资保障地点 */

@ -2,6 +2,7 @@ package com.ruoyi.ehsRisk.service;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.ehsRisk.domain.EhsRisk; import com.ruoyi.ehsRisk.domain.EhsRisk;
/** /**
@ -27,5 +28,5 @@ public interface IEhsRiskService extends IService<EhsRisk> {
* @return * @return
*/ */
public List<EhsRisk> selectEhsRiskList(EhsRisk ehsRisk); public List<EhsRisk> selectEhsRiskList(EhsRisk ehsRisk);
public String importRisk(List<EhsRisk> riskList, Boolean isUpdateSupport);
} }

@ -3,6 +3,10 @@ package com.ruoyi.ehsRisk.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.bean.BeanValidators;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
@ -12,6 +16,8 @@ import com.ruoyi.ehsRisk.mapper.EhsRiskMapper;
import com.ruoyi.ehsRisk.domain.EhsRisk; import com.ruoyi.ehsRisk.domain.EhsRisk;
import com.ruoyi.ehsRisk.service.IEhsRiskService; import com.ruoyi.ehsRisk.service.IEhsRiskService;
import javax.validation.Validator;
/** /**
* Service * Service
* *
@ -23,7 +29,8 @@ public class EhsRiskServiceImpl extends ServiceImpl<EhsRiskMapper, EhsRisk> impl
@Autowired @Autowired
private EhsRiskMapper ehsRiskMapper; private EhsRiskMapper ehsRiskMapper;
@Autowired
protected Validator validator;
/** /**
* *
* *
@ -66,7 +73,54 @@ public class EhsRiskServiceImpl extends ServiceImpl<EhsRiskMapper, EhsRisk> impl
{ {
return ehsRiskMapper.selectEhsRiskList(ehsRisk); return ehsRiskMapper.selectEhsRiskList(ehsRisk);
} }
/**
*
*
* @param list
* @param isUpdateSupport
* @return
*/
@Override
public String importRisk(List<EhsRisk> list, Boolean isUpdateSupport )
{
if (StringUtils.isNull(list) || list.size() == 0)
{
throw new ServiceException("导入用户数据不能为空!");
}
int successNum = 0;
int failureNum = 0;
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
int i =0;
for (EhsRisk risk : list)
{
i++;
try
{
BeanValidators.validateWithException(validator, risk);
ehsRiskMapper.insert(risk);
successNum++;
successMsg.append("<br/>" + successNum + "、第 " + i + " 行记录导入成功");
}
catch (Exception e)
{
failureNum++;
String msg = "<br/>" + failureNum + "、第 " +i + " 行记录导入失败:";
failureMsg.append(msg + e.getMessage());
log.error(msg, e);
}
}
if (failureNum > 0)
{
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
throw new ServiceException(failureMsg.toString());
}
else
{
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
}
return successMsg.toString();
}
private LambdaQueryWrapper<EhsRisk> buildQueryWrapper(EhsRisk query) { private LambdaQueryWrapper<EhsRisk> buildQueryWrapper(EhsRisk query) {
Map<String, Object> params = query.getParams(); Map<String, Object> params = query.getParams();

@ -0,0 +1,13 @@
package com.ruoyi.materialClass.domain;
import lombok.Data;
import java.util.List;
@Data
public class MaterialClass {
private String value;
private String label;
List<MaterialClass> children;
}

@ -0,0 +1,49 @@
package com.ruoyi.materialClass.domain;
import java.util.List;
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;
/**
* material_class_master
*
* @author ruoyi
* @date 2024-01-05
*/
@Data
@ToString
@NoArgsConstructor
@Accessors(chain = true)
@TableName("material_class_master")
public class MaterialClassMaster extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 分类编号 */
@Excel(name = "分类编号")
private String classMastId;
/** 主键 */
@TableId(type= IdType.AUTO)
private Long id;
/** 分类的大类 */
@Excel(name = "分类的大类")
private String classMastType;
/** 分类名称 */
@Excel(name = "分类名称")
private String classNameMast;
/** 物资分类-二级分类信息 */
@TableField(exist = false)
private List<MaterialClassSub> materialClassSubList;
}

@ -0,0 +1,52 @@
package com.ruoyi.materialClass.domain;
import com.baomidou.mybatisplus.annotation.IdType;
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;
/**
* - material_class_sub
*
* @author ruoyi
* @date 2024-01-05
*/
@Data
@ToString
@NoArgsConstructor
@Accessors(chain = true)
@TableName("material_class_sub")
//@ApiModel(value = "MaterialClassSub", description = "物资分类-二级分类实体")
public class MaterialClassSub extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 二级分类主键 */
@Excel(name = "二级分类主键")
// @ApiModelProperty("二级分类主键")
private String classSubId;
/** 分类的大类 */
@Excel(name = "分类的大类")
private String classMastType;
/** 上级分类主键 */
@Excel(name = "上级分类主键")
// @ApiModelProperty("上级分类主键")
private String classMastId;
// @ApiModelProperty("上级分类主键")
private Long mastId;
/** 二级分类名称 */
@Excel(name = "二级分类名称")
// @ApiModelProperty("二级分类名称")
private String classNameSub;
/** 主键 */
@TableId(type= IdType.AUTO)
// @ApiModelProperty("主键")
private Long id;
}

@ -0,0 +1,45 @@
package com.ruoyi.materialClass.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.materialClass.domain.MaterialClassMaster;
import java.util.List;
/**
* Mapper
*
* @author ruoyi
* @date 2024-01-05
*/
public interface MaterialClassMasterMapper extends BaseMapper<MaterialClassMaster> {
/**
*
*
* @param classMastId
* @return
*/
public MaterialClassMaster selectMaterialClassMastByClassMastId(String classMastId);
/**
*
*
* @param materialClassMast
* @return
*/
public List<MaterialClassMaster> selectMaterialClassMastList(MaterialClassMaster materialClassMast);
/**
*
*
* @param classMastId
* @return
*//*
int deleteMaterialClassSubByClassMastId(@Param("classMastId")String classMastId);
*//**
* -
*
* @param materialClassSubList -
* @return
*//*
int batchInsertMaterialClassSub(List<MaterialClassSub> materialClassSubList);*/
}

@ -0,0 +1,31 @@
package com.ruoyi.materialClass.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.materialClass.domain.MaterialClassSub;
import java.util.List;
/**
* -Mapper
*
* @author ruoyi
* @date 2024-01-04
*/
public interface MaterialClassSubMapper extends BaseMapper<MaterialClassSub> {
/**
* -
*
* @param classSubId -
* @return -
*/
public MaterialClassSub selectMaterialClassSubByClassSubId(String classSubId);
/**
* -
*
* @param materialClassSub -
* @return -
*/
public List<MaterialClassSub> selectMaterialClassSubList(MaterialClassSub materialClassSub);
public int deleteMaterialClassSubByClassMastId(String classMastId);
}

@ -0,0 +1,64 @@
package com.ruoyi.materialClass.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.materialClass.domain.MaterialClassMaster;
/**
* Service
*
* @author ruoyi
* @date 2024-01-05
*/
public interface IMaterialClassMasterService extends IService<MaterialClassMaster> {
/**
*
*
* @param classMastId
* @return
*/
public MaterialClassMaster selectMaterialClassMastByClassMastId(String classMastId);
/**
*
*
* @param materialClassMast
* @return
*/
public List<MaterialClassMaster> selectMaterialClassMastList(MaterialClassMaster materialClassMast);
/**
*
*
* @param materialClassMast
* @return
*/
public int insertMaterialClassMast(MaterialClassMaster materialClassMast);
/**
*
*
* @param materialClassMast
* @return
*/
public int updateMaterialClassMast(MaterialClassMaster materialClassMast);
/**
*
*
* @param classMastIds
* @return
*/
public int deleteMaterialClassMastByClassMastIds(String[] classMastIds);
/**
*
*
* @param classMastId
* @return
*/
public int deleteMaterialClassMastByClassMastId(String classMastId);
}

@ -0,0 +1,31 @@
package com.ruoyi.materialClass.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.materialClass.domain.MaterialClassSub;
/**
* -Service
*
* @author ruoyi
* @date 2024-01-04
*/
public interface IMaterialClassSubService extends IService<MaterialClassSub> {
/**
* -
*
* @param classSubId -
* @return -
*/
public MaterialClassSub selectMaterialClassSubByClassSubId(String classSubId);
/**
* -
*
* @param materialClassSub -
* @return -
*/
public List<MaterialClassSub> selectMaterialClassSubList(MaterialClassSub materialClassSub);
}

@ -0,0 +1,157 @@
package com.ruoyi.materialClass.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.materialClass.mapper.MaterialClassSubMapper;
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 java.util.Arrays;
import org.springframework.transaction.annotation.Transactional;
import com.ruoyi.materialClass.domain.MaterialClassSub;
import com.ruoyi.materialClass.mapper.MaterialClassMasterMapper;
import com.ruoyi.materialClass.domain.MaterialClassMaster;
import com.ruoyi.materialClass.service.IMaterialClassMasterService;
/**
* Service
*
* @author ruoyi
* @date 2024-01-05
*/
@Service
public class MaterialClassMasterServiceImpl extends ServiceImpl<MaterialClassMasterMapper, MaterialClassMaster> implements IMaterialClassMasterService {
@Autowired
private MaterialClassMasterMapper materialClassMastMapper;
@Autowired
private MaterialClassSubMapper materialClassSubMapper;
/**
*
*
* @param classMastId
* @return
*/
@Override
public MaterialClassMaster selectMaterialClassMastByClassMastId(String classMastId)
{
MaterialClassMaster materialClassMaster = materialClassMastMapper.selectMaterialClassMastByClassMastId(classMastId);
/*MaterialClassSub sub = new MaterialClassSub();
sub.setClassMastId(materialClassMaster.getClassMastId());
List<MaterialClassSub> subs = materialClassSubMapper.selectMaterialClassSubList(sub);
materialClassMaster.setMaterialClassSubList(subs);*/
return materialClassMaster;
}
/**
*
*
* @param materialClassMast
* @return
*/
@Override
public List<MaterialClassMaster> selectMaterialClassMastList(MaterialClassMaster materialClassMast)
{
return materialClassMastMapper.selectMaterialClassMastList(materialClassMast);
}
/**
*
*
* @param materialClassMast
* @return
*/
@Transactional
@Override
public int insertMaterialClassMast(MaterialClassMaster materialClassMast)
{
int rows = materialClassMastMapper.insert(materialClassMast);
insertMaterialClassSub(materialClassMast);
return rows;
}
/**
*
*
* @param materialClassMast
* @return
*/
@Transactional
@Override
public int updateMaterialClassMast(MaterialClassMaster materialClassMast)
{
materialClassSubMapper.deleteMaterialClassSubByClassMastId( materialClassMast.getId().toString());
insertMaterialClassSub(materialClassMast);
return materialClassMastMapper.updateById(materialClassMast);
}
/**
*
*
* @param classMastIds
* @return
*/
@Transactional
@Override
public int deleteMaterialClassMastByClassMastIds(String[] classMastIds)
{
List<String> classMastIdList = Arrays.asList(classMastIds);
for (String classMastId : classMastIdList) {
materialClassSubMapper.deleteMaterialClassSubByClassMastId(classMastId);
}
return materialClassMastMapper.deleteBatchIds(classMastIdList);
}
/**
*
*
* @param classMastId
* @return
*/
@Transactional
@Override
public int deleteMaterialClassMastByClassMastId(String classMastId)
{
materialClassSubMapper.deleteMaterialClassSubByClassMastId(classMastId);
return materialClassMastMapper.deleteById(classMastId);
}
/**
* -
*
* @param materialClassMast
*/
private void insertMaterialClassSub(MaterialClassMaster materialClassMast)
{
List<MaterialClassSub> materialClassSubList = materialClassMast.getMaterialClassSubList();
String classMastId = materialClassMast.getClassMastId();
Long mastId = materialClassMast.getId();
String classMastType = materialClassMast.getClassMastType();
if (StringUtils.isNotNull(materialClassSubList)) {
for (MaterialClassSub materialClassSub : materialClassSubList) {
materialClassSub.setClassMastId(classMastId);
materialClassSub.setMastId(mastId);
materialClassSub.setClassMastType(classMastType);
materialClassSubMapper.insert(materialClassSub);
}
//materialClassMastMapper.batchInsertMaterialClassSub(materialClassSubList);
}
}
private LambdaQueryWrapper<MaterialClassMaster> buildQueryWrapper(MaterialClassMaster query) {
Map<String, Object> params = query.getParams();
LambdaQueryWrapper<MaterialClassMaster> lqw = Wrappers.lambdaQuery();
lqw.eq(StringUtils.isNotBlank(query.getClassMastId()), MaterialClassMaster::getClassMastId, query.getClassMastId());
lqw.eq(StringUtils.isNotBlank(query.getClassMastType()), MaterialClassMaster::getClassMastType, query.getClassMastType());
lqw.eq(StringUtils.isNotBlank(query.getClassNameMast()), MaterialClassMaster::getClassNameMast, query.getClassNameMast());
lqw.orderByDesc(MaterialClassMaster::getCreateTime);
lqw.eq(query.getDeptId() != null, MaterialClassMaster::getDeptId, query.getDeptId());
lqw.eq(query.getCreateUserId() != null, MaterialClassMaster::getCreateUserId, query.getCreateUserId());
lqw.eq(query.getUpdateUserId() != null, MaterialClassMaster::getUpdateUserId, query.getUpdateUserId());
return lqw;
}
}

@ -0,0 +1,60 @@
package com.ruoyi.materialClass.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.materialClass.mapper.MaterialClassSubMapper;
import com.ruoyi.materialClass.domain.MaterialClassSub;
import com.ruoyi.materialClass.service.IMaterialClassSubService;
/**
* -Service
*
* @author ruoyi
* @date 2024-01-04
*/
@Service
public class MaterialClassSubServiceImpl extends ServiceImpl<MaterialClassSubMapper, MaterialClassSub> implements IMaterialClassSubService {
@Autowired
private MaterialClassSubMapper materialClassSubMapper;
/**
* -
*
* @param classSubId -
* @return -
*/
@Override
public MaterialClassSub selectMaterialClassSubByClassSubId(String classSubId)
{
return materialClassSubMapper.selectMaterialClassSubByClassSubId(classSubId);
}
/**
* -
*
* @param materialClassSub -
* @return -
*/
@Override
public List<MaterialClassSub> selectMaterialClassSubList(MaterialClassSub materialClassSub)
{
return materialClassSubMapper.selectMaterialClassSubList(materialClassSub);
}
private LambdaQueryWrapper<MaterialClassSub> buildQueryWrapper(MaterialClassSub query) {
Map<String, Object> params = query.getParams();
LambdaQueryWrapper<MaterialClassSub> lqw = Wrappers.lambdaQuery();
lqw.eq(StringUtils.isNotBlank(query.getClassMastId()), MaterialClassSub::getClassMastId, query.getClassMastId());
lqw.like(StringUtils.isNotBlank(query.getClassNameSub()), MaterialClassSub::getClassNameSub, query.getClassNameSub());
return lqw;
}
}

@ -23,6 +23,7 @@
<result property="hiddenDangerGrade" column="hidden_danger_grade" /> <result property="hiddenDangerGrade" column="hidden_danger_grade" />
<result property="hiddenDangerType" column="hidden_danger_type" /> <result property="hiddenDangerType" column="hidden_danger_type" />
<result property="hiddenDangerLabel" column="hidden_danger_label" /> <result property="hiddenDangerLabel" column="hidden_danger_label" />
<result property="hiddenDangerLabelName" column="hidden_danger_label_name" />
<result property="rectifyTermTime" column="rectify_term_time" /> <result property="rectifyTermTime" column="rectify_term_time" />
<result property="isSupervise" column="is_supervise" /> <result property="isSupervise" column="is_supervise" />
<result property="assistDeptName" column="assist_dept_name" /> <result property="assistDeptName" column="assist_dept_name" />
@ -31,14 +32,14 @@
<result property="areaId" column="area_id" /> <result property="areaId" column="area_id" />
<result property="economicType" column="economic_type" /> <result property="economicType" column="economic_type" />
<result property="enterpriseScale" column="enterprise_scale" /> <result property="enterpriseScale" column="enterprise_scale" />
<result property="overTime" column="over_time" />
</resultMap> </resultMap>
<sql id="selectEhsHiddenDangerVo"> <sql id="selectEhsHiddenDangerVo">
select h.*, d.dept_name, SELECT h.*, d.dept_name, DATEDIFF(h.rectify_term_time ,ifnull(h.rectify_time,CURDATE()) ) over_time,
(SELECT GROUP_CONCAT( ft.dept_name SEPARATOR ';' ) FROM ( SELECT GROUP_CONCAT( ft.dept_name SEPARATOR ';' ) FROM sys_dept ft WHERE FIND_IN_SET( ft.DEPT_ID, h.assist_dept ) ) assist_dept_name ,
sys_dept ft where FIND_IN_SET( ft.DEPT_ID, h.assist_dept ))assist_dept_name ( SELECT GROUP_CONCAT( dd.dict_label SEPARATOR ';' ) FROM (select * from sys_dict_data where dict_type = 'hidden_danger_label' ) dd WHERE FIND_IN_SET(dd.dict_value, h.hidden_danger_label ) ) hidden_danger_label_name
from ehs_hidden_danger h FROM ehs_hidden_danger h LEFT JOIN sys_dept d ON h.dept_id = d.dept_id
left join sys_dept d on h.dept_id = d.dept_id
</sql> </sql>
<select id="selectEhsHiddenDangerList" parameterType="EhsHiddenDanger" resultMap="EhsHiddenDangerResult"> <select id="selectEhsHiddenDangerList" parameterType="EhsHiddenDanger" resultMap="EhsHiddenDangerResult">
@ -65,7 +66,9 @@
<if test="hiddenDangerType != null and hiddenDangerType != ''"> and hidden_danger_type = #{hiddenDangerType}</if> <if test="hiddenDangerType != null and hiddenDangerType != ''"> and hidden_danger_type = #{hiddenDangerType}</if>
<if test="assistDept != null and assistDept != ''"> and FIND_IN_SET( #{assistDept}, assist_dept )</if> <if test="assistDept != null and assistDept != ''"> and FIND_IN_SET( #{assistDept}, assist_dept )</if>
<if test="areaId != null and areaId != ''">and area_id = #{areaId}</if> <if test="areaId != null and areaId != ''">and area_id = #{areaId}</if>
<if test="isOverTime == '1'">and STATUS != 10 AND rectify_term_time &lt; NOW()</if> <if test="overTime == 7 ">and (h.STATUS = 0 or h.STATUS = 5 ) AND DATEDIFF(h.rectify_term_time ,ifnull(h.rectify_time,CURDATE()) )>3 AND DATEDIFF(h.rectify_term_time ,ifnull(h.rectify_time,CURDATE()) ) &lt;= 7 </if>
<if test="overTime == 3 ">and (h.STATUS = 0 or h.STATUS = 5 ) AND DATEDIFF(h.rectify_term_time ,ifnull(h.rectify_time,CURDATE()) )>=0 AND DATEDIFF(h.rectify_term_time ,ifnull(h.rectify_time,CURDATE()) ) &lt; 3 </if>
<if test="overTime == 0 ">and (h.STATUS = 0 or h.STATUS = 5 ) AND DATEDIFF(h.rectify_term_time ,ifnull(h.rectify_time,CURDATE()) ) &lt; 0</if>
<if test="hiddenDangerLabelArray != null "> <if test="hiddenDangerLabelArray != null ">
AND AND
<foreach collection="hiddenDangerLabelArray" item="item" separator="OR" index="index" open="(" close=")"> <foreach collection="hiddenDangerLabelArray" item="item" separator="OR" index="index" open="(" close=")">
@ -79,7 +82,10 @@
<include refid="selectEhsHiddenDangerVo"/> <include refid="selectEhsHiddenDangerVo"/>
where hidden_danger_id = #{hiddenDangerId} where hidden_danger_id = #{hiddenDangerId}
</select> </select>
<select id="selectEhsHiddenDangerOverTime" parameterType="EhsHiddenDanger" resultMap="EhsHiddenDangerResult">
select count(1) over_time from ehs_hidden_danger
where h.dept_Id = #{deptId} and (h.STATUS = 0 or h.STATUS = 5 ) AND DATEDIFF(h.rectify_term_time ,ifnull(h.rectify_time,CURDATE()) ) &lt; 0
</select>
<update id="superviseEhsHiddenDanger" parameterType="Long"> <update id="superviseEhsHiddenDanger" parameterType="Long">
update ehs_hidden_danger set is_supervise = 1 where hidden_danger_id in update ehs_hidden_danger set is_supervise = 1 where hidden_danger_id in
<foreach collection="array" item="hiddenDangerId" open="(" separator="," close=")"> <foreach collection="array" item="hiddenDangerId" open="(" separator="," close=")">

@ -35,12 +35,14 @@
</resultMap> </resultMap>
<sql id="selectEhsRiskVo"> <sql id="selectEhsRiskVo">
select risk_id, risk_grade, report_address_type, risk_location, risk_desc, people_quantity, materials_addr, materials_quantity, life_addr, resettle_addr, village_name, village_duties, village_tel, village_name1, village_duties1, village_tel1, create_by, create_time, update_by, update_time, remark, dept_id, create_user_id, update_user_id, inspection_name, inspection_duties, inspection_tel from ehs_risk select e.*, d.dept_name from ehs_risk e
left join sys_dept d on e.dept_id = d.dept_id
</sql> </sql>
<select id="selectEhsRiskList" parameterType="EhsRisk" resultMap="EhsRiskResult"> <select id="selectEhsRiskList" parameterType="EhsRisk" resultMap="EhsRiskResult">
<include refid="selectEhsRiskVo"/> <include refid="selectEhsRiskVo"/>
<where> <where>
<if test="deptId != null "> and e.dept_Id = #{deptId}</if>
<if test="riskGrade != null "> and risk_grade = #{riskGrade}</if> <if test="riskGrade != null "> and risk_grade = #{riskGrade}</if>
<if test="reportAddressType != null and reportAddressType != ''"> and report_address_type = #{reportAddressType}</if> <if test="reportAddressType != null and reportAddressType != ''"> and report_address_type = #{reportAddressType}</if>
<if test="riskLocation != null and riskLocation != ''"> and risk_location like concat('%', #{riskLocation}, '%')</if> <if test="riskLocation != null and riskLocation != ''"> and risk_location like concat('%', #{riskLocation}, '%')</if>

@ -0,0 +1,71 @@
<?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.materialClass.mapper.MaterialClassMasterMapper">
<resultMap type="MaterialClassMaster" id="MaterialClassMastResult">
<result property="classMastId" column="class_mast_id" />
<result property="id" column="id" />
<result property="classMastType" column="class_mast_type" />
<result property="classNameMast" column="class_name_mast" />
<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" />
<result property="classCount" column="class_count" />
</resultMap>
<resultMap id="MaterialClassMastMaterialClassSubResult" type="MaterialClassMaster" extends="MaterialClassMastResult">
<collection property="materialClassSubList" notNullColumn="sub_class_sub_id" javaType="java.util.List" resultMap="MaterialClassSubResult" />
</resultMap>
<resultMap type="MaterialClassSub" id="MaterialClassSubResult">
<result property="classSubId" column="sub_class_sub_id" />
<result property="classMastId" column="sub_class_mast_id" />
<result property="classMastType" column="class_mast_type" />
<result property="classNameSub" column="sub_class_name_sub" />
<result property="createBy" column="sub_create_by" />
<result property="createTime" column="sub_create_time" />
<result property="updateBy" column="sub_update_by" />
<result property="updateTime" column="sub_update_time" />
<result property="remark" column="sub_remark" />
<result property="deptId" column="sub_dept_id" />
<result property="createUserId" column="sub_create_user_id" />
<result property="updateUserId" column="sub_update_user_id" />
<result property="id" column="sub_id" />
</resultMap>
<sql id="selectMaterialClassMastVo">
select class_mast_id, id, class_mast_type, class_name_mast, create_by, create_time, update_by, update_time,
remark, dept_id, create_user_id, update_user_id,(select count(1) from material_class_sub b where a.id=b.mast_id ) class_count from material_class_master a
</sql>
<select id="selectMaterialClassMastList" parameterType="MaterialClassMaster" resultMap="MaterialClassMastResult">
<include refid="selectMaterialClassMastVo"/>
<where>
<if test="classMastId != null and classMastId != ''"> and class_mast_id = #{classMastId}</if>
<if test="classMastType != null and classMastType != ''"> and class_mast_type = #{classMastType}</if>
<if test="classNameMast != null and classNameMast != ''"> and class_name_mast = #{classNameMast}</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="createUserId != null "> and create_user_id = #{createUserId}</if>
<if test="updateUserId != null "> and update_user_id = #{updateUserId}</if>
</where>
</select>
<select id="selectMaterialClassMastByClassMastId" parameterType="String" resultMap="MaterialClassMastMaterialClassSubResult">
select a.class_mast_id, a.id, a.class_mast_type, a.class_name_mast, a.create_by, a.create_time, a.update_by, a.update_time, a.remark, a.dept_id, a.create_user_id, a.update_user_id,
b.class_sub_id as sub_class_sub_id, b.class_mast_id as sub_class_mast_id, b.class_name_sub as sub_class_name_sub, b.create_by as sub_create_by, b.create_time as sub_create_time, b.update_by as sub_update_by, b.update_time as sub_update_time, b.remark as sub_remark, b.dept_id as sub_dept_id, b.create_user_id as sub_create_user_id, b.update_user_id as sub_update_user_id, b.id as sub_id
from material_class_master a
left join material_class_sub b on b.mast_id = a.id
where a.id = #{classMastId}
</select>
</mapper>

@ -0,0 +1,54 @@
<?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.materialClass.mapper.MaterialClassSubMapper">
<resultMap type="MaterialClassSub" id="MaterialClassSubResult">
<result property="id" column="id" />
<result property="mastId" column="mast_id" />
<result property="classMastType" column="class_mast_type" />
<result property="classMastId" column="class_mast_id" />
<result property="classSubId" column="class_sub_id" />
<result property="classNameSub" column="class_name_sub" />
<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="selectMaterialClassSubVo">
select class_sub_id, class_mast_id, class_name_sub from material_class_sub
</sql>
<select id="selectMaterialClassSubList" parameterType="MaterialClassSub" resultMap="MaterialClassSubResult">
<include refid="selectMaterialClassSubVo"/>
<where>
<if test="mastId != null "> and mast_id = #{mastId}</if>
<if test="classMastType != null and classMastType != ''"> and class_mast_type = #{classMastType}</if>
<if test="classMastId != null and classMastId != ''"> and class_mast_id = #{classMastId}</if>
<if test="classSubId != null and classSubId != ''"> and class_sub_id = #{classSubId}</if>
<if test="classNameSub != null and classNameSub != ''"> and class_name_sub like concat('%', #{classNameSub}, '%')</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="createUserId != null "> and create_user_id = #{createUserId}</if>
<if test="updateUserId != null "> and update_user_id = #{updateUserId}</if>
</where>
</select>
<select id="selectMaterialClassSubByClassSubId" parameterType="String" resultMap="MaterialClassSubResult">
<include refid="selectMaterialClassSubVo"/>
where class_sub_id = #{classSubId}
</select>
<delete id="deleteMaterialClassSubByClassMastId" parameterType="String">
delete
from material_class_sub
where mast_id = #{classMastId}
</delete>
</mapper>

@ -57,7 +57,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql> </sql>
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult"> <select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag,
u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
left join sys_dept d on u.dept_id = d.dept_id left join sys_dept d on u.dept_id = d.dept_id
where u.del_flag = '0' where u.del_flag = '0'
<if test="userId != null and userId != 0"> <if test="userId != null and userId != 0">
@ -81,6 +82,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deptId != null and deptId != 0"> <if test="deptId != null and deptId != 0">
AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) )) AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) ))
</if> </if>
order by order_num
<!-- 数据范围过滤 --> <!-- 数据范围过滤 -->
${params.dataScope} ${params.dataScope}
</select> </select>

@ -0,0 +1,62 @@
import request from '@/utils/request'
// 查询物资分类一级分类列表
export function listMaterialClass(query) {
return request({
url: '/materialClass/materialClassMaster/list',
method: 'get',
params: query
})
}
// 查询物资分类一级分类详细
export function getMaterialClass(classMastId) {
return request({
url: '/materialClass/materialClassMaster/' + classMastId,
method: 'get'
})
}
// 新增物资分类一级分类
export function addMaterialClass(data) {
return request({
url: '/materialClass/materialClassMaster',
method: 'post',
data: data
})
}
// 修改物资分类一级分类
export function updateMaterialClass(data) {
return request({
url: '/materialClass/materialClassMaster',
method: 'put',
data: data
})
}
// 删除物资分类一级分类
export function delMaterialClass(classMastId) {
return request({
url: '/materialClass/materialClassMaster/' + classMastId,
method: 'delete'
})
}
// 按大类获取json
export function getMaterialClassJson(typeId) {
return request({
url: '/materialClass/materialClassMaster/getMaterialClassJson/' + typeId,
method: 'get'
})
}
// 根据json保存
export function setMaterialClassJson(data) {
return request({
url: '/materialClass/materialClassMaster/setMaterialClassJson' ,
method: 'post',
params: data
})
}

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询物资分类-二级分类列表
export function listMaterialClass(query) {
return request({
url: '/materialClass/materialClassSub/list',
method: 'get',
params: query
})
}
// 查询物资分类-二级分类详细
export function getMaterialClass(classSubId) {
return request({
url: '/materialClass/materialClassSub/' + classSubId,
method: 'get'
})
}
// 新增物资分类-二级分类
export function addMaterialClass(data) {
return request({
url: '/materialClass/materialClassSub',
method: 'post',
data: data
})
}
// 修改物资分类-二级分类
export function updateMaterialClass(data) {
return request({
url: '/materialClass/materialClassSub',
method: 'put',
data: data
})
}
// 删除物资分类-二级分类
export function delMaterialClass(classSubId) {
return request({
url: '/materialClass/materialClassSub/' + classSubId,
method: 'delete'
})
}

@ -25,6 +25,21 @@
}, { }, {
"value": "v1-8", "value": "v1-8",
"label": "救生绳" "label": "救生绳"
}, {
"value": "v1-9",
"label": "爆闪警示灯"
}, {
"value": "v1-10",
"label": "防爆微型警示灯"
}, {
"value": "v1-11",
"label": "电锯"
}, {
"value": "v1-12",
"label": "免洗胶"
}, {
"value": "v1-13",
"label": "电动喷雾器"
} }
] ]
}, },
@ -61,6 +76,24 @@
}, { }, {
"value": "v2-10", "value": "v2-10",
"label": "呼吸器充填泵" "label": "呼吸器充填泵"
}, {
"value": "v2-11",
"label": "手摇报警器"
}, {
"value": "v2-12",
"label": "防护服"
}, {
"value": "v2-13",
"label": "头盔"
}, {
"value": "v2-15",
"label": "口罩"
}, {
"value": "v2-14",
"label": "酒精"
}, {
"value": "v2-16",
"label": "应急救援包"
} }
] ]
}, },
@ -82,6 +115,9 @@
}, { }, {
"value": "v3-5", "value": "v3-5",
"label": "卫星电话" "label": "卫星电话"
}, {
"value": "v3-6",
"label": "双模对讲机"
} }
] ]
}, },
@ -106,6 +142,30 @@
}, { }, {
"value": "v4-6", "value": "v4-6",
"label": "照明灯具" "label": "照明灯具"
}, {
"value": "v4-7",
"label": "水泵"
}, {
"value": "v4-8",
"label": "泵车"
}, {
"value": "v4-9",
"label": "自动升降照明灯"
}, {
"value": "v4-10",
"label": "智能应急物资管理柜"
}, {
"value": "v4-11",
"label": "车载搜救灯"
}, {
"value": "v4-12",
"label": "LED大功率灯"
}, {
"value": "v4-13",
"label": "高杆电灯"
}, {
"value": "v4-14",
"label": "发电车"
} }
] ]
} }

@ -16,6 +16,21 @@
}, { }, {
"value": "v1-5", "value": "v1-5",
"label": "无土沙袋" "label": "无土沙袋"
}, {
"value": "v1-6",
"label": "组合式防护板"
}, {
"value": "v1-7",
"label": "子堤(组合式防护板)"
}, {
"value": "v1-8",
"label": "铁丝"
}, {
"value": "v1-9",
"label": "铁丝网"
}, {
"value": "v1-10",
"label": "电缆"
} }
] ]
}, },
@ -46,6 +61,12 @@
}, { }, {
"value": "v2-8", "value": "v2-8",
"label": "管涌探测仪" "label": "管涌探测仪"
}, {
"value": "v2-9",
"label": "打桩机"
}, {
"value": "v2-10",
"label": "抽水机"
} }
] ]
}, },
@ -79,6 +100,12 @@
}, { }, {
"value": "v3-9", "value": "v3-9",
"label": "潜水设备" "label": "潜水设备"
}, {
"value": "v3-10",
"label": "水面漂浮救生绳"
}, {
"value": "v3-11",
"label": "防汛套装应急包"
} }
] ]
}, },

@ -124,6 +124,9 @@
}, { }, {
"value": "v4-17", "value": "v4-17",
"label": "手电" "label": "手电"
}, {
"value": "v4-18",
"label": "风力灭火器"
} }
] ]
}, },

@ -16,6 +16,24 @@
}, { }, {
"value": "v1-5", "value": "v1-5",
"label": "睡袋" "label": "睡袋"
}, {
"value": "v1-6",
"label": "新帐篷"
}, {
"value": "v1-7",
"label": "旧帐篷"
}, {
"value": "v1-8",
"label": "新床"
}, {
"value": "v1-9",
"label": "旧床"
}, {
"value": "v1-10",
"label": "黑金刚(四脚帐篷)"
}, {
"value": "v1-11",
"label": "凳子"
} }
] ]
}, { }, {
@ -54,6 +72,9 @@
}, { }, {
"value": "v2-11", "value": "v2-11",
"label": "雨鞋" "label": "雨鞋"
}, {
"value": "v2-12",
"label": "被服包"
} }
] ]
}, { }, {
@ -89,6 +110,15 @@
}, { }, {
"value": "v3-10", "value": "v3-10",
"label": "救生圈" "label": "救生圈"
}, {
"value": "v3-11",
"label": "电暖炉"
}, {
"value": "v3-12",
"label": "电油汀"
}, {
"value": "v3-13",
"label": "旧油汀"
} }
] ]
}, { }, {
@ -121,6 +151,9 @@
}, { }, {
"value": "v4-9", "value": "v4-9",
"label": "火腿肠" "label": "火腿肠"
}, {
"value": "v4-10",
"label": "中药饮品"
} }
] ]
} }

@ -1,216 +0,0 @@
<template>
<div class="upload-file">
<el-upload
multiple
:action="uploadFileUrl"
:before-upload="handleBeforeUpload"
:file-list="fileList"
:limit="limit"
:on-error="handleUploadError"
:on-exceed="handleExceed"
:on-success="handleUploadSuccess"
:show-file-list="false"
:headers="headers"
class="upload-file-uploader"
ref="fileUpload"
>
<!-- 上传按钮 -->
<el-button size="mini" type="primary">选取文件</el-button>
<!-- 上传提示 -->
<div class="el-upload__tip" slot="tip" v-if="showTip">
请上传
<template v-if="fileSize"> <b style="color: #f56c6c">{{ fileSize }}MB</b> </template>
<template v-if="fileType"> <b style="color: #f56c6c">{{ fileType.join("/") }}</b> </template>
的文件
</div>
</el-upload>
<!-- 文件列表 -->
<transition-group class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul">
<li :key="file.url" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in fileList">
<el-link :href="`${baseUrl}${file.url}`" :underline="false" target="_blank">
<span class="el-icon-document"> {{ getFileName(file.name) }} </span>
</el-link>
<div class="ele-upload-list__item-content-action">
<el-link :underline="false" @click="handleDelete(index)" type="danger">删除</el-link>
</div>
</li>
</transition-group>
</div>
</template>
<script>
import { getToken } from "@/utils/auth";
export default {
name: "FileUpload",
props: {
//
value: [String, Object, Array],
//
limit: {
type: Number,
default: 5,
},
// (MB)
fileSize: {
type: Number,
default: 5,
},
// , ['png', 'jpg', 'jpeg']
fileType: {
type: Array,
default: () => ["doc", "xls", "ppt", "txt", "pdf"],
},
//
isShowTip: {
type: Boolean,
default: true
}
},
data() {
return {
number: 0,
uploadList: [],
baseUrl: process.env.VUE_APP_BASE_API,
uploadFileUrl: process.env.VUE_APP_BASE_API + "/common/upload", //
headers: {
Authorization: "Bearer " + getToken(),
},
fileList: [],
};
},
watch: {
value: {
handler(val) {
if (val) {
let temp = 1;
//
const list = Array.isArray(val) ? val : this.value.split(',');
//
this.fileList = list.map(item => {
if (typeof item === "string") {
item = { name: item, url: item };
}
item.uid = item.uid || new Date().getTime() + temp++;
return item;
});
} else {
this.fileList = [];
return [];
}
},
deep: true,
immediate: true
}
},
computed: {
//
showTip() {
return this.isShowTip && (this.fileType || this.fileSize);
},
},
methods: {
//
handleBeforeUpload(file) {
//
if (this.fileType) {
const fileName = file.name.split('.');
const fileExt = fileName[fileName.length - 1];
const isTypeOk = this.fileType.indexOf(fileExt) >= 0;
if (!isTypeOk) {
this.$modal.msgError(`文件格式不正确, 请上传${this.fileType.join("/")}格式文件!`);
return false;
}
}
//
if (this.fileSize) {
const isLt = file.size / 1024 / 1024 < this.fileSize;
if (!isLt) {
this.$modal.msgError(`上传文件大小不能超过 ${this.fileSize} MB!`);
return false;
}
}
this.$modal.loading("正在上传文件,请稍候...");
this.number++;
return true;
},
//
handleExceed() {
this.$modal.msgError(`上传文件数量不能超过 ${this.limit} 个!`);
},
//
handleUploadError(err) {
this.$modal.msgError("上传文件失败,请重试");
this.$modal.closeLoading();
},
//
handleUploadSuccess(res, file) {
if (res.code === 200) {
this.uploadList.push({ name: res.fileName, url: res.fileName });
this.uploadedSuccessfully();
} else {
this.number--;
this.$modal.closeLoading();
this.$modal.msgError(res.msg);
this.$refs.fileUpload.handleRemove(file);
this.uploadedSuccessfully();
}
},
//
handleDelete(index) {
this.fileList.splice(index, 1);
this.$emit("input", this.listToString(this.fileList));
},
//
uploadedSuccessfully() {
if (this.number > 0 && this.uploadList.length === this.number) {
this.fileList = this.fileList.concat(this.uploadList);
this.uploadList = [];
this.number = 0;
this.$emit("input", this.listToString(this.fileList));
this.$modal.closeLoading();
}
},
//
getFileName(name) {
// url
if (name.lastIndexOf("/") > -1) {
return name.slice(name.lastIndexOf("/") + 1);
} else {
return name;
}
},
//
listToString(list, separator) {
let strs = "";
separator = separator || ",";
for (let i in list) {
strs += list[i].url + separator;
}
return strs != '' ? strs.substr(0, strs.length - 1) : '';
}
}
};
</script>
<style scoped lang="scss">
.upload-file-uploader {
margin-bottom: 5px;
}
.upload-file-list .el-upload-list__item {
border: 1px solid #e4e7ed;
line-height: 2;
margin-bottom: 10px;
position: relative;
}
.upload-file-list .ele-upload-list__item-content {
display: flex;
justify-content: space-between;
align-items: center;
color: inherit;
}
.ele-upload-list__item-content-action .el-link {
margin-right: 10px;
}
</style>

@ -124,6 +124,7 @@ export default {
}, },
// //
handleSelect(key, keyPath) { handleSelect(key, keyPath) {
console.log(key)
this.currentIndex = key; this.currentIndex = key;
const route = this.routers.find(item => item.path === key); const route = this.routers.find(item => item.path === key);
if (this.ishttp(key)) { if (this.ishttp(key)) {

@ -12,7 +12,7 @@ module.exports = {
/** /**
* 是否显示顶部导航 * 是否显示顶部导航
*/ */
topNav: false, topNav: true,
/** /**
* 是否显示 tagsView * 是否显示 tagsView

@ -11,14 +11,7 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="社会信用代码" prop="enterpriseCode">
<el-input
v-model="queryParams.enterpriseCode"
placeholder="请输入社会信用代码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="名称" prop="enterpriseName"> <el-form-item label="名称" prop="enterpriseName">
<el-input <el-input
v-model="queryParams.enterpriseName" v-model="queryParams.enterpriseName"
@ -47,6 +40,14 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="社会信用代码" prop="enterpriseCode" label-width="98px">
<el-input
v-model="queryParams.enterpriseCode"
placeholder="请输入社会信用代码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!--<el-form-item label="生产经营地址" prop="enterpriseAddr"> <!--<el-form-item label="生产经营地址" prop="enterpriseAddr">
<el-input <el-input
v-model="queryParams.enterpriseAddr" v-model="queryParams.enterpriseAddr"
@ -184,6 +185,17 @@
v-hasPermi="['ehsEnterprise:ehsEnterprise:export']" v-hasPermi="['ehsEnterprise:ehsEnterprise:export']"
>导出</el-button> >导出</el-button>
</el-col> </el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-upload2"
size="mini"
@click="handleImport"
v-hasPermi="['ehsEnterprise:ehsEnterprise:import']"
>导入</el-button
>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
@ -362,15 +374,26 @@
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<!-- 导入 -->
<importUpload
ref="uploadRef"
@ok="upLoadOk"
downUrl="/ehsEnterprise/ehsEnterprise/importTemplate"
temName="企业信息导入模板"
></importUpload>
</div> </div>
</template> </template>
<script> <script>
import { listEhsEnterprise, getEhsEnterprise, delEhsEnterprise, addEhsEnterprise, updateEhsEnterprise } from "@/api/ehs/ehsEnterprise"; import { listEhsEnterprise, getEhsEnterprise, delEhsEnterprise, addEhsEnterprise, updateEhsEnterprise } from "@/api/ehs/ehsEnterprise";
import {listAllDept } from "@/api/system/dept"; import {listAllDept } from "@/api/system/dept";
import importUpload from "@/components/upload/upload";
export default { export default {
name: "EhsEnterprise", name: "EhsEnterprise",
dicts: ['enterprise_type','enterprise_scale','economic_type','area_id'], dicts: ['enterprise_type','enterprise_scale','economic_type','area_id'],
components: {
importUpload,
},
data() { data() {
return { return {
// //
@ -581,8 +604,21 @@ export default {
handleExport() { handleExport() {
this.download('ehsEnterprise/ehsEnterprise/export', { this.download('ehsEnterprise/ehsEnterprise/export', {
...this.queryParams ...this.queryParams
}, `ehsEnterprise_${new Date().getTime()}.xlsx`) }, `企业_${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 + "/ehsEnterprise/ehsEnterprise/importData";
},
/** 导入成功 */
upLoadOk() {
// console.log("")
this.getList();
},
} }
}; };
</script> </script>

@ -132,9 +132,10 @@
border border
height="396" height="396"
> >
<el-table-column prop="index" type="index" label="排名"> </el-table-column>
<el-table-column prop="areaName" label="区域"> </el-table-column> <el-table-column prop="areaName" label="区域"> </el-table-column>
<el-table-column prop="reportHiddenNum" label="隐患数量"> </el-table-column> <el-table-column prop="reportHiddenNum" label="隐患数量"> </el-table-column>
<el-table-column prop="index" type="index" label="排名"> </el-table-column>
</el-table> </el-table>
</div> </div>
</div> </div>

@ -12,10 +12,10 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="隐患所在单位" prop="enterpriseName"> <el-form-item label="单位名称" prop="enterpriseName">
<el-input <el-input
v-model="queryParams.enterpriseName" v-model="queryParams.enterpriseName"
placeholder="请输入隐患所在单位" placeholder="请输入单位名称"
clearable clearable
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
@ -40,6 +40,27 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="整改进度" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择整改进度" clearable>
<el-option
v-for="dict in dict.type.hidden_danger_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="隐患级别" prop="hiddenDangerGrade">
<el-select v-model="queryParams.hiddenDangerGrade" placeholder="请选择隐患级别" clearable>
<el-option
v-for="dict in dict.type.hidden_danger_grade"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="排查时间" prop="checkTime"> <el-form-item label="排查时间" prop="checkTime">
<el-date-picker <el-date-picker
v-model="daterangeCheckTime" v-model="daterangeCheckTime"
@ -107,18 +128,9 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item>--> </el-form-item>-->
<el-form-item label="隐患级别" prop="hiddenDangerGrade">
<el-select v-model="queryParams.hiddenDangerGrade" placeholder="请选择隐患级别" clearable> <!--<el-form-item label="行政区划" prop="areaId">
<el-option <el-select v-model="queryParams.areaId" placeholder="请选择企业地址">
v-for="dict in dict.type.hidden_danger_grade"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="行政区划" prop="areaId">
<el-select v-model="queryParams.areaId" placeholder="请选择行政区域">
<el-option <el-option
v-for="dict in dict.type.area_id" v-for="dict in dict.type.area_id"
:key="dict.value" :key="dict.value"
@ -136,7 +148,18 @@
:value="dict.value" :value="dict.value"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>-->
<!-- <el-form-item label="排查方式" prop="checkType">
<el-select v-model="queryParams.checkType" placeholder="请选择排查方式" clearable>
<el-option
v-for="dict in dict.type.check_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>-->
<el-form-item label="标签" prop="hiddenDangerLabelArray"> <el-form-item label="标签" prop="hiddenDangerLabelArray">
<el-select v-model="queryParams.hiddenDangerLabelArray" multiple collapse-tags placeholder="请选择标签" clearable> <el-select v-model="queryParams.hiddenDangerLabelArray" multiple collapse-tags placeholder="请选择标签" clearable>
<el-option <el-option
@ -147,6 +170,26 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="告警查询" prop="overTime">
<el-select v-model="queryParams.overTime" placeholder="请选告警范围" clearable>
<el-option
v-for="dict in alertState"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<!--<el-form-item label="是否乡镇(街道)" prop="isTowns" label-width="130px">
<el-select v-model="queryParams.isTowns" placeholder="请选择是否乡镇(街道)" clearable>
<el-option
v-for="dict in dict.type.ehs_yes_no"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>-->
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button> <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-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
@ -164,7 +207,7 @@
v-hasPermi="['ehsHiddenDanger:ehsHiddenDanger:add']" v-hasPermi="['ehsHiddenDanger:ehsHiddenDanger:add']"
>新增</el-button> >新增</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <!-- <el-col :span="1.5">
<el-button <el-button
type="success" type="success"
plain plain
@ -174,7 +217,7 @@
@click="handleUpdate" @click="handleUpdate"
v-hasPermi="['ehsHiddenDanger:ehsHiddenDanger:edit']" v-hasPermi="['ehsHiddenDanger:ehsHiddenDanger:edit']"
>修改</el-button> >修改</el-button>
</el-col> </el-col>-->
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="danger" type="danger"
@ -196,17 +239,26 @@
v-hasPermi="['ehsHiddenDanger:ehsHiddenDanger:export']" v-hasPermi="['ehsHiddenDanger:ehsHiddenDanger:export']"
>导出</el-button> >导出</el-button>
</el-col> </el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-upload2"
size="mini"
@click="handleImport"
v-hasPermi="['ehsHiddenDanger:ehsHiddenDanger:import']"
>导入</el-button >
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="ehsHiddenDangerList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="ehsHiddenDangerList" @selection-change="handleSelectionChange" max-height="550" style="width: 100%" :row-class-name="tableRowClassName">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="主键" align="center" prop="hiddenDangerId" />--> <!-- <el-table-column label="主键" align="center" prop="hiddenDangerId" />-->
<el-table-column label="上报部门" align="center" prop="deptName" v-if="deptShow"/> <el-table-column label="上报部门" align="center" prop="deptName" v-if="deptShow"/>
<el-table-column label="隐患所在单位" align="center" prop="enterpriseName" /> <el-table-column label="单位名称" align="center" prop="enterpriseName" >
<el-table-column label="企业现状" align="center" prop="enterpriseStatus">
<template slot-scope="scope"> <template slot-scope="scope">
<span> {{ (scope.row.enterpriseStatus !=null && scope.row.enterpriseStatus != "") ? statusOptions[scope.row.enterpriseStatus].label:""}}</span> <el-link type="primary" @click="handleUpdate(scope.row,true)">{{scope.row.enterpriseName}} </el-link>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="行业" align="center" prop="enterpriseType"> <el-table-column label="行业" align="center" prop="enterpriseType">
@ -214,36 +266,39 @@
<dict-tag :options="dict.type.enterprise_type" :value="scope.row.enterpriseType"/> <dict-tag :options="dict.type.enterprise_type" :value="scope.row.enterpriseType"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="企业现状" align="center" prop="enterpriseStatus">
<template slot-scope="scope">
<span> {{ (scope.row.enterpriseStatus !=null && scope.row.enterpriseStatus != "") ? statusOptions[scope.row.enterpriseStatus].label:""}}</span>
</template>
</el-table-column>
<el-table-column label="隐患情况" align="center" prop="hiddenDangerDesc" /> <el-table-column label="隐患情况" align="center" prop="hiddenDangerDesc" />
<el-table-column label="排查时间" align="center" prop="checkTime" width="180"> <el-table-column label="排查时间" align="center" prop="checkTime" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.checkTime, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.checkTime, '{y}-{m}-{d}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="排查方式" align="center" prop="checkType">
<template slot-scope="scope">
<dict-tag :options="dict.type.check_type" :value="scope.row.checkType"/>
</template>
</el-table-column>
<el-table-column label="整改措施" align="center" prop="rectifyMeasure" />
<el-table-column label="要求整改时间" align="center" prop="rectifyTermTime" width="180"> <el-table-column label="要求整改时间" align="center" prop="rectifyTermTime" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.rectifyTermTime, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.rectifyTermTime, '{y}-{m}-{d}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="排查方式" align="center" prop="checkType" /> <el-table-column label="整改进度" align="center" prop="status">
<el-table-column label="隐患照片" align="center" prop="hiddenDangerImg" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<image-preview :src="scope.row.hiddenDangerImg" :width="50" :height="50"/> <dict-tag :options="dict.type.hidden_danger_status" :value="scope.row.status"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="整改措施" align="center" prop="rectifyMeasure" />
<el-table-column label="整改进度" align="center" prop="status" />
<el-table-column label="整改时间" align="center" prop="rectifyTime" width="180"> <el-table-column label="整改时间" align="center" prop="rectifyTime" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.rectifyTime, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.rectifyTime, '{y}-{m}-{d}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="整改责任人" align="center" prop="principalName" /> <el-table-column label="整改责任人" align="center" prop="principalName" />
<el-table-column label="整改照片" align="center" prop="rectifyImg" width="100">
<template slot-scope="scope">
<image-preview :src="scope.row.rectifyImg" :width="50" :height="50"/>
</template>
</el-table-column>
<el-table-column label="监管部门" align="center" prop="regulatoryDept" /> <el-table-column label="监管部门" align="center" prop="regulatoryDept" />
<el-table-column label="监管部门责任人" align="center" prop="regulatoryName" /> <el-table-column label="监管部门责任人" align="center" prop="regulatoryName" />
<el-table-column label="隐患级别" align="center" prop="hiddenDangerGrade"> <el-table-column label="隐患级别" align="center" prop="hiddenDangerGrade">
@ -251,11 +306,32 @@
<dict-tag :options="dict.type.hidden_danger_grade" :value="scope.row.hiddenDangerGrade"/> <dict-tag :options="dict.type.hidden_danger_grade" :value="scope.row.hiddenDangerGrade"/>
</template> </template>
</el-table-column> </el-table-column>
<!--<el-table-column label="是否乡镇(街道)" align="center" prop="isTowns">
<template slot-scope="scope">
<dict-tag :options="dict.type.ehs_yes_no" :value="scope.row.isTowns"/>
</template>
</el-table-column>-->
<!--<el-table-column label="隐患照片" align="center" prop="hiddenDangerImg" width="100">
<template slot-scope="scope">
<image-preview :src="scope.row.hiddenDangerImg" :width="50" :height="50"/>
</template>
</el-table-column>
<el-table-column label="整改照片" align="center" prop="rectifyImg" width="100">
<template slot-scope="scope">
<image-preview :src="scope.row.rectifyImg" :width="50" :height="50"/>
</template>
</el-table-column>
<el-table-column label="隐患类型" align="center" prop="hiddenDangerType"> <el-table-column label="隐患类型" align="center" prop="hiddenDangerType">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.hidden_danger_type" :value="scope.row.hiddenDangerType"/> <dict-tag :options="dict.type.hidden_danger_type" :value="scope.row.hiddenDangerType"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="整改情况" align="center" prop="status" >
<template slot-scope="scope">
<dict-tag :options="dict.type.hidden_danger_status" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="整改资金" align="center" prop="rectifyMoney" />-->
<el-table-column label="是否督办" align="center" prop="isSupervise"> <el-table-column label="是否督办" align="center" prop="isSupervise">
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch v-model="scope.row.isSupervise==1" @change="val => {isSuperviseChange(val, scope.row);}" ></el-switch> <el-switch v-model="scope.row.isSupervise==1" @change="val => {isSuperviseChange(val, scope.row);}" ></el-switch>
@ -266,33 +342,34 @@
<el-link type="primary" @click="val => {assistDeptClick(val, scope.row);}" > {{(scope.row.assistDept=='' ||scope.row.assistDept==null)?"无协办单位": "显示协办单位" }} </el-link> <el-link type="primary" @click="val => {assistDeptClick(val, scope.row);}" > {{(scope.row.assistDept=='' ||scope.row.assistDept==null)?"无协办单位": "显示协办单位" }} </el-link>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="整改情况" align="center" prop="status" >
<template slot-scope="scope">
<dict-tag :options="dict.type.hidden_danger_status" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="整改资金" align="center" prop="rectifyMoney" />
<el-table-column label="标签" align="center" prop="hiddenDangerLabel"> <el-table-column label="标签" align="center" prop="hiddenDangerLabel">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.hidden_danger_label" :value="scope.row.hiddenDangerLabel"/> <dict-tag :options="dict.type.hidden_danger_label" :value="scope.row.hiddenDangerLabel"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row,false)"
v-hasPermi="['ehsHiddenDanger:ehsHiddenDanger:edit']" v-hasPermi="['ehsHiddenDanger:ehsHiddenDanger:edit']"
>修改</el-button> >修改</el-button>
<!-- <el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleUpdate(scope.row,true)"
>明细</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['ehsHiddenDanger:ehsHiddenDanger:remove']" v-hasPermi="['ehsHiddenDanger:ehsHiddenDanger:remove']"
>删除</el-button> >删除</el-button>-->
<!--<el-button v-if="scope.row.isSupervise==0" <!--<el-button v-if="scope.row.isSupervise==0"
size="mini" size="mini"
type="text" type="text"
@ -336,15 +413,15 @@
<!-- 添加或修改隐患信息对话框 --> <!-- 添加或修改隐患信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="800px" > <el-dialog :title="title" :visible.sync="open" width="800px" >
<el-form ref="form" :model="form" :rules="rules" label-width="110px"> <el-form ref="form" :model="form" :rules="rules" label-width="110px">
<el-form-item label="隐患所在单位" prop="enterpriseName"> <el-form-item label="单位名称" prop="enterpriseName">
<el-input placeholder="请输入隐患所在单位" v-model="form.enterpriseName" class="input-with-select"> <el-input placeholder="请输入单位名称" v-model="form.enterpriseName" class="input-with-select" :readonly="isReadOnly">
<el-button slot="append" icon="el-icon-search" @click="openEnterprise"></el-button> <el-button slot="append" icon="el-icon-search" @click="openEnterprise"></el-button>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="行业" prop="enterpriseType"> <el-form-item label="行业" prop="enterpriseType">
<el-select v-model="form.enterpriseType" placeholder="请选择行业"> <el-select v-model="form.enterpriseType" placeholder="请选择行业" :disabled="isReadOnly">
<el-option <el-option
v-for="dict in dict.type.enterprise_type" v-for="dict in dict.type.enterprise_type"
:key="dict.value" :key="dict.value"
@ -356,7 +433,7 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="企业现状" prop="enterpriseStatus"> <el-form-item label="企业现状" prop="enterpriseStatus">
<el-select v-model="form.enterpriseStatus" placeholder="请选择企业现状" clearable> <el-select v-model="form.enterpriseStatus" placeholder="请选择企业现状" clearable :disabled="isReadOnly">
<el-option <el-option
v-for="dict in statusOptions" v-for="dict in statusOptions"
:key="dict.value" :key="dict.value"
@ -370,7 +447,7 @@
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="经济类型" prop="economicType"> <el-form-item label="经济类型" prop="economicType">
<el-select v-model="form.economicType" placeholder="请选择经济类型"> <el-select v-model="form.economicType" placeholder="请选择经济类型" :disabled="isReadOnly">
<el-option <el-option
v-for="dict in dict.type.economic_type" v-for="dict in dict.type.economic_type"
:key="dict.value" :key="dict.value"
@ -382,7 +459,7 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="企业规模" prop="enterpriseScale"> <el-form-item label="企业规模" prop="enterpriseScale">
<el-select v-model="form.enterpriseScale" placeholder="请选择企业规模" clearable> <el-select v-model="form.enterpriseScale" placeholder="请选择企业规模" clearable :disabled="isReadOnly">
<el-option <el-option
v-for="dict in dict.type.enterprise_scale" v-for="dict in dict.type.enterprise_scale"
:key="dict.value" :key="dict.value"
@ -395,8 +472,8 @@
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="行政区域" prop="areaId"> <el-form-item label="企业地址" prop="areaId">
<el-select v-model="form.areaId" placeholder="请选择行政区域"> <el-select v-model="form.areaId" placeholder="请选择企业地址" :disabled="isReadOnly">
<el-option <el-option
v-for="dict in dict.type.area_id" v-for="dict in dict.type.area_id"
:key="dict.value" :key="dict.value"
@ -407,16 +484,51 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="排查方式" prop="checkType">
<el-select v-model="form.checkType" placeholder="请选择排查方式" :disabled="isReadOnly">
<el-option
v-for="dict in dict.type.check_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<!--<el-form-item label="是否乡镇(街道)" prop="isTowns">
<el-select v-model="form.isTowns" placeholder="请选择是否乡镇(街道)" :disabled="isReadOnly">
<el-option
v-for="dict in dict.type.ehs_yes_no"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>-->
</el-col>
<el-col :span="12">
<el-form-item label="整改进度" prop="status">
<el-select v-model="form.status" placeholder="请选择整改进度" :disabled="isReadOnly">
<el-option
v-for="dict in dict.type.hidden_danger_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-form-item label="隐患情况" prop="hiddenDangerDesc"> <el-form-item label="隐患情况" prop="hiddenDangerDesc">
<el-input v-model="form.hiddenDangerDesc" type="textarea" placeholder="请输入内容" /> <el-input v-model="form.hiddenDangerDesc" type="textarea" placeholder="请输入内容" :readonly="isReadOnly" />
</el-form-item> </el-form-item>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="排查时间" prop="checkTime"> <el-form-item label="排查时间" prop="checkTime" >
<el-date-picker clearable <el-date-picker clearable :readonly="isReadOnly"
v-model="form.checkTime" v-model="form.checkTime"
type="date" type="date"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
@ -425,8 +537,8 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="整改期限" prop="rectifyTermTime"> <el-form-item label="整改期限" prop="rectifyTermTime" >
<el-date-picker clearable <el-date-picker clearable :readonly="isReadOnly"
v-model="form.rectifyTermTime" v-model="form.rectifyTermTime"
type="date" type="date"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
@ -436,15 +548,16 @@
</el-col> </el-col>
</el-row> </el-row>
<el-form-item label="隐患照片" prop="hiddenDangerImg"> <el-form-item label="隐患照片" prop="hiddenDangerImg">
<image-upload v-model="form.hiddenDangerImg"/> <image-upload v-if="!isReadOnly" v-model="form.hiddenDangerImg" />
<image-preview v-if="isReadOnly" :src="form.hiddenDangerImg" />
</el-form-item> </el-form-item>
<el-form-item label="整改措施" prop="rectifyMeasure"> <el-form-item label="整改措施" prop="rectifyMeasure">
<el-input v-model="form.rectifyMeasure" type="textarea" placeholder="请输入整改措施" /> <el-input v-model="form.rectifyMeasure" type="textarea" placeholder="请输入整改措施" :readonly="isReadOnly"/>
</el-form-item> </el-form-item>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="整改时间" prop="rectifyTime"> <el-form-item label="整改时间" prop="rectifyTime">
<el-date-picker clearable <el-date-picker clearable :readonly="isReadOnly"
v-model="form.rectifyTime" v-model="form.rectifyTime"
type="date" type="date"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
@ -454,29 +567,30 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="整改责任人" prop="principalName"> <el-form-item label="整改责任人" prop="principalName">
<el-input v-model="form.principalName" placeholder="请输入整改责任人" /> <el-input v-model="form.principalName" placeholder="请输入整改责任人" :readonly="isReadOnly"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-form-item label="整改照片" prop="rectifyImg"> <el-form-item label="整改照片" prop="rectifyImg">
<image-upload v-model="form.rectifyImg"/> <image-upload v-if="!isReadOnly" v-model="form.rectifyImg" />
<image-preview v-if="isReadOnly" :src="form.rectifyImg" />
</el-form-item> </el-form-item>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="监管部门" prop="regulatoryDept"> <el-form-item label="监管部门" prop="regulatoryDept">
<el-input v-model="form.regulatoryDept" placeholder="请输入监管部门" /> <el-input v-model="form.regulatoryDept" placeholder="请输入监管部门" :readonly="isReadOnly"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="监管责任人" prop="regulatoryName"> <el-form-item label="监管责任人" prop="regulatoryName">
<el-input v-model="form.regulatoryName" placeholder="请输入监管部门责任人" /> <el-input v-model="form.regulatoryName" placeholder="请输入监管部门责任人" :readonly="isReadOnly"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="隐患级别" prop="hiddenDangerGrade"> <el-form-item label="隐患级别" prop="hiddenDangerGrade">
<el-select v-model="form.hiddenDangerGrade" placeholder="请选择隐患级别"> <el-select v-model="form.hiddenDangerGrade" placeholder="请选择隐患级别" :disabled="isReadOnly">
<el-option <el-option
v-for="dict in dict.type.hidden_danger_grade" v-for="dict in dict.type.hidden_danger_grade"
:key="dict.value" :key="dict.value"
@ -488,7 +602,7 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="隐患类型" prop="hiddenDangerType"> <el-form-item label="隐患类型" prop="hiddenDangerType">
<el-select v-model="form.hiddenDangerType" placeholder="请选择隐患类型"> <el-select v-model="form.hiddenDangerType" placeholder="请选择隐患类型" :disabled="isReadOnly">
<el-option <el-option
v-for="dict in dict.type.hidden_danger_type" v-for="dict in dict.type.hidden_danger_type"
:key="dict.value" :key="dict.value"
@ -503,7 +617,7 @@
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="标签" prop="hiddenDangerLabelArray"> <el-form-item label="标签" prop="hiddenDangerLabelArray">
<el-select v-model="form.hiddenDangerLabelArray" multiple collapse-tags placeholder="请选择标签"> <el-select v-model="form.hiddenDangerLabelArray" multiple collapse-tags placeholder="请选择标签" :disabled="isReadOnly">
<el-option <el-option
v-for="dict in dict.type.hidden_danger_label" v-for="dict in dict.type.hidden_danger_label"
:key="dict.value" :key="dict.value"
@ -515,13 +629,13 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="整改资金" prop="rectifyMoney"> <el-form-item label="整改资金" prop="rectifyMoney">
<el-input v-model="form.rectifyMoney" placeholder="请输入整改资金" /> <el-input v-model="form.rectifyMoney" placeholder="请输入整改资金" :readonly="isReadOnly" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button v-if="!isReadOnly" type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
<enterpriseSelect ref="enterpriseSelectRef" @selectInfo='selectInfo'></enterpriseSelect> <enterpriseSelect ref="enterpriseSelectRef" @selectInfo='selectInfo'></enterpriseSelect>
@ -546,6 +660,13 @@
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<!-- 导入 -->
<importUpload
ref="uploadRef"
@ok="upLoadOk"
downUrl="/ehsHiddenDanger/ehsHiddenDanger/importTemplate"
temName="隐患信息导入模板"
></importUpload>
</div> </div>
</template> </template>
@ -554,10 +675,12 @@ import { listEhsHiddenDanger, getEhsHiddenDanger, delEhsHiddenDanger, addEhsHidd
superviseEhsHiddenDanger,assistEhsHiddenDanger } from "@/api/ehs/ehsHiddenDanger"; superviseEhsHiddenDanger,assistEhsHiddenDanger } from "@/api/ehs/ehsHiddenDanger";
import {listAllDept } from "@/api/system/dept"; import {listAllDept } from "@/api/system/dept";
import enterpriseSelect from "./enterpriseSelect" import enterpriseSelect from "./enterpriseSelect"
import importUpload from "@/components/upload/upload";
export default { export default {
name: "EhsHiddenDanger", name: "EhsHiddenDanger",
dicts: ['hidden_danger_type', 'hidden_danger_grade', 'hidden_danger_label', 'enterprise_type','enterprise_scale','economic_type','area_id', "hidden_danger_status"], dicts: ['hidden_danger_type', 'hidden_danger_grade', 'hidden_danger_label', 'enterprise_type','enterprise_scale',
components:{ enterpriseSelect }, 'economic_type','area_id', "hidden_danger_status","check_type", "ehs_yes_no"],
components:{ importUpload,enterpriseSelect },
data() { data() {
return { return {
// //
@ -578,6 +701,7 @@ export default {
title: "", title: "",
// //
open: false, open: false,
isReadOnly:false,//form
// //
deptShow: false, deptShow: false,
// //
@ -620,18 +744,33 @@ export default {
hiddenDangerType: null, hiddenDangerType: null,
hiddenDangerLabel: null, hiddenDangerLabel: null,
hiddenDangerLabelArray:null, hiddenDangerLabelArray:null,
isTowns:null,
overTime:null
}, },
alertState: [{
value: '7',
label: '7天预警'
}, {
value: '3',
label: '3天预警'
}, {
value: '0',
label: '逾期告警'
}],
// //
form: {}, form: {},
formAssist:{}, formAssist:{},
// //
rules: { rules: {
enterpriseName: [ { type: 'string',required: true,message: "隐患所在单位必填", trigger: 'blur'}], enterpriseName: [ { type: 'string',required: true,message: "单位名称必填", trigger: 'blur'}],
enterpriseType: [ { type: 'string',required: true,message: "行业必须选择", trigger: 'blur'}], enterpriseType: [ { type: 'string',required: true,message: "行业必须选择", trigger: 'blur'}],
enterpriseStatus: [ { type: 'string',required: true,message: "企业现状必须选择", trigger: 'blur'}], enterpriseStatus: [ { type: 'string',required: true,message: "企业现状必须选择", trigger: 'blur'}],
hiddenDangerDesc: [ { type: 'string',required: true,message: "隐患情况必填", trigger: 'blur'}], hiddenDangerDesc: [ { type: 'string',required: true,message: "隐患情况必填", trigger: 'blur'}],
checkTime: [ { required: true,message: "排查时间必填", trigger: 'blur'}], checkTime: [ { required: true,message: "排查时间必填", trigger: 'blur'}],
rectifyTermTime: [ { required: true,message: "整改期限必填", trigger: 'blur'}], rectifyTermTime: [ { required: true,message: "整改期限必填", trigger: 'blur'}],
checkType: [ { required: true,message: "排查方式必须选择", trigger: 'blur'}],
/* isTowns: [ { required: true,message: "是否乡镇(街道必须选择", trigger: 'blur'}],*/
status: [ { required: true,message: "整改进度必须选择", trigger: 'blur'}],
/*rectifyMeasure: [ { type: 'string',required: true,message: "", trigger: 'blur'}], /*rectifyMeasure: [ { type: 'string',required: true,message: "", trigger: 'blur'}],
rectifyTime: [ { type: 'date',required: true,message: "整改时间必填", trigger: 'blur'}], rectifyTime: [ { type: 'date',required: true,message: "整改时间必填", trigger: 'blur'}],
hiddenDangerGrade: [ { type: 'string',required: true,message: "隐患级别必填", trigger: 'blur'}], hiddenDangerGrade: [ { type: 'string',required: true,message: "隐患级别必填", trigger: 'blur'}],
@ -644,12 +783,12 @@ export default {
areaId: [ areaId: [
{ required: true, message: "不能为空", trigger: "change" } { required: true, message: "不能为空", trigger: "change" }
], ],
economicType: [ /* economicType: [
{ required: true, message: "不能为空", trigger: "change" } { required: true, message: "不能为空", trigger: "change" }
], ],*/
enterpriseScale: [ /* enterpriseScale: [
{ required: true, message: "不能为空", trigger: "change" } { required: true, message: "不能为空", trigger: "change" }
], ],*/
}, },
pickerOptions: { pickerOptions: {
shortcuts: [{ shortcuts: [{
@ -744,6 +883,8 @@ export default {
areaId:null, areaId:null,
economicType:null, economicType:null,
enterpriseScale:null, enterpriseScale:null,
isTowns:null,
}; };
this.resetForm("form"); this.resetForm("form");
}, },
@ -769,11 +910,13 @@ export default {
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.open = true; this.open = true;
this.isReadOnly = false;
this.title = "添加隐患信息"; this.title = "添加隐患信息";
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row,isReadOnly) {
this.reset(); this.reset();
this.isReadOnly = isReadOnly;
const hiddenDangerId = row.hiddenDangerId || this.ids const hiddenDangerId = row.hiddenDangerId || this.ids
getEhsHiddenDanger(hiddenDangerId).then(response => { getEhsHiddenDanger(hiddenDangerId).then(response => {
this.form = response.data; this.form = response.data;
@ -784,6 +927,7 @@ export default {
this.title = "修改隐患信息"; this.title = "修改隐患信息";
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
@ -810,7 +954,7 @@ export default {
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const hiddenDangerIds = row.hiddenDangerId || this.ids; const hiddenDangerIds = row.hiddenDangerId || this.ids;
this.$modal.confirm('是否确认删除隐患信息编号为"' + hiddenDangerIds + '"的数据项?').then(function() { this.$modal.confirm('是否确认删除选中的隐患的数据项?').then(function() {
return delEhsHiddenDanger(hiddenDangerIds); return delEhsHiddenDanger(hiddenDangerIds);
}).then(() => { }).then(() => {
this.getList(); this.getList();
@ -821,7 +965,7 @@ export default {
handleExport() { handleExport() {
this.download('ehsHiddenDanger/ehsHiddenDanger/export', { this.download('ehsHiddenDanger/ehsHiddenDanger/export', {
...this.queryParams ...this.queryParams
}, `ehsHiddenDanger_${new Date().getTime()}.xlsx`) }, `风险信息_${new Date().getTime()}.xls`)
}, },
openEnterprise() { openEnterprise() {
@ -911,13 +1055,50 @@ export default {
this.$alert(row.superviseResult, '督办反馈', { this.$alert(row.superviseResult, '督办反馈', {
confirmButtonText: '确定', confirmButtonText: '确定',
callback: action => { callback: action => {
this.$message({ /*this.$message({
type: 'info', type: 'info',
message: `action: ${ action }` message: `action: ${ action }`
}); });*/
} }
}); });
}, },
/** 批量导入 */
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 + "/ehsHiddenDanger/ehsHiddenDanger/importData";
},
/** 导入成功 */
upLoadOk() {
// console.log("")
this.getList();
},
tableRowClassName({row, rowIndex}) {
if(row.status==0 ||status==5){
if (row.overTime <0 ) {
return 'warning-row';
} else if (row.overTime > 3 && row.overTime <= 7) {
return 'warning7-row';
} else if (row.overTime > 0 && rowIndex <= 3) {
return 'warning3-row';
}
}
return '';
},
} }
}; };
</script> </script>
<style>
.el-table .warning-row {
background: #f97762;
}
.el-table .warning7-row {
background: #57a6f9;
}
.el-table .warning3-row {
background: #f9c43d;
}
</style>

@ -12,10 +12,10 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="隐患所在单位" prop="enterpriseName"> <el-form-item label="单位名称" prop="enterpriseName">
<el-input <el-input
v-model="queryParams.enterpriseName" v-model="queryParams.enterpriseName"
placeholder="请输入隐患所在单位" placeholder="请输入单位名称"
clearable clearable
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
@ -122,7 +122,7 @@
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="主键" align="center" prop="hiddenDangerId" />--> <!-- <el-table-column label="主键" align="center" prop="hiddenDangerId" />-->
<el-table-column label="上报部门" align="center" prop="deptName" v-if="deptShow"/> <el-table-column label="上报部门" align="center" prop="deptName" v-if="deptShow"/>
<el-table-column label="隐患所在单位" align="center" prop="enterpriseName" /> <el-table-column label="单位名称" align="center" prop="enterpriseName" />
<el-table-column label="企业现状" align="center" prop="enterpriseStatus"> <el-table-column label="企业现状" align="center" prop="enterpriseStatus">
<template slot-scope="scope"> <template slot-scope="scope">
<span> {{ (scope.row.enterpriseStatus !=null && scope.row.enterpriseStatus != "") ? statusOptions[scope.row.enterpriseStatus].label:""}}</span> <span> {{ (scope.row.enterpriseStatus !=null && scope.row.enterpriseStatus != "") ? statusOptions[scope.row.enterpriseStatus].label:""}}</span>
@ -500,10 +500,10 @@ export default {
this.$alert(row.superviseResult, '督办反馈', { this.$alert(row.superviseResult, '督办反馈', {
confirmButtonText: '确定', confirmButtonText: '确定',
callback: action => { callback: action => {
this.$message({ /*this.$message({
type: 'info', type: 'info',
message: `action: ${ action }` message: `action: ${ action }`
}); });*/
} }
}); });
}, },

@ -41,7 +41,7 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="是否重大隐患" prop="isLargeRisk"> <el-form-item label="是否重大隐患" prop="isLargeRisk" label-width="100px">
<el-select v-model="queryParams.isLargeRisk" placeholder="请选择是否重大隐患" clearable> <el-select v-model="queryParams.isLargeRisk" placeholder="请选择是否重大隐患" clearable>
<el-option <el-option
v-for="dict in dict.type.sys_yes_no" v-for="dict in dict.type.sys_yes_no"
@ -59,7 +59,7 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item>--> </el-form-item>-->
<el-form-item label="整改责任人" prop="rectificationPeople"> <el-form-item label="整改责任人" prop="rectificationPeople" label-width="89px">
<el-input <el-input
v-model="queryParams.rectificationPeople" v-model="queryParams.rectificationPeople"
placeholder="请输入整改责任人" placeholder="请输入整改责任人"
@ -77,7 +77,7 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="是否建立双预防" prop="isEstablishPrevention"> <el-form-item label="是否建立双预防" prop="isEstablishPrevention" label-width="110px">
<el-select v-model="queryParams.isEstablishPrevention" placeholder="请选择是否建立双预防" clearable> <el-select v-model="queryParams.isEstablishPrevention" placeholder="请选择是否建立双预防" clearable>
<el-option <el-option
v-for="dict in dict.type.sys_yes_no" v-for="dict in dict.type.sys_yes_no"

@ -141,6 +141,16 @@
v-hasPermi="['ehsMaterial:ehsMaterial:export']" v-hasPermi="['ehsMaterial:ehsMaterial:export']"
>导出</el-button> >导出</el-button>
</el-col> </el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-upload2"
size="mini"
@click="handleImport"
v-hasPermi="['ehsRisk:ehsRisk:import']"
>导入</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
@ -170,6 +180,7 @@
<el-table-column label="储备地点" align="center" prop="reserveLocation" /> <el-table-column label="储备地点" align="center" prop="reserveLocation" />
<el-table-column label="管理责任人" align="center" prop="managerPerson" /> <el-table-column label="管理责任人" align="center" prop="managerPerson" />
<el-table-column label="联系电话" align="center" prop="tel" /> <el-table-column label="联系电话" align="center" prop="tel" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="更新时间" align="center" prop="updateTime" > <el-table-column label="更新时间" align="center" prop="updateTime" >
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
@ -353,6 +364,13 @@
:total="totalDetail"> :total="totalDetail">
</el-pagination>--> </el-pagination>-->
</el-dialog> </el-dialog>
<!-- 导入 -->
<importUpload
ref="uploadRef"
@ok="upLoadOk"
downUrl="/ehsMaterial/ehsMaterial/importTemplate"
temName="物资信息导入模板"
></importUpload>
</div> </div>
</template> </template>
@ -360,7 +378,9 @@
import { listEhsMaterial, getEhsMaterial, delEhsMaterial, addEhsMaterial, updateEhsMaterial } from "@/api/ehs/ehsMaterial"; import { listEhsMaterial, getEhsMaterial, delEhsMaterial, addEhsMaterial, updateEhsMaterial } from "@/api/ehs/ehsMaterial";
import {listAllDept } from "@/api/system/dept"; import {listAllDept } from "@/api/system/dept";
import {addEhsMaterialDetail,listEhsMaterialDetail, updateEhsMaterialDetail , delEhsMaterialDetail} from "@/api/ehs/EhsMaterialDetail"; import {addEhsMaterialDetail,listEhsMaterialDetail, updateEhsMaterialDetail , delEhsMaterialDetail} from "@/api/ehs/EhsMaterialDetail";
import { getDicts } from "@/api/system/dict/data"; import { getMaterialClassJson } from "@/api/ehs/materialClassMaster";
import importUpload from "@/components/upload/upload";
/* import { getDicts } from "@/api/system/dict/data";
import material1 from '../../../assets/materialClass.json'; import material1 from '../../../assets/materialClass.json';
import material2 from '../../../assets/materialClass2.json'; import material2 from '../../../assets/materialClass2.json';
import material3 from '../../../assets/materialClass3.json'; import material3 from '../../../assets/materialClass3.json';
@ -368,17 +388,17 @@
import material5 from '../../../assets/materialClass5.json'; import material5 from '../../../assets/materialClass5.json';
import material6 from '../../../assets/materialClass6.json'; import material6 from '../../../assets/materialClass6.json';
import material7 from '../../../assets/materialClass7.json'; import material7 from '../../../assets/materialClass7.json';
import material8 from '../../../assets/materialClass8.json'; import material8 from '../../../assets/materialClass8.json';*/
export default { export default {
name: "EhsMaterial", name: "EhsMaterial",
// dicts: ['material_class_1','material_class_2','material_class_3','material_class_4'], // dicts: ['material_class_1','material_class_2','material_class_3','material_class_4'],
components: {
importUpload,
},
data() { data() {
return { return {
options:[],
//curDict:[],
options:material1,
curDict:[],
// //
loading: true, loading: true,
// //
@ -471,11 +491,12 @@
created() { created() {
this.getList(); this.getList();
this.materialClass = this.$route.query.classFirst; this.materialClass = this.$route.query.classFirst;
this.getDictList(); //this.getDictList();
this.getListAllDept(); this.getListAllDept();
this.deptShow = this.$store.state.user.parentId==0 ?true :false; this.deptShow = this.$store.state.user.parentId==0 ?true :false;
console.log(this.curDict); //console.log(this.curDict);
if (this.materialClass == 1){ this.getMaterialClassJson(this.materialClass);
/*if (this.materialClass == 1){
this.options = material1; this.options = material1;
}else if (this.materialClass == 2){ }else if (this.materialClass == 2){
this.options = material2; this.options = material2;
@ -491,10 +512,16 @@
this.options = material7; this.options = material7;
}else if (this.materialClass == 8){ }else if (this.materialClass == 8){
this.options = material8; this.options = material8;
} }*/
}, },
methods: { methods: {
async getMaterialClassJson(id) {
this.loading = true;
const data = await getMaterialClassJson(id) ;
this.options=data;
console.log(data);
},
/** 查询物资信息包含 通用应急救援装备”“防汛抗旱应急救援装备”“森林防灭火应急救援装备”“救灾物资”列表 */ /** 查询物资信息包含 通用应急救援装备”“防汛抗旱应急救援装备”“森林防灭火应急救援装备”“救灾物资”列表 */
getList() { getList() {
this.loading = true; this.loading = true;
@ -513,7 +540,7 @@
this.loading = false; this.loading = false;
}); });
}, },
getDictList() { /*getDictList() {
this.loading = true; this.loading = true;
let str = ""; let str = "";
if(this.materialClass ==1) if(this.materialClass ==1)
@ -535,7 +562,7 @@
} }
this.loading = false; this.loading = false;
}); });
}, },*/
// //
cancel() { cancel() {
this.open = false; this.open = false;
@ -752,6 +779,19 @@
console.log(str); console.log(str);
return str; return str;
}, },
/** 批量导入 */
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 + "/ehsMaterial/ehsMaterial/importData/"+this.materialClass;
},
/** 导入成功 */
upLoadOk() {
// console.log("")
this.getList();
},
} }
}; };
</script> </script>

@ -139,12 +139,12 @@
</el-table-column> </el-table-column>
<el-table-column label="类别" align="center" prop="classSecond"> <el-table-column label="类别" align="center" prop="classSecond">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{classToStr(scope.row.classSecond,1)}}</span> <span>{{classToStr(scope.row.classSecond,1,scope.row.classFirst)}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="物资名称" align="center" prop="materialName" > <el-table-column label="物资名称" align="center" prop="materialName" >
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{classToStr(scope.row.materialName,2)}}</span> <span>{{classToStr(scope.row.materialName,2,scope.row.classFirst)}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="规格/参数" align="center" prop="materialSpecs" /> <el-table-column label="规格/参数" align="center" prop="materialSpecs" />
@ -221,22 +221,23 @@
<script> <script>
import { listEhsMaterial, getEhsMaterial, delEhsMaterial, addEhsMaterial, updateEhsMaterial } from "@/api/ehs/ehsMaterial"; import { listEhsMaterial, getEhsMaterial, delEhsMaterial, addEhsMaterial, updateEhsMaterial } from "@/api/ehs/ehsMaterial";
import { getMaterialClassJson,setMaterialClassJson } from "@/api/ehs/materialClassMaster";
import {listAllDept } from "@/api/system/dept"; import {listAllDept } from "@/api/system/dept";
import {addEhsMaterialDetail,listEhsMaterialDetail, updateEhsMaterialDetail , delEhsMaterialDetail} from "@/api/ehs/EhsMaterialDetail"; import {addEhsMaterialDetail,listEhsMaterialDetail, updateEhsMaterialDetail , delEhsMaterialDetail} from "@/api/ehs/EhsMaterialDetail";
import material1 from '../../../assets/materialClass.json'; /*import material1 from '../../../assets/materialClass.json';
import material2 from '../../../assets/materialClass2.json'; import material2 from '../../../assets/materialClass2.json';
import material3 from '../../../assets/materialClass3.json'; import material3 from '../../../assets/materialClass3.json';
import material4 from '../../../assets/materialClass4.json'; import material4 from '../../../assets/materialClass4.json';
import material5 from '../../../assets/materialClass5.json'; import material5 from '../../../assets/materialClass5.json';
import material6 from '../../../assets/materialClass6.json'; import material6 from '../../../assets/materialClass6.json';
import material7 from '../../../assets/materialClass7.json'; import material7 from '../../../assets/materialClass7.json';
import material8 from '../../../assets/materialClass8.json'; import material8 from '../../../assets/materialClass8.json';*/
export default { export default {
name: "EhsMaterial", name: "EhsMaterial",
dicts: ['material_class_fast' ], dicts: ['material_class_fast' ],
data() { data() {
return { return {
options:material1, options:[],
curDict:[], curDict:[],
// //
loading: true, loading: true,
@ -273,6 +274,8 @@
// //
allDeptList: [], allDeptList: [],
sendQuantity:"",// sendQuantity:"",//
materialJson:new Array(8) ,
materialTypeOptions: [{ materialTypeOptions: [{
value: 1, value: 1,
label: '自储', label: '自储',
@ -303,7 +306,8 @@
this.materialClass = this.$route.query.classFirst; this.materialClass = this.$route.query.classFirst;
this.getListAllDept(); this.getListAllDept();
this.deptShow = this.$store.state.user.parentId==0 ?true :false; this.deptShow = this.$store.state.user.parentId==0 ?true :false;
this.getMaterialClassJson();
//this.setMaterialClassJson();
}, },
methods: { methods: {
@ -316,6 +320,33 @@
this.loading = false; this.loading = false;
}); });
}, },
async getMaterialClassJson() {
this.loading = true;
for(let i=1;i<=8;i++){
const data = await getMaterialClassJson(i) ;
this.materialJson[i-1] = data ;
}
this.options=this.materialJson[0];
console.log(this.materialJson);
},
setMaterialClassJson() {
this.loading = true;
let jsonStr =encodeURIComponent(JSON.stringify(material5));
let para = {};
para.id=1;
//para.classNameMast=jsonStr;
setMaterialClassJson(para).then(response => {
let s = response;
console.log(response);
});
/*for(let i=1;i<=8;i++){
setMaterialClassJson(i).then(response => {
this.materialJson.push(response);
});
}*/
console.log(this.materialJson);
},
/** 单位信息列表 */ /** 单位信息列表 */
getListAllDept() { getListAllDept() {
console.log(this.$store.state.user.deptId); console.log(this.$store.state.user.deptId);
@ -519,16 +550,34 @@
this.queryParams.classSecond = value[0] ; this.queryParams.classSecond = value[0] ;
} }
}, },
classToStr(value,type) { classToStr(value,type,classFirst) {
let str =""; let str ="";
let opt = this.materialJson[classFirst-1];
/* if (classFirst == 1){
opt = material1;
}else if (classFirst == 2){
opt = material2;
}else if (classFirst == 3){
opt = material3;
}else if (classFirst == 4){
opt = material4;
}else if (classFirst == 5){
opt = material5;
}else if (classFirst == 6){
opt = material6;
}else if (classFirst == 7){
opt = material7;
}else if (classFirst == 8){
opt = material8;
}*/
if(type==1){ if(type==1){
this.options.forEach(item =>{ opt.forEach(item =>{
if(item.value==value){ if(item.value==value){
str = item.label; str = item.label;
} }
}) })
}else{ }else{
this.options.forEach(item =>{ opt.forEach(item =>{
let v = value.split("-"); let v = value.split("-");
if(item.value==v[0]){ if(item.value==v[0]){
item.children.forEach(it =>{ item.children.forEach(it =>{
@ -539,11 +588,12 @@
} }
}) })
} }
console.log(str); //console.log(str);
return str; return str;
}, },
classFirstChange(value){ classFirstChange(value){
if (value == 1){ this.options = this.materialJson[value-1];
/*if (value == 1){
this.options = material1; this.options = material1;
}else if (value == 2){ }else if (value == 2){
this.options = material2; this.options = material2;
@ -559,7 +609,7 @@
this.options = material7; this.options = material7;
}else if (value == 8){ }else if (value == 8){
this.options = material8; this.options = material8;
} }*/
} }
} }

@ -77,9 +77,12 @@
<el-table-column label="标题" align="center" prop="title" /> <el-table-column label="标题" align="center" prop="title" />
<el-table-column label="任务模板" align="center" prop="fileTempOriginalName" v-if ="taskShow" > <el-table-column label="任务模板" align="center" prop="fileTempOriginalName" v-if ="taskShow" >
<template slot-scope="scope"> <template slot-scope="scope">
<div v-if="scope.row.fileTempName!=null && scope.row.fileTempName!='' ">
<span v-for="(item, index) in scope.row.fileTempName.split(',')" :key="index" > <span v-for="(item, index) in scope.row.fileTempName.split(',')" :key="index" >
<el-link type="primary" @click="downloadFile(scope.row,index)" > {{(scope.row.fileTempOriginalName=='' ||scope.row.fileTempOriginalName==null)?"": scope.row.fileTempOriginalName.split(",")[index] }} </el-link> <el-link type="primary" @click="downloadFile(scope.row,index)" > {{(scope.row.fileTempOriginalName=='' ||scope.row.fileTempOriginalName==null)?"": scope.row.fileTempOriginalName.split(",")[index] }} </el-link>
</span> </span>
</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="提交状态" align="center" prop="status" > <el-table-column label="提交状态" align="center" prop="status" >

@ -1,7 +1,7 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="创建者部门" prop="deptId" v-show="deptShow"> <el-form-item label="创建者部门" prop="deptId" v-show="deptShow" label-width="88px">
<el-select v-model="queryParams.deptId" filterable placeholder="请选择部门" clearable> <el-select v-model="queryParams.deptId" filterable placeholder="请选择部门" clearable>
<el-option <el-option
v-for="dict in allDeptList" v-for="dict in allDeptList"

@ -198,12 +198,12 @@
/> />
<!-- 添加或修改应急救援队人员信息对话框 --> <!-- 添加或修改应急救援队人员信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="550px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="100px">
<!-- <el-form-item label="应急救援队伍id" prop="rescueTeamId"> <!-- <el-form-item label="应急救援队伍id" prop="rescueTeamId">
<el-input v-model="form.rescueTeamId" placeholder="请输入应急救援队伍id" /> <el-input v-model="form.rescueTeamId" placeholder="请输入应急救援队伍id" />
</el-form-item>--> </el-form-item>-->
<el-form-item label="队伍名称" prop="rescueTeamName"> <el-form-item label="所属队伍名称" prop="rescueTeamName">
<el-input v-model="form.rescueTeamName" :readonly="true" placeholder="请输入应急救援队伍名称" /> <el-input v-model="form.rescueTeamName" :readonly="true" placeholder="请输入应急救援队伍名称" />
</el-form-item> </el-form-item>

@ -1,6 +1,6 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="89px">
<el-form-item label="登记部门" prop="deptId" v-show="deptShow"> <el-form-item label="登记部门" prop="deptId" v-show="deptShow">
<el-select v-model="queryParams.deptId" filterable placeholder="请选择部门" clearable> <el-select v-model="queryParams.deptId" filterable placeholder="请选择部门" clearable>
<el-option <el-option
@ -224,12 +224,23 @@
v-hasPermi="['ehsRisk:ehsRisk:export']" v-hasPermi="['ehsRisk:ehsRisk:export']"
>导出</el-button> >导出</el-button>
</el-col> </el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-upload2"
size="mini"
@click="handleImport"
v-hasPermi="['ehsRisk:ehsRisk:import']"
>导入</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="ehsRiskList" @selection-change="handleSelectionChange" max-height="550" style="width: 100%"> <el-table v-loading="loading" :data="ehsRiskList" @selection-change="handleSelectionChange" max-height="550" style="width: 100%">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="" align="center" prop="riskId" />--> <!-- <el-table-column label="" align="center" prop="riskId" />-->
<el-table-column label="上报部门" align="center" prop="deptName" v-if="this.$store.state.user.parentId==0"/>
<el-table-column label="风险点等级" align="center" prop="riskGrade"> <el-table-column label="风险点等级" align="center" prop="riskGrade">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.risk_grade" :value="scope.row.riskGrade"/> <dict-tag :options="dict.type.risk_grade" :value="scope.row.riskGrade"/>
@ -436,11 +447,6 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" /> <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item> </el-form-item>
@ -450,15 +456,26 @@
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<!-- 导入 -->
<importUpload
ref="uploadRef"
@ok="upLoadOk"
downUrl="/ehsRisk/ehsRisk/importTemplate"
temName="风险信息导入模板"
></importUpload>
</div> </div>
</template> </template>
<script> <script>
import { listEhsRisk, getEhsRisk, delEhsRisk, addEhsRisk, updateEhsRisk } from "@/api/ehs/ehsRisk"; import { listEhsRisk, getEhsRisk, delEhsRisk, addEhsRisk, updateEhsRisk } from "@/api/ehs/ehsRisk";
import {listAllDept } from "@/api/system/dept"; import {listAllDept } from "@/api/system/dept";
import importUpload from "@/components/upload/upload";
export default { export default {
name: "EhsRisk", name: "EhsRisk",
dicts: ['risk_grade', 'risk_report_address_type'], dicts: ['risk_grade', 'risk_report_address_type'],
components: {
importUpload,
},
data() { data() {
return { return {
// //
@ -696,7 +713,7 @@
handleExport() { handleExport() {
this.download('ehsRisk/ehsRisk/export', { this.download('ehsRisk/ehsRisk/export', {
...this.queryParams ...this.queryParams
}, `ehsRisk_${new Date().getTime()}.xlsx`) }, `风险信息_${new Date().getTime()}.xlsx`)
}, },
toStr(v,t) { toStr(v,t) {
if(v!=null){ if(v!=null){
@ -711,8 +728,19 @@
return v; return v;
}else }else
return "" return ""
},
/** 批量导入 */
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 + "/ehsRisk/ehsRisk/importData";
},
/** 导入成功 */
upLoadOk() {
// console.log("")
this.getList();
}, },
} }
}; };

@ -0,0 +1,398 @@
<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="classMastId">
<el-input
v-model="queryParams.classMastId"
placeholder="请输入分类编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<el-form-item label="基本分类" prop="classMastType">
<el-select v-model="queryParams.classMastType" placeholder="请选择基本分类" clearable>
<el-option
v-for="dict in dict.type.material_class_fast"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<!--<el-form-item label="分类名称" prop="classNameMast">
<el-input
v-model="queryParams.classNameMast"
placeholder="请输入分类名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="创建者部门" prop="deptId">
<el-input
v-model="queryParams.deptId"
placeholder="请输入创建者部门"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="创建者id" prop="createUserId">
<el-input
v-model="queryParams.createUserId"
placeholder="请输入创建者id"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="修改着id" prop="updateUserId">
<el-input
v-model="queryParams.updateUserId"
placeholder="请输入修改着id"
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="['materialClass:materialClassMaster: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="['materialClass:materialClassMaster: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="['materialClass:materialClassMaster: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="['materialClass:materialClassMaster:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="materialClassList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="基本分类" align="center" prop="classMastType">
<template slot-scope="scope">
<dict-tag :options="dict.type.material_class_fast" :value="scope.row.classMastType"/>
</template>
</el-table-column>
<el-table-column label="分类编号" align="center" prop="classMastId" />
<!--<el-table-column label="主键" align="center" prop="id" />-->
<el-table-column label="分类名称" align="center" prop="classNameMast" />
<el-table-column label="子分类数量" align="center" prop="classCount" />
<!--<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="创建者部门" align="center" prop="deptId" />-->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['materialClass:materialClassMaster:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['materialClass:materialClassMaster: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="600px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row>
<el-col :span="12">
<el-form-item label="基本大类" prop="classMastType" >
<el-select v-model="form.classMastType" placeholder="请选择基本大类" :disabled="true">
<el-option
v-for="dict in dict.type.material_class_fast"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="分类编号" prop="classMastId">
<el-input v-model="form.classMastId" placeholder="请输入分类编号" />
</el-form-item>
</el-col>
</el-row>
<el-form-item label="分类名称" prop="classNameMast">
<el-input v-model="form.classNameMast" placeholder="请输入分类名称" />
</el-form-item>
<!-- <el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>-->
<el-divider content-position="center">二级分类信息</el-divider>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddMaterialClassSub"></el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteMaterialClassSub"></el-button>
</el-col>
</el-row>
<el-table :data="materialClassSubList" :row-class-name="rowMaterialClassSubIndex" @selection-change="handleMaterialClassSubSelectionChange" ref="materialClassSub">
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="序号" align="center" prop="index" width="50"/>
<el-table-column label="分类编号" prop="classNameSub" width="180">
<template slot-scope="scope">
<el-input v-model="scope.row.classSubId" placeholder="请输入二级分类编号" />
</template>
</el-table-column>
<el-table-column label="分类名称" prop="classNameSub" width="220">
<template slot-scope="scope">
<el-input v-model="scope.row.classNameSub" placeholder="请输入二级分类名称" />
</template>
</el-table-column>
</el-table>
</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>
</div>
</template>
<script>
import { listMaterialClass, getMaterialClass, delMaterialClass, addMaterialClass, updateMaterialClass } from "@/api/ehs/materialClassMaster";
export default {
name: "MaterialClass",
dicts: ['material_class_fast'],
data() {
return {
//
loading: true,
//
ids: [],
//
checkedMaterialClassSub: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
materialClassList: [],
// -
materialClassSubList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
classMastId: null,
classMastType: null,
classNameMast: null,
deptId: null,
createUserId: null,
updateUserId: null
},
//
form: {},
//
rules: {
classMastId: [
{ required: true, message: "分类编号不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询物资分类一级分类列表 */
getList() {
this.loading = true;
listMaterialClass(this.queryParams).then(response => {
this.materialClassList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
classMastId: null,
id: null,
classMastType: null,
classNameMast: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null,
deptId: null,
createUserId: null,
updateUserId: null
};
this.materialClassSubList = [];
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 classMastId = row.id || this.ids
getMaterialClass(classMastId).then(response => {
this.form = response.data;
this.materialClassSubList = response.data.materialClassSubList;
this.open = true;
this.title = "修改物资分类一级分类";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
this.form.materialClassSubList = this.materialClassSubList;
if (this.form.id != null) {
updateMaterialClass(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addMaterialClass(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const classMastIds = row.id || this.ids;
this.$modal.confirm('是否确认删除物资分类一级分类编号为"' + classMastIds + '"的数据项?').then(function() {
return delMaterialClass(classMastIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 物资分类-二级分类序号 */
rowMaterialClassSubIndex({ row, rowIndex }) {
row.index = rowIndex + 1;
},
/** 物资分类-二级分类添加按钮操作 */
handleAddMaterialClassSub() {
let obj = {};
obj.classMastId = "";
obj.classNameSub = "";
obj.remark = "";
obj.deptId = "";
this.materialClassSubList.push(obj);
},
/** 物资分类-二级分类删除按钮操作 */
handleDeleteMaterialClassSub() {
if (this.checkedMaterialClassSub.length == 0) {
this.$modal.msgError("请先选择要删除的物资分类-二级分类数据");
} else {
const materialClassSubList = this.materialClassSubList;
const checkedMaterialClassSub = this.checkedMaterialClassSub;
this.materialClassSubList = materialClassSubList.filter(function(item) {
return checkedMaterialClassSub.indexOf(item.index) == -1
});
}
},
/** 复选框选中数据 */
handleMaterialClassSubSelectionChange(selection) {
this.checkedMaterialClassSub = selection.map(item => item.index)
},
/** 导出按钮操作 */
handleExport() {
this.download('materialClass/materialClass/export', {
...this.queryParams
}, `materialClass_${new Date().getTime()}.xlsx`)
}
}
};
</script>

@ -0,0 +1,259 @@
<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="classMastId">
<el-input
v-model="queryParams.classMastId"
placeholder="请输入上级分类主键"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="二级分类名称" prop="classNameSub">
<el-input
v-model="queryParams.classNameSub"
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="['materialClass:materialClass: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="['materialClass:materialClass: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="['materialClass:materialClass: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="['materialClass:materialClass:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="materialClassList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="二级分类主键" align="center" prop="classSubId" />
<el-table-column label="上级分类主键" align="center" prop="classMastId" />
<el-table-column label="二级分类名称" align="center" prop="classNameSub" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['materialClass:materialClass:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['materialClass:materialClass: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="classMastId">
<el-input v-model="form.classMastId" placeholder="请输入上级分类主键" />
</el-form-item>
<el-form-item label="二级分类名称" prop="classNameSub">
<el-input v-model="form.classNameSub" 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>
</div>
</template>
<script>
import { listMaterialClass, getMaterialClass, delMaterialClass, addMaterialClass, updateMaterialClass } from "@/api/ehs/materialClassSub";
export default {
name: "MaterialClass",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
// -
materialClassList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
classMastId: null,
classNameSub: null
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询物资分类-二级分类列表 */
getList() {
this.loading = true;
listMaterialClass(this.queryParams).then(response => {
this.materialClassList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
classSubId: null,
classMastId: null,
classNameSub: 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.classSubId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加物资分类-二级分类";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const classSubId = row.classSubId || this.ids
getMaterialClass(classSubId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改物资分类-二级分类";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.classSubId != null) {
updateMaterialClass(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addMaterialClass(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const classSubIds = row.classSubId || this.ids;
this.$modal.confirm('是否确认删除物资分类-二级分类编号为"' + classSubIds + '"的数据项?').then(function() {
return delMaterialClass(classSubIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('materialClass/materialClass/export', {
...this.queryParams
}, `materialClass_${new Date().getTime()}.xlsx`)
}
}
};
</script>

@ -257,6 +257,12 @@
}, },
created() { created() {
this.getIndexDetails(); this.getIndexDetails();
this.$alert('这是一段内容', '标题名称', {
confirmButtonText: '确定',
callback: action => {
//this.$router.push({ path: "ehs/ehsHiddenDanger/index" });
}
});
}, },
methods: { methods: {
parseTime, parseTime,

@ -5,8 +5,8 @@
<div class="leftBox"> <div class="leftBox">
<img src="../assets/images/logo2.png" alt=""> <img src="../assets/images/logo2.png" alt="">
<span> <span>
<p class="pChina">中华人民共和国应急管理部</p> <p class="pChina">唐河县应急管理平台</p>
<p class="pEnglish">Ministry of Emergency Management of the People's Republic of China</p> <!--<p class="pEnglish">Ministry of Emergency Management of the People's Republic of China</p>-->
</span> </span>
<span class="slogan"> <span class="slogan">
<p>对党忠诚 纪律严明</p> <p>对党忠诚 纪律严明</p>
@ -24,7 +24,7 @@
</div> </div>
<div class="login"> <div class="login">
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form"> <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
<h3 class="title">唐河县安全隐患及应急救援管理平台</h3> <h3 class="title">唐河县应急管理平台</h3>
<el-form-item prop="username"> <el-form-item prop="username">
<el-input <el-input
v-model="loginForm.username" v-model="loginForm.username"

@ -435,6 +435,9 @@ export default {
{ required: true, message: "用户密码不能为空", trigger: "blur" }, { required: true, message: "用户密码不能为空", trigger: "blur" },
{ min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' } { min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' }
], ],
deptId: [
{ required: true, message: "部门不能为空", trigger: "blur" }
],
email: [ email: [
{ {
type: "email", type: "email",
@ -447,7 +450,8 @@ export default {
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
message: "请输入正确的手机号码", message: "请输入正确的手机号码",
trigger: "blur" trigger: "blur"
} },
{ required: true, message: "手机号不能为空", trigger: "blur" }
] ]
} }
}; };

Loading…
Cancel
Save