Нет описания

QuestionResult.html 8.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <link href="../css/bootstrap.min.css" />
  7. <link rel="stylesheet" href="../css/bootstrap-select.css" />
  8. <script src="../Script/Common/huayi.load.js"></script>
  9. <script src="../Script/Common/huayi.config.js"></script>
  10. <link rel="stylesheet" href="../css/init.css" />
  11. <title>问卷结果</title>
  12. <style>
  13. </style>
  14. </head>
  15. <body class="gray-bg">
  16. <div class="daoHang clearfix">
  17. <div class="dhLeft">
  18. <sapn><i class="syIcon"></i>位置:
  19. <a id="ReIndex">首页</a>&gt;
  20. <a href="javaScript:;">问卷调查</a>&gt;
  21. <a href="" style="color: #000;">问卷结果</a>
  22. </sapn>
  23. </div>
  24. <div class="dhRight">
  25. <a href="" title="刷新"><i class="fa fa-refresh"></i></a>
  26. </div>
  27. </div>
  28. <div class="container-fluid wrapper wrapper-content animated fadeInRight">
  29. <div class="top clearfix " style="margin-bottom: 20px;">
  30. <div>
  31. <span>&nbsp;问卷:<select class="form-control" id="ques" style="width: 300px;display: inline-block;"></select>
  32. <div style="display: inline-block;width: 400px;">
  33. <select class="form-control" id="allques" data-live-search="true">
  34. <option value="">请选择问题</option>
  35. </select>
  36. </div>
  37. <span>时间:</span><input type="text" id="starttime" class="photo x-color laydate-icon" autocomplete="off" style="height: 35px;width: 200px;" />&nbsp;——&nbsp;
  38. <input type="text" id="endtime" class="photo x-color laydate-icon" autocomplete="off" style="height: 35px;width: 200px;" />
  39. <button class="btns searchGo size-14"> <i class="fa fa-search size-14"></i>&nbsp;搜索</button>
  40. </div>
  41. </div>
  42. <div style="width: 100%; padding: 10px;margin-bottom: 10px;display: none;" class="tabbox">
  43. <table id="orderlist" data-row-style="rowStyle" data-query-params="queryParams" data-pagination="true">
  44. <thead>
  45. <tr>
  46. <th data-field="F_CusName" data-align="center" data-formatter="forcusname">提交人</th>
  47. <th data-field="F_Answer" data-align="center">答案</th>
  48. <th data-field="F_Opton" data-align="center">时间</th>
  49. </tr>
  50. </thead>
  51. </table>
  52. </div>
  53. <div style="width: 100%;text-align: center;height: 400px;padding: 0 30%;" class="EchartsData">
  54. <div style="width: 500px;height: 400px;" id="echartdata"></div>
  55. </div>
  56. </div>
  57. </body>
  58. <script src="../js/layui/layui.js"></script>
  59. <script src="../js/bootstrap-select.js"></script>
  60. <script src="../css/laydate/laydate.js"></script>
  61. <script src="../js/echarts.common.min.js"></script>
  62. <script>
  63. $(function() {
  64. laydate.skin('blue');
  65. laydate({
  66. elem: '#starttime',
  67. event: 'focus',
  68. istime: true,
  69. format: 'YYYY-MM-DD hh:mm:ss'
  70. });
  71. laydate({
  72. elem: '#endtime',
  73. event: 'focus',
  74. istime: true,
  75. format: 'YYYY-MM-DD hh:mm:ss'
  76. });
  77. Allquestion($("#ques"))
  78. // load()
  79. })
  80. function Allquestion(obj) {
  81. obj.empty();
  82. obj.append(
  83. '<option selected="selected" value="">请选择问卷</option>'
  84. );
  85. $.getJSON(
  86. huayi.config.callcenter_url +
  87. "Questionnaire/GetAllPager", {
  88. token: $.cookie("token")
  89. },
  90. function(data) {
  91. if(data.state.toLowerCase() == "success") {
  92. var content = data.data;
  93. $(content).each(function(i, n) {
  94. $(
  95. "<option value='" +
  96. n.F_PagerId +
  97. "'>" +
  98. n.F_Title +
  99. "</option>"
  100. ).appendTo(obj);
  101. });
  102. }
  103. }
  104. );
  105. }
  106. $('#ques').change(function() {
  107. $("#allques").empty()
  108. $.getJSON(
  109. huayi.config.callcenter_url + "Questionnaire/GetAllQuestionByPid", {
  110. pid: $("#ques").val(),
  111. token: $.cookie("token"),
  112. },
  113. function(data) {
  114. if(data.state.toLowerCase() == "success") {
  115. var content = data.data;
  116. $("<option value=''>请选择问题</option>").appendTo($("#allques"))
  117. $(content).each(function(i, n) {
  118. $(
  119. "<option value='" +
  120. n.F_QuestionId +
  121. "'>" +
  122. n.F_Title +
  123. "</option>"
  124. ).appendTo($("#allques"));
  125. });
  126. $("#allques").selectpicker({
  127. noneSelectedText: "请选择问题", //默认显示内容
  128. });
  129. $("#allques").selectpicker("refresh");
  130. }
  131. }
  132. );
  133. })
  134. var arrData = [];
  135. var myChart = echarts.init(document.getElementById("echartdata"));
  136. //搜索
  137. $('.searchGo').click(function() {
  138. if(!$('#ques').val()){
  139. layer.msg('请选择问卷')
  140. return;
  141. }
  142. if(!$('#allques').val()){
  143. layer.msg('请选择问题')
  144. return;
  145. }
  146. $(".tabbox").show()
  147. arrData = [];
  148. load();
  149. initechart();
  150. })
  151. //获取列表信息
  152. function load() {
  153. //先销毁表格
  154. $("#orderlist").bootstrapTable("destroy");
  155. //初始化表格,动态从服务器加载数据
  156. $("#orderlist").bootstrapTable({
  157. method: "get", //使用get请求到服务器获取数据
  158. url: huayi.config.callcenter_url + "Questionnaire/GetAllAnswerByPidQid", //获取数据的Servlet地址
  159. contentType: "application/x-www-form-urlencoded",
  160. striped: true, //表格显示条纹
  161. pagination: true, //启动分页
  162. pageSize: 10, //每页显示的记录数
  163. pageNumber: 1, //当前第几页
  164. pageList: [10, 20, 50, 100], //记录数可选列表
  165. search: false, //是否启用查询
  166. showColumns: false, //显示下拉框勾选要显示的列
  167. showRefresh: false, //显示刷新按钮
  168. sidePagination: "server", //表示服务端请求
  169. //设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
  170. //设置为limit可以获取limit, offset, search, sort, order
  171. queryParamsType: "undefined",
  172. queryParams: function queryParams(params) {
  173. //设置查询参数
  174. //alert(params.pageNumber)
  175. var param = {
  176. // pid:3,
  177. // qid:13,
  178. pageindex: params.pageNumber,
  179. pagesize: params.pageSize,
  180. pid: $("#ques").val() || 0,
  181. qid: $("#allques").val() || 0,
  182. sdata: $("#starttime").val(), //=开始时间
  183. edata: $("#endtime").val(), //=结束时间
  184. token: $.cookie("token"),
  185. };
  186. // 导出参数
  187. exportParams = param;
  188. return param;
  189. },
  190. responseHandler: function(res) {
  191. return {
  192. "rows": res.data.data,
  193. "total": res.data.allcount
  194. }
  195. },
  196. onLoadSuccess: function(data) {
  197. },
  198. onLoadError: function() {
  199. },
  200. });
  201. }
  202. function forcusname(val, row) {
  203. if(val) {
  204. return "<span>" + row.F_CusName + '-' + row.F_Phone + "</span>"
  205. } else {
  206. return '-'
  207. }
  208. }
  209. //获取图表
  210. function initechart() {
  211. $.ajax({
  212. type: "get",
  213. url: huayi.config.callcenter_url + "Questionnaire/GetAllAnswerCountByPidQid",
  214. dataType: 'json',
  215. data: {
  216. pid: $("#ques").val(),
  217. qid: $("#allques").val(),
  218. sdata: $("#starttime").val(), //=开始时间
  219. edata: $("#endtime").val(), //=结束时间
  220. token: $.cookie("token"),
  221. },
  222. async: true,
  223. success: function(data) {
  224. var resultdata = data.data.queitem
  225. if(resultdata.length > 0) {
  226. resultdata.forEach(function(val) {
  227. arrData.push({
  228. value: val.itemcount,
  229. name: val.itemname
  230. })
  231. })
  232. }
  233. var option = {
  234. title: {
  235. text:'',
  236. left:'center'
  237. },
  238. tooltip: {
  239. trigger: 'item',
  240. formatter: "{b}:{c}({d}%)"
  241. },
  242. legend: {
  243. orient: 'vertical',
  244. left: 'left'
  245. },
  246. series: [{
  247. name: 'Access From',
  248. type: 'pie',
  249. radius: '50%',
  250. data: arrData,
  251. // itemStyle: {
  252. // normal: {
  253. // label: {
  254. // show: false //隐藏标示文字
  255. // },
  256. // labelLine: {
  257. // show: false //隐藏标示线
  258. // }
  259. // }
  260. // },
  261. emphasis: {
  262. itemStyle: {
  263. shadowBlur: 10,
  264. shadowOffsetX: 0,
  265. shadowColor: 'rgba(0, 0, 0, 0.5)'
  266. }
  267. }
  268. }]
  269. };
  270. myChart.setOption(option);
  271. }
  272. });
  273. }
  274. </script>
  275. </html>