parent
3eee22c87c
commit
4916035030
Binary file not shown.
Binary file not shown.
@ -0,0 +1,78 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>点击单元格变色</title>
|
||||
<link rel="stylesheet" href="../../../component/layui/css/layui.css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<table class="layui-table" id="myTable">
|
||||
|
||||
</table>
|
||||
|
||||
<script src="../../../component/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.use(function () {
|
||||
var $ = layui.jquery;
|
||||
var table = layui.table;
|
||||
|
||||
var jobId = GetQueryString("job_id");
|
||||
|
||||
table.render({
|
||||
elem: '#myTable',
|
||||
url: '/QingLong/collect/getSheetStage?job_id=' + jobId,
|
||||
height: 'full-60',
|
||||
cols: [[
|
||||
{ title: '模板', field: 'sheet_name', align: 'center' },
|
||||
{ title: '小学', templet: '<div class="xx" id="a{{= d.id }}"> </div>', align: 'center', width: "15%", style: 'cursor: pointer;' },
|
||||
{ title: '初中', templet: '<div class="cz" id="a{{= d.id }}"> </div>', align: 'center', width: "15%", style: 'cursor: pointer;' },
|
||||
{ title: '高中', templet: '<div class="gz" id="a{{= d.id }}"> </div>', align: 'center', width: "15%", style: 'cursor: pointer;' }
|
||||
|
||||
]],
|
||||
// skin: 'line',
|
||||
defaultToolbar: [],
|
||||
done: function (res, curr, count) {
|
||||
// $('.layui-table').on('click', 'td', function (obj) {
|
||||
// if (obj.currentTarget.cellIndex > 2) {
|
||||
// console.log(obj)
|
||||
// if ($(this).css('background-color') == "rgba(0, 0, 0, 0)") {
|
||||
// $(this).css('background-color', '#5FB878');
|
||||
// } else {
|
||||
// $(this).css('background-color', 'rgba(0, 0, 0, 0)');
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
|
||||
// $("#a1").css('background-color', '#5FB878');
|
||||
$(".xx").click(function () {
|
||||
if ($(this).css('background-color') == "rgba(0, 0, 0, 0)") {
|
||||
$(this).css('background-color', '#D6F2F3');
|
||||
} else {
|
||||
$(this).css('background-color', 'rgba(0, 0, 0, 0)');
|
||||
}
|
||||
// console.log($(this).attr('id'));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function GetQueryString(name, istop) {
|
||||
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
|
||||
var r = window.location.search.substr(1).match(reg);
|
||||
if (typeof (istop) != "undefined") r = top.location.search.substr(1).match(reg);
|
||||
|
||||
if (r != null) return unescape(r[2]);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
Reference in new issue