panel.blade.php 30 KB

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