495 lines
23 KiB
Plaintext
495 lines
23 KiB
Plaintext
<%@ 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">
|
|
var imgDatas = [];
|
|
$(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 + "&rid=${param.rid}&view=0",
|
|
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 + "&rid=${param.rid}&view=0",
|
|
async: false,
|
|
globle: false,
|
|
error: function () {
|
|
return false;
|
|
},
|
|
success: function (data) {
|
|
html = html + data;
|
|
}
|
|
});
|
|
}
|
|
}
|
|
// console.log(html);
|
|
$('#show').html(html);
|
|
|
|
setTimeout(function () {
|
|
getechart();
|
|
}, 600);
|
|
|
|
}, 'json');
|
|
|
|
})
|
|
|
|
function getechart() {
|
|
$.ajax({
|
|
type: 'GET',
|
|
url: ext.contextPath + "/work/wordAnalysisReportStructure/getOutWordViewForCurveJson.do?pid=${param.pid}",
|
|
async: false,
|
|
globle: false,
|
|
error: function () {
|
|
return false;
|
|
},
|
|
success: function (maindata) {
|
|
var maindatas = eval('(' + maindata + ')');
|
|
var unitId = maindatas.unitId;
|
|
var ids = maindatas.ids;
|
|
var idcontents = ids.substring(0, ids.length - 1).split(",");
|
|
for (var i = 0; i < idcontents.length; i++) {
|
|
$.ajax({
|
|
type: 'GET',
|
|
url: ext.contextPath + "/work/wordAnalysisReportStructure/getOutWordViewContentForCurveDataJson.do?id=" + idcontents[i] + "&unitId=" + unitId + "&rid=${param.rid}&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 curvescaleSt = datas[10];
|
|
if (curvescaleSt == '') {
|
|
curvescaleSt = "false";
|
|
} else {
|
|
curvescaleSt = curvescaleSt[0];
|
|
}
|
|
var curvesMaxAndMinJson = datas[11];
|
|
let maxValue = curvesMaxAndMinJson[0];
|
|
let minValue = curvesMaxAndMinJson[1];
|
|
let curveinterval = curvesMaxAndMinJson[2];
|
|
|
|
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 = [];
|
|
var symbolSt = "none";
|
|
var symbolSize = "4";
|
|
if (legendshapeJson[i] == '' || legendshapeJson[i] == 'none') {
|
|
} else {
|
|
symbolSize = "8";
|
|
symbol = legendshapeJson[i];
|
|
}
|
|
var itemStyle = [];
|
|
var markPoint = [];
|
|
var markLine = [];
|
|
if (seriesTypeJson[0] == "bar") {
|
|
itemStyle = ({
|
|
normal: {
|
|
label: {
|
|
show: true, //开启显示
|
|
position: 'top', //在上方显示
|
|
textStyle: { //数值样式
|
|
color: 'black',
|
|
fontSize: 16
|
|
}
|
|
}
|
|
}
|
|
})
|
|
} else if (seriesTypeJson[0] == "line") {
|
|
// markPoint = ({
|
|
// symbolSize: '30',
|
|
// data: [
|
|
// {type: 'max', name: 'Max'},
|
|
// {type: 'min', name: 'Min'}
|
|
// ]
|
|
// })
|
|
// markLine = ({
|
|
// data: [{type: 'average', name: 'Avg'}]
|
|
// })
|
|
}
|
|
|
|
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
|
|
},
|
|
scale: eval(curvescaleSt.toLowerCase())
|
|
})
|
|
|
|
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++) {
|
|
if (xDataJson[i] == '') {
|
|
series.push({
|
|
name: legendJson[i],
|
|
symbol: symbolSt, //去掉折线图中的节点
|
|
smooth: true,
|
|
symbolSize: symbolSize,
|
|
type: seriesTypeJson[i],
|
|
data: seriesDataJson[i],
|
|
yAxisIndex: axisD[i],
|
|
itemStyle: itemStyle
|
|
})
|
|
} else {
|
|
series.push({
|
|
name: legendJson[i],
|
|
symbol: symbolSt, //去掉折线图中的节点
|
|
smooth: true,
|
|
symbolSize: symbolSize,
|
|
type: seriesTypeJson[i],
|
|
data: seriesDataJson[i],
|
|
yAxisIndex: axisD[i],
|
|
itemStyle: itemStyle,
|
|
markPoint: markPoint,
|
|
markLine: markLine
|
|
})
|
|
}
|
|
}
|
|
} else {
|
|
yAxis.push({
|
|
type: 'value',
|
|
name: unitD,
|
|
splitLine: {
|
|
show: false
|
|
},
|
|
scale: eval(curvescaleSt.toLowerCase())
|
|
})
|
|
|
|
if (maxValue != '-') {
|
|
yAxis[0].max = Number(maxValue);
|
|
}
|
|
if (minValue != '-') {
|
|
yAxis[0].min = Number(minValue);
|
|
}
|
|
if (curveinterval != '-') {
|
|
yAxis[0].interval = Number(curveinterval);
|
|
}
|
|
for (var i = 0; i < seriesTypeJson.length; i++) {
|
|
if (xDataJson[i] == '') {
|
|
series.push({
|
|
name: legendJson[i],
|
|
symbol: symbolSt, //去掉折线图中的节点
|
|
smooth: true,
|
|
symbolSize: symbolSize,
|
|
type: seriesTypeJson[i],
|
|
data: seriesDataJson[i],
|
|
itemStyle: itemStyle
|
|
})
|
|
} else {
|
|
series.push({
|
|
name: legendJson[i],
|
|
symbol: symbolSt, //去掉折线图中的节点
|
|
smooth: true,
|
|
symbolSize: symbolSize,
|
|
type: seriesTypeJson[i],
|
|
data: seriesDataJson[i],
|
|
itemStyle: itemStyle,
|
|
markPoint: markPoint,
|
|
markLine: markLine
|
|
})
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
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
|
|
};
|
|
// console.log(option);
|
|
mychart.setOption(option, true);
|
|
}
|
|
|
|
var img = mychart.getDataURL();
|
|
|
|
var imgString = '{ "id": "' + id + '", "img": ' + JSON.stringify(img) + ' }';
|
|
var imgjson = eval('(' + imgString + ')');
|
|
imgDatas.push(imgjson);
|
|
|
|
|
|
}
|
|
});
|
|
}
|
|
|
|
if ('${param.addst}' != '') {
|
|
outWord();
|
|
}
|
|
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
|
|
function doWordViewClose() {
|
|
closeModal('wordViewSubModal');
|
|
}
|
|
|
|
function outWord() {
|
|
$.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();
|
|
// console.log(imgDatas);
|
|
if (imgDatas != '' && imgDatas.length > 0) {
|
|
for (let index = 0; index < imgDatas.length; index++) {
|
|
$.ajax({
|
|
url: ext.contextPath + "/work/wordAnalysisReportStructure/saveImage.do",
|
|
type: "POST",
|
|
contentType: "application/json;charset=UTF-8",
|
|
datatype: "JSON",
|
|
data: imgDatas[index].id + "," + JSON.stringify(imgDatas[index].img),
|
|
async: false,
|
|
success: function (data) {
|
|
}
|
|
});
|
|
// $.post(ext.contextPath + '/work/wordAnalysisReportStructure/saveImage.do',{id:imgDatas[index].id,img:imgDatas[index].img},function(data) {
|
|
|
|
// });
|
|
}
|
|
}
|
|
|
|
|
|
},
|
|
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 changeFormText(id) {
|
|
var value = $('#' + id + '').val();
|
|
$.post(ext.contextPath + '/work/wordAnalysisReportRecord/changeRecordFormText.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">×</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 class="modal-footer">
|
|
<button type="button" class="btn btn-default pull-left" data-dismiss="modal"
|
|
onclick="doWordViewClose()">关闭
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<!-- /.modal-content -->
|
|
</div>
|
|
<!-- /.modal-dialog -->
|
|
</div>
|