stock_trend.html 8.4 KB

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