Compare commits

..

5 Commits

Author SHA1 Message Date
67d28f7018 Merge branch 'zjw' 2024-09-06 08:36:29 +08:00
10bd09b8a6 维修工单记录详情查看维修报告 2024-09-05 17:54:14 +08:00
d343ed6486 维修工单报告模块修改 2024-09-05 17:35:02 +08:00
5b7ddf0704 维修工单报告模块 2024-09-05 17:14:41 +08:00
c15bc190d4 维修工单记录 2024-09-05 16:40:58 +08:00
24 changed files with 1348 additions and 8 deletions

View File

@ -175,6 +175,7 @@ public interface ErrorCodeConstants {
// ========== 维修管理 ==========
ErrorCode REMOTE_MAINTENANCE_ORDER_NOT_EXISTS = new ErrorCode(1_002_028_000, "未获取到维修工单信息");
ErrorCode MAINTENANCE_REPORT_NOT_EXISTS = new ErrorCode(1_002_028_000, "未获取到维修报告信息");
// ========== 设备管理模块 ==========
ErrorCode GATEWAY_INFO_NOT_EXISTS = new ErrorCode(1_002_029_000, "机床网关信息不存在");

View File

@ -2,6 +2,7 @@ package com.inspur.module.system.controller.maintenance;
import com.inspur.framework.common.pojo.PageResult;
import com.inspur.module.system.controller.maintenance.vo.MaintenanceOrderPageReqVO;
import com.inspur.module.system.controller.maintenance.vo.MaintenanceOrderRecordsPageReqVO;
import com.inspur.module.system.controller.maintenance.vo.MaintenanceOrderRespVO;
import com.inspur.module.system.controller.maintenance.vo.MaintenanceOrderSaveReqVO;
import com.inspur.module.system.dal.dataobject.maintenance.MaintenanceOrderDO;
@ -91,4 +92,20 @@ public class MaintenanceOrderController {
BeanUtils.toBean(list, MaintenanceOrderRespVO.class));
}
@GetMapping("/report/page")
@Operation(summary = "获得维修工单记录分页")
@PreAuthorize("@ss.hasPermission('imt:remote-maintenance-order-record:query')")
public CommonResult<PageResult<MaintenanceOrderRespVO>> getRemoteMaintenanceOrderReportPage(@Valid MaintenanceOrderRecordsPageReqVO pageReqVO) {
PageResult<MaintenanceOrderDO> pageResult = maintenanceOrderService.getRemoteMaintenanceOrderReportPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, MaintenanceOrderRespVO.class));
}
@GetMapping("/get/record")
@Operation(summary = "获得维修工单记录详情")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('imt:remote-maintenance-order-record:query')")
public CommonResult<MaintenanceOrderRespVO> getRemoteMaintenanceOrderRecord(@RequestParam("id") String id) {
return success(maintenanceOrderService.getRemoteMaintenanceOrderRecord(id));
}
}

View File

@ -0,0 +1,91 @@
package com.inspur.module.system.controller.maintenance;
import com.inspur.framework.common.pojo.PageResult;
import com.inspur.module.system.controller.maintenance.vo.MaintenanceReportPageReqVO;
import com.inspur.module.system.controller.maintenance.vo.MaintenanceReportRespVO;
import com.inspur.module.system.controller.maintenance.vo.MaintenanceReportSaveReqVO;
import com.inspur.module.system.dal.dataobject.maintenance.MaintenanceReportDO;
import com.inspur.module.system.service.maintenance.MaintenanceReportService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.*;
import javax.servlet.http.*;
import java.io.IOException;
import java.util.List;
import com.inspur.framework.common.pojo.PageParam;
import com.inspur.framework.common.pojo.CommonResult;
import com.inspur.framework.common.util.object.BeanUtils;
import static com.inspur.framework.common.pojo.CommonResult.success;
import com.inspur.framework.excel.core.util.ExcelUtils;
import com.inspur.framework.apilog.core.annotation.ApiAccessLog;
import static com.inspur.framework.apilog.core.enums.OperateTypeEnum.*;
@Tag(name = "管理后台 - 维修报告")
@RestController
@RequestMapping("/admin-api/maintenance/report")
@Validated
public class MaintenanceReportController {
@Resource
private MaintenanceReportService maintenanceReportService;
@PostMapping("/create")
@Operation(summary = "创建维修报告")
public CommonResult<String> createMaintenanceReport(@Valid @RequestBody MaintenanceReportSaveReqVO createReqVO) {
return success(maintenanceReportService.createMaintenanceReport(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新维修报告")
public CommonResult<Boolean> updateMaintenanceReport(@Valid @RequestBody MaintenanceReportSaveReqVO updateReqVO) {
maintenanceReportService.updateMaintenanceReport(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除维修报告")
@Parameter(name = "id", description = "编号", required = true)
public CommonResult<Boolean> deleteMaintenanceReport(@RequestParam("id") String id) {
maintenanceReportService.deleteMaintenanceReport(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得维修报告")
public CommonResult<MaintenanceReportRespVO> getMaintenanceReport(@RequestParam("id") String id) {
MaintenanceReportDO maintenanceReport = maintenanceReportService.getMaintenanceReport(id);
return success(BeanUtils.toBean(maintenanceReport, MaintenanceReportRespVO.class));
}
@GetMapping("/pageList")
@Operation(summary = "获得维修报告分页")
public CommonResult<PageResult<MaintenanceReportRespVO>> getMaintenanceReportPage(@Valid MaintenanceReportPageReqVO pageReqVO) {
PageResult<MaintenanceReportDO> pageResult = maintenanceReportService.getMaintenanceReportPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, MaintenanceReportRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出维修报告 Excel")
@ApiAccessLog(operateType = EXPORT)
public void exportMaintenanceReportExcel(@Valid MaintenanceReportPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<MaintenanceReportDO> list = maintenanceReportService.getMaintenanceReportPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "维修报告.xls", "数据", MaintenanceReportRespVO.class,
BeanUtils.toBean(list, MaintenanceReportRespVO.class));
}
}

View File

@ -23,6 +23,6 @@ public class MaintenanceOrderPageReqVO extends PageParam {
private String customerId;
@Schema(description = "状态")
private String status;
private Integer status;
}

View File

@ -0,0 +1,46 @@
package com.inspur.module.system.controller.maintenance.vo;
import com.inspur.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import static com.inspur.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* @Author xusd
* @Date 2024/9/5 9:53
**/
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class MaintenanceOrderRecordsPageReqVO extends PageParam {
@Schema(description = "维修工单编号")
private String maintenanceOrderNo;
@Schema(description = "机床设备id")
private String equipId;
@Schema(description = "机床组件id")
private String componentId;
@Schema(description = "机床客户id")
private String customerId;
@Schema(description = "完成时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] completeTime;
@Schema(description = "状态")
private Integer status;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] createTime;
}

View File

@ -84,6 +84,7 @@ public class MaintenanceOrderRespVO {
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
private LocalDateTime createTime;
}

View File

@ -0,0 +1,18 @@
package com.inspur.module.system.controller.maintenance.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.inspur.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static com.inspur.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 维修报告分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class MaintenanceReportPageReqVO extends PageParam {
}

View File

@ -0,0 +1,50 @@
package com.inspur.module.system.controller.maintenance.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
import com.inspur.framework.excel.core.annotations.DictFormat;
import com.inspur.framework.excel.core.convert.DictConvert;
@Schema(description = "管理后台 - 维修报告 Response VO")
@Data
@ExcelIgnoreUnannotated
public class MaintenanceReportRespVO {
@Schema(description = "维修报告id", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("维修报告id")
private String maintenanceReportId;
@Schema(description = "维修工单id", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("维修工单id")
private String maintenanceOrderId;
@Schema(description = "维修结果类型0维修完成1远程维修")
@ExcelProperty(value = "维修结果类型0维修完成1远程维修", converter = DictConvert.class)
@DictFormat("maintenance_result_type") // TODO 代码优化建议设置到对应的 DictTypeConstants 枚举类中
private Integer maintenanceResultType;
@Schema(description = "维修内容")
@ExcelProperty("维修内容")
private String maintenanceContent;
@Schema(description = "故障原因")
@ExcelProperty("故障原因")
private String maintenanceProblem;
@Schema(description = "维修评价")
@ExcelProperty("维修评价")
private String maintenanceEvaluation;
@Schema(description = "备注")
@ExcelProperty("备注")
private String remark;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,34 @@
package com.inspur.module.system.controller.maintenance.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 维修报告新增/修改 Request VO")
@Data
public class MaintenanceReportSaveReqVO {
@Schema(description = "维修报告id", requiredMode = Schema.RequiredMode.REQUIRED)
private String maintenanceReportId;
@Schema(description = "维修工单id", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "维修工单id不能为空")
private String maintenanceOrderId;
@Schema(description = "维修结果类型0维修完成1远程维修")
private Integer maintenanceResultType;
@Schema(description = "维修内容")
private String maintenanceContent;
@Schema(description = "故障原因")
private String maintenanceProblem;
@Schema(description = "维修评价")
private String maintenanceEvaluation;
@Schema(description = "备注")
private String remark;
}

View File

@ -0,0 +1,57 @@
package com.inspur.module.system.dal.dataobject.maintenance;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.inspur.framework.mybatis.core.dataobject.BaseDO;
/**
* 维修报告 DO
*
* @author 芋道源码
*/
@TableName("imt_maintenance_report")
@KeySequence("imt_maintenance_report_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class MaintenanceReportDO extends BaseDO {
/**
* 维修报告id
*/
@TableId(type = IdType.INPUT)
private String maintenanceReportId;
/**
* 维修工单id
*/
private String maintenanceOrderId;
/**
* 维修结果类型0维修完成1远程维修
*
* 枚举 {@link TODO maintenance_result_type 对应的类}
*/
private Integer maintenanceResultType;
/**
* 维修内容
*/
private String maintenanceContent;
/**
* 故障原因
*/
private String maintenanceProblem;
/**
* 维修评价
*/
private String maintenanceEvaluation;
/**
* 备注
*/
private String remark;
}

View File

@ -1,9 +1,11 @@
package com.inspur.module.system.dal.mysql.maintenance;
import com.inspur.framework.common.pojo.PageResult;
import com.inspur.framework.common.util.object.BeanUtils;
import com.inspur.framework.mybatis.core.mapper.BaseMapperX;
import com.inspur.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.inspur.module.system.controller.maintenance.vo.MaintenanceOrderPageReqVO;
import com.inspur.module.system.controller.maintenance.vo.MaintenanceOrderRecordsPageReqVO;
import com.inspur.module.system.dal.dataobject.maintenance.MaintenanceOrderDO;
import org.apache.ibatis.annotations.Mapper;
@ -24,5 +26,4 @@ public interface MaintenanceOrderMapper extends BaseMapperX<MaintenanceOrderDO>
.eqIfPresent(MaintenanceOrderDO::getStatus, reqVO.getStatus())
.orderByDesc(MaintenanceOrderDO::getCreateTime));
}
}

View File

@ -0,0 +1,29 @@
package com.inspur.module.system.dal.mysql.maintenance;
import com.inspur.framework.common.pojo.PageResult;
import com.inspur.framework.mybatis.core.mapper.BaseMapperX;
import com.inspur.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.inspur.module.system.controller.maintenance.vo.MaintenanceOrderPageReqVO;
import com.inspur.module.system.controller.maintenance.vo.MaintenanceOrderRecordsPageReqVO;
import com.inspur.module.system.dal.dataobject.maintenance.MaintenanceOrderDO;
import org.apache.ibatis.annotations.Mapper;
/**
* @Author xusd
* @Date 2024/9/5 14:45
**/
@Mapper
public interface MaintenanceOrderRecordMapper extends BaseMapperX<MaintenanceOrderDO> {
default PageResult<MaintenanceOrderDO> selectPage(MaintenanceOrderRecordsPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<MaintenanceOrderDO>()
.likeIfPresent(MaintenanceOrderDO::getMaintenanceOrderNo, reqVO.getMaintenanceOrderNo())
.eqIfPresent(MaintenanceOrderDO::getEquipId, reqVO.getEquipId())
.eqIfPresent(MaintenanceOrderDO::getComponentId, reqVO.getComponentId())
.eqIfPresent(MaintenanceOrderDO::getCustomerId, reqVO.getCustomerId())
.betweenIfPresent(MaintenanceOrderDO::getCompleteTime, reqVO.getCompleteTime())
.eqIfPresent(MaintenanceOrderDO::getStatus, reqVO.getStatus())
.betweenIfPresent(MaintenanceOrderDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(MaintenanceOrderDO::getCreateTime));
}
}

View File

@ -0,0 +1,23 @@
package com.inspur.module.system.dal.mysql.maintenance;
import com.inspur.framework.common.pojo.PageResult;
import com.inspur.framework.mybatis.core.mapper.BaseMapperX;
import com.inspur.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.inspur.module.system.controller.maintenance.vo.MaintenanceReportPageReqVO;
import com.inspur.module.system.dal.dataobject.maintenance.MaintenanceReportDO;
import org.apache.ibatis.annotations.Mapper;
/**
* 维修报告 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface MaintenanceReportMapper extends BaseMapperX<MaintenanceReportDO> {
default PageResult<MaintenanceReportDO> selectPage(MaintenanceReportPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<MaintenanceReportDO>()
.orderByDesc(MaintenanceReportDO::getCreateTime));
}
}

View File

@ -2,6 +2,8 @@ package com.inspur.module.system.service.maintenance;
import com.inspur.framework.common.pojo.PageResult;
import com.inspur.module.system.controller.maintenance.vo.MaintenanceOrderPageReqVO;
import com.inspur.module.system.controller.maintenance.vo.MaintenanceOrderRecordsPageReqVO;
import com.inspur.module.system.controller.maintenance.vo.MaintenanceOrderRespVO;
import com.inspur.module.system.controller.maintenance.vo.MaintenanceOrderSaveReqVO;
import com.inspur.module.system.dal.dataobject.maintenance.MaintenanceOrderDO;
@ -52,4 +54,23 @@ public interface MaintenanceOrderService {
*/
PageResult<MaintenanceOrderDO> getRemoteMaintenanceOrderPage(MaintenanceOrderPageReqVO pageReqVO);
/**
* 获得远程维修工单记录分页
*
* @Author xusd
* @Date 9:54 2024/9/5
* @param pageReqVO
* @return com.inspur.framework.common.pojo.PageResult<com.inspur.module.system.dal.dataobject.maintenance.MaintenanceOrderDO>
*/
PageResult<MaintenanceOrderDO> getRemoteMaintenanceOrderReportPage(MaintenanceOrderRecordsPageReqVO pageReqVO);
/**
* 获得维修工单记录详情
*
* @Author xusd
* @Date 15:27 2024/9/5
* @param id
* @return com.inspur.module.system.dal.dataobject.maintenance.MaintenanceOrderDO
*/
MaintenanceOrderRespVO getRemoteMaintenanceOrderRecord(String id);
}

View File

@ -9,10 +9,13 @@ import com.inspur.module.system.controller.baseData.vo.CustomerInfoSelectionVO;
import com.inspur.module.system.controller.equip.vo.ComponentSelectionVO;
import com.inspur.module.system.controller.equip.vo.EquipSelectionVO;
import com.inspur.module.system.controller.maintenance.vo.MaintenanceOrderPageReqVO;
import com.inspur.module.system.controller.maintenance.vo.MaintenanceOrderRecordsPageReqVO;
import com.inspur.module.system.controller.maintenance.vo.MaintenanceOrderRespVO;
import com.inspur.module.system.controller.maintenance.vo.MaintenanceOrderSaveReqVO;
import com.inspur.module.system.dal.dataobject.maintenance.MaintenanceOrderDO;
import com.inspur.module.system.dal.dataobject.user.AdminUserDO;
import com.inspur.module.system.dal.mysql.maintenance.MaintenanceOrderMapper;
import com.inspur.module.system.dal.mysql.maintenance.MaintenanceOrderRecordMapper;
import com.inspur.module.system.service.baseData.CustomerInfoService;
import com.inspur.module.system.service.equip.ComponentInfoService;
import com.inspur.module.system.service.equip.EquipInfoService;
@ -25,6 +28,7 @@ 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.stream.Collectors;
import static com.inspur.framework.common.exception.util.ServiceExceptionUtil.exception;
@ -54,6 +58,9 @@ public class MaintenanceOrderServiceImpl implements MaintenanceOrderService {
@Resource
private AdminUserService userService;
@Resource
private MaintenanceOrderRecordMapper maintenanceOrderRecordMapper;
@Override
public String createRemoteMaintenanceOrder(MaintenanceOrderSaveReqVO createReqVO) {
// 插入
@ -116,4 +123,51 @@ public class MaintenanceOrderServiceImpl implements MaintenanceOrderService {
return page;
}
@Override
public PageResult<MaintenanceOrderDO> getRemoteMaintenanceOrderReportPage(MaintenanceOrderRecordsPageReqVO pageReqVO) {
pageReqVO.setStatus(4);
PageResult<MaintenanceOrderDO> page = maintenanceOrderRecordMapper.selectPage(pageReqVO);
List<MaintenanceOrderDO> list = page.getList();
if (CollUtil.isNotEmpty(list)){
List<EquipSelectionVO> equipList = equipInfoService.selection();
Map<String, String> equipMap = equipList.stream().collect(Collectors.toMap(EquipSelectionVO::getEquipId, EquipSelectionVO::getEquipNo));
List<ComponentSelectionVO> componentList = componentInfoService.selection();
Map<String, String> componentMap = componentList.stream().collect(Collectors.toMap(ComponentSelectionVO::getComponentId, ComponentSelectionVO::getComponentName));
List<CustomerInfoSelectionVO> customerList = customerInfoService.selection(true);
Map<String, String> customerMap = customerList.stream().collect(Collectors.toMap(CustomerInfoSelectionVO::getCustomerId, CustomerInfoSelectionVO::getCustomerName));
List<AdminUserDO> userList = userService.getUserListByStatus(CommonStatusEnum.ENABLE.getStatus());
Map<Long, String> userMap = userList.stream().collect(Collectors.toMap(AdminUserDO::getId, AdminUserDO::getNickname));
list.forEach(item->{
item.setEquipNo(equipMap.get(item.getEquipId()));
item.setCustomerName(customerMap.get(item.getCustomerId()));
item.setComponentName(componentMap.get(item.getComponentId()));
item.setExecutorName(userMap.get(item.getExecutorId()));
});
}
page.setList(list);
return page;
}
@Override
public MaintenanceOrderRespVO getRemoteMaintenanceOrderRecord(String id) {
MaintenanceOrderDO remoteMaintenanceOrder = this.getRemoteMaintenanceOrder(id);
if (Objects.nonNull(remoteMaintenanceOrder)){
MaintenanceOrderRespVO vo = BeanUtils.toBean(remoteMaintenanceOrder, MaintenanceOrderRespVO.class);
List<EquipSelectionVO> equipList = equipInfoService.selection();
Map<String, String> equipMap = equipList.stream().collect(Collectors.toMap(EquipSelectionVO::getEquipId, EquipSelectionVO::getEquipNo));
List<ComponentSelectionVO> componentList = componentInfoService.selection();
Map<String, String> componentMap = componentList.stream().collect(Collectors.toMap(ComponentSelectionVO::getComponentId, ComponentSelectionVO::getComponentName));
List<CustomerInfoSelectionVO> customerList = customerInfoService.selection(true);
Map<String, String> customerMap = customerList.stream().collect(Collectors.toMap(CustomerInfoSelectionVO::getCustomerId, CustomerInfoSelectionVO::getCustomerName));
List<AdminUserDO> userList = userService.getUserListByStatus(CommonStatusEnum.ENABLE.getStatus());
Map<Long, String> userMap = userList.stream().collect(Collectors.toMap(AdminUserDO::getId, AdminUserDO::getNickname));
vo.setEquipNo(equipMap.get(vo.getEquipId()));
vo.setCustomerName(customerMap.get(vo.getCustomerId()));
vo.setComponentName(componentMap.get(vo.getComponentId()));
vo.setExecutorName(userMap.get(vo.getExecutorId()));
return vo;
}else {
return null;
}
}
}

View File

@ -0,0 +1,55 @@
package com.inspur.module.system.service.maintenance;
import com.inspur.framework.common.pojo.PageResult;
import com.inspur.module.system.controller.maintenance.vo.MaintenanceReportPageReqVO;
import com.inspur.module.system.controller.maintenance.vo.MaintenanceReportSaveReqVO;
import com.inspur.module.system.dal.dataobject.maintenance.MaintenanceReportDO;
import javax.validation.*;
/**
* 维修报告 Service 接口
*
* @author 芋道源码
*/
public interface MaintenanceReportService {
/**
* 创建维修报告
*
* @param createReqVO 创建信息
* @return 编号
*/
String createMaintenanceReport(@Valid MaintenanceReportSaveReqVO createReqVO);
/**
* 更新维修报告
*
* @param updateReqVO 更新信息
*/
void updateMaintenanceReport(@Valid MaintenanceReportSaveReqVO updateReqVO);
/**
* 删除维修报告
*
* @param id 编号
*/
void deleteMaintenanceReport(String id);
/**
* 获得维修报告
*
* @param id 编号
* @return 维修报告
*/
MaintenanceReportDO getMaintenanceReport(String id);
/**
* 获得维修报告分页
*
* @param pageReqVO 分页查询
* @return 维修报告分页
*/
PageResult<MaintenanceReportDO> getMaintenanceReportPage(MaintenanceReportPageReqVO pageReqVO);
}

View File

@ -0,0 +1,70 @@
package com.inspur.module.system.service.maintenance;
import com.inspur.framework.common.pojo.PageResult;
import com.inspur.module.system.controller.maintenance.vo.MaintenanceReportPageReqVO;
import com.inspur.module.system.controller.maintenance.vo.MaintenanceReportSaveReqVO;
import com.inspur.module.system.dal.dataobject.maintenance.MaintenanceReportDO;
import com.inspur.module.system.dal.mysql.maintenance.MaintenanceReportMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import com.inspur.framework.common.util.object.BeanUtils;
import static com.inspur.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.inspur.module.system.enums.ErrorCodeConstants.MAINTENANCE_REPORT_NOT_EXISTS;
/**
* 维修报告 Service 实现类
*
* @author 芋道源码
*/
@Service
@Validated
public class MaintenanceReportServiceImpl implements MaintenanceReportService {
@Resource
private MaintenanceReportMapper maintenanceReportMapper;
@Override
public String createMaintenanceReport(MaintenanceReportSaveReqVO createReqVO) {
// 插入
MaintenanceReportDO maintenanceReport = BeanUtils.toBean(createReqVO, MaintenanceReportDO.class);
maintenanceReportMapper.insert(maintenanceReport);
// 返回
return maintenanceReport.getMaintenanceReportId();
}
@Override
public void updateMaintenanceReport(MaintenanceReportSaveReqVO updateReqVO) {
// 校验存在
validateMaintenanceReportExists(updateReqVO.getMaintenanceReportId());
// 更新
MaintenanceReportDO updateObj = BeanUtils.toBean(updateReqVO, MaintenanceReportDO.class);
maintenanceReportMapper.updateById(updateObj);
}
@Override
public void deleteMaintenanceReport(String id) {
// 校验存在
validateMaintenanceReportExists(id);
// 删除
maintenanceReportMapper.deleteById(id);
}
private void validateMaintenanceReportExists(String id) {
if (maintenanceReportMapper.selectById(id) == null) {
throw exception(MAINTENANCE_REPORT_NOT_EXISTS);
}
}
@Override
public MaintenanceReportDO getMaintenanceReport(String id) {
return maintenanceReportMapper.selectById(id);
}
@Override
public PageResult<MaintenanceReportDO> getMaintenanceReportPage(MaintenanceReportPageReqVO pageReqVO) {
return maintenanceReportMapper.selectPage(pageReqVO);
}
}

View File

@ -1,6 +1,6 @@
import request from '@/utils/request'
// 创建远程维修工单
// 创建维修工单
export function createRemoteMaintenanceOrder(data) {
return request({
url: '/maintenance/create',
@ -9,7 +9,7 @@ export function createRemoteMaintenanceOrder(data) {
})
}
// 更新远程维修工单
// 更新维修工单
export function updateRemoteMaintenanceOrder(data) {
return request({
url: '/maintenance/update',
@ -18,7 +18,7 @@ export function updateRemoteMaintenanceOrder(data) {
})
}
// 删除远程维修工单
// 删除维修工单
export function deleteRemoteMaintenanceOrder(id) {
return request({
url: '/maintenance/delete?id=' + id,
@ -26,7 +26,7 @@ export function deleteRemoteMaintenanceOrder(id) {
})
}
// 获得远程维修工单
// 获得维修工单
export function getRemoteMaintenanceOrder(id) {
return request({
url: '/maintenance/get?id=' + id,
@ -34,7 +34,7 @@ export function getRemoteMaintenanceOrder(id) {
})
}
// 获得远程维修工单分页
// 获得维修工单分页
export function getRemoteMaintenanceOrderPage(params) {
return request({
url: '/maintenance/page',
@ -42,7 +42,7 @@ export function getRemoteMaintenanceOrderPage(params) {
params
})
}
// 导出远程维修工单 Excel
// 导出维修工单 Excel
export function exportRemoteMaintenanceOrderExcel(params) {
return request({
url: '/maintenance/export-excel',
@ -51,3 +51,20 @@ export function exportRemoteMaintenanceOrderExcel(params) {
responseType: 'blob'
})
}
// 获得维修工单记录分页
export function getRemoteMaintenanceOrderReportPage(params) {
return request({
url: '/maintenance/report/page',
method: 'get',
params
})
}
// 获得维修工单记录详情
export function getRemoteMaintenanceOrderRecord(id) {
return request({
url: '/maintenance/get/record?id=' + id,
method: 'get'
})
}

View File

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 创建维修报告
export function createMaintenanceReport(data) {
return request({
url: '/maintenance/report/create',
method: 'post',
data: data
})
}
// 更新维修报告
export function updateMaintenanceReport(data) {
return request({
url: '/maintenance/report/update',
method: 'put',
data: data
})
}
// 删除维修报告
export function deleteMaintenanceReport(id) {
return request({
url: '/maintenance/report/delete?id=' + id,
method: 'delete'
})
}
// 获得维修报告
export function getMaintenanceReport(id) {
return request({
url: '/maintenance/report/get?id=' + id,
method: 'get'
})
}
// 获得维修报告分页
export function getMaintenanceReportPage(params) {
return request({
url: '/maintenance/report/pageList',
method: 'get',
params
})
}
// 导出维修报告 Excel
export function exportMaintenanceReportExcel(params) {
return request({
url: '/maintenance/report/export-excel',
method: 'get',
params,
responseType: 'blob'
})
}

View File

@ -29,6 +29,7 @@ export const DICT_TYPE = {
MAINTENANCE_STATUS: "maintenance_status",
MAINTENANCE_PRIORITY: "maintenance_priority",
FAULT_TYPE: "fault_type",
MAINTENANCE_RESULT_TYPE: "maintenance_result_type",
// ========== SYSTEM 模块 ==========
SYSTEM_USER_SEX: "system_user_sex",
SYSTEM_MENU_TYPE: "system_menu_type",

View File

@ -0,0 +1,320 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="维修工单编号" prop="maintenanceOrderNo" label-width="100px">
<el-input v-model="queryParams.maintenanceOrderNo" placeholder="请输入远程维修工单编号" clearable
@keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="机床设备" prop="equipId">
<el-cascader
v-model="cascaderValue"
:options="equipCascader"
:props="{ value: 'id',label: 'name',children: 'children'}"
clearable
@change="cascaderChange"></el-cascader>
</el-form-item>
<el-form-item label="机床客户" prop="customerId">
<el-select v-model="queryParams.customerId" placeholder="请选择机床客户" clearable size="small">
<el-option v-for="item in customerSelection"
:key="item.customerId" :label="item.customerName" :value="item.customerId"/>
</el-select>
</el-form-item>
<el-form-item label="机床组件" prop="componentId">
<el-select v-model="queryParams.componentId" placeholder="请选择机床组件" clearable size="small">
<el-option v-for="item in componentSelection"
:key="item.componentId" :label="item.componentName" :value="item.componentId"/>
</el-select>
</el-form-item>
<el-form-item label="完成时间" prop="completeTime">
<el-date-picker v-model="queryParams.completeTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss"
type="datetimerange"
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"/>
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss"
type="datetimerange"
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="维修工单编号" align="center" prop="maintenanceOrderNo"/>
<el-table-column label="机床设备" align="center" prop="equipNo"/>
<el-table-column label="机床组件" align="center" prop="componentName"/>
<el-table-column label="机床客户" align="center" prop="customerName"/>
<el-table-column label="故障类型" align="center" prop="faultType">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.FAULT_TYPE" :value="scope.row.faultType"/>
</template>
</el-table-column>
<el-table-column label="故障描述" align="center" prop="description"/>
<el-table-column label="优先级" align="center" prop="priority">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.MAINTENANCE_PRIORITY" :value="scope.row.priority"/>
</template>
</el-table-column>
<el-table-column label="完成时间" align="center" prop="completeTime" width="180">
<template v-slot="scope">
<span>{{ parseTime(scope.row.completeTime) }}</span>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="status">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.MAINTENANCE_STATUS" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="维修人" align="center" prop="executorName"/>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template v-slot="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-view" @click="details(scope.row.maintenanceOrderId)">详情
</el-button>
<el-button size="mini" type="text" icon="el-icon-coordinate" @click="">审批记录
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
<el-dialog
:title="detailTitle"
:visible.sync="detailOpen"
width="40%"
:close-on-click-modal="false"
>
<el-form
:model="detailForm"
v-loading="detailLoading"
label-width="120px"
>
<el-col :span="12">
<el-form-item
label="维修工单编号:"
prop="maintenanceOrderNo"
>
{{ detailForm.maintenanceOrderNo }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="维修报告:"
prop="diagnoiseReportId"
>
<el-button v-if="detailForm.diagnoiseReportId !== null" size="mini" type="text" @click="openReport(detailForm.maintenanceOrderNo,detailForm.diagnoiseReportId)">维修报告</el-button>
<span v-else></span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="机床设备:"
prop="equipNo"
>
{{ detailForm.equipNo }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="机床组件:"
prop="componentName"
>
{{ detailForm.componentName }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="机床客户信息:"
prop="customerName"
>
{{ detailForm.customerName }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="故障类型:"
prop="faultType"
>
<dict-tag :type="DICT_TYPE.FAULT_TYPE" :value="detailForm.faultType" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="故障描述:"
prop="description"
>
{{ detailForm.description }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="优先级:"
prop="priority"
>
<dict-tag :type="DICT_TYPE.MAINTENANCE_PRIORITY" :value="detailForm.priority" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="完成时间:"
prop="completeTime"
>
{{ detailForm.completeTime }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="状态:"
prop="status"
>
<dict-tag :type="DICT_TYPE.MAINTENANCE_STATUS" :value="detailForm.status" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="维修人:"
prop="executorName"
>
{{ detailForm.executorName }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="创建时间:"
prop="createTime"
>
{{ detailForm.createTime }}
</el-form-item>
</el-col>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="closeDetails"> </el-button>
</div>
</el-dialog>
<MaintenanceReportDetails ref="formRef"/>
</div>
</template>
<script>
import * as RemoteMaintenanceOrderApi from '@/api/system/maintenance/maintenance';
import {getEquipCascader} from '@/api/system/equip/equipInfo'
import {getComponentSelection} from '@/api/system/equip/componentInfo'
import {getCustomerSelection} from '@/api/system/baseData/customerInfo'
import MaintenanceReportDetails from '@/views/system/maintenance/maintenanceReport/MaintenanceReportDetails.vue';
export default {
name: "RemoteMaintenanceOrder",
components: {
MaintenanceReportDetails,
},
data() {
return {
detailOpen: false,
detailTitle: "维修详情",
detailLoading: false,
detailForm: {},
cascaderValue: [],
equipCascader: [],
componentSelection: [],
customerSelection: [],
//
loading: true,
//
exportLoading: false,
//
showSearch: true,
//
total: 0,
//
list: [],
//
isExpandAll: true,
//
refreshTable: true,
//
currentRow: {},
//
queryParams: {
pageNo: 1,
pageSize: 10,
maintenanceOrderNo: null,
equipId: null,
componentId: null,
completeTime: [],
createTime: [],
},
};
},
created() {
this.getList();
this.initSelection();
},
methods: {
openReport(maintenanceOrderNo,id){
console.log(id)
this.$refs["formRef"].open(maintenanceOrderNo,id);
},
closeDetails(){
this.detailOpen = false;
this.detailForm = {};
},
details(maintenanceOrderId) {
this.detailOpen = true;
this.detailLoading = true;
RemoteMaintenanceOrderApi.getRemoteMaintenanceOrderRecord(maintenanceOrderId).then(res => {
this.detailForm = res.data;
this.detailLoading = false;
})
},
cascaderChange(value) {
if (value.length > 0) {
this.queryParams.equipId = value[1];
} else {
this.queryParams.equipId = null;
}
},
initSelection() {
getEquipCascader().then(res => {
this.equipCascader = res;
});
getComponentSelection().then(res => {
this.componentSelection = res;
});
getCustomerSelection().then(res => {
this.customerSelection = res;
});
},
/** 查询列表 */
async getList() {
try {
this.loading = true;
const res = await RemoteMaintenanceOrderApi.getRemoteMaintenanceOrderReportPage(this.queryParams);
this.list = res.data.list;
this.total = res.data.total;
} finally {
this.loading = false;
}
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.cascaderValue = [];
this.resetForm("queryForm");
this.queryParams.equipId = null;
this.handleQuery();
},
}
};
</script>

View File

@ -0,0 +1,105 @@
<template>
<div class="app-container">
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="45%" v-dialogDrag append-to-body>
<el-form ref="formRef" :model="formData" :rules="formRules" v-loading="formLoading" label-width="120px">
<el-col :span="12">
<el-form-item label="维修工单:" prop="maintenanceOrderNo">
{{formData.maintenanceOrderNo}}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="维修结果类型:" prop="maintenanceResultType">
<dict-tag :type="DICT_TYPE.MAINTENANCE_RESULT_TYPE" :value="formData.maintenanceResultType" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="维修内容:" prop="maintenanceContent">
{{formData.maintenanceContent}}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="故障原因:" prop="maintenanceProblem">
{{formData.maintenanceProblem}}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="维修评价:" prop="maintenanceEvaluation">
{{formData.maintenanceEvaluation}}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注:" prop="remark">
{{formData.remark}}
</el-form-item>
</el-col>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import * as MaintenanceReportApi from '@/api/system/maintenance/maintenanceReport';
export default {
name: "MaintenanceReportForm",
components: {},
data() {
return {
//
dialogTitle: "",
//
dialogVisible: false,
// 12
formLoading: false,
//
formData: {
maintenanceReportId: undefined,
maintenanceOrderId: undefined,
maintenanceResultType: undefined,
maintenanceContent: undefined,
maintenanceProblem: undefined,
maintenanceEvaluation: undefined,
remark: undefined,
},
//
formRules: {
},
};
},
methods: {
/** 打开弹窗 */
open(maintenanceOrderNo,id) {
this.reset();
MaintenanceReportApi.getMaintenanceReport(id).then(res=>{
if (res.data == null){
this.$message.error('未查询到数据')
return;
}
this.dialogVisible = true;
this.formLoading = true;
this.formData = res.data;
this.formData.maintenanceOrderNo = maintenanceOrderNo;
this.formLoading = false;
this.dialogTitle = "维修报告详情";
})
},
/** 表单重置 */
reset() {
this.formData = {
maintenanceReportId: undefined,
maintenanceOrderId: undefined,
maintenanceResultType: undefined,
maintenanceContent: undefined,
maintenanceProblem: undefined,
maintenanceEvaluation: undefined,
remark: undefined,
};
this.resetForm("formRef");
}
}
};
</script>

View File

@ -0,0 +1,125 @@
<template>
<div class="app-container">
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="45%" v-dialogDrag append-to-body>
<el-form ref="formRef" :model="formData" :rules="formRules" v-loading="formLoading" label-width="100px">
<el-form-item label="维修工单id" prop="maintenanceOrderId">
<el-select v-model="formData.maintenanceOrderId" placeholder="请选择维修工单id">
<el-option label="请选择字典生成" value=""/>
</el-select>
</el-form-item>
<el-form-item label="维修结果类型" prop="maintenanceResultType">
<el-select v-model="formData.maintenanceResultType" placeholder="请选择维修结果类型">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.MAINTENANCE_RESULT_TYPE)"
:key="dict.value" :label="dict.label" :value="parseInt(dict.value)"/>
</el-select>
</el-form-item>
<el-form-item label="维修内容" prop="maintenanceContent">
<el-input v-model="formData.maintenanceContent" type="textarea" placeholder="请输入内容"/>
</el-form-item>
<el-form-item label="故障原因" prop="maintenanceProblem">
<el-input v-model="formData.maintenanceProblem" placeholder="请输入故障原因"/>
</el-form-item>
<el-form-item label="维修评价" prop="maintenanceEvaluation">
<el-input v-model="formData.maintenanceEvaluation" placeholder="请输入维修评价"/>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="formData.remark" type="textarea" placeholder="请输入内容"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm" :disabled="formLoading"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import * as MaintenanceReportApi from '@/api/system/maintenance/maintenanceReport';
export default {
name: "MaintenanceReportForm",
components: {},
data() {
return {
//
dialogTitle: "",
//
dialogVisible: false,
// 12
formLoading: false,
//
formData: {
maintenanceReportId: undefined,
maintenanceOrderId: undefined,
maintenanceResultType: undefined,
maintenanceContent: undefined,
maintenanceProblem: undefined,
maintenanceEvaluation: undefined,
remark: undefined,
},
//
formRules: {
maintenanceOrderId: [{required: true, message: '维修工单id不能为空', trigger: 'change'}],
},
};
},
methods: {
/** 打开弹窗 */
async open(id) {
this.dialogVisible = true;
this.reset();
//
if (id) {
this.formLoading = true;
try {
const res = await MaintenanceReportApi.getMaintenanceReport(id);
this.formData = res.data;
this.dialogTitle = "修改维修报告";
} finally {
this.formLoading = false;
}
}
this.dialogTitle = "新增维修报告";
},
/** 提交按钮 */
async submitForm() {
//
await this.$refs["formRef"].validate();
this.formLoading = true;
try {
const data = this.formData;
//
if (data.maintenanceReportId) {
await MaintenanceReportApi.updateMaintenanceReport(data);
this.$modal.msgSuccess("修改成功");
this.dialogVisible = false;
this.$emit('success');
return;
}
//
await MaintenanceReportApi.createMaintenanceReport(data);
this.$modal.msgSuccess("新增成功");
this.dialogVisible = false;
this.$emit('success');
} finally {
this.formLoading = false;
}
},
/** 表单重置 */
reset() {
this.formData = {
maintenanceReportId: undefined,
maintenanceOrderId: undefined,
maintenanceResultType: undefined,
maintenanceContent: undefined,
maintenanceProblem: undefined,
maintenanceEvaluation: undefined,
remark: undefined,
};
this.resetForm("formRef");
}
}
};
</script>

View File

@ -0,0 +1,151 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<!-- 操作工具栏 -->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="openForm(undefined)"
v-hasPermi="['imt:maintenance-report:create']">新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
:loading="exportLoading"
v-hasPermi="['imt:maintenance-report:export']">导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="维修报告id" align="center" prop="maintenanceReportId"/>
<el-table-column label="维修工单id" align="center" prop="maintenanceOrderId"/>
<el-table-column label="维修结果类型" align="center" prop="maintenanceResultType">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.MAINTENANCE_RESULT_TYPE" :value="scope.row.maintenanceResultType"/>
</template>
</el-table-column>
<el-table-column label="维修内容" align="center" prop="maintenanceContent"/>
<el-table-column label="故障原因" align="center" prop="maintenanceProblem"/>
<el-table-column label="维修评价" align="center" prop="maintenanceEvaluation"/>
<el-table-column label="备注" align="center" prop="remark"/>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template v-slot="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row.maintenanceReportId)"
v-hasPermi="['imt:maintenance-report:update']">修改
</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['imt:maintenance-report:delete']">删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
<!-- 对话框(添加 / 修改) -->
<MaintenanceReportForm ref="formRef" @success="getList"/>
</div>
</template>
<script>
import * as MaintenanceReportApi from '@/api/system/maintenance/maintenanceReport';
import MaintenanceReportForm from './MaintenanceReportForm.vue';
export default {
name: "MaintenanceReport",
components: {
MaintenanceReportForm,
},
data() {
return {
//
loading: true,
//
exportLoading: false,
//
showSearch: true,
//
total: 0,
//
list: [],
//
isExpandAll: true,
//
refreshTable: true,
//
currentRow: {},
//
queryParams: {
pageNo: 1,
pageSize: 10,
},
};
},
created() {
this.getList();
},
methods: {
/** 查询列表 */
async getList() {
try {
this.loading = true;
const res = await MaintenanceReportApi.getMaintenanceReportPage(this.queryParams);
this.list = res.data.list;
this.total = res.data.total;
} finally {
this.loading = false;
}
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 添加/修改操作 */
openForm(id) {
this.$refs["formRef"].open(id);
},
/** 删除按钮操作 */
async handleDelete(row) {
const maintenanceReportId = row.maintenanceReportId;
await this.$modal.confirm('是否确认删除维修报告编号为"' + maintenanceReportId + '"的数据项?')
try {
await MaintenanceReportApi.deleteMaintenanceReport(maintenanceReportId);
await this.getList();
this.$modal.msgSuccess("删除成功");
} catch {
}
},
/** 导出按钮操作 */
async handleExport() {
await this.$modal.confirm('是否确认导出所有维修报告数据项?');
try {
this.exportLoading = true;
const data = await MaintenanceReportApi.exportMaintenanceReportExcel(this.queryParams);
this.$download.excel(data, '维修报告.xls');
} catch {
} finally {
this.exportLoading = false;
}
},
}
};
</script>