index.vue 19 KB

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