panel.blade.php 30 KB

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