panel.blade.php 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503
  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. <span class="demonstration" ></span>
  56. <el-date-picker @blur="orderCountingRecordApi('')"
  57. v-model="orderCountingRecordsDate"
  58. type="daterange"
  59. align="right"
  60. unlink-panels
  61. range-separator="-"
  62. start-placeholder="开始日期"
  63. end-placeholder="结束日期"
  64. value-format="yyyy-MM-dd"
  65. :picker-options="pickerOptions">
  66. </el-date-picker>
  67. <el-button type="primary" value="日" @click="orderCountingRecordApi('日')" v-model="orderCountingRecordsUnit">日</el-button>
  68. <el-button type="primary" value="周" @click="orderCountingRecordApi('周')" v-model="orderCountingRecordsUnit">周</el-button>
  69. <el-button type="primary" value="月" @click="orderCountingRecordApi('月')" v-model="orderCountingRecordsUnit">月</el-button>
  70. </div>
  71. <div class="card-body row">
  72. <div id="orderCountingRecords" class="col" style="width:600px;height:600px;"></div>
  73. </div>
  74. </div>
  75. </div>
  76. <div class="col-7">
  77. <div class="row">
  78. <div class="col-6">
  79. <div class="card">
  80. <div class="card-header">
  81. <div class="col-5 row">
  82. <div class="block">
  83. <span class="demonstration"></span>
  84. <el-date-picker @blur="logisticsCountingRecordsApi()"
  85. v-model="logisticsCountingRecordsData"
  86. type="daterange"
  87. align="right"
  88. unlink-panels
  89. range-separator="-"
  90. start-placeholder="开始日期"
  91. end-placeholder="结束日期"
  92. value-format="yyyy-MM-dd"
  93. :picker-options="pickerOptions">
  94. </el-date-picker>
  95. </div>
  96. </div>
  97. </div>
  98. <div class="card-body row">
  99. <div id="logisticsCountingRecords" class="col"
  100. style="width: 600px;height:600px;"></div>
  101. </div>
  102. </div>
  103. </div>
  104. <div class="col-6">
  105. <div class="card">
  106. <div class="card-header">
  107. <div class="col-5 row">
  108. <div class="block">
  109. <span class="demonstration"></span>
  110. <el-date-picker @blur="warehouseCountingRecordsApi()"
  111. v-model="warehouseCountingRecordsData"
  112. type="daterange"
  113. align="right"
  114. unlink-panels
  115. range-separator="-"
  116. start-placeholder="开始日期"
  117. end-placeholder="结束日期"
  118. value-format="yyyy-MM-dd"
  119. :picker-options="pickerOptions">
  120. </el-date-picker>
  121. </div>
  122. </div>
  123. </div>
  124. <div class="card-body row">
  125. <div id="warehouseCountingRecords" class="col"
  126. style="width: 600px;height:600px;"></div>
  127. </div>
  128. </div>
  129. </div>
  130. </div>
  131. </div>
  132. <div class="col-5">
  133. <div class="card">
  134. <div class="card-header">
  135. <span class="demonstration" ></span>
  136. <el-date-picker @blur="laborReportsCountingRecordApi('')"
  137. v-model="laborReportsCountingRecordsDate"
  138. type="daterange"
  139. align="right"
  140. unlink-panels
  141. range-separator="-"
  142. start-placeholder="开始日期"
  143. end-placeholder="结束日期"
  144. value-format="yyyy-MM-dd"
  145. :picker-options="pickerOptions">
  146. </el-date-picker>
  147. <el-button type="primary" value="日" @click="laborReportsCountingRecordApi('日')" v-model="laborReportsCountingRecordUnit">日</el-button>
  148. <el-button type="primary" value="周" @click="laborReportsCountingRecordApi('周')" v-model="laborReportsCountingRecordUnit">周</el-button>
  149. <el-button type="primary" value="月" @click="laborReportsCountingRecordApi('月')" v-model="laborReportsCountingRecordUnit">月</el-button>
  150. </div>
  151. <div class="card-body row">
  152. <div id="laborReportsCountingRecords" class="col" style="width:600px;height:600px;"></div>
  153. </div>
  154. </div>
  155. </div>
  156. <div class="col-7">
  157. <div class="card">
  158. <div class="card-header">
  159. <span class="demonstration" ></span>
  160. <el-date-picker @blur="laborReportsUserGroupsCountApi('')"
  161. v-model="laborReportsUserGroupsCountDate"
  162. type="daterange"
  163. align="right"
  164. unlink-panels
  165. range-separator="-"
  166. start-placeholder="开始日期"
  167. end-placeholder="结束日期"
  168. value-format="yyyy-MM-dd"
  169. :picker-options="pickerOptions">
  170. </el-date-picker>
  171. </div>
  172. <div class="card-body row">
  173. <div id="laborReportsUserGroupsCount" class="col" style="width:600px;height:600px;"></div>
  174. </div>
  175. </div>
  176. </div>
  177. </div>
  178. </div>
  179. @endsection
  180. @section('lastScript')
  181. <script src="{{ mix('js/echarts.js') }}"></script>
  182. <!-- 引入样式 -->
  183. <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
  184. <!-- 引入组件库 -->
  185. <script src="https://unpkg.com/element-ui/lib/index.js"></script>
  186. <script>
  187. let vue = new Vue({
  188. el: "#list",
  189. data: {
  190. myChart: null,
  191. menus:{!! $menus !!},
  192. warehousesOrders:{!! $warehousesOrders !!},
  193. orderCountingRecords:{!! $orderCountingRecords !!},
  194. logisticsCountingRecords:{!! $logisticsCountingRecords !!},
  195. warehouseCountingRecords:{!! $warehouseCountingRecords !!},
  196. laborReportsCountingRecords:{!! $laborReportsCountingRecords !!},
  197. laborReportsUserGroupsCount:{!! $laborReportsUserGroupsCount !!},
  198. warehouses: {},
  199. totalOrders: {
  200. total: null,
  201. createOrder: null,
  202. assignedComplete: null,
  203. partialAllocation: null,
  204. partPacking: null,
  205. sowComplete: null,
  206. },
  207. orderCountingRecordsDateTarget: [],
  208. orderCountingRecordsData: [],
  209. laborReportsCountingRecordsDateTarget: [],
  210. laborReportsCountingRecordsData: [],
  211. pickerOptions: {
  212. shortcuts: [{
  213. text: '最近一周',
  214. onClick(picker) {
  215. const end = new Date();
  216. const start = new Date();
  217. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  218. picker.$emit('pick', [start, end]);
  219. }
  220. }, {
  221. text: '最近一个月',
  222. onClick(picker) {
  223. const end = new Date();
  224. const start = new Date();
  225. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  226. picker.$emit('pick', [start, end]);
  227. }
  228. }, {
  229. text: '最近三个月',
  230. onClick(picker) {
  231. const end = new Date();
  232. const start = new Date();
  233. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  234. picker.$emit('pick', [start, end]);
  235. }
  236. }]
  237. },
  238. orderCountingRecordsDate: [moment(new Date(new Date().getTime() - 3600 * 1000 * 24 * 30)).format('yyyy-MM-DD'),
  239. moment(new Date()).format('yyyy-MM-DD')],
  240. logisticsCountingRecordsData: [moment(new Date(new Date().getTime() - 3600 * 1000 * 24 * 30)).format('yyyy-MM-DD'),
  241. moment(new Date()).format('yyyy-MM-DD')],
  242. warehouseCountingRecordsData: [moment(new Date(new Date().getTime() - 3600 * 1000 * 24 * 30)).format('yyyy-MM-DD'),
  243. moment(new Date()).format('yyyy-MM-DD')],
  244. laborReportsCountingRecordsDate: [moment(new Date(new Date().getTime() - 3600 * 1000 * 24 * 30)).format('yyyy-MM-DD'),
  245. moment(new Date()).format('yyyy-MM-DD')],
  246. laborReportsUserGroupsCountDate: [moment(new Date(new Date().getTime() - 3600 * 1000 * 24 * 30)).format('yyyy-MM-DD'),
  247. moment(new Date()).format('yyyy-MM-DD')],
  248. orderCountingRecordsUnit: '日',
  249. laborReportsCountingRecordUnit: '日'
  250. },
  251. mounted: function () {
  252. let _this = this;
  253. this.warehouses = {
  254. "WH01": '松江一仓',
  255. "WH02": '松江二仓',
  256. "WH03": '嘉定一仓',
  257. }
  258. this.warehousesOrders.forEach(function (item) {
  259. _this.totalOrders.total += parseInt(item.total);
  260. _this.totalOrders.createOrder += item.createOrder;
  261. _this.totalOrders.assignedComplete += item.assignedComplete;
  262. _this.totalOrders.partialAllocation += item.partialAllocation;
  263. _this.totalOrders.partPacking += item.partPacking;
  264. _this.totalOrders.sowComplete += item.sowComplete;
  265. });
  266. this.initOrderCountingRecords();
  267. this.orderCountingRecordsChart = echarts.init(document.getElementById('orderCountingRecords'));
  268. this.initOrderCountingRecordsChart();
  269. this.logisticsCountingRecordsChart = echarts.init(document.getElementById('logisticsCountingRecords'));
  270. this.initLogisticsCountingRecordsChart();
  271. this.warehouseCountingRecordsChart = echarts.init(document.getElementById('warehouseCountingRecords'));
  272. this.initWarehouseCountingRecordsChart();
  273. this.initLaborReportsCountingRecords();
  274. this.laborReportsCountingRecordsChart = echarts.init(document.getElementById('laborReportsCountingRecords'));
  275. this.initLaborReportsCountingRecordsChart();
  276. this.laborReportsUserGroupsCountChart = echarts.init(document.getElementById('laborReportsUserGroupsCount'));
  277. this.initLaborReportsUserGroupsCountChart();
  278. },
  279. methods: {
  280. getWareHouse: function (code) {
  281. return this.warehouses[code];
  282. },
  283. initOrderCountingRecords() {
  284. let _this = this;
  285. this.orderCountingRecords.forEach(function (item) {
  286. _this.orderCountingRecordsDateTarget.push(item.date_target);
  287. _this.orderCountingRecordsData.push(item.counter);
  288. });
  289. },
  290. initOrderCountingRecordsChart() {
  291. this.orderCountingRecordsChart.setOption({
  292. title: {text: '订单量趋势'},
  293. tooltip: {},
  294. legend: {data: ['订单数']},
  295. xAxis: {
  296. type: 'category',
  297. data: this.orderCountingRecordsDateTarget
  298. },
  299. yAxis: {type: 'value'},
  300. series: [{
  301. data: this.orderCountingRecordsData,
  302. type: 'line',
  303. smooth: true
  304. }]
  305. });
  306. },
  307. initLaborReportsCountingRecordsChart() {
  308. this.laborReportsCountingRecordsChart.setOption({
  309. title: {text: '临时用工趋势'},
  310. tooltip: {},
  311. legend: {data: ['临时用工数']},
  312. xAxis: {
  313. type: 'category',
  314. data: this.laborReportsCountingRecordsDateTarget
  315. },
  316. yAxis: {type: 'value'},
  317. series: [{
  318. data: this.laborReportsCountingRecordsData,
  319. type: 'line',
  320. smooth: true
  321. }]
  322. });
  323. },
  324. initLogisticsCountingRecordsChart() {
  325. this.logisticsCountingRecordsChart.setOption({
  326. title: {
  327. text: '快递分布',
  328. left: 'left'
  329. },
  330. tooltip: {
  331. trigger: 'item',
  332. formatter: '{a} <br/>{b} : {c} ({d}%)'
  333. },
  334. series: [
  335. {
  336. name: '访问来源',
  337. type: 'pie',
  338. radius: '55%',
  339. center: ['50%', '60%'],
  340. data: this.logisticsCountingRecords,
  341. emphasis: {
  342. itemStyle: {
  343. shadowBlur: 10,
  344. shadowOffsetX: 0,
  345. shadowColor: 'rgba(0, 0, 0, 0.5)'
  346. }
  347. }
  348. }
  349. ]
  350. });
  351. },
  352. initWarehouseCountingRecordsChart() {
  353. this.warehouseCountingRecordsChart.setOption({
  354. title: {
  355. text: '仓库分布',
  356. left: 'left'
  357. },
  358. tooltip: {
  359. trigger: 'item',
  360. formatter: '{a} <br/>{b} : {c} ({d}%)'
  361. },
  362. series: [
  363. {
  364. name: '访问来源',
  365. type: 'pie',
  366. radius: '55%',
  367. center: ['50%', '60%'],
  368. data: this.warehouseCountingRecords,
  369. emphasis: {
  370. itemStyle: {
  371. shadowBlur: 10,
  372. shadowOffsetX: 0,
  373. shadowColor: 'rgba(0, 0, 0, 0.5)'
  374. }
  375. }
  376. }
  377. ]
  378. });
  379. },
  380. initLaborReportsUserGroupsCountChart() {
  381. this.laborReportsUserGroupsCountChart.setOption({
  382. title: {
  383. text: '小组临时工分布',
  384. left: 'left'
  385. },
  386. tooltip: {
  387. trigger: 'item',
  388. formatter: '{a} <br/>{b} : {c} ({d}%)'
  389. },
  390. series: [
  391. {
  392. name: '访问来源',
  393. type: 'pie',
  394. radius: '55%',
  395. center: ['50%', '60%'],
  396. data: this.laborReportsUserGroupsCount,
  397. emphasis: {
  398. itemStyle: {
  399. shadowBlur: 10,
  400. shadowOffsetX: 0,
  401. shadowColor: 'rgba(0, 0, 0, 0.5)'
  402. }
  403. }
  404. }
  405. ]
  406. });
  407. },
  408. initLaborReportsCountingRecords() {
  409. let _this = this;
  410. this.laborReportsCountingRecords.forEach(function (item) {
  411. _this.laborReportsCountingRecordsDateTarget.push(item.date_target);
  412. _this.laborReportsCountingRecordsData.push(item.counter);
  413. });
  414. },
  415. orderCountingRecordApi(orderCountingRecordsUnit) {
  416. if (orderCountingRecordsUnit === '') {
  417. orderCountingRecordsUnit = this.orderCountingRecordsUnit;
  418. }
  419. this.orderCountingRecordsUnit = orderCountingRecordsUnit;
  420. let formData = new FormData();
  421. formData.append('start', this.orderCountingRecordsDate[0]);
  422. formData.append('end', this.orderCountingRecordsDate[1]);
  423. formData.append('unit', orderCountingRecordsUnit);
  424. let _this = this;
  425. axios.post('{{url('apiLocal/control/panel/menu/orderCountingRecordApi')}}', formData).then(function (res) {
  426. if (res.status === 200) {
  427. _this.orderCountingRecords = res.data.orderCountingRecords;
  428. _this.orderCountingRecordsDateTarget = [];
  429. _this.orderCountingRecordsData = [];
  430. _this.initOrderCountingRecords();
  431. _this.initOrderCountingRecordsChart();
  432. }
  433. });
  434. },
  435. logisticsCountingRecordsApi() {
  436. let formData = new FormData();
  437. formData.append('start', this.logisticsCountingRecordsData[0]);
  438. formData.append('end', this.logisticsCountingRecordsData[1]);
  439. let _this = this;
  440. axios.post('{{url('apiLocal/control/panel/menu/logisticsCountingRecordsApi')}}', formData).then(function (res) {
  441. if (res.status === 200) {
  442. _this.logisticsCountingRecords = res.data.logisticsCountingRecords;
  443. _this.initLogisticsCountingRecordsChart();
  444. }
  445. });
  446. },
  447. warehouseCountingRecordsApi() {
  448. let formData = new FormData();
  449. formData.append('start', this.warehouseCountingRecordsData[0]);
  450. formData.append('end', this.warehouseCountingRecordsData[1]);
  451. let _this = this;
  452. axios.post('{{url('apiLocal/control/panel/menu/warehouseCountingRecordsApi')}}', formData).then(function (res) {
  453. if (res.status === 200) {
  454. _this.warehouseCountingRecords = res.data.warehouseCountingRecords;
  455. _this.initWarehouseCountingRecordsChart();
  456. }
  457. });
  458. },
  459. laborReportsCountingRecordApi(laborReportsCountingRecordUnit) {
  460. if (laborReportsCountingRecordUnit === '') {
  461. laborReportsCountingRecordUnit = this.laborReportsCountingRecordUnit;
  462. }
  463. this.laborReportsCountingRecordUnit = laborReportsCountingRecordUnit;
  464. let formData = new FormData();
  465. formData.append('start', this.laborReportsCountingRecordsDate[0]);
  466. formData.append('end', this.laborReportsCountingRecordsDate[1]);
  467. formData.append('unit', laborReportsCountingRecordUnit);
  468. let _this = this;
  469. axios.post('{{url('apiLocal/control/panel/menu/laborReportsCountingRecordApi')}}', formData).then(function (res) {
  470. if (res.status === 200) {
  471. _this.laborReportsCountingRecords = res.data.laborReportsCountingRecords;
  472. _this.laborReportsCountingRecordsDateTarget = [];
  473. _this.laborReportsCountingRecordsData = [];
  474. _this.initLaborReportsCountingRecords();
  475. _this.initLaborReportsCountingRecordsChart();
  476. }
  477. });
  478. },
  479. laborReportsUserGroupsCountApi() {
  480. let formData = new FormData();
  481. formData.append('start', this.laborReportsUserGroupsCountDate[0]);
  482. formData.append('end', this.laborReportsUserGroupsCountDate[1]);
  483. let _this = this;
  484. axios.post('{{url('apiLocal/control/panel/menu/laborReportsUserGroupsCountApi')}}', formData).then(function (res) {
  485. if (res.status === 200) {
  486. _this.laborReportsUserGroupsCount = res.data.laborReportsUserGroupsCount;
  487. _this.initLaborReportsUserGroupsCountChart();
  488. }
  489. });
  490. },
  491. }
  492. });
  493. </script>
  494. @endsection