地铁二期项目正式开始

reportRiskLevel1.cshtml 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. @using YTSoft.BaseCallCenter.MVCWeb.Models;
  2. @using YTSoft.BaseCallCenter.Model;
  3. <!DOCTYPE html>
  4. <html>
  5. <head>
  6. <meta charset="UTF-8">
  7. <title>风险等级报表</title>
  8. <link href="/Content/layui/css/layui.css" rel="stylesheet" />
  9. <link href="/Content/css/public.css" rel="stylesheet" />
  10. <link href="/Content/layui/css/modules/layui-icon-extend/iconfont.css" type="text/css" rel=" stylesheet" />
  11. <link href="/Content/css/font-awesome/css/font-awesome.min.css" type="text/css" rel=" stylesheet" />
  12. <script src="/Content/js/jquery-other.min.js"></script>
  13. <script src="/Content/js/Report/moment.js"></script>
  14. <script src="~/Content/js/Report/GetDate.js"></script>
  15. <script type="text/javascript" src="/Content/layui/layui.js"></script>
  16. <link href="/Content/css/callrecord/iconfont.css" rel="stylesheet" />
  17. <script src="~/Content/layui/loading.js"></script>
  18. <link href="~/Content/css/workorder/loading.css" rel="stylesheet" />
  19. <script src="/Content/dist/echarts.js" type="text/javascript"></script>
  20. <script src="/Content/dist/theme/dahua.js" type="text/javascript"></script>
  21. <style>
  22. .reportEcharts {
  23. display: flex;
  24. }
  25. </style>
  26. </head>
  27. <body class="childrenBody">
  28. <div class="layui-fluid" style="height: calc(100% - 35px);overflow:auto;">
  29. <div class=" layui-col-space15" style="height:100%">
  30. <div class="layui-card">
  31. <div class="layui-card-body">
  32. <div class="layui-row layui-col-space10 searchfilter">
  33. <div class="layui-col-md7">
  34. <div class="layui-row layui-col-space10">
  35. @* <div class="layui-col-xs6">
  36. <button class="layui-btn layui-btn-normal layui-btn-radius"
  37. data-type="oneWeek">最近一周</button>
  38. <button class="layui-btn layui-btn-normal layui-btn-radius"
  39. data-type="oneMonth">最近一月</button>
  40. <button class="layui-btn layui-btn-normal layui-btn-radius"
  41. data-type="oneYear">最近一年</button>
  42. </div> *@
  43. <div class="layui-col-xs6">
  44. <label class="layui-form-label">
  45. 时间:
  46. </label>
  47. <div class="layui-input-block">
  48. <input type="text" class="layui-input dayParty" id="test10"
  49. style="width: 300px; max-width: 300px; " placeholder=" - "
  50. value="@Model.NowDate">
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. <div class="layui-col-md5">
  56. <button class="layui-btn layui-btn-normal layui-btn-normal" data-type="reload">
  57. <i class="layui-icon">&#xe615; 查 询</i>
  58. </button>
  59. </div>
  60. </div>
  61. </div>
  62. </div>
  63. <div class="layui-card layui-form"
  64. style="position: absolute; top: 80px; bottom: 5px; width: calc(100% - 30px);">
  65. <div class="reportEcharts">
  66. <div id="divimagereport1" style="width:500px;height:500px;"></div>
  67. <div id="divimagereport2" style="width:500px;height:500px;"></div>
  68. </div>
  69. <div style="margin-top: 30px;">
  70. <div class="layui-row layui-col-space10">
  71. <div class="layui-col-xs3 layui-input-inline">
  72. <label class="layui-form-label">
  73. 等级:
  74. </label>
  75. <div class="layui-input-block">
  76. <select id="level">
  77. <option value=""></option>
  78. <option value="一级">一级</option>
  79. <option value="二级">二级</option>
  80. <option value="三级">三级</option>
  81. <option value="自动">自动</option>
  82. </select>
  83. </div>
  84. </div>
  85. </div>
  86. <div class="layui-row layui-col-space10">
  87. <table class="layui-table"
  88. lay-data="{height: 'full-220',url:'/ReportOther/GetTableList/?NowDateTime=@Model.NowDateTime', id:'recordtable'}"
  89. lay-size="sm" lay-filter="demo">
  90. <thead>
  91. <tr>
  92. <th lay-data="{field:'F_labelName'}">标签</th>
  93. <th lay-data="{field:'F_level',align:'center'}">等级</th>
  94. <th lay-data="{field:'cnt'}">数量</th>
  95. <th lay-data="{field:'percent',align:'center'}">占比</th>
  96. <th lay-data="{field:'total'}">合计</th>
  97. </tr>
  98. </thead>
  99. </table>
  100. </div>
  101. </div>
  102. <img id="progressImgage" class="progress hide" alt=""
  103. src="@Url.Content("~/Content/images/ajax-loader.gif")" />
  104. <div id="maskOfProgressImage" class="mask hide"></div>
  105. </div>
  106. </div>
  107. </div>
  108. <script type="text/html" id="barDemo">
  109. <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="view">查看详情</a>
  110. </script>
  111. <script>
  112. layui.use('element', function () {
  113. var $ = layui.jquery
  114. , element = layui.element; //Tab的切换功能,切换事件监听等,需要依赖element模块
  115. $('.site-demo-active').on('click', function () {
  116. var othis = $(this), type = othis.data('type');
  117. active[type] ? active[type].call(this, othis) : '';
  118. });
  119. //Hash地址的定位
  120. var layid = location.hash.replace(/^#test=/, '');
  121. element.tabChange('test', layid);
  122. element.on('tab(test)', function (elem) {
  123. location.hash = 'test=' + $(this).attr('lay-id');
  124. });
  125. });
  126. layui.use('laydate', function () {
  127. var laydate = layui.laydate;
  128. //日期时间范围
  129. laydate.render({
  130. elem: '#test10'
  131. // , type: 'datetime'
  132. , range: true
  133. });
  134. });
  135. layui.use(['table', 'jquery'], function () {
  136. var table = layui.table;
  137. var form = layui.form,
  138. layer = parent.layer === undefined ? layui.layer : parent.layer,
  139. $ = layui.jquery;
  140. $ = layui.$, active = {
  141. //查询按钮
  142. reload: function () {
  143. Init();
  144. //执行重载
  145. table.reload('recordtable', {
  146. where: {
  147. level: $("#level").val(),
  148. stime: $("#test10").val().split(' -')[0] + " 00:00:00",
  149. etime: $("#test10").val().split('- ')[1] + " 23:59:59",
  150. NowDateTime: new Date()
  151. }
  152. });
  153. }
  154. };
  155. $('.searchfilter .layui-btn').on('click', function () {
  156. var type = $(this).data('type');
  157. active[type] ? active[type].call(this) : '';
  158. });
  159. // 路径配置
  160. require.config({
  161. paths: {
  162. echarts: '/Content/dist'
  163. }
  164. });
  165. function Init() {
  166. echartsData("/ReportOther/GetPieChart", "pie")
  167. echartsData("/ReportOther/GetLineChart", "line")
  168. }
  169. Init();
  170. });
  171. function echartsData(apiUrl, type) {
  172. $.ajax({
  173. url: apiUrl,
  174. type: "get",
  175. contentType: "application/json",
  176. dataType: "text",
  177. cache: false,
  178. data: {
  179. NowDateTime: new Date(),
  180. stime: $("#test10").val().split(' -')[0] + " 00:00:00",
  181. etime: $("#test10").val().split('- ')[1] + " 23:59:59",
  182. },
  183. success: function (result, status) {
  184. if (status) {
  185. var resultData = JSON.parse(result)
  186. if (type === "pie") {
  187. console.log(type)
  188. if (resultData.length > 0) {
  189. var pieData = {}
  190. var pieTitleData = []
  191. var pieSeriesData = []
  192. resultData.forEach(element => {
  193. var pieObj = {}
  194. pieObj.value = element.count
  195. pieObj.name = element.level
  196. pieTitleData.push(element.level)
  197. pieSeriesData.push(pieObj)
  198. });
  199. pieData.pieTitleData = pieTitleData
  200. pieData.pieSeriesData = pieSeriesData
  201. }
  202. setPieOption("divimagereport1", pieData)
  203. } else if (type === "line") {
  204. if (resultData.data) {
  205. console.log(type)
  206. setLineOption("divimagereport2", resultData.data)
  207. }
  208. }
  209. }
  210. }
  211. });
  212. }
  213. function setPieOption(id, pieData) {
  214. // 使用
  215. require(
  216. [
  217. 'echarts',
  218. 'echarts/chart/pie' // 使用柱状图就加载bar模块,按需加载
  219. ],
  220. function (ec) {
  221. var dahuatheme
  222. require(['echarts/theme/dahua'], function (theme) {
  223. dahuatheme = theme;
  224. });
  225. // 基于准备好的dom,初始化echarts图表
  226. var myChart = ec.init(document.getElementById(id), dahuatheme);
  227. option = {
  228. title: {
  229. show: false,
  230. text: '',
  231. subtext: '',
  232. x: 'center'
  233. },
  234. tooltip: {
  235. trigger: 'item',
  236. formatter: "{a} <br/>{b} : {c} ({d}%)"
  237. },
  238. toolbox: {
  239. show: true,
  240. feature: {
  241. dataView: {
  242. show: true,
  243. title: '数据视图',
  244. readOnly: true,
  245. lang: ['数据视图', '关闭', '刷新']
  246. },
  247. saveAsImage: {
  248. show: true,
  249. title: '保存为图片',
  250. type: 'png',
  251. lang: ['点击保存']
  252. }
  253. }
  254. },
  255. legend: {
  256. show: true,
  257. orient: 'horizontal',
  258. bottom: 20,
  259. data: pieData.pieTitleData
  260. },
  261. series: [
  262. {
  263. name: '渠道',
  264. type: 'pie',
  265. radius: '55%',
  266. center: ['50%', '55%'],
  267. data: pieData.pieSeriesData,
  268. itemStyle: {
  269. emphasis: {
  270. shadowBlur: 10,
  271. shadowOffsetX: 0,
  272. shadowColor: 'rgba(0, 0, 0, 0.5)'
  273. }
  274. }
  275. }
  276. ]
  277. }; // 为echarts对象加载数据
  278. myChart.setOption(option);
  279. }
  280. );
  281. }
  282. function setLineOption(id, resultData) {
  283. // 使用
  284. require(
  285. [
  286. 'echarts',
  287. 'echarts/chart/bar', // 使用柱状图就加载bar模块,按需加载
  288. 'echarts/chart/line'
  289. ],
  290. function (ec) {
  291. var dahuatheme
  292. require(['echarts/theme/dahua'], function (theme) {
  293. dahuatheme = theme;
  294. });
  295. // 基于准备好的dom,初始化echarts图表
  296. var myChart = ec.init(document.getElementById(id), dahuatheme);
  297. option = {
  298. tooltip: {
  299. trigger: 'axis'
  300. },
  301. legend: {
  302. data: ["一级", "二级", "三级"]
  303. },
  304. grid: {
  305. left: '3%',
  306. right: '4%',
  307. bottom: '3%',
  308. containLabel: true
  309. },
  310. toolbox: {
  311. feature: {
  312. saveAsImage: {}
  313. }
  314. },
  315. xAxis: {
  316. type: 'category',
  317. boundaryGap: false,
  318. data: resultData.datelist
  319. },
  320. yAxis: {
  321. type: 'value'
  322. },
  323. series: [
  324. {
  325. name: '一级',
  326. type: 'line',
  327. stack: 'Total',
  328. data: resultData.yiji
  329. },
  330. {
  331. name: '二级',
  332. type: 'line',
  333. stack: 'Total',
  334. data: resultData.erji
  335. },
  336. {
  337. name: '三级',
  338. type: 'line',
  339. stack: 'Total',
  340. data: resultData.sanji
  341. },
  342. ]
  343. };
  344. // 为echarts对象加载数据
  345. myChart.setOption(option);
  346. }
  347. );
  348. }
  349. </script>
  350. </body>
  351. </html>