sales-trend.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
  1. <template>
  2. <div class="home-container">
  3. <el-card class="home-container__card">
  4. <div>
  5. <div class="content" v-loading="loading">
  6. <avue-crud :data="tableData" :option="option" :key="key" ref="crud" @refresh-change="refresh"
  7. @resetColumn="resetColumn"
  8. @saveColumn="saveColumn">
  9. <template slot="menuLeft">
  10. <span>今日业务详情(集装箱)</span>
  11. </template>
  12. <template slot="billNo" slot-scope="{row}">
  13. <span class="el-button--text" style="cursor: pointer"
  14. @click="openTrack(row,0)">{{ row.billNo }}</span>
  15. </template>
  16. <template slot="plateNo" slot-scope="{row}">
  17. <span class="el-button--text" style="cursor: pointer"
  18. @click="openTrack(row,1)">{{ row.plateNo }}</span>
  19. </template>
  20. <template slot="addressDetail" slot-scope="{ row,index}">
  21. <el-tooltip class="item" effect="dark" placement="top">
  22. <div v-html="ToBreak(row.addressDetail)" slot="content"></div>
  23. <div style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">{{ row.addressDetail }}</div>
  24. </el-tooltip>
  25. </template>
  26. <template slot="status" slot-scope="{row}">
  27. <span v-if="row.status == 0" style="color: #E45656;">未调度</span>
  28. <span v-if="row.status == 1" style="color: #F56C6C;">未派车</span>
  29. <span v-if="row.status == 2" style="color: #F1A532;">未受理</span>
  30. <span v-if="row.status == 3" style="color: #53C21D;">未完工</span>
  31. <span v-if="row.status == 5" style="color: #F56C6C;">未到厂</span>
  32. <span v-if="row.status == 4" style="color: #3C9CFF;">工单关闭</span>
  33. <span v-if="row.status == 6" style="color: #3C9CFF;">未提箱</span>
  34. </template>
  35. </avue-crud>
  36. </div>
  37. </div>
  38. </el-card>
  39. <el-dialog
  40. title="车辆轨迹"
  41. append-to-body
  42. custom-class="dialog_two"
  43. :visible.sync="dialogVisible"
  44. lock-scroll
  45. width="80%">
  46. <div id="container"></div>
  47. </el-dialog>
  48. </div>
  49. </template>
  50. <script>
  51. import {active} from "@/api/wel";
  52. import {gaude, location} from "@/api/gaude";
  53. import data from "@/views/util/data";
  54. export default {
  55. name: "basicContainer",
  56. props: {
  57. sysType: Number
  58. },
  59. data() {
  60. return {
  61. entrustTimer:null,
  62. roleName: localStorage.getItem("roleName").split(','),
  63. dialogVisible: false,
  64. loading: false,
  65. tableData: [],
  66. map: null,
  67. infoWindow: null,
  68. marker: null,
  69. lineArr: [],
  70. key: 0,
  71. option: {},
  72. optionList: {
  73. stripe: true,
  74. index: true,
  75. menu: false,
  76. refreshBtn: true,
  77. addBtn: false,
  78. height: 390,
  79. align: 'center',
  80. column: [
  81. {
  82. label: '货运日期',
  83. prop: 'arrivalTime',
  84. type: "date",
  85. format: "yyyy-MM-dd HH:mm",
  86. index: 1,
  87. width: 150,
  88. overHidden: true,
  89. },
  90. {
  91. label: '货运地点',
  92. prop: 'addressDetail',
  93. index: 3,
  94. width: 100
  95. },
  96. {
  97. label: '票据号',
  98. prop: 'receiptNo',
  99. index: 4,
  100. width: 100,
  101. overHidden: true,
  102. },
  103. {
  104. label: '提单号',
  105. prop: 'billNo',
  106. index: 5,
  107. width: 140,
  108. overHidden: true,
  109. },
  110. {
  111. label: '场站',
  112. prop: 'station',
  113. index: 6,
  114. width: 100,
  115. overHidden: true,
  116. },
  117. {
  118. label: '箱型箱量',
  119. prop: 'ctnDetail',
  120. index: 7,
  121. width: 100,
  122. overHidden: true,
  123. },
  124. {
  125. label: '车队',
  126. prop: 'fleetShortName',
  127. index: 11,
  128. width: 100,
  129. overHidden: true,
  130. },
  131. {
  132. label: '车号',
  133. prop: 'plateNo',
  134. index: 12,
  135. width: 100,
  136. overHidden: true,
  137. },
  138. {
  139. label: '状态',
  140. prop: 'status',
  141. type: 'select',
  142. dicUrl: "/api/blade-system/dict-biz/dictionary?code=land_order_status",
  143. props: {
  144. label: "dictValue",
  145. value: "dictKey"
  146. },
  147. dataType: "string",
  148. index: 13,
  149. width: 100,
  150. overHidden: true,
  151. }, {
  152. label: '备注',
  153. prop: 'remarks',
  154. index: 17,
  155. width: 100,
  156. overHidden: true,
  157. },
  158. ]
  159. },
  160. };
  161. },
  162. async mounted() {
  163. this.option = await this.getColumnData(this.getColumnName(140), this.optionList);
  164. this.key++
  165. this.init();
  166. if (this.roleName.indexOf('平台') !== -1||this.roleName.indexOf('总调度') !== -1||this.roleName.indexOf('分管调度') !== -1) {
  167. for (let item of this.option.column) {
  168. if (item.prop === 'extraAmountC') return
  169. }
  170. this.option.column.push(
  171. {
  172. label: '业务员',
  173. prop: 'salesmanName',
  174. index: 2,
  175. width: 60,
  176. overHidden: true,
  177. },{
  178. label: '运输调度',
  179. prop: 'dispatcherName',
  180. overHidden: true,
  181. index: 2,
  182. width: 100,
  183. },
  184. {
  185. label: '客户名称',
  186. prop: 'corpShortName',
  187. index: 16,
  188. width: 100,
  189. overHidden: true,
  190. },{
  191. label: '应付杂费',
  192. prop: 'extraAmountC',
  193. index: 14,
  194. width: 100,
  195. overHidden: true
  196. },
  197. {
  198. label: '应收运费',
  199. prop: 'landAmountD',
  200. index: 13,
  201. width: 100,
  202. overHidden: true,
  203. },
  204. {
  205. label: '应收杂费',
  206. prop: 'extraAmountD',
  207. index: 13,
  208. width: 100,
  209. overHidden: true,
  210. }
  211. )
  212. }
  213. if (this.roleName.indexOf('车队') !== -1) {
  214. for (let item of this.option.column) {
  215. if (item.prop === 'extraAmountC') return
  216. }
  217. this.option.column.push(
  218. {
  219. label: '物流运输',
  220. prop: 'dispatchDeptName',
  221. overHidden: true,
  222. index: 1,
  223. width: 100
  224. }, {
  225. label: '运输调度',
  226. prop: 'dispatcherName',
  227. overHidden: true,
  228. index: 1,
  229. width: 100,
  230. }, {
  231. label: '应付运费',
  232. prop: 'landAmountC',
  233. index: 13,
  234. width: 100,
  235. overHidden: true,
  236. },{
  237. label: '应付杂费',
  238. prop: 'extraAmountC',
  239. index: 13,
  240. width: 100,
  241. overHidden: true
  242. }
  243. )
  244. }
  245. if (this.roleName.indexOf('客户') !== -1) {
  246. for (let item of this.option.column) {
  247. if (item.prop === 'salesmanName') return
  248. }
  249. this.option.column.push(
  250. {
  251. label: '业务员',
  252. prop: 'salesmanName',
  253. index: 2,
  254. width: 60,
  255. overHidden: true,
  256. },{
  257. label: '物流运输',
  258. prop: 'dispatchDeptName',
  259. overHidden: true,
  260. index: 2,
  261. width: 100
  262. },
  263. {
  264. label: '客户名称',
  265. prop: 'corpShortName',
  266. index: 16,
  267. width: 100,
  268. overHidden: true,
  269. },
  270. {
  271. label: '应收运费',
  272. prop: 'landAmountD',
  273. index: 14,
  274. width: 100,
  275. overHidden: true,
  276. },
  277. {
  278. label: '应收杂费',
  279. prop: 'extraAmountD',
  280. index: 15,
  281. width: 100,
  282. overHidden: true,
  283. }
  284. )
  285. }
  286. },
  287. beforeDestroy() {
  288. this.map && this.map.destroy();
  289. clearInterval(this.entrustTimer); //关闭
  290. },
  291. methods: {
  292. //自定义列保存
  293. async saveColumn() {
  294. /**
  295. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  296. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  297. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  298. */
  299. const inSave = await this.saveColumnData(this.getColumnName(140), this.option);
  300. if (inSave) {
  301. this.$message.success("保存成功");
  302. //关闭窗口
  303. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  304. }
  305. },
  306. //自定义列重置
  307. async resetColumn() {
  308. this.option = this.optionList;
  309. const inSave = await this.delColumnData(this.getColumnName(140), this.optionList);
  310. if (inSave) {
  311. this.$message.success("重置成功");
  312. //关闭窗口
  313. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  314. this.key++
  315. if (this.roleName.indexOf('平台') !== -1||this.roleName.indexOf('总调度') !== -1||this.roleName.indexOf('分管调度') !== -1) {
  316. for (let item of this.option.column) {
  317. if (item.prop === 'extraAmountC') return
  318. }
  319. this.option.column.push(
  320. {
  321. label: '业务员',
  322. prop: 'salesmanName',
  323. index: 2,
  324. width: 60,
  325. overHidden: true,
  326. },{
  327. label: '运输调度',
  328. prop: 'dispatcherName',
  329. overHidden: true,
  330. index: 2,
  331. width: 100,
  332. },
  333. {
  334. label: '客户名称',
  335. prop: 'corpShortName',
  336. index: 16,
  337. width: 100,
  338. overHidden: true,
  339. },{
  340. label: '应付杂费',
  341. prop: 'extraAmountC',
  342. index: 14,
  343. width: 100,
  344. overHidden: true
  345. },
  346. {
  347. label: '应收运费',
  348. prop: 'landAmountD',
  349. index: 13,
  350. width: 100,
  351. overHidden: true,
  352. },
  353. {
  354. label: '应收杂费',
  355. prop: 'extraAmountD',
  356. index: 13,
  357. width: 100,
  358. overHidden: true,
  359. }
  360. )
  361. }
  362. if (this.roleName.indexOf('车队') !== -1) {
  363. for (let item of this.option.column) {
  364. if (item.prop === 'extraAmountC') return
  365. }
  366. this.option.column.push(
  367. {
  368. label: '物流运输',
  369. prop: 'dispatchDeptName',
  370. overHidden: true,
  371. index: 1,
  372. width: 100
  373. }, {
  374. label: '运输调度',
  375. prop: 'dispatcherName',
  376. overHidden: true,
  377. index: 1,
  378. width: 100,
  379. }, {
  380. label: '应付运费',
  381. prop: 'landAmountC',
  382. index: 13,
  383. width: 100,
  384. overHidden: true,
  385. },{
  386. label: '应付杂费',
  387. prop: 'extraAmountC',
  388. index: 13,
  389. width: 100,
  390. overHidden: true
  391. }
  392. )
  393. }
  394. if (this.roleName.indexOf('客户') !== -1) {
  395. for (let item of this.option.column) {
  396. if (item.prop === 'salesmanName') return
  397. }
  398. this.option.column.push(
  399. {
  400. label: '业务员',
  401. prop: 'salesmanName',
  402. index: 2,
  403. width: 60,
  404. overHidden: true,
  405. },{
  406. label: '物流运输',
  407. prop: 'dispatchDeptName',
  408. overHidden: true,
  409. index: 2,
  410. width: 100
  411. },
  412. {
  413. label: '客户名称',
  414. prop: 'corpShortName',
  415. index: 16,
  416. width: 100,
  417. overHidden: true,
  418. },
  419. {
  420. label: '应收运费',
  421. prop: 'landAmountD',
  422. index: 14,
  423. width: 100,
  424. overHidden: true,
  425. },
  426. {
  427. label: '应收杂费',
  428. prop: 'extraAmountD',
  429. index: 15,
  430. width: 100,
  431. overHidden: true,
  432. }
  433. )
  434. }
  435. }
  436. },
  437. openTrack(row, index) {
  438. if (index == 0) {
  439. this.$router.push({
  440. path: '/landTransportation/placeAnOrder/index',
  441. query: {id: row.orderId},
  442. });
  443. } else {
  444. // gaude({itemId: row.itemId, plateNo: row.plateNo, tenantId: '234557',color:'2'}).then(res => {
  445. // this.lineArr = res.data.data
  446. // this.dialogVisible = true
  447. // let this_ = this
  448. // setTimeout(function () {
  449. // this_.initMap();
  450. // }, 100)
  451. // })
  452. location({itemId: row.itemId, plateNo: row.plateNo, tenantId: '234557', color: '2'}).then(res => {
  453. console.log(res.data.data)
  454. console.log(this.lineArr[this.lineArr.length - 1])
  455. this.dialogVisible = true
  456. let this_ = this
  457. setTimeout(function () {
  458. this_.initMap(res.data.data, row.plateNo);
  459. }, 1000)
  460. })
  461. }
  462. },
  463. markerClick(e) {
  464. this.infoWindow.setContent(e.target.content);
  465. this.infoWindow.open(this.map, e.target.getPosition());
  466. },
  467. initMap(data, plateNo) {
  468. this.map = new AMap.Map("container", {resizeEnable: true});
  469. this.infoWindow = new AMap.InfoWindow({
  470. ffset: new AMap.Pixel(0, -30),
  471. offset: new AMap.Pixel(0, -30)
  472. });
  473. let icon = new AMap.Icon({
  474. size: new AMap.Size(52, 26), // 图标尺寸
  475. image: 'https://trade.tubaosoft.com/file/bladex/000000/1123598821738675201/che.png',
  476. imageSize: new AMap.Size(52, 26), // 根据所设置的大小拉伸或压缩图片
  477. });
  478. this.marker = new AMap.Marker({
  479. position: data.location,
  480. map: this.map,
  481. icon: icon,
  482. markerMeta: new AMap.Size(28, 28),
  483. offset: new AMap.Pixel(-26, -15),
  484. autoRotation: true,
  485. angle: -15
  486. });
  487. this.marker.content = '<div style="width: 300px;">'
  488. + '<p style="font-size: 22px;font-weight: bold;background-color: #2d8cf0;color: #fff;">' + plateNo + '</p>'
  489. + '<p style="padding: 5px 0"><span style="color: #a0a0a0">最后上报时间:</span>' + new Date(Number(data.time) + 8 * 60 * 60 * 1000).toJSON().split('T').join(' ').substr(0, 19) + '</p>'
  490. + '<div style="width: 150px;float: left;">'
  491. + '<p style="padding: 5px 0"><span style="color: #a0a0a0">车辆状态:</span>' + (data.speed > 0 ? '行驶中' : '停车') + '</p>'
  492. + '</div>'
  493. + '<div style="width: 150px;float: right;">'
  494. + '<p style="padding: 5px 0"><span style="color: #a0a0a0">速度:</span>' + data.speed + 'km/h</p>'
  495. + '</div>'
  496. + '<p><span style="color: #a0a0a0">当前位置:</span>' + data.address + '</p>'
  497. + '<p style="padding: 5px 0"><span style="color: #a0a0a0">经纬度:</span>' + data.location.join(',') + '</p>'
  498. + '</div>'
  499. this.infoWindow.open(this.map, this.map.getCenter());
  500. this.marker.on('click', this.markerClick);
  501. this.marker.emit('click', {target: this.marker});
  502. this.map.setFitView();
  503. },
  504. init() {
  505. this.getsalesTrend();
  506. let this_ = this
  507. this_.entrustTimer = setInterval(function () {
  508. if (JSON.parse(localStorage.getItem("saber-token")).content) {
  509. this_.getsalesTrend();
  510. }
  511. }, 60000)
  512. },
  513. query(data) {
  514. this.getsalesTrend(data)
  515. },
  516. getsalesTrend(data = {status: 0, mold: 0}) {
  517. this.loading = true;
  518. active(data).then(res => {
  519. this.tableData = res.data.data
  520. this.loading = false;
  521. })
  522. },
  523. ToBreak(val) {
  524. if (val) return val.replace(/\n/g, '<br/>')
  525. },
  526. refresh() {
  527. this.getsalesTrend()
  528. }
  529. }
  530. };
  531. </script>
  532. <style scoped src="../../../../../styles/demo-center.css"></style>
  533. <style scoped>
  534. #container {
  535. height: 80vh;
  536. width: 100%;
  537. }
  538. .input-card .btn {
  539. margin-right: 1.2rem;
  540. width: 9rem;
  541. }
  542. .input-card .btn:last-child {
  543. margin-right: 0;
  544. }
  545. </style>
  546. <style lang="scss" scoped>
  547. .home-container {
  548. padding: 0px 5px 5px 0px;
  549. box-sizing: border-box;
  550. height: 100%;
  551. ::v-deep .el-card__body {
  552. padding: 10px 15px;
  553. font-size: 14px;
  554. }
  555. &__card {
  556. width: 100%;
  557. height: 100%;
  558. }
  559. .title {
  560. display: flex;
  561. justify-content: space-between;
  562. }
  563. }
  564. .content {
  565. }
  566. ::v-deep .el-dialog {
  567. margin-top: 5vh !important;
  568. margin-bottom: 0 !important;
  569. }
  570. ::v-deep .el-dialog__body {
  571. padding: 0 20px 10px 20px !important;
  572. }
  573. ::v-deep .amap-info-close {
  574. right: 10px !important;
  575. top: 12px !important;
  576. }
  577. ::v-deep .amap-info-content {
  578. padding: 5px 5px 5px 5px !important;
  579. }
  580. </style>