巡视计划
This commit is contained in:
parent
b2afcb3fb3
commit
70dd098a82
|
|
@ -2,15 +2,19 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>工作签证</title>
|
||||
<script src="../../../js/public/token.js"></script>
|
||||
<title>特勤考勤台账</title>
|
||||
<script src="../../../plugs/jquery/jquery-3.6.0.min.js"></script>
|
||||
<script src="../../../js/public/jq.js"></script>
|
||||
<script src="../../../js/public/public.js"></script>
|
||||
<script src="../../../js/public/public_utils.js"></script>
|
||||
<script src="../../../js/public/aescbc.js"></script>
|
||||
<script src="../../../plugs/jquery/jquery-3.6.0.min.js"></script>
|
||||
<!-- 引入xlsx -->
|
||||
|
||||
<script src="../../../plugs/layui-v2.9.2/layui/layui.js"></script>
|
||||
<script src="../../../plugs/layui-v2.9.2/layui_exts/excel.js"></script>
|
||||
<link href="../../../plugs/layui-v2.9.2/layui/css/layui.css" rel="stylesheet">
|
||||
<script src="../../../util/Interceptor.js"></script>
|
||||
|
||||
<!-- <script src="../../../util/Interceptor.js"></script> -->
|
||||
<!--业务js-->
|
||||
<script src="../../../js/dataStatistics/specialPatrol/specialPatrolList.js"></script>
|
||||
|
||||
|
|
@ -61,29 +65,29 @@
|
|||
<div class="form-group" style="margin-top: 0.5%">
|
||||
<div class="layui-inline">
|
||||
<div class="layui-input-inline">
|
||||
<input id="search1" type="text" class="layui-input" placeholder="人员姓名" >
|
||||
<input id="userName" type="text" class="layui-input" placeholder="人员姓名" >
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<div class="layui-input-inline">
|
||||
<input id="search2" type="text" class="layui-input" placeholder="工程名称" >
|
||||
<input id="proName" type="text" class="layui-input" placeholder="工程名称" >
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<div class="layui-input-inline">
|
||||
<input id="search3" type="text" class="layui-input" placeholder="工作站名称" >
|
||||
<input id="yjName" type="text" class="layui-input" placeholder="工作站名称" >
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<div class="layui-input-inline">
|
||||
<input id="dataTime" name="dataTime" type="text" class="layui-input" placeholder="请选择月份">
|
||||
<input type="text" class="layui-input" readonly autocomplete="off" id="makeMonth" name="makeMonth" placeholder="选择月份" >
|
||||
</div>
|
||||
</div>
|
||||
<button class="layui-btn layui-btn-sm" lay-submit lay-filter="query">
|
||||
<button class="layui-btn layui-btn-sm" lay-submit lay-filter="query" onclick="queryClick()">
|
||||
<i class="layui-icon layui-icon-search"></i>
|
||||
查询
|
||||
</button>
|
||||
<button id="reset" type="button" class="layui-btn layui-btn-sm layui-btn-primary">
|
||||
<button id="reset" type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="resetClick()">
|
||||
<i class="layui-icon layui-icon-refresh"></i>
|
||||
重置
|
||||
</button>
|
||||
|
|
@ -104,4 +108,5 @@
|
|||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script src="../../../plugs/layui-v2.9.2/xlsx.full.min.js"></script>
|
||||
</html>
|
||||
|
|
@ -1,156 +1,177 @@
|
|||
|
||||
var currentDate = new Date();
|
||||
// 获取当前月份的第一天
|
||||
var firstDay = new Date(currentDate.getFullYear(), currentDate.getMonth(), 1);
|
||||
// 获取下一个月的第一天
|
||||
var nextMonthFirstDay = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 1);
|
||||
// 获取当前月份的天数 //本月多少天
|
||||
var daysInMonth = Math.floor((nextMonthFirstDay.getTime() - firstDay.getTime()) / (24 * 60 * 60 * 1000));
|
||||
// console.log(daysInMonth);
|
||||
var pers = []
|
||||
var table,form,laydate
|
||||
layui.use(['form','layer','table','laydate'], function () {
|
||||
var table, form, laydate,excel;
|
||||
var d;
|
||||
var excelData=[];
|
||||
|
||||
layui.use(['form', 'layer', 'table', 'laydate','excel'], function() {
|
||||
excel = layui.excel;
|
||||
table = layui.table;
|
||||
form = layui.form;
|
||||
laydate = layui.laydate
|
||||
|
||||
laydate = layui.laydate;
|
||||
//初始化日期选择框
|
||||
laydate.render({
|
||||
elem: '#dataTime',
|
||||
elem: '#makeMonth',
|
||||
type: 'month',
|
||||
value: (new Date()).toISOString().substr(0, 7), // 获取当前日期并转换为'yyyy-MM'格式
|
||||
btns: ['now', 'confirm']
|
||||
});
|
||||
// 触发submit提交 按钮点击或者表单被执行提交时触发
|
||||
form.on('submit(query)', function (data) {
|
||||
console.log("搜索")
|
||||
// 对表格进行重载。id 即 table表格的id
|
||||
table.reload('table', {
|
||||
// //设定异步数据接口的额外参数
|
||||
page:{curr : 1}
|
||||
,where: data.field
|
||||
})
|
||||
return false; // 阻止表单跳转。如果需要表单跳转,去掉这段即可。
|
||||
});
|
||||
$("#reset").click(function(){
|
||||
console.log("重置")
|
||||
$('#search1').val('');
|
||||
$('#search2').val('');
|
||||
$('#search3').val('');
|
||||
let obj = {
|
||||
search1:'',
|
||||
search2:'',
|
||||
search3:''
|
||||
}
|
||||
// 对表格进行重载。id 即 table表格的id
|
||||
table.reload('table', {
|
||||
// //设定异步数据接口的额外参数
|
||||
page:{curr : 1}
|
||||
,where: obj
|
||||
})
|
||||
})
|
||||
|
||||
init();
|
||||
});
|
||||
|
||||
/* var dataList = [
|
||||
{name: '3.1', value: ''}, {name: '3.2', value: ''}, {name: '3.3', value: ''}, {name: '3.4', value: ''}, {name: '3.5', value: ''}, {name: '3.6', value: ''},
|
||||
{name: '3.7', value: ''}, {name: '3.8', value: ''}, {name: '3.9', value: ''}, {name: '3.10', value: ''}, {name: '3.11', value: ''}, {name: '3.12', value: ''},
|
||||
{name: '3.13', value: ''}, {name: '3.14', value: ''}, {name: '3.15', value: ''}, {name: '3.16', value: ''}, {name: '3.17', value: ''}, {name: '3.18', value: ''},
|
||||
{name: '3.19', value: ''}, {name: '3.20', value: ''}, {name: '3.21', value: ''}, {name: '3.22', value: ''}, {name: '3.23', value: ''}, {name: '3.24', value: ''},
|
||||
{name: '3.25', value: ''}, {name: '3.26', value: ''}, {name: '3.27', value: ''}, {name: '3.28', value: ''}, {name: '3.29', value: ''}, {name: '3.30', value: ''},
|
||||
{name: '3.31', value: ''}
|
||||
] */
|
||||
// 静态数据
|
||||
var tableData = [
|
||||
{id: 1, comName: '2024-03', stationName: '±500kV永富直流线', lineName: '300', username: '21', totalDay: '256',
|
||||
'3.1': '', '3.2': '√', '3.3': '√', '3.4': '', '3.5': '√', '3.6': '', '3.7': '', '3.8': '', '3.9': '', '3.10': '', '3.11': '', '3.12': '', '3.13': '',
|
||||
'3.14': '', '3.15': '', '3.16': '', '3.17': '', '3.18': '', '3.19': '', '3.20': '', '3.21': '', '3.22': '', '3.23': '', '3.24': '', '3.25': '', '3.26': '',
|
||||
'3.27': '', '3.28': '', '3.29': '', '3.30': '', '3.31': ''},
|
||||
{id: 1, comName: '2024-03', stationName: '±500kV永富直流线', lineName: '300', username: '21', totalDay: '256',
|
||||
'3.1': '', '3.2': '√', '3.3': '√', '3.4': '', '3.5': '', '3.6': '', '3.7': '√', '3.8': '√', '3.9': '', '3.10': '', '3.11': '', '3.12': '', '3.13': '',
|
||||
'3.14': '', '3.15': '', '3.16': '', '3.17': '', '3.18': '', '3.19': '', '3.20': '', '3.21': '', '3.22': '', '3.23': '', '3.24': '', '3.25': '', '3.26': '',
|
||||
'3.27': '', '3.28': '', '3.29': '', '3.30': '', '3.31': ''},
|
||||
{id: 1, comName: '2024-03', stationName: '±500kV永富直流线', lineName: '300', username: '21', totalDay: '256',
|
||||
'3.1': '', '3.2': '√', '3.3': '√', '3.4': '', '3.5': '√', '3.6': '√', '3.7': '', '3.8': '', '3.9': '', '3.10': '', '3.11': '', '3.12': '', '3.13': '',
|
||||
'3.14': '', '3.15': '', '3.16': '', '3.17': '', '3.18': '', '3.19': '', '3.20': '', '3.21': '', '3.22': '', '3.23': '', '3.24': '', '3.25': '', '3.26': '',
|
||||
'3.27': '', '3.28': '', '3.29': '', '3.30': '', '3.31': ''},
|
||||
{id: 1, comName: '2024-03', stationName: '±500kV永富直流线', lineName: '300', username: '21', totalDay: '256',
|
||||
'3.1': '', '3.2': '√', '3.3': '√', '3.4': '', '3.5': '√', '3.6': '', '3.7': '', '3.8': '', '3.9': '', '3.10': '√', '3.11': '', '3.12': '', '3.13': '',
|
||||
'3.14': '', '3.15': '', '3.16': '', '3.17': '', '3.18': '', '3.19': '', '3.20': '', '3.21': '', '3.22': '', '3.23': '', '3.24': '', '3.25': '', '3.26': '',
|
||||
'3.27': '', '3.28': '', '3.29': '', '3.30': '', '3.31': ''},
|
||||
{id: 1, comName: '2024-03', stationName: '±500kV永富直流线', lineName: '300', username: '21', totalDay: '256',
|
||||
'3.1': '', '3.2': '√', '3.3': '√', '3.4': '', '3.5': '√', '3.6': '', '3.7': '', '3.8': '', '3.9': '√', '3.10': '', '3.11': '', '3.12': '', '3.13': '',
|
||||
'3.14': '', '3.15': '', '3.16': '', '3.17': '', '3.18': '', '3.19': '', '3.20': '', '3.21': '', '3.22': '', '3.23': '', '3.24': '', '3.25': '', '3.26': '',
|
||||
'3.27': '', '3.28': '', '3.29': '', '3.30': '', '3.31': ''},
|
||||
];
|
||||
|
||||
var col = [
|
||||
[
|
||||
{
|
||||
|
||||
function init() {
|
||||
let userName = $('#userName').val();
|
||||
let proName = $('#proName').val();
|
||||
let yjName = $('#yjName').val();
|
||||
let makeMonth = $('#makeMonth').val();
|
||||
|
||||
// 静态数据
|
||||
var tableData = [];
|
||||
|
||||
//保存表头
|
||||
var col = [
|
||||
[{
|
||||
title: '序号',
|
||||
field: 'zizeng',
|
||||
align: 'center',
|
||||
type: 'numbers',
|
||||
type: 'numbers'
|
||||
},
|
||||
{
|
||||
field:'comName',
|
||||
title: '所属分公司',
|
||||
field: 'userName',
|
||||
title: '姓 名',
|
||||
align: 'center',
|
||||
width: '10%',
|
||||
width: '80'
|
||||
},
|
||||
{
|
||||
field:'stationName',
|
||||
title: '所属运检站',
|
||||
align: 'center',
|
||||
width: '15%',
|
||||
},
|
||||
{
|
||||
field:'lineName',
|
||||
field: 'proName',
|
||||
title: '管辖线路名称',
|
||||
align: 'center',
|
||||
width: '10%',
|
||||
width: '200'
|
||||
},
|
||||
{
|
||||
field:'username',
|
||||
title: '姓名',
|
||||
field: 'yjName',
|
||||
title: '所属运检站',
|
||||
align: 'center',
|
||||
width: '5%',
|
||||
width: '200'
|
||||
},
|
||||
{
|
||||
field:'totalDay',
|
||||
field: 'special',
|
||||
title: '总计(天)',
|
||||
align: 'center',
|
||||
width: '10%',
|
||||
width: '100'
|
||||
},
|
||||
]
|
||||
];
|
||||
if(tableData != null && tableData!= ''){
|
||||
//生成表格列. 以属性个数进行循环,生成表头
|
||||
for (var i = 6; i < Object.keys(tableData[0]).length; i++) {
|
||||
var key = Object.keys(tableData[0])[i];
|
||||
]
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: PATH_URL + '/attendance/getSpecialPatrolList', // 请求地址
|
||||
data: {
|
||||
"userName": userName,
|
||||
"proName": proName,
|
||||
"yjName": yjName,
|
||||
"makeMonth": makeMonth,
|
||||
"fgsId": "26"
|
||||
}, //获取提交的表单字段
|
||||
success: function(data) {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var json = {
|
||||
field: key,
|
||||
title: key,
|
||||
align: 'center',
|
||||
'userName': data[i].userName,
|
||||
'proName': data[i].proName,
|
||||
'yjName': data[i].yjName,
|
||||
'special': data[i].special,
|
||||
'makeMonth': data[i].makeMonth,
|
||||
'proId': data[i].proId
|
||||
}
|
||||
var spMakeList = data[i].spMakeList;
|
||||
for (var j = 0; j < spMakeList.length; j++) {
|
||||
json[`${ spMakeList[j].currDay }`] = spMakeList[j].isAtt;
|
||||
}
|
||||
tableData.push(json)
|
||||
}
|
||||
console.log('tableData', tableData)
|
||||
|
||||
if (data.length > 0) {
|
||||
for (var i = 0; i < data[0].spMakeList.length; i++) {
|
||||
var spMake = data[0].spMakeList[i];
|
||||
var json = {
|
||||
field: `${ spMake.currDay }`,
|
||||
title: `${ spMake.currDay }`,
|
||||
align: 'center'
|
||||
}
|
||||
col[0].push(json);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 初始化数据
|
||||
*/
|
||||
function init(){
|
||||
// 渲染表格
|
||||
table.render({
|
||||
}
|
||||
d = table.render({
|
||||
id: 'layui_table',
|
||||
elem: '#table',
|
||||
// url: "/sys/achievement",
|
||||
page: true,
|
||||
// skin: 'line', // 表格样式
|
||||
border: 1,
|
||||
page: true, //开启分页
|
||||
skin: 'line', // 表格样式
|
||||
cols: col,
|
||||
data: tableData
|
||||
data: tableData,
|
||||
title: '特勤考勤台账'//导出数据excel的表名称
|
||||
});
|
||||
console.log("col",col)
|
||||
console.log("tableData",tableData)
|
||||
|
||||
excelData.push(['特勤考勤台账']);
|
||||
// 使用 cols 和 data 构造一个包含表头的新数组
|
||||
excelData.push(col[0].map(function(item) { return item.title; })); // 构建表头行
|
||||
tableData.forEach(function(row, index) {
|
||||
var newRow = [];
|
||||
col[0].forEach(function(colItem) {
|
||||
if (colItem.type === 'numbers') {
|
||||
newRow.push(index + 1); // 序号从 1 开始
|
||||
} else {
|
||||
newRow.push(row[colItem.field]); // 添加对应字段的值
|
||||
}
|
||||
});
|
||||
excelData.push(newRow); // 将新行添加到 excelData
|
||||
});
|
||||
console.log(excelData); // 输出结果,检查是否正确
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, e) {
|
||||
layer.msg('数据请求发生异常,请稍后重试', {
|
||||
icon: 16,
|
||||
scrollbar: false
|
||||
});
|
||||
top.layer.close(addLoadingMsg); //再执行关闭
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//查询
|
||||
function queryClick() {
|
||||
init();
|
||||
}
|
||||
//重置
|
||||
function resetClick() {
|
||||
$('#userName').val("");
|
||||
$('#proName').val("");
|
||||
$('#yjName').val("");
|
||||
|
||||
var today = new Date();
|
||||
var year = today.getFullYear();
|
||||
var month = today.getMonth() + 1;
|
||||
if (month < 10) {
|
||||
month = '0' + month;
|
||||
}
|
||||
var currentMonth = year + '-' + month;
|
||||
$('#makeMonth').val(currentMonth);
|
||||
init();
|
||||
}
|
||||
|
||||
//导出
|
||||
function exportData(){
|
||||
// let search1 = $('#search1').val();
|
||||
// let search2 = $('#search2').val();
|
||||
window.location.href = oiPlanUrl + "/monthlyPlanSubmission/export?token=" + token;
|
||||
function exportData() {
|
||||
layui.excel.exportExcel(excelData, '特勤考勤台账.xlsx', 'xlsx')
|
||||
// table.exportFile(d.config.id, excelData, 'xlsx');
|
||||
}
|
||||
Loading…
Reference in New Issue