This commit is contained in:
cwchen 2024-07-25 20:21:17 +08:00
parent 9030f67757
commit 31387a50f5
3 changed files with 168 additions and 8 deletions

View File

@ -777,4 +777,52 @@ input:-ms-input-placeholder {
.xm-select-parent dd > .xm-cz-group { .xm-select-parent dd > .xm-cz-group {
margin-right: 20px !important; margin-right: 20px !important;
} }
.classTable {
width: 100%;
table-layout: fixed;
text-align: center;
border-collapse: collapse;
border-spacing: 0;
box-sizing: border-box;
height: 100%;
}
.classTable tr td {
font-size: 13px;
border-bottom: 1px solid #7c7878;
height: 30px;
color: #262626;
}
.classTable thead tr:nth-of-type(1) {
background-color: #f0f0f0;
height: 40px;
}
.classTable thead tr:nth-of-type(1) td {
font-size: 15px;
}
.classTable tbody {
display: block;
height: 300px;
/*height: 35vh;*/
overflow-y: auto;
}
.classTable thead,
.classTable tbody tr {
display: table;
width: 100%;
table-layout: fixed;
}
.classTable thead {
width: calc(100% - 5px);
}
.classTable tbody tr {
width: 100%;
cursor: pointer;
}

View File

@ -96,7 +96,23 @@ function initTable(dataList, limit, page) {
}, },
{field: "devTypeName", title: "设备类型", unresize: true, align: "center"}, {field: "devTypeName", title: "设备类型", unresize: true, align: "center"},
{field: "sampleNum", title: "送样总数", unresize: true, align: "center"}, {field: "sampleNum", title: "送样总数", unresize: true, align: "center"},
{field: "sampleQuantity", title: "样品总数", unresize: true, align: "center"}, {field: "sampleQuantity", title: "样品总数", unresize: true, align: "center",
templet: function (d) {
const sampleList = d.sampleList;
if (sampleList && sampleList.length > 0) {
let flag = false,style = '';
$.each(sampleList, function (index, item) {
if (item.testResult === '不合格') {
flag = true;
return false;
}
})
style='color: '+(flag ? "#F39268" : '#2A6EDF')+'';
return "<span class='layui-show-details' onmouseover='getMouseover("+JSON.stringify(sampleList)+")' onmouseout='getMouseout()' style='"+style+"'; cursor: pointer'>" + sampleList.length + "</span>";
} else {
return 0;
}
}},
{field: "experimenter", title: "试验人员", unresize: true, align: "center"}, {field: "experimenter", title: "试验人员", unresize: true, align: "center"},
{field: "testTime", title: "试验时间", unresize: true, align: "center"}, {field: "testTime", title: "试验时间", unresize: true, align: "center"},
{field: "status", title: "状态", unresize: true, align: "center", templet: function (d) { {field: "status", title: "状态", unresize: true, align: "center", templet: function (d) {
@ -210,6 +226,46 @@ function checkAllList(list, obj) {
return -1; return -1;
} }
function getMouseover(data) {
for (let i = 0; i < 10; i++) {
data.push(data[0]);
}
let html = '<table class="classTable" lay-skin="line" lay-size="sm" style="width: 100%;">' +
'<thead>' +
'<tr>' +
'<th>序号</th>' +
'<th>设备编号</th>' +
'<th>试验结果</th>' +
'</tr>' +
'</thead>'
html += '<tbody>';
if (data.length > 0) {
for (let i = 0; i < data.length; i++) {
html += '<tr>' +
'<td>' + (i + 1) + '</td>' +
'<td title="' + data[i].devCode + '" style="cursor: pointer;" >' + data[i].devCode + '</td>' +
'<td title="' + data[i].testResult + '" style="cursor: pointer;color:'+(data[i].testResult.indexOf('不合格')>-1 ? '#F39268' : '#2A6EDF')+'">' + data[i].testResult + '</td>' +
'</tr>';
}
} else {
html += '<tr>' +
'<td colspan="3" style="text-align: center">暂无数据</td>' +
'</tr>';
}
html += '</tbody>';
html += '</table>';
let devOpenIndex = layer.open({
type: 0,
title: '样品设备详情',
area: ['400px', '500px'],
content: html,
btn: ['关闭'],
yes: function (index, layero) {
layer.close(index);
}
});
}
// 获取参数 // 获取参数
function getReqParams(page, limit, type) { function getReqParams(page, limit, type) {
let obj = {}; let obj = {};

View File

@ -2,6 +2,7 @@ let form, layer, table, tableIns, laydate;
let pageNum = 1, limitSize = 10; // 默认第一页分页数量为10 let pageNum = 1, limitSize = 10; // 默认第一页分页数量为10
let deviceTypeList = []; let deviceTypeList = [];
let idParam = null, statusParam = null; let idParam = null, statusParam = null;
function setParams(params) { function setParams(params) {
idParam = JSON.parse(params).id; idParam = JSON.parse(params).id;
statusParam = JSON.parse(params).status; statusParam = JSON.parse(params).status;
@ -68,8 +69,6 @@ function laypages(total, page, limit) {
}) })
} }
let flag = true;
/*初始化表格*/ /*初始化表格*/
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,});
@ -89,12 +88,30 @@ function initTable(dataList, limit, page) {
}, },
{field: "devTypeName", title: "设备类型", unresize: true, align: "center"}, {field: "devTypeName", title: "设备类型", unresize: true, align: "center"},
{field: "sampleNum", title: "送样总数", unresize: true, align: "center"}, {field: "sampleNum", title: "送样总数", unresize: true, align: "center"},
{field: "sampleQuantity", title: "样品总数", unresize: true, align: "center"}, {
field: "sampleQuantity", title: "样品总数", unresize: true, align: "center", templet: function (d) {
const sampleList = d.sampleList;
if (sampleList && sampleList.length > 0) {
let flag = false,style = '';
$.each(sampleList, function (index, item) {
if (item.testResult === '不合格') {
flag = true;
return false;
}
})
style='color: '+(flag ? "#F39268" : '#2A6EDF')+'';
return "<span class='layui-show-details' onmouseover='getMouseover("+JSON.stringify(sampleList)+")' onmouseout='getMouseout()' style='"+style+"'; cursor: pointer'>" + sampleList.length + "</span>";
} else {
return 0;
}
}
},
{field: "experimenter", title: "试验人员", unresize: true, align: "center"}, {field: "experimenter", title: "试验人员", unresize: true, align: "center"},
{field: "testTime", title: "试验时间", unresize: true, align: "center"}, {field: "testTime", title: "试验时间", unresize: true, align: "center"},
{field: "status", title: "状态", unresize: true, align: "center", templet: function (d) { {
return setAuditStatus(d.status); field: "status", title: "状态", unresize: true, align: "center", templet: function (d) {
} return setAuditStatus(d.status);
}
}, },
{field: "causeOfRejection", title: "驳回原因", unresize: true, align: "center"}, {field: "causeOfRejection", title: "驳回原因", unresize: true, align: "center"},
{ {
@ -116,6 +133,45 @@ function initTable(dataList, limit, page) {
}); });
} }
function getMouseover(data) {
for (let i = 0; i < 10; i++) {
data.push(data[0]);
}
let html = '<table class="classTable" lay-skin="line" lay-size="sm" style="width: 100%;">' +
'<thead>' +
'<tr>' +
'<th>序号</th>' +
'<th>设备编号</th>' +
'<th>试验结果</th>' +
'</tr>' +
'</thead>'
html += '<tbody>';
if (data.length > 0) {
for (let i = 0; i < data.length; i++) {
html += '<tr>' +
'<td>' + (i + 1) + '</td>' +
'<td title="' + data[i].devCode + '" style="cursor: pointer;" >' + data[i].devCode + '</td>' +
'<td title="' + data[i].testResult + '" style="cursor: pointer;color:'+(data[i].testResult.indexOf('不合格')>-1 ? '#F39268' : '#2A6EDF')+'">' + data[i].testResult + '</td>' +
'</tr>';
}
} else {
html += '<tr>' +
'<td colspan="3" style="text-align: center">暂无数据</td>' +
'</tr>';
}
html += '</tbody>';
html += '</table>';
let devOpenIndex = layer.open({
type: 0,
title: '样品设备详情',
area: ['400px', '500px'],
content: html,
btn: ['关闭'],
yes: function (index, layero) {
layer.close(index);
}
});
}
// 获取参数 // 获取参数
function getReqParams(page, limit, type) { function getReqParams(page, limit, type) {
let obj = {}; let obj = {};