From 59f3375f9b3d899e826c3a2637b12e1b532d1a84 Mon Sep 17 00:00:00 2001 From: hayu <1604366271@qq.com> Date: Thu, 25 Jul 2024 21:20:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A3=80=E6=B5=8B=E6=8A=A5=E5=91=8A=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../aqgqj/basis/dao/TestReportManageDao.java | 10 +++ .../basis/entity/dto/TestReportManageDto.java | 10 ++- .../impl/TestReportManageServiceImpl.java | 10 +++ .../mappers/basis/SamplesManageMapper.xml | 12 ++- .../mappers/basis/TestReportManageMapper.xml | 19 ++++ .../mappers/basis/ToolsManageMapper.xml | 5 +- .../js/testReport/child/testReportForm.js | 88 +++++++++++++++++-- .../testReport/child/testReportForm.html | 8 +- 8 files changed, 145 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/bonus/aqgqj/basis/dao/TestReportManageDao.java b/src/main/java/com/bonus/aqgqj/basis/dao/TestReportManageDao.java index 709caef..a225638 100644 --- a/src/main/java/com/bonus/aqgqj/basis/dao/TestReportManageDao.java +++ b/src/main/java/com/bonus/aqgqj/basis/dao/TestReportManageDao.java @@ -1,9 +1,11 @@ package com.bonus.aqgqj.basis.dao; import com.bonus.aqgqj.basis.entity.dto.TestReportManageDto; +import org.apache.ibatis.annotations.MapKey; import org.apache.ibatis.annotations.Mapper; import java.util.List; +import java.util.Map; @Mapper public interface TestReportManageDao { @@ -95,4 +97,12 @@ public interface TestReportManageDao { * @return */ int updateReportCode(TestReportManageDto dto); + + /** + * 获取设备编号与结果 + * @param dto + * @return + */ + @MapKey("devCode") + List> getExperDevItems(TestReportManageDto dto); } diff --git a/src/main/java/com/bonus/aqgqj/basis/entity/dto/TestReportManageDto.java b/src/main/java/com/bonus/aqgqj/basis/entity/dto/TestReportManageDto.java index 0b45926..9106db1 100644 --- a/src/main/java/com/bonus/aqgqj/basis/entity/dto/TestReportManageDto.java +++ b/src/main/java/com/bonus/aqgqj/basis/entity/dto/TestReportManageDto.java @@ -1,8 +1,11 @@ package com.bonus.aqgqj.basis.entity.dto; import com.bonus.aqgqj.base.entity.PageEntity; +import com.bonus.aqgqj.basis.entity.vo.ExperimentalDetailVo; import lombok.Data; +import java.util.List; + /** * 工器具个体管理 * @author hay @@ -31,6 +34,11 @@ public class TestReportManageDto extends PageEntity { */ private String customName; + /** + * 送样部门id + */ + private Integer departmentId; + /** * 送样部门 */ @@ -163,6 +171,6 @@ public class TestReportManageDto extends PageEntity { */ private String detectionTime; - + private List sampleList; } diff --git a/src/main/java/com/bonus/aqgqj/basis/service/impl/TestReportManageServiceImpl.java b/src/main/java/com/bonus/aqgqj/basis/service/impl/TestReportManageServiceImpl.java index 5fe7f65..a888e94 100644 --- a/src/main/java/com/bonus/aqgqj/basis/service/impl/TestReportManageServiceImpl.java +++ b/src/main/java/com/bonus/aqgqj/basis/service/impl/TestReportManageServiceImpl.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.bonus.aqgqj.basis.dao.TestReportManageDao; import com.bonus.aqgqj.basis.entity.dto.TestReportManageDto; +import com.bonus.aqgqj.basis.entity.vo.ExperimentalDetailVo; import com.bonus.aqgqj.basis.service.SamplesManageService; import com.bonus.aqgqj.basis.service.TestReportManageService; import com.bonus.aqgqj.utils.DateTimeHelper; @@ -15,7 +16,9 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.List; +import java.util.Map; /** * @description 工器具个体管理 @@ -55,6 +58,13 @@ public class TestReportManageServiceImpl implements TestReportManageService { List list = testReportManageDao.getDetailsList(data); //如果没有报告编号,需要生成报告编号 for (TestReportManageDto dto : list){ + //将每条数据下的设备编号,试验结果加进去 + List sampleList = new ArrayList<>(); + List> mapList = testReportManageDao.getExperDevItems(dto); + JSONArray jsonArray = new JSONArray(); + jsonArray.addAll(mapList); + sampleList = jsonArray.toJavaList(ExperimentalDetailVo.Sample.class); + dto.setSampleList(sampleList); if (StringHelper.isEmpty(dto.getReportCode())){ //生成报告编号 String reportCode = generateReportCode(dto); diff --git a/src/main/resources/mappers/basis/SamplesManageMapper.xml b/src/main/resources/mappers/basis/SamplesManageMapper.xml index cd6a0b3..f62f3f7 100644 --- a/src/main/resources/mappers/basis/SamplesManageMapper.xml +++ b/src/main/resources/mappers/basis/SamplesManageMapper.xml @@ -148,10 +148,14 @@ LIMIT 1 + \ No newline at end of file diff --git a/src/main/resources/mappers/basis/ToolsManageMapper.xml b/src/main/resources/mappers/basis/ToolsManageMapper.xml index 07b69ac..943c1ab 100644 --- a/src/main/resources/mappers/basis/ToolsManageMapper.xml +++ b/src/main/resources/mappers/basis/ToolsManageMapper.xml @@ -10,7 +10,7 @@ tsd.customer_code as customerCode, tsd.dev_module as devModule, tc.custom_name as customName, - ts.department as sampleDepartment, + tcs.custom_name as sampleDepartment, ted.manufacture_date as manufactureDate, te.exper_time as experTime, te.exper_conclu as experConclu, @@ -21,6 +21,7 @@ tb_sample_device tsd LEFT JOIN tb_sample ts on ts.id=tsd.sample_id and ts.del_flag=0 LEFT JOIN tb_custom tc on tc.id=ts.custom_id and tc.del_flag=0 + LEFT JOIN tb_custom tcs on tcs.id=tsd.department_id and tcs.del_flag=0 LEFT JOIN tb_exper_dev ted on ted.dev_id=tsd.id LEFT JOIN tb_exper te on te.id=ted.exper_id and te.del_flag=0 LEFT JOIN sys_user su on su.id=te.create_user and su.del_flag=0 @@ -35,7 +36,7 @@ tsd.customer_code like concat('%', #{keyWord}, '%') OR tsd.dev_module like concat('%', #{keyWord}, '%') OR tc.custom_name like concat('%', #{keyWord}, '%') OR - ts.department like concat('%', #{keyWord}, '%') OR + tcs.custom_name like concat('%', #{keyWord}, '%') OR te.exper_conclu like concat('%', #{keyWord}, '%') ) diff --git a/src/main/resources/static/js/testReport/child/testReportForm.js b/src/main/resources/static/js/testReport/child/testReportForm.js index b66ee2d..bf9187f 100644 --- a/src/main/resources/static/js/testReport/child/testReportForm.js +++ b/src/main/resources/static/js/testReport/child/testReportForm.js @@ -91,14 +91,36 @@ function initTable(dataList, limit, page) { {field: "reportCode", title: "报告编号", unresize: true, align: "center"}, {field: "sampleDepartment", title: "送样部门", unresize: true, align: "center"}, {field: "devModule", title: "规格型号", unresize: true, align: "center"}, - { - field: "devNum", - title: "样品数量", - width: 68, - unresize: true, - align: "center", + {field: "", title: "样品数量", width: 68, unresize: true, align: "center", templet: function (d) { - return `${d.devNum}`; + var testResult=""; + var html = ''; + var sampleList = JSON.stringify(d.sampleList); + console.log("d.sampleList",d.sampleList) + console.log("sampleList",sampleList) + if(d.sampleList.length>0){ + for (let i = 0; i < d.sampleList.length; i++) { + if (d.sampleList[i].testResult == "合格") { + + }else{ + testResult = d.sampleList[i].testResult + } + } + } + + if(testResult=="不合格"){ + // 添加包裹元素并应用类 + html += "" + + d.devNum + + ""; + }else{ + // 添加包裹元素并应用类 + html += "" + + d.devNum + + ""; + + } + return html; } }, { @@ -129,6 +151,52 @@ function initTable(dataList, limit, page) { }); } +function getMouseout(){ + // alert("鼠标移出"); + // layer.close(devOpenIndex); +} + +function getMouseover(data){ + console.log("data",data) + var html = '' + + '' + + '' + + '' + + '' + + ''+ + ''+ + '' + + html += ''; + if (data.length>0){ + for (let i = 0; i < data.length; i++){ + html += '' + + '' + + '' + + '' + + ''; + } + }else{ + html += '' + + '' + + ''; + } + html += ''; + html += '
序号设备编号试验结果
' + (i+1) + '' + data[i].devCode + '' + data[i].testResult + '
暂无数据
'; + + let devOpenIndex = layer.open({ + type: 0, + title: '设备信息', + area: ['400px', '500px'], + content: html, + btn: ['关闭'], + yes: function (index, layero) { + layer.close(index); + } + }); +} + + function handleClick1(view1) { alert('Clicked on: ' + view1); } @@ -156,7 +224,8 @@ function getReqParams(page, limit, type) { limit: limit + "", id: idParam, sampleTools: selectedText, - keyWord:$('#keyWord').val() + keyWord:$('#keyWord').val(), + reportCode:$('#reportCode').val() }; } else { obj = { @@ -164,7 +233,8 @@ function getReqParams(page, limit, type) { limit: '10', id: idParam, sampleTools: selectedText, - keyWord: '' + keyWord: '', + reportCode:'' }; } console.log(obj) diff --git a/src/main/resources/static/pages/testReport/child/testReportForm.html b/src/main/resources/static/pages/testReport/child/testReportForm.html index bd1776c..a0a0b3d 100644 --- a/src/main/resources/static/pages/testReport/child/testReportForm.html +++ b/src/main/resources/static/pages/testReport/child/testReportForm.html @@ -30,7 +30,13 @@
- + +
+
+ +
+
+