index.vue 19 KB

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