panel.blade.php 30 KB

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