main
kgdxpr 1 year ago
parent 239a3f4452
commit 1662a2d986

@ -459,11 +459,10 @@
$("#sheetSet").click(function () {
layer.open({
type: 1,
type: 2,
area: ['420px', '240px'], // 宽高
title: false, // 不显示标题栏
closeBtn: 0,
shadeClose: true, // 点击遮罩关闭层
closeBtn: 0,
content: './sheet_set.html?job_id=' + jobId
});
});

@ -8,10 +8,13 @@
</head>
<body>
<div class="layui-card">
<div class="layui-card-body">
<table class="layui-table" id="myTable">
<table class="layui-table" id="myTable">
</table>
</table>
</div>
</div>
<script src="../../../component/layui/layui.js"></script>
<script>
@ -25,39 +28,101 @@
elem: '#myTable',
url: '/QingLong/collect/getSheetStage?job_id=' + jobId,
height: 'full-60',
page: false,
cols: [[
{ title: '模板', field: 'sheet_name', align: 'center' },
{ title: '小学', templet: '<div class="xx" id="a{{= d.id }}">&nbsp;</div>', align: 'center', width: "15%", style: 'cursor: pointer;' },
{ title: '初中', templet: '<div class="cz" id="a{{= d.id }}">&nbsp;</div>', align: 'center', width: "15%", style: 'cursor: pointer;' },
{ title: '高中', templet: '<div class="gz" id="a{{= d.id }}">&nbsp;</div>', align: 'center', width: "15%", style: 'cursor: pointer;' }
{ title: '小学', templet: '<div class="xx" id="xx_sheet_{{= d.sheet_index }}">&nbsp;</div>', align: 'center', width: "15%", style: 'cursor: pointer;' },
{ title: '初中', templet: '<div class="cz" id="cz_sheet_{{= d.sheet_index }}">&nbsp;</div>', align: 'center', width: "15%", style: 'cursor: pointer;' },
{ title: '高中', templet: '<div class="gz" id="gz_sheet_{{= d.sheet_index }}">&nbsp;</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 () {
res.data.forEach(function (item) {
var sheetIndex = item.sheet_index;
if (item.xiaoxue === 1) {
$("#xx_sheet_" + sheetIndex).css('background-color', '#16BAAA');
}
if (item.xiaoxue === 0) {
$("#xx_sheet_" + sheetIndex).css('background-color', 'rgba(0, 0, 0, 0)');
}
if (item.chuzhong === 1) {
$("#cz_sheet_" + sheetIndex).css('background-color', '#16BAAA');
}
if (item.chuzhong === 0) {
$("#cz_sheet_" + sheetIndex).css('background-color', 'rgba(0, 0, 0, 0)');
}
if (item.gaozhong === 1) {
$("#gz_sheet_" + sheetIndex).css('background-color', '#16BAAA');
}
if (item.gaozhong === 0) {
$("#gz_sheet_" + sheetIndex).css('background-color', 'rgba(0, 0, 0, 0)');
}
});
$(".xx").click(function (obj) {
var _sheetIndex = $(this).attr('id').split('_')[2];
if ($(this).css('background-color') == "rgba(0, 0, 0, 0)") {
$(this).css('background-color', '#D6F2F3');
$(this).css('background-color', '#16BAAA');
updateSheetStage(4, _sheetIndex, 1)
} else {
$(this).css('background-color', 'rgba(0, 0, 0, 0)');
updateSheetStage(4, _sheetIndex, 0)
}
});
$(".cz").click(function () {
var _sheetIndex = $(this).attr('id').split('_')[2];
if ($(this).css('background-color') == "rgba(0, 0, 0, 0)") {
$(this).css('background-color', '#16BAAA');
updateSheetStage(5, _sheetIndex, 1)
} else {
$(this).css('background-color', 'rgba(0, 0, 0, 0)');
updateSheetStage(5, _sheetIndex, 0)
}
});
$(".gz").click(function () {
var _sheetIndex = $(this).attr('id').split('_')[2];
if ($(this).css('background-color') == "rgba(0, 0, 0, 0)") {
$(this).css('background-color', '#16BAAA');
updateSheetStage(6, _sheetIndex, 1)
} else {
$(this).css('background-color', 'rgba(0, 0, 0, 0)');
updateSheetStage(6, _sheetIndex, 0)
}
// console.log($(this).attr('id'));
});
}
});
function updateSheetStage(stageId, sheetIndex, bUse) {
$.ajax({
url: '/QingLong/collect/updateSheetStage',
type: 'post',
data: { job_id: parseInt(jobId), sheet_index: parseInt(sheetIndex), stage_id: parseInt(stageId), b_use: parseInt(bUse) },
success: function (result) {
if (result.success) {
layer.msg("设置成功!", {
icon: 1,
time: 500
});
} else {
layer.msg(result.message, {
icon: 2,
time: 2000
});
}
}
});
}
function GetQueryString(name, istop) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");

Loading…
Cancel
Save