1123 lines
39 KiB
JavaScript
1123 lines
39 KiB
JavaScript
/**
|
||
* 设备总览js
|
||
*/
|
||
|
||
/*function pie1(unitId, mpointCode, echartId) {
|
||
var unitId = '021THZS';
|
||
var mpointCode = 'P3flow1_total';
|
||
echartPie(unitId, mpointCode, echartId);//通用环形图
|
||
}*/
|
||
|
||
function getValue(unitId, mpointCode, valueId, textId) {
|
||
$.ajax({
|
||
type: 'GET',
|
||
url: ext.contextPath + '/work/mpoint/getValue.do?unitId=' + unitId + '&mpointCode=' + mpointCode,
|
||
async: true,
|
||
globle: false,
|
||
error: function () {
|
||
return false;
|
||
},
|
||
success: function (data) {
|
||
if (data != null && data != '') {
|
||
var data = eval('(' + data + ')');
|
||
//只限制上限为0.8 下限根据设定值自己设
|
||
// var maxvalue = data.alarmmax/0.8;
|
||
// var minvalue = data.alarmmin/maxvalue;
|
||
// var acvalue = data.parmvalue/maxvalue*100;
|
||
$('#' + valueId).html(data.parmvalue);//赋值
|
||
if (data.unit == undefined) {
|
||
$('#' + textId).html(data.parmname);//赋值名称
|
||
} else {
|
||
$('#' + textId).html(data.parmname + ' (' + data.unit + ')');//赋值名称+单位
|
||
}
|
||
}
|
||
}
|
||
});
|
||
}
|
||
|
||
/**
|
||
* echart饼图--通用
|
||
*/
|
||
function echartPie(unitId, mpointCode, echartId, textId) {
|
||
var myChart = echarts.init(document.getElementById(echartId));
|
||
$.ajax({
|
||
type: 'GET',
|
||
url: ext.contextPath + '/work/mpoint/getValue.do?unitId=' + unitId + '&mpointCode=' + mpointCode,
|
||
async: true,
|
||
globle: false,
|
||
error: function () {
|
||
return false;
|
||
},
|
||
success: function (data) {
|
||
var data = eval('(' + data + ')');
|
||
//只限制上限为0.8 下限根据设定值自己设
|
||
var maxvalue = 100;
|
||
var minvalue = 0;
|
||
var acvalue = 0;
|
||
var unit = '';
|
||
|
||
$('#' + textId).html(data.parmname);
|
||
|
||
if (data.unit != undefined) {
|
||
unit = '(' + data.unit + ')';
|
||
}
|
||
|
||
if (data.alarmmax != undefined) {
|
||
maxvalue = data.alarmmax / 0.8;
|
||
}
|
||
if (data.alarmmin != undefined) {
|
||
minvalue = data.alarmmin / maxvalue;
|
||
}
|
||
if (data.alarmmax != undefined && data.alarmmin != undefined) {
|
||
acvalue = data.parmvalue / maxvalue * 100;
|
||
} else {
|
||
acvalue = data.parmvalue;
|
||
}
|
||
// console.log(minvalue);
|
||
// console.log(maxvalue);
|
||
// console.log(acvalue);
|
||
|
||
var colorStr = '#66d99f';
|
||
if (acvalue < minvalue) {
|
||
colorStr = '#e2e2e2';
|
||
} else if (acvalue > maxvalue) {
|
||
colorStr = '#f35a4a';
|
||
} else {
|
||
colorStr = '#66d99f';
|
||
}
|
||
|
||
var option = {
|
||
toolbox: { //可视化的工具箱
|
||
show: false,
|
||
feature: {
|
||
restore: { //重置
|
||
show: true
|
||
},
|
||
saveAsImage: {//保存图片
|
||
show: true
|
||
}
|
||
}
|
||
},
|
||
series: [{
|
||
name: '业务指标',
|
||
type: 'gauge',
|
||
startAngle: 180,
|
||
endAngle: 0,
|
||
radius: 70,
|
||
center: ['50%', '80%'],//设置饼图位置
|
||
axisLine: {
|
||
show: true,
|
||
// 属性lineStyle控制线条样式
|
||
lineStyle: {
|
||
width: 15,
|
||
color: [[minvalue, '#e2e2e2'], [0.8, '#66d99f'], [1, '#f35a4a']]
|
||
}
|
||
},
|
||
splitLine: {
|
||
show: false,
|
||
},
|
||
axisTick: {
|
||
show: false,
|
||
},
|
||
axisLabel: {
|
||
show: false,
|
||
},
|
||
pointer: {
|
||
length: '40px',
|
||
width: '3px',
|
||
},
|
||
detail: {
|
||
offsetCenter: [0, '20%'],
|
||
fontSize: 14,
|
||
//formatter: data.parmname,
|
||
formatter: data.parmvalue + unit,//data.parmvalue为实际值 acvalue为计算后的比例
|
||
fontSize: 14,
|
||
color: colorStr
|
||
},
|
||
data: [
|
||
// {value: data.parmvalue}
|
||
{value: acvalue}
|
||
]
|
||
}]
|
||
};
|
||
myChart.setOption(option);
|
||
myChart.resize();
|
||
}
|
||
});
|
||
}
|
||
|
||
/**
|
||
* echart折线图--通用
|
||
*/
|
||
function echartLine(unitId, mpointCode, echartId) {
|
||
var myChart = echarts.init(document.getElementById(echartId));
|
||
|
||
$.ajax({
|
||
type: 'GET',
|
||
url: ext.contextPath + '/work/mpoint/getValueDay.do?unitId=' + unitId + '&mpointCode=' + mpointCode,
|
||
async: true,
|
||
globle: false,
|
||
error: function () {
|
||
return false;
|
||
},
|
||
success: function (data) {
|
||
var data = eval('(' + data + ')');
|
||
var option = {
|
||
tooltip: {
|
||
trigger: 'axis'
|
||
},
|
||
title: [{
|
||
left: 'center',
|
||
text: data.name
|
||
}],
|
||
grid: {
|
||
left: '3%',
|
||
right: '4%',
|
||
bottom: '3%',
|
||
containLabel: true
|
||
},
|
||
xAxis: {
|
||
type: 'category',
|
||
boundaryGap: false,
|
||
data: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23']
|
||
},
|
||
yAxis: {
|
||
type: 'value'
|
||
},
|
||
series: [
|
||
{
|
||
name: '上限',
|
||
type: 'line',
|
||
// stack: '总量',
|
||
data: data.maxlist
|
||
},
|
||
{
|
||
name: '下限',
|
||
type: 'line',
|
||
// stack: '总量',
|
||
data: data.minlist
|
||
},
|
||
{
|
||
name: '实际值',
|
||
type: 'line',
|
||
// stack: '总量',
|
||
data: data.datalist
|
||
}
|
||
]
|
||
};
|
||
myChart.setOption(option);
|
||
myChart.resize();
|
||
}
|
||
});
|
||
}
|
||
|
||
/**
|
||
* echart柱状图--单柱通用
|
||
*/
|
||
function echartColumnarold(unitId, mpointCode, echartId) {
|
||
var myChart = echarts.init(document.getElementById(echartId));
|
||
|
||
$.ajax({
|
||
type: 'GET',
|
||
url: ext.contextPath + '/maintenance/abnormity/getAbnormity4Month.do?unitId=' + unitId,
|
||
async: true,
|
||
globle: false,
|
||
error: function () {
|
||
return false;
|
||
},
|
||
success: function (data) {
|
||
var data = eval('(' + data + ')');
|
||
var option = {
|
||
color: '#62AEDF',
|
||
xAxis: {
|
||
type: 'category',
|
||
data: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30']
|
||
},
|
||
yAxis: {
|
||
type: 'value'
|
||
},
|
||
title: [{
|
||
left: 'center',
|
||
text: data.name
|
||
}],
|
||
grid: {
|
||
left: '2%',
|
||
right: '2%',
|
||
bottom: '3%',
|
||
containLabel: true
|
||
},
|
||
series: [{
|
||
data: data.datalist,
|
||
type: 'bar',
|
||
showBackground: true,
|
||
backgroundStyle: {
|
||
//color: '#62AEDF'
|
||
}
|
||
}]
|
||
};
|
||
myChart.setOption(option);
|
||
myChart.resize();
|
||
}
|
||
});
|
||
}
|
||
|
||
function echartColumnar2(unitId, mpointCode, echartId) {
|
||
var myChart = echarts.init(document.getElementById(echartId));
|
||
|
||
$.ajax({
|
||
type: 'GET',
|
||
url: ext.contextPath + '/maintenance/abnormity/getAbnormity4Month.do?unitId=' + unitId,
|
||
async: true,
|
||
globle: false,
|
||
error: function () {
|
||
return false;
|
||
},
|
||
success: function (data) {
|
||
var data = eval('(' + data + ')');
|
||
var option = {
|
||
color: '#62AEDF',
|
||
xAxis: {
|
||
type: 'value'
|
||
},
|
||
yAxis: {
|
||
type: 'category',
|
||
data: ['异常停机', '异常震动', '电脑故障', '弯曲变形', '仪表读数异常', '异常发热', '视频信号中断', '仪表故障', '跳闸', '用电变更', '废弃物未清理', '软件故障']
|
||
},
|
||
/*title: [{
|
||
left: 'center',
|
||
text: data.name
|
||
}],*/
|
||
grid: {
|
||
top: '2%',
|
||
left: '3%',
|
||
right: '4%',
|
||
bottom: '3%',
|
||
containLabel: true
|
||
},
|
||
series: [{
|
||
data: data.value1,
|
||
type: 'bar',
|
||
showBackground: true,
|
||
backgroundStyle: {
|
||
//color: '#62AEDF'
|
||
}
|
||
}]
|
||
};
|
||
myChart.setOption(option);
|
||
myChart.resize();
|
||
}
|
||
});
|
||
}
|
||
|
||
/*
|
||
获取设备台账列表数据
|
||
*/
|
||
function tableType1(bizid, dateType, selectDate) {
|
||
var proId = $('#proId').val();
|
||
var levelId = $('#levelId').val();
|
||
var classId = $('#classId').val();
|
||
//获取div的高度
|
||
var hei = $(window).height();
|
||
var heightstr = (hei - 164) * 0.4;
|
||
$('#table1').bootstrapTable('destroy');
|
||
$("#table1").bootstrapTable({ // 对应table标签的id
|
||
url: ext.contextPath + '/equipment/getlist4Overview.do', // 获取表格数据的url
|
||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||
striped: true, //表格显示条纹,默认为false
|
||
pagination: true, // 在表格底部显示分页组件,默认false
|
||
pageList: [6], // 设置页面可以显示的数据条数
|
||
pageSize: 6, // 页面数据条数
|
||
pageNumber: 1, // 首页页码
|
||
height: heightstr,
|
||
sidePagination: 'server', // 设置为服务器端分页
|
||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||
return {
|
||
rows: params.limit, // 每页要显示的数据条数
|
||
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
|
||
sort: params.sort, // 要排序的字段
|
||
order: params.order,
|
||
unitId: bizid,
|
||
proId: proId,
|
||
levelId: levelId,
|
||
classId: classId
|
||
}
|
||
},
|
||
onClickRow: function (row) {//单击行事件,执行查看功能
|
||
viewFunEquipmentCard(row.id);
|
||
},
|
||
/*responseHandler: function(res){
|
||
return res.result
|
||
},*/
|
||
sortName: 'id', // 要排序的字段
|
||
sortOrder: 'desc', // 排序规则
|
||
|
||
//导出配置,使用需要单独引用js
|
||
//是否显示导出按钮
|
||
showExport: false,
|
||
//导出表格方式(默认basic:只导出当前页的表格数据;all:导出所有数据;selected:导出选中的数据)
|
||
exportDataType: "all",
|
||
//导出文件类型
|
||
exportTypes: ['excel'],
|
||
exportOptions: {
|
||
worksheetName: '工单列表', //表格工作区名称
|
||
fileName: '临时巡检工单'
|
||
},
|
||
//end
|
||
|
||
columns: [
|
||
{
|
||
field: 'equipmentcardid', // 返回json数据中的name
|
||
title: '设备编号', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
width: '25%',
|
||
formatter: function (value, row, index) {
|
||
return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.equipmentcardid + "'>" + row.equipmentcardid + "</span>";
|
||
}
|
||
}, {
|
||
field: 'id', // 返回json数据中的name
|
||
title: '设备名称', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
width: '25%',
|
||
formatter: function (value, row, index) {
|
||
return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.equipmentname + "'>" + row.equipmentname + "</span>";
|
||
}
|
||
}, {
|
||
field: 'id', // 返回json数据中的name
|
||
title: '无故障运行总台时', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
width: '25%',
|
||
formatter: function (value, row, index) {
|
||
return "-";
|
||
}
|
||
}, {
|
||
field: 'equipmentmanufacturer', // 返回json数据中的name
|
||
title: '设备厂商', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
width: '25%',
|
||
formatter: function (value, row, index) {
|
||
return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.equipmentmanufacturer + "'>" + row.equipmentmanufacturer + "</span>";
|
||
}
|
||
}
|
||
],
|
||
onLoadSuccess: function () { //加载成功时执行
|
||
adjustBootstrapTableView("table1");
|
||
},
|
||
onLoadError: function () { //加载失败时执行
|
||
console.info("加载数据失败");
|
||
}
|
||
});
|
||
}
|
||
|
||
function tableType2(bizid, dateType, selectDate) {
|
||
//获取div的高度
|
||
var hei = $(window).height();
|
||
var heightstr = (hei - 130) * 0.4;
|
||
|
||
$('#table1').bootstrapTable('destroy');
|
||
$("#table1").bootstrapTable({ // 对应table标签的id
|
||
url: ext.contextPath + '/timeEfficiency/patrolRecord/getList.do', // 获取表格数据的url
|
||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||
striped: true, //表格显示条纹,默认为false
|
||
pagination: true, // 在表格底部显示分页组件,默认false
|
||
pageList: [5], // 设置页面可以显示的数据条数
|
||
pageSize: 5, // 页面数据条数
|
||
pageNumber: 1, // 首页页码
|
||
height: heightstr,
|
||
sidePagination: 'server', // 设置为服务器端分页
|
||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||
return {
|
||
rows: params.limit, // 每页要显示的数据条数
|
||
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
|
||
sort: params.sort, // 要排序的字段
|
||
order: params.order,
|
||
unitId: bizid,
|
||
type: 'E'
|
||
}
|
||
},
|
||
onClickRow: function (row) {//单击行事件,执行查看功能
|
||
viewFunPatrolRecord(row.id);
|
||
},
|
||
/*responseHandler: function(res){
|
||
return res.result
|
||
},*/
|
||
sortName: 'id', // 要排序的字段
|
||
sortOrder: 'desc', // 排序规则
|
||
|
||
//导出配置,使用需要单独引用js
|
||
//是否显示导出按钮
|
||
showExport: false,
|
||
//导出表格方式(默认basic:只导出当前页的表格数据;all:导出所有数据;selected:导出选中的数据)
|
||
exportDataType: "all",
|
||
//导出文件类型
|
||
exportTypes: ['excel'],
|
||
exportOptions: {
|
||
worksheetName: '工单列表', //表格工作区名称
|
||
fileName: '临时巡检工单'
|
||
},
|
||
//end
|
||
|
||
columns: [
|
||
{
|
||
field: 'name', // 返回json数据中的name
|
||
title: '巡检名称', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
width: '25%',
|
||
formatter: function (value, row, index) {
|
||
return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.name + "'>" + row.name + "</span>";
|
||
}
|
||
}, {
|
||
field: 'content', // 返回json数据中的name
|
||
title: '巡检内容', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
width: '25%',
|
||
formatter: function (value, row, index) {
|
||
return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.content + "'>" + row.content + "</span>";
|
||
}
|
||
}, {
|
||
field: 'startTime', // 返回json数据中的name
|
||
title: '开始时间', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
width: '25%',
|
||
formatter: function (value, row, index) {
|
||
return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.startTime + "'>" + (row.startTime).substring(0, 16) + "</span>";
|
||
}
|
||
}, {
|
||
field: 'endTime', // 返回json数据中的name
|
||
title: '结束时间', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
width: '25%',
|
||
formatter: function (value, row, index) {
|
||
return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.endTime + "'>" + (row.endTime).substring(0, 16) + "</span>";
|
||
}
|
||
}
|
||
],
|
||
onLoadSuccess: function () { //加载成功时执行
|
||
adjustBootstrapTableView("table1");
|
||
},
|
||
onLoadError: function () { //加载失败时执行
|
||
console.info("加载数据失败");
|
||
}
|
||
});
|
||
}
|
||
|
||
function tableType3(bizid, dateType, selectDate) {
|
||
|
||
//获取div的高度
|
||
var hei = $(window).height();
|
||
var heightstr = (hei - 130) * 0.4;
|
||
|
||
$('#table2').bootstrapTable('destroy');
|
||
$("#table2").bootstrapTable({ // 对应table标签的id
|
||
url: ext.contextPath + '/maintenance/getList4Equipment.do', // 获取表格数据的url
|
||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||
striped: true, //表格显示条纹,默认为false
|
||
pagination: true, // 在表格底部显示分页组件,默认false
|
||
pageList: [5], // 设置页面可以显示的数据条数
|
||
pageSize: 5, // 页面数据条数
|
||
pageNumber: 1, // 首页页码
|
||
height: heightstr,
|
||
sidePagination: 'server', // 设置为服务器端分页
|
||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||
return {
|
||
rows: params.limit, // 每页要显示的数据条数
|
||
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
|
||
sort: params.sort, // 要排序的字段
|
||
order: params.order,
|
||
equipmentId: '',
|
||
unitId: unitId,
|
||
dateType: '',
|
||
selectDate: '',
|
||
type: '2'
|
||
}
|
||
},
|
||
onClickRow: function (row) {//单击行事件,执行查看功能
|
||
viewFunMaintain(row.id);
|
||
},
|
||
/*responseHandler: function(res){
|
||
return res.result
|
||
},*/
|
||
sortName: 'id', // 要排序的字段
|
||
sortOrder: 'desc', // 排序规则
|
||
|
||
//导出配置,使用需要单独引用js
|
||
//是否显示导出按钮
|
||
showExport: false,
|
||
//导出表格方式(默认basic:只导出当前页的表格数据;all:导出所有数据;selected:导出选中的数据)
|
||
exportDataType: "all",
|
||
//导出文件类型
|
||
exportTypes: ['excel'],
|
||
exportOptions: {
|
||
worksheetName: '工单列表', //表格工作区名称
|
||
fileName: '临时巡检工单'
|
||
},
|
||
//end
|
||
|
||
columns: [
|
||
{
|
||
field: 'name', // 返回json数据中的name
|
||
title: '故障编码', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
width: '30%',
|
||
formatter: function (value, row, index) {
|
||
return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.detailNumber + "'>" + row.detailNumber + "</span>";
|
||
}
|
||
}, {
|
||
field: 'name', // 返回json数据中的name
|
||
title: '故障名称', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
width: '25%',
|
||
formatter: function (value, row, index) {
|
||
return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.problemcontent + "'>" + row.problemcontent + "</span>";
|
||
}
|
||
}, {
|
||
field: 'startTime', // 返回json数据中的name
|
||
title: '设备', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
width: '30%',
|
||
formatter: function (value, row, index) {
|
||
if (row.equipmentCard != null && row.equipmentCard != '') {
|
||
return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.equipmentCard.equipmentname + "'>" + row.equipmentCard.equipmentname + "</span>";
|
||
} else {
|
||
return "-";
|
||
}
|
||
}
|
||
}
|
||
/*, {
|
||
field: 'worker', // 返回json数据中的name
|
||
title: '故障类型', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle',
|
||
width: '20%',
|
||
formatter: function (value, row, index) {
|
||
return "-";
|
||
}
|
||
}*/
|
||
, {
|
||
field: 'worker', // 返回json数据中的name
|
||
title: '状态', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle',
|
||
width: '15%',
|
||
formatter: function (value, row, index) {
|
||
switch (value) {
|
||
case '0' :
|
||
return '开始';
|
||
break;
|
||
case '1' :
|
||
return "完成";
|
||
break;
|
||
default :
|
||
return "待处理";
|
||
}
|
||
}
|
||
}
|
||
],
|
||
onLoadSuccess: function () { //加载成功时执行
|
||
adjustBootstrapTableView("table2");
|
||
},
|
||
onLoadError: function () { //加载失败时执行
|
||
console.info("加载数据失败");
|
||
}
|
||
});
|
||
}
|
||
|
||
/**
|
||
* 获取设备数量
|
||
* @param unitId
|
||
* @param type all获取所有的 use获取在用的
|
||
* @param spanId 需要赋值的divId
|
||
*/
|
||
function getEquNum(unitId, type, spanId) {
|
||
var proId = $('#proId').val();
|
||
var levelId = $('#levelId').val();
|
||
var classId = $('#classId').val();
|
||
$.ajax({
|
||
url: ext.contextPath + '/equipment/selectEquipmentNum.do', // 获取表格数据的url
|
||
async: true,
|
||
type: 'GET',
|
||
data: {
|
||
unitId: unitId,
|
||
type: type,
|
||
proId: proId,
|
||
levelId: levelId,
|
||
classId: classId
|
||
},
|
||
success: function (data) {
|
||
$('#' + spanId).html(data);
|
||
},
|
||
});
|
||
}
|
||
|
||
function getfindDATA(unitId, page_nub, spanId) {
|
||
$.ajax({
|
||
url: ext.contextPath + '/equipment/findDATA1.do', // 获取测量点数据的url
|
||
async: true,
|
||
data: {
|
||
bizId: unitId,
|
||
data_number: spanId,
|
||
page_nub: page_nub
|
||
|
||
},
|
||
success: function (data) {
|
||
$('#' + spanId).html(data);
|
||
},
|
||
});
|
||
}
|
||
|
||
var formdates = []
|
||
|
||
function initializeCalendar() {
|
||
$.post(ext.contextPath + "/workorder/workorderDetail/getGList.do", {
|
||
rows: 0,
|
||
page: 1,
|
||
unitId,
|
||
type: "repair",
|
||
}, function (data) {
|
||
var res = eval('(' + data + ')');
|
||
var i = 0;
|
||
console.log("res is 2 ", res)
|
||
res.forEach(e => {
|
||
formdates[i] = e.insdt.substring(0, 10)
|
||
i++;
|
||
})
|
||
//初始化日历
|
||
$('#sandbox-container').datepicker({
|
||
language: "zh-CN",
|
||
CustomFormat: 'yyyy-MM-dd HH:mm:ss',
|
||
beforeShow: checkday,
|
||
beforeShowDay: daytest,
|
||
todayHighlight: false
|
||
// }).on('changeDate', gotoDate).on('changeMonth', gotoMonth).on('changeMonth', gotoYear);
|
||
}).on('changeDate', gotoDate);
|
||
})
|
||
}
|
||
|
||
function checkday(input) {
|
||
// alert('1');
|
||
}
|
||
|
||
//日历每个日期加载方法
|
||
function daytest(date) {
|
||
var d = date;
|
||
var curr_date = d.getDate();
|
||
if (curr_date < 10) {
|
||
curr_date = '0' + curr_date;
|
||
}
|
||
var curr_month = d.getMonth() + 1;
|
||
if (curr_month < 10) {
|
||
curr_month = '0' + curr_month;
|
||
}
|
||
var curr_year = d.getFullYear();
|
||
var formatDate = curr_year + "-" + curr_month + "-" + curr_date;
|
||
for (var i = 0; i < formdates.length; i++) {
|
||
if (formatDate === formdates[i]) {
|
||
return {classes: 'markedDay', onclick: 'getXq()w'};
|
||
}
|
||
}
|
||
/*if($.inArray(formatDate,dateArrExam)!=-1 && $.inArray(formatDate,dateArrCourseware)==-1){
|
||
return {classes:'iconfont icon-yuandianxiao color-red'};
|
||
}
|
||
if($.inArray(formatDate,dateArrExam)==-1 && $.inArray(formatDate,dateArrCourseware)!=-1){
|
||
return {classes:'iconfont icon-yuandianxiao color-green'};
|
||
}
|
||
if($.inArray(formatDate,dateArrExam)!=-1 && $.inArray(formatDate,dateArrCourseware)!=-1){
|
||
return {classes:'iconfont icon-yuandianxiao color-yellow'};
|
||
}*/
|
||
}
|
||
|
||
|
||
//切换天
|
||
function gotoDate(ev) {
|
||
var year = ev.date.getFullYear().toString();
|
||
var month = (ev.date.getMonth() + 1).toString();
|
||
var day = ev.date.getDate().toString();
|
||
var dateStr = year + '-' + month + '-' + day;
|
||
/*console.log("datastr is", dateStr)
|
||
$.post(ext.contextPath + "/workorder/workorderDetail/showList4Date.do", {
|
||
dateStr: dateStr,
|
||
type: 'repair'
|
||
}, function (data) {
|
||
console.log("data is 3 ", data);
|
||
$("#subDiv_workorder").html(data);
|
||
openModal('subModal4Date');
|
||
}, 'json');*/
|
||
|
||
$.post(ext.contextPath + '/workorder/workorderDetail/showList4Date.do', {dateStr: dateStr,type: 'repair'} , function(data) {
|
||
$("#subDiv_workorder").html(data);
|
||
openModal('subModal4Date');
|
||
});
|
||
|
||
}
|
||
|
||
//切换月
|
||
function gotoMonth(ev) {
|
||
//
|
||
}
|
||
|
||
//切换年
|
||
function gotoYear(ev) {
|
||
//
|
||
}
|
||
|
||
function viewEchartFun1(type) {
|
||
if (type == '0') {
|
||
echartColumnar1(unitId, 'TH_03_FIT040001D_FLOW_C', 'myChartsafe1');
|
||
//字体颜色
|
||
$("#viewEchartTable1").css("color", "#428ECB");
|
||
$("#viewEchartTable2").css("color", "#838393");
|
||
$("#viewEchartTable3").css("color", "#838393");
|
||
}
|
||
if (type == '1') {
|
||
echartColumnar1(unitId, 'TH_03_FIT040001D_FLOW_C', 'myChartsafe1');
|
||
//字体颜色
|
||
$("#viewEchartTable1").css("color", "#838393");
|
||
$("#viewEchartTable2").css("color", "#428ECB");
|
||
$("#viewEchartTable3").css("color", "#838393");
|
||
}
|
||
if (type == '2') {
|
||
echartColumnar1(unitId, 'TH_03_FIT040001D_FLOW_C', 'myChartsafe1');
|
||
//字体颜色
|
||
$("#viewEchartTable1").css("color", "#838393");
|
||
$("#viewEchartTable2").css("color", "#838393");
|
||
$("#viewEchartTable3").css("color", "#428ECB");
|
||
}
|
||
}
|
||
|
||
function viewTableFun1(type) {
|
||
if (type == '0') {
|
||
tableType1(unitId, '0', current());
|
||
//字体颜色
|
||
$("#viewTable1").css("color", "#428ECB");
|
||
$("#viewTable2").css("color", "#838393");
|
||
}
|
||
if (type == '1') {
|
||
tableType2(unitId, '0', current());
|
||
//字体颜色
|
||
$("#viewTable2").css("color", "#428ECB");
|
||
$("#viewTable1").css("color", "#838393");
|
||
}
|
||
}
|
||
|
||
/*
|
||
点击查看设备卡片详情
|
||
*/
|
||
var viewFunEquipmentCard = function (id) {
|
||
$.post(ext.contextPath + '/equipment/doview.do', {id: id}, function (data) {
|
||
$("#subDiv").html(data);
|
||
openModal('subModal');
|
||
});
|
||
};
|
||
|
||
/*
|
||
点击查看设备巡检详情
|
||
*/
|
||
var viewFunPatrolRecord = function (id) {
|
||
$.post(ext.contextPath + '/timeEfficiency/patrolRecord/view_Equipment.do', {id: id}, function (data) {
|
||
$("#subDiv").html(data);
|
||
openModal('subModal');
|
||
});
|
||
};
|
||
|
||
/*
|
||
点击查看设备巡检详情
|
||
*/
|
||
var viewFunMaintain = function (id) {
|
||
$.post(ext.contextPath + '/maintenance/viewMaintain.do', {id: id}, function (data) {
|
||
$("#subDiv").html(data);
|
||
openModal('subRepairModal');
|
||
});
|
||
};
|
||
|
||
/*
|
||
获取工艺段数据
|
||
*/
|
||
function getProcessSection(unitId) {
|
||
$.post(ext.contextPath + "/user/processSection/getlist.do", {unitId: unitId}, function (data) {
|
||
var str = '';
|
||
var num = 6;
|
||
if (data.total < 6) {
|
||
num = data.total;
|
||
}
|
||
for (var i = 0; i < num; i++) {
|
||
str += '<div style="width:16%;height:100%;float:left;color:#838393;cursor:pointer;" id="pro' + i + '" onclick="choseProcess(\'pro' + i + '\',\'' + data.rows[i].id + '\');">' + data.rows[i].sname + '</div>';
|
||
}
|
||
$('#process').html(str);
|
||
}, 'json');
|
||
}
|
||
|
||
/*
|
||
点击工艺段
|
||
*/
|
||
function choseProcess(divId, id) {
|
||
//先将其余颜色样式恢复
|
||
for (var i = 0; i < 6; i++) {
|
||
$('#pro' + i).css('color', '#838393');
|
||
$('#pro' + i).css('font-weight', 'normal');
|
||
}
|
||
if (divId == 'proAll') {
|
||
//改变 不限 按钮的样式
|
||
document.getElementById('proAll').className = 'btn btn-success btn-xs';
|
||
} else {
|
||
//改变 不限 按钮的样式
|
||
document.getElementById('proAll').className = '';
|
||
//修改点击颜色及样式
|
||
$('#' + divId).css('color', 'red');
|
||
$('#' + divId).css('font-weight', 'bold');
|
||
}
|
||
$('#proId').val(id);
|
||
}
|
||
|
||
/*
|
||
获取重要等级 如 ABC
|
||
*/
|
||
function getLevel() {
|
||
var str = '';
|
||
str += '<div style="width:16%;height:100%;float:left;color:#838393;cursor:pointer;" id="A" onclick="choseLevel(\'A\');">关键</div>';
|
||
str += '<div style="width:16%;height:100%;float:left;color:#838393;cursor:pointer;" id="B" onclick="choseLevel(\'B\');">重要</div>';
|
||
str += '<div style="width:16%;height:100%;float:left;color:#838393;cursor:pointer;" id="C" onclick="choseLevel(\'C\');">普通</div>';
|
||
$('#level').html(str);
|
||
}
|
||
|
||
/*
|
||
点击重要等级
|
||
*/
|
||
function choseLevel(id) {
|
||
//先将其余颜色样式恢复
|
||
$('#A').css('color', '#838393');
|
||
$('#B').css('color', '#838393');
|
||
$('#C').css('color', '#838393');
|
||
$('#A').css('font-weight', 'normal');
|
||
$('#B').css('font-weight', 'normal');
|
||
$('#C').css('font-weight', 'normal');
|
||
|
||
if (id == 'levelAll') {
|
||
//改变 不限 按钮的样式
|
||
document.getElementById('levelAll').className = 'btn btn-success btn-xs';
|
||
} else {
|
||
//改变 不限 按钮的样式
|
||
document.getElementById('levelAll').className = '';
|
||
//修改点击颜色及样式
|
||
$('#' + id).css('color', 'red');
|
||
$('#' + id).css('font-weight', 'bold');
|
||
}
|
||
$('#levelId').val(id);
|
||
}
|
||
|
||
/*
|
||
获取设备类型数据
|
||
*/
|
||
function getEquipmentClass() {
|
||
$.post(ext.contextPath + "/equipment/equipmentClass/getIndexList.do", {}, function (data) {
|
||
var str = '';
|
||
for (var i = 0; i < 6; i++) {
|
||
if (data.result[i] != null && data.result[i] != 'undefined') {
|
||
str += '<div style="width:16%;height:100%;float:left;color:#838393;cursor:pointer;" id="equclass' + i + '" onclick="choseEquipmentClass(\'equclass' + i + '\',\'' + data.result[i].id + '\');">' + data.result[i].name + '</div>';
|
||
}
|
||
}
|
||
$('#equClass').html(str);
|
||
}, 'json');
|
||
}
|
||
|
||
/*
|
||
点击设备类型
|
||
*/
|
||
function choseEquipmentClass(divId, id) {
|
||
//先将其余颜色样式恢复
|
||
for (var i = 0; i < 6; i++) {
|
||
$('#equclass' + i).css('color', '#838393');
|
||
$('#equclass' + i).css('font-weight', 'normal');
|
||
}
|
||
if (divId == 'equclassAll') {
|
||
//改变 不限 按钮的样式
|
||
document.getElementById('equclassAll').className = 'btn btn-success btn-xs';
|
||
} else {
|
||
//改变 不限 按钮的样式
|
||
document.getElementById('equclassAll').className = '';
|
||
//修改点击颜色及样式
|
||
$('#' + divId).css('color', 'red');
|
||
$('#' + divId).css('font-weight', 'bold');
|
||
}
|
||
$('#classId').val(id);
|
||
}
|
||
|
||
function proPage(type) {
|
||
//获取当前页
|
||
var page = $('#proPage').val();
|
||
if (type == 'previous') {
|
||
if (page > 1) {
|
||
page = page - 1;
|
||
}
|
||
}
|
||
if (type == 'next') {
|
||
page = page - 0 + 1;
|
||
}
|
||
|
||
$.post(ext.contextPath + "/user/processSection/getIndexList.do", {page: page, unitId: unitId}, function (data) {
|
||
var str = '';
|
||
var num = 6;
|
||
if (data.total < 6) {
|
||
num = data.total;
|
||
}
|
||
for (var i = 0; i < num; i++) {
|
||
if (data.rows[i] != null && data.rows[i] != 'undefined') {
|
||
str += '<div style="width:16%;height:100%;float:left;color:#838393;cursor:pointer;" id="pro' + i + '" onclick="choseProcess(\'pro' + i + '\',\'' + data.rows[i].id + '\');">' + data.rows[i].sname + '</div>';
|
||
}
|
||
}
|
||
$('#process').html(str);
|
||
|
||
//分页后面没值 页数不叠加
|
||
if (page > Math.ceil(data.total / 6)) {
|
||
page = page - 1;
|
||
}
|
||
$('#proPage').val(page);
|
||
}, 'json');
|
||
}
|
||
|
||
function equclassPage(type) {
|
||
//获取当前页
|
||
var page = $('#classPage').val();
|
||
if (type == 'previous') {
|
||
if (page > 1) {
|
||
page = page - 1;
|
||
}
|
||
}
|
||
if (type == 'next') {
|
||
page = page - 0 + 1;
|
||
}
|
||
$.post(ext.contextPath + "/equipment/equipmentClass/getIndexList.do", {page: page}, function (data) {
|
||
var str = '';
|
||
for (var i = 0; i < 6; i++) {
|
||
if (data.result[i] != null && data.result[i] != 'undefined') {
|
||
str += '<div style="width:16%;height:100%;float:left;color:#838393;cursor:pointer;" id="equclass' + i + '" onclick="choseEquipmentClass(\'equclass' + i + '\',\'' + data.result[i].id + '\');">' + data.result[i].name + '</div>';
|
||
}
|
||
}
|
||
$('#equClass').html(str);
|
||
//分页后面没值 页数不叠加
|
||
if (page > Math.ceil(data.total / 6)) {
|
||
page = page - 1;
|
||
}
|
||
$('#classPage').val(page);
|
||
}, 'json');
|
||
}
|
||
|
||
function search() {
|
||
//获取所有设备数量
|
||
getEquNum(unitId, 'all', 'allNum');
|
||
//获取在用设备数量
|
||
getEquNum(unitId, 'use', 'useNum');
|
||
|
||
//加载设备台账列表
|
||
tableType1(unitId, '0', current());
|
||
//字体颜色
|
||
$("#viewTable1").css("color", "#428ECB");
|
||
$("#viewTable2").css("color", "#838393");
|
||
}
|
||
|
||
function current() {
|
||
var d = new Date(),
|
||
str = '';
|
||
str += d.getFullYear() + '-'; //获取当前年份
|
||
str += d.getMonth() + 1 + '-'; //获取当前月份(0——11)
|
||
str += d.getDate() + '';
|
||
// str += d.getHours() + ':';
|
||
// str += d.getMinutes() + ':';
|
||
// str += d.getSeconds() + '';
|
||
return str;
|
||
}
|
||
|
||
/**
|
||
* 获取KPI数据 -- (设备异常上报数)
|
||
* @param unitId
|
||
* @param type
|
||
* @param spanId
|
||
*/
|
||
function getKpiCount1(unitId, divId) {
|
||
$.ajax({
|
||
url: ext.contextPath + '/equipment/getAbnormityCount.do', // 获取表格数据的url
|
||
async: true,
|
||
data: {
|
||
unitId: unitId,
|
||
type: 'equipment'
|
||
},
|
||
success: function (data) {
|
||
var json = $.parseJSON(data);
|
||
$('#' + divId).html(json.result);
|
||
},
|
||
});
|
||
}
|
||
|
||
/**
|
||
* 获取KPI数据 -- (维修工单完成率)
|
||
* @param unitId
|
||
* @param type
|
||
* @param spanId
|
||
*/
|
||
function getKpiCount2(unitId, divId) {
|
||
$.ajax({
|
||
url: ext.contextPath + '/equipment/getWorkOrderCompletionRate.do', // 获取表格数据的url
|
||
async: true,
|
||
data: {
|
||
unitId: unitId,
|
||
type: 'repair'
|
||
},
|
||
success: function (data) {
|
||
var json = $.parseJSON(data);
|
||
$('#' + divId).html(json.result);
|
||
},
|
||
});
|
||
}
|
||
|
||
/**
|
||
* 获取KPI数据 -- (保养工单完成率)
|
||
* @param unitId
|
||
* @param type
|
||
* @param spanId
|
||
*/
|
||
function getKpiCount3(unitId, divId) {
|
||
$.ajax({
|
||
url: ext.contextPath + '/equipment/getWorkOrderCompletionRate.do', // 获取表格数据的url
|
||
async: true,
|
||
data: {
|
||
unitId: unitId,
|
||
type: 'maintain'
|
||
},
|
||
success: function (data) {
|
||
var json = $.parseJSON(data);
|
||
$('#' + divId).html(json.result);
|
||
},
|
||
});
|
||
}
|
||
|
||
/**
|
||
* 获取KPI数据 -- (设备完成率)
|
||
* @param unitId
|
||
* @param type
|
||
* @param spanId
|
||
*/
|
||
function getKpiCount4(unitId, divId) {
|
||
$.ajax({
|
||
url: ext.contextPath + '/equipment/getIntactRate.do', // 获取表格数据的url
|
||
async: true,
|
||
data: {
|
||
unitId: unitId,
|
||
levelType: '0'
|
||
},
|
||
success: function (data) {
|
||
var json = $.parseJSON(data);
|
||
$('#' + divId).html(json.result);
|
||
},
|
||
});
|
||
}
|
||
|