index.vue 21 KB

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