index.vue 17 KB

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