index.vue 25 KB

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