panel.blade.php 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551
  1. @extends('layouts.app')
  2. @section('title')控制台@endsection
  3. @section('head')
  4. <link href="{{ mix('css/element-ui.css') }}" rel="stylesheet">
  5. @endsection
  6. @section('content')
  7. <div class="d-none" id="list">
  8. <div class="container-fluid">
  9. <div class="card">
  10. <h5 class="card-header">最近使用功能</h5>
  11. <div class="card-body row">
  12. <ul class="list-group" v-for="(menu,index) in menus">
  13. <div class="container-fluid btn-group justify-content-center">
  14. <a class="btn-primary btn-lg" v-if="index<=3" :href="'/'+menu.route">@{{ menu.name }}</a>
  15. </div>
  16. <div v-if="menu.secondLevelMenu && menu.secondLevelMenu.length>0&&index<=3">
  17. <div class="container-fluid btn-group m-1">
  18. <a class="bth btn-sm btn-info m-1" v-for="(secondMenu,index) in menu.secondLevelMenu"
  19. :href="'/'+secondMenu.route" v-if="index < 2"> @{{ secondMenu.name }}</a>
  20. </div>
  21. </div>
  22. </ul>
  23. </div>
  24. </div>
  25. <div class="row my-3">
  26. <div class="col-sm col-lg-2 col-xl-2 col-md-2">
  27. <div class="card">
  28. <div class="card-header text-dark h5">
  29. <p>实时待处理订(总):@{{ totalOrders.total }}</p>
  30. </div>
  31. <div class="card-body">
  32. <p>创建订单:@{{ totalOrders.createOrder }}</p>
  33. <p>分配完成:@{{ totalOrders.assignedComplete }}</p>
  34. <p>部分分配:@{{ totalOrders.partialAllocation }}</p>
  35. <p>部分装箱:@{{ totalOrders.partPacking }}</p>
  36. <p>分拨完成:@{{ totalOrders.sowComplete }}</p>
  37. </div>
  38. </div>
  39. </div>
  40. <div class="col-sm col-lg-2 col-xl-2 col-md-2" v-for="(warehousesOrder,index) in warehousesOrders">
  41. <div class="card">
  42. <div class="card-header text-success h5">
  43. <p>@{{ getWareHouse(warehousesOrder.code) }}:@{{ warehousesOrder.total }}</p>
  44. </div>
  45. <div class="card-body">
  46. <p>创建订单:@{{ warehousesOrder.createOrder }}</p>
  47. <p>分配完成:@{{ warehousesOrder.assignedComplete }}</p>
  48. <p>部分分配:@{{ warehousesOrder.partialAllocation }}</p>
  49. <p>部分装箱:@{{ warehousesOrder.partPacking }}</p>
  50. <p>分拨完成:@{{ warehousesOrder.sowComplete }}</p>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. <div class="row my-3">
  56. <div class="col-sm col-lg-5 col-xl-5 col-md-5">
  57. <div class="card">
  58. <div class="card-header">
  59. <span class="demonstration"></span>
  60. <el-date-picker @blur="orderCountingRecordApi('')"
  61. v-model="orderCountingRecordsDate"
  62. type="daterange"
  63. align="right"
  64. unlink-panels
  65. range-separator="-"
  66. start-placeholder="开始日期"
  67. end-placeholder="结束日期"
  68. value-format="yyyy-MM-dd"
  69. :picker-options="pickerOptions">
  70. </el-date-picker>
  71. <el-button type="primary" value="日" @click="orderCountingRecordApi('日')"
  72. v-model="orderCountingRecordsUnit">日
  73. </el-button>
  74. <el-button type="primary" value="月" @click="orderCountingRecordApi('月')"
  75. v-model="orderCountingRecordsUnit">月
  76. </el-button>
  77. </div>
  78. <div class="card-body row">
  79. <div v-show="orderCountingRecordsShow" id="orderCountingRecords" class="col"
  80. style="width:600px;height:600px;"></div>
  81. </div>
  82. <div v-show="!orderCountingRecordsShow" class="text-center">
  83. <h3>正在加载...</h3>
  84. </div>
  85. </div>
  86. </div>
  87. <div class="col-sm col-lg-7 col-xl-7 col-md-7">
  88. <div class="row">
  89. <div class="col-sm col-lg-5 col-xl-5 col-md-5">
  90. <div class="card">
  91. <div class="card-header">
  92. <div class="col-5 row">
  93. <div class="block">
  94. <span class="demonstration"></span>
  95. <el-date-picker @blur="logisticsCountingRecordsApi()"
  96. v-model="logisticsCountingRecordsData"
  97. type="daterange"
  98. align="right"
  99. unlink-panels
  100. range-separator="-"
  101. start-placeholder="开始日期"
  102. end-placeholder="结束日期"
  103. value-format="yyyy-MM-dd"
  104. :picker-options="pickerOptions">
  105. </el-date-picker>
  106. </div>
  107. </div>
  108. </div>
  109. <div class="card-body row">
  110. <div v-show="logisticsCountingRecordsShow" id="logisticsCountingRecords" class="col"
  111. style="width: 600px;height:600px;"></div>
  112. <div v-show="!logisticsCountingRecordsShow" class="text-center">
  113. <h3>正在加载...</h3>
  114. </div>
  115. </div>
  116. </div>
  117. </div>
  118. <div class="col-sm col-lg-5 col-xl-5 col-md-5">
  119. <div class="card">
  120. <div class="card-header">
  121. <div class="col-5 row">
  122. <div class="block">
  123. <span class="demonstration"></span>
  124. <el-date-picker @blur="warehouseCountingRecordsApi()"
  125. v-model="warehouseCountingRecordsData"
  126. type="daterange"
  127. align="right"
  128. unlink-panels
  129. range-separator="-"
  130. start-placeholder="开始日期"
  131. end-placeholder="结束日期"
  132. value-format="yyyy-MM-dd"
  133. :picker-options="pickerOptions">
  134. </el-date-picker>
  135. </div>
  136. </div>
  137. </div>
  138. <div class="card-body row">
  139. <div v-show="warehouseCountingRecordsShow" id="warehouseCountingRecords" class="col"
  140. style="width: 600px;height:600px;"></div>
  141. <div v-show="!warehouseCountingRecordsShow">
  142. 正在加载
  143. </div>
  144. </div>
  145. </div>
  146. </div>
  147. </div>
  148. </div>
  149. @can('人事管理-临时工报表-可见全部组')
  150. <div class="col-sm col-lg-5 col-xl-5 col-md-5">
  151. <div class="card">
  152. <div class="card-header">
  153. <span class="demonstration"></span>
  154. <el-date-picker @blur="laborReportsCountingRecordApi('')"
  155. v-model="laborReportsCountingRecordsDate"
  156. type="daterange"
  157. align="right"
  158. unlink-panels
  159. range-separator="-"
  160. start-placeholder="开始日期"
  161. end-placeholder="结束日期"
  162. value-format="yyyy-MM-dd"
  163. :picker-options="pickerOptions">
  164. </el-date-picker>
  165. <el-button type="primary" value="日" @click="laborReportsCountingRecordApi('日')"
  166. v-model="laborReportsCountingRecordUnit">日
  167. </el-button>
  168. <el-button type="primary" value="月" @click="laborReportsCountingRecordApi('月')"
  169. v-model="laborReportsCountingRecordUnit">月
  170. </el-button>
  171. </div>
  172. <div class="card-body row">
  173. <div v-show="laborReportsCountingRecordsShow" id="laborReportsCountingRecords"
  174. class="col"
  175. style="width:600px;height:600px;"></div>
  176. <div v-show="!laborReportsCountingRecordsShow">
  177. 正在加载
  178. </div>
  179. </div>
  180. </div>
  181. </div>
  182. <div class="col-sm col-lg-7 col-xl-5 col-md-5">
  183. <div class="card">
  184. <div class="card-header">
  185. <span class="demonstration"></span>
  186. <el-date-picker @blur="laborReportsUserGroupsCountApi('')"
  187. v-model="laborReportsUserGroupsCountDate"
  188. type="daterange"
  189. align="right"
  190. unlink-panels
  191. range-separator="-"
  192. start-placeholder="开始日期"
  193. end-placeholder="结束日期"
  194. value-format="yyyy-MM-dd"
  195. :picker-options="pickerOptions">
  196. </el-date-picker>
  197. </div>
  198. <div class="card-body row">
  199. <div v-show="laborReportsUserGroupsCountShow" id="laborReportsUserGroupsCount"
  200. class="col"
  201. style="width:600px;height:600px;"></div>
  202. <div v-show="!laborReportsUserGroupsCountShow">
  203. 正在加载
  204. </div>
  205. </div>
  206. </div>
  207. </div>
  208. @endcan
  209. </div>
  210. </div>
  211. </div>
  212. @endsection
  213. @section('lastScript')
  214. <script src="{{ mix('js/echarts.js') }}"></script>
  215. <!-- 引入样式 -->
  216. <!-- 引入组件库 -->
  217. <script src="{{ mix('js/element-ui.js') }}"></script>
  218. <script>
  219. let vue = new Vue({
  220. el: "#list",
  221. data: {
  222. myChart: null,
  223. menus:{!! $menus !!},
  224. warehousesOrders:{!! $warehousesOrders !!},
  225. orderCountingRecords:{!! $orderCountingRecords !!},
  226. logisticsCountingRecords:{!! $logisticsCountingRecords !!},
  227. warehouseCountingRecords:{!! $warehouseCountingRecords !!},
  228. laborReportsCountingRecords:{!! $laborReportsCountingRecords !!},
  229. laborReportsUserGroupsCount:{!! $laborReportsUserGroupsCount !!},
  230. warehouses: {},
  231. totalOrders: {
  232. total: null,
  233. createOrder: null,
  234. assignedComplete: null,
  235. partialAllocation: null,
  236. partPacking: null,
  237. sowComplete: null,
  238. },
  239. orderCountingRecordsDateTarget: [],
  240. orderCountingRecordsData: [],
  241. laborReportsCountingRecordsDateTarget: [],
  242. laborReportsCountingRecordsData: [],
  243. pickerOptions: {
  244. shortcuts: [{
  245. text: '最近一周',
  246. onClick(picker) {
  247. const end = new Date();
  248. const start = new Date();
  249. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  250. picker.$emit('pick', [start, end]);
  251. }
  252. }, {
  253. text: '最近一个月',
  254. onClick(picker) {
  255. const end = new Date();
  256. const start = new Date();
  257. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  258. picker.$emit('pick', [start, end]);
  259. }
  260. }, {
  261. text: '最近三个月',
  262. onClick(picker) {
  263. const end = new Date();
  264. const start = new Date();
  265. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  266. picker.$emit('pick', [start, end]);
  267. }
  268. }]
  269. },
  270. orderCountingRecordsDate: [moment().subtract('1', 'month').format('yyyy-MM-DD'),
  271. moment(new Date()).format('yyyy-MM-DD')],
  272. logisticsCountingRecordsData: [moment().subtract('1', 'month').format('yyyy-MM-DD'),
  273. moment(new Date()).format('yyyy-MM-DD')],
  274. warehouseCountingRecordsData: [moment().subtract('1', 'month').format('yyyy-MM-DD'),
  275. moment(new Date()).format('yyyy-MM-DD')],
  276. laborReportsCountingRecordsDate: [moment().subtract('1', 'month').format('yyyy-MM-DD'),
  277. moment(new Date()).format('yyyy-MM-DD')],
  278. laborReportsUserGroupsCountDate: [moment().subtract('1', 'month').format('yyyy-MM-DD'),
  279. moment(new Date()).format('yyyy-MM-DD')],
  280. orderCountingRecordsUnit: '日',
  281. laborReportsCountingRecordUnit: '日',
  282. orderCountingRecordsShow: true,
  283. logisticsCountingRecordsShow: true,
  284. warehouseCountingRecordsShow: true,
  285. laborReportsCountingRecordsShow: true,
  286. laborReportsUserGroupsCountShow: true,
  287. },
  288. mounted: function () {
  289. $('#list').removeClass('d-none');
  290. let _this = this;
  291. this.warehouses = {
  292. "WH01": '松江一仓',
  293. "WH02": '松江二仓',
  294. "WH03": '嘉定一仓',
  295. }
  296. this.warehousesOrders.forEach(function (item) {
  297. _this.totalOrders.total += parseInt(item.total);
  298. _this.totalOrders.createOrder += item.createOrder;
  299. _this.totalOrders.assignedComplete += item.assignedComplete;
  300. _this.totalOrders.partialAllocation += item.partialAllocation;
  301. _this.totalOrders.partPacking += item.partPacking;
  302. _this.totalOrders.sowComplete += item.sowComplete;
  303. });
  304. this.initOrderCountingRecords();
  305. this.orderCountingRecordsChart = echarts.init(document.getElementById('orderCountingRecords'));
  306. this.initOrderCountingRecordsChart();
  307. this.logisticsCountingRecordsChart = echarts.init(document.getElementById('logisticsCountingRecords'));
  308. this.initLogisticsCountingRecordsChart();
  309. this.warehouseCountingRecordsChart = echarts.init(document.getElementById('warehouseCountingRecords'));
  310. this.initWarehouseCountingRecordsChart();
  311. this.initLaborReportsCountingRecords();
  312. this.laborReportsCountingRecordsChart = echarts.init(document.getElementById('laborReportsCountingRecords'));
  313. this.initLaborReportsCountingRecordsChart();
  314. this.laborReportsUserGroupsCountChart = echarts.init(document.getElementById('laborReportsUserGroupsCount'));
  315. this.initLaborReportsUserGroupsCountChart();
  316. },
  317. methods: {
  318. getWareHouse: function (code) {
  319. return this.warehouses[code];
  320. },
  321. initOrderCountingRecords() {
  322. for (let key in this.orderCountingRecords) {
  323. this.orderCountingRecordsDateTarget.push(this.orderCountingRecords[key].date_target);
  324. this.orderCountingRecordsData.push(this.orderCountingRecords[key].counter);
  325. }
  326. },
  327. initOrderCountingRecordsChart() {
  328. this.orderCountingRecordsChart.setOption({
  329. title: {text: '订单量趋势'},
  330. tooltip: {},
  331. legend: {data: ['订单数']},
  332. xAxis: {
  333. type: 'category',
  334. data: this.orderCountingRecordsDateTarget
  335. },
  336. yAxis: {type: 'value'},
  337. series: [{
  338. data: this.orderCountingRecordsData,
  339. type: 'line',
  340. smooth: true
  341. }]
  342. });
  343. },
  344. initLaborReportsCountingRecordsChart() {
  345. this.laborReportsCountingRecordsChart.setOption({
  346. title: {text: '临时用工趋势'},
  347. tooltip: {},
  348. legend: {data: ['临时用工数']},
  349. xAxis: {
  350. type: 'category',
  351. data: this.laborReportsCountingRecordsDateTarget
  352. },
  353. yAxis: {type: 'value'},
  354. series: [{
  355. data: this.laborReportsCountingRecordsData,
  356. type: 'line',
  357. smooth: true
  358. }]
  359. });
  360. },
  361. initLogisticsCountingRecordsChart() {
  362. this.logisticsCountingRecordsChart.setOption({
  363. title: {
  364. text: '快递分布',
  365. left: 'left'
  366. },
  367. tooltip: {
  368. trigger: 'item',
  369. formatter: '{a} <br/>{b} : {c} ({d}%)'
  370. },
  371. series: [
  372. {
  373. name: '快递分布',
  374. type: 'pie',
  375. radius: '55%',
  376. center: ['50%', '60%'],
  377. data: this.logisticsCountingRecords,
  378. emphasis: {
  379. itemStyle: {
  380. shadowBlur: 10,
  381. shadowOffsetX: 0,
  382. shadowColor: 'rgba(0, 0, 0, 0.5)'
  383. }
  384. }
  385. }
  386. ]
  387. });
  388. },
  389. initWarehouseCountingRecordsChart() {
  390. this.warehouseCountingRecordsChart.setOption({
  391. title: {
  392. text: '仓库分布',
  393. left: 'left'
  394. },
  395. tooltip: {
  396. trigger: 'item',
  397. formatter: '{a} <br/>{b} : {c} ({d}%)'
  398. },
  399. series: [
  400. {
  401. name: '仓库分布',
  402. type: 'pie',
  403. radius: '55%',
  404. center: ['50%', '60%'],
  405. data: this.warehouseCountingRecords,
  406. emphasis: {
  407. itemStyle: {
  408. shadowBlur: 10,
  409. shadowOffsetX: 0,
  410. shadowColor: 'rgba(0, 0, 0, 0.5)'
  411. }
  412. }
  413. }
  414. ]
  415. });
  416. },
  417. initLaborReportsUserGroupsCountChart() {
  418. this.laborReportsUserGroupsCountChart.setOption({
  419. title: {
  420. text: '小组临时工分布',
  421. left: 'left'
  422. },
  423. tooltip: {
  424. trigger: 'item',
  425. formatter: '{a} <br/>{b} : {c} ({d}%)'
  426. },
  427. series: [
  428. {
  429. name: '小组临时工分布',
  430. type: 'pie',
  431. radius: '55%',
  432. center: ['50%', '60%'],
  433. data: this.laborReportsUserGroupsCount,
  434. emphasis: {
  435. itemStyle: {
  436. shadowBlur: 10,
  437. shadowOffsetX: 0,
  438. shadowColor: 'rgba(0, 0, 0, 0.5)'
  439. }
  440. }
  441. }
  442. ]
  443. });
  444. },
  445. initLaborReportsCountingRecords() {
  446. let _this = this;
  447. this.laborReportsCountingRecords.forEach(function (item) {
  448. _this.laborReportsCountingRecordsDateTarget.push(item.date_target);
  449. _this.laborReportsCountingRecordsData.push(item.counter);
  450. });
  451. },
  452. orderCountingRecordApi(orderCountingRecordsUnit) {
  453. if (orderCountingRecordsUnit === '') {
  454. orderCountingRecordsUnit = this.orderCountingRecordsUnit;
  455. }
  456. this.orderCountingRecordsUnit = orderCountingRecordsUnit;
  457. let formData = new FormData();
  458. formData.append('start', this.orderCountingRecordsDate[0]);
  459. formData.append('end', this.orderCountingRecordsDate[1]);
  460. formData.append('unit', orderCountingRecordsUnit);
  461. this.orderCountingRecordsShow = false;
  462. let _this = this;
  463. axios.post('{{url('apiLocal/control/panel/menu/orderCountingRecordApi')}}', formData).then(function (res) {
  464. if (res.status === 200) {
  465. _this.orderCountingRecords = res.data.orderCountingRecords;
  466. _this.orderCountingRecordsDateTarget = [];
  467. _this.orderCountingRecordsData = [];
  468. _this.initOrderCountingRecords();
  469. _this.initOrderCountingRecordsChart();
  470. _this.orderCountingRecordsShow = true;
  471. }
  472. });
  473. },
  474. logisticsCountingRecordsApi() {
  475. this.logisticsCountingRecordsShow = false;
  476. let formData = new FormData();
  477. formData.append('start', this.logisticsCountingRecordsData[0]);
  478. formData.append('end', this.logisticsCountingRecordsData[1]);
  479. let _this = this;
  480. axios.post('{{url('apiLocal/control/panel/menu/logisticsCountingRecordsApi')}}', formData).then(function (res) {
  481. if (res.status === 200) {
  482. _this.logisticsCountingRecords = res.data.logisticsCountingRecords;
  483. _this.initLogisticsCountingRecordsChart();
  484. _this.logisticsCountingRecordsShow = true;
  485. }
  486. });
  487. },
  488. warehouseCountingRecordsApi() {
  489. this.warehouseCountingRecordsShow = false;
  490. let formData = new FormData();
  491. formData.append('start', this.warehouseCountingRecordsData[0]);
  492. formData.append('end', this.warehouseCountingRecordsData[1]);
  493. let _this = this;
  494. axios.post('{{url('apiLocal/control/panel/menu/warehouseCountingRecordsApi')}}', formData).then(function (res) {
  495. if (res.status === 200) {
  496. _this.warehouseCountingRecords = res.data.warehouseCountingRecords;
  497. _this.initWarehouseCountingRecordsChart();
  498. _this.warehouseCountingRecordsShow = true;
  499. }
  500. });
  501. },
  502. laborReportsCountingRecordApi(laborReportsCountingRecordUnit) {
  503. this.laborReportsCountingRecordsShow = false;
  504. if (laborReportsCountingRecordUnit === '') {
  505. laborReportsCountingRecordUnit = this.laborReportsCountingRecordUnit;
  506. }
  507. this.laborReportsCountingRecordUnit = laborReportsCountingRecordUnit;
  508. let formData = new FormData();
  509. formData.append('start', this.laborReportsCountingRecordsDate[0]);
  510. formData.append('end', this.laborReportsCountingRecordsDate[1]);
  511. formData.append('unit', laborReportsCountingRecordUnit);
  512. let _this = this;
  513. axios.post('{{url('apiLocal/control/panel/menu/laborReportsCountingRecordApi')}}', formData).then(function (res) {
  514. if (res.status === 200) {
  515. _this.laborReportsCountingRecords = res.data.laborReportsCountingRecords;
  516. _this.laborReportsCountingRecordsDateTarget = [];
  517. _this.laborReportsCountingRecordsData = [];
  518. _this.initLaborReportsCountingRecords();
  519. _this.initLaborReportsCountingRecordsChart();
  520. _this.laborReportsCountingRecordsShow = true;
  521. }
  522. });
  523. },
  524. laborReportsUserGroupsCountApi() {
  525. this.laborReportsUserGroupsCountShow = false;
  526. let formData = new FormData();
  527. formData.append('start', this.laborReportsUserGroupsCountDate[0]);
  528. formData.append('end', this.laborReportsUserGroupsCountDate[1]);
  529. let _this = this;
  530. axios.post('{{url('apiLocal/control/panel/menu/laborReportsUserGroupsCountApi')}}', formData).then(function (res) {
  531. if (res.status === 200) {
  532. _this.laborReportsUserGroupsCount = res.data.laborReportsUserGroupsCount;
  533. _this.initLaborReportsUserGroupsCountChart();
  534. _this.laborReportsUserGroupsCountShow = true;
  535. }
  536. });
  537. },
  538. }
  539. });
  540. </script>
  541. @endsection