panel.blade.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. @extends('layouts.app')
  2. @section('title')控制台@endsection
  3. @section('content')
  4. <div class="container-fluid" id="list">
  5. <div class="card">
  6. <h5 class="card-header">最近使用功能</h5>
  7. <div class="card-body row">
  8. <ul class="list-group" v-for="(menu,index) in menus">
  9. <div class="container-fluid btn-group justify-content-center">
  10. <a class="btn-primary btn-lg" v-if="index<=3" :href="'/'+menu.route">@{{ menu.name }}</a>
  11. </div>
  12. <div v-if="menu.secondLevelMenu && menu.secondLevelMenu.length>0&&index<=3">
  13. <div class="container-fluid btn-group m-1">
  14. <a class="bth btn-sm btn-info m-1" v-for="(secondMenu,index) in menu.secondLevelMenu"
  15. :href="'/'+secondMenu.route" v-if="index < 2"> @{{ secondMenu.name }}</a>
  16. </div>
  17. </div>
  18. </ul>
  19. </div>
  20. </div>
  21. <div class="row my-3">
  22. <div class="col-2">
  23. <div class="card">
  24. <div class="card-header text-dark h5">
  25. <p>实时待处理订(总):@{{ totalOrders.total }}</p>
  26. </div>
  27. <div class="card-body">
  28. <p>创建订单:@{{ totalOrders.createOrder }}</p>
  29. <p>分配完成:@{{ totalOrders.assignedComplete }}</p>
  30. <p>部分分配:@{{ totalOrders.partialAllocation }}</p>
  31. <p>部分装箱:@{{ totalOrders.partPacking }}</p>
  32. <p>播种完成:@{{ totalOrders.sowComplete }}</p>
  33. </div>
  34. </div>
  35. </div>
  36. <div class="col-2" v-for="(warehousesOrder,index) in warehousesOrders">
  37. <div class="card">
  38. <div class="card-header text-success h5">
  39. <p>@{{ getWareHouse(warehousesOrder.name) }}:@{{ warehousesOrder.total }}</p>
  40. </div>
  41. <div class="card-body">
  42. <p>创建订单:@{{ warehousesOrder.createOrder }}</p>
  43. <p>分配完成:@{{ warehousesOrder.assignedComplete }}</p>
  44. <p>部分分配:@{{ warehousesOrder.partialAllocation }}</p>
  45. <p>部分装箱:@{{ warehousesOrder.partPacking }}</p>
  46. <p>播种完成:@{{ warehousesOrder.sowComplete }}</p>
  47. </div>
  48. </div>
  49. </div>
  50. </div>
  51. <div class="row my-3">
  52. <div class="col-5">
  53. <div class="card">
  54. <div class="card-header">
  55. <div class="col-5 row">
  56. <span class="demonstration"></span>
  57. <el-date-picker
  58. v-model="orderCountingRecordsDate"
  59. type="daterange"
  60. align="right"
  61. unlink-panels
  62. range-separator="-"
  63. start-placeholder="开始日期"
  64. end-placeholder="结束日期"
  65. value-format="yyyy-MM-dd"
  66. :picker-options="pickerOptions">
  67. </el-date-picker>
  68. <div class="row">
  69. <el-button type="primary" value="日" @click="unit= '日'" v-model="unit">日</el-button>
  70. <el-button type="primary" value="周" @click="unit= '周'" v-model="unit">周</el-button>
  71. <el-button type="primary" value="月" @click="unit= '月'" v-model="unit">月</el-button>
  72. <el-button type="primary" icon="el-icon-search" @click="orderCountingRecordApi()">搜索
  73. </el-button>
  74. </div>
  75. </div>
  76. </div>
  77. <div class="card-body row">
  78. <div id="orderCountingRecords" class="col" style="width:600px;height:600px;"></div>
  79. </div>
  80. </div>
  81. </div>
  82. <div class="col-7">
  83. <div class="row">
  84. <div class="col-6">
  85. <div class="card">
  86. <div class="card-header">
  87. <div class="col-5 row">
  88. <div class="block">
  89. <span class="demonstration"></span>
  90. <el-date-picker
  91. v-model="logisticsCountingRecordsData"
  92. type="daterange"
  93. align="right"
  94. unlink-panels
  95. range-separator="-"
  96. start-placeholder="开始日期"
  97. end-placeholder="结束日期"
  98. value-format="yyyy-MM-dd"
  99. :picker-options="pickerOptions">
  100. </el-date-picker>
  101. <el-button type="primary" icon="el-icon-search"
  102. @click="logisticsCountingRecordsApi()">搜索
  103. </el-button>
  104. </div>
  105. </div>
  106. </div>
  107. <div class="card-body row">
  108. <div id="logisticsCountingRecords" class="col"
  109. style="width: 600px;height:600px;"></div>
  110. </div>
  111. </div>
  112. </div>
  113. <div class="col-6">
  114. </div>
  115. </div>
  116. </div>
  117. </div>
  118. </div>
  119. @endsection
  120. @section('lastScript')
  121. <script src="{{ mix('js/echarts.js') }}"></script>
  122. <!-- 引入样式 -->
  123. <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
  124. <!-- 引入组件库 -->
  125. <script src="https://unpkg.com/element-ui/lib/index.js"></script>
  126. <script>
  127. let vue = new Vue({
  128. el: "#list",
  129. data: {
  130. myChart: null,
  131. menus:{!! $menus !!},
  132. warehousesOrders:{!! $warehousesOrders !!},
  133. orderCountingRecords:{!! $orderCountingRecords !!},
  134. logisticsCountingRecords:{!! $logisticsCountingRecords !!},
  135. warehouses: {},
  136. totalOrders: {
  137. total: null,
  138. createOrder: null,
  139. assignedComplete: null,
  140. partialAllocation: null,
  141. partPacking: null,
  142. sowComplete: null,
  143. },
  144. orderCountingRecordsDateTarget: [],
  145. orderCountingRecordsData: [],
  146. pickerOptions: {
  147. shortcuts: [{
  148. text: '最近一周',
  149. onClick(picker) {
  150. const end = new Date();
  151. const start = new Date();
  152. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  153. picker.$emit('pick', [start, end]);
  154. }
  155. }, {
  156. text: '最近一个月',
  157. onClick(picker) {
  158. const end = new Date();
  159. const start = new Date();
  160. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  161. picker.$emit('pick', [start, end]);
  162. }
  163. }, {
  164. text: '最近三个月',
  165. onClick(picker) {
  166. const end = new Date();
  167. const start = new Date();
  168. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  169. picker.$emit('pick', [start, end]);
  170. }
  171. }]
  172. },
  173. orderCountingRecordsDate: [
  174. moment(new Date(new Date().getTime() - 3600 * 1000 * 24 * 30)).format('yyyy-MM-DD'),
  175. moment(new Date()).format('yyyy-MM-DD')
  176. ],
  177. logisticsCountingRecordsData: [moment(new Date(new Date().getTime() - 3600 * 1000 * 24 * 30)).format('yyyy-MM-DD'),
  178. moment(new Date()).format('yyyy-MM-DD')],
  179. unit: '日'
  180. },
  181. mounted: function () {
  182. let _this = this;
  183. this.warehouses = {
  184. "WH01": '松江一仓',
  185. "WH02": '松江二仓',
  186. "WH03": '嘉定一仓',
  187. }
  188. this.warehousesOrders.forEach(function (item) {
  189. _this.totalOrders.total += parseInt(item.total);
  190. _this.totalOrders.createOrder += item.createOrder;
  191. _this.totalOrders.assignedComplete += item.assignedComplete;
  192. _this.totalOrders.partialAllocation += item.partialAllocation;
  193. _this.totalOrders.partPacking += item.partPacking;
  194. _this.totalOrders.sowComplete += item.sowComplete;
  195. });
  196. this.initOrderCountingRecords();
  197. this.orderCountingRecordsChart = echarts.init(document.getElementById('orderCountingRecords'));
  198. this.initOrderCountingRecordsChart();
  199. // this.initLogisticsCountingRecords();
  200. this.logisticsCountingRecordsChart = echarts.init(document.getElementById('logisticsCountingRecords'));
  201. this.initLogisticsCountingRecordsChart();
  202. },
  203. methods: {
  204. getWareHouse: function (code) {
  205. return this.warehouses[code];
  206. },
  207. initOrderCountingRecords() {
  208. let _this = this;
  209. this.orderCountingRecords.forEach(function (item) {
  210. _this.orderCountingRecordsDateTarget.push(item.date_target);
  211. _this.orderCountingRecordsData.push(item.counter);
  212. });
  213. },
  214. initLogisticsCountingRecords() {
  215. let _this = this;
  216. this.logisticsCountingRecords.forEach(function (item) {
  217. _this.orderCountingRecordsDateTarget.push(item.date_target);
  218. _this.orderCountingRecordsData.push(item.counter);
  219. });
  220. },
  221. initOrderCountingRecordsChart() {
  222. this.orderCountingRecordsChart.setOption({
  223. title: {text: '实时待处理订单'},
  224. tooltip: {},
  225. legend: {data: ['订单数']},
  226. xAxis: {
  227. type: 'category',
  228. data: this.orderCountingRecordsDateTarget
  229. },
  230. yAxis: {type: 'value'},
  231. series: [{
  232. data: this.orderCountingRecordsData,
  233. type: 'line',
  234. smooth: true
  235. }]
  236. });
  237. },
  238. initLogisticsCountingRecordsChart() {
  239. this.logisticsCountingRecordsChart.setOption({
  240. title: {
  241. text: '快递分布',
  242. left: 'left'
  243. },
  244. tooltip: {
  245. trigger: 'item',
  246. formatter: '{a} <br/>{b} : {c} ({d}%)'
  247. },
  248. series: [
  249. {
  250. name: '访问来源',
  251. type: 'pie',
  252. radius: '55%',
  253. center: ['50%', '60%'],
  254. data: this.logisticsCountingRecords,
  255. emphasis: {
  256. itemStyle: {
  257. shadowBlur: 10,
  258. shadowOffsetX: 0,
  259. shadowColor: 'rgba(0, 0, 0, 0.5)'
  260. }
  261. }
  262. }
  263. ]
  264. });
  265. },
  266. orderCountingRecordApi() {
  267. let formData = new FormData();
  268. formData.append('start', this.orderCountingRecordsDate[0]);
  269. formData.append('end', this.orderCountingRecordsDate[1]);
  270. formData.append('unit', this.unit);
  271. console.log(this.unit);
  272. let _this = this;
  273. axios.post('{{url('apiLocal/control/panel/menu/orderCountingRecordApi')}}', formData).then(function (res) {
  274. if (res.status === 200) {
  275. _this.orderCountingRecords = res.data.orderCountingRecords;
  276. _this.orderCountingRecordsDateTarget = [];
  277. _this.orderCountingRecordsData = [];
  278. _this.initOrderCountingRecords();
  279. _this.initOrderCountingRecordsChart();
  280. }
  281. });
  282. },
  283. logisticsCountingRecordsApi() {
  284. let formData = new FormData();
  285. formData.append('start', this.logisticsCountingRecordsData[0]);
  286. formData.append('end', this.logisticsCountingRecordsData[1]);
  287. let _this = this;
  288. axios.post('{{url('apiLocal/control/panel/menu/logisticsCountingRecordsApi')}}', formData).then(function (res) {
  289. if (res.status === 200) {
  290. _this.logisticsCountingRecords = res.data.logisticsCountingRecords;
  291. _this.initLogisticsCountingRecordsChart();
  292. }
  293. });
  294. }
  295. }
  296. });
  297. </script>
  298. @endsection