feat(example): 新增设备巡检配置功能模块
This commit is contained in:
parent
42bc27f076
commit
ee2e1af6f5
@ -0,0 +1,7 @@
|
|||||||
|
package jnpf.mapper;
|
||||||
|
|
||||||
|
import jnpf.model.eqpatrol.EqPatrolConfigItemEntity;
|
||||||
|
|
||||||
|
public interface EqPatrolConfigItemMapper extends com.baomidou.mybatisplus.core.mapper.BaseMapper<EqPatrolConfigItemEntity> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
package jnpf.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import jnpf.model.eqpatrol.EqPatrolConfigEntity;
|
||||||
|
|
||||||
|
public interface EqPatrolConfigMapper extends BaseMapper<EqPatrolConfigEntity> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
package jnpf.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import jnpf.model.eqpatrol.EqPatrolConfigItemEntity;
|
||||||
|
|
||||||
|
public interface EqPatrolConfigItemService extends IService<EqPatrolConfigItemEntity> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
package jnpf.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import jnpf.model.eqpatrol.EqPatrolConfigEntity;
|
||||||
|
import jnpf.model.eqpatrol.EqPatrolConfigForm;
|
||||||
|
import jnpf.model.eqpatrol.EqPatrolConfigPagination;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface EqPatrolConfigService extends IService<EqPatrolConfigEntity> {
|
||||||
|
|
||||||
|
List<EqPatrolConfigEntity> getList(EqPatrolConfigPagination pagination);
|
||||||
|
|
||||||
|
EqPatrolConfigEntity getInfo(Integer id);
|
||||||
|
|
||||||
|
void create(EqPatrolConfigEntity entity);
|
||||||
|
|
||||||
|
boolean update(Integer id, EqPatrolConfigEntity entity);
|
||||||
|
|
||||||
|
void delete(EqPatrolConfigEntity entity);
|
||||||
|
|
||||||
|
String checkForm(EqPatrolConfigForm form, int i);
|
||||||
|
|
||||||
|
void saveOrUpdate(EqPatrolConfigForm form, Integer id, boolean isSave) throws Exception;
|
||||||
|
}
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
package jnpf.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import jnpf.mapper.EqPatrolConfigItemMapper;
|
||||||
|
import jnpf.model.eqpatrol.EqPatrolConfigItemEntity;
|
||||||
|
import jnpf.service.EqPatrolConfigItemService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class EqPatrolConfigItemServiceImpl extends ServiceImpl<EqPatrolConfigItemMapper, EqPatrolConfigItemEntity> implements EqPatrolConfigItemService {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,147 @@
|
|||||||
|
package jnpf.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import jnpf.service.EqPatrolConfigItemService;
|
||||||
|
import jnpf.mapper.EqPatrolConfigMapper;
|
||||||
|
import jnpf.model.eqpatrol.*;
|
||||||
|
import jnpf.service.EqPatrolConfigService;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class EqPatrolConfigServiceImpl extends ServiceImpl<EqPatrolConfigMapper, EqPatrolConfigEntity> implements EqPatrolConfigService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EqPatrolConfigItemService eqPatrolConfigItemService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EqPatrolConfigEntity> getList(EqPatrolConfigPagination pagination) {
|
||||||
|
LambdaQueryWrapper<EqPatrolConfigEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
|
||||||
|
if (ObjectUtil.isNotEmpty(pagination.getEqCode())) {
|
||||||
|
wrapper.like(EqPatrolConfigEntity::getEqCode, pagination.getEqCode());
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(pagination.getEqName())) {
|
||||||
|
wrapper.like(EqPatrolConfigEntity::getEqName, pagination.getEqName());
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(pagination.getDeptId())) {
|
||||||
|
wrapper.eq(EqPatrolConfigEntity::getDeptId, pagination.getDeptId());
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(pagination.getUserId())) {
|
||||||
|
wrapper.eq(EqPatrolConfigEntity::getUserId, pagination.getUserId());
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(pagination.getEnabledStatus())) {
|
||||||
|
wrapper.eq(EqPatrolConfigEntity::getEnabledStatus, pagination.getEnabledStatus());
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(pagination.getKeyword())) {
|
||||||
|
String keyword = pagination.getKeyword();
|
||||||
|
wrapper.and(w -> w.like(EqPatrolConfigEntity::getEqCode, keyword)
|
||||||
|
.or()
|
||||||
|
.like(EqPatrolConfigEntity::getEqName, keyword));
|
||||||
|
}
|
||||||
|
|
||||||
|
wrapper.eq(EqPatrolConfigEntity::getDeleteMark, 0);
|
||||||
|
wrapper.orderByDesc(EqPatrolConfigEntity::getId);
|
||||||
|
|
||||||
|
if ("0".equals(pagination.getDataType())) {
|
||||||
|
Page<EqPatrolConfigEntity> page = new Page<>(pagination.getCurrentPage(), pagination.getPageSize());
|
||||||
|
IPage<EqPatrolConfigEntity> configIPage = this.page(page, wrapper);
|
||||||
|
pagination.setData(configIPage.getRecords(), configIPage.getTotal());
|
||||||
|
return configIPage.getRecords();
|
||||||
|
} else {
|
||||||
|
return this.list(wrapper);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EqPatrolConfigEntity getInfo(Integer id) {
|
||||||
|
QueryWrapper<EqPatrolConfigEntity> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.lambda().eq(EqPatrolConfigEntity::getId, id);
|
||||||
|
queryWrapper.lambda().eq(EqPatrolConfigEntity::getDeleteMark, 0);
|
||||||
|
return this.getOne(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void create(EqPatrolConfigEntity entity) {
|
||||||
|
this.save(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean update(Integer id, EqPatrolConfigEntity entity) {
|
||||||
|
return this.updateById(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delete(EqPatrolConfigEntity entity) {
|
||||||
|
if (entity != null) {
|
||||||
|
this.removeById(entity.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String checkForm(EqPatrolConfigForm form, int i) {
|
||||||
|
boolean isUp = ObjectUtil.isNotEmpty(form.getId());
|
||||||
|
String countRecover = "";
|
||||||
|
if (ObjectUtil.isNotEmpty(form.getEqCode())) {
|
||||||
|
LambdaQueryWrapper<EqPatrolConfigEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(EqPatrolConfigEntity::getEqCode, form.getEqCode());
|
||||||
|
if (isUp) {
|
||||||
|
wrapper.ne(EqPatrolConfigEntity::getId, form.getId());
|
||||||
|
}
|
||||||
|
long count = this.count(wrapper);
|
||||||
|
if (count > 0) {
|
||||||
|
countRecover += "该设备已存在巡检配置,请确认!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return countRecover;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void saveOrUpdate(EqPatrolConfigForm form, Integer id, boolean isSave) throws Exception {
|
||||||
|
EqPatrolConfigEntity entity = getInfo(id);
|
||||||
|
if (entity == null) {
|
||||||
|
entity = new EqPatrolConfigEntity();
|
||||||
|
}
|
||||||
|
BeanUtils.copyProperties(form, entity);
|
||||||
|
|
||||||
|
if (isSave) {
|
||||||
|
this.save(entity);
|
||||||
|
} else {
|
||||||
|
this.updateById(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer mainId = entity.getId();
|
||||||
|
|
||||||
|
List<EqPatrolConfigItemEntity> newItemList = new ArrayList<>();
|
||||||
|
if (form.getItemList() != null && !form.getItemList().isEmpty()) {
|
||||||
|
for (int i = 0; i < form.getItemList().size(); i++) {
|
||||||
|
EqPatrolConfigItemForm itemForm = form.getItemList().get(i);
|
||||||
|
EqPatrolConfigItemEntity itemEntity = new EqPatrolConfigItemEntity();
|
||||||
|
BeanUtils.copyProperties(itemForm, itemEntity);
|
||||||
|
itemEntity.setEqPatrolId(mainId);
|
||||||
|
newItemList.add(itemEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LambdaQueryWrapper<EqPatrolConfigItemEntity> deleteWrapper = new LambdaQueryWrapper<>();
|
||||||
|
deleteWrapper.eq(EqPatrolConfigItemEntity::getEqPatrolId, mainId);
|
||||||
|
eqPatrolConfigItemService.remove(deleteWrapper);
|
||||||
|
|
||||||
|
if (!newItemList.isEmpty()) {
|
||||||
|
eqPatrolConfigItemService.saveBatch(newItemList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,120 @@
|
|||||||
|
package jnpf.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jnpf.base.ActionResult;
|
||||||
|
import jnpf.base.vo.PageListVO;
|
||||||
|
import jnpf.base.vo.PaginationVO;
|
||||||
|
import jnpf.model.eqpatrol.EqPatrolConfigEntity;
|
||||||
|
import jnpf.model.eqpatrol.EqPatrolConfigForm;
|
||||||
|
import jnpf.model.eqpatrol.EqPatrolConfigItemEntity;
|
||||||
|
import jnpf.model.eqpatrol.EqPatrolConfigPagination;
|
||||||
|
import jnpf.service.EqPatrolConfigItemService;
|
||||||
|
import jnpf.service.EqPatrolConfigService;
|
||||||
|
import jnpf.util.JsonUtil;
|
||||||
|
import jnpf.util.StringUtil;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Tag(name = "设备巡检配置", description = "EqPatrolConfig")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/example/eqpatrolconfig")
|
||||||
|
public class EqPatrolConfigController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EqPatrolConfigService eqPatrolConfigService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EqPatrolConfigItemService eqPatrolConfigItemService;
|
||||||
|
|
||||||
|
@Operation(summary = "获取配置列表")
|
||||||
|
@PostMapping("/getList")
|
||||||
|
public ActionResult getList(@RequestBody EqPatrolConfigPagination pagination) {
|
||||||
|
List<EqPatrolConfigEntity> list = eqPatrolConfigService.getList(pagination);
|
||||||
|
List<Map<String, Object>> realList = list.stream()
|
||||||
|
.map(JsonUtil::entityToMap)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
PageListVO vo = new PageListVO();
|
||||||
|
vo.setList(realList);
|
||||||
|
PaginationVO page = JsonUtil.getJsonToBean(pagination, PaginationVO.class);
|
||||||
|
vo.setPagination(page);
|
||||||
|
return ActionResult.success(vo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "获取配置详情(含子表)")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public ActionResult info(@PathVariable("id") Integer id) {
|
||||||
|
EqPatrolConfigEntity entity = eqPatrolConfigService.getInfo(id);
|
||||||
|
if (entity == null) {
|
||||||
|
return ActionResult.fail("该设备巡检配置不存在,请刷新界面!");
|
||||||
|
}
|
||||||
|
if (entity != null) {
|
||||||
|
Map<String, Object> result = JsonUtil.entityToMap(entity);
|
||||||
|
|
||||||
|
List<EqPatrolConfigItemEntity> itemList = eqPatrolConfigItemService.lambdaQuery()
|
||||||
|
.eq(EqPatrolConfigItemEntity::getEqPatrolId, id)
|
||||||
|
.orderByAsc(EqPatrolConfigItemEntity::getSeqNo)
|
||||||
|
.list();
|
||||||
|
result.put("itemList", itemList.stream()
|
||||||
|
.map(JsonUtil::entityToMap)
|
||||||
|
.collect(Collectors.toList()));
|
||||||
|
|
||||||
|
return ActionResult.success(result);
|
||||||
|
}
|
||||||
|
return ActionResult.fail("数据不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "新建配置")
|
||||||
|
@PostMapping
|
||||||
|
public ActionResult create(@RequestBody @Valid EqPatrolConfigForm form) {
|
||||||
|
String errorMsg = eqPatrolConfigService.checkForm(form, 0);
|
||||||
|
if (StringUtil.isNotEmpty(errorMsg)) {
|
||||||
|
return ActionResult.fail(errorMsg);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
eqPatrolConfigService.saveOrUpdate(form, null, true);
|
||||||
|
return ActionResult.success("新建成功");
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ActionResult.fail("新建数据失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "更新配置")
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
public ActionResult update(@PathVariable("id") Integer id, @RequestBody @Valid EqPatrolConfigForm form) {
|
||||||
|
form.setId(id);
|
||||||
|
String errorMsg = eqPatrolConfigService.checkForm(form, 1);
|
||||||
|
if (StringUtil.isNotEmpty(errorMsg)) {
|
||||||
|
return ActionResult.fail(errorMsg);
|
||||||
|
}
|
||||||
|
EqPatrolConfigEntity entity = eqPatrolConfigService.getInfo(id);
|
||||||
|
if (entity != null) {
|
||||||
|
try {
|
||||||
|
eqPatrolConfigService.saveOrUpdate(form, id, false);
|
||||||
|
return ActionResult.success("更新成功");
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ActionResult.fail("更新数据失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return ActionResult.fail("更新失败,数据不存在");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "删除配置")
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public ActionResult delete(@PathVariable("id") Integer id) {
|
||||||
|
EqPatrolConfigEntity entity = eqPatrolConfigService.getInfo(id);
|
||||||
|
if (entity != null) {
|
||||||
|
eqPatrolConfigService.delete(entity);
|
||||||
|
return ActionResult.success("删除成功");
|
||||||
|
}
|
||||||
|
return ActionResult.fail("删除失败,数据不存在");
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,78 @@
|
|||||||
|
package jnpf.model.eqpatrol;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("tba_eq_patrol_config")
|
||||||
|
public class EqPatrolConfigEntity {
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@TableField(value = "f_creator_user_id", fill = FieldFill.INSERT)
|
||||||
|
private String creatorUserId;
|
||||||
|
|
||||||
|
@TableField(value = "f_creator_time", fill = FieldFill.INSERT)
|
||||||
|
private Date creatorTime;
|
||||||
|
|
||||||
|
@TableField(value = "f_last_modify_user_id", fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private String lastModifyUserId;
|
||||||
|
|
||||||
|
@TableField(value = "f_last_modify_time", fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private Date lastModifyTime;
|
||||||
|
|
||||||
|
@TableField(value = "f_delete_user_id", fill = FieldFill.UPDATE)
|
||||||
|
private String deleteUserId;
|
||||||
|
|
||||||
|
@TableField(value = "f_delete_time", fill = FieldFill.UPDATE)
|
||||||
|
private Date deleteTime;
|
||||||
|
|
||||||
|
@TableField(value = "f_delete_mark", updateStrategy = FieldStrategy.IGNORED)
|
||||||
|
private Integer deleteMark;
|
||||||
|
|
||||||
|
@TableField(value = "f_flow_id")
|
||||||
|
private String flowId;
|
||||||
|
|
||||||
|
@TableField(value = "f_flow_task_id")
|
||||||
|
private String flowTaskId;
|
||||||
|
|
||||||
|
@TableField(value = "enabled_status", updateStrategy = FieldStrategy.IGNORED)
|
||||||
|
private Integer enabledStatus;
|
||||||
|
|
||||||
|
@TableField(value = "remark", updateStrategy = FieldStrategy.IGNORED)
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@TableField("eq_id")
|
||||||
|
private Integer eqId;
|
||||||
|
|
||||||
|
@TableField("eq_code")
|
||||||
|
private String eqCode;
|
||||||
|
|
||||||
|
@TableField("eq_name")
|
||||||
|
private String eqName;
|
||||||
|
|
||||||
|
@TableField("cycle_unit")
|
||||||
|
private String cycleUnit;
|
||||||
|
|
||||||
|
@TableField("cycle_value")
|
||||||
|
private Integer cycleValue;
|
||||||
|
|
||||||
|
@TableField("plan_start_dtime")
|
||||||
|
private Date planStartDtime;
|
||||||
|
|
||||||
|
@TableField("dept_id")
|
||||||
|
private String deptId;
|
||||||
|
|
||||||
|
@TableField("dept_name")
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
|
@TableField("user_id")
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
@TableField("user_name")
|
||||||
|
private String userName;
|
||||||
|
}
|
||||||
@ -0,0 +1,63 @@
|
|||||||
|
package jnpf.model.eqpatrol;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class EqPatrolConfigForm {
|
||||||
|
|
||||||
|
@Schema(description = "主键")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@NotBlank(message = "设备编码不能为空")
|
||||||
|
@Schema(description = "设备编码")
|
||||||
|
private String eqCode;
|
||||||
|
|
||||||
|
@NotBlank(message = "设备名称不能为空")
|
||||||
|
@Schema(description = "设备名称")
|
||||||
|
private String eqName;
|
||||||
|
|
||||||
|
@Schema(description = "设备id")
|
||||||
|
private Integer eqId;
|
||||||
|
|
||||||
|
@Schema(description = "周期(1 小时 2 班 3 天)")
|
||||||
|
private String cycleUnit;
|
||||||
|
|
||||||
|
@Schema(description = "周期值")
|
||||||
|
private Integer cycleValue;
|
||||||
|
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||||
|
@Schema(description = "下次执行时间")
|
||||||
|
private Date planStartDtime;
|
||||||
|
|
||||||
|
@Schema(description = "责任部门id")
|
||||||
|
private String deptId;
|
||||||
|
|
||||||
|
@Schema(description = "责任部门名称")
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
|
@Schema(description = "责任人id")
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
@Schema(description = "责任人")
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
@Schema(description = "状态(1启用 2未启用)")
|
||||||
|
private Integer enabledStatus;
|
||||||
|
|
||||||
|
@Schema(description = "备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@Schema(description = "流程ID")
|
||||||
|
private String flowId;
|
||||||
|
|
||||||
|
@Schema(description = "流程任务ID")
|
||||||
|
private String flowTaskId;
|
||||||
|
|
||||||
|
@Schema(description = "子表数据")
|
||||||
|
private List<EqPatrolConfigItemForm> itemList;
|
||||||
|
}
|
||||||
@ -0,0 +1,67 @@
|
|||||||
|
package jnpf.model.eqpatrol;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("tba_eq_patrol_config_item")
|
||||||
|
public class EqPatrolConfigItemEntity {
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@TableField(value = "f_creator_user_id", fill = FieldFill.INSERT)
|
||||||
|
private String creatorUserId;
|
||||||
|
|
||||||
|
@TableField(value = "f_creator_time", fill = FieldFill.INSERT)
|
||||||
|
private Date creatorTime;
|
||||||
|
|
||||||
|
@TableField(value = "f_last_modify_user_id", fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private String lastModifyUserId;
|
||||||
|
|
||||||
|
@TableField(value = "f_last_modify_time", fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private Date lastModifyTime;
|
||||||
|
|
||||||
|
@TableField(value = "f_delete_user_id", fill = FieldFill.UPDATE)
|
||||||
|
private String deleteUserId;
|
||||||
|
|
||||||
|
@TableField(value = "f_delete_time", fill = FieldFill.UPDATE)
|
||||||
|
private Date deleteTime;
|
||||||
|
|
||||||
|
@TableField(value = "f_delete_mark", updateStrategy = FieldStrategy.IGNORED)
|
||||||
|
private Integer deleteMark;
|
||||||
|
|
||||||
|
@TableField(value = "f_flow_id")
|
||||||
|
private String flowId;
|
||||||
|
|
||||||
|
@TableField(value = "f_flow_task_id")
|
||||||
|
private String flowTaskId;
|
||||||
|
|
||||||
|
@TableField(value = "enabled_status", updateStrategy = FieldStrategy.IGNORED)
|
||||||
|
private Integer enabledStatus;
|
||||||
|
|
||||||
|
@TableField(value = "remark", updateStrategy = FieldStrategy.IGNORED)
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@TableField("eq_patrol_id")
|
||||||
|
private Integer eqPatrolId;
|
||||||
|
|
||||||
|
@TableField("item_name")
|
||||||
|
private String itemName;
|
||||||
|
|
||||||
|
@TableField("check_part")
|
||||||
|
private String checkPart;
|
||||||
|
|
||||||
|
@TableField("check_method")
|
||||||
|
private String checkMethod;
|
||||||
|
|
||||||
|
@TableField("qualified_stand")
|
||||||
|
private String qualifiedStand;
|
||||||
|
|
||||||
|
@TableField("check_tool")
|
||||||
|
private String checkTool;
|
||||||
|
|
||||||
|
@TableField("seq_no")
|
||||||
|
private Integer seqNo;
|
||||||
|
}
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
package jnpf.model.eqpatrol;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class EqPatrolConfigItemForm {
|
||||||
|
|
||||||
|
@Schema(description = "主键")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@Schema(description = "巡检项目")
|
||||||
|
private String itemName;
|
||||||
|
|
||||||
|
@Schema(description = "检查部位")
|
||||||
|
private String checkPart;
|
||||||
|
|
||||||
|
@Schema(description = "检查方法")
|
||||||
|
private String checkMethod;
|
||||||
|
|
||||||
|
@Schema(description = "合格标准")
|
||||||
|
private String qualifiedStand;
|
||||||
|
|
||||||
|
@Schema(description = "所需工具")
|
||||||
|
private String checkTool;
|
||||||
|
|
||||||
|
@Schema(description = "项目序号")
|
||||||
|
private Integer seqNo;
|
||||||
|
|
||||||
|
@Schema(description = "状态(1启用 2未启用)")
|
||||||
|
private Integer enabledStatus;
|
||||||
|
|
||||||
|
@Schema(description = "备注")
|
||||||
|
private String remark;
|
||||||
|
}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
package jnpf.model.eqpatrol;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jnpf.base.Pagination;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class EqPatrolConfigPagination extends Pagination {
|
||||||
|
|
||||||
|
@Schema(description = "数据类型")
|
||||||
|
private String dataType;
|
||||||
|
|
||||||
|
@Schema(description = "设备编码")
|
||||||
|
private String eqCode;
|
||||||
|
|
||||||
|
@Schema(description = "设备名称")
|
||||||
|
private String eqName;
|
||||||
|
|
||||||
|
@Schema(description = "责任部门id")
|
||||||
|
private String deptId;
|
||||||
|
|
||||||
|
@Schema(description = "责任人id")
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
@Schema(description = "状态(1启用 2未启用)")
|
||||||
|
private Integer enabledStatus;
|
||||||
|
|
||||||
|
@Schema(description = "关键词")
|
||||||
|
private String keyword;
|
||||||
|
}
|
||||||
@ -16,6 +16,8 @@ export const dictMaps = {
|
|||||||
mainType: { '1': '点检', '2': '保养', '3': '润滑' },
|
mainType: { '1': '点检', '2': '保养', '3': '润滑' },
|
||||||
// 周期单位
|
// 周期单位
|
||||||
cycleUnit: { '1': '班', '2': '日', '3': '月', '4': '季度', '5': '年' },
|
cycleUnit: { '1': '班', '2': '日', '3': '月', '4': '季度', '5': '年' },
|
||||||
|
|
||||||
|
cycleUnit2: { '1': '小时', '2': '班', '3': '天',},
|
||||||
};
|
};
|
||||||
|
|
||||||
// 根据映射自动生成下拉选项(使用id和fullName字段)
|
// 根据映射自动生成下拉选项(使用id和fullName字段)
|
||||||
@ -42,5 +44,6 @@ export const enabledStatusOptions = dictOptions.enabledStatus;
|
|||||||
export const ordTypeOptions = dictOptions.ordType;
|
export const ordTypeOptions = dictOptions.ordType;
|
||||||
export const mainTypeOptions = dictOptions.mainType;
|
export const mainTypeOptions = dictOptions.mainType;
|
||||||
export const cycleUnitOptions = dictOptions.cycleUnit;
|
export const cycleUnitOptions = dictOptions.cycleUnit;
|
||||||
|
export const cycleUnitOptions2 = dictOptions.cycleUnit2;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -49,12 +49,12 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="责任人">
|
<el-form-item label="责任人员">
|
||||||
<el-input :value="dataForm.userName" disabled style="width: 100%;"></el-input>
|
<el-input :value="dataForm.userName" disabled style="width: 100%;"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="负责岗位">
|
<el-form-item label="责任岗位">
|
||||||
<el-input :value="dataForm.mainPost" disabled style="width: 100%;"></el-input>
|
<el-input :value="dataForm.mainPost" disabled style="width: 100%;"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -81,7 +81,7 @@
|
|||||||
<el-table-column label="保养项目" prop="itemName" align="center"></el-table-column>
|
<el-table-column label="保养项目" prop="itemName" align="center"></el-table-column>
|
||||||
<el-table-column label="检查/保养部位" prop="checkPart" align="center"></el-table-column>
|
<el-table-column label="检查/保养部位" prop="checkPart" align="center"></el-table-column>
|
||||||
<el-table-column label="检查/保养方法" prop="checkMethod" align="center"></el-table-column>
|
<el-table-column label="检查/保养方法" prop="checkMethod" align="center"></el-table-column>
|
||||||
<el-table-column label="标准/要求" prop="qualifiedStand" align="center"></el-table-column>
|
<!-- <el-table-column label="标准/要求" prop="qualifiedStand" align="center"></el-table-column> -->
|
||||||
<el-table-column label="所需工具" prop="checkTool" align="center"></el-table-column>
|
<el-table-column label="所需工具" prop="checkTool" align="center"></el-table-column>
|
||||||
<el-table-column label="项目序号" prop="seqNo" align="center"></el-table-column>
|
<el-table-column label="项目序号" prop="seqNo" align="center"></el-table-column>
|
||||||
<el-table-column label="备注" prop="remark" align="center"></el-table-column>
|
<el-table-column label="备注" prop="remark" align="center"></el-table-column>
|
||||||
|
|||||||
@ -74,7 +74,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="责任人" prop="userId">
|
<el-form-item label="责任人员" prop="userId">
|
||||||
<JnpfSelect v-model="dataForm.userId" placeholder="请选择责任人" filterable clearable
|
<JnpfSelect v-model="dataForm.userId" placeholder="请选择责任人" filterable clearable
|
||||||
:style="{ width: '100%' }" :options="userIdOptions"
|
:style="{ width: '100%' }" :options="userIdOptions"
|
||||||
:props="userIdProps" @change="handleUserChange">
|
:props="userIdProps" @change="handleUserChange">
|
||||||
@ -82,8 +82,8 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="负责岗位" prop="mainPost">
|
<el-form-item label="责任岗位" prop="mainPost">
|
||||||
<JnpfInput v-model="dataForm.mainPost" placeholder="请输入负责岗位" clearable>
|
<JnpfInput v-model="dataForm.mainPost" placeholder="请输入责任岗位" clearable>
|
||||||
</JnpfInput>
|
</JnpfInput>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -122,12 +122,12 @@
|
|||||||
</JnpfInput>
|
</JnpfInput>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="qualifiedStand" label="标准/要求" min-width="150" align="center">
|
<!-- <el-table-column prop="qualifiedStand" label="标准/要求" min-width="150" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<JnpfInput v-model="scope.row.qualifiedStand" clearable>
|
<JnpfInput v-model="scope.row.qualifiedStand" clearable>
|
||||||
</JnpfInput>
|
</JnpfInput>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column> -->
|
||||||
<el-table-column prop="checkTool" label="所需工具" min-width="120" align="center">
|
<el-table-column prop="checkTool" label="所需工具" min-width="120" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<JnpfInput v-model="scope.row.checkTool" clearable>
|
<JnpfInput v-model="scope.row.checkTool" clearable>
|
||||||
@ -204,12 +204,22 @@ export default {
|
|||||||
eqCode: [
|
eqCode: [
|
||||||
{required: true, message: '请选择设备', trigger: 'change'},
|
{required: true, message: '请选择设备', trigger: 'change'},
|
||||||
],
|
],
|
||||||
mainName: [
|
|
||||||
{required: true, message: '请输入方案名称', trigger: 'blur'},
|
|
||||||
],
|
|
||||||
mainType: [
|
mainType: [
|
||||||
{required: true, message: '请选择类型', trigger: 'change'},
|
{required: true, message: '请选择类型', trigger: 'change'},
|
||||||
],
|
],
|
||||||
|
//周期
|
||||||
|
cycleUnit: [
|
||||||
|
{required: true, message: '请选择周期', trigger: 'change'},
|
||||||
|
],
|
||||||
|
//计划开始时间
|
||||||
|
planStartDtime: [
|
||||||
|
{required: true, message: '请选择下次执行时间', trigger: 'change'},
|
||||||
|
],
|
||||||
|
// 启用
|
||||||
|
enabledStatus: [
|
||||||
|
{required: true, message: '请选择启用状态', trigger: 'change'},
|
||||||
|
]
|
||||||
|
|
||||||
},
|
},
|
||||||
deptOptions: [],
|
deptOptions: [],
|
||||||
userIdOptions: [],
|
userIdOptions: [],
|
||||||
|
|||||||
@ -0,0 +1,59 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
import { getDataInterfaceRes } from '@/api/systemData/dataInterface'
|
||||||
|
|
||||||
|
export function getEquipmentList(data) {
|
||||||
|
return request({
|
||||||
|
url: '/api/example/equipment/getList',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getEqPatrolConfigList(data) {
|
||||||
|
return request({
|
||||||
|
url: '/api/example/eqpatrolconfig/getList',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getEqPatrolConfigInfo(id) {
|
||||||
|
return request({
|
||||||
|
url: `/api/example/eqpatrolconfig/${id}`,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createEqPatrolConfig(data) {
|
||||||
|
return request({
|
||||||
|
url: '/api/example/eqpatrolconfig',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateEqPatrolConfig(id, data) {
|
||||||
|
return request({
|
||||||
|
url: `/api/example/eqpatrolconfig/${id}`,
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function deleteEqPatrolConfig(id) {
|
||||||
|
return request({
|
||||||
|
url: `/api/example/eqpatrolconfig/${id}`,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getDeptList() {
|
||||||
|
return getDataInterfaceRes('811583643129479301')
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getUserList(deptId) {
|
||||||
|
return request({
|
||||||
|
url: `/api/example/exampleOrder/getByDeptId/${deptId}`,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
@ -0,0 +1,163 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
:title="'详情'"
|
||||||
|
:visible.sync="dialogVisible"
|
||||||
|
width="1200px"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
@close="handleClose"
|
||||||
|
>
|
||||||
|
<el-form :model="dataForm" size="small" label-width="100px" label-position="right">
|
||||||
|
<template v-if="!loading">
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="设备名称">
|
||||||
|
<el-input :value="dataForm.eqName" disabled style="width: 100%;"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="设备编码">
|
||||||
|
<el-input :value="dataForm.eqCode" disabled style="width: 100%;"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="周期单位">
|
||||||
|
<el-input :value="getCycleUnitLabel(dataForm.cycleUnit)" disabled style="width: 100%;"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="周期值">
|
||||||
|
<el-input :value="dataForm.cycleValue" disabled style="width: 100%;"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="下次执行时间">
|
||||||
|
<el-input :value="formatDate(dataForm.planStartDtime)" disabled style="width: 100%;"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="启用状态">
|
||||||
|
<el-input :value="getEnabledStatusLabel(dataForm.enabledStatus)" disabled style="width: 100%;"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="责任部门">
|
||||||
|
<el-input :value="dataForm.deptName" disabled style="width: 100%;"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="责任人员">
|
||||||
|
<el-input :value="dataForm.userName" disabled style="width: 100%;"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="备注">
|
||||||
|
<el-input :value="dataForm.remark" disabled style="width: 100%;"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<div style="margin-bottom: 10px; display: flex; align-items: center;">
|
||||||
|
<span style="font-weight: bold;">巡检项目信息</span>
|
||||||
|
</div>
|
||||||
|
<el-table :data="dataForm.itemList" border style="width: 100%;" size="small">
|
||||||
|
<el-table-column type="index" label="序号" width="50" align="center"></el-table-column>
|
||||||
|
<el-table-column label="巡检项目" prop="itemName" align="center"></el-table-column>
|
||||||
|
<el-table-column label="检查部位" prop="checkPart" align="center"></el-table-column>
|
||||||
|
<el-table-column label="检查方法" prop="checkMethod" align="center"></el-table-column>
|
||||||
|
<el-table-column label="合格标准" prop="qualifiedStand" align="center"></el-table-column>
|
||||||
|
<el-table-column label="所需工具" prop="checkTool" align="center"></el-table-column>
|
||||||
|
<el-table-column label="项目序号" prop="seqNo" align="center"></el-table-column>
|
||||||
|
<el-table-column label="备注" prop="remark" align="center"></el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</template>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="handleClose">关 闭</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {getEqPatrolConfigInfo} from "./api";
|
||||||
|
import {getLabel} from "../common/dict";
|
||||||
|
import jnpf from "@/utils/jnpf";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "EqPatrolConfigDetail",
|
||||||
|
components: {},
|
||||||
|
props: [],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
dialogVisible: false,
|
||||||
|
loading: false,
|
||||||
|
jnpf: jnpf,
|
||||||
|
dataForm: {
|
||||||
|
id: '',
|
||||||
|
eqId: undefined,
|
||||||
|
eqCode: undefined,
|
||||||
|
eqName: undefined,
|
||||||
|
cycleUnit: undefined,
|
||||||
|
cycleValue: undefined,
|
||||||
|
planStartDtime: undefined,
|
||||||
|
deptId: undefined,
|
||||||
|
deptName: undefined,
|
||||||
|
userId: undefined,
|
||||||
|
userName: undefined,
|
||||||
|
enabledStatus: "1",
|
||||||
|
remark: undefined,
|
||||||
|
itemList: []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
init(id) {
|
||||||
|
this.dialogVisible = true
|
||||||
|
this.loading = true
|
||||||
|
getEqPatrolConfigInfo(id).then((res) => {
|
||||||
|
const data = res.data
|
||||||
|
this.dataForm = {
|
||||||
|
...data,
|
||||||
|
enabledStatus: String(data.enabledStatus || '1'),
|
||||||
|
itemList: data.itemList || []
|
||||||
|
}
|
||||||
|
this.loading = false
|
||||||
|
}).catch((err) => {
|
||||||
|
this.loading = false
|
||||||
|
this.dialogVisible = false
|
||||||
|
this.$message({
|
||||||
|
type: 'error',
|
||||||
|
message: err.message || '获取数据失败'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getCycleUnitLabel(value) {
|
||||||
|
return getLabel('cycleUnit', value)
|
||||||
|
},
|
||||||
|
getEnabledStatusLabel(value) {
|
||||||
|
return getLabel('enabledStatus', value)
|
||||||
|
},
|
||||||
|
formatDate(timestamp) {
|
||||||
|
if (!timestamp) return ''
|
||||||
|
const date = new Date(timestamp)
|
||||||
|
const year = date.getFullYear()
|
||||||
|
const month = String(date.getMonth() + 1).padStart(2, '0')
|
||||||
|
const day = String(date.getDate()).padStart(2, '0')
|
||||||
|
const hours = String(date.getHours()).padStart(2, '0')
|
||||||
|
const minutes = String(date.getMinutes()).padStart(2, '0')
|
||||||
|
return `${year}-${month}-${day} ${hours}:${minutes}`
|
||||||
|
},
|
||||||
|
handleClose() {
|
||||||
|
this.dialogVisible = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@ -0,0 +1,447 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-dialog
|
||||||
|
:title="!dataForm.id ? '新建' : '编辑'"
|
||||||
|
:visible.sync="dialogVisible"
|
||||||
|
width="1200px"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
@close="handleClose"
|
||||||
|
>
|
||||||
|
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="120px" label-position="right">
|
||||||
|
<template v-if="!loading">
|
||||||
|
<el-row :gutter="24">
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="设备名称" prop="eqCode">
|
||||||
|
<el-input v-model="dataForm.eqName" placeholder="请选择设备" clearable readonly :disabled="!!dataForm.id" @click.native="selectEquipment">
|
||||||
|
<i slot="suffix" class="el-input__icon el-icon-search" style="cursor: pointer;"></i>
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="周期" prop="cycleUnit">
|
||||||
|
<JnpfSelect v-model="dataForm.cycleUnit" placeholder="请选择周期单位" :options="cycleUnitOptions2" :props="cycleUnitProps" clearable :style="{ width: '100%' }">
|
||||||
|
</JnpfSelect>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="周期值" prop="cycleValue">
|
||||||
|
<JnpfInputNumber v-model="dataForm.cycleValue" placeholder="请输入周期值" :min="1" :step="1" clearable>
|
||||||
|
</JnpfInputNumber>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="24">
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="责任部门" prop="deptId">
|
||||||
|
<el-select v-model="dataForm.deptId" placeholder="请选择责任部门" clearable ref="deptSelect"
|
||||||
|
:style="{ width: '100%' }" @clear="deptIdLabel = ''">
|
||||||
|
<el-option :value="dataForm.deptId" :label="deptIdLabel" style="height: auto; padding: 0;">
|
||||||
|
<el-tree
|
||||||
|
:data="deptOptions"
|
||||||
|
:props="{ children: 'children', label: 'name' }"
|
||||||
|
@node-click="handleDeptSelect"
|
||||||
|
node-key="id"
|
||||||
|
default-expand-all
|
||||||
|
:expand-on-click-node="true">
|
||||||
|
</el-tree>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="责任人员" prop="userId">
|
||||||
|
<JnpfSelect v-model="dataForm.userId" placeholder="请选择责任人" filterable clearable
|
||||||
|
:style="{ width: '100%' }" :options="userIdOptions"
|
||||||
|
:props="userIdProps" @change="handleUserChange">
|
||||||
|
</JnpfSelect>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="下次执行时间" prop="planStartDtime">
|
||||||
|
<JnpfDatePicker v-model="dataForm.planStartDtime"
|
||||||
|
placeholder="请选择下次执行时间"
|
||||||
|
clearable
|
||||||
|
:style='{ "width": "100%" }'
|
||||||
|
format="yyyy-MM-dd HH:mm"
|
||||||
|
type="datetime">
|
||||||
|
</JnpfDatePicker>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="24">
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="启用状态" prop="enabledStatus">
|
||||||
|
<JnpfSelect v-model="dataForm.enabledStatus" placeholder="请选择启用状态" :options="enabledStatusOptions" :props="enabledStatusProps" :style="{ width: '100%' }">
|
||||||
|
</JnpfSelect>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="16">
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<JnpfTextarea v-model="dataForm.remark" placeholder="请输入备注" :autoSize="{ minRows: 2, maxRows: 2 }" type="textarea">
|
||||||
|
</JnpfTextarea>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<div style="display: flex; align-items: center; margin-bottom: 10px;">
|
||||||
|
<span style="font-weight: bold;">巡检项目信息</span>
|
||||||
|
<el-button type="primary" size="small" icon="el-icon-plus" @click="addItem" style="margin-left: 10px;">新增</el-button>
|
||||||
|
</div>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="24" style="overflow-x: hidden;">
|
||||||
|
<el-table :data="dataForm.itemList" border :show-header="true" style="width: 100%; table-layout: fixed;">
|
||||||
|
<el-table-column type="index" label="序号" width="60" align="center"/>
|
||||||
|
<el-table-column prop="itemName" label="*巡检项目" min-width="150" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<JnpfInput v-model="scope.row.itemName" clearable>
|
||||||
|
</JnpfInput>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="checkPart" label="*检查部位" min-width="150" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<JnpfInput v-model="scope.row.checkPart" clearable>
|
||||||
|
</JnpfInput>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="checkMethod" label="*检查方法" min-width="150" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<JnpfInput v-model="scope.row.checkMethod" clearable>
|
||||||
|
</JnpfInput>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="qualifiedStand" label="合格标准" min-width="150" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<JnpfInput v-model="scope.row.qualifiedStand" clearable>
|
||||||
|
</JnpfInput>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="checkTool" label="所需工具" min-width="120" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<JnpfInput v-model="scope.row.checkTool" clearable>
|
||||||
|
</JnpfInput>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="seqNo" label="*项目序号" width="100" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<JnpfInput v-model="scope.row.seqNo" type="number" :step="1">
|
||||||
|
</JnpfInput>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="remark" label="备注" min-width="170" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<JnpfInput v-model="scope.row.remark" clearable>
|
||||||
|
</JnpfInput>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" width="80" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button type="text" class="JNPF-table-delBtn" @click="deleteItem(scope.$index)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</template>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading">保 存</el-button>
|
||||||
|
<el-button @click="handleClose">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</el-dialog>
|
||||||
|
<EquipmentSelect v-if="equipmentSelectVisible" :visible.sync="equipmentSelectVisible" @select="handleEquipmentSelect"/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {createEqPatrolConfig, deleteEqPatrolConfig, getDeptList, getEqPatrolConfigInfo, getUserList, updateEqPatrolConfig} from './api'
|
||||||
|
import EquipmentSelect from '../equipment/select.vue'
|
||||||
|
import {enabledStatusOptions, dictProps, cycleUnitOptions2} from '../common/dict'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
EquipmentSelect
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
dialogVisible: false,
|
||||||
|
loading: false,
|
||||||
|
btnLoading: false,
|
||||||
|
equipmentSelectVisible: false,
|
||||||
|
dataForm: {
|
||||||
|
id: '',
|
||||||
|
eqId: undefined,
|
||||||
|
eqCode: undefined,
|
||||||
|
eqName: undefined,
|
||||||
|
cycleUnit: undefined,
|
||||||
|
cycleValue: undefined,
|
||||||
|
planStartDtime: undefined,
|
||||||
|
deptId: undefined,
|
||||||
|
deptName: undefined,
|
||||||
|
userId: undefined,
|
||||||
|
userName: undefined,
|
||||||
|
enabledStatus: "1",
|
||||||
|
remark: undefined,
|
||||||
|
itemList: []
|
||||||
|
},
|
||||||
|
dataRule: {
|
||||||
|
eqCode: [
|
||||||
|
{required: true, message: '请选择设备', trigger: 'change'},
|
||||||
|
],
|
||||||
|
//周期
|
||||||
|
cycleUnit: [
|
||||||
|
{required: true, message: '请选择周期', trigger: 'change'},
|
||||||
|
],
|
||||||
|
// 下次执行时间
|
||||||
|
planStartDtime: [
|
||||||
|
{required: true, message: '请选择下次执行时间', trigger: 'change'},
|
||||||
|
],
|
||||||
|
// 设备状态
|
||||||
|
enabledStatus: [
|
||||||
|
{required: true, message: '请选择设备状态', trigger: 'change'},
|
||||||
|
],
|
||||||
|
|
||||||
|
},
|
||||||
|
deptOptions: [],
|
||||||
|
userIdOptions: [],
|
||||||
|
userIdProps: { 'label': 'realName', 'value': 'id' },
|
||||||
|
deptIdLabel: '',
|
||||||
|
cycleUnitOptions2: cycleUnitOptions2,
|
||||||
|
cycleUnitProps: dictProps,
|
||||||
|
enabledStatusOptions: enabledStatusOptions,
|
||||||
|
enabledStatusProps: dictProps
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
init(id) {
|
||||||
|
this.dialogVisible = true
|
||||||
|
this.loading = true
|
||||||
|
this.resetForm()
|
||||||
|
this.dataForm.id = id || ''
|
||||||
|
this.loadDeptList().then(() => {
|
||||||
|
if (id) {
|
||||||
|
this.getInfo()
|
||||||
|
} else {
|
||||||
|
this.loading = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
resetForm() {
|
||||||
|
this.dataForm = {
|
||||||
|
id: '',
|
||||||
|
eqId: undefined,
|
||||||
|
eqCode: undefined,
|
||||||
|
eqName: undefined,
|
||||||
|
cycleUnit: undefined,
|
||||||
|
cycleValue: undefined,
|
||||||
|
planStartDtime: undefined,
|
||||||
|
deptId: undefined,
|
||||||
|
deptName: undefined,
|
||||||
|
userId: undefined,
|
||||||
|
userName: undefined,
|
||||||
|
enabledStatus: "1",
|
||||||
|
remark: undefined,
|
||||||
|
itemList: []
|
||||||
|
}
|
||||||
|
this.deptIdLabel = ''
|
||||||
|
this.userIdOptions = []
|
||||||
|
},
|
||||||
|
getInfo() {
|
||||||
|
getEqPatrolConfigInfo(this.dataForm.id).then((res) => {
|
||||||
|
const data = res.data
|
||||||
|
Object.keys(data).forEach(key => {
|
||||||
|
if (key !== 'itemList') {
|
||||||
|
if (key === 'enabledStatus') {
|
||||||
|
this.dataForm[key] = String(data[key])
|
||||||
|
} else {
|
||||||
|
this.dataForm[key] = data[key]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (data.itemList && Array.isArray(data.itemList)) {
|
||||||
|
this.dataForm.itemList = [...data.itemList]
|
||||||
|
} else {
|
||||||
|
this.dataForm.itemList = []
|
||||||
|
}
|
||||||
|
if (this.dataForm.deptId) {
|
||||||
|
this.deptIdLabel = this.findDeptNameById(this.dataForm.deptId, this.deptOptions)
|
||||||
|
getUserList(this.dataForm.deptId).then((res) => {
|
||||||
|
this.userIdOptions = res.data || []
|
||||||
|
if (this.dataForm.userId) {
|
||||||
|
const user = this.userIdOptions.find(item => String(item.id) === String(this.dataForm.userId))
|
||||||
|
if (user) {
|
||||||
|
this.dataForm.userName = user.realName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.loading = false
|
||||||
|
}).catch((err) => {
|
||||||
|
this.loading = false
|
||||||
|
this.dialogVisible = false
|
||||||
|
this.$message({
|
||||||
|
type: 'error',
|
||||||
|
message: err.message || '获取数据失败'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
loadDeptList() {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
getDeptList().then((res) => {
|
||||||
|
let data = res.data || []
|
||||||
|
this.deptOptions = this.buildTree(data)
|
||||||
|
resolve()
|
||||||
|
}).catch(() => {
|
||||||
|
resolve()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
buildTree(list) {
|
||||||
|
if (!list || !list.length) return []
|
||||||
|
const tree = []
|
||||||
|
const map = {}
|
||||||
|
list.forEach(item => {
|
||||||
|
map[item.id] = { ...item, children: [] }
|
||||||
|
})
|
||||||
|
list.forEach(item => {
|
||||||
|
if (item.parentId && map[item.parentId]) {
|
||||||
|
map[item.parentId].children.push(map[item.id])
|
||||||
|
} else {
|
||||||
|
tree.push(map[item.id])
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return tree
|
||||||
|
},
|
||||||
|
handleDeptSelect(data) {
|
||||||
|
this.dataForm.deptId = String(data.id)
|
||||||
|
this.deptIdLabel = data.name
|
||||||
|
this.dataForm.deptName = data.name
|
||||||
|
if (this.$refs.deptSelect) {
|
||||||
|
this.$refs.deptSelect.visible = false
|
||||||
|
}
|
||||||
|
this.userIdOptions = []
|
||||||
|
this.dataForm.userId = undefined
|
||||||
|
this.dataForm.userName = undefined
|
||||||
|
if (data.id) {
|
||||||
|
getUserList(data.id).then((res) => {
|
||||||
|
this.userIdOptions = res.data || []
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleUserChange(val) {
|
||||||
|
this.dataForm.userId = val
|
||||||
|
const user = this.userIdOptions.find(item => String(item.id) === String(val))
|
||||||
|
if (user) {
|
||||||
|
this.dataForm.userName = user.realName
|
||||||
|
} else {
|
||||||
|
this.dataForm.userName = undefined
|
||||||
|
}
|
||||||
|
},
|
||||||
|
findDeptNameById(id, tree) {
|
||||||
|
for (const item of tree) {
|
||||||
|
if (String(item.id) === String(id)) {
|
||||||
|
return item.name
|
||||||
|
}
|
||||||
|
if (item.children && item.children.length > 0) {
|
||||||
|
const found = this.findDeptNameById(id, item.children)
|
||||||
|
if (found) {
|
||||||
|
return found
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ''
|
||||||
|
},
|
||||||
|
selectEquipment() {
|
||||||
|
this.equipmentSelectVisible = true
|
||||||
|
},
|
||||||
|
handleEquipmentSelect(data) {
|
||||||
|
this.dataForm.eqId = data.eqId
|
||||||
|
this.dataForm.eqCode = data.eqCode
|
||||||
|
this.dataForm.eqName = data.eqName
|
||||||
|
this.equipmentSelectVisible = false
|
||||||
|
},
|
||||||
|
addItem() {
|
||||||
|
this.dataForm.itemList = [...this.dataForm.itemList, {
|
||||||
|
id: '',
|
||||||
|
itemName: undefined,
|
||||||
|
checkPart: undefined,
|
||||||
|
checkMethod: undefined,
|
||||||
|
qualifiedStand: undefined,
|
||||||
|
checkTool: undefined,
|
||||||
|
seqNo: undefined,
|
||||||
|
enabledStatus: 1,
|
||||||
|
remark: undefined
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
deleteItem(index) {
|
||||||
|
this.dataForm.itemList = this.dataForm.itemList.filter((_, i) => i !== index)
|
||||||
|
},
|
||||||
|
dataFormSubmit() {
|
||||||
|
if (!this.validateItemList()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.$refs.formRef.validate((valid) => {
|
||||||
|
if (!valid) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.btnLoading = true
|
||||||
|
if (this.dataForm.id) {
|
||||||
|
updateEqPatrolConfig(this.dataForm.id, this.dataForm).then(() => {
|
||||||
|
this.$message.success('修改成功')
|
||||||
|
this.dialogVisible = false
|
||||||
|
this.btnLoading = false
|
||||||
|
this.$emit('refresh')
|
||||||
|
}).catch(() => {
|
||||||
|
this.btnLoading = false
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
createEqPatrolConfig(this.dataForm).then(() => {
|
||||||
|
this.$message.success('新增成功')
|
||||||
|
this.dialogVisible = false
|
||||||
|
this.btnLoading = false
|
||||||
|
this.$emit('refresh')
|
||||||
|
}).catch(() => {
|
||||||
|
this.btnLoading = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
validateItemList() {
|
||||||
|
for (let i = 0; i < this.dataForm.itemList.length; i++) {
|
||||||
|
const item = this.dataForm.itemList[i]
|
||||||
|
if (!item.itemName || item.itemName.trim() === '') {
|
||||||
|
this.$message.warning(`第${i + 1}行巡检项目不能为空`)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (!item.checkPart || item.checkPart.trim() === '') {
|
||||||
|
this.$message.warning(`第${i + 1}行检查部位不能为空`)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (!item.checkMethod || item.checkMethod.trim() === '') {
|
||||||
|
this.$message.warning(`第${i + 1}行检查方法不能为空`)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (!item.seqNo && item.seqNo !== 0) {
|
||||||
|
this.$message.warning(`第${i + 1}行项目序号不能为空`)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const itemNameMap = {}
|
||||||
|
for (let i = 0; i < this.dataForm.itemList.length; i++) {
|
||||||
|
const itemName = this.dataForm.itemList[i].itemName.trim()
|
||||||
|
if (itemNameMap[itemName]) {
|
||||||
|
this.$message.warning('巡检项目存在重复数据,请确认!')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
itemNameMap[itemName] = true
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
},
|
||||||
|
handleClose() {
|
||||||
|
this.dialogVisible = false
|
||||||
|
this.$emit('refresh',true)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@ -0,0 +1,200 @@
|
|||||||
|
<template>
|
||||||
|
<div class="JNPF-common-layout eq-patrol-config-data">
|
||||||
|
<div class="JNPF-common-layout-center">
|
||||||
|
<el-row class="JNPF-common-search-box" :gutter="14">
|
||||||
|
<el-form @submit.native.prevent>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item label="设备编码">
|
||||||
|
<el-input v-model="query.eqCode" placeholder="请输入设备编码" clearable></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item label="设备名称">
|
||||||
|
<el-input v-model="query.eqName" placeholder="请输入设备名称" clearable></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item label="启用状态">
|
||||||
|
<JnpfSelect v-model="query.enabledStatus" placeholder="请选择" clearable :options="enabledStatusOptions"
|
||||||
|
:props="enabledStatusProps">
|
||||||
|
</JnpfSelect>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item class="btn">
|
||||||
|
<el-button type="primary" icon="el-icon-search" @click="search()">查询</el-button>
|
||||||
|
<el-button icon="el-icon-refresh-right" @click="reset()">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-form>
|
||||||
|
</el-row>
|
||||||
|
<div class="JNPF-common-layout-main JNPF-flex-main">
|
||||||
|
<div class="JNPF-common-head">
|
||||||
|
<div>
|
||||||
|
<el-button type="primary" icon="icon-ym icon-ym-btn-add" @click="addOrUpdateHandle()">新建</el-button>
|
||||||
|
</div>
|
||||||
|
<div class="JNPF-common-head-right"></div>
|
||||||
|
</div>
|
||||||
|
<JNPF-table
|
||||||
|
v-loading="listLoading"
|
||||||
|
:data="list"
|
||||||
|
>
|
||||||
|
<el-table-column prop="eqCode" label="设备编码" align="center" min-width="120"/>
|
||||||
|
<el-table-column prop="eqName" label="设备名称" align="center" min-width="120"/>
|
||||||
|
<el-table-column prop="cycleUnit" label="周期" align="center" min-width="80">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ getCycleUnitLabel2(scope.row.cycleUnit) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="cycleValue" label="周期值" align="center" min-width="80"/>
|
||||||
|
<el-table-column prop="planStartDtime" label="下次执行时间" align="center" min-width="150" :formatter="jnpf.tableDateFormat1"/>
|
||||||
|
<el-table-column prop="deptName" label="责任部门" align="center" min-width="100"/>
|
||||||
|
<el-table-column prop="userName" label="责任人" align="center" min-width="80"/>
|
||||||
|
<el-table-column prop="enabledStatus" label="启用状态" align="center" min-width="80">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-tag :type="scope.row.enabledStatus == 1 ? 'success' : 'info'" size="small">
|
||||||
|
{{ getLabel('enabledStatus', scope.row.enabledStatus) }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="remark" label="备注" align="center" min-width="150" show-overflow-tooltip/>
|
||||||
|
<el-table-column label="操作" fixed="right" align="center" width="200">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button type="text" @click="addOrUpdateHandle(scope.row)">编辑</el-button>
|
||||||
|
<el-button type="text" @click="detailHandle(scope.row)">详情</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</JNPF-table>
|
||||||
|
<pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize"
|
||||||
|
@pagination="initData"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<JNPFForm v-if="formVisible" ref="JNPFForm" @refresh="refresh"/>
|
||||||
|
<EqPatrolConfigDetail ref="detail"/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {deleteEqPatrolConfig, getEqPatrolConfigList} from "./api";
|
||||||
|
import JNPFForm from "./form";
|
||||||
|
import EqPatrolConfigDetail from "./detail";
|
||||||
|
import jnpf from "@/utils/jnpf";
|
||||||
|
import {enabledStatusOptions, dictProps, getLabel, cycleUnitOptions} from '../common/dict';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "eqpatrolconfig",
|
||||||
|
components: {
|
||||||
|
JNPFForm,
|
||||||
|
EqPatrolConfigDetail,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
query: {
|
||||||
|
eqCode: undefined,
|
||||||
|
eqName: undefined,
|
||||||
|
enabledStatus: undefined,
|
||||||
|
},
|
||||||
|
list: [],
|
||||||
|
listLoading: false,
|
||||||
|
multipleSelection: [],
|
||||||
|
total: 0,
|
||||||
|
listQuery: {
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
sort: "",
|
||||||
|
sidx: "",
|
||||||
|
},
|
||||||
|
formVisible: false,
|
||||||
|
detailVisible: false,
|
||||||
|
enabledStatusOptions: enabledStatusOptions,
|
||||||
|
enabledStatusProps: dictProps,
|
||||||
|
cycleUnitOptions: cycleUnitOptions,
|
||||||
|
cycleUnitProps: dictProps,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
jnpf() {
|
||||||
|
return jnpf
|
||||||
|
},
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.initData();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
initData() {
|
||||||
|
this.listLoading = true;
|
||||||
|
let _query = {
|
||||||
|
...this.listQuery,
|
||||||
|
...this.query,
|
||||||
|
dataType: 0,
|
||||||
|
};
|
||||||
|
Object.keys(_query).forEach(key => {
|
||||||
|
if (_query[key] === undefined || _query[key] === null || _query[key] === '') {
|
||||||
|
delete _query[key];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
getEqPatrolConfigList(_query).then((res) => {
|
||||||
|
console.log('response:', res);
|
||||||
|
console.log('list length:', res.data.list.length);
|
||||||
|
this.list = res.data.list || [];
|
||||||
|
this.total = res.data.pagination.total;
|
||||||
|
this.listLoading = false;
|
||||||
|
}).catch(() => {
|
||||||
|
this.listLoading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
search() {
|
||||||
|
this.listQuery.currentPage = 1;
|
||||||
|
this.initData();
|
||||||
|
},
|
||||||
|
reset() {
|
||||||
|
this.query = {
|
||||||
|
eqCode: undefined,
|
||||||
|
eqName: undefined,
|
||||||
|
enabledStatus: undefined,
|
||||||
|
};
|
||||||
|
this.search();
|
||||||
|
},
|
||||||
|
handleSelectionChange(val) {
|
||||||
|
this.multipleSelection = val;
|
||||||
|
},
|
||||||
|
detailHandle(row) {
|
||||||
|
this.$refs.detail.init(row.id);
|
||||||
|
},
|
||||||
|
addOrUpdateHandle(row) {
|
||||||
|
this.formVisible = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.JNPFForm.init(row ? row.id : '');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleDel(row) {
|
||||||
|
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
deleteEqPatrolConfig(row.id).then((res) => {
|
||||||
|
this.$message({
|
||||||
|
type: 'success',
|
||||||
|
message: '删除成功!'
|
||||||
|
});
|
||||||
|
this.initData();
|
||||||
|
});
|
||||||
|
}).catch(() => {
|
||||||
|
});
|
||||||
|
},
|
||||||
|
refresh() {
|
||||||
|
this.initData();
|
||||||
|
},
|
||||||
|
getLabel(type, value) {
|
||||||
|
return getLabel(type, value);
|
||||||
|
},
|
||||||
|
getCycleUnitLabel2(value) {
|
||||||
|
return this.getLabel('cycleUnit2', value);
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
</style>
|
||||||
@ -25,7 +25,11 @@
|
|||||||
{{ getEquipmentTypeLabel(scope.row.eqType) }}
|
{{ getEquipmentTypeLabel(scope.row.eqType) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="deptName" label="责任部门" align="center"/>
|
<el-table-column prop="eqStatus" label="设备状态" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ getEquipmentStatusLabel(scope.row.eqStatus) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize"
|
<pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize"
|
||||||
@pagination="initData" style="margin-top: 10px;"/>
|
@pagination="initData" style="margin-top: 10px;"/>
|
||||||
@ -119,6 +123,10 @@ export default {
|
|||||||
getEquipmentTypeLabel(value) {
|
getEquipmentTypeLabel(value) {
|
||||||
return getLabel('eqType', value);
|
return getLabel('eqType', value);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getEquipmentStatusLabel(value) {
|
||||||
|
return getLabel('eqStatus', value);
|
||||||
|
},
|
||||||
handleRowClick(row) {
|
handleRowClick(row) {
|
||||||
this.selectedId = row.id;
|
this.selectedId = row.id;
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user