stock_trend.html 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title></title>
  6. <link rel="stylesheet" type="text/css" href="css/main.css">
  7. <link rel="stylesheet" type="text/css" href="css/jquery-ui.css">
  8. <style type="text/css">
  9. .content>div{
  10. float: left;
  11. width: 100%;
  12. color: #fff;
  13. }
  14. #echartTrend{
  15. height: 40%;
  16. }
  17. #inlist,#outlist{
  18. width: 48%;
  19. height: 98%;
  20. margin: 1%;
  21. float: left;
  22. }
  23. .trend-title{
  24. width: 100%;height:20%;text-align: center;line-height: 40px;font-weight: bold;font-size: 20px;
  25. }
  26. </style>
  27. </head>
  28. <body onclick="clearEle();" style="background-color: rgba(41,85,137,0.7);height: 724px;">
  29. <div class="content" style="height: 100%;">
  30. <div id="echartTrend">
  31. <div class="trend-title">出入库趋势-最近1月</div>
  32. <div style="width: 100%;height:80%;"></div>
  33. </div>
  34. <div style="height: 60%;">
  35. <div id="inlist">
  36. <div class="trend-title" style="height: 15%">当日入库明细</div>
  37. <div style="width: 100%;height:85%;overflow-y: auto;"></div>
  38. </div>
  39. <div id="outlist">
  40. <div class="trend-title" style="height: 15%">当日出库明细</div>
  41. <div style="width: 100%;height:85%;overflow-y: auto;"></div>
  42. </div>
  43. </div>
  44. </div>
  45. <script type="text/html" id="detail_tpl">
  46. <table style="width: 100%;">
  47. <thead>
  48. <tr style="text-align: center;font-weight: bold;">
  49. <td width="30%">物料类型</td>
  50. <td width="40%">单据类型</td>
  51. <td width="30%">数量 ({{unitname}})</td>
  52. </tr>
  53. </thead>
  54. <tbody>
  55. {{each data}}
  56. <tr>
  57. <td width="30%">{{$value.clas}}</td>
  58. <td width="40%">{{$value.type}}</td>
  59. <td width="30%">{{$value.total}}</td>
  60. </tr>
  61. {{/each}}
  62. </tbody>
  63. </table>
  64. </script>
  65. </body>
  66. </html>
  67. <!-- 引入qwebchannel.js、Player.js、PlayerUtils.js -->
  68. <script type="text/javascript" src="jquery-3.4.1.js"></script>
  69. <script type="text/javascript" src="jquery-ui.min.js"></script>
  70. <script type="text/javascript" src="echarts.min.js"></script>
  71. <script src="global.js"></script>
  72. <script type="text/javascript" src="template.js"></script>
  73. <script>
  74. var type = window.location.hash.replace('#','');
  75. var unit = parent.StockTypeUnit[type];
  76. $(document).ready(function () {
  77. var datalist = (parent.FacStockData[type]['trend']);
  78. showTrend(datalist);
  79. var indatalst = parent.FacStockData[type]['in'];
  80. var outdatalst = parent.FacStockData[type]['out'];
  81. var inhtml = template('detail_tpl',{data:indatalst,unitname:unit});
  82. var outhtml = template('detail_tpl',{data:outdatalst,unitname:unit});
  83. $("#inlist>div:last").html(inhtml);
  84. $("#outlist>div:last").html(outhtml);
  85. });
  86. function showTrend(data){
  87. var t = $("#echartTrend>div:last");
  88. var inNum = [],outNum=[];
  89. var times = [];
  90. var v_series = [];
  91. for (var i = 0; i < data.length; i++) {
  92. var tv = data[i]['date'].split("-")
  93. times.push(tv[1] + "-" + tv[2])
  94. inNum.push(data[i]['inNum']);
  95. outNum.push(data[i]['outNum']);
  96. }
  97. if (times.length == 0) {
  98. //t.parent().hide();
  99. } else {
  100. v_series.push({
  101. name: "入库",
  102. type: 'line',
  103. smooth: true,
  104. //symbol: 'none',
  105. data: inNum,
  106. itemStyle: {
  107. normal: {
  108. color: '#F0F275', // 这里设置折线的颜色
  109. lineStyle: {
  110. color: '#F0F27580' // 这里同时设置线头的颜色
  111. }
  112. }
  113. },
  114. });
  115. v_series.push({
  116. name: "出库",
  117. type: 'line',
  118. smooth: true,
  119. //symbol: 'none',
  120. data: outNum,
  121. itemStyle: {
  122. normal: {
  123. color: '#FFFFFF', // 这里设置折线的颜色
  124. lineStyle: {
  125. color: '#FFFFFF80' // 这里同时设置线头的颜色
  126. }
  127. }
  128. },
  129. });
  130. var opt = {
  131. title: {
  132. show: false, //不显示标题
  133. text: '',
  134. textStyle: {
  135. color: "rgb(89, 151, 229)",
  136. fontWeight: "bold"
  137. },
  138. top: "0px",
  139. left: "30px"
  140. },
  141. tooltip: {
  142. trigger: 'axis',
  143. backgroundColor:'rgba(41,85,137,0.7)',
  144. textStyle: {
  145. // 设置字体颜色
  146. color: '#fff'
  147. },
  148. formatter: function (params) {
  149. let xv='';
  150. let result = '';
  151. params.forEach(function (item) {
  152. xv=`${item.name}<br/>`;
  153. result += ` ${item.marker} ${item.value}(`+unit+`)<br/>`;
  154. });
  155. return xv+result;
  156. }
  157. },
  158. legend: {
  159. show: true, //不显示图例
  160. inactiveColor: "#04417A",
  161. data: ["入库","出库"],
  162. textStyle: {color: "#fff"},
  163. top: "-5px"
  164. },
  165. grid: {
  166. left: '1%',
  167. right: '1%',
  168. bottom: '5%',
  169. top: '10%',
  170. containLabel: true
  171. },
  172. xAxis: {
  173. type: 'category',
  174. boundaryGap: false,
  175. axisLabel: {
  176. rotate: 45,
  177. color: "#fff"
  178. },
  179. data: times
  180. },
  181. yAxis: {
  182. type: 'value',
  183. nameTextStyle: {
  184. color: "#fff"
  185. },
  186. axisLabel: {
  187. color: "rgb(203,215,235)"
  188. },
  189. splitLine: {
  190. lineStyle: {
  191. color: "#7DA7CD",
  192. type: "dashed",
  193. width: 1
  194. }
  195. }
  196. },
  197. series: v_series
  198. };
  199. var echartsEle = echarts.init(t[0]);
  200. echartsEle.setOption(opt);
  201. }
  202. }
  203. function clearEle(){
  204. }
  205. </script>