index.vue 17 KB

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