index.vue 16 KB

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