前端接口对接
This commit is contained in:
parent
275dbef757
commit
a14c4f4fe7
|
|
@ -0,0 +1,50 @@
|
|||
let layer,laypage,table,form,element;
|
||||
|
||||
layui.use(['element', 'layer', 'form', 'element','laypage'], function(){
|
||||
layer = layui.layer; //弹层
|
||||
element = layui.element; //分页
|
||||
laypage = layui.laypage; //分页
|
||||
table = layui.table; //表格
|
||||
form=layui.form;
|
||||
init()
|
||||
})
|
||||
//初始化云间公司
|
||||
function init(){
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: PATH_URL + '/homePageSelect/getSubCom', // 请求地址
|
||||
contentType: "application/json; charset=utf-8",
|
||||
async: false,
|
||||
data: {}, //获取提交的表单字段
|
||||
success: function (data) {
|
||||
if(data.code == 200){
|
||||
let html = '';
|
||||
let resultObj = data.data;
|
||||
|
||||
for (let i = 0; i < resultObj.length; i++) {
|
||||
html += `<option value="${resultObj[i].id}" style="color: #757575 !important;font-weight: 400 !important;">${resultObj[i].name}</option>`;
|
||||
}
|
||||
$("#subComId").html(html);
|
||||
}else{
|
||||
$("#subComId").html('<option value="">--无数据--</option>');
|
||||
}
|
||||
layui.form.render();
|
||||
|
||||
//下拉选监听
|
||||
form.on('select(yjSelect)', function(data){
|
||||
|
||||
|
||||
var iframe = $("#indexFrame")[0];
|
||||
var iframeWindow = iframe.contentWindow;
|
||||
|
||||
iframeWindow.initStation();
|
||||
iframeWindow.setData();
|
||||
});
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, e) {
|
||||
layer.msg('数据请求发生异常,请稍后重试', {icon: 16, scrollbar: false});
|
||||
top.layer.close(addLoadingMsg); //再执行关闭
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -6,247 +6,180 @@ layui.use(['element', 'layer', 'form', 'element','laypage'], function(){
|
|||
laypage = layui.laypage; //分页
|
||||
table = layui.table; //表格
|
||||
form=layui.form;
|
||||
var list = [{name:'111',personnelAvgUseRate:'30'},{name:'222',personnelAvgUseRate:'11'},{name:'333',personnelAvgUseRate:'45'}];
|
||||
// console.log(list)
|
||||
monthRateEcharts(list)
|
||||
getTableData()
|
||||
|
||||
|
||||
|
||||
$("#station>div").click(function(){
|
||||
$("#station>div").removeClass("stationClick");
|
||||
$(this).addClass("stationClick");
|
||||
|
||||
getTableData()
|
||||
monthRateEcharts(list)
|
||||
})
|
||||
initStation();
|
||||
|
||||
|
||||
setData("")
|
||||
})
|
||||
function setData(yjId){
|
||||
|
||||
var subComId = $(window.parent.document).find("select[id='subComId']").val();
|
||||
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: PATH_URL + '/lineProjectHomePage/getDataOverview',
|
||||
contentType: "application/json; charset=utf-8",
|
||||
data: JSON.stringify({"yjId": yjId, "subComId": subComId}),
|
||||
success: function (data) {
|
||||
console.log("asdxzc:", data)
|
||||
var dataOverview = data.dataOverview;
|
||||
//线路总数
|
||||
$("#proNum").text(dataOverview.proNum);
|
||||
//护线员人数
|
||||
$("#workerNum").text(dataOverview.workerNum);
|
||||
//杆塔总数
|
||||
$("#towerNum").text(dataOverview.towerNum);
|
||||
//本月已巡视
|
||||
$("#makeNum").text(dataOverview.makeNum);
|
||||
//本月未巡视
|
||||
$("#notMakeNum").text(dataOverview.notMakeNum);
|
||||
//本月特巡天数
|
||||
$("#specialDayNum").text(dataOverview.specialDayNum);
|
||||
|
||||
|
||||
|
||||
//处理一下数据,将数据与右下角的表格列一一对应
|
||||
var value = data.proDataOverview;
|
||||
var arr = []
|
||||
for (var i = 0; i < value.length; i++) {
|
||||
var json = {
|
||||
index: i + 1,
|
||||
lineProName: value[i].lineProName,
|
||||
towerNum: value[i].towerNum,
|
||||
makeNum: value[i].makeNum,
|
||||
notMakeNum: value[i].notMakeNum,
|
||||
workerNum: value[i].workerNum,
|
||||
makeWorkerNum: value[i].makeWorkerNum,
|
||||
arrivalRate: value[i].arrivalRate,
|
||||
}
|
||||
arr.push(json);
|
||||
}
|
||||
//表格数据赋值
|
||||
getTableData(arr);
|
||||
|
||||
//echart图数据赋值
|
||||
monthRateEcharts(data.dataOverview)
|
||||
},
|
||||
error: function (xhr, textStatus, errorThrown) {
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
function getTableData(){
|
||||
// $.ajax({
|
||||
// type: 'post',
|
||||
// url: oiPlanUrl + '/dayPlanStatistics/getPersonnelUtilizationRate',
|
||||
// data: {
|
||||
// companyId: companyId,
|
||||
// month: $("#workTime").val(),
|
||||
// },
|
||||
// success: function (data) {
|
||||
let data = {
|
||||
code:200,
|
||||
data:[
|
||||
{ index:1,
|
||||
project:"工程xxxxx",
|
||||
gmNum:"10",
|
||||
viewNum:"11",
|
||||
unViewNum:"12",
|
||||
peopleNum:"13",
|
||||
viewPeople:"14",
|
||||
rate:"88.3%"
|
||||
},
|
||||
{ index:2,
|
||||
project:"工程xxxxx",
|
||||
gmNum:"10",
|
||||
viewNum:"11",
|
||||
unViewNum:"12",
|
||||
peopleNum:"13",
|
||||
viewPeople:"14",
|
||||
rate:"88.3%"
|
||||
},
|
||||
{ index:3,
|
||||
project:"工程xxxxx",
|
||||
gmNum:"10",
|
||||
viewNum:"11",
|
||||
unViewNum:"12",
|
||||
peopleNum:"13",
|
||||
viewPeople:"14",
|
||||
rate:"88.3%"
|
||||
},
|
||||
{ index:4,
|
||||
project:"工程xxxxx",
|
||||
gmNum:"10",
|
||||
viewNum:"11",
|
||||
unViewNum:"12",
|
||||
peopleNum:"13",
|
||||
viewPeople:"14",
|
||||
rate:"88.3%"
|
||||
},
|
||||
{ index:5,
|
||||
project:"工程xxxxx",
|
||||
gmNum:"10",
|
||||
viewNum:"11",
|
||||
unViewNum:"12",
|
||||
peopleNum:"13",
|
||||
viewPeople:"14",
|
||||
rate:"88.3%"
|
||||
},
|
||||
{ index:6,
|
||||
project:"工程xxxxx",
|
||||
gmNum:"10",
|
||||
viewNum:"11",
|
||||
unViewNum:"12",
|
||||
peopleNum:"13",
|
||||
viewPeople:"14",
|
||||
rate:"88.3%"
|
||||
},
|
||||
{ index:7,
|
||||
project:"工程xxxxx",
|
||||
gmNum:"10",
|
||||
viewNum:"11",
|
||||
unViewNum:"12",
|
||||
peopleNum:"13",
|
||||
viewPeople:"14",
|
||||
rate:"88.3%"
|
||||
},
|
||||
{ index:8,
|
||||
project:"工程xxxxx",
|
||||
gmNum:"10",
|
||||
viewNum:"11",
|
||||
unViewNum:"12",
|
||||
peopleNum:"13",
|
||||
viewPeople:"14",
|
||||
rate:"88.3%"
|
||||
},
|
||||
{ index:9,
|
||||
project:"工程xxxxx",
|
||||
gmNum:"10",
|
||||
viewNum:"11",
|
||||
unViewNum:"12",
|
||||
peopleNum:"13",
|
||||
viewPeople:"14",
|
||||
rate:"88.3%"
|
||||
},
|
||||
{ index:10,
|
||||
project:"工程xxxxx",
|
||||
gmNum:"10",
|
||||
viewNum:"11",
|
||||
unViewNum:"12",
|
||||
peopleNum:"13",
|
||||
viewPeople:"14",
|
||||
rate:"88.3%"
|
||||
},
|
||||
{ index:11,
|
||||
project:"工程xxxxx",
|
||||
gmNum:"10",
|
||||
viewNum:"11",
|
||||
unViewNum:"12",
|
||||
peopleNum:"13",
|
||||
viewPeople:"14",
|
||||
rate:"88.3%"
|
||||
},
|
||||
{ index:12,
|
||||
project:"工程xxxxx",
|
||||
gmNum:"10",
|
||||
viewNum:"11",
|
||||
unViewNum:"12",
|
||||
peopleNum:"13",
|
||||
viewPeople:"14",
|
||||
rate:"88.3%"
|
||||
},
|
||||
{ index:13,
|
||||
project:"工程xxxxx",
|
||||
gmNum:"10",
|
||||
viewNum:"11",
|
||||
unViewNum:"12",
|
||||
peopleNum:"13",
|
||||
viewPeople:"14",
|
||||
rate:"88.3%"
|
||||
},
|
||||
{ index:14,
|
||||
project:"工程xxxxx",
|
||||
gmNum:"10",
|
||||
viewNum:"11",
|
||||
unViewNum:"12",
|
||||
peopleNum:"13",
|
||||
viewPeople:"14",
|
||||
rate:"88.3%"
|
||||
},
|
||||
{ index:15,
|
||||
project:"工程xxxxx",
|
||||
gmNum:"10",
|
||||
viewNum:"11",
|
||||
unViewNum:"12",
|
||||
peopleNum:"13",
|
||||
viewPeople:"14",
|
||||
rate:"88.3%"
|
||||
},
|
||||
{ index:16,
|
||||
project:"工程xxxxx",
|
||||
gmNum:"10",
|
||||
viewNum:"11",
|
||||
unViewNum:"12",
|
||||
peopleNum:"13",
|
||||
viewPeople:"14",
|
||||
rate:"88.3%"
|
||||
}
|
||||
]
|
||||
|
||||
}
|
||||
intervalId = "";
|
||||
var html ="";
|
||||
$("#personnelTable thead tr").empty();
|
||||
$("#personnelTable tbody").empty();
|
||||
if (data.code == 200) {
|
||||
var list = data.data;
|
||||
if(list.length>0){
|
||||
html+= '<th width="10%">序号</th>';
|
||||
html+= '<th width="12%">工程名称</th>';
|
||||
html+= '<th width="12%">杆塔数量</th>';
|
||||
html+= '<th width="12%">已巡数量</th>';
|
||||
html+= '<th width="12%">未巡数量</th>';
|
||||
html+= '<th width="12%">护线员人数</th>';
|
||||
html+= '<th width="12%">已巡视人数</th>';
|
||||
html+= '<th width="12%">到位率</th>';
|
||||
// for (let i = 0; i < list[0].length; i++) {
|
||||
// html+= '<th title="'+list[0][i].name+'">'+list[0][i].name+'</th>';
|
||||
// }
|
||||
$("#personnelTable thead tr").append(html);
|
||||
var echartArr = [];
|
||||
for (let k = 0; k < list.length; k++) {
|
||||
var obj = {};
|
||||
obj = list[k]
|
||||
// obj.data = list[k][0].date;
|
||||
// for (let i = 0; i < l; i++) {
|
||||
// obj['personnelAvgUseRate' + i] = Number(list[k][i].personnelAvgUseRate * 100).toFixed(2)+"%";
|
||||
// }
|
||||
echartArr.push(obj);
|
||||
}
|
||||
var tbody = $('#personnelTable tbody');
|
||||
echartArr.forEach(function(item) {
|
||||
// console.log(item)
|
||||
|
||||
// console.log(Object.values(item))
|
||||
var row = $('<tr>');
|
||||
Object.values(item).forEach(function(value) {
|
||||
// console.log(value)
|
||||
var cell = $('<td>').text(value);
|
||||
row.append(cell);
|
||||
});
|
||||
tbody.append(row);
|
||||
});
|
||||
}
|
||||
clearInterval(intervalId);
|
||||
// monveinout();
|
||||
console.log("ddddd");
|
||||
$("#personnelRate").unbind()
|
||||
$("#personnelRate").hover(function(){
|
||||
clearInterval(intervalId);
|
||||
},function(){
|
||||
intervalId = setInterval(scrolldiv, 40);
|
||||
});
|
||||
// 开始滚动
|
||||
scrollableDiv = $('.scrollable'); // 假设你的滚动容器类名为.scrollable
|
||||
totalHeight = scrollableDiv[0].scrollHeight;
|
||||
visibleHeight = scrollableDiv.innerHeight();
|
||||
currentScrollTop = 0;
|
||||
intervalId = setInterval(scrolldiv, 40); // 这个数字是滚动间隔的时间,单位是毫秒
|
||||
// 如果需要停止滚动,可以使用以下代码
|
||||
// clearInterval(intervalId);
|
||||
}else{
|
||||
|
||||
}
|
||||
// },
|
||||
// error: function (xhr, textStatus, errorThrown) {
|
||||
// }
|
||||
// });
|
||||
|
||||
//初始化运检站
|
||||
function initStation(){
|
||||
var subComId = $(window.parent.document).find("select[id='subComId']").val();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: PATH_URL + '/homePageSelect/getYjById', // 请求地址
|
||||
contentType: "application/json; charset=utf-8",
|
||||
data: JSON.stringify({'id': subComId}),
|
||||
success: function (data) {
|
||||
var html = `<div class="stationClick">全部</div>`;
|
||||
if(data.length > 0){
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
html += `<div value="${ data[i].id }">${ data[i].title }</div>`;
|
||||
}
|
||||
}else{
|
||||
}
|
||||
$("#station").empty();
|
||||
$("#station").html(html);
|
||||
|
||||
|
||||
|
||||
|
||||
$("#station>div").click(function(){
|
||||
$("#station>div").removeClass("stationClick");
|
||||
$(this).addClass("stationClick");
|
||||
|
||||
var id = $(this).attr("value");
|
||||
setData(id)
|
||||
})
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, e) {
|
||||
layer.msg('数据请求发生异常,请稍后重试', {icon: 16, scrollbar: false});
|
||||
top.layer.close(addLoadingMsg); //再执行关闭
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getTableData(list){
|
||||
let data = {
|
||||
code:200,
|
||||
data: list
|
||||
|
||||
}
|
||||
intervalId = "";
|
||||
var html ="";
|
||||
$("#personnelTable thead tr").empty();
|
||||
$("#personnelTable tbody").empty();
|
||||
if (data.code == 200) {
|
||||
var list = data.data;
|
||||
if(list.length>0){
|
||||
html+= '<th width="10%">序号</th>';
|
||||
html+= '<th width="12%">工程名称</th>';
|
||||
html+= '<th width="12%">杆塔数量</th>';
|
||||
html+= '<th width="12%">已巡数量</th>';
|
||||
html+= '<th width="12%">未巡数量</th>';
|
||||
html+= '<th width="12%">护线员人数</th>';
|
||||
html+= '<th width="12%">已巡视人数</th>';
|
||||
html+= '<th width="12%">到位率</th>';
|
||||
// for (let i = 0; i < list[0].length; i++) {
|
||||
// html+= '<th title="'+list[0][i].name+'">'+list[0][i].name+'</th>';
|
||||
// }
|
||||
$("#personnelTable thead tr").append(html);
|
||||
var echartArr = [];
|
||||
for (let k = 0; k < list.length; k++) {
|
||||
var obj = {};
|
||||
obj = list[k]
|
||||
// obj.data = list[k][0].date;
|
||||
// for (let i = 0; i < l; i++) {
|
||||
// obj['personnelAvgUseRate' + i] = Number(list[k][i].personnelAvgUseRate * 100).toFixed(2)+"%";
|
||||
// }
|
||||
echartArr.push(obj);
|
||||
}
|
||||
var tbody = $('#personnelTable tbody');
|
||||
echartArr.forEach(function(item) {
|
||||
// console.log(item)
|
||||
|
||||
// console.log(Object.values(item))
|
||||
var row = $('<tr>');
|
||||
Object.values(item).forEach(function(value) {
|
||||
// console.log(value)
|
||||
var cell = $('<td>').text(value);
|
||||
row.append(cell);
|
||||
});
|
||||
tbody.append(row);
|
||||
});
|
||||
}
|
||||
clearInterval(intervalId);
|
||||
// monveinout();
|
||||
console.log("ddddd");
|
||||
$("#personnelRate").unbind()
|
||||
$("#personnelRate").hover(function(){
|
||||
clearInterval(intervalId);
|
||||
},function(){
|
||||
intervalId = setInterval(scrolldiv, 40);
|
||||
});
|
||||
// 开始滚动
|
||||
scrollableDiv = $('.scrollable'); // 假设你的滚动容器类名为.scrollable
|
||||
totalHeight = scrollableDiv[0].scrollHeight;
|
||||
visibleHeight = scrollableDiv.innerHeight();
|
||||
currentScrollTop = 0;
|
||||
intervalId = setInterval(scrolldiv, 40); // 这个数字是滚动间隔的时间,单位是毫秒
|
||||
// 如果需要停止滚动,可以使用以下代码
|
||||
// clearInterval(intervalId);
|
||||
}else{
|
||||
|
||||
}
|
||||
}
|
||||
function monveinout(){
|
||||
const element = document.getElementById('personnelRate');
|
||||
|
|
@ -266,7 +199,7 @@ function monveinout(){
|
|||
});
|
||||
}
|
||||
var scrollableDiv = $('.scrollable'); // 假设你的滚动容器类名为.scrollable
|
||||
var totalHeight = scrollableDiv[0].scrollHeight;
|
||||
var totalHeight = $('.scrollable').scrollHeight;//scrollHeight;
|
||||
var visibleHeight = scrollableDiv.innerHeight();
|
||||
var currentScrollTop = 0;
|
||||
function scrolldiv() {
|
||||
|
|
@ -282,15 +215,15 @@ function scrolldiv() {
|
|||
}
|
||||
|
||||
//图表
|
||||
function monthRateEcharts(list) {
|
||||
console.log('monthRateEcharts')
|
||||
function monthRateEcharts(data) {
|
||||
console.log('monthRateEcharts2', data)
|
||||
//先销毁
|
||||
echarts.init(document.getElementById("monthRate")).dispose();
|
||||
var myChart = echarts.init(document.getElementById("monthRate"));
|
||||
|
||||
var value = 0.6;//百分比
|
||||
var value1 = 1100//已巡杆塔数
|
||||
var value2 = 1300//总杆塔数
|
||||
var value = data.arrivalRate;//百分比
|
||||
var value1 = data.makeNum//已巡杆塔数
|
||||
var value2 = data.towerNum//总杆塔数
|
||||
var option = {
|
||||
backgroundColor: '#fff',
|
||||
title: [
|
||||
|
|
@ -334,7 +267,7 @@ function monthRateEcharts(list) {
|
|||
},
|
||||
},
|
||||
{
|
||||
text: (value * 100).toFixed(0),
|
||||
text: value,
|
||||
left: '47.5%',
|
||||
top: '40%',
|
||||
textAlign: 'center',
|
||||
|
|
@ -345,7 +278,6 @@ function monthRateEcharts(list) {
|
|||
},
|
||||
|
||||
{
|
||||
text:"%",
|
||||
left: '56%',
|
||||
top: '43%',
|
||||
textAlign: 'center',
|
||||
|
|
|
|||
|
|
@ -172,7 +172,6 @@ function getView(data){
|
|||
</div>`;
|
||||
}
|
||||
$("#specialViewBox").append(html3);
|
||||
debugger
|
||||
initTable(data.data.spDateList)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ function setData(){
|
|||
data: JSON.stringify({"yjId": yjId}),
|
||||
success: function (data) {
|
||||
console.log("data:", data)
|
||||
var dataOverview = data.dataOverview;
|
||||
var dataOverview = data.data.dataOverview;
|
||||
//线路总数
|
||||
$("#proNum").text(dataOverview.proNum);
|
||||
//护线员人数
|
||||
|
|
@ -39,7 +39,7 @@ function setData(){
|
|||
|
||||
|
||||
//处理一下数据,将数据与右下角的表格列一一对应
|
||||
var value = data.proDataOverview;
|
||||
var value = data.data.proDataOverview;
|
||||
var arr = []
|
||||
for (var i = 0; i < value.length; i++) {
|
||||
var json = {
|
||||
|
|
@ -58,7 +58,7 @@ function setData(){
|
|||
getTableData(arr);
|
||||
|
||||
//echart图数据赋值
|
||||
monthRateEcharts(data.dataOverview)
|
||||
monthRateEcharts(data.data.dataOverview)
|
||||
},
|
||||
error: function (xhr, textStatus, errorThrown) {
|
||||
}
|
||||
|
|
@ -172,7 +172,7 @@ function scrolldiv() {
|
|||
|
||||
//图表
|
||||
function monthRateEcharts(data) {
|
||||
console.log('monthRateEcharts')
|
||||
console.log('monthRateEcharts1',data)
|
||||
//先销毁
|
||||
echarts.init(document.getElementById("monthRate")).dispose();
|
||||
var myChart = echarts.init(document.getElementById("monthRate"));
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ function addData(formData) {
|
|||
contentType: "application/json; charset=utf-8",
|
||||
data: JSON.stringify(formData.field),
|
||||
success: function (data) {
|
||||
debugger
|
||||
layer.close(loadingMsg); // 关闭提示层
|
||||
if(data.code == 200){
|
||||
parent.layer.msg("添加成功", { icon: 1 });
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ function updData(formData) {
|
|||
// 加载提示
|
||||
let loadingMsg = layer.msg('数据上传中,请稍候...', {icon: 16, scrollbar: false, time: 0, shade: [0.8, '#393D49']});
|
||||
|
||||
debugger
|
||||
formData.field.gtId = parentData[0].gtId;
|
||||
formData.field.proId = parentProId;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue