检测报告管理
This commit is contained in:
parent
3f3d75915e
commit
4ca72dc323
|
|
@ -131,7 +131,7 @@ public class SamplesManageController {
|
|||
@PostMapping("dispatchWork")
|
||||
@DecryptAndVerify(decryptedClass = SamplesManageDto.class)//加解密统一管理
|
||||
@LogAnnotation(operModul = "收样管理", operation = "派工", operDesc = "业务级事件", operType = "新增")
|
||||
@PreAuthorize("@pms.hasPermission('sys:samples:add')")
|
||||
@PreAuthorize("@pms.hasPermission('sys:samples:dispatch')")
|
||||
public ServerResponse dispatchWork(EncryptedReq<SamplesManageDto> vo) {
|
||||
try {
|
||||
return samplesManageService.dispatchWork(vo.getData());
|
||||
|
|
|
|||
|
|
@ -0,0 +1,142 @@
|
|||
package com.bonus.aqgqj.basis.controller;
|
||||
|
||||
import com.bonus.aqgqj.annotation.DecryptAndVerify;
|
||||
import com.bonus.aqgqj.annotation.LogAnnotation;
|
||||
import com.bonus.aqgqj.basis.entity.dto.TestReportManageDto;
|
||||
import com.bonus.aqgqj.basis.service.TestReportManageService;
|
||||
import com.bonus.aqgqj.system.vo.EncryptedReq;
|
||||
import com.bonus.aqgqj.utils.ServerResponse;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 检测报告管理
|
||||
* @author hay
|
||||
*/
|
||||
@Api(tags = "检测报告管理")
|
||||
@RestController
|
||||
@RequestMapping("/testReport/")
|
||||
public class TestReportManageController {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger("adminLogger");
|
||||
|
||||
@Autowired
|
||||
private TestReportManageService testReportManageService;
|
||||
|
||||
@PostMapping(value = "getList")
|
||||
@DecryptAndVerify(decryptedClass = TestReportManageDto.class)
|
||||
@LogAnnotation(operModul = "收样管理-收样管理", operation = "查询用列表", operDesc = "业务级事件",operType="查询")
|
||||
@PreAuthorize("@pms.hasPermission('sys:testReport:query')" )
|
||||
public ServerResponse listUsers(EncryptedReq<TestReportManageDto> data) {
|
||||
PageHelper.startPage(data.getData().getPage(), data.getData().getLimit());
|
||||
try {
|
||||
List<TestReportManageDto> list = testReportManageService.list(data.getData());
|
||||
PageInfo<TestReportManageDto> pageInfo = new PageInfo<>(list);
|
||||
return ServerResponse.createSuccessPage(pageInfo,data.getData().getPage(),data.getData().getLimit());
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return ServerResponse.createErrorPage(data.getData().getPage(),data.getData().getLimit());
|
||||
}
|
||||
|
||||
@PostMapping(value = "getDetailsList")
|
||||
@DecryptAndVerify(decryptedClass = TestReportManageDto.class)
|
||||
@LogAnnotation(operModul = "收样管理-收样管理详情", operation = "查询用列表", operDesc = "业务级事件",operType="查询")
|
||||
@PreAuthorize("@pms.hasPermission('sys:samples:query')" )
|
||||
public ServerResponse getDetailsList(EncryptedReq<TestReportManageDto> data) {
|
||||
PageHelper.startPage(data.getData().getPage(), data.getData().getLimit());
|
||||
try {
|
||||
List<TestReportManageDto> list = testReportManageService.getDetailsList(data.getData());
|
||||
PageInfo<TestReportManageDto> pageInfo = new PageInfo<>(list);
|
||||
return ServerResponse.createSuccessPage(pageInfo,data.getData().getPage(),data.getData().getLimit());
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return ServerResponse.createErrorPage(data.getData().getPage(),data.getData().getLimit());
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "all")
|
||||
@LogAnnotation(operModul = "收样管理", operation = "查询所有工器具", operDesc = "业务级事件",operType="查询")
|
||||
@PreAuthorize("@pms.hasPermission('sys:samples:query')" )
|
||||
public ServerResponse getAll() {
|
||||
try {
|
||||
List<TestReportManageDto> list = testReportManageService.listTools();
|
||||
return ServerResponse.createSuccess(list);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return ServerResponse.createErroe("操作失败");
|
||||
}
|
||||
|
||||
@PostMapping(value = "allCustomName")
|
||||
@LogAnnotation(operModul = "收样管理", operation = "查询所有单位", operDesc = "业务级事件",operType="查询")
|
||||
@PreAuthorize("@pms.hasPermission('sys:samples:query')" )
|
||||
public ServerResponse getAllCustomName() {
|
||||
try {
|
||||
List<TestReportManageDto> list = testReportManageService.getAllCustomName();
|
||||
return ServerResponse.createSuccess(list);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return ServerResponse.createErroe("操作失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 新增收样数据
|
||||
*/
|
||||
@PostMapping("addSamples")
|
||||
@DecryptAndVerify(decryptedClass = TestReportManageDto.class)//加解密统一管理
|
||||
@LogAnnotation(operModul = "收样管理", operation = "新增收样数据", operDesc = "业务级事件", operType = "新增")
|
||||
@PreAuthorize("@pms.hasPermission('sys:samples:add')")
|
||||
public ServerResponse addSamples(EncryptedReq<TestReportManageDto> vo) {
|
||||
try {
|
||||
return testReportManageService.addSamples(vo.getData());
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
return ServerResponse.createErroe("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping(value = "getTeamSelected")
|
||||
@LogAnnotation(operModul = "收样管理", operation = "查询所有班组", operDesc = "业务级事件",operType="查询")
|
||||
@PreAuthorize("@pms.hasPermission('sys:samples:query')" )
|
||||
public ServerResponse getToolsSelected() {
|
||||
try {
|
||||
List<TestReportManageDto> list = testReportManageService.getTeamSelected();
|
||||
return ServerResponse.createSuccess(list);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return ServerResponse.createErroe("操作失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 派工
|
||||
*/
|
||||
@PostMapping("dispatchWork")
|
||||
@DecryptAndVerify(decryptedClass = TestReportManageDto.class)//加解密统一管理
|
||||
@LogAnnotation(operModul = "收样管理", operation = "派工", operDesc = "业务级事件", operType = "新增")
|
||||
@PreAuthorize("@pms.hasPermission('sys:samples:dispatch')")
|
||||
public ServerResponse dispatchWork(EncryptedReq<TestReportManageDto> vo) {
|
||||
try {
|
||||
return testReportManageService.dispatchWork(vo.getData());
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
return ServerResponse.createErroe("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
package com.bonus.aqgqj.basis.dao;
|
||||
|
||||
import com.bonus.aqgqj.basis.entity.dto.TestReportManageDto;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface TestReportManageDao {
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<TestReportManageDto> list(TestReportManageDto bean);
|
||||
|
||||
/**
|
||||
* 获取工器具
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
String getSampleTools(Integer id);
|
||||
|
||||
/**
|
||||
* 获取详情列表
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
List<TestReportManageDto> getDetailsList(TestReportManageDto data);
|
||||
|
||||
/**
|
||||
* 获取工器具
|
||||
* @return
|
||||
*/
|
||||
List<TestReportManageDto> listTools();
|
||||
|
||||
/**
|
||||
* 获取所有单位名称
|
||||
* @return
|
||||
*/
|
||||
List<TestReportManageDto> getAllCustomName();
|
||||
|
||||
/**
|
||||
* 新增收样数据 tb_samples
|
||||
* @param TestReportManageDto
|
||||
* @return
|
||||
*/
|
||||
int addSamples(TestReportManageDto TestReportManageDto);
|
||||
|
||||
/**
|
||||
* 新增设备数据 tb_samples_device
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
int addSamplesDevice(TestReportManageDto dto);
|
||||
|
||||
/**
|
||||
* 设备类型编码
|
||||
* @param sampleToolsId
|
||||
* @return
|
||||
*/
|
||||
String getDevTypeCodeById(Integer sampleToolsId);
|
||||
|
||||
/**
|
||||
* 获取设备编码
|
||||
* @param nowDate
|
||||
* @return
|
||||
*/
|
||||
String selectCustomerCode(String nowDate);
|
||||
|
||||
/**
|
||||
* 获取班组
|
||||
* @return
|
||||
*/
|
||||
List<TestReportManageDto> getTeamSelected();
|
||||
|
||||
/**
|
||||
* 修改班组
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
int updateTeamId(TestReportManageDto dto);
|
||||
}
|
||||
|
|
@ -0,0 +1,152 @@
|
|||
package com.bonus.aqgqj.basis.entity.dto;
|
||||
|
||||
import com.bonus.aqgqj.base.entity.PageEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 工器具个体管理
|
||||
* @author hay
|
||||
*/
|
||||
@Data
|
||||
public class TestReportManageDto extends PageEntity {
|
||||
|
||||
private static final long serialVersionUID = -6525908145032868837L;
|
||||
|
||||
private Integer id;
|
||||
|
||||
private String ids;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 送样单位id
|
||||
*/
|
||||
private Integer customId;
|
||||
|
||||
/**
|
||||
* 送样单位
|
||||
*/
|
||||
private String customName;
|
||||
|
||||
/**
|
||||
* 送样部门
|
||||
*/
|
||||
private String sampleDepartment;
|
||||
|
||||
/**
|
||||
* 送样人
|
||||
*/
|
||||
private String sampleUser;
|
||||
|
||||
/**
|
||||
* 送样时间
|
||||
*/
|
||||
private String sampleTime;
|
||||
|
||||
/**
|
||||
* 送样设备id
|
||||
*/
|
||||
private Integer sampleToolsId;
|
||||
|
||||
/**
|
||||
* 送样设备
|
||||
*/
|
||||
private String sampleTools;
|
||||
|
||||
/**
|
||||
* 收样人
|
||||
*/
|
||||
private String collectSamplesUser;
|
||||
|
||||
/**
|
||||
* 收样时间
|
||||
*/
|
||||
private String collectSamplesTime;
|
||||
|
||||
/**
|
||||
* 班组Id
|
||||
*/
|
||||
private Integer teamId;
|
||||
|
||||
/**
|
||||
* 班组
|
||||
*/
|
||||
private String teamName;
|
||||
|
||||
/**
|
||||
* 设备编号 (手填/扫码)
|
||||
*/
|
||||
private String devCode;
|
||||
|
||||
/**
|
||||
* 设备类型编码
|
||||
*/
|
||||
private String devTypeCode;
|
||||
|
||||
/**
|
||||
* 客户自编号(设备编码--自动生成)
|
||||
*/
|
||||
private String customerCode;
|
||||
|
||||
/**
|
||||
* 生产厂家
|
||||
*/
|
||||
private String factoryName;
|
||||
|
||||
/**
|
||||
* 生产日期
|
||||
*/
|
||||
private String manufactureDate;
|
||||
|
||||
/**
|
||||
* 设备规格
|
||||
*/
|
||||
private String devModule;
|
||||
|
||||
/**
|
||||
* 试验日期
|
||||
*/
|
||||
private String experTime;
|
||||
|
||||
/**
|
||||
* 下次试验日期
|
||||
*/
|
||||
private String nextExperTime;
|
||||
|
||||
/**
|
||||
* 试验人员
|
||||
*/
|
||||
private String experUser;
|
||||
|
||||
/**
|
||||
* 试验结论
|
||||
*/
|
||||
private String experConclu;
|
||||
|
||||
/**
|
||||
* 关键字
|
||||
*/
|
||||
private String keyWord;
|
||||
|
||||
private String paramsList;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Integer createBy;
|
||||
|
||||
/**
|
||||
* 试验项内容数量
|
||||
*/
|
||||
private Integer experItemNum;
|
||||
|
||||
/**
|
||||
* 样品数量
|
||||
*/
|
||||
private Integer devNum;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
package com.bonus.aqgqj.basis.service;
|
||||
|
||||
import com.bonus.aqgqj.basis.entity.dto.TestReportManageDto;
|
||||
import com.bonus.aqgqj.utils.ServerResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 工器具个体管理
|
||||
* @author hay
|
||||
*/
|
||||
public interface TestReportManageService {
|
||||
/**
|
||||
* 查询列表
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<TestReportManageDto> list(TestReportManageDto bean);
|
||||
|
||||
/**
|
||||
* 详情列表
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
List<TestReportManageDto> getDetailsList(TestReportManageDto data);
|
||||
|
||||
/**
|
||||
* 工器具列表
|
||||
* @return
|
||||
*/
|
||||
List<TestReportManageDto> listTools();
|
||||
|
||||
/**
|
||||
* 单位列表
|
||||
* @return
|
||||
*/
|
||||
List<TestReportManageDto> getAllCustomName();
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
ServerResponse addSamples(TestReportManageDto data);
|
||||
|
||||
/**
|
||||
* 获取所有班组数据
|
||||
* @return
|
||||
*/
|
||||
List<TestReportManageDto> getTeamSelected();
|
||||
|
||||
/**
|
||||
* 派工
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
ServerResponse dispatchWork(TestReportManageDto data);
|
||||
}
|
||||
|
|
@ -0,0 +1,164 @@
|
|||
package com.bonus.aqgqj.basis.service.impl;
|
||||
|
||||
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.service.SamplesManageService;
|
||||
import com.bonus.aqgqj.basis.service.TestReportManageService;
|
||||
import com.bonus.aqgqj.utils.DateTimeHelper;
|
||||
import com.bonus.aqgqj.utils.ServerResponse;
|
||||
import com.bonus.aqgqj.utils.StringHelper;
|
||||
import com.bonus.aqgqj.utils.UserUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 工器具个体管理
|
||||
* @author hay
|
||||
* @date 2024/7/20 16:10
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class TestReportManageServiceImpl implements TestReportManageService {
|
||||
|
||||
|
||||
@Resource
|
||||
private TestReportManageDao testReportManageDao;
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<TestReportManageDto> list(TestReportManageDto bean) {
|
||||
List<TestReportManageDto> list = testReportManageDao.list(bean);
|
||||
for (TestReportManageDto dto : list){
|
||||
String sampleTools = testReportManageDao.getSampleTools(dto.getId());
|
||||
dto.setSampleTools(sampleTools);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询详情列表
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<TestReportManageDto> getDetailsList(TestReportManageDto data) {
|
||||
return testReportManageDao.getDetailsList(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TestReportManageDto> listTools() {
|
||||
List<TestReportManageDto> list = testReportManageDao.listTools();
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有单位列表
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<TestReportManageDto> getAllCustomName() {
|
||||
return testReportManageDao.getAllCustomName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ServerResponse addSamples(TestReportManageDto data) {
|
||||
JSONArray jsonArray = JSONObject.parseArray(data.getParamsList());
|
||||
List<TestReportManageDto> TestReportManageDtos = jsonArray.toJavaList(TestReportManageDto.class);
|
||||
if (TestReportManageDtos.size() > 0){
|
||||
//先增加基础数据表,并返回Id
|
||||
Integer userId = Integer.parseInt(UserUtil.getLoginUser().getId().toString());
|
||||
TestReportManageDtos.get(0).setCreateBy(userId);
|
||||
int re= testReportManageDao.addSamples(TestReportManageDtos.get(0));
|
||||
if (re>0){
|
||||
//添加详情数据
|
||||
for (TestReportManageDto dto : TestReportManageDtos){
|
||||
//查询设备类型编码
|
||||
if (dto.getSampleToolsId()!=null){
|
||||
String devTypeCode = testReportManageDao.getDevTypeCodeById(dto.getSampleToolsId());
|
||||
dto.setDevTypeCode(devTypeCode);
|
||||
}
|
||||
//生成设备编码
|
||||
String customerCode = customerCodeRule();
|
||||
dto.setCustomerCode(customerCode);
|
||||
dto.setId(TestReportManageDtos.get(0).getId());
|
||||
dto.setCreateBy(userId);
|
||||
int res= testReportManageDao.addSamplesDevice(dto);
|
||||
if (res<=0){
|
||||
throw new RuntimeException("收样设备信息表添加失败");
|
||||
}
|
||||
}
|
||||
}else {
|
||||
throw new RuntimeException("收样单位信息表添加失败");
|
||||
}
|
||||
}else {
|
||||
throw new RuntimeException("未获取到数据");
|
||||
}
|
||||
return ServerResponse.createBySuccessMsg("上传成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有班组
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<TestReportManageDto> getTeamSelected() {
|
||||
return testReportManageDao.getTeamSelected();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ServerResponse dispatchWork(TestReportManageDto data) {
|
||||
if (StringHelper.isNotEmpty(data.getIds())){
|
||||
//拆分用逗号分隔的数据
|
||||
String[] ids = data.getIds().split(",");
|
||||
for (String id : ids){
|
||||
TestReportManageDto dto = new TestReportManageDto();
|
||||
dto.setId(Integer.parseInt(id));
|
||||
dto.setTeamId(data.getTeamId());
|
||||
//更新班组数据
|
||||
int res = testReportManageDao.updateTeamId(dto);
|
||||
if (res<=0){
|
||||
throw new RuntimeException("派工失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
return ServerResponse.createBySuccessMsg("派工成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备编号--自动生成
|
||||
* 生成规则:YYMMDDNNNN
|
||||
* YYMMDD:年月日
|
||||
* NNNN: 当天收样的流水号,采用四位数字,从0001开始,每天重新计数
|
||||
*/
|
||||
private String customerCodeRule() {
|
||||
String nowDate = DateTimeHelper.getNowYMD();
|
||||
//查询本日收样流水号
|
||||
String customerCode = testReportManageDao.selectCustomerCode(nowDate);
|
||||
if (StringHelper.isNotEmpty(customerCode)) {
|
||||
// 将字符串转换为整数
|
||||
int num = Integer.parseInt(customerCode);
|
||||
// 执行加一操作
|
||||
num++;
|
||||
// 将结果转换回字符串格式,并确保结果是四位数,不足四位则在前面补0
|
||||
customerCode = String.format("%04d", num);
|
||||
} else {
|
||||
customerCode = "0001";
|
||||
}
|
||||
String code = nowDate + customerCode;
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -41,7 +41,7 @@
|
|||
</insert>
|
||||
<update id="updateTeamId">
|
||||
UPDATE tb_sample
|
||||
SET team_id = #{teamId}
|
||||
SET team_id = #{teamId},dispatch_time=NOW()
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,166 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.aqgqj.basis.dao.TestReportManageDao">
|
||||
<insert id="addSamples" keyColumn="id" keyProperty="id" useGeneratedKeys="true">
|
||||
INSERT INTO tb_sample(custom_id,
|
||||
custom_name,
|
||||
department,
|
||||
sample_user,
|
||||
sample_time,
|
||||
create_time,
|
||||
create_user,
|
||||
sample_date)
|
||||
VALUES (#{customId},
|
||||
#{customName},
|
||||
#{sampleDepartment},
|
||||
#{sampleUser},
|
||||
#{sampleTime},
|
||||
NOW(),
|
||||
#{createBy},
|
||||
#{sampleTime})
|
||||
</insert>
|
||||
<insert id="addSamplesDevice">
|
||||
INSERT INTO tb_sample_device(sample_id,
|
||||
dev_type_name,
|
||||
dev_type_code,
|
||||
dev_module,
|
||||
dev_code,
|
||||
customer_code,
|
||||
sample_time,
|
||||
create_time,
|
||||
create_user)
|
||||
VALUES (#{id},
|
||||
#{sampleTools},
|
||||
#{devTypeCode},
|
||||
#{devModule},
|
||||
#{devCode},
|
||||
#{customerCode},
|
||||
#{sampleTime},
|
||||
NOW(),
|
||||
#{createBy})
|
||||
</insert>
|
||||
<update id="updateTeamId">
|
||||
UPDATE tb_sample
|
||||
SET team_id = #{teamId}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="list" resultType="com.bonus.aqgqj.basis.entity.dto.TestReportManageDto">
|
||||
select
|
||||
ts.id,
|
||||
tc.custom_name AS customName,
|
||||
ts.sample_user AS sampleUser,
|
||||
ts.sample_time AS sampleTime,
|
||||
su.user_name AS collectSamplesUser,
|
||||
tsd.create_time AS collectSamplesTime,
|
||||
tt.team_name AS teamName,
|
||||
IFNULL(te.devNum,0) as devNum
|
||||
FROM tb_sample ts
|
||||
LEFT JOIN tb_custom tc
|
||||
on tc.id = ts.custom_id
|
||||
LEFT JOIN tb_sample_device tsd on tsd.sample_id = ts.id
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
te.sample_id,
|
||||
SUM( te.dev_num ) AS devNum
|
||||
FROM
|
||||
tb_exper te
|
||||
WHERE
|
||||
te.del_flag = 0
|
||||
GROUP BY
|
||||
te.sample_id
|
||||
) te ON te.sample_id = ts.id
|
||||
LEFT JOIN sys_user su on su.id = tsd.create_user
|
||||
LEFT JOIN tb_team tt on tt.id = ts.team_id
|
||||
WHERE ts.del_flag = '0'
|
||||
<if test="collectSamplesUser != null and collectSamplesUser != ''">
|
||||
AND su.user_name like concat('%', #{collectSamplesUser}, '%')
|
||||
</if>
|
||||
<if test="sampleTools != null and sampleTools != ''">
|
||||
and tsd.dev_type_name like concat('%',#{sampleTools}, '%')
|
||||
</if>
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
AND (
|
||||
ts.sample_user like concat('%', #{keyWord}, '%') OR
|
||||
tc.custom_name like concat('%', #{keyWord}, '%') OR
|
||||
tt.team_name like concat('%', #{keyWord}, '%')
|
||||
)
|
||||
</if>
|
||||
GROUP BY ts.id
|
||||
</select>
|
||||
<select id="getSampleTools" resultType="java.lang.String">
|
||||
SELECT GROUP_CONCAT(aa.dev_type_name SEPARATOR '、') AS sampleTools
|
||||
FROM (SELECT DISTINCT tsd.dev_type_name
|
||||
FROM tb_sample_device tsd
|
||||
LEFT JOIN tb_sample ts ON ts.id = tsd.sample_id
|
||||
WHERE tsd.sample_id = #{id}
|
||||
AND tsd.del_falg = '0') aa
|
||||
</select>
|
||||
<select id="getDetailsList" resultType="com.bonus.aqgqj.basis.entity.dto.TestReportManageDto">
|
||||
SELECT
|
||||
te.id,
|
||||
te.dev_type_name as sampleTools,
|
||||
ts.department as sampleDepartment,
|
||||
te.dev_module as devModule,
|
||||
te.dev_num as devNum
|
||||
FROM
|
||||
tb_exper te
|
||||
LEFT JOIN tb_sample ts on ts.id=te.sample_id and ts.del_flag=0
|
||||
WHERE
|
||||
te.del_flag=0
|
||||
and ts.id=#{id}
|
||||
<if test="sampleTools != null and sampleTools != ''">
|
||||
and te.dev_type_name like concat('%',#{sampleTools}, '%')
|
||||
</if>
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
AND (
|
||||
ts.department like concat('%', #{keyWord}, '%') OR
|
||||
te.dev_module like concat('%', #{keyWord}, '%')
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
<select id="listTools" resultType="com.bonus.aqgqj.basis.entity.dto.TestReportManageDto">
|
||||
select
|
||||
id,
|
||||
dict_name as name
|
||||
from
|
||||
sys_distinct
|
||||
where
|
||||
p_id = 92
|
||||
and del_flag = 0
|
||||
</select>
|
||||
<select id="getAllCustomName" resultType="com.bonus.aqgqj.basis.entity.dto.TestReportManageDto">
|
||||
SELECT
|
||||
id,
|
||||
custom_name AS name
|
||||
FROM
|
||||
tb_custom
|
||||
WHERE
|
||||
del_flag = 0
|
||||
and custom_status=0
|
||||
</select>
|
||||
<select id="getDevTypeCodeById" resultType="java.lang.String">
|
||||
select sd.dict_code
|
||||
from sys_distinct sd
|
||||
where sd.p_id = 92
|
||||
and sd.id = #{sampleToolsId}
|
||||
and del_flag = 0
|
||||
</select>
|
||||
<select id="selectCustomerCode" resultType="java.lang.String">
|
||||
SELECT
|
||||
SUBSTRING( customer_code, - 4 ) AS CODE
|
||||
FROM
|
||||
tb_sample_device
|
||||
WHERE
|
||||
SUBSTRING( customer_code, 1, 8 )= #{nowDate}
|
||||
ORDER BY
|
||||
customer_code DESC
|
||||
LIMIT 1
|
||||
</select>
|
||||
<select id="getTeamSelected" resultType="com.bonus.aqgqj.basis.entity.dto.TestReportManageDto">
|
||||
SELECT id,
|
||||
team_name AS name
|
||||
FROM tb_team
|
||||
WHERE del_flag = 0
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -42,9 +42,9 @@
|
|||
</select>
|
||||
<!--新增用户-->
|
||||
<insert id="saveUser" parameterType="com.bonus.aqgqj.model.SysUser" >
|
||||
insert into sys_user(login_name, user_name, user_code, sex, org_id, role_id, phone, user_type, state, password,create_time)
|
||||
insert into sys_user(login_name, user_name, user_code, sex, org_id, role_id, phone, user_type, state, password,team_id,create_time)
|
||||
values (#{loginName}, #{username}, #{userCode}, #{sex}, #{orgId}, #{roleId}, #{phone}, #{userType}, #{state},
|
||||
#{password},NOW())
|
||||
#{password},#{teamId},NOW())
|
||||
</insert>
|
||||
<!--登录查询用户-->
|
||||
<select id="getUser" parameterType="String" resultType="com.bonus.aqgqj.model.SysUser">
|
||||
|
|
@ -84,11 +84,11 @@
|
|||
t.user_code AS userCode,
|
||||
t.sex,
|
||||
t.org_id as orgId,
|
||||
CONCAT(so.org_name,'/',t.team_name) as orgName,
|
||||
CONCAT(so.org_name,'/',tt.team_name) as orgName,
|
||||
sr.role_name roleName,
|
||||
t.phone AS phone,
|
||||
t.team_id as teamId,
|
||||
t.team_name as teamName,
|
||||
tt.team_name as teamName,
|
||||
CASE
|
||||
t.user_type
|
||||
WHEN '0' THEN
|
||||
|
|
@ -101,6 +101,7 @@
|
|||
FROM
|
||||
sys_user t
|
||||
LEFT JOIN sys_role sr ON sr.role_id = t.role_id
|
||||
left join tb_team tt on tt.id = t.team_id and tt.del_flag = 0
|
||||
LEFT JOIN sys_org so ON so.org_id = t.org_id
|
||||
where t.del_flag = 0
|
||||
<if test="username != null and username != ''">
|
||||
|
|
|
|||
|
|
@ -128,6 +128,7 @@ function initTable(dataList) {
|
|||
elem: "#table_data",
|
||||
height: "full-130",
|
||||
data: dataList,
|
||||
limit:10000,
|
||||
cols: [
|
||||
[
|
||||
//表头
|
||||
|
|
|
|||
|
|
@ -157,8 +157,13 @@ function getCheckedValues() {
|
|||
return '';
|
||||
}
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
ids.push(data[i].id);
|
||||
if (!data[i].teamName) {
|
||||
// teamName 为空时才加入 ids 数组
|
||||
ids.push(data[i].id);
|
||||
}
|
||||
}
|
||||
console.log("ids1:", ids);
|
||||
console.log("ids2:", ids.join(','))
|
||||
// 将 ids 数组用逗号分隔成字符串
|
||||
return ids.join(',');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,10 +5,11 @@ let data = [], appResList = [];
|
|||
// 角色下拉选
|
||||
let roleList;
|
||||
let orgData;
|
||||
let teamList;
|
||||
// showDictSelect("orgId", "org_id");
|
||||
showDictSelect("sex", "sex");
|
||||
showDictSelect("unit", "unit");
|
||||
showDictSelect("dept", "dept");
|
||||
// showDictSelect("sex", "sex");
|
||||
// showDictSelect("unit", "unit");
|
||||
// showDictSelect("dept", "dept");
|
||||
function setParams(params) {
|
||||
console.log(params)
|
||||
idParam = JSON.parse(params).id;
|
||||
|
|
@ -23,6 +24,7 @@ function setParams(params) {
|
|||
dtree = layui.dtree;
|
||||
var $ = layui.jquery;
|
||||
roleList = getRoleSelected();
|
||||
teamList = getTeamSelected();
|
||||
orgData = getOrgTree();
|
||||
if (idParam) {
|
||||
getUserById();
|
||||
|
|
@ -71,13 +73,32 @@ function setParams(params) {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取角色数据
|
||||
*/
|
||||
function getRoleSelected() {
|
||||
let url = dataUrl + '/roles/all';
|
||||
ajaxRequest(url, "POST", null, true, function () {
|
||||
}, function (result) {
|
||||
if (result.code === 200) {
|
||||
setSelectValue(result.data, 'roleId');
|
||||
// return result.data
|
||||
} else {
|
||||
layer.alert(result.msg, {icon: 2})
|
||||
}
|
||||
}, function (xhr) {
|
||||
error(xhr)
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取班组数据
|
||||
*/
|
||||
function getTeamSelected() {
|
||||
let url = dataUrl + '/samples/getTeamSelected';
|
||||
ajaxRequest(url, "POST", null, true, function () {
|
||||
}, function (result) {
|
||||
if (result.code === 200) {
|
||||
setSelectValue(result.data, 'teamId');
|
||||
} else {
|
||||
layer.alert(result.msg, {icon: 2})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
let form, layer, dtree, table, tableIns;
|
||||
let pageNum = 1, limitSize = 10; // 默认第一页,分页数量为10
|
||||
let orgData,selectOrgId;
|
||||
let orgData,selectOrgId="";
|
||||
|
||||
layui.config({
|
||||
base: "../../js/layui-v2.6.8/dtree/", //此处路径请自行处理, 可以使用绝对路径
|
||||
|
|
@ -147,7 +147,7 @@ function getReqParams(page, limit, type) {
|
|||
limit: limit + "",
|
||||
userName: $('#userName').val(),
|
||||
phone: $('#phone').val(),
|
||||
orgId: $('#orgId').val(),
|
||||
orgId: selectOrgId,
|
||||
userType: $('#userType').val(),
|
||||
};
|
||||
} else {
|
||||
|
|
@ -274,8 +274,8 @@ function resetPwd(id) {
|
|||
|
||||
function getOrgTree() {
|
||||
let data = [];
|
||||
let url = dataUrl + '/users/getOrg';
|
||||
ajaxRequest(url, "POST", null, true, function () {
|
||||
let url = dataUrl + '/sys/org/getOrgTree';
|
||||
ajaxRequest(url, "POST", null, false, function () {
|
||||
}, function (result) {
|
||||
if (result.code === 200) {
|
||||
console.log(result,"getOrgTree")
|
||||
|
|
@ -292,20 +292,40 @@ function getOrgTree() {
|
|||
|
||||
function setOrgTree(data){
|
||||
console.log("data",data)
|
||||
orgTree = dtree.renderSelect({
|
||||
var af=0,bf=0;
|
||||
$.each(data, function (i, item) {
|
||||
if(item.id==0){
|
||||
item.id="99999";
|
||||
item.parentId="0";
|
||||
item.title="请选择组织机构";
|
||||
af=1;
|
||||
}
|
||||
if(item.id==1){
|
||||
item.parentId="99999";
|
||||
bf=1;
|
||||
}
|
||||
if(af==1&&bf==1){
|
||||
return
|
||||
}
|
||||
})
|
||||
orgTree =dtree.renderSelect({
|
||||
elem: "#orgId",
|
||||
data: data,
|
||||
width: "100%", // 指定树的宽度
|
||||
dataFormat: "list",
|
||||
skin: "laySimple",
|
||||
selectInitVal: null,
|
||||
selectTips: "请选择组织机构",
|
||||
data: data,
|
||||
line: true, // 显示树线
|
||||
checkbar: false, //开启复选框
|
||||
done: function (data, url, first) {
|
||||
console.log($('#orgId').val())
|
||||
if (first) {
|
||||
var params = dtree.dataInit("orgId", $('#orgId').val());
|
||||
var selectParam = dtree.selectVal("orgId");
|
||||
console.log(params)
|
||||
}
|
||||
skin: "laySimple",
|
||||
done: function (result, $ul, first) {
|
||||
}
|
||||
});
|
||||
dtree.on('node(orgId)', function (obj) {
|
||||
console.log("obj.param.nodeId",obj.param.nodeId); // 打印选中节点的值
|
||||
if(obj.param.nodeId=="99999"){
|
||||
selectOrgId="";
|
||||
}else{
|
||||
selectOrgId=obj.param.nodeId;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,280 @@
|
|||
let form, layer, table, tableIns;
|
||||
let pageNum = 1, limitSize = 10; // 默认第一页,分页数量为10
|
||||
let orgData,selectOrgId;
|
||||
let idParam;
|
||||
|
||||
function setParams(params){
|
||||
idParam = JSON.parse(params).id;
|
||||
layui.use(['form', 'layer', 'table', 'laydate'], function () {
|
||||
form = layui.form;
|
||||
layer = layui.layer;
|
||||
table = layui.table;
|
||||
layui.form.render();
|
||||
pages(1, 10, 1);
|
||||
getToolsSelected();
|
||||
})
|
||||
}
|
||||
|
||||
function pages(pageNum, pageSize, typeNum) {
|
||||
let params = getReqParams(pageNum, pageSize, typeNum);
|
||||
let url = dataUrl + "/testReport/getDetailsList"
|
||||
ajaxRequest(url, "POST", params, true, function () {
|
||||
}, function (result) {
|
||||
console.log(result);
|
||||
if (result.code === 200) {
|
||||
if (result.data) {
|
||||
initTable(result.data, result.limit, result.curr)
|
||||
laypages(result.count, result.curr, result.limit)
|
||||
}
|
||||
} else if (result.code === 500) {
|
||||
layer.alert(result.msg, {icon: 2})
|
||||
}
|
||||
}, function (xhr) {
|
||||
error(xhr)
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function getToolsSelected() {
|
||||
let url = dataUrl + '/samples/all';
|
||||
ajaxRequest(url, "POST", null, true, function () {
|
||||
}, function (result) {
|
||||
if (result.code === 200) {
|
||||
setSelectValue(result.data, 'sampleTools');
|
||||
// return result.data
|
||||
} else {
|
||||
layer.alert(result.msg, {icon: 2})
|
||||
}
|
||||
}, function (xhr) {
|
||||
error(xhr)
|
||||
});
|
||||
}
|
||||
|
||||
function laypages(total, page, limit) {
|
||||
layui.use(['laypage'], function () {
|
||||
let laypage = layui.laypage;
|
||||
laypage.render({
|
||||
elem: 'voi-page',
|
||||
count: total,
|
||||
curr: page,
|
||||
limit: limit,
|
||||
limits: [10, 20, 50, 100, 200, 500],
|
||||
layout: ['prev', 'page', 'next', 'skip', 'count', 'limit'],
|
||||
groups: 5,
|
||||
jump: function (obj, first) {
|
||||
if (!first) {
|
||||
pageNum = obj.curr, limitSize = obj.limit;
|
||||
pages(obj.curr, obj.limit, null);
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/*初始化表格*/
|
||||
function initTable(dataList, limit, page) {
|
||||
let loadingMsg = layer.msg("数据加载中,请稍候...", {icon: 16, scrollbar: false, time: 0,});
|
||||
tableIns = table.render({
|
||||
elem: "#table_data",
|
||||
height: "full-130",
|
||||
data: dataList,
|
||||
limit: limit,
|
||||
cols: [
|
||||
[
|
||||
//表头
|
||||
{title: "序号", width: 80, unresize: true, align: "center",
|
||||
templet: function (d) {
|
||||
return (page - 1) * limit + d.LAY_INDEX;
|
||||
}
|
||||
},
|
||||
{field: "sampleTools", title: "设备类型", unresize: true, align: "center"},
|
||||
{field: "devNum", title: "报告编号", unresize: true, align: "center"},
|
||||
{field: "sampleDepartment", title: "送样部门", unresize: true, align: "center"},
|
||||
{field: "devModule", title: "规格型号", unresize: true, align: "center"},
|
||||
{
|
||||
field: "devNum",
|
||||
title: "样品数量",
|
||||
unresize: true,
|
||||
align: "center",
|
||||
templet: function (d) {
|
||||
return `<span style="color: blue">${d.devNum}</span>`;
|
||||
}
|
||||
},
|
||||
{field: "devNum", title: "检测结果", unresize: true, align: "center"},
|
||||
{field: "devNum", title: "检测时间", unresize: true, align: "center"},
|
||||
{
|
||||
field: "view1", title: "检测报告", unresize: true, align: "center",
|
||||
templet: function (d) {
|
||||
return '<a href="#" style="color: blue;" onclick="handleClick1(\'' + d.id + '\')">查看</a>';
|
||||
}
|
||||
},
|
||||
],
|
||||
],
|
||||
done: function (res, curr, count) {
|
||||
layer.close(loadingMsg);
|
||||
table.resize("table_data");
|
||||
count || this.elem.next(".layui-table-view").find(".layui-table-header").css("display", "inline-block");
|
||||
count || this.elem.next(".layui-table-view").find(".layui-table-box").css("overflow", "auto");
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function handleClick1(view1) {
|
||||
alert('Clicked on: ' + view1);
|
||||
}
|
||||
|
||||
function handleClick2(view1) {
|
||||
alert('Clicked on: ' + view1);
|
||||
}
|
||||
|
||||
function handleClick3(view1) {
|
||||
alert('Clicked on: ' + view1);
|
||||
}
|
||||
|
||||
// 获取参数
|
||||
function getReqParams(page, limit, type) {
|
||||
var selectedValue =$('#sampleTools').val()
|
||||
// 2. 查找对应的选项文本
|
||||
var selectedText = $('#sampleTools option[value="' + selectedValue + '"]').text();
|
||||
if (selectedText=='请选择设备类型'){
|
||||
selectedText=''
|
||||
}
|
||||
let obj = {};
|
||||
if (!type) {
|
||||
obj = {
|
||||
page: page + "",
|
||||
limit: limit + "",
|
||||
id: idParam,
|
||||
sampleTools: selectedText,
|
||||
keyWord:$('#keyWord').val()
|
||||
};
|
||||
} else {
|
||||
obj = {
|
||||
page: '1',
|
||||
limit: '10',
|
||||
id: idParam,
|
||||
sampleTools: selectedText,
|
||||
keyWord: ''
|
||||
};
|
||||
}
|
||||
console.log(obj)
|
||||
obj={
|
||||
encryptedData:encryptCBC(JSON.stringify(obj))
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
// 查询/重置
|
||||
function query() {
|
||||
let pattern = new RegExp("[%_<>]");
|
||||
if (pattern.test($("#loginName").val())) {
|
||||
$("#loginName").val('');
|
||||
return layer.msg('用户名查询包含特殊字符,请重新输入', {
|
||||
icon: 2,
|
||||
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
||||
});
|
||||
}
|
||||
if (pattern.test($("#phone").val())) {
|
||||
$("#phone").val('');
|
||||
return layer.msg('手机号查询包含特殊字符,请重新输入', {
|
||||
icon: 2,
|
||||
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
||||
});
|
||||
}
|
||||
pageNum = 1;
|
||||
pages(1, limitSize);
|
||||
}
|
||||
|
||||
|
||||
//重置
|
||||
function reset() {
|
||||
pages(1, limitSize, 1)
|
||||
}
|
||||
|
||||
|
||||
function reloadData() {
|
||||
pages(pageNum, limitSize);
|
||||
}
|
||||
|
||||
// 新增/修改平台用户
|
||||
function addData(id) {
|
||||
if (id) {
|
||||
title = '详情';
|
||||
}
|
||||
let param = {
|
||||
'id': id
|
||||
}
|
||||
openIframe2("addOrEditUser", title, "child/toolsFrom.html", '100%', '100%', param);
|
||||
}
|
||||
|
||||
/*删除用户*/
|
||||
function delData(id) {
|
||||
layer.confirm("确定删除吗?", {
|
||||
move: false
|
||||
}, function () {
|
||||
let loadingMsg = layer.msg('数据删除中,请稍候...', {icon: 16, scrollbar: false, time: 0});
|
||||
let url = dataUrl + "/users/delById";
|
||||
let params = {
|
||||
'id': id
|
||||
}
|
||||
params={
|
||||
encryptedData:encryptCBC(JSON.stringify(params))
|
||||
}
|
||||
ajaxRequest(url, "POST", params, true, function () {
|
||||
}, function (result) {
|
||||
layer.close(loadingMsg); // 关闭提示层
|
||||
if (result.code === 200) {
|
||||
parent.layer.msg(result.msg, {icon: 1})
|
||||
query()
|
||||
} else if (result.code === 500) {
|
||||
layer.alert(result.msg, {icon: 2})
|
||||
}
|
||||
}, function (xhr) {
|
||||
layer.close(loadingMsg); // 关闭提示层
|
||||
error(xhr)
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
// 启用/停用/解除锁定
|
||||
function editUserAccountStatus(id, status, type) {
|
||||
let url = dataUrl + "/sys/user/editUserAccountStatus?token=" + token;
|
||||
let params = {
|
||||
'id': id,
|
||||
'accountStatus': status,
|
||||
'type': type
|
||||
}
|
||||
ajaxRequest(url, "POST", params, true, function () {
|
||||
}, function (result) {
|
||||
if (result.code === 200) {
|
||||
if(type){
|
||||
reloadData();
|
||||
}
|
||||
parent.layer.msg(result.msg, {icon: 1})
|
||||
} else if (result.code === 500) {
|
||||
layer.alert(result.msg, {icon: 2})
|
||||
}
|
||||
}, function (xhr) {
|
||||
error(xhr)
|
||||
});
|
||||
}
|
||||
|
||||
// 管理员修改密码
|
||||
function resetPwd(id) {
|
||||
let param = {
|
||||
'id': id,
|
||||
'type': '1'
|
||||
}
|
||||
openIframe2("addOrEditUnifyUser", '修改密码', "password.html", '770px', '400px', param);
|
||||
}
|
||||
|
||||
/*下拉选表单赋值*/
|
||||
function setSelectValue(list, selectName) {
|
||||
console.log("list",list)
|
||||
let html = '<option value="" selected>请选择设备类型</option>';
|
||||
$.each(list, function (index, item) {
|
||||
html += '<option value="' + item.id + '">' + item.name + '</option>';
|
||||
})
|
||||
$('#' + selectName).empty().append(html);
|
||||
layui.form.render();
|
||||
}
|
||||
|
|
@ -0,0 +1,351 @@
|
|||
let form, layer, table, tableIns;
|
||||
let pageNum = 1, limitSize = 10; // 默认第一页,分页数量为10
|
||||
let orgData,selectOrgId;
|
||||
let quanju = new Array();//全局
|
||||
let huancun = new Array();//缓存
|
||||
|
||||
layui.use(['form', 'layer', 'table', 'laydate'], function () {
|
||||
form = layui.form;
|
||||
layer = layui.layer;
|
||||
table = layui.table;
|
||||
layui.form.render();
|
||||
pages(1, 10, 1);
|
||||
getToolsSelected();
|
||||
})
|
||||
|
||||
|
||||
function getToolsSelected() {
|
||||
let url = dataUrl + '/tools/all';
|
||||
ajaxRequest(url, "POST", null, true, function () {
|
||||
}, function (result) {
|
||||
if (result.code === 200) {
|
||||
setSelectValue(result.data, 'sampleTools');
|
||||
// return result.data
|
||||
} else {
|
||||
layer.alert(result.msg, {icon: 2})
|
||||
}
|
||||
}, function (xhr) {
|
||||
error(xhr)
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
function pages(pageNum, pageSize, typeNum) {
|
||||
let params = getReqParams(pageNum, pageSize, typeNum);
|
||||
let url = dataUrl + "/testReport/getList"
|
||||
ajaxRequest(url, "POST", params, true, function () {
|
||||
}, function (result) {
|
||||
console.log("result.data:",result.data);
|
||||
if (result.code === 200) {
|
||||
initTable(result.data, result.limit, result.curr)
|
||||
laypages(result.count, result.curr, result.limit)
|
||||
} else if (result.code === 500) {
|
||||
layer.alert(result.msg, {icon: 2})
|
||||
}
|
||||
}, function (xhr) {
|
||||
error(xhr)
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
function laypages(total, page, limit) {
|
||||
layui.use(['laypage'], function () {
|
||||
let laypage = layui.laypage;
|
||||
laypage.render({
|
||||
elem: 'voi-page',
|
||||
count: total,
|
||||
curr: page,
|
||||
limit: limit,
|
||||
limits: [10, 20, 50, 100, 200, 500],
|
||||
layout: ['prev', 'page', 'next', 'skip', 'count', 'limit'],
|
||||
groups: 5,
|
||||
jump: function (obj, first) {
|
||||
if (!first) {
|
||||
pageNum = obj.curr, limitSize = obj.limit;
|
||||
pages(obj.curr, obj.limit, null);
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化表格
|
||||
*/
|
||||
function initTable(dataList, limit, page) {
|
||||
let loadingMsg = layer.msg("数据加载中,请稍候...", {icon: 16, scrollbar: false, time: 0,});
|
||||
tableIns = table.render({
|
||||
elem: "#table_data",
|
||||
height: "full-130",
|
||||
data: dataList,
|
||||
limit: limit,
|
||||
cols: [
|
||||
[
|
||||
{
|
||||
type: 'checkbox',
|
||||
fixed: 'left',
|
||||
align: "center"
|
||||
},
|
||||
//表头
|
||||
{title: "序号", width: 80, unresize: true, align: "center",
|
||||
templet: function (d) {
|
||||
return (page - 1) * limit + d.LAY_INDEX;
|
||||
}
|
||||
},
|
||||
{field: "customName", title: "送样单位", unresize: true, align: "center"},
|
||||
{field: "sampleTime", title: "送样时间", unresize: true, align: "center"},
|
||||
{field: "sampleTools", title: "送样设备", unresize: true, align: "center"},
|
||||
{field: "devNum", title: "样品数量", unresize: true, align: "center"},
|
||||
{field: "collectSamplesUser", title: "收样人", unresize: true, align: "center"},
|
||||
{field: "collectSamplesTime", title: "收样时间", unresize: true, align: "center"},
|
||||
{
|
||||
field: "teamName", title: "试验班组", unresize: true, align: "center", templet: function (d) {
|
||||
let html = '';
|
||||
let view ='';
|
||||
if (d.teamName == null) {
|
||||
view="<a style='cursor:pointer; background: #F2F3FF'' >未派工</a>";
|
||||
} else {
|
||||
view="<a style='color: black;'>" + d.teamName + "</a>";
|
||||
}
|
||||
html=view;
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{title: "操作", unresize: true, width: 85, align: "center",
|
||||
templet: function (d) {
|
||||
|
||||
let html = '';
|
||||
let view="<a style='cursor:pointer;' onclick=\"addData('" + d.id + "')\">详情</a>";
|
||||
html=view;
|
||||
if(d.delFlag==1){
|
||||
return '';
|
||||
}
|
||||
return html;
|
||||
}
|
||||
},
|
||||
],
|
||||
],
|
||||
done: function (res, curr, count) {
|
||||
layer.close(loadingMsg);
|
||||
table.resize("table_data");
|
||||
count || this.elem.next(".layui-table-view").find(".layui-table-header").css("display", "inline-block");
|
||||
count || this.elem.next(".layui-table-view").find(".layui-table-box").css("overflow", "auto");
|
||||
form.render('checkbox');
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取选中的数据
|
||||
*/
|
||||
function getCheckedValues() {
|
||||
let data = table.checkStatus("table_data").data;
|
||||
let ids = [];
|
||||
if (data.length === 0) {
|
||||
return '';
|
||||
}
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
ids.push(data[i].id);
|
||||
}
|
||||
console.log("ids1:", ids);
|
||||
console.log("ids2:", ids.join(','))
|
||||
// 将 ids 数组用逗号分隔成字符串
|
||||
return ids.join(',');
|
||||
}
|
||||
|
||||
// 获取参数
|
||||
function getReqParams(page, limit, type) {
|
||||
var selectedValue =$('#sampleTools').val()
|
||||
// 2. 查找对应的选项文本
|
||||
var selectedText = $('#sampleTools option[value="' + selectedValue + '"]').text();
|
||||
if (selectedText=='请选择设备类型'){
|
||||
selectedText=''
|
||||
}
|
||||
let obj = {};
|
||||
if (!type) {
|
||||
obj = {
|
||||
page: page + "",
|
||||
limit: limit + "",
|
||||
sampleTools: selectedText,
|
||||
collectSamplesUser:$('#collectSamplesUser').val(),
|
||||
keyWord:$('#keyWord').val()
|
||||
};
|
||||
} else {
|
||||
obj = {
|
||||
page: '1',
|
||||
limit: '10',
|
||||
sampleTools: '',
|
||||
collectSamplesUser: '',
|
||||
keyWord: ''
|
||||
};
|
||||
}
|
||||
console.log(obj)
|
||||
obj={
|
||||
encryptedData:encryptCBC(JSON.stringify(obj))
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
// 查询/重置
|
||||
function query() {
|
||||
let pattern = new RegExp("[%_<>]");
|
||||
if (pattern.test($("#loginName").val())) {
|
||||
$("#loginName").val('');
|
||||
return layer.msg('用户名查询包含特殊字符,请重新输入', {
|
||||
icon: 2,
|
||||
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
||||
});
|
||||
}
|
||||
if (pattern.test($("#phone").val())) {
|
||||
$("#phone").val('');
|
||||
return layer.msg('手机号查询包含特殊字符,请重新输入', {
|
||||
icon: 2,
|
||||
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
||||
});
|
||||
}
|
||||
pageNum = 1;
|
||||
pages(1, limitSize);
|
||||
}
|
||||
|
||||
|
||||
//重置
|
||||
function reset() {
|
||||
pages(1, limitSize, 1)
|
||||
}
|
||||
|
||||
|
||||
function reloadData() {
|
||||
pages(pageNum, limitSize);
|
||||
}
|
||||
|
||||
// 新增/修改平台用户
|
||||
function addData(id) {
|
||||
if (id) {
|
||||
title = '检测报告管理/详情';
|
||||
}
|
||||
let param = {
|
||||
'id': id
|
||||
}
|
||||
openIframe2("addOrEditUser", title, "child/testReportForm.html", '100%', '100%', param);
|
||||
}
|
||||
|
||||
/**
|
||||
* 收样
|
||||
*/
|
||||
function collectSamples(id) {
|
||||
title = '收样';
|
||||
let param = {
|
||||
'id': id
|
||||
}
|
||||
openIframe2("addOrEditUser", title, "child/samplesAdd.html", '70%', '90%', param);
|
||||
}
|
||||
|
||||
/**
|
||||
* 派工
|
||||
*/
|
||||
function dispatch() {
|
||||
//获取复选框选中数据的Id
|
||||
var ids = getCheckedValues();
|
||||
if (ids==='') {
|
||||
return layer.msg('请选择需要派工的数据', {icon: 7})
|
||||
} else {
|
||||
layer.open({
|
||||
type: 1,
|
||||
id: 'dispatch',
|
||||
area: ['380px', '45%'],
|
||||
resize: false,
|
||||
shadeClose: true,
|
||||
title: '请选择试验班组',
|
||||
content: `
|
||||
<div class="layui-form" lay-filter="filter-test-layer" style="margin: 16px;">
|
||||
<div class="demo-login-container">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-wrap">
|
||||
<select id="teamId" lay-filter="teamId" lay-verify="required" placeholder="请选择班组" name="teamId" class="form-control input-sm">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" style="margin-top: 45%;margin-left: 46%">
|
||||
<button class="layui-btn" lay-filter="demo-login">取消</button>
|
||||
<button class="layui-btn" lay-submit lay-filter="upload">确认派工</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`,
|
||||
success: function () {
|
||||
// 对弹层中的表单进行初始化渲染
|
||||
form.render();
|
||||
getTeamSelected();
|
||||
// 表单提交事件
|
||||
form.on('submit(upload)', function (data) {
|
||||
console.log("data.field:",data.field)
|
||||
let loadingMsg = layer.msg('数据上传中,请稍候...', {icon: 16, scrollbar: false, time: 0});
|
||||
let url = dataUrl + '/samples/dispatchWork';
|
||||
let params = {
|
||||
"ids": ids,
|
||||
teamId: data.field.teamId
|
||||
}
|
||||
params={
|
||||
encryptedData:encryptCBC(JSON.stringify(params))
|
||||
}
|
||||
ajaxRequest(url, "POST", params, true, function () {
|
||||
}, function (result) {
|
||||
layer.close(loadingMsg); // 关闭提示层
|
||||
if (result.code === 200) {
|
||||
closePage(1);
|
||||
parent.layer.msg("派工成功", {icon: 1});
|
||||
}else {
|
||||
layer.alert(result.msg, {icon: 2})
|
||||
}
|
||||
}, function (xhr) {
|
||||
layer.close(loadingMsg); // 关闭提示层
|
||||
error(xhr)
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取班组数据
|
||||
*/
|
||||
function getTeamSelected() {
|
||||
let url = dataUrl + '/samples/getTeamSelected';
|
||||
ajaxRequest(url, "POST", null, true, function () {
|
||||
}, function (result) {
|
||||
if (result.code === 200) {
|
||||
setSelectValue(result.data, 'teamId');
|
||||
// return result.data
|
||||
} else {
|
||||
layer.alert(result.msg, {icon: 2})
|
||||
}
|
||||
}, function (xhr) {
|
||||
error(xhr)
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 下拉选表单赋值
|
||||
*/
|
||||
function setSelectValue(list, selectName) {
|
||||
console.log("list",list)
|
||||
let html = '<option value="" selected>请选择设备类型</option>';
|
||||
$.each(list, function (index, item) {
|
||||
html += '<option value="' + item.id + '">' + item.name + '</option>';
|
||||
})
|
||||
$('#' + selectName).empty().append(html);
|
||||
layui.form.render();
|
||||
}
|
||||
|
||||
function closePage(type) {
|
||||
layer.closeAll();
|
||||
if (type === 1) {
|
||||
pages(1, 10, 1)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="../../../js/layui-v2.6.8/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="../../../js/layui-v2.6.8/dtree/dtree.css">
|
||||
<link rel="stylesheet" href="../../../js/layui-v2.6.8/dtree/font/dtreefont.css">
|
||||
<link rel="stylesheet" href="../../../css/table-common2.css">
|
||||
<script src="../../../js/libs/jquery-2.1.1.min.js" charset="UTF-8" type="text/javascript"></script>
|
||||
<script src="../../../js/layui-v2.6.8/layui.js" charset="UTF-8" type="text/javascript"></script>
|
||||
<script src="../../../js/publicJs.js"></script>
|
||||
<script src="../../../js/commonUtils.js"></script>
|
||||
<script src="../../../js/openIframe.js"></script>
|
||||
<script src="../../../js/my/aes.js"></script>
|
||||
<script src="../../../js/ajaxRequest.js"></script>
|
||||
<title>详情</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content">
|
||||
<div class="basic-search-box layout">
|
||||
<form class="layui-form basic-form" onsubmit="return false;">
|
||||
<div class="layui-form-item">
|
||||
|
||||
<div class="layui-inline" style="padding: 0 0 0 10px;">
|
||||
<div class="layui-input-inline">
|
||||
<select id="sampleTools" name="sampleTools" class="form-control input-sm">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-inline" style="padding: 0 0 0 10px;">
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="keyWord" maxlength="30" class="layui-input" autocomplete="off" placeholder="请输入关键字">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="layui-inline btns">
|
||||
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm btn-1" onclick="query(1)">查询
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="table-box" table-responsive style="z-index: 1;">
|
||||
<table id="table_data" class="table" lay-filter="table_data"></table>
|
||||
<div id="voi-page" class="layout"></div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script src="../../../js/testReport/child/testReportForm.js" charset="UTF-8" type="text/javascript"></script>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="../../js/layui-v2.6.8/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="../../js/layui-v2.6.8/dtree/dtree.css">
|
||||
<link rel="stylesheet" href="../../js/layui-v2.6.8/dtree/font/dtreefont.css">
|
||||
<link rel="stylesheet" href="../../css/table-common2.css">
|
||||
<script src="../../js/libs/jquery-2.1.1.min.js" charset="UTF-8" type="text/javascript"></script>
|
||||
<script src="../../js/layui-v2.6.8/layui.js" charset="UTF-8" type="text/javascript"></script>
|
||||
<script src="../../js/publicJs.js"></script>
|
||||
<script src="../../js/dict.js"></script>
|
||||
<script src="../../js/commonUtils.js"></script>
|
||||
<script src="../../js/openIframe.js"></script>
|
||||
<script src="../../js/my/aes.js"></script>
|
||||
<script src="../../js/ajaxRequest.js"></script>
|
||||
<title>检测报告管理</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content">
|
||||
<div class="basic-search-box layout">
|
||||
<form class="layui-form basic-form" onsubmit="return false;">
|
||||
<div class="layui-form-item">
|
||||
|
||||
<div class="layui-inline" style="padding: 0 0 0 10px;">
|
||||
<div class="layui-input-inline">
|
||||
<select id="sampleTools" name="sampleTools" class="form-control input-sm">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-inline" style="padding: 0 0 0 10px;">
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="collectSamplesUser" maxlength="30" class="layui-input" autocomplete="off" placeholder="请输入收样人">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-inline" style="padding: 0 0 0 10px;">
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="keyWord" maxlength="30" class="layui-input" autocomplete="off" placeholder="请输入关键字">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="layui-inline btns">
|
||||
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm btn-1" onclick="query(1)">查询
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="table-box" table-responsive style="z-index: 1;">
|
||||
<table id="table_data" class="table" lay-filter="table_data"></table>
|
||||
<div id="voi-page" class="layout"></div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<style>
|
||||
.layui-table-init {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
.layui-form-selected dl {
|
||||
height: 150px !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script src="../../js/testReport/testReportMge.js" charset="UTF-8" type="text/javascript"></script>
|
||||
</html>
|
||||
|
|
@ -36,16 +36,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- <div class="layui-form-item" style="margin-top: 2%;">-->
|
||||
<!-- <label class="layui-form-label"><i style="padding: 0 10px;">*</i>工号</label>-->
|
||||
<!-- <div class="layui-input-inline">-->
|
||||
<!-- <input class="layui-input" id="userCode" name="userCode" autocomplete="off"-->
|
||||
<!-- lay-verify="required" maxlength="30">-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"> <i style="padding: 0 10px;">*</i> 性别</label>
|
||||
<div class="layui-input-block" >
|
||||
|
|
@ -69,6 +59,14 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><i style="padding: 0 10px;">*</i>班组</label>
|
||||
<div class="layui-input-inline">
|
||||
<select id="teamId" lay-verify="required" name="teamId" class="form-control input-sm">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><i style="padding: 0 10px;">*</i>联系电话</label>
|
||||
<div class="layui-input-inline">
|
||||
|
|
|
|||
Loading…
Reference in New Issue