提交 9a15ff17 编写于 作者: doc_wei's avatar doc_wei

统计后台接口完成

上级 e77a32b9
因为 它太大了无法显示 source diff 。你可以改为 查看blob
......@@ -416,4 +416,20 @@ public class DwSurveyDirectoryController {
dwSurveyDirectoryService.deleteSurveyMationById(inputObject, outputObject);
}
/**
*
* @Title: querySurveyFxMationById
* @Description: 分析报告问卷
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/DwSurveyDirectoryController/querySurveyFxMationById")
@ResponseBody
public void querySurveyFxMationById(InputObject inputObject, OutputObject outputObject) throws Exception{
dwSurveyDirectoryService.querySurveyFxMationById(inputObject, outputObject);
}
}
......@@ -132,4 +132,30 @@ public interface DwSurveyDirectoryDao {
public int deleteSurveyMationById(Map<String, Object> map) throws Exception;
public int editSurveyStateToReleaseById(Map<String, Object> map) throws Exception;
public List<Map<String, Object>> queryRadioGroupStat(Map<String, Object> question) throws Exception;
public List<Map<String, Object>> queryCheckBoxGroupStat(Map<String, Object> question) throws Exception;
public Map<String, Object> queryFillBlankGroupStat(Map<String, Object> question) throws Exception;
public Map<String, Object> queryAnswerGroupStat(Map<String, Object> question) throws Exception;
public List<Map<String, Object>> queryMultiFillBlankGroupStat(Map<String, Object> question) throws Exception;
public List<Map<String, Object>> queryEnumQuGroupStat(Map<String, Object> question) throws Exception;
public List<Map<String, Object>> queryChenRadioGroupStat(Map<String, Object> question) throws Exception;
public List<Map<String, Object>> queryChenFbkGroupStat(Map<String, Object> question) throws Exception;
public List<Map<String, Object>> queryChenCheckBoxGroupStat(Map<String, Object> question) throws Exception;
public List<Map<String, Object>> queryChenScoreGroupStat(Map<String, Object> question) throws Exception;
public List<Map<String, Object>> queryScoreGroupStat(Map<String, Object> question) throws Exception;
public List<Map<String, Object>> queryOrderQuGroupStat(Map<String, Object> question) throws Exception;
}
......@@ -55,4 +55,6 @@ public interface DwSurveyDirectoryService {
public void deleteSurveyMationById(InputObject inputObject, OutputObject outputObject) throws Exception;
public void querySurveyFxMationById(InputObject inputObject, OutputObject outputObject) throws Exception;
}
......@@ -1173,7 +1173,12 @@ public class DwSurveyDirectoryServiceImpl implements DwSurveyDirectoryService{
public void editSurveyStateToReleaseById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
Map<String, Object> surveyMation = dwSurveyDirectoryDao.querySurveyMationById(map);//获取问卷信息
if("0".equals(surveyMation.get("surveyState").toString())){//设计状态可以发布问卷
map.put("startTime", ToolUtil.getTimeAndToString());
dwSurveyDirectoryDao.editSurveyStateToReleaseById(map);
}else{
outputObject.setreturnMessage("该问卷已发布,请刷新数据。");
}
}
/**
......@@ -1223,5 +1228,193 @@ public class DwSurveyDirectoryServiceImpl implements DwSurveyDirectoryService{
Map<String, Object> map = inputObject.getParams();
dwSurveyDirectoryDao.deleteSurveyMationById(map);//删除问卷
}
/**
*
* @Title: querySurveyFxMationById
* @Description: 分析报告问卷
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void querySurveyFxMationById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
List<Map<String, Object>> questions = dwSurveyDirectoryDao.queryQuestionListByBelongId(map);//获取问卷中的题
for(Map<String, Object> question : questions){
question.put("quTypeName", QuType.getCName(Integer.parseInt(question.get("quType").toString())));
getQuestionOptionListMation(question);
getQuestionOptionReportListMation(question);
}
Map<String, Object> surveyMation = dwSurveyDirectoryDao.querySurveyMationById(map);//获取问卷信息
outputObject.setBean(surveyMation);
outputObject.setBeans(questions);
outputObject.settotal(1);
}
/**
*
* @Title: getQuestionOptionReportListMation
* @Description: 统计获取数量
* @param @param question
* @param @return
* @param @throws Exception 参数
* @return Map<String,Object> 返回类型
* @throws
*/
@SuppressWarnings("unchecked")
public Map<String, Object> getQuestionOptionReportListMation(Map<String, Object> question) throws Exception {
String quType = QuType.getActionName(Integer.parseInt(question.get("quType").toString()));//获取题目类型
if (quType.equals(QuType.RADIO.getActionName()) || quType.equals(QuType.COMPRADIO.getActionName())) {//单选 复合单选
List<Map<String, Object>> beans = dwSurveyDirectoryDao.queryRadioGroupStat(question);
List<Map<String, Object>> radios = (List<Map<String, Object>>) question.get("questionRadio");
int count = 0;
for(Map<String, Object> radio : radios){
radio.put("anCount", 0);
for(Map<String, Object> bean : beans){
if(bean.get("quItemId").toString().equals(radio.get("id").toString())){
radio.put("anCount", bean.get("count"));
}
}
count += Integer.parseInt(radio.get("anCount").toString());
}
for(Map<String, Object> radio : radios){
radio.put("anAllCount", count);
}
} else if (quType.equals(QuType.CHECKBOX.getActionName()) || quType.equals(QuType.COMPCHECKBOX.getActionName())) {//多选 复合多选
List<Map<String, Object>> beans = dwSurveyDirectoryDao.queryCheckBoxGroupStat(question);
List<Map<String, Object>> checkBoxs = (List<Map<String, Object>>) question.get("questionCheckBox");
int count = 0;
for(Map<String, Object> checkBox : checkBoxs){
checkBox.put("anCount", 0);
for(Map<String, Object> bean : beans){
if(bean.get("quItemId").toString().equals(checkBox.get("id").toString())){
checkBox.put("anCount", bean.get("count"));
}
}
count += Integer.parseInt(checkBox.get("anCount").toString());
}
for(Map<String, Object> checkBox : checkBoxs){
checkBox.put("anAllCount", count);
}
} else if (quType.equals(QuType.FILLBLANK.getActionName())) {//填空题
Map<String, Object> bean = dwSurveyDirectoryDao.queryFillBlankGroupStat(question);
question.put("rowContent", bean.get("emptyCount"));
question.put("optionContent", bean.get("blankCount"));
question.put("anCount", bean.get("blankCount"));
} else if (quType.equals(QuType.ANSWER.getActionName())) {//多行填空题
Map<String, Object> bean = dwSurveyDirectoryDao.queryAnswerGroupStat(question);
question.put("rowContent", bean.get("emptyCount"));
question.put("optionContent", bean.get("blankCount"));
question.put("anCount", bean.get("blankCount"));
} else if (quType.equals(QuType.MULTIFILLBLANK.getActionName())) {//组合填空
List<Map<String, Object>> beans = dwSurveyDirectoryDao.queryMultiFillBlankGroupStat(question);
List<Map<String, Object>> multiFillBlanks = (List<Map<String, Object>>) question.get("questionMultiFillBlank");
int count = 0;
for(Map<String, Object> multiFillBlank : multiFillBlanks){
multiFillBlank.put("anCount", 0);
for(Map<String, Object> bean : beans){
if(bean.get("quItemId").toString().equals(multiFillBlank.get("id").toString())){
multiFillBlank.put("anCount", bean.get("count"));
}
}
count += Integer.parseInt(multiFillBlank.get("anCount").toString());
}
for(Map<String, Object> multiFillBlank : multiFillBlanks){
multiFillBlank.put("anAllCount", count);
}
} else if (quType.equals(QuType.ENUMQU.getActionName())) {//枚举题
List<Map<String, Object>> beans = dwSurveyDirectoryDao.queryEnumQuGroupStat(question);
if(beans.isEmpty())
question.put("anCount", 0);
else
question.put("anCount", beans.size());
} else if (quType.equals(QuType.CHENRADIO.getActionName())){//矩阵单选题
List<Map<String, Object>> beans = dwSurveyDirectoryDao.queryChenRadioGroupStat(question);
List<Map<String, Object>> rows = (List<Map<String, Object>>) question.get("questionChenRow");
int count = 0;
for(Map<String, Object> row : rows){
row.put("anCount", 0);
for(Map<String, Object> bean : beans){
if(bean.get("quRowId").toString().equals(row.get("id").toString())){
row.put("anCount", Integer.parseInt(row.get("anCount").toString()) + Integer.parseInt(bean.get("count").toString()));
}
}
count += Integer.parseInt(row.get("anCount").toString());
}
for(Map<String, Object> row : rows){
row.put("anAllCount", count);
}
question.put("anChenRadios", beans);
} else if (quType.equals(QuType.CHENFBK.getActionName())){//矩阵填空题
List<Map<String, Object>> beans = dwSurveyDirectoryDao.queryChenFbkGroupStat(question);
List<Map<String, Object>> rows = (List<Map<String, Object>>) question.get("questionChenRow");
int count = 0;
for(Map<String, Object> row : rows){
row.put("anCount", 0);
for(Map<String, Object> bean : beans){
if(bean.get("quRowId").toString().equals(row.get("id").toString())){
row.put("anCount", Integer.parseInt(row.get("anCount").toString()) + Integer.parseInt(bean.get("count").toString()));
}
}
count += Integer.parseInt(row.get("anCount").toString());
}
for(Map<String, Object> row : rows){
row.put("anAllCount", count);
}
question.put("anChenFbks", beans);
} else if(quType.equals(QuType.CHENCHECKBOX.getActionName())){//矩阵多选题
List<Map<String, Object>> beans = dwSurveyDirectoryDao.queryChenCheckBoxGroupStat(question);
List<Map<String, Object>> rows = (List<Map<String, Object>>) question.get("questionChenRow");
int count = 0;
for(Map<String, Object> row : rows){
row.put("anCount", 0);
for(Map<String, Object> bean : beans){
if(bean.get("quRowId").toString().equals(row.get("id").toString())){
row.put("anCount", Integer.parseInt(row.get("anCount").toString()) + Integer.parseInt(bean.get("count").toString()));
}
}
count += Integer.parseInt(row.get("anCount").toString());
}
for(Map<String, Object> row : rows){
row.put("anAllCount", count);
}
question.put("anChenCheckboxs", beans);
} else if(quType.equals(QuType.CHENSCORE.getActionName())){//矩阵评分题
List<Map<String, Object>> beans = dwSurveyDirectoryDao.queryChenScoreGroupStat(question);
question.put("anChenScores", beans);
}else if (quType.equals(QuType.SCORE.getActionName())) {//评分题
List<Map<String, Object>> beans = dwSurveyDirectoryDao.queryScoreGroupStat(question);
List<Map<String, Object>> scores = (List<Map<String, Object>>) question.get("quScores");
int count = 0;
for(Map<String, Object> score : scores){
score.put("anCount", 0);
score.put("avgScore", "0.00");
for(Map<String, Object> bean : beans){
if(bean.get("quRowId").toString().equals(score.get("id").toString())){
score.put("anCount", bean.get("count"));
score.put("avgScore", Float.parseFloat(bean.get("avgScore").toString()));
}
}
count += Integer.parseInt(score.get("anCount").toString());
}
for(Map<String, Object> score : scores){
score.put("anAllCount", count);
}
} else if (quType.equals(QuType.ORDERQU.getActionName())) {//排序题
List<Map<String, Object>> beans = dwSurveyDirectoryDao.queryOrderQuGroupStat(question);
List<Map<String, Object>> orderQus = (List<Map<String, Object>>) question.get("questionOrderBy");
for(Map<String, Object> bean : beans){
for(Map<String, Object> orderQu : orderQus){
if(bean.get("quRowId").toString().equals(orderQu.get("id").toString())){
orderQu.put("anOrderSum", bean.get("sumOrderNum"));
}
}
}
}
return question;
}
}
......@@ -300,7 +300,9 @@
a.end_num endNum,
a.yn_end_time ynEndTime,
CONVERT(a.end_time, char) endTime,
a.view_answer viewAnswer
CONVERT(a.real_start_time, char) startTime,
a.view_answer viewAnswer,
a.survey_state surveyState
FROM
dw_survey_directory a
WHERE a.id = #{id}
......@@ -866,4 +868,197 @@
WHERE id = #{id}
</update>
<update id="editSurveyStateToReleaseById" parameterType="java.util.Map">
UPDATE dw_survey_directory
<set>
survey_state = '1',
real_start_time = #{startTime},
</set>
WHERE id = #{id}
</update>
<select id="queryRadioGroupStat" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
qu_item_id quItemId,
count(qu_item_id) count
FROM
dw_an_radio
WHERE
visibility = 1
AND qu_id = #{id}
GROUP BY
qu_item_id
</select>
<select id="queryCheckBoxGroupStat" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
qu_item_id quItemId,
count(qu_item_id) count
FROM
dw_an_checkbox
WHERE
visibility = 1
AND qu_id = #{id}
GROUP BY
qu_item_id
</select>
<select id="queryFillBlankGroupStat" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
count(
CASE
WHEN answer = '' THEN
answer
END
) emptyCount,
count(
CASE
WHEN answer != '' THEN
answer
END
) blankCount
FROM
dw_an_fillblank
WHERE
visibility = 1
AND qu_id = #{id}
</select>
<select id="queryAnswerGroupStat" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
count(
CASE
WHEN answer = '' THEN
answer
END
) emptyCount,
count(
CASE
WHEN answer != '' THEN
answer
END
) blankCount
FROM
dw_an_answer
WHERE
visibility = 1
AND qu_id = #{id}
</select>
<select id="queryMultiFillBlankGroupStat" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
qu_item_id quItemId,
count(*) count
FROM
dw_an_dfillblank
WHERE
visibility = 1
AND qu_id = #{id}
GROUP BY
qu_item_id
</select>
<select id="queryEnumQuGroupStat" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
answer,
count(answer) count
FROM
dw_an_enumqu
WHERE
visibility = 1
AND qu_id = #{id}
GROUP BY
answer
</select>
<select id="queryChenRadioGroupStat" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
qu_row_id quRowId,
qu_col_id quColId,
count(qu_col_id) count
FROM
dw_an_chen_radio
WHERE
visibility = 1
AND qu_id = #{id}
GROUP BY
qu_row_id,
qu_col_id
</select>
<select id="queryChenFbkGroupStat" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
qu_row_id quRowId,
qu_col_id quColId,
count(qu_col_id) count
FROM
dw_an_chen_fbk
WHERE
visibility = 1
AND qu_id = #{id}
GROUP BY
qu_row_id,
qu_col_id
</select>
<select id="queryChenCheckBoxGroupStat" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
qu_row_id quRowId,
qu_col_id quColId,
count(qu_col_id) count
FROM
dw_an_chen_checkbox
WHERE
visibility = 1
AND qu_id = #{id}
GROUP BY
qu_row_id,
qu_col_id
</select>
<select id="queryChenScoreGroupStat" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
qu_row_id quRowId,
qu_col_id quColId,
AVG(answser_score) avgScore
FROM
dw_an_chen_score
WHERE
visibility = 1
AND qu_id = #{id}
GROUP BY
qu_row_id,
qu_col_id
</select>
<select id="queryScoreGroupStat" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
qu_row_id quRowId,
count(qu_row_id) count,
AVG(answser_score) avgScore
FROM
dw_an_score
WHERE
visibility = 1
AND qu_id = #{id}
GROUP BY
qu_row_id
</select>
<select id="queryOrderQuGroupStat" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
qu_row_id quRowId,
sum(ordery_num) sumOrderNum
FROM
dw_an_order
WHERE
visibility = 1
AND qu_id = #{id}
GROUP BY
qu_row_id
ORDER BY
sumOrderNum
</select>
</mapper>
\ No newline at end of file
......@@ -193,6 +193,9 @@
<url id="dwsurveydirectory025" path="/post/DwSurveyDirectoryController/deleteSurveyMationById" val="删除问卷" allUse="1">
<property id="rowId" name="id" ref="required" var="问卷id"/>
</url>
<url id="dwsurveydirectory026" path="/post/DwSurveyDirectoryController/querySurveyFxMationById" val="分析报告问卷" allUse="1">
<property id="rowId" name="id" ref="required" var="问卷id"/>
</url>
<!-- 问卷调查结束 -->
</controller>
\ No newline at end of file
......@@ -5927,6 +5927,189 @@ select option{
height: 100%;
}
#dwBody{
margin: 0px auto;
padding-top: 10px;
padding-bottom: 10px;
}
#dwBodyContent{
margin: 0px auto;
background: white;
}
.surveyCollectTop{
padding: 15px 30px;
font-family: "微软雅黑";
border-bottom:1px solid #EEEEEE;
}
.surveyCollectTitle{
font-size: 23px;
font-size:1.8em;
letter-spacing: 3px;
color: #6b6b6b;
}
.surveyCollectInfoDiv{
font-size: 14px;
line-height: 1.4em;
padding: 5px;
margin-top: 10px;
color: #9b9a9a;
}
.surveyCollectInfoLeft{
}
.surveyCollectInfoRight{
float: right;
}
.collectInfoSpan{
color: #9b9a9a;
}
.surveyCollectMiddle{
overflow: auto;
}
.surveyCollectTitleDiv{
}
.surveyCollectMiddleTab{
font-family: "微软雅黑";
border: 1px solid #d4d4d4;
border: none;
background: #f5f5f5;
}
.scmTabRight{
float: right;
margin-top: 5px;
}
.sbtn25_2{
background-position: -123px -333px;
color: #6d6d6d;
width: 110px;
height: 40px;
line-height: 36px;
}
.sbtn25{
background: url(../../../images/dw-icons1-24.png) no-repeat 999px 999px;
width: 108px;
height: 33px;
color: white;
font-size: 13px;
border: 0;
cursor: pointer;
display: inline-block;
zoom: 1;
letter-spacing: 1px;
line-height: 32px;
text-align: center;
text-decoration: none;
font-family: "Hiragino Sans GB","Microsoft YaHei","微软雅黑",tahoma,arial,simsun,"宋体";
}
.r-qu-body-title{
line-height: 26px;
padding: 4px 0;
}
.r-qu-body-title, .r-qu-body-title p, .r-qu-body-title span{
color: #625F5F! important;
font: 14px/20px "Microsoft Yahei","微软雅黑","SimSun","宋体","Arial Narrow",HELVETICA;
font-size: 20px;
display: inline-block;
}
.quCoTitleText{
display: inline-block;
}
.surveyResultQu{
margin-bottom:15px;
background: rgb(245, 245, 245);
padding: 10px 5px;
}
.r-qu-body-content{
padding-left: 10px;
color: #6c6c6c;
font: 12px/20px "Microsoft Yahei","微软雅黑","SimSun","宋体","Arial Narrow",HELVETICA;
}
.r-qu-body-title{
line-height: 26px;
padding: 4px 0;
}
.r-qu-body-title, .r-qu-body-title p, .r-qu-body-title span{
color: #625F5F! important;
font: 14px/20px "Microsoft Yahei","微软雅黑","SimSun","宋体","Arial Narrow",HELVETICA;
font-size: 20px;
display: inline-block;
}
.r-qu-body-title .quCoNum {
float: left;
padding-left: 8px;
}
.reportPic{
padding: 10px;
margin-top: 10px;
}
.dw_btn026{
display: inline-block;
font-size: 12px;
font-family: "Hiragino Sans GB","Microsoft YaHei","微软雅黑",tahoma,arial,simsun,"宋体";
border: 1px solid #D5D5D5;
padding: 3px 12px;
color: #434242;
letter-spacing: 2px;
background-color: #f7f7f7;
border: 1px solid transparent;
}
.dw_btn026.active,a.dw_btn026:hover{
background: #599FD1;
border: 1px solid #599FD1;
color: white;
background: #FEFFFF;
border: 1px solid transparent;
color: rgb(27, 5, 5);
}
.suQuTable {
border: 1px solid #c5b6b6! important;
width: 100%;
}
.suQuTable tr td{
height: 30px! important;
font-size: 16px;
border-bottom: 1px dashed #dad5d5;
}
.ui-corner-all,.ui-corner-left{
-moz-border-radius: 0px;
-webkit-border-radius: 0px;
-khtml-border-radius: 0px;
border-radius: 0px;
border: none;
}
.progressbarDiv{
background: #E8E8E8;
height: 15px! important;
box-shadow: none! important;
}
/*******************************************自定义样式end********************************************/
var quIndex = 0;//问题序号
layui.config({
base: basePath,
version: skyeyeVersion
}).extend({
echarts: '../echarts/echarts',
echartsTheme: '../echarts/echartsTheme',
}).define(['jquery', 'winui', 'echarts'], function (exports) {
winui.renderColor();
layui.use(['form'], function (form) {
var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
var $ = layui.$,
form = layui.form;
showGrid({
id: "dwBodyUser",
url: reqBasePath + "dwsurveydirectory026",
params: {rowId: parent.rowId},
pagination: false,
template: getFileContent('tpl/dwsurveydesign/surveyReport.tpl'),
ajaxSendLoadBefore: function(hdb){
hdb.registerHelper("showIndex", function(v1, options) {
quIndex++;
return quIndex;
});
hdb.registerHelper("showXhIndex", function(v1, options) {
return parseInt(v1) + 1;
});
hdb.registerHelper('compare1', function(v1, v2, options) {
if(v1 == v2){
return options.fn(this);
}else{
return options.inverse(this);
}
});
hdb.registerHelper('compare7', function(v1, options) {
if(v1 != '16' && v1 != '17'){
return options.fn(this);
}else{
return options.inverse(this);
}
});
},
ajaxSendAfter:function(json){
/**
* 统计图切换
*/
$(".linechart_pic,.piechart_pic,.barchart_pic,.columnchart_pic").click(function() {
var th = $(this);
var thClass = th.attr("class");
var quId = th.parents(".surveyResultQu").find("input[name='quId']").val();
var amchartdivId = null;
if(thClass.indexOf("linechart_pic") > 0) {
amchartdivId = "line_chart_" + quId;
} else if(thClass.indexOf("piechart_pic") > 0) {
amchartdivId = "pie_chart_" + quId;
} else if(thClass.indexOf("barchart_pic") > 0) {
amchartdivId = "bar_chart_" + quId;
} else if(thClass.indexOf("columnchart_pic") > 0) {
amchartdivId = "column_chart_" + quId;
}
th.parent().find(".dw_btn026.active").removeClass("active");
th.addClass("active");
if(amchartdivId != null) {
var amchartdivObj = $("#" + amchartdivId);
if(!amchartdivObj[0]) {
var url = "${ctx}/da/survey-report!chartData.action";
var data = "quId=" + quId;
$.ajax({
url: url,
data: data,
type: "post",
success: function(msg) {
$("#amchart_" + quId).find(".higChartSvg").hide();
if(thClass.indexOf("linechart_pic") > 0) {
higLineChart(msg, quId);
} else if(thClass.indexOf("piechart_pic") > 0) {
higPieChart(msg, quId);
} else if(thClass.indexOf("barchart_pic") > 0) {
higBarChart(msg, quId);
} else if(thClass.indexOf("columnchart_pic") > 0) {
higColumnChart(msg, quId);
}
}
});
} else {
$("#amchart_" + quId).find(".higChartSvg").hide();
amchartdivObj.show();
}
}
return false;
});
$(".columnchart_pic").click();
resetQuNum();
}
});
function resetQuNum(){
var quCoNums = $(".quCoNum");
$.each(quCoNums, function(i, item){
$(this).html((i + 1) + "");
});
}
function getHighchartsData(quItemBody, charType) {
var quType = quItemBody.find("input[name='quType']").val();
var categories = [];
var series = new Array();
var seriesData = new Array();
var tagText = "次数";
var legendData = new Array();
var seriesType = 'bar';
if(charType === "Line") {
seriesType = 'line';
}
if(quType === "CHENRADIO" || quType === "CHENCHECKBOX" || quType === "CHENSCORE") {
if(charType === "PIE") {
seriesData = new Array();
var rowItemTrs = quItemBody.find(".rowItemTr");
$.each(rowItemTrs, function() {
var rowItemOptionName = $(this).find(".rowItemOptionName").text();
var thColumnItemTrs = $(this).next().find(".columnItemTr");
$.each(thColumnItemTrs, function() {
var columnItemOptionName = $(this).find(".columnItemOptionName").text();
var anCount = $(this).find("input[name='columnItemAnCount']").val();
var data = {};
data["value"] = parseInt(anCount);
data["name"] = rowItemOptionName + "|" + columnItemOptionName;
series.push(data);
});
});
} else {
var columnItemTrs = quItemBody.find(".anColumnTable:eq(0) .columnItemTr");
$.each(columnItemTrs, function() {
var columnItemOptionName = $(this).find(".columnItemOptionName").text();
categories.push(columnItemOptionName);
});
var rowItemTrs = quItemBody.find(".rowItemTr");
$.each(rowItemTrs, function() {
var rowItemOptionName = $(this).find(".rowItemOptionName").text();
var thColumnItemTrs = $(this).next().find(".columnItemTr");
seriesData = new Array();
$.each(thColumnItemTrs, function() {
var anCount = $(this).find("input[name='columnItemAnCount']").val();
seriesData.push(parseInt(anCount));
});
series.push({ //指定数据列
name: rowItemOptionName, //数据列名
type: seriesType,
data: seriesData //数据
});
legendData.push(rowItemOptionName);
});
}
} else {
var seriesDataTemp = "[";
var quRadioOptions = quItemBody.find(".quTrOptions");
$.each(quRadioOptions, function(i, item) {
var quOptionName = $(this).find(".optionName").text();
var anCount = $(this).find("input[name='quItemAnCount']").val();
if(anCount == "") {
anCount = 0;
}
categories.push(quOptionName);
if(quType === "SCORE") {
var avgScore = $(this).find("input[name='quItemAvgScore']").val();
//平均分 setAvgScore
avgScore = parseFloat(avgScore).toFixed(2);
if(avgScore === "NaN") {
avgScore = "0.00";
}
if(charType === "PIE") {
var data = {};
data["value"] = parseFloat(avgScore);
data["name"] = quOptionName;
seriesData.push(data);
} else {
seriesData.push(parseFloat(avgScore));
}
tagText = "分数";
} else if(quType === "ORDERQU") {
if(charType === "PIE") {
var data = {};
data["value"] = parseInt(anCount);
data["name"] = quOptionName;
seriesData.push(data);
} else {
seriesData.push(parseInt(anCount));
}
tagText = "排名";
} else {
if(charType === "PIE") {
var data = {};
data["value"] = parseInt(anCount);
data["name"] = quOptionName;
seriesData.push(data);
} else {
seriesData.push(parseInt(anCount));
}
}
});
if(charType === "PIE") {
series = seriesData;
} else if(charType === "BAR") {
series = [{
name: tagText,
type: 'bar',
data: seriesData
}];
} else {
series = [{
name: tagText,
type: seriesType,
data: seriesData
}]
}
}
return [categories, series, tagText, legendData];
}
function higColumnChart(resultJson, quId) {
var chartdivId = "column_chart_" + quId;
$("#amchart_" + quId).prepend("<div id='" + chartdivId + "' class=\"higChartSvg\"></div>");
$("#" + chartdivId).css({
"height": "300px"
});
var quItemBody = $("#quTr_" + quId);
var quTitle = quItemBody.find(".quCoTitleText").text();
var quTypeName = quItemBody.find("input[name='quTypeCnName']").val();
var datas = getHighchartsData(quItemBody, "column");
var categories = datas[0];
var series = datas[1];
var tagText = datas[2];
var legendData = datas[3];
var myChart = echarts.init($('#' + chartdivId)[0], "shine");
// 指定图表的配置项和数据
var option = {
title: {
text: quTitle,
top: 8,
textStyle: {
fontSize: 16
},
x: 'center'
},
toolbox: {
show: true,
feature: {
saveAsImage: {
show: true
}
}
},
color: ['#7cb5ec'],
backgroundColor: '#fff',
tooltip: {
trigger: 'axis',
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
},
top: 20
},
grid: {
left: '3%',
right: '3%',
bottom: '5%',
containLabel: true
},
xAxis: {
type: 'category',
data: categories,
axisTick: {
alignWithLabel: true
},
nameGap: 20,
axisLabel: {
interval: 0,
margin: 15
},
axisLine: {
show: false,
lineStyle: {
width: 1
}
},
axisTick: {
show: false
}
},
yAxis: {
splitNumber: 5,
type: 'value',
axisLine: {
show: false
},
axisTick: {
show: false
},
name: tagText
},
legend: {
bottom: 0,
data: legendData
},
series: series
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
}
function higPieChart(resultJson, quId) {
var chartdivId = "pie_chart_" + quId;
$("#amchart_" + quId).prepend("<div id='" + chartdivId + "' class=\"higChartSvg\"></div>");
$("#" + chartdivId).css({
"height": "300px"
});
var quItemBody = $("#quTr_" + quId);
var quTitle = quItemBody.find(".quCoTitleText").text();
var quTypeName = quItemBody.find("input[name='quTypeCnName']").val();
var datas = getHighchartsData(quItemBody, "PIE");
var series = datas[1];
var tagText = datas[2];
var categories = datas[0]
var legendData = datas[3];
var myChart = echarts.init($('#' + chartdivId)[0], "shine");
var option = {
title: {
text: quTitle,
top: 8,
textStyle: {
fontSize: 16
},
x: 'center'
},
tooltip: {
trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)"
},
backgroundColor: '#fff',
toolbox: {
show: true,
feature: {
saveAsImage: {
show: true
}
}
},
legend: {
x: 'center',
y: 'bottom',
data: categories //['直接访问','邮件营销','联盟广告','视频广告','搜索引擎']
},
series: // series
[{
name: tagText,
type: 'pie',
radius: '55%',
center: ['50%', '60%'],
data: series,
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}]
};
myChart.setOption(option);
}
function higBarChart(resultJson, quId) {
var chartdivId = "bar_chart_" + quId;
$("#amchart_" + quId).prepend("<div id='" + chartdivId + "' class=\"higChartSvg\"></div>");
$("#" + chartdivId).css({
"height": "300px"
});
var quItemBody = $("#quTr_" + quId);
var quTitle = quItemBody.find(".quCoTitleText").text();
var quTypeName = quItemBody.find("input[name='quTypeCnName']").val();
var datas = getHighchartsData(quItemBody, "BAR");
var categories = datas[0];
var series = datas[1];
var tagText = datas[2];
var legendData = datas[3];
var myChart = echarts.init($('#' + chartdivId)[0], "shine");
var option = {
title: {
text: quTitle,
top: 8,
textStyle: {
fontSize: 16
},
x: 'center'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
backgroundColor: '#fff',
color: ['#7cb5ec'],
legend: {
data: ['2011年', '2012年']
},
grid: {
left: '3%',
right: '4%',
bottom: '10%',
containLabel: true
},
toolbox: {
show: true,
feature: {
saveAsImage: {
show: true
}
}
},
xAxis: {
type: 'value',
axisTick: {
alignWithLabel: true
},
nameGap: 12,
axisLabel: {
interval: 0,
margin: 15
},
axisLine: {
show: false,
lineStyle: {
width: 1
}
},
axisTick: {
show: false
},
splitLine: {
show: true
}
},
yAxis: {
type: 'category',
data: categories
},
legend: {
bottom: 2,
data: legendData
},
series: series
};
myChart.setOption(option);
}
function higLineChart(resultJson, quId) {
//根据quId得到数据对象,并且解析
var chartdivId = "line_chart_" + quId;
$("#amchart_" + quId).prepend("<div id='" + chartdivId + "' class=\"higChartSvg\"></div>");
$("#" + chartdivId).css({
"height": "300px"
});
var quItemBody = $("#quTr_" + quId);
var quTitle = quItemBody.find(".quCoTitleText").text();
var quTypeName = quItemBody.find("input[name='quTypeCnName']").val();
var datas = getHighchartsData(quItemBody, "Line");
var categories = datas[0];
var series = datas[1];
var tagText = datas[2];
var legendData = datas[3];
var myChart = echarts.init($('#' + chartdivId)[0], "shine");
// 指定图表的配置项和数据
var option = {
title: {
text: quTitle,
top: 8,
textStyle: {
fontSize: 16
},
x: 'center'
},
toolbox: {
show: true,
feature: {
saveAsImage: {
show: true
}
}
},
backgroundColor: '#fff',
color: ['#3398DB'],
tooltip: {
trigger: 'axis',
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
},
top: 20
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: {
type: 'category',
data: categories,
axisTick: {
alignWithLabel: true
},
nameGap: 20,
axisLabel: {
interval: 0,
margin: 15
},
axisLine: {
show: false,
lineStyle: {
width: 1
}
},
axisTick: {
show: false
},
splitLine: {
show: true
}
},
yAxis: {
minInterval: 1,
name: '次数'
},
legend: {
bottom: 0,
data: legendData
},
series: series
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
}
function substring(json) {
var bufLen = json.length;
var lastIndex = json.lastIndexOf(",");
if(bufLen == (lastIndex + 1)) {
json = json.substring(0, lastIndex);
}
return json;
}
});
});
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<link href="../../assets/lib/layui/css/layui.css" rel="stylesheet" />
<link href="../../assets/lib/font-awesome-4.7.0/css/font-awesome.css" rel="stylesheet" />
<link href="../../assets/lib/winui/css/winui.css" rel="stylesheet" />
</head>
<body>
<div style="padding-top:20px;">
<div id="dwBody">
<div id="dwBodyContent" class="bodyCenter" style="border:1px solid #C1DAEC;">
<div id="dwBodyUser">
</div>
</div>
</div>
</div>
<script src="../../assets/lib/layui/layui.js"></script>
<script src="../../assets/lib/layui/custom.js"></script>
<script type="text/javascript">
layui.config({base: '../../js/dwsurveydesign/'}).use('surveyReport');
</script>
</body>
</html>
\ No newline at end of file
{{#bean}}
<div class="surveyCollectMiddle">
<div class="surveyCollectTop">
<div class="surveyCollectTitleDiv">
<span class="surveyCollectTitle">{{surveyName}}</span>
</div>
<div class="surveyCollectInfoDiv">
<span class="surveyCollectInfoLeft">
状态:<span class="collectInfoSpan">收集中</span>&nbsp;&nbsp;&nbsp;&nbsp; 参与人数:
<span class="collectInfoSpan">{{answerNum}}</span>
</span>
<span class="surveyCollectInfoRight">
开始时间:<span class="collectInfoSpan">{{startTime}}</span>
</span>
</div>
</div>
{{/bean}}
<div class="surveyCollectMiddleContent">
<div style="padding: 15px 25px;overflow: auto;">
<div style="overflow: auto;">
<div style="float: left;">
<a href="${ctx }/da/survey-report!defaultReport.action?surveyId=${surveyId }" class="dw_btn025 tabpic active"><i class="fa fa-refresh"></i>&nbsp;刷新</a>
</div>
<div style="float: right;">
<a href="${ctx }/da/my-survey-answer!exportXLS.action?surveyId=${surveyId }" class="dw_btn025"><i class="fa fa-download"></i>下载数据</a>
</div>
</div>
<div style="padding-top:8px;">
<div class="" style="border: 1px solid #D1D6DD;padding: 0px;">
<table id="content-tableList" width="100%" cellpadding="0" cellspacing="0">
{{#each rows}}
{{#if quType}}
{{#compare7 quType}}
<tr id="quTr_{{id}}">
<td colspan="3">
<div class="surveyResultQu">
<input type="hidden" name="quId" value="{{id}}">
<input type="hidden" name="quType" value="{{quType}}">
<input type="hidden" name="quAnCount" value="{{anCount}}">
<input type="hidden" name="quTypeCnName" value="{{quTypeName}}">
<div class="r-qu-body-title">
<div class="quCoNum">{{showIndex quType}}、</div>
<div class="quCoTitleText">{{quTitle}}[{{quTypeName}}]</div>
</div>
<div class="r-qu-body-content">
{{#if quType}}
{{#compare1 quType '1'}}<!-- radio -->
<table class="suQuTable" border="0" cellpadding="0" cellspacing="0">
{{#each questionRadio}}
<tr class="quTrOptions">
<td width="15px">&nbsp;</td>
<td width="520px" class="optionName">{{optionName}}</td>
<td width="180px"><div id="bfbTd{{quType}}{{anAllCount}}_{{anCount}}_{{id}}" class="progressbarDiv progress{{showXhIndex @index}}"></div></td>
<td width="60px" align="right" id="bfbNum{{quType}}{{anAllCount}}_{{anCount}}_{{id}}" class="bfbTd">0%</td>
<td align="left" class="tdAnCount">&nbsp;&nbsp;{{anCount}}次</td>
<td width="40px">&nbsp;
<input type="hidden" name="quItemAnCount" value="{{anCount}}">
</td>
</tr>
<script type="text/javascript">
layui.define(["jquery", 'jqueryUI'], function(exports) {
var jQuery = layui.jquery;
(function($) {
var count = parseInt("{{anAllCount}}");
var anCount = parseInt("{{anCount}}");
if(count == 0){
count = 1;
}
var bfbFloat = anCount / count * 100;
var bfbVal = bfbFloat.toFixed(2);
$("#bfbNum{{quType}}{{anAllCount}}_{{anCount}}_{{id}}").html(bfbVal + "%");
$("#bfbTd{{quType}}{{anAllCount}}_{{anCount}}_{{id}}").progressbar({value: bfbFloat});
})(jQuery);
});
</script>
{{/each}}
</table>
<div class="reportPic">
<div class="chartBtnEvent">
<a href="#" class="dw_btn026 columnchart_pic"><i class="fa fa-bar-chart"></i>柱状图</a>
<a href="#" class="dw_btn026 piechart_pic"><i class="fa fa-pie-chart"></i>饼图</a>
<a href="#" class="dw_btn026 barchart_pic"><i class="fa fa-tasks"></i>条形图</a>
<a href="#" class="dw_btn026 linechart_pic"><i class="fa fa-line-chart"></i>折线图</a>
</div>
<div style="clear: both;"></div>
<div id="amchart_{{id}}" ></div>
</div>
<div style="clear:both;">
</div>
{{else}}
{{#if quType}}
{{#compare1 quType '2'}}<!-- checkbox -->
<table class="suQuTable" border="0" cellpadding="0" cellspacing="0">
<c:forEach items="${en.quCheckboxs }" var="quEn" varStatus="quI">
<tr class="quTrOptions">
<td width="15px">&nbsp;</td>
<td width="520px" class="optionName">${quEn.optionName }</td>
<td width="180px"><div id="bfbTd${en.quType }${i.count }_${quI.count}" class="progressbarDiv progress${quI.index }"></div></td>
<td width="60px" align="right" id="bfbNum${en.quType }${i.count }_${quI.count}" class="bfbTd">0%</td>
<td align="left" class="tdAnCount">&nbsp;&nbsp;${quEn.anCount }</td>
<td width="40px">&nbsp;
<input type="hidden" name="quItemAnCount" value="${quEn.anCount }">
</td>
</tr>
<script type="text/javascript">
var count=parseInt("${en.anCount }");
var anCount=parseInt("${quEn.anCount }");
var bfbFloat=anCount/count*100;
var bfbVal = bfbFloat.toFixed(2);
if(bfbVal==="NaN"){
bfbVal="0.00";
}
$("#bfbNum${en.quType }${i.count }_${quI.count}").html(bfbVal+"%");
$("#bfbTd${en.quType }${i.count }_${quI.count}").progressbar({value: bfbFloat});
</script>
</c:forEach>
</table>
<div class="reportPic">
<div class="chartBtnEvent">
<a href="#" class="dw_btn026 columnchart_pic"><i class="fa fa-bar-chart"></i>柱状图</a>
<a href="#" class="dw_btn026 piechart_pic"><i class="fa fa-pie-chart"></i>饼图</a>
<a href="#" class="dw_btn026 barchart_pic"><i class="fa fa-tasks"></i>条形图</a>
<a href="#" class="dw_btn026 linechart_pic"><i class="fa fa-line-chart"></i>折线图</a>
</div>
<div style="clear: both;"></div>
<div id="amchart_${en.id }" ></div>
</div>
<div style="clear:both;"></div>
{{else}}
{{#if quType}}
{{#compare1 quType '3'}}<!-- fillblank -->
{{else}}
{{#if quType}}
{{#compare1 quType '9'}}<!-- orderby -->
{{else}}
{{#if quType}}
{{#compare1 quType '4'}}<!-- multi-fillblank -->
{{else}}
{{#if quType}}
{{#compare1 quType '11'}}<!-- chen-radio -->
{{else}}
{{#if quType}}
{{#compare1 quType '13'}}<!-- chen-checkbox -->
{{else}}
{{#if quType}}
{{#compare1 quType '12'}}<!-- chen-fbk -->
{{else}}
{{#if quType}}
{{#compare1 quType '18'}}<!-- chen-score -->
{{else}}
{{#if quType}}
{{#compare1 quType '8'}}<!-- score -->
{{else}}
{{/compare1}}
{{/if}}
{{/compare1}}
{{/if}}
{{/compare1}}
{{/if}}
{{/compare1}}
{{/if}}
{{/compare1}}
{{/if}}
{{/compare1}}
{{/if}}
{{/compare1}}
{{/if}}
{{/compare1}}
{{/if}}
{{/compare1}}
{{/if}}
{{/compare1}}
{{/if}}
</div>
</div>
</td>
</tr>
{{else}}
{{/compare7}}
{{/if}}
{{/each}}
</table>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册