projectCostWarnRpt4ZJLDemo.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /**
  2. *
  3. */
  4. function showdetail(event){
  5. var valuetext = event.currentTarget.childNodes[0].childNodes[0].value;
  6. var values = new Array(); //定义一数组
  7. values = valuetext.split(","); //字符分割
  8. mui.openWindow({
  9. id:'detail',
  10. url:'contractReportsController.do?projectCostWarnDemoRpt4ZJLdetail&projectname='+values[0]
  11. });
  12. return;
  13. mui.alert(' <div id="echarts-line" style="height:600px;">'+
  14. ' <div id="container" style="height:80%;"></div>'+
  15. '</div>'+
  16. '<script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts/echarts.min.js"></script> '+
  17. '<script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts-gl/echarts-gl.min.js"></script> '+
  18. ' <script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts-stat/ecStat.min.js"></script> '+
  19. '<script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts/extension/dataTool.min.js"></script> '+
  20. '<script type="text/javascript"> '+
  21. ' var dom = document.getElementById("container"); '+
  22. ' var myChart = echarts.init(dom); '+
  23. ' window.onresize = myChart.resize; '+
  24. ' var app = {}; '+
  25. ' option = null; '+
  26. ' option = { '+
  27. ' baseOption: { '+
  28. ' title: { '+
  29. ' text: "某楼盘销售情况", '+
  30. ' subtext: "纯属虚构" '+
  31. ' }, '+
  32. ' tooltip: { '+
  33. ' trigger: "axis" '+
  34. ' }, '+
  35. ' legend: { '+
  36. ' data:["意向","预购","成交"] '+
  37. ' }, '+
  38. ' toolbox: { '+
  39. ' show: true, '+
  40. ' feature: { '+
  41. ' saveAsImage: {show: true} '+
  42. ' } '+
  43. ' }, '+
  44. ' grid: { '+
  45. ' left: "10%", '+
  46. ' top: "20%", '+
  47. ' right: "10%", '+
  48. ' bottom: "10%" '+
  49. ' }, '+
  50. ' xAxis: { '+
  51. ' type: "category", '+
  52. ' boundaryGap: false, '+
  53. ' data: ["周一","周二","周三","周四","周五","周六","周日"] '+
  54. ' }, '+
  55. ' yAxis: { '+
  56. ' type: "value" '+
  57. ' }, '+
  58. ' series: [{ '+
  59. ' name: "成交", '+
  60. ' type: "line", '+
  61. ' smooth: true, '+
  62. ' data: [10, 12, 21, 54, 260, 830, 710] '+
  63. ' }, '+
  64. ' { '+
  65. ' name: "预购", '+
  66. ' type: "line", '+
  67. ' smooth: true, '+
  68. ' data: [30, 182, 434, 791, 390, 30, 10] '+
  69. ' }, '+
  70. ' { '+
  71. ' name: "意向", '+
  72. ' type: "line", '+
  73. ' smooth: true, '+
  74. ' data: [1320, 1132, 601, 234, 120, 90, 20] '+
  75. ' }] '+
  76. ' } '+
  77. '}; debugger;'+
  78. ' if (option && typeof option === "object") { '+
  79. ' myChart.setOption(option, true); '+
  80. ' } '+
  81. ' </script>',values[0]
  82. );
  83. }
  84. /**
  85. * 将数值格式化成金额形式
  86. *
  87. * @param num 数值(Number或者String)
  88. * @param precision 精度,默认不变
  89. * @param separator 分隔符,默认为逗号
  90. * @return 金额格式的字符串,如'1,234,567',默认返回NaN
  91. * @type String
  92. */
  93. function formatNumber(num, precision, separator) {
  94. var parts;
  95. // 判断是否为数字
  96. if (!isNaN(parseFloat(num)) && isFinite(num)) {
  97. // 把类似 .5, 5. 之类的数据转化成0.5, 5, 为数据精度处理做准, 至于为什么
  98. // 不在判断中直接写 if (!isNaN(num = parseFloat(num)) && isFinite(num))
  99. // 是因为parseFloat有一个奇怪的精度问题, 比如 parseFloat(12312312.1234567119)
  100. // 的值变成了 12312312.123456713
  101. num = Number(num);
  102. // 处理小数点位数
  103. num = (typeof precision !== 'undefined' ? (Math.round(num * Math.pow(10,precision)) / Math.pow(10,precision)).toFixed(precision) : num).toString();
  104. // 分离数字的小数部分和整数部分
  105. parts = num.split('.');
  106. // 整数部分加[separator]分隔, 借用一个著名的正则表达式
  107. parts[0] = parts[0].toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1' + (separator || ','));
  108. return parts.join('.');
  109. }
  110. return NaN;
  111. }