sales-trend.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  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. roleName: localStorage.getItem("roleName").split(','),
  62. dialogVisible: false,
  63. loading: false,
  64. tableData: [],
  65. map: null,
  66. infoWindow: null,
  67. marker: null,
  68. lineArr: [],
  69. key: 0,
  70. option: {},
  71. optionList: {
  72. stripe: true,
  73. index: true,
  74. menu: false,
  75. refreshBtn: true,
  76. addBtn: false,
  77. height: 390,
  78. align: 'center',
  79. column: [
  80. {
  81. label: '货运日期',
  82. prop: 'arrivalTime',
  83. type: "date",
  84. format: "yyyy-MM-dd HH:mm",
  85. index: 1,
  86. width: 150,
  87. overHidden: true,
  88. },
  89. {
  90. label: '业务员',
  91. prop: 'salesmanName',
  92. index: 2,
  93. width: 60,
  94. overHidden: true,
  95. },
  96. {
  97. label: '货运地点',
  98. prop: 'addressDetail',
  99. index: 3,
  100. width: 100
  101. },
  102. {
  103. label: '票据号',
  104. prop: 'receiptNo',
  105. index: 4,
  106. width: 100,
  107. overHidden: true,
  108. },
  109. {
  110. label: '提单号',
  111. prop: 'billNo',
  112. index: 5,
  113. width: 130,
  114. overHidden: true,
  115. },
  116. {
  117. label: '场站',
  118. prop: 'station',
  119. index: 6,
  120. width: 100,
  121. overHidden: true,
  122. },
  123. {
  124. label: '箱型箱量',
  125. prop: 'ctnDetail',
  126. index: 7,
  127. width: 100,
  128. overHidden: true,
  129. },
  130. {
  131. label: '车队',
  132. prop: 'fleetShortName',
  133. index: 8,
  134. width: 190,
  135. overHidden: true,
  136. },
  137. {
  138. label: '车号',
  139. prop: 'plateNo',
  140. index: 9,
  141. width: 100,
  142. overHidden: true,
  143. },
  144. {
  145. label: '状态',
  146. prop: 'status',
  147. type: 'select',
  148. dicUrl: "/api/blade-system/dict-biz/dictionary?code=land_order_status",
  149. props: {
  150. label: "dictValue",
  151. value: "dictKey"
  152. },
  153. dataType: "string",
  154. index: 10,
  155. width: 100,
  156. overHidden: true,
  157. },
  158. {
  159. label: '运费',
  160. prop: 'landAmountD',
  161. index: 11,
  162. width: 100,
  163. overHidden: true,
  164. },
  165. {
  166. label: '应收杂费',
  167. prop: 'extraAmountD',
  168. index: 13,
  169. width: 100,
  170. overHidden: true,
  171. },
  172. {
  173. label: '客户名称',
  174. prop: 'corpShortName',
  175. index: 14,
  176. width: 100,
  177. overHidden: true,
  178. },
  179. {
  180. label: '备注',
  181. prop: 'remarks',
  182. index: 15,
  183. width: 100,
  184. overHidden: true,
  185. },
  186. ]
  187. },
  188. };
  189. },
  190. async mounted() {
  191. this.option = await this.getColumnData(this.getColumnName(140), this.optionList);
  192. this.key++
  193. this.init();
  194. for (let item of this.option.column) {
  195. if (item.prop === 'extraAmountC') return
  196. }
  197. if (this.roleName.indexOf('平台') !== -1) {
  198. this.option.column.push(
  199. {
  200. label: '应付杂费',
  201. prop: 'extraAmountC',
  202. index: 12,
  203. width: 100,
  204. overHidden: true
  205. }
  206. )
  207. }
  208. },
  209. beforeDestroy() {
  210. this.map && this.map.destroy();
  211. },
  212. methods: {
  213. //自定义列保存
  214. async saveColumn() {
  215. /**
  216. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  217. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  218. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  219. */
  220. const inSave = await this.saveColumnData(this.getColumnName(140), this.option);
  221. if (inSave) {
  222. this.$message.success("保存成功");
  223. //关闭窗口
  224. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  225. }
  226. },
  227. //自定义列重置
  228. async resetColumn() {
  229. this.option = this.optionList;
  230. const inSave = await this.delColumnData(this.getColumnName(140), this.optionList);
  231. if (inSave) {
  232. this.$message.success("重置成功");
  233. //关闭窗口
  234. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  235. for (let item of this.option.column) {
  236. if (item.prop === 'extraAmountC') return false
  237. }
  238. if (this.roleName.indexOf('平台') !== -1) {
  239. console.log(this.option.column)
  240. this.option.column.push(
  241. {
  242. label: '应付杂费',
  243. prop: 'extraAmountC',
  244. index: 12,
  245. width: 100,
  246. overHidden: true
  247. }
  248. )
  249. }
  250. this.key++
  251. }
  252. },
  253. openTrack(row, index) {
  254. if (index == 0) {
  255. this.$router.push({
  256. path: '/landTransportation/placeAnOrder/index',
  257. query: {id: row.orderId},
  258. });
  259. } else {
  260. // gaude({itemId: row.itemId, plateNo: row.plateNo, tenantId: '234557',color:'2'}).then(res => {
  261. // this.lineArr = res.data.data
  262. // this.dialogVisible = true
  263. // let this_ = this
  264. // setTimeout(function () {
  265. // this_.initMap();
  266. // }, 100)
  267. // })
  268. location({itemId: row.itemId, plateNo: row.plateNo, tenantId: '234557', color: '2'}).then(res => {
  269. console.log(res.data.data)
  270. console.log(this.lineArr[this.lineArr.length - 1])
  271. this.dialogVisible = true
  272. let this_ = this
  273. setTimeout(function () {
  274. this_.initMap(res.data.data, row.plateNo);
  275. }, 1000)
  276. })
  277. }
  278. },
  279. markerClick(e) {
  280. this.infoWindow.setContent(e.target.content);
  281. this.infoWindow.open(this.map, e.target.getPosition());
  282. },
  283. initMap(data, plateNo) {
  284. this.map = new AMap.Map("container", {resizeEnable: true});
  285. this.infoWindow = new AMap.InfoWindow({
  286. ffset: new AMap.Pixel(0, -30),
  287. offset: new AMap.Pixel(0, -30)
  288. });
  289. let icon = new AMap.Icon({
  290. size: new AMap.Size(52, 26), // 图标尺寸
  291. image: 'https://trade.tubaosoft.com/file/bladex/000000/1123598821738675201/che.png',
  292. imageSize: new AMap.Size(52, 26), // 根据所设置的大小拉伸或压缩图片
  293. });
  294. this.marker = new AMap.Marker({
  295. position: data.location,
  296. map: this.map,
  297. icon: icon,
  298. markerMeta: new AMap.Size(28, 28),
  299. offset: new AMap.Pixel(-26, -15),
  300. autoRotation: true,
  301. angle: -15
  302. });
  303. this.marker.content = '<div style="width: 300px;">'
  304. + '<p style="font-size: 22px;font-weight: bold;background-color: #2d8cf0;color: #fff;">' + plateNo + '</p>'
  305. + '<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>'
  306. + '<div style="width: 150px;float: left;">'
  307. + '<p style="padding: 5px 0"><span style="color: #a0a0a0">车辆状态:</span></p>'
  308. + '<p style="padding: 5px 0"><span style="color: #a0a0a0">今日里程:</span>' + (data.distance.length > 0 ? data.distance : 0) + '</p>'
  309. + '</div>'
  310. + '<div style="width: 150px;float: right;">'
  311. + '<p style="padding: 5px 0"><span style="color: #a0a0a0">速度:</span>' + data.speed + '</p>'
  312. + '<p style="padding: 5px 0"><span style="color: #a0a0a0">总里程:</span>' + data.mileage + '</p>'
  313. + '</div>'
  314. + '<p><span style="color: #a0a0a0">当前位置:</span>' + data.address + '</p>'
  315. + '<p style="padding: 5px 0"><span style="color: #a0a0a0">经纬度:</span>' + data.location.join(',') + '</p>'
  316. + '</div>'
  317. this.infoWindow.open(this.map, this.map.getCenter());
  318. this.marker.on('click', this.markerClick);
  319. this.marker.emit('click', {target: this.marker});
  320. this.map.setFitView();
  321. },
  322. init() {
  323. this.getsalesTrend();
  324. },
  325. query(data) {
  326. this.getsalesTrend(data)
  327. },
  328. getsalesTrend(data = {status: 0, mold: 0}) {
  329. this.loading = true;
  330. active(data).then(res => {
  331. this.tableData = res.data.data
  332. this.loading = false;
  333. })
  334. },
  335. ToBreak(val) {
  336. if (val) return val.replace(/\n/g, '<br/>')
  337. },
  338. refresh() {
  339. this.init()
  340. }
  341. }
  342. };
  343. </script>
  344. <style scoped src="../../../../../styles/demo-center.css"></style>
  345. <style scoped>
  346. #container {
  347. height: 80vh;
  348. width: 100%;
  349. }
  350. .input-card .btn {
  351. margin-right: 1.2rem;
  352. width: 9rem;
  353. }
  354. .input-card .btn:last-child {
  355. margin-right: 0;
  356. }
  357. </style>
  358. <style lang="scss" scoped>
  359. .home-container {
  360. padding: 0px 5px 5px 0px;
  361. box-sizing: border-box;
  362. height: 100%;
  363. ::v-deep .el-card__body {
  364. padding: 10px 15px;
  365. font-size: 14px;
  366. }
  367. &__card {
  368. width: 100%;
  369. height: 100%;
  370. }
  371. .title {
  372. display: flex;
  373. justify-content: space-between;
  374. }
  375. }
  376. .content {
  377. }
  378. ::v-deep .el-dialog {
  379. margin-top: 5vh !important;
  380. margin-bottom: 0 !important;
  381. }
  382. ::v-deep .el-dialog__body {
  383. padding: 0 20px 10px 20px !important;
  384. }
  385. ::v-deep .amap-info-close{
  386. right: 10px!important;
  387. top: 12px !important;
  388. }
  389. ::v-deep .amap-info-content{
  390. padding: 5px 5px 5px 5px !important;
  391. }
  392. </style>