点检方案反馈

This commit is contained in:
xusd 2024-11-01 13:42:42 +08:00
parent 5abebfbc30
commit cf80753f73
26 changed files with 748 additions and 79 deletions

View File

@ -97,6 +97,15 @@ public class InspectionPlanController {
return success(BeanUtils.toBean(list, InspectionPlanRespVO.class));
}
@GetMapping("/listHaveFeedback")
@Operation(summary = "获得点检方案列表(带反馈)")
@PreAuthorize("@ss.hasPermission('imt:inspection-plan:query')")
public CommonResult<List<InspectionPlanRespVO>> getInspectionPlanHaveFeedbackList(@Valid InspectionPlanListReqVO reqVO) {
List<InspectionPlanDO> list = inspectionPlanService.getInspectionPlanHaveFeedbackList(reqVO);
list.sort(Comparator.comparing(InspectionPlanDO::getSort));
return success(BeanUtils.toBean(list, InspectionPlanRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出点检方案 Excel")
@PreAuthorize("@ss.hasPermission('imt:inspection-plan:export')")

View File

@ -3,6 +3,8 @@ package com.inspur.module.system.controller.admin.inspection.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
/**
* @Author zhangjunwen
* @create 2024/10/23
@ -15,4 +17,10 @@ public class InspectionPlanListReqVO {
@Schema(description = "点检方案状态")
private Integer status;
@Schema(description = "点检方案ids")
private List<String> inspectionPlanIds;
@Schema(description = "点检工单id")
private String inspectionId;
}

View File

@ -53,4 +53,8 @@ public class InspectionPlanRespVO {
@Schema(description = "点检方案级别")
@ExcelProperty("点检方案级别")
private Integer level;
@Schema(description = "点检方案反馈")
@ExcelProperty("点检方案反馈")
private String feedBack;
}

View File

@ -13,4 +13,6 @@ public class EquipSelectionVO {
private String equipNo;
private String equipName;
}

View File

@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* 定制化点检反馈
@ -22,4 +23,15 @@ public class ExclusiveInspectionInfoFeedbackVO {
@NotBlank(message = "定制化点检反馈不能为空")
private String exclusiveInspectionFeedback;
@Schema(description = "是否关闭报警")
private Boolean closeAlarm;
@Schema(description = "报警id", example = "20802")
@NotBlank(message = "报警id不能为空")
private String alarmId;
@Schema(description = "状态")
@NotNull(message = "状态不能为空")
private Integer status;
}

View File

@ -1,10 +1,12 @@
package com.inspur.module.system.controller.inspection.vo;
import com.inspur.module.system.dal.dataobject.inspection.InspectionFeedbackDO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* 点检反馈
@ -22,8 +24,18 @@ public class InspectionInfoFeedbackVO {
@Schema(description = "点检方案补充")
private String inspectionPlanSupplement;
@Schema(description = "根据点检树点检是否通过")
@NotNull(message = "点检是否通过不能为空")
private Boolean isPass;
@Schema(description = "状态")
@NotNull(message = "状态不能为空")
private Integer status;
@Schema(description = "是否关闭报警")
private Boolean closeAlarm;
@Schema(description = "报警id", example = "20802")
@NotBlank(message = "报警id不能为空")
private String alarmId;
@Schema(description = "点检反馈")
private List<InspectionFeedbackDO> feedbackList;
}

View File

@ -24,14 +24,26 @@ public class InspectionInfoRespVO {
@ExcelProperty("设备id")
private String equipId;
@Schema(description = "设备名称", example = "23331")
@ExcelProperty("设备名称")
private String equipName;
@Schema(description = "客户id", example = "4797")
@ExcelProperty("客户id")
private String customerId;
@Schema(description = "客户名称", example = "4797")
@ExcelProperty("客户名称")
private String customerName;
@Schema(description = "点检方案id", example = "20275")
@ExcelProperty("点检方案id")
private String inspectionPlanId;
@Schema(description = "点检方案", example = "20275")
@ExcelProperty("点检方案")
private String inspectionPlanName;
@Schema(description = "报警id", example = "20275")
@ExcelProperty("报警id")
private String alarmId;

View File

@ -40,7 +40,4 @@ public class InspectionInfoSaveReqVO {
@Schema(description = "定制化点检反馈")
private String exclusiveInspectionFeedback;
@Schema(description = "是否关闭报警")
private Boolean closeAlarm;
}

View File

@ -0,0 +1,43 @@
package com.inspur.module.system.dal.dataobject.inspection;
import lombok.*;
import com.baomidou.mybatisplus.annotation.*;
import com.inspur.framework.mybatis.core.dataobject.BaseDO;
import java.util.List;
/**
* 点检方案反馈 DO
*
* @author 管理员
*/
@TableName("imt_inspection_feedback")
@KeySequence("imt_inspection_feedback_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class InspectionFeedbackDO {
/**
* 点检工单id
*/
@TableId(type = IdType.ASSIGN_UUID)
private String inspectionId;
/**
* 点检方案id
*/
private Long inspectionPlanId;
/**
* 点检反馈内容
*/
private String inspectionFeedbackContent;
/**
* 点检方案ids
*/
@TableField(exist = false)
private List<String> inspectionPlanIds;
}

View File

@ -74,4 +74,10 @@ public class InspectionInfoDO extends BaseDO {
*/
private Long tenantId;
@TableField(exist = false)
private String customerName;
@TableField(exist = false)
private String equipName;
@TableField(exist = false)
private String inspectionPlanName;
}

View File

@ -66,5 +66,9 @@ public class InspectionPlanDO extends BaseDO {
* 级别
*/
private Integer level;
/**
* 点检方案反馈
*/
@TableField(exist = false)
private String feedBack;
}

View File

@ -0,0 +1,19 @@
package com.inspur.module.system.dal.mysql.inspection;
import com.inspur.framework.mybatis.core.mapper.BaseMapperX;
import com.inspur.framework.tenant.core.aop.TenantIgnore;
import com.inspur.module.system.dal.dataobject.inspection.InspectionFeedbackDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 点检方案反馈 Mapper
*
* @author 管理员
*/
@Mapper
public interface InspectionFeedbackMapper extends BaseMapperX<InspectionFeedbackDO> {
@TenantIgnore
int deleteByInspectionId(@Param("inspectionId") String inspectionId);
}

View File

@ -6,7 +6,11 @@ package com.inspur.module.system.dal.mysql.inspection;
*/
import java.util.*;
import java.util.stream.Collectors;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.inspur.framework.common.pojo.PageResult;
import com.inspur.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.inspur.framework.mybatis.core.mapper.BaseMapperX;
@ -35,10 +39,22 @@ public interface InspectionPlanMapper extends BaseMapperX<InspectionPlanDO> {
}
default List<InspectionPlanDO> selectList(InspectionPlanListReqVO reqVO){
return selectList(new LambdaQueryWrapperX<InspectionPlanDO>()
.likeIfPresent(InspectionPlanDO::getInspectionName, reqVO.getInspectionName())
.eqIfPresent(InspectionPlanDO::getStatus, reqVO.getStatus())
);
LambdaQueryWrapper<InspectionPlanDO> queryWrapper = new LambdaQueryWrapperX<>();
if (StrUtil.isNotBlank(reqVO.getInspectionName())){
queryWrapper.like(InspectionPlanDO::getInspectionName, reqVO.getInspectionName());
}
if (Objects.nonNull(reqVO.getStatus())){
queryWrapper.eq(InspectionPlanDO::getStatus, reqVO.getStatus());
}
if (CollUtil.isNotEmpty(reqVO.getInspectionPlanIds())){
List<String> inspectionPlanIds = reqVO.getInspectionPlanIds();
// 构建 FIND_IN_SET OR 条件
String findInSetConditions = inspectionPlanIds.stream()
.map(id -> "FIND_IN_SET('" + id + "', ancestors)")
.collect(Collectors.joining(" OR "));
queryWrapper.and(i->i.in(InspectionPlanDO::getInspectionPlanId, reqVO.getInspectionPlanIds()).or().apply("(" + findInSetConditions + ")"));
}
return selectList(queryWrapper);
}
}

View File

@ -0,0 +1,43 @@
package com.inspur.module.system.service.inspection;
import com.inspur.module.system.dal.dataobject.inspection.InspectionFeedbackDO;
import java.util.List;
/**
* 点检方案反馈 Service 接口
*
* @author 管理员
*/
public interface InspectionFeedbackService {
/**
* 批量新增
*
* @Author xusd
* @Date 15:54 2024/10/30
* @param inspectionFeedbackDOList 新增数据
* @return java.lang.Boolean
*/
Boolean batchInsert(List<InspectionFeedbackDO> inspectionFeedbackDOList);
/**
* 根据点检工单ids删除
*
* @Author xusd
* @Date 15:54 2024/10/30
* @param inspectionId 点检工单id
* @return int
*/
int deleteByInspectionId(String inspectionId);
/**
* 根据工单id查询
*
* @Author xusd
* @Date 16:03 2024/10/30
* @param inspectionFeedbackDO 点检工单id
* @return java.util.List<com.inspur.module.system.dal.dataobject.inspection.InspectionFeedbackDO>
*/
List<InspectionFeedbackDO> selectList(InspectionFeedbackDO inspectionFeedbackDO);
}

View File

@ -0,0 +1,54 @@
package com.inspur.module.system.service.inspection;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.inspur.framework.tenant.core.aop.TenantIgnore;
import com.inspur.module.system.dal.dataobject.inspection.InspectionFeedbackDO;
import com.inspur.module.system.dal.mysql.inspection.InspectionFeedbackMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
/**
* 点检方案反馈 Service 实现类
*
* @author 管理员
*/
@Service
@Validated
public class InspectionFeedbackServiceImpl implements InspectionFeedbackService {
@Resource
private InspectionFeedbackMapper inspectionFeedbackMapper;
@Override
@TenantIgnore
public Boolean batchInsert(List<InspectionFeedbackDO> inspectionFeedbackDOList) {
return inspectionFeedbackMapper.insertBatch(inspectionFeedbackDOList);
}
@Override
public int deleteByInspectionId(String inspectionId) {
return inspectionFeedbackMapper.deleteByInspectionId(inspectionId);
}
@Override
@TenantIgnore
public List<InspectionFeedbackDO> selectList(InspectionFeedbackDO inspectionFeedbackDO) {
LambdaQueryWrapper<InspectionFeedbackDO> queryWrapper = new LambdaQueryWrapper<>();
if (Objects.nonNull(inspectionFeedbackDO.getInspectionId())){
queryWrapper.eq(InspectionFeedbackDO::getInspectionId, inspectionFeedbackDO.getInspectionId());
}
if (CollUtil.isNotEmpty(inspectionFeedbackDO.getInspectionPlanIds())){
queryWrapper.in(InspectionFeedbackDO::getInspectionPlanId, inspectionFeedbackDO.getInspectionPlanIds());
}
return inspectionFeedbackMapper.selectList(queryWrapper);
}
}

View File

@ -1,6 +1,7 @@
package com.inspur.module.system.service.inspection;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
@ -9,27 +10,31 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.inspur.framework.common.exception.ServiceException;
import com.inspur.framework.common.pojo.PageResult;
import com.inspur.framework.tenant.core.aop.TenantIgnore;
import com.inspur.module.system.controller.admin.inspection.vo.InspectionPlanListReqVO;
import com.inspur.module.system.controller.baseData.vo.CustomerInfoSelectionVO;
import com.inspur.module.system.controller.equip.vo.EquipSelectionVO;
import com.inspur.module.system.controller.inspection.vo.*;
import com.inspur.module.system.dal.dataobject.baseData.CustomerInfoDO;
import com.inspur.module.system.dal.dataobject.inspection.InspectionFeedbackDO;
import com.inspur.module.system.dal.dataobject.inspection.InspectionInfoDO;
import com.inspur.module.system.dal.dataobject.inspection.InspectionPlanDO;
import com.inspur.module.system.dal.dataobject.maintenance.MaintenanceOrderDO;
import com.inspur.module.system.dal.mysql.inspection.InspectionInfoMapper;
import com.inspur.module.system.service.alarm.AlarmDataService;
import com.inspur.module.system.service.baseData.CustomerInfoService;
import com.inspur.module.system.service.equip.EquipInfoService;
import com.inspur.module.system.service.maintenance.MaintenanceOrderService;
import org.aspectj.weaver.ast.Var;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import com.inspur.framework.common.util.object.BeanUtils;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
import static com.inspur.framework.common.exception.util.ServiceExceptionUtil.exception;
@ -56,6 +61,15 @@ public class InspectionInfoServiceImpl implements InspectionInfoService {
@Resource
private AlarmDataService alarmDataService;
@Resource
private InspectionFeedbackService inspectionFeedbackService;
@Resource
private EquipInfoService equipInfoService;
@Resource
private InspectionPlanService inspectionPlanService;
@Override
@TenantIgnore
public String createInspectionInfo(InspectionInfoSaveReqVO createReqVO) {
@ -82,18 +96,18 @@ public class InspectionInfoServiceImpl implements InspectionInfoService {
validateInspectionInfoExists(updateReqVO.getInspectionId());
// 更新
InspectionInfoDO updateObj = BeanUtils.toBean(updateReqVO, InspectionInfoDO.class);
if (updateReqVO.getCloseAlarm()) {
alarmDataService.closeAllAlarmDataByEquipAlarmId(updateObj.getAlarmId());
}
inspectionInfoMapper.updateById(updateObj);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteInspectionInfo(String id) {
// 校验存在
validateInspectionInfoExists(id);
// 删除
inspectionInfoMapper.deleteById(id);
//删除点检反馈关联表
inspectionFeedbackService.deleteByInspectionId(id);
}
private void validateInspectionInfoExists(String id) {
@ -110,27 +124,56 @@ public class InspectionInfoServiceImpl implements InspectionInfoService {
@Override
public PageResult<InspectionInfoDO> getInspectionInfoPage(InspectionInfoPageReqVO pageReqVO) {
return inspectionInfoMapper.selectPage(pageReqVO);
PageResult<InspectionInfoDO> page = inspectionInfoMapper.selectPage(pageReqVO);
List<InspectionInfoDO> list = page.getList();
if (CollUtil.isNotEmpty(list)){
List<CustomerInfoSelectionVO> customerList = customerInfoService.selection(true);
Map<String, String> customerListMap = customerList.stream().collect(Collectors.toMap(CustomerInfoSelectionVO::getCustomerId, CustomerInfoSelectionVO::getCustomerName));
List<EquipSelectionVO> equipList = equipInfoService.selection();
Map<String, String> equipMap = equipList.stream().collect(Collectors.toMap(EquipSelectionVO::getEquipId, EquipSelectionVO::getEquipName));
List<InspectionPlanDO> inspectionPlanList = inspectionPlanService.getInspectionPlanList(new InspectionPlanListReqVO());
Map<Long, String> inspectionPlanMap = inspectionPlanList.stream().collect(Collectors.toMap(InspectionPlanDO::getInspectionPlanId, InspectionPlanDO::getInspectionName));
list.forEach(item->{
item.setCustomerName(customerListMap.get(item.getCustomerId()));
item.setEquipName(equipMap.get(item.getEquipId()));
if (StrUtil.isNotBlank(item.getInspectionPlanId())){
String[] split = item.getInspectionPlanId().split(",");
List<String> inspectionPlanNameList = new ArrayList<>();
for (String s : split) {
inspectionPlanNameList.add(inspectionPlanMap.get(Long.parseLong(s)));
}
if (CollUtil.isNotEmpty(inspectionPlanNameList)){
item.setInspectionPlanName(CollUtil.join(inspectionPlanNameList,","));
}
}
});
}
return page;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean inspectionFeedback(InspectionInfoFeedbackVO vo) {
InspectionInfoDO inspectionInfoDO = new InspectionInfoDO();
inspectionInfoDO.setInspectionId(vo.getInspectionId());
inspectionInfoDO.setInspectionPlanSupplement(vo.getInspectionPlanSupplement());
//通过
if (vo.getIsPass()) {
inspectionInfoDO.setStatus(2);
} else {
inspectionInfoDO.setStatus(1);
}
InspectionInfoDO inspectionInfoDO = BeanUtils.toBean(vo, InspectionInfoDO.class);
int i = inspectionInfoMapper.updateById(inspectionInfoDO);
if (vo.getCloseAlarm()) {
alarmDataService.closeAllAlarmDataByEquipAlarmId(vo.getAlarmId());
}
//点检树新增
if (CollUtil.isNotEmpty(vo.getFeedbackList())){
List<InspectionFeedbackDO> feedbackList = vo.getFeedbackList();
feedbackList.forEach(item->item.setInspectionId(vo.getInspectionId()));
inspectionFeedbackService.batchInsert(feedbackList);
}
return i > 0;
}
@Override
public Boolean exclusiveInspectionFeedback(ExclusiveInspectionInfoFeedbackVO vo) {
InspectionInfoDO inspectionInfoDO = BeanUtils.toBean(vo, InspectionInfoDO.class);
if (vo.getCloseAlarm()) {
alarmDataService.closeAllAlarmDataByEquipAlarmId(vo.getAlarmId());
}
return inspectionInfoMapper.updateById(inspectionInfoDO) > 0;
}

View File

@ -67,4 +67,14 @@ public interface InspectionPlanService {
* 获取点检方案列表
*/
List<InspectionPlanDO> getInspectionPlanList(InspectionPlanListReqVO reqVO);
/**
* 获得点检方案列表带反馈
*
* @Author xusd
* @Date 15:31 2024/10/31
* @param reqVO 请求参数
* @return java.util.List<com.inspur.module.system.dal.dataobject.inspection.InspectionPlanDO>
*/
List<InspectionPlanDO> getInspectionPlanHaveFeedbackList(InspectionPlanListReqVO reqVO);
}

View File

@ -5,8 +5,11 @@ package com.inspur.module.system.service.inspection;
* @create 2024/10/21
*/
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.inspur.framework.tenant.core.aop.TenantIgnore;
import com.inspur.module.system.dal.dataobject.inspection.InspectionFeedbackDO;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -15,6 +18,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.stream.Collectors;
import com.inspur.module.system.controller.admin.inspection.vo.*;
import com.inspur.module.system.dal.dataobject.inspection.InspectionPlanDO;
@ -39,6 +43,9 @@ public class InspectionPlanServiceImpl implements InspectionPlanService {
@Resource
private InspectionPlanMapper inspectionPlanMapper;
@Resource
private InspectionFeedbackService inspectionFeedbackService;
@Override
public Long createInspectionPlan(InspectionPlanSaveReqVO createReqVO) {
// 插入
@ -106,4 +113,18 @@ public class InspectionPlanServiceImpl implements InspectionPlanService {
public List<InspectionPlanDO> getInspectionPlanList(InspectionPlanListReqVO reqVO){
return inspectionPlanMapper.selectList(reqVO);
}
@Override
public List<InspectionPlanDO> getInspectionPlanHaveFeedbackList(InspectionPlanListReqVO reqVO) {
List<InspectionPlanDO> inspectionPlanDOS = inspectionPlanMapper.selectList(reqVO);
if (CollUtil.isNotEmpty(inspectionPlanDOS) && CollUtil.isNotEmpty(reqVO.getInspectionPlanIds())){
List<InspectionFeedbackDO> feedbackList = inspectionFeedbackService.selectList(new InspectionFeedbackDO()
.setInspectionId(reqVO.getInspectionId()));
if (CollUtil.isNotEmpty(feedbackList)){
Map<Long, String> feedbackMap = feedbackList.stream().collect(Collectors.toMap(InspectionFeedbackDO::getInspectionPlanId, InspectionFeedbackDO::getInspectionFeedbackContent));
inspectionPlanDOS.forEach(item-> item.setFeedBack(feedbackMap.get(item.getInspectionPlanId())));
}
}
return inspectionPlanDOS;
}
}

View File

@ -135,8 +135,6 @@ public class MaintenanceOrderServiceImpl implements MaintenanceOrderService {
InspectionInfoSaveReqVO inspectionInfoSaveReqVO = new InspectionInfoSaveReqVO();
inspectionInfoSaveReqVO.setInspectionId(createReqVO.getInspectionId());
inspectionInfoSaveReqVO.setStatus(3);
//是否关闭报警
inspectionInfoSaveReqVO.setCloseAlarm(false);
InspectionInfoServiceImpl inspectionInfoService = SpringUtils.getBean(InspectionInfoServiceImpl.class);
inspectionInfoService.updateInspectionInfo(inspectionInfoSaveReqVO);
}

View File

@ -0,0 +1,10 @@
<?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.inspur.module.system.dal.mysql.inspection.InspectionFeedbackMapper">
<delete id="deleteByInspectionId">
delete from imt_inspection_feedback
where inspection_id = #{inspectionId}
</delete>
</mapper>

View File

@ -68,3 +68,12 @@ export function getInspectionPlanList(params) {
params,
});
}
// 获得点检方案列表(带反馈)
export function getInspectionPlanListHaveFeedback(params) {
return request({
url: "/imt/inspection-plan/listHaveFeedback",
method: "get",
params,
});
}

View File

@ -63,9 +63,9 @@
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="点检单号" align="center" prop="inspectionNo"/>
<el-table-column label="设备" align="center" prop="equipId"/>
<el-table-column label="客户" align="center" prop="customerId"/>
<el-table-column label="点检方案" align="center" prop="inspectionPlanId"/>
<el-table-column label="设备" align="center" prop="equipName"/>
<el-table-column label="客户" align="center" prop="customerName"/>
<el-table-column label="点检方案" align="center" prop="inspectionPlanName"/>
<el-table-column label="定制化点检方案" align="center" prop="exclusiveInspection"/>
<el-table-column label="状态" align="center" prop="status">
<template v-slot="scope">
@ -89,7 +89,7 @@
<el-button v-if="scope.row.status === 2" size="mini" type="text" icon="el-icon-tickets" @click="exclusiveInspectionFeedback(scope.row)"
v-hasPermi="['imt:inspection-info:exclusiveInspectionFeedback']">定制化点检反馈
</el-button>
<el-button v-if="scope.row.status === 3 || scope.row.status === 0" size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['imt:inspection-info:delete']">删除
</el-button>
</template>
@ -104,8 +104,28 @@
<!-- 点检树点检反馈 -->
<el-dialog :title="inspectionFeedbackTitle" :visible.sync="inspectionFeedbackVisible" width="45%" v-dialogDrag append-to-body>
<el-form ref="inspectionFeedbackRef" :model="inspectionFeedbackData" :rules="inspectionFeedbackRules" v-loading="inspectionFeedbackLoading" label-width="100px">
<el-form-item label="点检方案id" prop="inspectionPlanId">
{{ inspectionFeedbackData.inspectionPlanId }}
<el-form-item label="点检方案:" prop="inspectionPlanId">
<div
v-for="(tree,index) in treeData"
:key="tree.inspectionPlanId"
:label="tree.inspectionPlanId"
>
<div
class="component-wrapper"
style="margin:0 3%;"
>
<vue-okr-tree
class="custom-tree"
:data="objToList(tree)"
node-key="nodeId"
direction="horizontal"
:props="props"
show-collapsable
default-expand-all
:isClickInput="true"
></vue-okr-tree>
</div>
</div>
</el-form-item>
<el-form-item label="是否解决:" prop="inspectionFeedbackStatus">
<el-radio-group v-model="inspectionFeedbackData.inspectionFeedbackStatus">
@ -113,7 +133,7 @@
<el-radio :label="1"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="点检方案补充" prop="inspectionPlanSupplement">
<el-form-item label="点检方案补充" prop="inspectionPlanSupplement">
<el-input v-model="inspectionFeedbackData.inspectionPlanSupplement" :rows="4" type="textarea" placeholder="请输入内容"/>
</el-form-item>
<div style="text-align: right">
@ -125,9 +145,9 @@
<!-- 定制化点检反馈 -->
<el-dialog :title="exclusiveInspectionFeedbackTitle" :visible.sync="exclusiveInspectionFeedbackVisible" width="45%" v-dialogDrag append-to-body>
<el-form ref="exclusiveInspectionFeedbackRef" :model="exclusiveInspectionFeedbackData" :rules="exclusiveInspectionFeedbackRules" v-loading="exclusiveInspectionFeedbackLoading" label-width="100px">
<el-form-item label="点检方案id" prop="inspectionPlanId">
{{ exclusiveInspectionFeedbackData.inspectionPlanId }}
<el-form ref="exclusiveInspectionFeedbackRef" :model="exclusiveInspectionFeedbackData" :rules="exclusiveInspectionFeedbackRules" v-loading="exclusiveInspectionFeedbackLoading" label-width="140px">
<el-form-item label="点检方案" prop="inspectionPlanId">
<inspection-plan-feedback-tree ref="inspectionPlanFeedbackTree" :inspection-id="inspectionId" :inspection-plan-ids="inspectionPlanIds"/>
</el-form-item>
<el-form-item label="点检方案补充:" prop="inspectionPlanSupplement">
{{ exclusiveInspectionFeedbackData.inspectionPlanSupplement }}
@ -141,7 +161,7 @@
<el-radio :label="1"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="定制化点检反馈" prop="exclusiveInspectionFeedback">
<el-form-item label="定制化点检反馈" prop="exclusiveInspectionFeedback">
<el-input v-model="exclusiveInspectionFeedbackData.exclusiveInspectionFeedback" :rows="4" type="textarea" placeholder="请输入内容"/>
</el-form-item>
<div style="text-align: right">
@ -159,14 +179,28 @@ import InspectionInfoForm from './InspectionInfoForm.vue';
import {getEquipCascader} from "@/api/system/equip/equipInfo";
import {getCustomerSelection} from "@/api/system/baseData/customerInfo";
import {DICT_TYPE, getDictDatas} from "@/utils/dict";
import * as InspectionPlanApi from "@/api/system/inspection/plan";
import {VueOkrTree} from "@/components/VueOkrTree";
import Vue from "vue";
import inspectionPlanFeedbackTree from "@/views/system/inspectionPlan/inspectionPlanFeedbackTree.vue"
export default {
name: "InspectionInfo",
components: {
VueOkrTree,
InspectionInfoForm,
inspectionPlanFeedbackTree
},
data() {
return {
inspectionPlanIds:null,
inspectionId:null,
feedbackList:[],
eventBus: new Vue(),
treeData:[],
props: {
label: "inspectionName",
},
inspectionStatusList:[],
exclusiveInspectionFeedbackTitle:"定制化点检反馈",
exclusiveInspectionFeedbackVisible:false,
@ -220,16 +254,24 @@ export default {
},
};
},
provide() {
return {
eventBus: this.eventBus,
};
},
created() {
this.getList();
this.initSelection();
},
methods: {
objToList(obj) {
return [obj];
},
async submitExclusiveInspectionFeedback(){
await this.$refs.exclusiveInspectionFeedbackRef.validate();
this.exclusiveInspectionFeedbackData.status = this.exclusiveInspectionFeedbackData.inspectionFeedbackStatus;
this.exclusiveInspectionFeedbackData.closeAlarm = this.exclusiveInspectionFeedbackData.status === 3;
await InspectionInfoApi.updateInspectionInfo(this.exclusiveInspectionFeedbackData).then(res=>{
await InspectionInfoApi.exclusiveInspectionFeedback(this.exclusiveInspectionFeedbackData).then(res=>{
this.$modal.msgSuccess("提交成功");
this.exclusiveInspectionFeedbackVisible = false;
this.getList();
@ -239,29 +281,74 @@ export default {
await this.$refs.inspectionFeedbackRef.validate();
this.inspectionFeedbackData.status = this.inspectionFeedbackData.inspectionFeedbackStatus;
this.inspectionFeedbackData.closeAlarm = this.inspectionFeedbackData.status === 3;
await InspectionInfoApi.updateInspectionInfo(this.inspectionFeedbackData).then(res=>{
this.inspectionFeedbackData.feedbackList = this.feedbackList;
await InspectionInfoApi.inspectionFeedback(this.inspectionFeedbackData).then(res=>{
this.$modal.msgSuccess("提交成功");
this.inspectionFeedbackVisible = false;
this.getList();
})
},
inspectionFeedback(row){
async inspectionFeedback(row){
this.feedbackList = [];
this.treeData = [];
this.inspectionFeedbackVisible = true;
this.inspectionFeedbackData = {};
this.inspectionFeedbackLoading = true;
InspectionInfoApi.getInspectionInfo(row.inspectionId).then(res=>{
await InspectionInfoApi.getInspectionInfo(row.inspectionId).then(res=>{
this.inspectionFeedbackData = res.data;
this.inspectionFeedbackLoading = false;
})
const data = {
inspectionPlanIds: this.inspectionFeedbackData.inspectionPlanId.split(',')
}
await InspectionPlanApi.getInspectionPlanList(data).then(res=>{
this.treeData = this.handleTree(
res.data,
"inspectionPlanId",
"parentInspectionId"
);
});
this.eventBus.$on("inputCompleted", this.handleGlobalInputCompleted);
},
exclusiveInspectionFeedback(row){
handleGlobalInputCompleted({ node, inputValue }) {
//
console.log("全局节点信息:", node);
console.log("全局输入值:", inputValue);
//
if (this.feedbackList.length > 0) {
const obj = this.feedbackList.find(item => item.inspectionPlanId === node.data.inspectionPlanId);
if (obj != null){
this.feedbackList.map(item => {
if (item.inspectionPlanId === node.data.inspectionPlanId) {
item.inspectionFeedbackContent = inputValue;
}
});
}else {
let data = {
inspectionFeedbackContent: inputValue,
inspectionPlanId: node.data.inspectionPlanId
}
this.feedbackList.push(data);
}
} else {
let data = {
inspectionFeedbackContent: inputValue,
inspectionPlanId: node.data.inspectionPlanId
}
this.feedbackList.push(data);
}
},
async exclusiveInspectionFeedback(row){
this.exclusiveInspectionFeedbackVisible = true;
this.exclusiveInspectionFeedbackData = {};
this.exclusiveInspectionFeedbackLoading = true;
InspectionInfoApi.getInspectionInfo(row.inspectionId).then(res=>{
await InspectionInfoApi.getInspectionInfo(row.inspectionId).then(res=>{
this.exclusiveInspectionFeedbackData = res.data;
this.inspectionPlanIds = this.exclusiveInspectionFeedbackData.inspectionPlanId.split(',')
this.inspectionId = row.inspectionId;
this.exclusiveInspectionFeedbackLoading = false;
})
await this.$refs.inspectionPlanFeedbackTree.initTree();
},
initSelection(){
getCustomerSelection().then((res) => {

View File

@ -0,0 +1,117 @@
<template>
<div>
<div
v-for="(tree,index) in treeData"
:key="tree.inspectionPlanId"
:label="tree.inspectionPlanId"
>
<div
class="component-wrapper"
style="margin:0 3%;"
>
<vue-okr-tree
class="custom-tree"
:data="objToList(tree)"
node-key="nodeId"
direction="horizontal"
:props="props"
show-collapsable
:default-expand-all="false"
:isClickInput="false"
:render-content="renderContent"
>
</vue-okr-tree>
</div>
</div>
</div>
</template>
<script>
import {VueOkrTree} from "@/components/VueOkrTree";
import Vue from "vue";
import * as InspectionPlanApi from "@/api/system/inspection/plan";
export default {
name: "inspectionPlanFeedbackTree",
components: {VueOkrTree},
props: ['inspectionPlanIds','inspectionId'],
data() {
return {
eventBus: new Vue(),
treeData: [],
props: {
label: "inspectionName",
},
}
},
provide() {
return {
eventBus: this.eventBus,
};
},
created() {
this.initTree();
},
methods: {
initTree() {
//
const data = {
inspectionId: this.inspectionId,
inspectionPlanIds: this.inspectionPlanIds
}
InspectionPlanApi.getInspectionPlanListHaveFeedback(data).then(res => {
this.treeData = this.handleTree(
res.data,
"inspectionPlanId",
"parentInspectionId"
);
});
},
objToList(obj) {
return [obj];
},
renderContent(h, node) {
const title = h("div", { class: "title" }, [node.data.inspectionName]);
//
if (node.childNodes.length > 0){
return h("div", { class: "node-content" }, [title]);
}
//
const feedbackPrefix = h(
"span",
{
style: { color: "blue", fontWeight: "bold" }, // 使
class: "feedback-prefix",
},
["反馈:"]
);
//
const feedbackText = h(
"span",
{
style: {
whiteSpace: "nowrap",
overflow: "hidden",
textOverflow: "ellipsis",
},
domProps: { title: `反馈:${node.data.feedBack}` },
},
[node.data.feedBack]
);
//
const feedback = h("div", { class: "feedback" }, [
feedbackPrefix,
feedbackText,
]);
//
return h("div", { class: "node-content" }, [title, h("hr"), feedback]);
},
}
}
</script>

View File

@ -4,7 +4,7 @@
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="45%" v-dialogDrag append-to-body>
<el-card class="box-card">
<div slot="header"><span>报警信息</span></div>
<el-form ref="alarmForm" :model="alarmFormData" v-loading="alarmFormLoading" label-width="160px">
<el-form ref="alarmForm" :model="alarmFormData" v-loading="alarmFormLoading" label-width="140px">
<el-row>
<el-col :span="12">
<el-form-item label="机床设备编号:" prop="equipNo">
@ -64,9 +64,9 @@
</el-card>
<el-card class="box-card" style="margin-top: 20px">
<div slot="header"><span>点检工单信息</span></div>
<el-form ref="submitForm" :model="inspectionInfo" v-loading="inspectionInfoLoading" label-width="120px">
<el-form-item label="点检方案id" prop="inspectionPlanId">
{{ inspectionInfo.inspectionPlanId }}
<el-form ref="submitForm" :model="inspectionInfo" v-loading="inspectionInfoLoading" label-width="140px">
<el-form-item label="点检方案" prop="inspectionPlanId">
<inspection-plan-feedback-tree ref="inspectionPlanFeedbackTree" :inspectionPlanIds="inspectionPlanIds" :inspectionId = "inspectionId"/>
</el-form-item>
<el-form-item label="点检方案补充:" prop="inspectionPlanSupplement">
{{ inspectionInfo.inspectionPlanSupplement }}
@ -75,7 +75,7 @@
</el-card>
<el-card class="box-card" style="margin-top: 20px">
<div slot="header"><span>定制化点检</span></div>
<el-form ref="submitForm" :model="submitFormData" v-loading="submitFormLoading" :rules="submitFormRules" label-width="100px">
<el-form ref="submitForm" :model="submitFormData" v-loading="submitFormLoading" :rules="submitFormRules" label-width="140px">
<el-form-item label="定制化点检方案" prop="exclusiveInspection">
<el-input v-model="submitFormData.exclusiveInspection" :rows="4" type="textarea" placeholder="请输入内容"/>
</el-form-item>
@ -93,11 +93,15 @@
import {getSubmitOrderDetails} from '@/api/system/alarm/equipalarmdata'
import {parseTime} from "../../../../utils/ruoyi";
import * as inspectionInfoApi from "@/api/system/inspection/inspectionInfo";
import inspectionPlanFeedbackTree from "@/views/system/inspectionPlan/inspectionPlanFeedbackTree.vue"
export default {
name: "alarmSubmitMaintenanceOrderForm",
components:{inspectionPlanFeedbackTree},
data() {
return {
inspectionId: null,
inspectionPlanIds:null,
inspectionInfo:{},
dialogTitle: "点检工单提交",
dialogVisible: false,
@ -113,15 +117,17 @@ export default {
},
methods: {
parseTime,
open(inspectionId) {
async open(inspectionId) {
this.alarmFormData = {};
this.submitFormData = {};
this.inspectionInfo = {};
this.alarmFormLoading = true
this.submitFormLoading = true;
this.inspectionInfoLoading = true;
inspectionInfoApi.getInspectionInfo(inspectionId).then(res=>{
await inspectionInfoApi.getInspectionInfo(inspectionId).then(res=>{
this.inspectionInfo = res.data;
this.inspectionId = this.inspectionInfo.inspectionId
this.inspectionPlanIds = this.inspectionInfo.inspectionPlanId.split(',')
//
getSubmitOrderDetails(this.inspectionInfo.alarmId).then(res=>{
console.log(res);
@ -136,6 +142,7 @@ export default {
this.inspectionInfoLoading = false;
})
})
await this.$refs.inspectionPlanFeedbackTree.initTree();
},
async submitOrder(){
this.submitFormLoading = true;

View File

@ -64,16 +64,80 @@
</el-card>
<el-card class="box-card" style="margin-top: 20px">
<div slot="header"><span>点检工单信息</span></div>
<el-form ref="submitForm" :model="submitFormData" v-loading="submitFormLoading" :rules="submitFormRules" label-width="100px">
<el-form-item label="点检树id" prop="inspectionPlanId">
<el-input v-model="submitFormData.inspectionPlanId" placeholder="请输入点检树id"/>
</el-form-item>
<div style="text-align: right">
<el-button type="primary" @click="submitOrder" > </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</div>
<el-form ref="submitForm" :model="submitFormData" v-loading="submitFormLoading" :rules="submitFormRules"
label-width="100px">
<el-col :span="20">
<el-form-item
label="点检方案"
prop="inspectionPlanId"
>
<el-input
v-model="submitFormData.inspectionPlanName"
:disabled="true"
placeholder="请选择点检方案"
/>
</el-form-item>
</el-col>
<el-col :span="2"> <el-button
type="primary"
@click="handleSelectInspectionPlan"
>
选择点检方案
</el-button></el-col>
</el-form>
</el-card>
<div slot="footer"
class="dialog-footer">
<el-button type="primary" @click="submitOrder"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</div>
</el-dialog>
<!-- 对话框(选择点检树) -->
<el-dialog :title="inspectionPlanTitle" :visible.sync="inspectionPlanVisible" width="45%" v-dialogDrag
append-to-body>
<div v-loading="inspectionPlanLoading">
<el-checkbox-group
v-model="inspectionPlanList"
@change="selectedInspectionPlanTreeChange"
>
<el-checkbox
v-for="(tree,index) in inspectionPlanTreeData"
:key="tree.inspectionPlanId"
:label="tree.inspectionPlanId"
style="display:flex;align-items:center"
>
<div
class="component-wrapper"
style="margin:0 3%;"
>
<vue-okr-tree
class="custom-tree"
:data="objToList(tree)"
node-key="nodeId"
direction="horizontal"
:props="props"
show-collapsable
default-expand-all
></vue-okr-tree>
</div>
</el-checkbox>
</el-checkbox-group>
</div>
<div
slot="footer"
class="dialog-footer"
>
<el-button
type="primary"
@click="submitSelectInspectionPlan"
>
</el-button>
<el-button @click="inspectionPlanVisible = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
@ -82,24 +146,76 @@
import {getSubmitOrderDetails} from '@/api/system/alarm/equipalarmdata'
import {parseTime} from "../../../../utils/ruoyi";
import * as InspectionInfoApi from "@/api/system/inspection/inspectionInfo";
import {VueOkrTree} from "@/components/VueOkrTree";
import * as InspectionPlanApi from "@/api/system/inspection/plan";
import Vue from "vue";
export default {
name: "alarmSubmitMaintenanceOrderForm",
components: {VueOkrTree},
data() {
return {
eventBus: new Vue(),
props: {
label: "inspectionName",
},
inspectionPlanLoading:false,
inspectionPlanTreeData:[],
inspectionPlanList:[],
inspectionPlanTitle:"选择点检方案",
inspectionPlanVisible:false,
dialogTitle: "点检工单提交",
dialogVisible: false,
alarmFormData:{},
alarmFormLoading:false,
submitFormData:{},
submitFormLoading:false,
submitFormRules:{
patrolPlan: [{ required: true, message: '点检方案不能为空', trigger: 'blur' }]
}
submitFormRules: {
inspectionPlanId: [
{ required: true, message: "点检方案不能为空", trigger: "blur" },
],
},
}
},
provide() {
return {
eventBus: this.eventBus,
};
},
methods: {
parseTime,
selectedInspectionPlanTreeChange(){
console.log("选择:", this.inspectionPlanList);
},
objToList(obj){
return [obj];
},
async handleSelectInspectionPlan(){
this.inspectionPlanVisible = true;
this.inspectionPlanLoading = true;
this.inspectionPlanTreeData = [];
this.inspectionPlanList = [];
try {
const res = await InspectionPlanApi.getInspectionPlanList();
this.inspectionPlanTreeData = this.handleTree(
res.data,
"inspectionPlanId",
"parentInspectionId"
);
console.log("treeData:", this.inspectionPlanTreeData);
} finally {
this.inspectionPlanLoading = false;
}
},
submitSelectInspectionPlan(){
if (this.inspectionPlanList.length === 0){
this.$message.error("请至少选择一个点检方案");
}else {
this.submitFormData.inspectionPlanId = this.inspectionPlanList.join(',');
this.submitFormData.inspectionPlanName = this.inspectionPlanTreeData.filter(item=>this.inspectionPlanList.includes(item.inspectionPlanId)).map(item=>item.inspectionName).join(',')
this.inspectionPlanVisible = false;
}
},
open(alarmId) {
this.alarmFormData = {};
this.submitFormData = {};
@ -118,17 +234,21 @@ export default {
})
},
async submitOrder(){
console.log(this.submitFormData);
this.submitFormLoading = true;
await this.$refs.submitForm.validate();
this.submitFormData.equipId = this.alarmFormData.equipId;
this.submitFormData.customerId = this.alarmFormData.customerId;
this.submitFormData.alarmId = this.alarmFormData.equipAlarmId;
this.submitFormData.status = 0;
await InspectionInfoApi.createInspectionInfo(this.submitFormData)
this.$modal.msgSuccess("提交成功");
this.$emit('child-event');
this.dialogVisible = false;
this.submitFormLoading = false;
try {
// await this.$refs.submitForm.validate();
this.submitFormData.equipId = this.alarmFormData.equipId;
this.submitFormData.customerId = this.alarmFormData.customerId;
this.submitFormData.alarmId = this.alarmFormData.equipAlarmId;
this.submitFormData.status = 0;
await InspectionInfoApi.createInspectionInfo(this.submitFormData)
this.$modal.msgSuccess("提交成功");
this.$emit('child-event');
this.dialogVisible = false;
}finally {
this.submitFormLoading = false;
}
},
},
}

View File

@ -65,8 +65,8 @@
<el-card class="box-card" style="margin-top: 20px">
<div slot="header"><span>点检工单信息</span></div>
<el-form ref="submitForm" :model="inspectionInfo" v-loading="inspectionInfoLoading" label-width="140px">
<el-form-item label="点检方案id" prop="inspectionPlanId">
{{ inspectionInfo.inspectionPlanId }}
<el-form-item label="点检方案" prop="inspectionPlanId">
<inspection-plan-feedback-tree ref="inspectionPlanFeedbackTree" :inspection-id="inspectionId" :inspection-plan-ids="inspectionPlanIds"/>
</el-form-item>
<el-form-item label="点检方案补充:" prop="inspectionPlanSupplement">
{{ inspectionInfo.inspectionPlanSupplement }}
@ -118,11 +118,15 @@ import {getSubmitOrderDetails} from '@/api/system/alarm/equipalarmdata'
import {parseTime} from "../../../../utils/ruoyi";
import * as MaintenanceOrderApi from "@/api/system/maintenance/maintenance";
import * as inspectionInfoApi from "@/api/system/inspection/inspectionInfo";
import inspectionPlanFeedbackTree from "@/views/system/inspectionPlan/inspectionPlanFeedbackTree.vue"
export default {
name: "alarmSubmitMaintenanceOrderForm",
components: {inspectionPlanFeedbackTree},
data() {
return {
inspectionPlanIds:null,
inspectionInfoLoading:false,
inspectionId:null,
inspectionInfo:{},
orderId: null,
@ -140,13 +144,14 @@ export default {
},
methods: {
parseTime,
open(inspectionId) {
async open(inspectionId) {
this.inspectionId = inspectionId;
this.inspectionInfo = {};
this.alarmFormData = {};
this.submitFormData = {};
inspectionInfoApi.getInspectionInfo(inspectionId).then(res=>{
await inspectionInfoApi.getInspectionInfo(inspectionId).then(res=>{
this.inspectionInfo = res.data;
this.inspectionPlanIds = this.inspectionInfo.inspectionPlanId.split(',')
//
getSubmitOrderDetails(this.inspectionInfo.alarmId).then(res=>{
console.log(res);
@ -161,6 +166,7 @@ export default {
this.inspectionInfoLoading = false;
})
})
await this.$refs.inspectionPlanFeedbackTree.initTree();
},
async submitOrder(){
this.submitFormLoading = true;