index.vue 20 KB

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