index.vue 17 KB

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