Files
SIPAIIS_WMS_JSSW/WebRoot/jsp/work/wordAnalysisReportOutStructureView.jsp

360 lines
16 KiB
Plaintext
Raw Permalink Normal View History

2026-01-16 14:13:44 +08:00
<%@ page language="java" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@page import="com.sipai.entity.work.WordAnalysisReportStructure" %>
<% request.setAttribute("Type_word", WordAnalysisReportStructure.Type_word);%>
<% request.setAttribute("Type_title", WordAnalysisReportStructure.Type_title);%>
<% request.setAttribute("Type_paragraph", WordAnalysisReportStructure.Type_paragraph);%>
<script type="text/javascript">
$(function () {
var viweHight = $(document).height();
$('#main').css('heigth', viweHight);
$.post(ext.contextPath + '/work/wordAnalysisReportStructure/getOutWordViewJson.do', {pid: '${param.pid}'}, function (data) {
// console.log(data);
var html = "";
var contents = data[0].nodes;
for (var i = 0; i < contents.length; i++) {
if (contents[i].type == '${Type_title}') {
$.ajax({
type: 'GET',
url: ext.contextPath + "/work/wordAnalysisReportStructure/getOutWordViewContentJson.do?id=" + contents[i].id,
async: false,
globle: false,
error: function () {
return false;
},
success: function (data) {
html = html + data;
}
});
} else if (contents[i].type == '${Type_paragraph}') {
$.ajax({
type: 'GET',
url: ext.contextPath + "/work/wordAnalysisReportStructure/getOutWordViewContentJson.do?id=" + contents[i].id,
async: false,
globle: false,
error: function () {
return false;
},
success: function (data) {
console.log(data)
html = html + data;
}
});
}
}
// console.log(html);
$('#show').html(html);
setTimeout(function () {
getechart();
}, 600);
}, 'json');
})
function getechart() {
$.post(ext.contextPath + '/work/wordAnalysisReportStructure/getOutWordViewForCurveJson.do', {pid: '${param.pid}'}, function (data) {
// console.log(data.unitId);
// console.log(data.ids);
var unitId = data.unitId;
var ids = data.ids;
var idcontents = ids.substring(0, ids.length - 1).split(",");
if (ids != '') {
for (var i = 0; i < idcontents.length; i++) {
$.ajax({
type: 'GET',
url: ext.contextPath + "/work/wordAnalysisReportStructure/getOutWordViewContentForCurveDataJson.do?id=" + idcontents[i] + "&unitId=" + unitId + "&worldId=${param.pid}",
async: false,
globle: false,
error: function () {
return false;
},
success: function (data) {
var datas = eval('(' + data + ')');
// console.log(datas);
var xDataJson = datas[0];
var seriesDataJson = datas[1];
var seriesTypeJson = datas[2];
var legendJson = datas[3];
var titleName = datas[4];
var id = datas[5];
var axis = datas[6];
var axisD = datas[7];
var unitD = datas[8];
var legendshapeJson = datas[9];
var series = [];
var mychart = echarts.init(document.getElementById('curve' + id));
if (seriesTypeJson[0] == 'pie') {
for (var i = 0; i < seriesTypeJson.length; i++) {
series.push({
name: legendJson[i],
value: seriesDataJson[i],
})
}
var option = {
animation: false,
color: [
"#2ec7c9",
"#b6a2de",
"#5ab1ef",
"#ffb980",
"#d87a80",
"#8d98b3",
"#e5cf0d",
"#97b552",
"#95706d",
"#dc69aa",
"#07a2a4",
"#9a7fd1",
"#588dd5",
"#f5994e",
"#c05050",
"#59678c",
"#c9ab00",
"#7eb00a",
"#6f5553",
"#c14089"
],
title: {
text: titleName,
left: 'center'
},
tooltip: {
trigger: 'item',
formatter: '{b} : {c} ' + unitD + ' ({d}%)'
},
legend: {
data: legendJson,
left: 10,
top: 20
},
series: {
type: 'pie',
data: series
}
};
mychart.setOption(option, true);
} else {
var yAxis = [];
if (axis != '' && axis.length > 0) {
for (var a = 0; a < axis.length; a++) {
yAxis.push({
type: 'value',
position: axis[a][1],
offset: axis[a][2],
name: axis[a][3],
axisLine: {
show: true
},
splitLine: {
show: false
}
})
if (axis[a][5] != null && axis[a][5] != '') {
yAxis[a].max = Number(axis[a][5]);
}
if (axis[a][6] != null && axis[a][6] != '') {
yAxis[a].min = Number(axis[a][6]);
}
if (axis[a][4] != null && axis[a][4] != '') {
yAxis[a].interval = Number(axis[a][4]);
}
}
for (var i = 0; i < seriesTypeJson.length; i++) {
series.push({
name: legendJson[i],
symbol: legendshapeJson[i],
symbolSize: '8',
type: seriesTypeJson[i],
data: seriesDataJson[i],
yAxisIndex: axisD[i],
// barWidth : 60,
// barCateGoryGap:50,
})
}
} else {
yAxis.push({
type: 'value',
name: unitD,
splitLine: {
show: false
}
})
for (var i = 0; i < seriesTypeJson.length; i++) {
series.push({
name: legendJson[i],
symbol: legendshapeJson[i],
symbolSize: '8',
type: seriesTypeJson[i],
data: seriesDataJson[i],
// barWidth : 60,
// barCateGoryGap:50,
})
}
}
var option = {
animation: false,
color: [
"#2ec7c9",
"#b6a2de",
"#5ab1ef",
"#ffb980",
"#d87a80",
"#8d98b3",
"#e5cf0d",
"#97b552",
"#95706d",
"#dc69aa",
"#07a2a4",
"#9a7fd1",
"#588dd5",
"#f5994e",
"#c05050",
"#59678c",
"#c9ab00",
"#7eb00a",
"#6f5553",
"#c14089"
],
title: {
text: titleName,
left: 'center'
},
tooltip: {
trigger: 'axis'
},
legend: {
data: legendJson,
left: 10,
top: 20
},
grid: {
left: '4%', // 与容器左侧的距离
right: '4%', // 与容器右侧的距离
top: 70, // 与容器顶部的距离
//bottom: '5%', // 与容器底部的距离
containLabel: true
},
xAxis: [{
type: 'category',
data: xDataJson[0],
splitLine: {
show: true
}
}],
yAxis: yAxis,
series: series
};
mychart.setOption(option, true);
}
// var img = new Image();
// img.src=mychart.getDataURL({
// pixeRatio:2,
// backgroundColor:'#fff'
// })
// var picBase64Info = mychart.getDataURL();
// console.log(picBase64Info);
// $.post(ext.contextPath + '/work/wordAnalysisReportStructure/saveImage.do',{id:id,img:picBase64Info},function(data) {
// });
}
});
}
}
}, 'json');
}
function doWordViewClose() {
closeModal('wordViewSubModal');
}
// function outWord(){
// // console.log(curveImg);
// $.ajax({
// type:'GET',
// url:ext.contextPath +"/work/wordAnalysisReportStructure/outWord.do?unitId="+unitId+"&pid=${param.pid}&rid=${param.rid}&wordName=${param.name}",
// async: true,
// beforeSend: function () {
// ShowDiv();
// },
// complete: function () {
// HiddenDiv();
// },
// globle:false,
// error: function(){
// return false;
// },
// success: function(data){
// if(data=='生成成功'){
// alert('生成成功');
// }else{
// alert('生成失败');
// }
// }
// });
// }
// function changeFormValue(id){
// var value=$('#'+id+'').val();
// $.post(ext.contextPath + '/work/wordAnalysisReportRecord/changeRecordFormValue.do',{id:id,value:value},function(data) {
// });
// }
// function changeTextValue(id){
// var value=$('#'+id+'').val();
// $.post(ext.contextPath + '/work/wordAnalysisReportRecord/changeRecordTextValue.do',{id:id,value:value},function(data) {
// });
// }
function ShowDiv() {
$("#loading").show();
}
//隐藏加载数据
function HiddenDiv() {
$("#loading").hide();
}
</script>
<div class="modal fade" id="wordViewSubModal">
<div class="modal-dialog modal-md" style="width:900px;">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" onclick="doWordViewClose()">
<span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">预览</h4>
</div>
<div id="loading" style="display: none;">正在加载数据,请稍候...</div>
<!-- 界面提醒div强制id为alertDiv -->
<div class="modal-footer">
<!-- <button type="button" class="btn btn-default pull-left" onclick="doWordViewClose()">关闭</button> -->
<!-- <button type="button" class="btn btn-primary pull-left" onclick="outWord();"><i class="fa fa-file-word-o"></i> 生成word</button> -->
</div>
<div id="main" class="modal-body" style="overflow: hidden;">
<div id="show" style="float: left;width: 100%;height: 100%;"></div>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>