维修工单报告模块
This commit is contained in:
parent
c15bc190d4
commit
5b7ddf0704
@ -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, "机床网关信息不存在");
|
||||
|
@ -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("/page")
|
||||
@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));
|
||||
}
|
||||
|
||||
}
|
@ -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 {
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 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;
|
||||
|
||||
}
|
@ -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));
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
53
imt-ui/src/api/system/maintenance/maintenanceReport.js
Normal file
53
imt-ui/src/api/system/maintenance/maintenanceReport.js
Normal 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/page',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
// 导出维修报告 Excel
|
||||
export function exportMaintenanceReportExcel(params) {
|
||||
return request({
|
||||
url: '/maintenance/report/export-excel',
|
||||
method: 'get',
|
||||
params,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
@ -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",
|
||||
|
@ -0,0 +1,131 @@
|
||||
<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-col :span="12">
|
||||
<el-form-item label="维修工单id" prop="maintenanceOrderId">
|
||||
{{formData.maintenanceOrderId}}
|
||||
</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,
|
||||
// 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
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.title = "修改维修报告";
|
||||
} finally {
|
||||
this.formLoading = false;
|
||||
}
|
||||
}
|
||||
this.title = "新增维修报告";
|
||||
},
|
||||
/** 提交按钮 */
|
||||
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>
|
@ -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,
|
||||
// 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
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>
|
151
imt-ui/src/views/system/maintenance/maintenanceReport/index.vue
Normal file
151
imt-ui/src/views/system/maintenance/maintenanceReport/index.vue
Normal 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>
|
Loading…
Reference in New Issue
Block a user