收样管理
This commit is contained in:
parent
5384e383fc
commit
9d7e99bc5b
|
|
@ -106,11 +106,40 @@ public class SamplesManageController {
|
||||||
public ServerResponse addSamples(EncryptedReq<SamplesManageDto> vo) {
|
public ServerResponse addSamples(EncryptedReq<SamplesManageDto> vo) {
|
||||||
try {
|
try {
|
||||||
return samplesManageService.addSamples(vo.getData());
|
return samplesManageService.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<SamplesManageDto> list = samplesManageService.getTeamSelected();
|
||||||
|
return ServerResponse.createSuccess(list);
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error(e.toString(),e);
|
log.error(e.toString(),e);
|
||||||
}
|
}
|
||||||
return ServerResponse.createErroe("操作失败");
|
return ServerResponse.createErroe("操作失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 派工
|
||||||
|
*/
|
||||||
|
@PostMapping("dispatchWork")
|
||||||
|
@DecryptAndVerify(decryptedClass = SamplesManageDto.class)//加解密统一管理
|
||||||
|
@LogAnnotation(operModul = "收样管理", operation = "派工", operDesc = "业务级事件", operType = "新增")
|
||||||
|
@PreAuthorize("@pms.hasPermission('sys:samples:add')")
|
||||||
|
public ServerResponse dispatchWork(EncryptedReq<SamplesManageDto> vo) {
|
||||||
|
try {
|
||||||
|
return samplesManageService.dispatchWork(vo.getData());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.toString(), e);
|
||||||
|
return ServerResponse.createErroe("操作失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,4 +54,31 @@ public interface SamplesManageDao {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int addSamplesDevice(SamplesManageDto dto);
|
int addSamplesDevice(SamplesManageDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型编码
|
||||||
|
* @param sampleToolsId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String getDevTypeCodeById(Integer sampleToolsId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设备编码
|
||||||
|
* @param nowDate
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String selectCustomerCode(String nowDate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取班组
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<SamplesManageDto> getTeamSelected();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改班组
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int updateTeamId(SamplesManageDto dto);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ public class SamplesManageDto extends PageEntity {
|
||||||
|
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
|
private String ids;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 名称
|
* 名称
|
||||||
*/
|
*/
|
||||||
|
|
@ -44,6 +46,11 @@ public class SamplesManageDto extends PageEntity {
|
||||||
*/
|
*/
|
||||||
private String sampleTime;
|
private String sampleTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 送样设备id
|
||||||
|
*/
|
||||||
|
private Integer sampleToolsId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 送样设备
|
* 送样设备
|
||||||
*/
|
*/
|
||||||
|
|
@ -59,21 +66,31 @@ public class SamplesManageDto extends PageEntity {
|
||||||
*/
|
*/
|
||||||
private String collectSamplesTime;
|
private String collectSamplesTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 班组Id
|
||||||
|
*/
|
||||||
|
private Integer teamId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 班组
|
* 班组
|
||||||
*/
|
*/
|
||||||
private String teamName;
|
private String teamName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备编号
|
* 设备编号 (手填/扫码)
|
||||||
*/
|
*/
|
||||||
private String devCode;
|
private String devCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 客户自编号
|
* 设备类型编码
|
||||||
*/
|
*/
|
||||||
private String devTypeCode;
|
private String devTypeCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户自编号(设备编码--自动生成)
|
||||||
|
*/
|
||||||
|
private String customerCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生产厂家
|
* 生产厂家
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -42,4 +42,17 @@ public interface SamplesManageService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ServerResponse addSamples(SamplesManageDto data);
|
ServerResponse addSamples(SamplesManageDto data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有班组数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<SamplesManageDto> getTeamSelected();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 派工
|
||||||
|
* @param data
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ServerResponse dispatchWork(SamplesManageDto data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,12 +8,18 @@ import com.bonus.aqgqj.basis.dao.ToolsManageDao;
|
||||||
import com.bonus.aqgqj.basis.entity.dto.SamplesManageDto;
|
import com.bonus.aqgqj.basis.entity.dto.SamplesManageDto;
|
||||||
import com.bonus.aqgqj.basis.service.SamplesManageService;
|
import com.bonus.aqgqj.basis.service.SamplesManageService;
|
||||||
import com.bonus.aqgqj.basis.service.ToolsManageService;
|
import com.bonus.aqgqj.basis.service.ToolsManageService;
|
||||||
|
import com.bonus.aqgqj.utils.DateTimeHelper;
|
||||||
import com.bonus.aqgqj.utils.ServerResponse;
|
import com.bonus.aqgqj.utils.ServerResponse;
|
||||||
|
import com.bonus.aqgqj.utils.StringHelper;
|
||||||
import com.bonus.aqgqj.utils.UserUtil;
|
import com.bonus.aqgqj.utils.UserUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.time.DateUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -70,6 +76,7 @@ public class SamplesManageServiceImpl implements SamplesManageService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public ServerResponse addSamples(SamplesManageDto data) {
|
public ServerResponse addSamples(SamplesManageDto data) {
|
||||||
JSONArray jsonArray = JSONObject.parseArray(data.getParamsList());
|
JSONArray jsonArray = JSONObject.parseArray(data.getParamsList());
|
||||||
List<SamplesManageDto> samplesManageDtos = jsonArray.toJavaList(SamplesManageDto.class);
|
List<SamplesManageDto> samplesManageDtos = jsonArray.toJavaList(SamplesManageDto.class);
|
||||||
|
|
@ -81,21 +88,82 @@ public class SamplesManageServiceImpl implements SamplesManageService {
|
||||||
if (re>0){
|
if (re>0){
|
||||||
//添加详情数据
|
//添加详情数据
|
||||||
for (SamplesManageDto dto : samplesManageDtos){
|
for (SamplesManageDto dto : samplesManageDtos){
|
||||||
|
//查询设备类型编码
|
||||||
|
if (dto.getSampleToolsId()!=null){
|
||||||
|
String devTypeCode = samplesManageDao.getDevTypeCodeById(dto.getSampleToolsId());
|
||||||
|
dto.setDevTypeCode(devTypeCode);
|
||||||
|
}
|
||||||
|
//生成设备编码
|
||||||
|
String customerCode = customerCodeRule();
|
||||||
|
dto.setCustomerCode(customerCode);
|
||||||
dto.setId(samplesManageDtos.get(0).getId());
|
dto.setId(samplesManageDtos.get(0).getId());
|
||||||
dto.setCreateBy(userId);
|
dto.setCreateBy(userId);
|
||||||
int res= samplesManageDao.addSamplesDevice(dto);
|
int res= samplesManageDao.addSamplesDevice(dto);
|
||||||
if (res<=0){
|
if (res<=0){
|
||||||
return ServerResponse.createByErrorMsg(500,"新增失败");
|
throw new RuntimeException("收样设备信息表添加失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
return ServerResponse.createByErrorMsg(500,"新增失败");
|
throw new RuntimeException("收样单位信息表添加失败");
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
return ServerResponse.createByErrorMsg(500,"新增失败");
|
throw new RuntimeException("未获取到数据");
|
||||||
}
|
}
|
||||||
return ServerResponse.createBySuccessMsg("上传成功");
|
return ServerResponse.createBySuccessMsg("上传成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有班组
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SamplesManageDto> getTeamSelected() {
|
||||||
|
return samplesManageDao.getTeamSelected();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public ServerResponse dispatchWork(SamplesManageDto data) {
|
||||||
|
if (StringHelper.isNotEmpty(data.getIds())){
|
||||||
|
//拆分用逗号分隔的数据
|
||||||
|
String[] ids = data.getIds().split(",");
|
||||||
|
for (String id : ids){
|
||||||
|
SamplesManageDto dto = new SamplesManageDto();
|
||||||
|
dto.setId(Integer.parseInt(id));
|
||||||
|
dto.setTeamId(data.getTeamId());
|
||||||
|
//更新班组数据
|
||||||
|
int res = samplesManageDao.updateTeamId(dto);
|
||||||
|
if (res<=0){
|
||||||
|
throw new RuntimeException("派工失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ServerResponse.createBySuccessMsg("派工成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备编号--自动生成
|
||||||
|
* 生成规则:YYMMDDNNNN
|
||||||
|
* YYMMDD:年月日
|
||||||
|
* NNNN: 当天收样的流水号,采用四位数字,从0001开始,每天重新计数
|
||||||
|
*/
|
||||||
|
private String customerCodeRule() {
|
||||||
|
String nowDate = DateTimeHelper.getNowYMD();
|
||||||
|
//查询本日收样流水号
|
||||||
|
String customerCode = samplesManageDao.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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,8 @@
|
||||||
dev_type_name,
|
dev_type_name,
|
||||||
dev_type_code,
|
dev_type_code,
|
||||||
dev_module,
|
dev_module,
|
||||||
|
dev_code,
|
||||||
|
customer_code,
|
||||||
sample_time,
|
sample_time,
|
||||||
create_time,
|
create_time,
|
||||||
create_user)
|
create_user)
|
||||||
|
|
@ -31,10 +33,17 @@
|
||||||
#{sampleTools},
|
#{sampleTools},
|
||||||
#{devTypeCode},
|
#{devTypeCode},
|
||||||
#{devModule},
|
#{devModule},
|
||||||
|
#{devCode},
|
||||||
|
#{customerCode},
|
||||||
#{sampleTime},
|
#{sampleTime},
|
||||||
NOW(),
|
NOW(),
|
||||||
#{createBy})
|
#{createBy})
|
||||||
</insert>
|
</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.SamplesManageDto">
|
<select id="list" resultType="com.bonus.aqgqj.basis.entity.dto.SamplesManageDto">
|
||||||
SELECT ts.id,
|
SELECT ts.id,
|
||||||
|
|
@ -78,14 +87,13 @@
|
||||||
select
|
select
|
||||||
tsd.id,
|
tsd.id,
|
||||||
tsd.dev_type_name as sampleTools,
|
tsd.dev_type_name as sampleTools,
|
||||||
tsd.dev_type_code as devTypeCode,
|
|
||||||
tsd.dev_code as devCode,
|
tsd.dev_code as devCode,
|
||||||
|
tsd.customer_code as customerCode,
|
||||||
tsd.dev_module as devModule,
|
tsd.dev_module as devModule,
|
||||||
tc.custom_name as customName
|
ts.department as sampleDepartment
|
||||||
from
|
from
|
||||||
tb_sample_device tsd
|
tb_sample_device tsd
|
||||||
LEFT JOIN tb_sample ts on tsd.sample_id=ts.id
|
LEFT JOIN tb_sample ts on tsd.sample_id=ts.id
|
||||||
LEFT JOIN tb_custom tc on tc.id=ts.custom_id
|
|
||||||
where tsd.del_falg = 0
|
where tsd.del_falg = 0
|
||||||
and tsd.sample_id = #{id}
|
and tsd.sample_id = #{id}
|
||||||
<if test="sampleTools != null and sampleTools != ''">
|
<if test="sampleTools != null and sampleTools != ''">
|
||||||
|
|
@ -94,9 +102,9 @@
|
||||||
<if test="keyWord != null and keyWord != ''">
|
<if test="keyWord != null and keyWord != ''">
|
||||||
AND (
|
AND (
|
||||||
tsd.dev_code like concat('%', #{keyWord}, '%') OR
|
tsd.dev_code like concat('%', #{keyWord}, '%') OR
|
||||||
tsd.dev_type_code like concat('%', #{keyWord}, '%') OR
|
tsd.customer_code like concat('%', #{keyWord}, '%') OR
|
||||||
tsd.dev_module like concat('%', #{keyWord}, '%') OR
|
tsd.dev_module like concat('%', #{keyWord}, '%') OR
|
||||||
tc.custom_name like concat('%', #{keyWord}, '%')
|
ts.department like concat('%', #{keyWord}, '%')
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
@ -120,4 +128,28 @@
|
||||||
del_flag = 0
|
del_flag = 0
|
||||||
and custom_status=0
|
and custom_status=0
|
||||||
</select>
|
</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.SamplesManageDto">
|
||||||
|
SELECT id,
|
||||||
|
team_name AS name
|
||||||
|
FROM tb_team
|
||||||
|
WHERE del_flag = 0
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -25,7 +25,7 @@ function setParams(params) {
|
||||||
console.log("data123456:",data)
|
console.log("data123456:",data)
|
||||||
console.log($('#sampleTime').val())
|
console.log($('#sampleTime').val())
|
||||||
pages(data.field)
|
pages(data.field)
|
||||||
$('#devTypeCode').val('')
|
$('#devCode').val('')
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -53,7 +53,7 @@ function pages(data) {
|
||||||
sampleToolsId: data.sampleTools,
|
sampleToolsId: data.sampleTools,
|
||||||
sampleTools: sampleToolsText,
|
sampleTools: sampleToolsText,
|
||||||
devModule: data.devModule,
|
devModule: data.devModule,
|
||||||
devTypeCode: data.devTypeCode
|
devCode: data.devCode
|
||||||
});
|
});
|
||||||
console.log("listData:",listData)
|
console.log("listData:",listData)
|
||||||
//启用/禁用控件
|
//启用/禁用控件
|
||||||
|
|
@ -133,7 +133,7 @@ function initTable(dataList) {
|
||||||
//表头
|
//表头
|
||||||
{type: 'numbers', title: '序号', width: '10%', align: 'center'},
|
{type: 'numbers', title: '序号', width: '10%', align: 'center'},
|
||||||
{field: "sampleTools",width: '25%', title: "设备类型", unresize: true, align: "center"},
|
{field: "sampleTools",width: '25%', title: "设备类型", unresize: true, align: "center"},
|
||||||
{field: "devTypeCode", width: '25%', title: "设备编号", unresize: true, align: "center"},
|
{field: "devCode", width: '25%', title: "设备编号", unresize: true, align: "center"},
|
||||||
{field: "sampleTime", width: '30%', title: "收样时间", unresize: true, align: "center"},
|
{field: "sampleTime", width: '30%', title: "收样时间", unresize: true, align: "center"},
|
||||||
{
|
{
|
||||||
field: "view1",width: '10%', title: "操作", unresize: true, align: "center",
|
field: "view1",width: '10%', title: "操作", unresize: true, align: "center",
|
||||||
|
|
|
||||||
|
|
@ -88,10 +88,10 @@ function initTable(dataList, limit, page) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{field: "sampleTools", title: "设备类型", unresize: true, align: "center"},
|
{field: "sampleTools", title: "设备类型", unresize: true, align: "center"},
|
||||||
{field: "devTypeCode", title: "设备编号", unresize: true, align: "center"},
|
{field: "devCode", title: "设备编号", unresize: true, align: "center"},
|
||||||
{field: "devCode", title: "客户自编号", unresize: true, align: "center"},
|
{field: "customerCode", title: "设备编码", unresize: true, align: "center"},
|
||||||
{field: "devModule", title: "规格型号", unresize: true, align: "center"},
|
{field: "devModule", title: "规格型号", unresize: true, align: "center"},
|
||||||
{field: "customName", title: "送检部门", unresize: true, align: "center"},
|
{field: "sampleDepartment", title: "送检部门", unresize: true, align: "center"},
|
||||||
{field: "experCycle", title: "试验周期", unresize: true, align: "center"},
|
{field: "experCycle", title: "试验周期", unresize: true, align: "center"},
|
||||||
{field: "experPrice", title: "试验单价(元)", unresize: true, align: "center"},
|
{field: "experPrice", title: "试验单价(元)", unresize: true, align: "center"},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
let form, layer, table, tableIns;
|
let form, layer, table, tableIns;
|
||||||
let pageNum = 1, limitSize = 10; // 默认第一页,分页数量为10
|
let pageNum = 1, limitSize = 10; // 默认第一页,分页数量为10
|
||||||
let orgData,selectOrgId;
|
let orgData,selectOrgId;
|
||||||
|
let quanju = new Array();//全局
|
||||||
|
let huancun = new Array();//缓存
|
||||||
|
|
||||||
layui.use(['form', 'layer', 'table', 'laydate'], function () {
|
layui.use(['form', 'layer', 'table', 'laydate'], function () {
|
||||||
form = layui.form;
|
form = layui.form;
|
||||||
|
|
@ -27,7 +29,9 @@ function getToolsSelected() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数据
|
||||||
|
*/
|
||||||
function pages(pageNum, pageSize, typeNum) {
|
function pages(pageNum, pageSize, typeNum) {
|
||||||
let params = getReqParams(pageNum, pageSize, typeNum);
|
let params = getReqParams(pageNum, pageSize, typeNum);
|
||||||
let url = dataUrl + "/samples/getList"
|
let url = dataUrl + "/samples/getList"
|
||||||
|
|
@ -48,6 +52,9 @@ function pages(pageNum, pageSize, typeNum) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页
|
||||||
|
*/
|
||||||
function laypages(total, page, limit) {
|
function laypages(total, page, limit) {
|
||||||
layui.use(['laypage'], function () {
|
layui.use(['laypage'], function () {
|
||||||
let laypage = layui.laypage;
|
let laypage = layui.laypage;
|
||||||
|
|
@ -69,7 +76,9 @@ function laypages(total, page, limit) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/*初始化表格*/
|
/**
|
||||||
|
* 初始化表格
|
||||||
|
*/
|
||||||
function initTable(dataList, limit, page) {
|
function initTable(dataList, limit, page) {
|
||||||
let loadingMsg = layer.msg("数据加载中,请稍候...", {icon: 16, scrollbar: false, time: 0,});
|
let loadingMsg = layer.msg("数据加载中,请稍候...", {icon: 16, scrollbar: false, time: 0,});
|
||||||
tableIns = table.render({
|
tableIns = table.render({
|
||||||
|
|
@ -79,6 +88,15 @@ function initTable(dataList, limit, page) {
|
||||||
limit: limit,
|
limit: limit,
|
||||||
cols: [
|
cols: [
|
||||||
[
|
[
|
||||||
|
{type: 'checkbox', fixed: 'left', align: "center", templet: function(d) {
|
||||||
|
console.log("d.teamName:",d.teamName)
|
||||||
|
if (d.teamName != null) {
|
||||||
|
console.log("1223455")
|
||||||
|
return `<input type="checkbox" name="id" value="${d.id}" lay-skin="primary" lay-filter="test" disabled>`;
|
||||||
|
} else {
|
||||||
|
return `<input type="checkbox" name="id" value="${d.id}" lay-skin="primary" lay-filter="test">`;
|
||||||
|
}
|
||||||
|
}},
|
||||||
//表头
|
//表头
|
||||||
{title: "序号", width: 80, unresize: true, align: "center",
|
{title: "序号", width: 80, unresize: true, align: "center",
|
||||||
templet: function (d) {
|
templet: function (d) {
|
||||||
|
|
@ -123,36 +141,45 @@ function initTable(dataList, limit, page) {
|
||||||
table.resize("table_data");
|
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-header").css("display", "inline-block");
|
||||||
count || this.elem.next(".layui-table-view").find(".layui-table-box").css("overflow", "auto");
|
count || this.elem.next(".layui-table-view").find(".layui-table-box").css("overflow", "auto");
|
||||||
|
|
||||||
|
// 处理复选框禁用
|
||||||
|
let checkboxes = this.elem.next(".layui-table-view").find("input[type='checkbox']");
|
||||||
|
dataList.forEach((item, index) => {
|
||||||
|
console.log("item.teamName:",item.teamName)
|
||||||
|
if (item.teamName) {
|
||||||
|
// 禁用该行的复选框
|
||||||
|
checkboxes.eq(index).prop('disabled', true);
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleClick1(sampleTools,devModule,devCode,experTime,nextExperTime,experUser,experConclu,customName) {
|
/**
|
||||||
title = '合格证';
|
* 获取选中的数据
|
||||||
let param = {
|
*/
|
||||||
'sampleTools' : sampleTools,
|
function getCheckedValues() {
|
||||||
'devModule' : devModule,
|
let data = table.checkStatus("table_data").data;
|
||||||
'devCode' : devCode,
|
let ids = [];
|
||||||
'experTime' : experTime,
|
|
||||||
'nextExperTime' : nextExperTime,
|
if (data.length === 0) {
|
||||||
'experUser': experUser,
|
return '';
|
||||||
'experConclu': experConclu,
|
|
||||||
'customName': customName
|
|
||||||
}
|
|
||||||
openIframe2("addOrEditUser", title, "child/certificateView.html", '30%', '70%', param);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleClick2(view1) {
|
for (let i = 0; i < data.length; i++) {
|
||||||
alert('Clicked on: ' + view1);
|
ids.push(data[i].id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 将 ids 数组用逗号分隔成字符串
|
||||||
|
return ids.join(',');
|
||||||
|
}
|
||||||
|
|
||||||
// 获取参数
|
// 获取参数
|
||||||
function getReqParams(page, limit, type) {
|
function getReqParams(page, limit, type) {
|
||||||
var selectedValue =$('#sampleTools').val()
|
var selectedValue =$('#sampleTools').val()
|
||||||
// 2. 查找对应的选项文本
|
// 2. 查找对应的选项文本
|
||||||
var selectedText = $('#sampleTools option[value="' + selectedValue + '"]').text();
|
var selectedText = $('#sampleTools option[value="' + selectedValue + '"]').text();
|
||||||
if (selectedText=='请选择设备类型'){
|
if (selectedText=='请选择'){
|
||||||
selectedText=''
|
selectedText=''
|
||||||
}
|
}
|
||||||
let obj = {};
|
let obj = {};
|
||||||
|
|
@ -234,14 +261,107 @@ function collectSamples(id) {
|
||||||
openIframe2("addOrEditUser", title, "child/samplesAdd.html", '70%', '90%', param);
|
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) {
|
function setSelectValue(list, selectName) {
|
||||||
console.log("list",list)
|
console.log("list",list)
|
||||||
let html = '<option value="" selected>请选择设备类型</option>';
|
let html = '<option value="" selected>请选择</option>';
|
||||||
$.each(list, function (index, item) {
|
$.each(list, function (index, item) {
|
||||||
html += '<option value="' + item.id + '">' + item.name + '</option>';
|
html += '<option value="' + item.id + '">' + item.name + '</option>';
|
||||||
})
|
})
|
||||||
$('#' + selectName).empty().append(html);
|
$('#' + selectName).empty().append(html);
|
||||||
layui.form.render();
|
layui.form.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function closePage(type) {
|
||||||
|
layer.closeAll();
|
||||||
|
if (type === 1) {
|
||||||
|
pages(1, 10, 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -10,6 +10,7 @@ showDictSelect("sex", "sex");
|
||||||
showDictSelect("unit", "unit");
|
showDictSelect("unit", "unit");
|
||||||
showDictSelect("dept", "dept");
|
showDictSelect("dept", "dept");
|
||||||
function setParams(params) {
|
function setParams(params) {
|
||||||
|
console.log(params)
|
||||||
idParam = JSON.parse(params).id;
|
idParam = JSON.parse(params).id;
|
||||||
layui.config({
|
layui.config({
|
||||||
base: "../../../js/layui-v2.6.8/dtree/", //此处路径请自行处理, 可以使用绝对路径
|
base: "../../../js/layui-v2.6.8/dtree/", //此处路径请自行处理, 可以使用绝对路径
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@
|
||||||
</div> <div class="layui-form-item" style="margin-top: 5%;">
|
</div> <div class="layui-form-item" style="margin-top: 5%;">
|
||||||
<label class="layui-form-label"><i style="padding: 0 10px; color: red;">*</i>设备编号</label>
|
<label class="layui-form-label"><i style="padding: 0 10px; color: red;">*</i>设备编号</label>
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
<input class="layui-input" placeholder="请输入设备编号" id="devTypeCode" name="devTypeCode" autocomplete="off"
|
<input class="layui-input" placeholder="请输入设备编号" id="devCode" name="devCode" autocomplete="off"
|
||||||
lay-verify="required" maxlength="30">
|
lay-verify="required" maxlength="30">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,9 @@
|
||||||
.layui-table-init {
|
.layui-table-init {
|
||||||
background-color: transparent !important;
|
background-color: transparent !important;
|
||||||
}
|
}
|
||||||
|
.layui-form-selected dl {
|
||||||
|
height: 150px !important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script src="../../js/samples/samplesMge.js" charset="UTF-8" type="text/javascript"></script>
|
<script src="../../js/samples/samplesMge.js" charset="UTF-8" type="text/javascript"></script>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue