index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740
  1. <template>
  2. <div>
  3. <basic-container v-show="show">
  4. <div class="home-container">
  5. <div style="display: flex;justify-content: center;">
  6. <div class="content">
  7. <div class="content-item" @click="handleClick('')">
  8. <div class="card">
  9. <div class="card-title card-title1">
  10. <span>
  11. </span>
  12. </div>
  13. <div class="card-content">
  14. <span class="card-content-num" :class="!activeName?'selected':''">{{ totalData.all }}</span>
  15. <span class="card-content-text" :class="!activeName?'selected':''">全部</span>
  16. </div>
  17. </div>
  18. </div>
  19. <div class="divider"/>
  20. <div class="content-item" @click="handleClick('0')">
  21. <div class="card">
  22. <div class="card-title card-title2">
  23. <span>
  24. </span>
  25. </div>
  26. <div class="card-content">
  27. <span class="card-content-num" :class="activeName === '0'?'selected':''">{{ totalData.zero }}</span>
  28. <span class="card-content-text" :class="activeName === '0'?'selected':''">未调度</span>
  29. </div>
  30. </div>
  31. </div>
  32. <div class="divider"/>
  33. <div class="content-item" @click="handleClick('1')">
  34. <div class="card">
  35. <div class="card-title card-title3">
  36. <span>
  37. </span>
  38. </div>
  39. <div class="card-content">
  40. <span class="card-content-num" :class="activeName === '1'?'selected':''">{{ totalData.one }}</span>
  41. <span class="card-content-text" :class="activeName === '1'?'selected':''">未派车</span>
  42. </div>
  43. </div>
  44. </div>
  45. </div>
  46. </div>
  47. </div>
  48. </basic-container>
  49. <basic-container v-show="show">
  50. <avue-crud
  51. :key="key"
  52. :table-loading="loading"
  53. :data="dataList"
  54. :page.sync="page"
  55. ref="crud"
  56. :option="option"
  57. @on-load="onLoad"
  58. @row-del="rowDel"
  59. @search-reset="query={};activeName = ''"
  60. @resetColumn="resetColumn"
  61. @saveColumn="saveColumn"
  62. @search-criteria-switch="searchCriteriaSwitch"
  63. @search-change="searchChange">
  64. <!-- <template slot="menuLeft" slot-scope="{size}">-->
  65. <!-- <el-button type="primary" :size="size" @click="rowSave">新增</el-button>-->
  66. <!-- </template>-->
  67. <template slot="corpNameSearch" slot-scope="{ row,index}">
  68. <crop-select
  69. v-model="row.corpId"
  70. ></crop-select>
  71. </template>
  72. <template slot="corpShortNameSearch" slot-scope="{ row,index}">
  73. <crop-select
  74. v-model="row.corpId"
  75. :corpType="'KH'"
  76. :label="'shortName'"
  77. ></crop-select>
  78. </template>
  79. <template slot="addressDetail" slot-scope="{ row,index}">
  80. <el-tooltip class="item" effect="dark" placement="top">
  81. <div v-html="ToBreak(row.addressDetail)" slot="content"></div>
  82. <div style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">{{ row.addressDetail }}</div>
  83. </el-tooltip>
  84. </template>
  85. <template slot="billNo" slot-scope="{row,index}">
  86. <span class="el-button--text" style="cursor: pointer" @click.stop="rowCell(row,index)">{{ row.billNo }}</span>
  87. </template>
  88. <template slot-scope="{row,index}" slot="menu">
  89. <el-button type="text"
  90. icon="el-icon-edit"
  91. size="small"
  92. @click.stop="rowCell(row,index)">编辑
  93. </el-button>
  94. <!-- <el-button type="text"-->
  95. <!-- icon="el-icon-delete"-->
  96. <!-- size="small"-->
  97. <!-- @click.stop="$refs.crud.rowDel(row,index)">删除</el-button>-->
  98. </template>
  99. <template slot="corpName" slot-scope="{row,index}">
  100. <span class="el-button--text" style="cursor: pointer" @click.stop="rowCell(row,index)">{{
  101. row.corpName
  102. }}</span>
  103. </template>
  104. <template slot="orderNo" slot-scope="{row,index}">
  105. <span class="el-button--text" style="cursor: pointer" @click.stop="rowCell(row,index)">{{
  106. row.orderNo
  107. }}</span>
  108. </template>
  109. </avue-crud>
  110. </basic-container>
  111. <detail-page v-if="!show" @backToList="backToList" :id="id" :home="home"></detail-page>
  112. </div>
  113. </template>
  114. <script>
  115. import detailPage from './detailPage'
  116. import {removeDelegationList, selectInvoiceList, totalList} from "@/api/landTransportation";
  117. import {businessStatisticsFrequency} from "@/api/wel";
  118. export default {
  119. name: "index",
  120. components: {
  121. detailPage
  122. },
  123. data() {
  124. return {
  125. id: '',
  126. show: true,
  127. loading: false,
  128. query: {},
  129. key: 0,
  130. dataList: [],
  131. totalData: {},
  132. page: {
  133. pageSize: 10,
  134. currentPage: 1,
  135. total: 0,
  136. pageSizes: [10, 50, 100, 200, 300]
  137. },
  138. option: {},
  139. activeName: '0',
  140. optionList: {
  141. stripe: true,
  142. align: 'center',
  143. menuWidth: 100,
  144. menu: false,
  145. index: true,
  146. addBtn: false,
  147. editBtn: false,
  148. delBtn: false,
  149. height: "auto",
  150. searchSpan: 8,
  151. searchIcon: true,
  152. column: [
  153. {
  154. label: '货运日期',
  155. prop: 'arrivalTime',
  156. overHidden: true,
  157. type: "date",
  158. searchRange: true,
  159. defaultTime: ['00:00:00', '23:59:59'],
  160. format: "yyyy-MM-dd HH:mm",
  161. valueFormat: "yyyy-MM-dd HH:mm:ss",
  162. index: 1,
  163. width: 134,
  164. search: true,
  165. }, {
  166. label: '业务员',
  167. index: 2,
  168. width: 74,
  169. prop: 'salesman',
  170. search: true,
  171. overHidden: true,
  172. type: "select",
  173. dicUrl: "/api/blade-user/userList",
  174. props: {
  175. label: "realName",
  176. value: "id"
  177. }
  178. }, {
  179. label: '运输调度',
  180. prop: 'dispatcherName',
  181. overHidden: true,
  182. index: 2,
  183. width: 76,
  184. }, {
  185. label: '货运地点',
  186. prop: 'addressDetail',
  187. index: 3,
  188. width: 122,
  189. search: true,
  190. }, {
  191. label: '提单号',
  192. prop: 'billNo',
  193. index: 4,
  194. overHidden: true,
  195. width: 140,
  196. search: true,
  197. }, {
  198. label: '场站',
  199. prop: 'station',
  200. overHidden: true,
  201. index: 5,
  202. width: 70,
  203. search: true,
  204. }, {
  205. label: '计划箱量',
  206. prop: 'ctnDetail',
  207. overHidden: true,
  208. index: 6,
  209. width: 84
  210. }, {
  211. label: '已派箱量',
  212. prop: 'dispatchCtnDetail',
  213. overHidden: true,
  214. index: 7,
  215. width: 84
  216. }, {
  217. label: '受理箱量',
  218. prop: 'sendCtnDetail',
  219. overHidden: true,
  220. index: 8,
  221. width: 94
  222. }, {
  223. label: '车队',
  224. index: 9,
  225. width: 92,
  226. overHidden: true,
  227. prop: 'fleetNameDetail'
  228. }, {
  229. label: '运费',
  230. index: 10,
  231. width: 98,
  232. prop: 'freight'
  233. }, {
  234. label: '状态',
  235. prop: 'itemStatusDetail',
  236. index: 11,
  237. overHidden: true,
  238. width: 140
  239. }, {
  240. label: '公司名称',
  241. prop: 'corpShortName',
  242. overHidden: true,
  243. index: 12,
  244. width: 112,
  245. search: true,
  246. }, {
  247. label: '订单号',
  248. prop: 'orderNo',
  249. index: 13,
  250. overHidden: true,
  251. width: 100,
  252. search: true,
  253. }
  254. // , {
  255. // label: '所属公司',
  256. // prop: 'belongCompany',
  257. // overHidden: true,
  258. // index: 4,
  259. // width: 140,
  260. // search: true,
  261. // }
  262. // , {
  263. // label: '货物名称',
  264. // prop: 'goods',
  265. // overHidden: true,
  266. // index: 13,
  267. // width: 140,
  268. // search: true,
  269. // }
  270. // , {
  271. // label: '船名航次',
  272. // prop: 'factory',
  273. // overHidden: true,
  274. // index: 14,
  275. // width: 140,
  276. // search: true,
  277. // }
  278. ,
  279. {
  280. label: '制单日期',
  281. overHidden: true,
  282. prop: 'createTime',
  283. type: "date",
  284. searchRange: true,
  285. defaultTime: ['00:00:00', '23:59:59'],
  286. format: "yyyy-MM-dd HH:mm",
  287. valueFormat: "yyyy-MM-dd HH:mm:ss",
  288. index: 15,
  289. width: 128,
  290. search: true,
  291. }]
  292. },
  293. home: false,
  294. dispatchTimer: null
  295. }
  296. },
  297. activated() {
  298. if (this.$route.query.orderId) {
  299. this.rowCell({id: this.$route.query.orderId}, 0)
  300. this.$router.$avueRouter.closeTag(window.location.hash.slice(1))
  301. this.home = true
  302. }
  303. // if (this.$route.query.params){
  304. // this.rowCell({id:this.$route.query.params},0)
  305. // }
  306. },
  307. async created() {
  308. this.option = await this.getColumnData(this.getColumnName(86), this.optionList);
  309. this.key++
  310. let i = 0;
  311. this.option.column.forEach(item => {
  312. if (item.search) i++
  313. })
  314. if (i % 3 !== 0) {
  315. const num = 3 - Number(i % 3)
  316. this.option.searchMenuSpan = num * 8;
  317. this.option.searchMenuPosition = "right";
  318. }
  319. },
  320. mounted() {
  321. businessStatisticsFrequency().then(res=>{
  322. let this_ = this;
  323. this_.dispatchTimer = setInterval(function () {
  324. if (JSON.parse(localStorage.getItem("saber-token")).content) {
  325. totalList(2).then(res => {
  326. this_.totalData = res.data.data
  327. })
  328. }
  329. }, Number(res.data.data[0].dictKey)*1000)
  330. })
  331. },
  332. beforeDestroy() {
  333. clearInterval(this.dispatchTimer); //关闭
  334. },
  335. methods: {
  336. //自定义列保存
  337. async saveColumn() {
  338. /**
  339. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  340. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  341. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  342. */
  343. const inSave = await this.saveColumnData(this.getColumnName(86), this.option);
  344. if (inSave) {
  345. this.$message.success("保存成功");
  346. //关闭窗口
  347. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  348. }
  349. },
  350. //自定义列重置
  351. async resetColumn() {
  352. this.option = this.optionList;
  353. const inSave = await this.delColumnData(this.getColumnName(86), this.optionList);
  354. if (inSave) {
  355. this.$message.success("重置成功");
  356. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  357. }
  358. },
  359. // 获得高度
  360. searchCriteriaSwitch(type) {
  361. if (type) {
  362. this.option.height = this.option.height - 138
  363. } else {
  364. this.option.height = this.option.height + 138
  365. }
  366. this.$refs.crud.getTableHeight()
  367. },
  368. onLoad(page, params = {}) {
  369. totalList(2).then(res => {
  370. this.totalData = res.data.data
  371. })
  372. let queryParams = {
  373. size: page.pageSize,
  374. current: page.currentPage,
  375. itemStatus: this.activeName,
  376. status: this.activeName,
  377. kind: '2',
  378. ...params,
  379. ...Object.assign(params, this.query)
  380. }
  381. this.loading = true;
  382. selectInvoiceList(queryParams).then(res => {
  383. this.dataList = res.data.data.records
  384. this.page.total = res.data.data.total
  385. this.option.height = window.innerHeight - 350;
  386. }).finally(() => {
  387. this.loading = false;
  388. })
  389. },
  390. //搜索
  391. searchChange(params, done) {
  392. let data = params
  393. if (params.arrivalTime) {
  394. data.beginArrivalTime = params.arrivalTime[0]
  395. data.endArrivalTime = params.arrivalTime[1]
  396. }
  397. if (params.createTime) {
  398. data.beginCrateTime = params.createTime[0]
  399. data.endCrateTime = params.createTime[1]
  400. }
  401. delete data.arrivalTime
  402. delete data.createTime
  403. this.query = data;
  404. this.onLoad(this.page, data)
  405. done();
  406. },
  407. //列表删除
  408. rowDel(row) {
  409. this.$confirm('此操作将永久删除该单据, 是否继续?', '提示', {
  410. confirmButtonText: '确定',
  411. cancelButtonText: '取消',
  412. type: 'warning'
  413. }).then(() => {
  414. removeDelegationList({ids: row.id}).then(res => {
  415. this.$message.success('删除成功');
  416. this.onLoad(this.page)
  417. })
  418. }).catch(() => {
  419. this.$message({
  420. type: 'info',
  421. message: '已取消删除'
  422. });
  423. });
  424. },
  425. //行编辑
  426. rowCell(row, index) {
  427. this.id = row.id
  428. this.show = false
  429. },
  430. rowSave() {
  431. this.show = false
  432. },
  433. backToList(type) {
  434. if (type) {
  435. this.$router.push({
  436. path: '/landTransportation/dispatchingCars/index'
  437. });
  438. }
  439. this.show = true
  440. this.onLoad(this.page)
  441. },
  442. //切换订单状态
  443. handleClick(tab) {
  444. this.activeName = tab
  445. this.onLoad(this.page)
  446. },
  447. ToBreak(val) {
  448. if (val) return val.replace(/\n/g, '<br/>')
  449. }
  450. }
  451. }
  452. </script>
  453. <style lang="scss" scoped>
  454. .home-container {
  455. padding: 0px 5px 5px 5px;
  456. box-sizing: border-box;
  457. height: 100%;
  458. ::v-deep .el-card__body {
  459. padding: 10px 15px;
  460. font-size: 14px;
  461. }
  462. &__card {
  463. width: 100%;
  464. height: 100%;
  465. }
  466. .title {
  467. display: flex;
  468. justify-content: space-between;
  469. .right {
  470. display: flex;
  471. align-items: center;
  472. &_but {
  473. margin-right: 10px;
  474. border: 1px solid #409eff;
  475. width: 80px;
  476. border-radius: 3px;
  477. display: flex;
  478. &_left {
  479. width: 40px;
  480. text-align: center;
  481. color: #409eff;
  482. cursor: pointer;
  483. }
  484. &_right {
  485. width: 40px;
  486. text-align: center;
  487. color: #409eff;
  488. cursor: pointer;
  489. }
  490. &_active {
  491. color: #fff;
  492. background-color: #409eff;
  493. }
  494. }
  495. }
  496. }
  497. }
  498. .content {
  499. display: flex;
  500. justify-content: center;
  501. align-items: center;
  502. height: 6vh !important;
  503. width: 80vw;
  504. .divider {
  505. display: block;
  506. height: 0px;
  507. width: 100%;
  508. border-top: 1px dashed #dcdfe6;
  509. }
  510. &-item {
  511. margin-left: 1vw;
  512. .card {
  513. width: 130px;
  514. display: flex;
  515. align-items: center;
  516. &-title {
  517. width: 40px;
  518. height: 40px;
  519. text-align: center;
  520. border-radius: 50%;
  521. font-size: 20px;
  522. font-weight: 600;
  523. display: flex;
  524. justify-content: center;
  525. align-items: center;
  526. span {
  527. line-height: 20px;
  528. }
  529. }
  530. &-title1 {
  531. color: #037fe1;
  532. background-color: rgba(3, 127, 225, 0.15);
  533. }
  534. &-title2 {
  535. color: #ffa21e;
  536. background-color: rgba(255, 162, 30, 0.15);
  537. }
  538. &-title3 {
  539. color: #fb5b60;
  540. background-color: rgba(251, 91, 96, 0.15);
  541. }
  542. &-title4 {
  543. color: #42bc6f;
  544. background-color: rgba(66, 188, 111, 0.15);
  545. }
  546. &-title5 {
  547. color: #14cde1;
  548. background-color: rgba(52, 149, 161, 0.15);
  549. }
  550. &-title6 {
  551. color: rgba(4, 66, 31, 0.63);
  552. background-color: rgba(66, 188, 111, 0.15);
  553. }
  554. &-content {
  555. padding-left: 1vw;
  556. display: flex;
  557. flex-direction: column;
  558. &-num {
  559. font-size: 20px;
  560. font-weight: 600;
  561. }
  562. &-text {
  563. color: #909399;
  564. }
  565. }
  566. }
  567. }
  568. }
  569. </style>
  570. <style lang="scss" scoped>
  571. .selected{
  572. color: #1e9fff !important;
  573. }
  574. .home-container {
  575. padding: 0px 5px 5px 5px;
  576. box-sizing: border-box;
  577. height: 100%;
  578. ::v-deep .el-card__body {
  579. padding: 10px 15px;
  580. font-size: 14px;
  581. }
  582. &__card {
  583. width: 100%;
  584. height: 100%;
  585. }
  586. .title {
  587. display: flex;
  588. justify-content: space-between;
  589. .right {
  590. display: flex;
  591. align-items: center;
  592. &_but {
  593. margin-right: 10px;
  594. border: 1px solid #409eff;
  595. width: 80px;
  596. border-radius: 3px;
  597. display: flex;
  598. &_left {
  599. width: 40px;
  600. text-align: center;
  601. color: #409eff;
  602. cursor: pointer;
  603. }
  604. &_right {
  605. width: 40px;
  606. text-align: center;
  607. color: #409eff;
  608. cursor: pointer;
  609. }
  610. &_active {
  611. color: #fff;
  612. background-color: #409eff;
  613. }
  614. }
  615. }
  616. }
  617. }
  618. .content {
  619. display: flex;
  620. justify-content: center;
  621. align-items: center;
  622. height: 15vh;
  623. width: 80vw;
  624. .divider {
  625. display: block;
  626. height: 0px;
  627. width: 100%;
  628. border-top: 1px dashed #dcdfe6;
  629. }
  630. &-item {
  631. margin-left: 1vw;
  632. .card {
  633. width: 130px;
  634. display: flex;
  635. align-items: center;
  636. &-title {
  637. width: 40px;
  638. height: 40px;
  639. text-align: center;
  640. border-radius: 50%;
  641. font-size: 20px;
  642. font-weight: 600;
  643. display: flex;
  644. justify-content: center;
  645. align-items: center;
  646. span {
  647. line-height: 20px;
  648. }
  649. }
  650. &-title1 {
  651. color: #037fe1;
  652. background-color: rgba(3, 127, 225, 0.15);
  653. }
  654. &-title2 {
  655. color: #ffa21e;
  656. background-color: rgba(255, 162, 30, 0.15);
  657. }
  658. &-title3 {
  659. color: #fb5b60;
  660. background-color: rgba(251, 91, 96, 0.15);
  661. }
  662. &-title4 {
  663. color: #42bc6f;
  664. background-color: rgba(66, 188, 111, 0.15);
  665. }
  666. &-title5 {
  667. color: #14cde1;
  668. background-color: rgba(52, 149, 161, 0.15);
  669. }
  670. &-title6 {
  671. color: rgba(4, 66, 31, 0.63);
  672. background-color: rgba(66, 188, 111, 0.15);
  673. }
  674. &-content {
  675. padding-left: 1vw;
  676. display: flex;
  677. flex-direction: column;
  678. &-num {
  679. font-size: 20px;
  680. font-weight: 600;
  681. }
  682. &-text {
  683. color: #909399;
  684. }
  685. }
  686. }
  687. }
  688. }
  689. </style>