index.vue 17 KB

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