panel.blade.php 59 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037
  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-3 col-lg-3 col-xl-3 col-md-3">
  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-2 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-6">
  57. <div class="card">
  58. <div class="card-header">
  59. <div class="row">
  60. <span v-show="orderCountingRecordsDayShow" class="demonstration mt-1">起始日期:</span>
  61. <el-date-picker
  62. size="small"
  63. @blur="orderCountingRecordApi('')"
  64. v-show="orderCountingRecordsDayShow"
  65. v-model="orderCountingRecordsStart"
  66. type="date"
  67. value-format="yyyy-MM-dd"
  68. placeholder="选起始日期">
  69. </el-date-picker>
  70. <span v-show="orderCountingRecordsDayShow" class="demonstration mt-1">结束日期:</span>
  71. <el-date-picker
  72. size="small"
  73. @blur="orderCountingRecordApi('')"
  74. v-show="orderCountingRecordsDayShow"
  75. v-model="orderCountingRecordsEnd"
  76. type="date"
  77. value-format="yyyy-MM-dd"
  78. placeholder="选择结束日期">
  79. </el-date-picker>
  80. <span v-show="orderCountingRecordsMonthShow" class="demonstration mt-1">起始月:</span>
  81. <el-date-picker
  82. size="small"
  83. @blur="orderCountingRecordApi('')"
  84. v-show="orderCountingRecordsMonthShow"
  85. v-model="orderCountingRecordsStart"
  86. type="month"
  87. value-format="yyyy-MM-dd"
  88. placeholder="选择起始月">
  89. </el-date-picker>
  90. <span v-show="orderCountingRecordsMonthShow" class="demonstration mt-1">结束月:</span>
  91. <el-date-picker
  92. size="small"
  93. @blur="orderCountingRecordApi('')"
  94. v-show="orderCountingRecordsMonthShow"
  95. v-model="orderCountingRecordsEnd"
  96. type="month"
  97. value-format="yyyy-MM-dd"
  98. placeholder="选择结束月">
  99. </el-date-picker>
  100. <span v-show="orderCountingRecordsYearShow" class="demonstration mt-1">起始年:</span>
  101. <el-date-picker
  102. size="small"
  103. @blur="orderCountingRecordApi('')"
  104. v-show="orderCountingRecordsYearShow"
  105. v-model="orderCountingRecordsStart"
  106. type="year"
  107. value-format="yyyy-MM-dd"
  108. placeholder="选择年">
  109. </el-date-picker>
  110. <span v-show="orderCountingRecordsYearShow" class="demonstration mt-1">结束年:</span>
  111. <el-date-picker
  112. size="small"
  113. @blur="orderCountingRecordApi('')"
  114. v-show="orderCountingRecordsYearShow"
  115. v-model="orderCountingRecordsEnd"
  116. type="year"
  117. value-format="yyyy-MM-dd"
  118. placeholder="选择年">
  119. </el-date-picker>
  120. <div class="btn-group btn-group-sm ml-2" role="group">
  121. <el-button type="primary" value="日" @click="orderCountingRecordApi('日')"
  122. class="btn btn-secondary"
  123. v-model="orderCountingRecordsUnit">日
  124. </el-button>
  125. <el-button type="primary" value="月" @click="orderCountingRecordApi('月')"
  126. class="btn btn-secondary "
  127. v-model="orderCountingRecordsUnit">月
  128. </el-button>
  129. <el-button type="primary" value="年" @click="orderCountingRecordApi('年')"
  130. class="btn btn-secondary"
  131. v-model="orderCountingRecordsUnit">年
  132. </el-button>
  133. </div>
  134. <div class="ml-2">
  135. <el-select placeholder="请选择对应货主" multiple v-model="selectOrderOwners" size="small"
  136. @change="orderCountingRecordApi('')">
  137. <el-option label="选择所有" value="all"></el-option>
  138. <el-option v-for="item in owners" :label="item.name" :value="item.id"
  139. :key="item.id"></el-option>
  140. </el-select>
  141. </div>
  142. </div>
  143. </div>
  144. <div class="card-body row">
  145. <div id="orderCountingRecords" class="col-12"
  146. style="min-height: 500px"></div>
  147. </div>
  148. </div>
  149. </div>
  150. <div class="col-sm-3 col-lg-3 col-xl-3 col-md-3">
  151. <div class="card">
  152. <div class="card-header">
  153. <div class="block row">
  154. <span class="demonstration"></span>
  155. <el-date-picker
  156. size="small"
  157. style="width: 60%;"
  158. @blur="logisticsCountingRecordsApi()"
  159. v-model="logisticsCountingRecordsData"
  160. type="daterange"
  161. align="right"
  162. unlink-panels
  163. range-separator="-"
  164. start-placeholder="开始日期"
  165. end-placeholder="结束日期"
  166. value-format="yyyy-MM-dd"
  167. :picker-options="pickerOptions">
  168. </el-date-picker>
  169. <el-select placeholder="请选择对应货主" multiple v-model="selectLogisticsOwners" size="small" style="width: 50%" @change="logisticsCountingRecordsApi('')">
  170. <el-option label="选择所有" value="all"></el-option>
  171. <el-option v-for="item in owners" :label="item.name" :value="item.id" :key="item.id"></el-option>
  172. </el-select>
  173. </div>
  174. </div>
  175. <div class="card-body row">
  176. <div id="logisticsCountingRecords" class="col-12"
  177. style="min-height:500px;"></div>
  178. </div>
  179. </div>
  180. </div>
  181. <div class="col-sm-3 col-lg-3 col-xl-3 col-md-3">
  182. <div class="card">
  183. <div class="card-header">
  184. <div class="block">
  185. <span class="demonstration"></span>
  186. <el-date-picker
  187. size="small"
  188. style="width: 80%;"
  189. @blur="warehouseCountingRecordsApi()"
  190. v-model="warehouseCountingRecordsData"
  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>
  202. <div class="card-body row">
  203. <div id="warehouseCountingRecords" class="col-12"
  204. style=min-height:500px;"></div>
  205. </div>
  206. </div>
  207. </div>
  208. </div>
  209. <div class="row my-3">
  210. @can('人事管理-临时工报表-可见全部组')
  211. <div class="col-sm-6 col-lg-6 col-xl-6 col-md-6">
  212. <div class="card">
  213. <div class="card-header">
  214. <div class="block row">
  215. <span class="demonstration"></span>
  216. <span v-show="laborReportsCountingRecordsDayShow"
  217. class="demonstration mt-1">起始日期:</span>
  218. <el-date-picker
  219. size="small"
  220. @blur="laborReportsCountingRecordApi('')"
  221. v-show="laborReportsCountingRecordsDayShow"
  222. v-model="laborReportsCountingRecordsStart"
  223. type="date"
  224. value-format="yyyy-MM-dd"
  225. placeholder="选起始日期">
  226. </el-date-picker>
  227. <span v-show="laborReportsCountingRecordsDayShow"
  228. class="demonstration mt-1">结束日期:</span>
  229. <el-date-picker
  230. size="small"
  231. @blur="laborReportsCountingRecordApi('')"
  232. v-show="laborReportsCountingRecordsDayShow"
  233. v-model="laborReportsCountingRecordsEnd"
  234. type="date"
  235. value-format="yyyy-MM-dd"
  236. placeholder="选择结束日期">
  237. </el-date-picker>
  238. <span v-show="laborReportsCountingRecordsMonthShow"
  239. class="demonstration mt-1">起始月:</span>
  240. <el-date-picker
  241. size="small"
  242. @blur="laborReportsCountingRecordApi('')"
  243. v-show="laborReportsCountingRecordsMonthShow"
  244. v-model="laborReportsCountingRecordsStart"
  245. type="month"
  246. value-format="yyyy-MM-dd"
  247. placeholder="选择起始月">
  248. </el-date-picker>
  249. <span v-show="laborReportsCountingRecordsMonthShow"
  250. class="demonstration mt-1">结束月:</span>
  251. <el-date-picker
  252. size="small"
  253. @blur="laborReportsCountingRecordApi('')"
  254. v-show="laborReportsCountingRecordsMonthShow"
  255. v-model="laborReportsCountingRecordsEnd"
  256. type="month"
  257. value-format="yyyy-MM-dd"
  258. placeholder="选择结束月">
  259. </el-date-picker>
  260. <span v-show="laborReportsCountingRecordsYearShow"
  261. class="demonstration mt-1">起始年:</span>
  262. <el-date-picker
  263. size="small"
  264. @blur="laborReportsCountingRecordApi('')"
  265. v-show="laborReportsCountingRecordsYearShow"
  266. v-model="laborReportsCountingRecordsStart"
  267. type="year"
  268. value-format="yyyy-MM-dd"
  269. placeholder="选择年">
  270. </el-date-picker>
  271. <span v-show="laborReportsCountingRecordsYearShow"
  272. class="demonstration mt-1">结束年:</span>
  273. <el-date-picker
  274. size="small"
  275. @blur="laborReportsCountingRecordApi('')"
  276. v-show="laborReportsCountingRecordsYearShow"
  277. v-model="laborReportsCountingRecordsEnd"
  278. type="year"
  279. value-format="yyyy-MM-dd"
  280. placeholder="选择年">
  281. </el-date-picker>
  282. <div class="btn-group btn-group-sm ml-2" role="group">
  283. <el-button type="primary" value="日" @click="laborReportsCountingRecordApi('日')"
  284. class="btn btn-secondary"
  285. v-model="laborReportsCountingRecordUnit">日
  286. </el-button>
  287. <el-button type="primary" value="月" @click="laborReportsCountingRecordApi('月')"
  288. class="btn btn-secondary"
  289. v-model="laborReportsCountingRecordUnit">月
  290. </el-button>
  291. <el-button type="primary" value="年" @click="laborReportsCountingRecordApi('年')"
  292. class="btn btn-secondary"
  293. v-model="laborReportsCountingRecordUnit">年
  294. </el-button>
  295. </div>
  296. </div>
  297. </div>
  298. <div class="card-body row">
  299. <div id="laborReportsCountingRecords"
  300. class="col-12"
  301. style="min-height:500px;"></div>
  302. </div>
  303. </div>
  304. </div>
  305. <div class="col-sm-6 col-lg-6 col-xl-6 col-md-6">
  306. <div class="card">
  307. <div class="card-header">
  308. <span class="demonstration"></span>
  309. <el-date-picker
  310. size="small"
  311. @blur="laborReportsUserGroupsCountApi('')"
  312. v-model="laborReportsUserGroupsCountDate"
  313. type="daterange"
  314. align="right"
  315. unlink-panels
  316. range-separator="-"
  317. start-placeholder="开始日期"
  318. end-placeholder="结束日期"
  319. value-format="yyyy-MM-dd"
  320. :picker-options="pickerOptions">
  321. </el-date-picker>
  322. </div>
  323. <div class="card-body row">
  324. <div id="laborReportsUserGroupsCount"
  325. class="col-12"
  326. style="min-height:500px;"></div>
  327. </div>
  328. </div>
  329. </div>
  330. @endcan
  331. </div>
  332. <div class="row my-3">
  333. @can("控制台-称重统计")
  334. <div class="col-6">
  335. <div class="card">
  336. <div class="card-header">
  337. <div class="row">
  338. <el-date-picker size="small" class="col-6 date" @blur="loadWeightInfo()"
  339. type="daterange" align="right"
  340. v-model="searchOption.weightDate" unlink-panels range-separator="-"
  341. start-placeholder="开始日期" end-placeholder="结束日期"
  342. value-format="yyyy-MM-dd">
  343. </el-date-picker>
  344. <label class="col-3 offset-3">
  345. <select class="form-control rounded" v-model="searchOption.weightSelect"
  346. @change="switchWeightDate()">
  347. <option v-for="(date,i) in dateOptions" :value="i">@{{ date.text }}</option>
  348. </select>
  349. </label>
  350. </div>
  351. </div>
  352. <div class="card-body row">
  353. <div id="weight" class="col-12" style="min-height: 500px"></div>
  354. </div>
  355. </div>
  356. </div>
  357. @endcan
  358. <div class="col-6">
  359. <div class="card">
  360. <div class="card-header">
  361. <div class="flex-column">
  362. <el-date-picker size="small" class="col-6 date" @blur="loadExceptionTypeInfo()"
  363. type="daterange" align="right"
  364. v-model="searchOption.exceptionTypeDate" unlink-panels range-separator="-"
  365. start-placeholder="开始日期" end-placeholder="结束日期"
  366. value-format="yyyy-MM-dd">
  367. </el-date-picker>
  368. <el-select class="col-3" placeholder="请选择对应货主" multiple v-model="selectExceptionTypeOwners" size="small" style="width: 20%" @change="loadExceptionTypeInfo()">
  369. <el-option label="选择所有" value="all"></el-option>
  370. <el-option v-for="item in owners" :label="item.name" :value="item.id" :key="item.id"></el-option>
  371. </el-select>
  372. <label class="col-3 ">
  373. <select class="form-control rounded" v-model="searchOption.exceptionTypeSelect"
  374. @change="switchExceptionTypeDate()">
  375. <option v-for="(date,i) in dateOptions" :value="i">@{{ date.text }}</option>
  376. </select>
  377. </label>
  378. </div>
  379. </div>
  380. <div class="card-body row">
  381. <div id="exceptionType" class="col-12" style="min-height: 500px"></div>
  382. </div>
  383. </div>
  384. </div>
  385. </div>
  386. </div>
  387. </div>
  388. @endsection
  389. @section('lastScript')
  390. <script src="{{ mix('js/echarts.js') }}"></script>
  391. <script src="{{ mix('js/element-ui.js') }}"></script>
  392. <script>
  393. let vue = new Vue({
  394. el: "#list",
  395. data: {
  396. myChart: null,
  397. menus:{!! $menus !!},
  398. owners:{!! $owners !!},
  399. selectOrderOwners: [],
  400. selectLogisticsOwners: [],
  401. selectExceptionTypeOwners: [],
  402. warehousesOrders:{!! $warehousesOrders !!},
  403. orderCountingRecords:{},
  404. logisticsCountingRecords:{},
  405. warehouseCountingRecords:{},
  406. laborReportsCountingRecords:{},
  407. laborReportsUserGroupsCount:{},
  408. warehouses: {
  409. "WH01": '松江一仓',
  410. "WH02": '松江二仓',
  411. "WH03": '嘉定一仓',},
  412. totalOrders: {
  413. total: null,
  414. createOrder: null,
  415. assignedComplete: null,
  416. partialAllocation: null,
  417. partPacking: null,
  418. sowComplete: null,
  419. },
  420. orderCountingRecordsDateTarget: [],
  421. orderCountingRecordsData: [],
  422. laborReportsCountingRecordsDateTarget: [],
  423. laborReportsCountingRecordsData: [],
  424. pickerOptions: {
  425. shortcuts: [{
  426. text: '最近一周',
  427. onClick(picker) {
  428. const end = new Date();
  429. const start = new Date();
  430. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  431. picker.$emit('pick', [start, end]);
  432. }
  433. }, {
  434. text: '最近一个月',
  435. onClick(picker) {
  436. const end = new Date();
  437. const start = new Date();
  438. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  439. picker.$emit('pick', [start, end]);
  440. }
  441. }, {
  442. text: '最近三个月',
  443. onClick(picker) {
  444. const end = new Date();
  445. const start = new Date();
  446. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  447. picker.$emit('pick', [start, end]);
  448. }
  449. }]
  450. },
  451. dateOptions:[{text:'当天',start:moment().format('yyyy-MM-DD'),end:moment().format('yyyy-MM-DD')},
  452. {text:"昨天",start:moment().subtract("1","day").format('yyyy-MM-DD'),end:moment().subtract("1","day").format('yyyy-MM-DD')},
  453. {text:"本周",start:moment().weekday(1).format('yyyy-MM-DD'),end:moment().weekday(7).format('yyyy-MM-DD')},
  454. {text:"上周",start:moment().weekday(-6).format('yyyy-MM-DD'),end:moment().weekday(0).format('yyyy-MM-DD')},
  455. {text:"本月",start:moment().startOf("month").format('yyyy-MM-DD'),end:moment().endOf("month").format('yyyy-MM-DD')},
  456. {text:"上月",start:moment().month(moment().month() - 1).startOf('month').format('yyyy-MM-DD'),end:moment().month(moment().month() - 1).endOf('month').format('yyyy-MM-DD')},
  457. {text:"本季度",start:moment(moment().quarter(moment().quarter()).startOf('quarter').valueOf()).format('yyyy-MM-DD'),end:moment(moment().quarter(moment().quarter()).endOf('quarter').valueOf()).format('yyyy-MM-DD')},
  458. {text:"上季度",start:moment(moment().quarter(moment().quarter() - 1).startOf('quarter').valueOf()).format('yyyy-MM-DD'),end:moment(moment().quarter(moment().quarter() - 1).endOf('quarter').valueOf()).format('yyyy-MM-DD')},
  459. {text:"本年",start:moment(moment().year(moment().year()).startOf('year').valueOf()).format('yyyy-MM-DD'),end:moment(moment().year(moment().year()).endOf('year').valueOf()).format('yyyy-MM-DD')},
  460. {text:"去年",start:moment(moment().year(moment().year() - 1).startOf('year').valueOf()).format('yyyy-MM-DD'),end:moment(moment().year(moment().year() - 1).endOf('year').valueOf()).format('yyyy-MM-DD')}],
  461. logisticsCountingRecordsData: [moment().subtract('1', 'month').format('yyyy-MM-DD'),
  462. moment(new Date()).format('yyyy-MM-DD')],
  463. warehouseCountingRecordsData: [moment().subtract('1', 'month').format('yyyy-MM-DD'),
  464. moment(new Date()).format('yyyy-MM-DD')],
  465. laborReportsCountingRecordsDate: [moment().subtract('1', 'month').format('yyyy-MM-DD'),
  466. moment(new Date()).format('yyyy-MM-DD')],
  467. laborReportsUserGroupsCountDate: [moment().subtract('1', 'month').format('yyyy-MM-DD'),
  468. moment(new Date()).format('yyyy-MM-DD')],
  469. orderCountingRecordsUnit: '日',
  470. laborReportsCountingRecordUnit: '日',
  471. orderCountingRecordsDayShow: true,
  472. orderCountingRecordsMonthShow: false,
  473. orderCountingRecordsYearShow: false,
  474. orderCountingRecordsStart: moment().subtract('1', 'month').format('yyyy-MM-DD'),
  475. orderCountingRecordsEnd: moment(new Date()).format('yyyy-MM-DD'),
  476. orderCountingUnit: '日',
  477. orderUnitsData: {
  478. start_day: moment().subtract('1', 'month').format('yyyy-MM-DD'),
  479. end_day: moment(new Date()).format('yyyy-MM-DD'),
  480. start_month: moment().subtract('12', 'month').format('yyyy-MM-DD'),
  481. end_month: moment(new Date()).format('yyyy-MM-DD'),
  482. start_year: moment().subtract('12', 'month').format('yyyy-MM-DD'),
  483. end_year: moment(new Date()).format('yyyy-MM-DD'),
  484. },
  485. laborReportsUnit: '日',
  486. laborReportsData: {
  487. start_day: moment().subtract('1', 'month').format('yyyy-MM-DD'),
  488. end_day: moment(new Date()).format('yyyy-MM-DD'),
  489. start_month: moment().subtract('12', 'month').format('yyyy-MM-DD'),
  490. end_month: moment(new Date()).format('yyyy-MM-DD'),
  491. start_year: moment().subtract('12', 'month').format('yyyy-MM-DD'),
  492. end_year: moment(new Date()).format('yyyy-MM-DD'),
  493. },
  494. laborReportsCountingRecordsDayShow: true,
  495. laborReportsCountingRecordsMonthShow: false,
  496. laborReportsCountingRecordsYearShow: false,
  497. laborReportsCountingRecordsStart: moment().subtract('1', 'month').format('yyyy-MM-DD'),
  498. laborReportsCountingRecordsEnd: moment(new Date()).format('yyyy-MM-DD'),
  499. cardPool:{},
  500. searchOption:{
  501. weightDate:[],
  502. exceptionTypeDate: [],
  503. weightSelect:"",
  504. exceptionTypeSelect:"",
  505. },
  506. },
  507. watch:{
  508. selectOrderOwners:function(val,oldval){
  509. let newindex = val.indexOf('all');
  510. let oldindex = oldval.indexOf('all');
  511. if(newindex!=-1 && oldindex==-1 && val.length>1)
  512. this.selectOrderOwners=['all'];
  513. else if(newindex!=-1 && oldindex!=-1 && val.length>1)
  514. this.selectOrderOwners.splice(val.indexOf('all'),1)
  515. },
  516. selectLogisticsOwners:function(val,oldval){
  517. let newindex = val.indexOf('all');
  518. let oldindex = oldval.indexOf('all');
  519. if(newindex!=-1 && oldindex==-1 && val.length>1)
  520. this.selectLogisticsOwners=['all'];
  521. else if(newindex!=-1 && oldindex!=-1 && val.length>1)
  522. this.selectLogisticsOwners.splice(val.indexOf('all'),1)
  523. }
  524. },
  525. mounted() {
  526. $('#list').removeClass('d-none');
  527. let index = 4;
  528. this.searchOption.weightSelect = index;
  529. this.searchOption.exceptionTypeSelect = index;
  530. this.searchOption.weightDate = [this.dateOptions[index].start, this.dateOptions[index].end];
  531. this.searchOption.exceptionTypeDate = [this.dateOptions[index].start, this.dateOptions[index].end];
  532. let _this = this;
  533. this.warehousesOrders.forEach(function (item) {
  534. _this.totalOrders.total += parseInt(item.total);
  535. _this.totalOrders.createOrder += item.createOrder;
  536. _this.totalOrders.assignedComplete += item.assignedComplete;
  537. _this.totalOrders.partialAllocation += item.partialAllocation;
  538. _this.totalOrders.partPacking += item.partPacking;
  539. _this.totalOrders.sowComplete += item.sowComplete;
  540. });
  541. //订单量趋势
  542. this.orderCountingRecordsChart = echarts.init(document.getElementById('orderCountingRecords'));
  543. this.initOrderCountingRecordsChart();
  544. this.orderCountingRecordApi('日');
  545. //订单快递分布
  546. this.logisticsCountingRecordsChart = echarts.init(document.getElementById('logisticsCountingRecords'));
  547. this.initLogisticsCountingRecordsChart();
  548. this.logisticsCountingRecordsApi();
  549. //订单仓库分布
  550. this.warehouseCountingRecordsChart = echarts.init(document.getElementById('warehouseCountingRecords'));
  551. this.initWarehouseCountingRecordsChart();
  552. this.warehouseCountingRecordsApi();
  553. @can('人事管理-临时工报表-可见全部组')
  554. this.laborReportsCountingRecordsChart = echarts.init(document.getElementById('laborReportsCountingRecords'));
  555. this.initLaborReportsCountingRecordsChart();
  556. this.laborReportsCountingRecordApi('日');
  557. this.laborReportsUserGroupsCountChart = echarts.init(document.getElementById('laborReportsUserGroupsCount'));
  558. this.initLaborReportsUserGroupsCountChart();
  559. this.laborReportsUserGroupsCountApi();
  560. @endcan
  561. @can("控制台-称重统计")
  562. this.cardPool.weight = echarts.init(document.getElementById("weight"));
  563. this.loadWeightInfo();
  564. @endcan
  565. this.cardPool.exceptionType = echarts.init(document.getElementById("exceptionType"));
  566. this.loadExceptionTypeInfo();
  567. },
  568. methods: {
  569. switchDataPanel_forOrderCountingRecords(fromUnit, toUnit) {
  570. switch (fromUnit) {
  571. case '日':
  572. this.orderUnitsData.start_day = this.orderCountingRecordsStart;
  573. this.orderUnitsData.end_day = this.orderCountingRecordsEnd;
  574. break;
  575. case '月':
  576. this.orderUnitsData.start_month = this.orderCountingRecordsStart;
  577. this.orderUnitsData.end_month = this.orderCountingRecordsEnd;
  578. break;
  579. case '年':
  580. this.orderUnitsData.start_year = this.orderCountingRecordsStart;
  581. this.orderUnitsData.end_year = this.orderCountingRecordsEnd;
  582. break;
  583. }
  584. switch (toUnit) {
  585. case '日':
  586. this.orderCountingRecordsStart = this.orderUnitsData.start_day;
  587. this.orderCountingRecordsEnd = this.orderUnitsData.end_day;
  588. break;
  589. case '月':
  590. this.orderCountingRecordsStart = this.orderUnitsData.start_month;
  591. this.orderCountingRecordsEnd = this.orderUnitsData.end_month;
  592. break;
  593. case '年':
  594. this.orderCountingRecordsStart = this.orderUnitsData.start_year;
  595. this.orderCountingRecordsEnd = this.orderUnitsData.end_year;
  596. break;
  597. }
  598. },
  599. switchDataPanel_forLaborReports(fromUnit, toUnit) {
  600. switch (fromUnit) {
  601. case '日':
  602. this.laborReportsData.start_day = this.laborReportsCountingRecordsStart;
  603. this.laborReportsData.end_day = this.laborReportsCountingRecordsEnd;
  604. break;
  605. case '月':
  606. this.laborReportsData.start_month = this.laborReportsCountingRecordsStart;
  607. this.laborReportsData.end_month = this.laborReportsCountingRecordsEnd;
  608. break;
  609. case '年':
  610. this.laborReportsData.start_year = this.laborReportsCountingRecordsStart;
  611. this.laborReportsData.end_year = this.laborReportsCountingRecordsEnd;
  612. break;
  613. }
  614. switch (toUnit) {
  615. case '日':
  616. this.laborReportsCountingRecordsStart = this.laborReportsData.start_day;
  617. this.laborReportsCountingRecordsEnd = this.laborReportsData.end_day;
  618. break;
  619. case '月':
  620. this.laborReportsCountingRecordsStart = this.laborReportsData.start_month;
  621. this.laborReportsCountingRecordsEnd = this.laborReportsData.end_month;
  622. break;
  623. case '年':
  624. this.laborReportsCountingRecordsStart = this.laborReportsData.start_year;
  625. this.laborReportsCountingRecordsEnd = this.laborReportsData.end_year;
  626. break;
  627. }
  628. },
  629. getWareHouse: function (code) {
  630. return this.warehouses[code];
  631. },
  632. initOrderCountingRecords() {
  633. for (let key in this.orderCountingRecords) {
  634. this.orderCountingRecordsDateTarget.push(this.orderCountingRecords[key].date_target);
  635. this.orderCountingRecordsData.push(this.orderCountingRecords[key].counter);
  636. }
  637. },
  638. initOrderCountingRecordsChart(text) {
  639. this.orderCountingRecordsChart.showLoading('default', {text: "加 载 中", color: '#C0C0C0'});
  640. if (text == null || text == '' || text == undefined) text = '默认显示权限下所有货主订单数量';
  641. this.orderCountingRecordsChart.setOption({
  642. title: {text: '订单量趋势', subtext: text,},
  643. tooltip: {},
  644. legend: {data: ['订单数']},
  645. xAxis: {
  646. type: 'category',
  647. data: this.orderCountingRecordsDateTarget
  648. },
  649. yAxis: {type: 'value'},
  650. series: [{
  651. data: this.orderCountingRecordsData,
  652. type: 'line',
  653. smooth: true
  654. }]
  655. });
  656. },
  657. initLaborReportsCountingRecordsChart() {
  658. this.laborReportsCountingRecordsChart.showLoading('default', {text: "加 载 中", color: '#C0C0C0'});
  659. this.laborReportsCountingRecordsChart.setOption({
  660. title: {text: '临时用工趋势'},
  661. tooltip: {},
  662. legend: {data: ['临时用工数']},
  663. xAxis: {
  664. type: 'category',
  665. data: this.laborReportsCountingRecordsDateTarget
  666. },
  667. yAxis: {type: 'value'},
  668. series: [{
  669. data: this.laborReportsCountingRecordsData,
  670. type: 'line',
  671. smooth: true
  672. }]
  673. });
  674. },
  675. initLogisticsCountingRecordsChart(text) {
  676. this.logisticsCountingRecordsChart.showLoading('default', {text: "加 载 中", color: '#C0C0C0'});
  677. if (text == null || text == '' || text == undefined) text = '默认显示权限下所有货主快递分布';
  678. this.logisticsCountingRecordsChart.setOption({
  679. title: {
  680. text: '快递分布',
  681. subtext: text,
  682. left: 'left'
  683. },
  684. tooltip: {
  685. trigger: 'item',
  686. formatter: '{a} <br/>{b} : {c} ({d}%)'
  687. },
  688. series: [
  689. {
  690. name: '快递分布',
  691. type: 'pie',
  692. radius: '55%',
  693. center: ['50%', '60%'],
  694. data: this.logisticsCountingRecords,
  695. emphasis: {
  696. itemStyle: {
  697. shadowBlur: 10,
  698. shadowOffsetX: 0,
  699. shadowColor: 'rgba(0, 0, 0, 0.5)'
  700. }
  701. }
  702. }
  703. ]
  704. });
  705. },
  706. initWarehouseCountingRecordsChart() {
  707. this.warehouseCountingRecordsChart.showLoading('default', {text: "加 载 中", color: '#C0C0C0'});
  708. this.warehouseCountingRecordsChart.setOption({
  709. title: {
  710. text: '仓库分布',
  711. left: 'left'
  712. },
  713. tooltip: {
  714. trigger: 'item',
  715. formatter: '{a} <br/>{b} : {c} ({d}%)'
  716. },
  717. series: [
  718. {
  719. name: '仓库分布',
  720. type: 'pie',
  721. radius: '55%',
  722. center: ['50%', '60%'],
  723. data: this.warehouseCountingRecords,
  724. emphasis: {
  725. itemStyle: {
  726. shadowBlur: 10,
  727. shadowOffsetX: 0,
  728. shadowColor: 'rgba(0, 0, 0, 0.5)'
  729. }
  730. }
  731. }
  732. ]
  733. });
  734. },
  735. initLaborReportsUserGroupsCountChart() {
  736. this.laborReportsUserGroupsCountChart.showLoading('default', {text: "加 载 中", color: '#C0C0C0'});
  737. this.laborReportsUserGroupsCountChart.setOption({
  738. title: {
  739. text: '小组临时工分布',
  740. left: 'left'
  741. },
  742. tooltip: {
  743. trigger: 'item',
  744. formatter: '{a} <br/>{b} : {c} ({d}%)'
  745. },
  746. series: [
  747. {
  748. name: '小组临时工分布',
  749. type: 'pie',
  750. radius: '55%',
  751. center: ['50%', '60%'],
  752. data: this.laborReportsUserGroupsCount,
  753. emphasis: {
  754. itemStyle: {
  755. shadowBlur: 10,
  756. shadowOffsetX: 0,
  757. shadowColor: 'rgba(0, 0, 0, 0.5)'
  758. }
  759. }
  760. }
  761. ]
  762. });
  763. },
  764. initLaborReportsCountingRecords() {
  765. let _this = this;
  766. this.laborReportsCountingRecords.forEach(function (item) {
  767. _this.laborReportsCountingRecordsDateTarget.push(item.date_target);
  768. _this.laborReportsCountingRecordsData.push(item.counter);
  769. });
  770. },
  771. orderCountingRecordApi(orderCountingRecordsUnit) {
  772. this.orderCountingRecordsChart.showLoading('default', {text: "加 载 中", color: '#C0C0C0'});
  773. if (orderCountingRecordsUnit === '') {
  774. orderCountingRecordsUnit = this.orderCountingRecordsUnit;
  775. }
  776. this.switchDataPanel_forOrderCountingRecords(this.orderCountingUnit, orderCountingRecordsUnit);
  777. this.orderCountingUnit = orderCountingRecordsUnit;
  778. switch (orderCountingRecordsUnit) {
  779. case '日':
  780. this.orderCountingRecordsDayShow = true;
  781. this.orderCountingRecordsMonthShow = false;
  782. this.orderCountingRecordsYearShow = false;
  783. break;
  784. case '月':
  785. this.orderCountingRecordsDayShow = false;
  786. this.orderCountingRecordsMonthShow = true;
  787. this.orderCountingRecordsYearShow = false;
  788. break;
  789. case '年':
  790. this.orderCountingRecordsDayShow = false;
  791. this.orderCountingRecordsMonthShow = false;
  792. this.orderCountingRecordsYearShow = true;
  793. break;
  794. }
  795. this.orderCountingRecordsUnit = orderCountingRecordsUnit;
  796. let _this = this;
  797. let text = null;
  798. axios.post('{{url('apiLocal/control/panel/menu/orderCountingRecordApi')}}', {
  799. 'start': this.orderCountingRecordsStart, 'end': this.orderCountingRecordsEnd,
  800. 'unit': orderCountingRecordsUnit, 'owner_ids': this.selectOrderOwners
  801. }).then(function (res) {
  802. if (res.status === 200) {
  803. _this.orderCountingRecords = res.data.orderCountingRecords;
  804. _this.orderCountingRecordsDateTarget = [];
  805. _this.orderCountingRecordsData = [];
  806. _this.initOrderCountingRecords();
  807. if (_this.selectOrderOwners.length > 0) text = '当前选中货主订单数量';
  808. _this.initOrderCountingRecordsChart(text);
  809. _this.orderCountingRecordsChart.hideLoading();
  810. }
  811. });
  812. },
  813. logisticsCountingRecordsApi() {
  814. this.logisticsCountingRecordsChart.showLoading('default', {text: "加 载 中", color: '#C0C0C0'});
  815. let text = null;
  816. let _this = this;
  817. axios.post('{{url('apiLocal/control/panel/menu/logisticsCountingRecordsApi')}}', {
  818. 'start': this.logisticsCountingRecordsData[0],
  819. 'end': this.logisticsCountingRecordsData[1],
  820. 'owner_ids': this.selectLogisticsOwners
  821. }).then(function (res) {
  822. if (res.status === 200) {
  823. _this.logisticsCountingRecords = res.data.logisticsCountingRecords;
  824. if (_this.selectLogisticsOwners.length > 0) text = '当前选中货主快递分布';
  825. _this.initLogisticsCountingRecordsChart(text);
  826. _this.logisticsCountingRecordsChart.hideLoading();
  827. }
  828. });
  829. },
  830. warehouseCountingRecordsApi() {
  831. this.warehouseCountingRecordsChart.showLoading('default', {text: "加 载 中", color: '#C0C0C0'});
  832. let formData = new FormData();
  833. formData.append('start', this.warehouseCountingRecordsData[0]);
  834. formData.append('end', this.warehouseCountingRecordsData[1]);
  835. let _this = this;
  836. axios.post('{{url('apiLocal/control/panel/menu/warehouseCountingRecordsApi')}}', formData).then(function (res) {
  837. if (res.status === 200) {
  838. _this.warehouseCountingRecords = res.data.warehouseCountingRecords;
  839. _this.initWarehouseCountingRecordsChart();
  840. _this.warehouseCountingRecordsChart.hideLoading();
  841. }
  842. });
  843. },
  844. laborReportsCountingRecordApi(laborReportsCountingRecordUnit) {
  845. this.laborReportsCountingRecordsChart.showLoading('default', {text: "加 载 中", color: '#C0C0C0'});
  846. if (laborReportsCountingRecordUnit === '') {
  847. laborReportsCountingRecordUnit = this.laborReportsCountingRecordUnit;
  848. }
  849. this.switchDataPanel_forLaborReports(this.laborReportsUnit, laborReportsCountingRecordUnit);
  850. this.laborReportsUnit = laborReportsCountingRecordUnit;
  851. this.laborReportsCountingRecordUnit = laborReportsCountingRecordUnit;
  852. switch (laborReportsCountingRecordUnit) {
  853. case '日':
  854. this.laborReportsCountingRecordsDayShow = true;
  855. this.laborReportsCountingRecordsMonthShow = false;
  856. this.laborReportsCountingRecordsYearShow = false;
  857. break;
  858. case '月':
  859. this.laborReportsCountingRecordsDayShow = false;
  860. this.laborReportsCountingRecordsMonthShow = true;
  861. this.laborReportsCountingRecordsYearShow = false;
  862. break;
  863. case '年':
  864. this.laborReportsCountingRecordsDayShow = false;
  865. this.laborReportsCountingRecordsMonthShow = false;
  866. this.laborReportsCountingRecordsYearShow = true;
  867. break;
  868. }
  869. let formData = new FormData();
  870. formData.append('start', this.laborReportsCountingRecordsStart);
  871. formData.append('end', this.laborReportsCountingRecordsEnd);
  872. formData.append('unit', laborReportsCountingRecordUnit);
  873. let _this = this;
  874. axios.post('{{url('apiLocal/control/panel/menu/laborReportsCountingRecordApi')}}', formData).then(function (res) {
  875. if (res.status === 200) {
  876. _this.laborReportsCountingRecords = res.data.laborReportsCountingRecords;
  877. _this.laborReportsCountingRecordsDateTarget = [];
  878. _this.laborReportsCountingRecordsData = [];
  879. _this.initLaborReportsCountingRecords();
  880. _this.initLaborReportsCountingRecordsChart();
  881. _this.laborReportsCountingRecordsChart.hideLoading();
  882. }
  883. });
  884. },
  885. laborReportsUserGroupsCountApi() {
  886. this.laborReportsUserGroupsCountChart.showLoading('default', {text: "加 载 中", color: '#C0C0C0'});
  887. let formData = new FormData();
  888. formData.append('start', this.laborReportsUserGroupsCountDate[0]);
  889. formData.append('end', this.laborReportsUserGroupsCountDate[1]);
  890. let _this = this;
  891. axios.post('{{url('apiLocal/control/panel/menu/laborReportsUserGroupsCountApi')}}', formData).then(function (res) {
  892. if (res.status === 200) {
  893. _this.laborReportsUserGroupsCount = res.data.laborReportsUserGroupsCount;
  894. _this.initLaborReportsUserGroupsCountChart();
  895. _this.laborReportsUserGroupsCountChart.hideLoading();
  896. }
  897. });
  898. },
  899. loadWeightInfo(){
  900. window.tempTip.setDuration(3000);
  901. if (!this.searchOption.weightDate[0]){
  902. window.tempTip.show("开始时间未选择");
  903. return;
  904. }
  905. if (!this.searchOption.weightDate[1]){
  906. window.tempTip.show("结束时间未选择");
  907. return;
  908. }
  909. this.cardPool.weight.showLoading('default',{text:"加 载 中",color:'#C0C0C0'});
  910. let url = "{{url('apiLocal/control/panel/menu/weightApi')}}";
  911. let params = {start:this.searchOption.weightDate[0],end:this.searchOption.weightDate[1]};
  912. window.tempTip.postBasicRequest(url,params,res=>{
  913. this.cardPool.weight.hideLoading();
  914. this.cardPool.weight.setOption(this._setWeightData(res.title,res.data));
  915. });
  916. },
  917. loadExceptionTypeInfo() {
  918. window.tempTip.setDuration(3000);
  919. if (!this.searchOption.exceptionTypeDate[0]){
  920. window.tempTip.show("开始时间未选择");
  921. return;
  922. }
  923. if (!this.searchOption.exceptionTypeDate[1]){
  924. window.tempTip.show("结束时间未选择");
  925. return;
  926. }
  927. this.cardPool.exceptionType.showLoading('default',{text:"加 载 中",color:'#C0C0C0'});
  928. let url = "{{url('apiLocal/control/panel/menu/exceptionTypeApi')}}";
  929. let params = {start:this.searchOption.exceptionTypeDate[0],end:this.searchOption.exceptionTypeDate[1],owner_ids:this.selectExceptionTypeOwners};
  930. window.tempTip.postBasicRequest(url,params,res=>{
  931. this.cardPool.exceptionType.hideLoading();
  932. this.cardPool.exceptionType.setOption(this._setExceptionTypeData(res.data));
  933. });
  934. },
  935. switchWeightDate(){
  936. let obj = this.dateOptions[this.searchOption.weightSelect];
  937. this.searchOption.weightDate = [obj.start,obj.end];
  938. this.loadWeightInfo();
  939. },
  940. switchExceptionTypeDate(){
  941. let obj = this.dateOptions[this.searchOption.exceptionTypeSelect];
  942. this.searchOption.exceptionTypeDate = [obj.start,obj.end];
  943. this.loadExceptionTypeInfo();
  944. },
  945. _setWeightData(title, data){
  946. return {
  947. title: {
  948. text: '已称重包裹占比',
  949. left: 'left'
  950. },
  951. tooltip: {
  952. trigger: 'item',
  953. formatter: function (params) {
  954. return params.data.date + "<br>" + "总量:<span class='text-success font-weight-bold'>" + params.data.total + "</span><br>" + "已称:<span class='text-info font-weight-bold'>" + params.data.count + "</span>";
  955. }
  956. }, xAxis: {
  957. data: title
  958. }, yAxis: {
  959. axisLabel: {
  960. show: true,
  961. interval: 'auto',
  962. formatter: '{value} %'
  963. },
  964. max: 100
  965. }, label: {
  966. show: true,
  967. position: 'top',
  968. formatter: '{c}%',
  969. color: "red"
  970. }, series: [{
  971. type: "bar",
  972. data: data,
  973. itemStyle: {
  974. color: "RGB(62,157,231)",
  975. }
  976. }]
  977. };
  978. },
  979. _setExceptionTypeData(data) {
  980. let resData = [];
  981. data.forEach(item => {
  982. resData.push({
  983. value:item.count,
  984. name:item.exception_type
  985. })
  986. })
  987. return {
  988. title: {
  989. text: '异常分布',
  990. left: 'left'
  991. },
  992. tooltip: {
  993. trigger: 'item',
  994. formatter: '{a} <br/>{b} : {c} ({d}%)'
  995. },
  996. series: [
  997. {
  998. name: '异常分布',
  999. type: 'pie',
  1000. radius: '55%',
  1001. center: ['50%', '60%'],
  1002. data: resData,
  1003. emphasis: {
  1004. itemStyle: {
  1005. shadowBlur: 10,
  1006. shadowOffsetX: 0,
  1007. shadowColor: 'rgba(0, 0, 0, 0.5)'
  1008. }
  1009. }
  1010. }
  1011. ]
  1012. }
  1013. }
  1014. }
  1015. });
  1016. </script>
  1017. @endsection