index.vue 18 KB

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