index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689
  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"></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: '',
  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:ss",
  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: 'corpName',
  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:ss",
  261. valueFormat: "yyyy-MM-dd HH:mm:ss",
  262. index: 15,
  263. width: 140,
  264. search: true,
  265. }]
  266. }
  267. }
  268. },
  269. activated() {
  270. if (this.$route.query.orderId){
  271. this.rowCell({id:this.$route.query.orderId},0)
  272. this.$router.$avueRouter.closeTag(window.location.hash.slice(1))
  273. }
  274. // if (this.$route.query.params){
  275. // this.rowCell({id:this.$route.query.params},0)
  276. // }
  277. },
  278. async created() {
  279. this.option = await this.getColumnData(this.getColumnName(86), this.optionList);
  280. this.key++
  281. let i = 0;
  282. this.option.column.forEach(item => {
  283. if (item.search) i++
  284. })
  285. if (i % 3 !== 0) {
  286. const num = 3 - Number(i % 3)
  287. this.option.searchMenuSpan = num * 8;
  288. this.option.searchMenuPosition = "right";
  289. }
  290. },
  291. methods: {
  292. //自定义列保存
  293. async saveColumn() {
  294. /**
  295. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  296. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  297. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  298. */
  299. const inSave = await this.saveColumnData(this.getColumnName(86), this.option);
  300. if (inSave) {
  301. this.$message.success("保存成功");
  302. //关闭窗口
  303. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  304. }
  305. },
  306. //自定义列重置
  307. async resetColumn() {
  308. this.option = this.optionList;
  309. const inSave = await this.delColumnData(this.getColumnName(86), this.optionList);
  310. if (inSave) {
  311. this.$message.success("重置成功");
  312. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  313. }
  314. },
  315. // 获得高度
  316. searchCriteriaSwitch(type) {
  317. if (type) {
  318. this.option.height = this.option.height - 138
  319. } else {
  320. this.option.height = this.option.height + 138
  321. }
  322. this.$refs.crud.getTableHeight()
  323. },
  324. onLoad(page, params={}) {
  325. totalList(2).then(res => {
  326. this.totalData = res.data.data
  327. })
  328. let queryParams = {
  329. size: page.pageSize,
  330. current: page.currentPage,
  331. itemStatus: this.activeName,
  332. status: this.activeName,
  333. kind: '2',
  334. ...params,
  335. ...Object.assign(params, this.query)
  336. }
  337. this.loading = true;
  338. selectInvoiceList(queryParams).then(res => {
  339. this.dataList = res.data.data.records
  340. this.page.total = res.data.data.total
  341. this.option.height = window.innerHeight - 350;
  342. }).finally(() => {
  343. this.loading = false;
  344. })
  345. },
  346. //搜索
  347. searchChange(params, done) {
  348. let data = params
  349. if (params.arrivalTime) {
  350. data.beginArrivalTime = params.arrivalTime[0]
  351. data.endArrivalTime = params.arrivalTime[1]
  352. }
  353. if (params.createTime) {
  354. data.beginCrateTime = params.createTime[0]
  355. data.endCrateTime = params.createTime[1]
  356. }
  357. delete data.arrivalTime
  358. delete data.createTime
  359. this.query = data;
  360. this.onLoad(this.page, data)
  361. done();
  362. },
  363. //列表删除
  364. rowDel(row) {
  365. this.$confirm('此操作将永久删除该单据, 是否继续?', '提示', {
  366. confirmButtonText: '确定',
  367. cancelButtonText: '取消',
  368. type: 'warning'
  369. }).then(() => {
  370. removeDelegationList({ids: row.id}).then(res => {
  371. this.$message.success('删除成功');
  372. this.onLoad(this.page)
  373. })
  374. }).catch(() => {
  375. this.$message({
  376. type: 'info',
  377. message: '已取消删除'
  378. });
  379. });
  380. },
  381. //行编辑
  382. rowCell(row, index) {
  383. this.id = row.id
  384. this.show = false
  385. },
  386. rowSave() {
  387. this.show = false
  388. },
  389. backToList() {
  390. this.show = true
  391. this.onLoad(this.page)
  392. },
  393. //切换订单状态
  394. handleClick(tab) {
  395. this.activeName = tab
  396. this.onLoad(this.page)
  397. },
  398. ToBreak (val) {
  399. if (val)return val.replace(/\n/g, '<br/>')
  400. }
  401. }
  402. }
  403. </script>
  404. <style lang="scss" scoped>
  405. .home-container {
  406. padding: 0px 5px 5px 5px;
  407. box-sizing: border-box;
  408. height: 100%;
  409. ::v-deep .el-card__body {
  410. padding: 10px 15px;
  411. font-size: 14px;
  412. }
  413. &__card {
  414. width: 100%;
  415. height: 100%;
  416. }
  417. .title {
  418. display: flex;
  419. justify-content: space-between;
  420. .right {
  421. display: flex;
  422. align-items: center;
  423. &_but {
  424. margin-right: 10px;
  425. border: 1px solid #409eff;
  426. width: 80px;
  427. border-radius: 3px;
  428. display: flex;
  429. &_left {
  430. width: 40px;
  431. text-align: center;
  432. color: #409eff;
  433. cursor: pointer;
  434. }
  435. &_right {
  436. width: 40px;
  437. text-align: center;
  438. color: #409eff;
  439. cursor: pointer;
  440. }
  441. &_active {
  442. color: #fff;
  443. background-color: #409eff;
  444. }
  445. }
  446. }
  447. }
  448. }
  449. .content {
  450. display: flex;
  451. justify-content: center;
  452. align-items: center;
  453. height: 6vh !important;
  454. width: 80vw;
  455. .divider {
  456. display: block;
  457. height: 0px;
  458. width: 100%;
  459. border-top: 1px dashed #dcdfe6;
  460. }
  461. &-item {
  462. margin-left: 1vw;
  463. .card {
  464. width: 130px;
  465. display: flex;
  466. align-items: center;
  467. &-title {
  468. width: 40px;
  469. height: 40px;
  470. text-align: center;
  471. border-radius: 50%;
  472. font-size: 20px;
  473. font-weight: 600;
  474. display: flex;
  475. justify-content: center;
  476. align-items: center;
  477. span {
  478. line-height: 20px;
  479. }
  480. }
  481. &-title1 {
  482. color: #037fe1;
  483. background-color: rgba(3, 127, 225, 0.15);
  484. }
  485. &-title2 {
  486. color: #ffa21e;
  487. background-color: rgba(255, 162, 30, 0.15);
  488. }
  489. &-title3 {
  490. color: #fb5b60;
  491. background-color: rgba(251, 91, 96, 0.15);
  492. }
  493. &-title4 {
  494. color: #42bc6f;
  495. background-color: rgba(66, 188, 111, 0.15);
  496. }
  497. &-title5 {
  498. color: #14cde1;
  499. background-color: rgba(52, 149, 161, 0.15);
  500. }
  501. &-title6 {
  502. color: rgba(4, 66, 31, 0.63);
  503. background-color: rgba(66, 188, 111, 0.15);
  504. }
  505. &-content {
  506. padding-left: 1vw;
  507. display: flex;
  508. flex-direction: column;
  509. &-num {
  510. font-size: 20px;
  511. font-weight: 600;
  512. }
  513. &-text {
  514. color: #909399;
  515. }
  516. }
  517. }
  518. }
  519. }
  520. </style>
  521. <style lang="scss" scoped>
  522. .home-container {
  523. padding: 0px 5px 5px 5px;
  524. box-sizing: border-box;
  525. height: 100%;
  526. ::v-deep .el-card__body {
  527. padding: 10px 15px;
  528. font-size: 14px;
  529. }
  530. &__card {
  531. width: 100%;
  532. height: 100%;
  533. }
  534. .title {
  535. display: flex;
  536. justify-content: space-between;
  537. .right {
  538. display: flex;
  539. align-items: center;
  540. &_but {
  541. margin-right: 10px;
  542. border: 1px solid #409eff;
  543. width: 80px;
  544. border-radius: 3px;
  545. display: flex;
  546. &_left {
  547. width: 40px;
  548. text-align: center;
  549. color: #409eff;
  550. cursor: pointer;
  551. }
  552. &_right {
  553. width: 40px;
  554. text-align: center;
  555. color: #409eff;
  556. cursor: pointer;
  557. }
  558. &_active {
  559. color: #fff;
  560. background-color: #409eff;
  561. }
  562. }
  563. }
  564. }
  565. }
  566. .content {
  567. display: flex;
  568. justify-content: center;
  569. align-items: center;
  570. height: 15vh;
  571. width: 80vw;
  572. .divider {
  573. display: block;
  574. height: 0px;
  575. width: 100%;
  576. border-top: 1px dashed #dcdfe6;
  577. }
  578. &-item {
  579. margin-left: 1vw;
  580. .card {
  581. width: 130px;
  582. display: flex;
  583. align-items: center;
  584. &-title {
  585. width: 40px;
  586. height: 40px;
  587. text-align: center;
  588. border-radius: 50%;
  589. font-size: 20px;
  590. font-weight: 600;
  591. display: flex;
  592. justify-content: center;
  593. align-items: center;
  594. span {
  595. line-height: 20px;
  596. }
  597. }
  598. &-title1 {
  599. color: #037fe1;
  600. background-color: rgba(3, 127, 225, 0.15);
  601. }
  602. &-title2 {
  603. color: #ffa21e;
  604. background-color: rgba(255, 162, 30, 0.15);
  605. }
  606. &-title3 {
  607. color: #fb5b60;
  608. background-color: rgba(251, 91, 96, 0.15);
  609. }
  610. &-title4 {
  611. color: #42bc6f;
  612. background-color: rgba(66, 188, 111, 0.15);
  613. }
  614. &-title5 {
  615. color: #14cde1;
  616. background-color: rgba(52, 149, 161, 0.15);
  617. }
  618. &-title6 {
  619. color: rgba(4, 66, 31, 0.63);
  620. background-color: rgba(66, 188, 111, 0.15);
  621. }
  622. &-content {
  623. padding-left: 1vw;
  624. display: flex;
  625. flex-direction: column;
  626. &-num {
  627. font-size: 20px;
  628. font-weight: 600;
  629. }
  630. &-text {
  631. color: #909399;
  632. }
  633. }
  634. }
  635. }
  636. }
  637. </style>