czl-screen/pages/home/z_ownTeam_populationList.html

213 lines
7.8 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
<meta charset="UTF-8">
<title>自有班组二级界面团队表单</title>
<link rel="stylesheet" type="text/css" media="screen" href="../../js/layui-v2.8.18/layui/css/layui.css">
<link rel="stylesheet" href="../../css/mainList.css">
<style type="text/css">
th {
text-align: center;
}
.layui-table-tool {
display: none;
}
.layui-table thead th {
background-color: #0A2559;
color: white;
border: 0px;
}
.layui-table-cell {
color: white;
}
/*.layui-laydate-content>table>tbody>tr>td{*/
/* background-color: white;*/
/*}*/
#layui-laydate1 {
left: 534.578px;
top: 171.484px;
background: #020B31;
color: white;
}
.laydate-footer-btns span {
height: 26px;
line-height: 26px;
margin: 0 0 0 -1px;
padding: 0 10px;
border: 1px solid #C9C9C9;
background-color: #020B31!important;
white-space: nowrap;
vertical-align: top;
border-radius: 2px;
}
.layui-btn {
background-color: #2a91d3;
}
.layui-btn-sm {
height: 36px;
line-height: 30px;
padding: 0 10px;
font-size: 12px;
width: 75px;
border-radius: 9px;
}
.clickable-text {
cursor: pointer;
}
.layui-table-view{
overflow-y: auto;
height: 80%;
}
.layui-table-fixed-r{
right: -150px !important;
}
</style>
</head>
<style>
.layui-form-label {
position: relative;
float: left;
display: block;
padding: 9px 15px;
width: 100%;
font-weight: 400;
line-height: 20px;
text-align: right;
}
</style>
<body>
<div class="tou">
<div class="head centers">
<span class="head centers clickable-text">线路承载力看板</span>
</div>
<table id="demo" lay-filter="test" style="margin-top: 1%"></table>
</div>
</body>
</html>
<script type="text/javascript" src="../../js/publicJs.js"></script>
<script type="text/javascript" src="../../js/common.js"></script>
<script type="text/javascript" src="../../js/libs/jquery.min.js"></script>
<script type="text/javascript" src="../../js/jq.js"></script>
<script type="text/javascript" src="../../js/my/permission.js"></script>
<script type="text/javascript" src="../../js/layui-v2.8.18/layui/layui.js"></script>
<script type="text/javascript" src="../../js/dict.js"></script>
<script type="text/javascript" src="../../js/publicJs.js"></script>
<script type="text/javascript" src="../../js/select.js"></script>
<script type="text/javascript">
var form;
var table;
var newData;
var id = localStorage.getItem("id");
var resourceId = localStorage.getItem("resourceId");
var teamTypeId = localStorage.getItem("teamTypeId");
var type = "1";
layui.use(['table', 'form'], function () {
table = layui.table;
form = layui.form;
showTable();
});
function showTable(){
$.ajax({
type: 'post',
url: ctxPath + '/dataDetail/getOwnTeamsFormLists',//数据接口
dataType: 'json', // 服务器返回数据类型
async: false,
data: {
teamTypeId: teamTypeId,
id: id,
resourceId: resourceId,
type: '2'
},
success: function (data) {
table.render({
elem: '#demo'
, toolbar: 'default'
, cellMinWidth: 80
, cols: [[ //表头
{
field: 'postName', title: '岗位', align: 'center', templet: d => {
let text = "";
if (d.isRequired == "1") {
text = '<i class="tip-required" style="color: red;font-size: 20px">*</i>' + d.postName;
} else if (d.isRequired == "0") {
text = d.postName;
}
return text;
}
},
{field: 'name', title: '姓名', align: 'center'},
{field: 'sex', title: '性别', align: 'center'},
{field: 'nation', title: '民族', align: 'center'},
{field: 'idNumber', title: '身份证', align: 'center'},
{field: 'implementation', title: '执证情况', align: 'center'},
{field: 'vocationalSkillLevel', title: '职业/技能等级', align: 'center'},
]],
data: data,
done: function (res, curr, count) {
console.log(res)
merge(res);
res.data.forEach(function (item,index) {
if (item.isPersonCharge == '1'){
item.LAY_CHECKED = true;
$(".layui-table-view[lay-id='demo'] .layui-table-body tr[data-index="+index+"] .layui-form-radio").click();
}
});
},
toolbar: '#toolbarDemo' //开启工具栏,此处显示默认图标,可以自定义模板,详见文档
});
},
error: function (err) {
console.log("获取工程下拉列表出错:", err);
}
});
}
/**
* 合并行方法
**/
function merge(res) {
var data = res.data;
var mergeIndex = 0;//定位需要添加合并属性的行数
var mark = 1; //这里涉及到简单的运算mark是计算每次需要合并的格子数
var columsName = ['postName'];//需要合并的列名称 ['business_tenant_name','land','contract_begin','contract_end','history_arrears','period'];
var columsIndex = [0];//需要合并的列索引值 [2,3,5,6,14,15];
for (var k = 0; k < columsName.length; k++) { //这里循环所有要合并的列
var trArr = $(".layui-table-body>.layui-table").find("tr");//所有行
if (!isEmpty(res.data)) {
for (var i = 1; i < res.data.length; i++) { //这里循环表格当前的数据
var tdCurArr = trArr.eq(i).find("td").eq(columsIndex[k]);//获取当前行的当前列
var tdPreArr = trArr.eq(mergeIndex).find("td").eq(columsIndex[k]);//获取相同列的第一列
if (data[i][columsName[0]] === data[i - 1][columsName[0]]) {
layui.hint().error(i);
if (data[i][columsName[k]] === data[i - 1][columsName[k]]) { //后一行的值与前一行的值做比较,相同就需要合并
mark += 1;
tdPreArr.each(function () {//相同列的第一列增加rowspan属性
$(this).attr("rowspan", mark);
});
tdCurArr.each(function () {//当前行隐藏
$(this).css("display", "none");
});
}
} else {
mergeIndex = i;
mark = 1;//一旦前后两行的值不一样了那么需要合并的格子数mark就需要重新计算
}
}
}
mergeIndex = 0;
mark = 1;
}
}
</script>