You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
210 lines
6.9 KiB
210 lines
6.9 KiB
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title></title>
|
|
<link rel="stylesheet" href="../../../component/layui/css/layui.css" />
|
|
<style>
|
|
.layui-table-cell {
|
|
|
|
padding: auto 1px !important;
|
|
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div class="layui-card-body">
|
|
<table class="layui-table" id="myTable">
|
|
|
|
</table>
|
|
<script type="text/html" id="toolbarDemo">
|
|
<div class="layui-btn-container">
|
|
<button type="button" class="layui-btn layui-btn-primary layui-border-green layui-btn-sm" lay-event="oneKey">
|
|
<i class="layui-icon layui-icon-success"></i> 一键全选
|
|
</button>
|
|
<button type="button" class="layui-btn layui-btn-primary layui-border-green layui-btn-sm" lay-event="ai">
|
|
<i class="layui-icon layui-icon-form"></i> 智能匹配
|
|
</button>
|
|
</div>
|
|
</script>
|
|
</div>
|
|
|
|
|
|
<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: '/dsBase/collect/getSheetStage?job_id=' + jobId,
|
|
height: 'full-40',
|
|
page: false,
|
|
toolbar: '#toolbarDemo',
|
|
cols: [[
|
|
{ title: '模板', field: 'sheet_name', align: 'center' },
|
|
{ title: '小学', templet: '<div class="xx" id="xx_sheet_{{= d.sheet_index }}"> </div>', align: 'center', width: "15%", style: 'cursor: pointer;' },
|
|
{ title: '初中', templet: '<div class="cz" id="cz_sheet_{{= d.sheet_index }}"> </div>', align: 'center', width: "15%", style: 'cursor: pointer;' },
|
|
{ title: '高中', templet: '<div class="gz" id="gz_sheet_{{= d.sheet_index }}"> </div>', align: 'center', width: "15%", style: 'cursor: pointer;' }
|
|
|
|
]],
|
|
// skin: 'line',
|
|
defaultToolbar: [],
|
|
done: function (res, curr, count) {
|
|
|
|
|
|
|
|
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', '#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)
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
table.on('toolbar(myTable)', function (obj) {
|
|
switch (obj.event) {
|
|
case 'oneKey':
|
|
$.ajax({
|
|
url: '/dsBase/collect/oneKeySheetStage',
|
|
type: 'post',
|
|
data: { job_id: parseInt(jobId) },
|
|
success: function (result) {
|
|
if (result.success) {
|
|
layer.msg("一键全选成功!", {
|
|
icon: 1,
|
|
time: 1000
|
|
}, function () {
|
|
table.reloadData('myTable');
|
|
});
|
|
} else {
|
|
layer.msg(result.message, {
|
|
icon: 2,
|
|
time: 2000
|
|
});
|
|
}
|
|
}
|
|
});
|
|
break;
|
|
case 'ai':
|
|
$.ajax({
|
|
url: '/dsBase/collect/intelligenceSheetStage',
|
|
type: 'post',
|
|
data: { job_id: parseInt(jobId) },
|
|
success: function (result) {
|
|
if (result.success) {
|
|
layer.msg("智能匹配成功!", {
|
|
icon: 1,
|
|
time: 1000
|
|
}, function () {
|
|
table.reloadData('myTable');
|
|
});
|
|
} else {
|
|
layer.msg(result.message, {
|
|
icon: 2,
|
|
time: 2000
|
|
});
|
|
}
|
|
}
|
|
});
|
|
break;
|
|
};
|
|
});
|
|
|
|
function updateSheetStage(stageId, sheetIndex, bUse) {
|
|
$.ajax({
|
|
url: '/dsBase/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");
|
|
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> |