panel.blade.php 26 KB

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