|
|
/** 工作汇报查看 */
|
|
|
layui.define(['table', 'form', 'sessions', 'admin', 'common', 'echarts','laydate','element'], function (exports) {
|
|
|
layui.define(['table', 'form', 'sessions', 'admin', 'common', 'echarts', 'laydate', 'element'], function (exports) {
|
|
|
var $ = layui.$;
|
|
|
var form = layui.form;
|
|
|
var table = layui.table;
|
...
|
...
|
@@ -15,48 +15,45 @@ layui.define(['table', 'form', 'sessions', 'admin', 'common', 'echarts','laydate |
|
|
var companyChart = echarts.init(document.getElementById('chart-company-report'));
|
|
|
var noReadChart = echarts.init(document.getElementById('chart-noRead-report'));
|
|
|
var dateLimit = ""
|
|
|
var createTime = ""
|
|
|
var createTime = "today"
|
|
|
var type = ''
|
|
|
var urlRepType = ''
|
|
|
var manufacturerId = ''
|
|
|
var reportDetailTable;
|
|
|
getUrlType()
|
|
|
|
|
|
if (type != '1') {
|
|
|
createTime = 'thisWeek';
|
|
|
} else {
|
|
|
$.each($("button.date"),function (i,e) {
|
|
|
var $dom = $(e);
|
|
|
if($dom.hasClass("active")){
|
|
|
$dom.removeClass("active")
|
|
|
}
|
|
|
})
|
|
|
$.each($("button.isRead"),function (i,e) {
|
|
|
var $dom = $(e);
|
|
|
if($dom.data("type") == '0'){
|
|
|
$dom.addClass("active")
|
|
|
}
|
|
|
})
|
|
|
$.each($('input[name="repType"]'),function (i,e) {
|
|
|
var $dom = $(e);
|
|
|
if($dom.val() == urlRepType){
|
|
|
$dom.attr('checked','checked');
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
$.each($("button.date"), function (i, e) {
|
|
|
var $dom = $(e);
|
|
|
if ($dom.hasClass("active")) {
|
|
|
$dom.removeClass("active")
|
|
|
}
|
|
|
})
|
|
|
$.each($("button.isRead"), function (i, e) {
|
|
|
var $dom = $(e);
|
|
|
if ($dom.data("type") == '0') {
|
|
|
$dom.addClass("active")
|
|
|
}
|
|
|
})
|
|
|
$.each($('input[name="repType"]'), function (i, e) {
|
|
|
var $dom = $(e);
|
|
|
if ($dom.val() == urlRepType) {
|
|
|
$dom.attr('checked', 'checked');
|
|
|
}
|
|
|
})
|
|
|
|
|
|
|
|
|
//日期范围选择
|
|
|
laydate.render({
|
|
|
elem: '#dateLimit'
|
|
|
,range: '~',
|
|
|
, range: '~',
|
|
|
done: function (value) {
|
|
|
dateLimit = value
|
|
|
if (dateLimit == '') {
|
|
|
$('[data-period="thisWeek"]').click()
|
|
|
$('[data-period="today"]').click()
|
|
|
} else {
|
|
|
$.each($("button.date"),function (i,e) {
|
|
|
$.each($("button.date"), function (i, e) {
|
|
|
var $dom = $(e);
|
|
|
if($dom.hasClass("active")){
|
|
|
if ($dom.hasClass("active")) {
|
|
|
$dom.removeClass("active")
|
|
|
}
|
|
|
})
|
...
|
...
|
@@ -66,43 +63,43 @@ layui.define(['table', 'form', 'sessions', 'admin', 'common', 'echarts','laydate |
|
|
});
|
|
|
|
|
|
form.render();
|
|
|
// loadDailyChart();
|
|
|
// loadReportableChart();
|
|
|
// loadDailyChart();
|
|
|
// loadReportableChart();
|
|
|
loadCompanyReport();
|
|
|
loadReadReport();
|
|
|
loadWorkReportTable();
|
|
|
loadConditionSelect();
|
|
|
var url = domainName + '/api-web/workreport/chart/noRead';
|
|
|
loadNoReadChart(noReadChart,url,'未读');
|
|
|
loadNoReadChart(noReadChart, url, '未读');
|
|
|
|
|
|
// tab页切换事件
|
|
|
element.on('tab(report-tab)', function (data) {
|
|
|
var name = '';
|
|
|
if (data.index == 0) {
|
|
|
url = domainName + '/api-web/workreport/chart/noRead'
|
|
|
name = '未读';
|
|
|
loadNoReadChart(noReadChart,url,name);
|
|
|
} else if (data.index == 1) {
|
|
|
url = domainName + '/api-web/workreport/chart/noReport?createTime=' + createTime + '&dateLimit=' + dateLimit;
|
|
|
name = '未报';
|
|
|
var noReportChat = echarts.init(document.getElementById('chart-noReport-report'));
|
|
|
loadNoReadChart(noReportChat,url,name);
|
|
|
} else if (data.index == 2) {
|
|
|
url = domainName + '/api-web/workreport/chart/noHandlingAlarmsChart'
|
|
|
name = '未处理';
|
|
|
var noAlarmChart = echarts.init(document.getElementById('chart-noAlarm-report'));
|
|
|
loadNoReadChart(noAlarmChart,url,name);
|
|
|
}
|
|
|
var name = '';
|
|
|
if (data.index == 0) {
|
|
|
url = domainName + '/api-web/workreport/chart/noRead'
|
|
|
name = '未读';
|
|
|
loadNoReadChart(noReadChart, url, name);
|
|
|
} else if (data.index == 1) {
|
|
|
url = domainName + '/api-web/workreport/chart/noReport?createTime=' + createTime + '&dateLimit=' + dateLimit;
|
|
|
name = '未报';
|
|
|
var noReportChat = echarts.init(document.getElementById('chart-noReport-report'));
|
|
|
loadNoReadChart(noReportChat, url, name);
|
|
|
} else if (data.index == 2) {
|
|
|
url = domainName + '/api-web/workreport/chart/noHandlingAlarmsChart'
|
|
|
name = '未处理';
|
|
|
var noAlarmChart = echarts.init(document.getElementById('chart-noAlarm-report'));
|
|
|
loadNoReadChart(noAlarmChart, url, name);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//监听Esc事件
|
|
|
$(document).keyup(function(event){
|
|
|
if(event.keyCode === 27 || event.keyCode === 96){
|
|
|
$(document).keyup(function (event) {
|
|
|
if (event.keyCode === 27 || event.keyCode === 96) {
|
|
|
layer.closeAll();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$("button.isRead").unbind().on("click",function () {
|
|
|
$("button.isRead").unbind().on("click", function () {
|
|
|
var $dom = $(this);
|
|
|
$("button.isRead").removeClass("active")
|
|
|
$dom.addClass("active")
|
...
|
...
|
@@ -111,9 +108,9 @@ layui.define(['table', 'form', 'sessions', 'admin', 'common', 'echarts','laydate |
|
|
|
|
|
// 日期方式选择
|
|
|
$('#btns-workreport-time button').click(function () {
|
|
|
$.each($("button.date"),function (i,e) {
|
|
|
$.each($("button.date"), function (i, e) {
|
|
|
var $dom = $(e);
|
|
|
if($dom.hasClass("active")){
|
|
|
if ($dom.hasClass("active")) {
|
|
|
$dom.removeClass("active")
|
|
|
}
|
|
|
})
|
...
|
...
|
@@ -163,16 +160,21 @@ layui.define(['table', 'form', 'sessions', 'admin', 'common', 'echarts','laydate |
|
|
// 加载工作汇报表格
|
|
|
function loadWorkReportTable() {
|
|
|
var conditions = form.val('form-workreport-condition');
|
|
|
$.each($("button.isRead"),function (i,e) {
|
|
|
$.each($("button.isRead"), function (i, e) {
|
|
|
var $dom = $(e);
|
|
|
if($dom.hasClass("active")){
|
|
|
if ($dom.hasClass("active")) {
|
|
|
conditions["currIsRead"] = $dom.data("type")
|
|
|
}
|
|
|
})
|
|
|
if(manufacturerId!=''){
|
|
|
if (manufacturerId != '') {
|
|
|
conditions.manufacturerName = manufacturerId;
|
|
|
}
|
|
|
Object.assign(conditions, {access_token: accessToken, createTime: createTime, viewMode: 'true',dateLimit:dateLimit});
|
|
|
Object.assign(conditions, {
|
|
|
access_token: accessToken,
|
|
|
createTime: createTime,
|
|
|
viewMode: 'true',
|
|
|
dateLimit: dateLimit
|
|
|
});
|
|
|
table.render({
|
|
|
elem: '#table-workreport-view',
|
|
|
url: domainName + '/api-web/workreport/page',
|
...
|
...
|
@@ -210,7 +212,7 @@ layui.define(['table', 'form', 'sessions', 'admin', 'common', 'echarts','laydate |
|
|
return typeName
|
|
|
}
|
|
|
}, {
|
|
|
field: 'repTitle', title: '标题', align: 'center', minWidth: 200,event: 'serRead',
|
|
|
field: 'repTitle', title: '标题', align: 'center', minWidth: 200, event: 'serRead',
|
|
|
templet: '<div><span data-id="{{d.id}}" data-rep="{{d.repType}}" class="layui-table-link view-workReport-title" >{{d.repTitle}}</span></div>'
|
|
|
}, {
|
|
|
field: 'attachmentList', title: '附件数量', align: 'center',
|
...
|
...
|
@@ -225,7 +227,7 @@ layui.define(['table', 'form', 'sessions', 'admin', 'common', 'echarts','laydate |
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
field: 'reportUserList', title: '未读人员', align: 'center',minWidth:'200',
|
|
|
field: 'reportUserList', title: '未读人员', align: 'center', minWidth: '200',
|
|
|
templet: function (d) {
|
|
|
var userName = [];
|
|
|
$.each(d.reportUserList, function (i, v) {
|
...
|
...
|
@@ -233,13 +235,13 @@ layui.define(['table', 'form', 'sessions', 'admin', 'common', 'echarts','laydate |
|
|
userName.push(v.nickName)
|
|
|
}
|
|
|
});
|
|
|
if(userName.length === 0){
|
|
|
if (userName.length === 0) {
|
|
|
userName = ['无']
|
|
|
}
|
|
|
return userName.toString();
|
|
|
}
|
|
|
}, {
|
|
|
field: 'reportUserList', title: '已读人员', align: 'center',minWidth:'200',
|
|
|
field: 'reportUserList', title: '已读人员', align: 'center', minWidth: '200',
|
|
|
templet: function (d) {
|
|
|
var userName = [];
|
|
|
$.each(d.reportUserList, function (i, v) {
|
...
|
...
|
@@ -247,13 +249,13 @@ layui.define(['table', 'form', 'sessions', 'admin', 'common', 'echarts','laydate |
|
|
userName.push(v.nickName)
|
|
|
}
|
|
|
});
|
|
|
if(userName.length === 0){
|
|
|
if (userName.length === 0) {
|
|
|
userName = ['无']
|
|
|
}
|
|
|
return userName.toString();
|
|
|
}
|
|
|
}, {
|
|
|
field: 'createUserNickName', title: '上报人', align: 'center',
|
|
|
field: 'createUserNickName', title: '汇报人', align: 'center',
|
|
|
}, {
|
|
|
field: 'manufacturerName', title: '厂商', align: 'center',
|
|
|
}, {
|
...
|
...
|
@@ -262,16 +264,19 @@ layui.define(['table', 'form', 'sessions', 'admin', 'common', 'echarts','laydate |
|
|
done: function () {
|
|
|
//获取附件列表
|
|
|
$('.view-workReport-attachment').on('click', function () {
|
|
|
common.openWin('workreport/list', '附件', {id: $(this).data('id'), type: 'attachment'}, ['确定', '取消']);
|
|
|
common.openWin('workreport/list', '附件', {
|
|
|
id: $(this).data('id'),
|
|
|
type: 'attachment'
|
|
|
}, ['确定', '取消']);
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
//监听单元格事件
|
|
|
table.on('tool(table-workreport-view)', function(obj){
|
|
|
table.on('tool(table-workreport-view)', function (obj) {
|
|
|
var data = obj.data;
|
|
|
if(obj.event === 'serRead'){
|
|
|
if (obj.event === 'serRead') {
|
|
|
|
|
|
var id = data['id'];
|
|
|
var repType = data['repType'];
|
...
|
...
|
@@ -286,7 +291,11 @@ layui.define(['table', 'form', 'sessions', 'admin', 'common', 'echarts','laydate |
|
|
loadReadReport();
|
|
|
}
|
|
|
});
|
|
|
common.openWin('workreport/add', '查看', {id: id, repType: repType, viewType: 'view'}, ['关闭'], function f() {
|
|
|
common.openWin('workreport/add', '查看', {
|
|
|
id: id,
|
|
|
repType: repType,
|
|
|
viewType: 'view'
|
|
|
}, ['关闭'], function f() {
|
|
|
return true;
|
|
|
}, null, null, {
|
|
|
success: function () {
|
...
|
...
|
@@ -306,7 +315,7 @@ layui.define(['table', 'form', 'sessions', 'admin', 'common', 'echarts','laydate |
|
|
options += "<option value='" + v.id + "'>" + v.manufacturerName + "</option>"
|
|
|
});
|
|
|
$('#slt-workreport-group').html(options);
|
|
|
if(manufacturerId!=''){
|
|
|
if (manufacturerId != '') {
|
|
|
$('#slt-workreport-group').val(manufacturerId)
|
|
|
}
|
|
|
form.render();
|
...
|
...
|
@@ -331,7 +340,12 @@ layui.define(['table', 'form', 'sessions', 'admin', 'common', 'echarts','laydate |
|
|
// 加载最近日报汇报统计图表
|
|
|
function loadDailyChart() {
|
|
|
var conditions = form.val('form-workreport-condition');
|
|
|
Object.assign(conditions, {access_token: accessToken, createTime: createTime, viewMode: 'true',dateLimit:dateLimit});
|
|
|
Object.assign(conditions, {
|
|
|
access_token: accessToken,
|
|
|
createTime: createTime,
|
|
|
viewMode: 'true',
|
|
|
dateLimit: dateLimit
|
|
|
});
|
|
|
admin.req({
|
|
|
url: domainName + '/api-web/workreport/chart/daily',
|
|
|
data: conditions
|
...
|
...
|
@@ -411,8 +425,8 @@ layui.define(['table', 'form', 'sessions', 'admin', 'common', 'echarts','laydate |
|
|
}],
|
|
|
dataZoom: [
|
|
|
{
|
|
|
type:"slider",
|
|
|
realtime:true,
|
|
|
type: "slider",
|
|
|
realtime: true,
|
|
|
height: 25,
|
|
|
start: 5,
|
|
|
end: 55
|
...
|
...
|
@@ -427,7 +441,12 @@ layui.define(['table', 'form', 'sessions', 'admin', 'common', 'echarts','laydate |
|
|
// 日报/周报/月报 应报已报统计
|
|
|
function loadReportableChart() {
|
|
|
var conditions = form.val('form-workreport-condition');
|
|
|
Object.assign(conditions, {access_token: accessToken, createTime: createTime, viewMode: 'true',dateLimit:dateLimit});
|
|
|
Object.assign(conditions, {
|
|
|
access_token: accessToken,
|
|
|
createTime: createTime,
|
|
|
viewMode: 'true',
|
|
|
dateLimit: dateLimit
|
|
|
});
|
|
|
admin.req({
|
|
|
url: domainName + '/api-web/workreport/chart/reptype',
|
|
|
data: conditions
|
...
|
...
|
@@ -514,7 +533,12 @@ layui.define(['table', 'form', 'sessions', 'admin', 'common', 'echarts','laydate |
|
|
// 各厂商应报已报情况
|
|
|
function loadCompanyReport() {
|
|
|
var conditions = form.val('form-workreport-condition');
|
|
|
Object.assign(conditions, {access_token: accessToken, createTime: createTime, viewMode: '',dateLimit:dateLimit});
|
|
|
Object.assign(conditions, {
|
|
|
access_token: accessToken,
|
|
|
createTime: createTime,
|
|
|
viewMode: '',
|
|
|
dateLimit: dateLimit
|
|
|
});
|
|
|
admin.req({
|
|
|
url: domainName + '/api-web/workreport/chart/group',
|
|
|
data: conditions
|
...
|
...
|
@@ -544,8 +568,8 @@ layui.define(['table', 'form', 'sessions', 'admin', 'common', 'echarts','laydate |
|
|
textStyle: {
|
|
|
color: '#555'
|
|
|
},
|
|
|
formatter:function (data) {
|
|
|
return reportedList[data.dataIndex] +'/'+ data.value
|
|
|
formatter: function (data) {
|
|
|
return reportedList[data.dataIndex] + '/' + data.value
|
|
|
}
|
|
|
},
|
|
|
itemStyle: {
|
...
|
...
|
@@ -645,8 +669,8 @@ layui.define(['table', 'form', 'sessions', 'admin', 'common', 'echarts','laydate |
|
|
axisLabel: {
|
|
|
color: '#333',
|
|
|
show: true,
|
|
|
interval:0,
|
|
|
rotate:25
|
|
|
interval: 0,
|
|
|
rotate: 25
|
|
|
},
|
|
|
axisLine: {
|
|
|
lineStyle: {
|
...
|
...
|
@@ -707,8 +731,8 @@ layui.define(['table', 'form', 'sessions', 'admin', 'common', 'echarts','laydate |
|
|
series: series,
|
|
|
dataZoom: [
|
|
|
{
|
|
|
type:"slider",
|
|
|
realtime:true,
|
|
|
type: "slider",
|
|
|
realtime: true,
|
|
|
height: 25,
|
|
|
start: 5,
|
|
|
end: 55
|
...
|
...
|
@@ -721,12 +745,12 @@ layui.define(['table', 'form', 'sessions', 'admin', 'common', 'echarts','laydate |
|
|
}
|
|
|
|
|
|
//点击弹出详情
|
|
|
companyChart.on('click',function (params) {
|
|
|
companyChart.on('click', function (params) {
|
|
|
reportDetails(params.name)
|
|
|
})
|
|
|
|
|
|
//未读人员
|
|
|
function loadNoReadChart(echartObject,url,name) {
|
|
|
function loadNoReadChart(echartObject, url, name) {
|
|
|
var xData = ""
|
|
|
var yData = ""
|
|
|
echartObject.showLoading({
|
...
|
...
|
@@ -785,9 +809,9 @@ layui.define(['table', 'form', 'sessions', 'admin', 'common', 'echarts','laydate |
|
|
axisLabel: {
|
|
|
color: '#333',
|
|
|
show: true,
|
|
|
interval:0,
|
|
|
rotate:19,
|
|
|
fontSize : 10 //更改坐标轴文字大小
|
|
|
interval: 0,
|
|
|
rotate: 19,
|
|
|
fontSize: 10 //更改坐标轴文字大小
|
|
|
},
|
|
|
axisLine: {
|
|
|
lineStyle: {
|
...
|
...
|
@@ -838,7 +862,7 @@ layui.define(['table', 'form', 'sessions', 'admin', 'common', 'echarts','laydate |
|
|
area: ['70%', '60%'],
|
|
|
content: '<div class="layui-card" style="margin-top: 30px;box-shadow:none"><div class="layui-card-body"><table id="reportDetails" lay-filter="reportDetails"></table></div></div>',
|
|
|
btn: ['关闭'],
|
|
|
success: function(index, layero) {
|
|
|
success: function (index, layero) {
|
|
|
reportDetailsTable(name)
|
|
|
},
|
|
|
yes: function (index, layero) {
|
...
|
...
|
@@ -846,14 +870,15 @@ layui.define(['table', 'form', 'sessions', 'admin', 'common', 'echarts','laydate |
|
|
}
|
|
|
});
|
|
|
}
|
|
|
$("#notReportCountBtn").unbind().on("click",function () {
|
|
|
|
|
|
$("#notReportCountBtn").unbind().on("click", function () {
|
|
|
layer.open({
|
|
|
title: ['汇报详细', 'font-size:18px;'],
|
|
|
type: 1,
|
|
|
area: ['70%', '60%'],
|
|
|
content: '<div class="layui-card" style="margin-top: 30px;box-shadow:none"><div class="layui-card-body"><table id="reportDetails" lay-filter="reportDetails"></table></div></div>',
|
|
|
btn: ['关闭'],
|
|
|
success: function(index, layero) {
|
|
|
success: function (index, layero) {
|
|
|
reportDetailsTable();
|
|
|
},
|
|
|
yes: function (index, layero) {
|
...
|
...
|
@@ -861,6 +886,7 @@ layui.define(['table', 'form', 'sessions', 'admin', 'common', 'echarts','laydate |
|
|
}
|
|
|
});
|
|
|
})
|
|
|
|
|
|
function reportDetailsTable(name) {
|
|
|
var conditions = form.val('form-workreport-condition');
|
|
|
if (name) conditions["name"] = name
|
...
|
...
|
@@ -887,15 +913,15 @@ layui.define(['table', 'form', 'sessions', 'admin', 'common', 'echarts','laydate |
|
|
}, {
|
|
|
field: 'readCount', title: '已报数量', align: 'center'
|
|
|
}, {
|
|
|
field: 'needReport', title: '未报数量', align: 'center',style:'color:red',templet:function (d) {
|
|
|
return d.needReport-d.readCount
|
|
|
field: 'needReport', title: '未报数量', align: 'center', style: 'color:red', templet: function (d) {
|
|
|
return d.needReport - d.readCount
|
|
|
}
|
|
|
}]],
|
|
|
})
|
|
|
}
|
|
|
|
|
|
//未读统计报表导出
|
|
|
$('#notReportExportBtn').unbind().on('click',function () {
|
|
|
$('#notReportExportBtn').unbind().on('click', function () {
|
|
|
var conditions = form.val('form-workreport-condition');
|
|
|
var url = common.domainName + '/api-web/workreport/group/exportReportDetails?access_token=' + accessToken + '&createTime=' + createTime + '&viewMode=' + 'true' + '&dateLimit=' + dateLimit + '&repType=' + conditions.repType + '&createBy=' + conditions.createBy;
|
|
|
window.open(url)
|
...
|
...
|
@@ -904,7 +930,12 @@ layui.define(['table', 'form', 'sessions', 'admin', 'common', 'echarts','laydate |
|
|
// 已读未读报表
|
|
|
function loadReadReport() {
|
|
|
var conditions = form.val('form-workreport-condition');
|
|
|
Object.assign(conditions, {access_token: accessToken, createTime: createTime, viewMode: 'true',dateLimit:dateLimit});
|
|
|
Object.assign(conditions, {
|
|
|
access_token: accessToken,
|
|
|
createTime: createTime,
|
|
|
viewMode: 'true',
|
|
|
dateLimit: dateLimit
|
|
|
});
|
|
|
admin.req({
|
|
|
url: domainName + '/api-web/workreport/chart/read',
|
|
|
data: conditions
|
...
|
...
|
@@ -1024,7 +1055,7 @@ layui.define(['table', 'form', 'sessions', 'admin', 'common', 'echarts','laydate |
|
|
//获取url中的type值
|
|
|
function getUrlType() {
|
|
|
var href = window.location.href;
|
|
|
href = href.substr(href.indexOf("#"),href.length);
|
|
|
href = href.substr(href.indexOf("#"), href.length);
|
|
|
var url = href.split("/");
|
|
|
if (url.length <= 1) {
|
|
|
return "";
|
...
|
...
|
@@ -1045,15 +1076,15 @@ layui.define(['table', 'form', 'sessions', 'admin', 'common', 'echarts','laydate |
|
|
// 图表,表格重新加载
|
|
|
function reloadAllChange() {
|
|
|
loadWorkReportTable();
|
|
|
// loadDailyChart();
|
|
|
// loadDailyChart();
|
|
|
loadCompanyReport();
|
|
|
loadReadReport();
|
|
|
var url = domainName + '/api-web/workreport/chart/noReport?createTime=' + createTime + '&dateLimit=' + dateLimit;
|
|
|
var name = '未报';
|
|
|
var noReportChat = echarts.init(document.getElementById('chart-noReport-report'));
|
|
|
loadNoReadChart(noReportChat,url,name);
|
|
|
loadNoReadChart(noReportChat, url, name);
|
|
|
// loadNoReadChart()
|
|
|
// loadReportableChart();
|
|
|
// loadReportableChart();
|
|
|
}
|
|
|
});
|
|
|
}); |
...
|
...
|
|