tranManagementTransport.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  1. <!--运输任务-->
  2. <template>
  3. <div>
  4. <BaseHeaderLayout :leftSpan="8">
  5. <template slot="left">
  6. <ws-button class="but" type="primary" @click="handleAdd()" v-hasPermission="
  7. `transportationTask.transportation.transportationInfo.add`
  8. ">添加</ws-button>
  9. </template>
  10. <template slot="right">
  11. <span style="width: 150px; display: inline-block;color: #8890B1;">状态:</span>
  12. <ws-select v-model="searchTypeText" placeholder="" class="typeselect" @change="selecttaskType"
  13. :value="searchType">
  14. <ws-option v-for="item in taskTypeList" :key="item.value" :label="item.value" :value="item.value"
  15. style="color: #8890B1;" />
  16. </ws-select>
  17. <span style="width: 150px; display: inline-block;color: #8890B1;">起点:</span>
  18. <el-input label="起点" placeholder="请输入起点" clearable maxlength="200" type="input" v-model="start"></el-input>
  19. <span style="width: 150px; display: inline-block;color: #8890B1;">终点:</span>
  20. <el-input label="终点" placeholder="请输入终点" clearable maxlength="200" type="input" v-model="end"></el-input>
  21. <el-input @keyup.enter.native="lookUp()" v-model="searchKeyWord" placeholder="可按合同编号或运输任务编号查找" clearable
  22. maxlength="500" type="input" class="findValue"></el-input>
  23. <div class="search">
  24. <ws-button class="find" type="primary" @click="lookUp()">
  25. <img width="16" height="16" style="
  26. vertical-align: text-top;
  27. position: relative;
  28. top: 0px;
  29. left: -8px;
  30. " src="../../../public/img/sousuo.png" alt />
  31. </ws-button>
  32. </div>
  33. </template>
  34. </BaseHeaderLayout>
  35. <el-table class="wenzi" :data="gainList.records" style="width: 100%; " height="calc(100% - 110px)">
  36. <el-table-column type="index" label="序号">
  37. <template scope="scope">
  38. <span v-if="scope.$index < 9">0{{ scope.$index + 1 }}</span>
  39. <span v-else>{{ scope.$index + 1 }}</span>
  40. </template>
  41. </el-table-column>
  42. <el-table-column prop="taskNo" label="运输任务编号" width="140"></el-table-column>
  43. <!-- <el-table-column prop="taskNo" label="任务类型" width="140"></el-table-column> -->
  44. <el-table-column prop="contractNo" label="合同编号" width="160"></el-table-column>
  45. <el-table-column prop=" weight" class="table_td" label="货物(吨数)" width="130">
  46. <template slot-scope="scope">{{ scope.row.goodsName }}({{ scope.row.weight }})</template>
  47. </el-table-column>
  48. <el-table-column prop="tranType" class="table_td" label="运输方式" width="120"></el-table-column>
  49. <el-table-column prop class="table_td" label="起点">
  50. <template slot-scope="scope">
  51. {{ scope.row.startPrivate }}{{ scope.row.startCity
  52. }}{{ scope.row.startArea }}{{ scope.row.startDetailedAddress }}
  53. </template>
  54. </el-table-column>
  55. <!-- <el-table-column prop="currentTransferAddress" class="table_td" label="当前中转">
  56. </el-table-column> -->
  57. <el-table-column prop="end" class="table_td" label="终点">
  58. <template slot-scope="scope">
  59. {{ scope.row.endPrivate }}{{ scope.row.endCity
  60. }}{{ scope.row.endArea }}{{ scope.row.endDetailedAddress }}{{scope.row.receiveWarehouse}}
  61. </template>
  62. </el-table-column>
  63. <el-table-column prop="status" label="状态" width="100">
  64. <template slot-scope="scope">
  65. <el-popover placement="left" :width="285" trigger="click" visible-arrow="false" @show="history(scope.row)">
  66. <template>
  67. <span slot="reference">
  68. <span v-if="scope.row.status == '待执行'" class="executory"></span>
  69. <span v-if="scope.row.status == '执行中'" class="inExecution"></span>
  70. <span v-if="scope.row.status == '已完成'" class="done"></span>
  71. {{ scope.row.status }}
  72. </span>
  73. </template>
  74. <div>
  75. <p style="margin-top: 0; padding-left: 10px">操作历史</p>
  76. <div v-for="(item, index) in historyList" class="flex">
  77. <div class="vertical-text vertical-text-left">{{ item.updateDate }}</div>
  78. <div>
  79. <div class="vertical-circle"></div>
  80. <div v-if="index != historyList.length - 1" class="vertical-line"></div>
  81. </div>
  82. <div class="vertical-text">
  83. {{ item.operateUser }}
  84. <br />
  85. {{ item.dealMsg }}
  86. </div>
  87. </div>
  88. </div>
  89. </el-popover>
  90. <img width="17" height="18" style="vertical-align: text-top; position: relative; top: -1px"
  91. src="../../../public/img/edit.png" @click="editClick(scope.row)" alt />
  92. </template>
  93. </el-table-column>
  94. <el-table-column prop="seller" label="操作" width="160">
  95. <template slot-scope="scope">
  96. <div class="record" @click="nocomplete(scope.row)" v-hasPermission="
  97. `transportationTask.transportation.transportationInfo.view`
  98. ">查看</div>
  99. <div class="record" @click="delivery(scope.row)" v-hasPermission="
  100. `transportationTask.transportation.transportationInfo.edit`
  101. ">编辑</div>
  102. <div class="record1" @click="deleteclick(scope.row)" v-hasPermission="
  103. `transportationTask.transportation.transportationInfo.delete`
  104. ">删除</div>
  105. </template>
  106. </el-table-column>
  107. </el-table>
  108. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
  109. :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="deptBudgetTotal"></el-pagination>
  110. </div>
  111. </template>
  112. <script>
  113. import {
  114. gain,
  115. deltran,
  116. states
  117. } from '@/model/tasksport/index'
  118. import Pagination from '@/components/Pagination'
  119. import WsUpload from '@/components/WsUpload'
  120. import {
  121. billoperatehis
  122. } from '@/model/contarct/index'
  123. export default {
  124. name: 'viewSpareMoney',
  125. components: {
  126. WsUpload,
  127. Pagination
  128. },
  129. watch: {
  130. vesselId(val) {
  131. this.getList()
  132. },
  133. isShow(val) {
  134. this.showType = val
  135. }
  136. },
  137. data() {
  138. return {
  139. //弹出框
  140. dialogViewSpareMoney: false,
  141. dialogApproveFormVisible: false,
  142. // 船舶类型
  143. monetaryKey: null,
  144. // 表格显示数据
  145. tableDate: [],
  146. // 是否显示
  147. showType: true,
  148. // 年
  149. year: '',
  150. gainList: [],
  151. currentPage: 1,
  152. primary: 1,
  153. deptBudgetTotal: 0,
  154. pageSize: 10,
  155. deptBudgetTotal: 0,
  156. searchType: 1,
  157. searchTypeText: '执行中',
  158. searchKeyWord: '',
  159. contractType: 2,
  160. // 提交类型
  161. submitType: true,
  162. size: 10,
  163. spanArr: [],
  164. warehouseName: '',
  165. compId: localStorage.getItem('ws-pf_compId'),
  166. deptCircularPage: {},
  167. historyList: [],
  168. pickerBeginDateBefore: {
  169. disabledDate: time => {
  170. return time.getTime() > Date.now()
  171. }
  172. },
  173. accessoryTFs: false,
  174. taskTypeList: [{
  175. value: '执行中',
  176. type: 1
  177. },
  178. {
  179. value: '已完成',
  180. type: 2
  181. },
  182. {
  183. value: '全部任务',
  184. type: 3
  185. },
  186. ],
  187. start: '',
  188. end: '',
  189. }
  190. },
  191. activated() {
  192. this.getList()
  193. this.showType = this.isShow
  194. },
  195. methods: {
  196. //添加
  197. add() {
  198. this.$router.push({
  199. path: 'tranManagementTransportAdd'
  200. })
  201. },
  202. //查找
  203. lookUp() {
  204. this.currentPage = 1
  205. this.getList()
  206. },
  207. history(row) {
  208. console.log(row)
  209. billoperatehis({
  210. id: row.id
  211. })
  212. .toPromise()
  213. .then((response) => {
  214. this.historyList = response
  215. })
  216. },
  217. deleteclick(row) {
  218. //cancelButtonClass: "btn-custom-cancel"
  219. this.$confirm(`运输任务删除后不可恢复,是否确定删除?`, {
  220. confirmButtonText: '确定',
  221. cancelButtonText: '取消',
  222. type: 'warning'
  223. })
  224. .then(() => {
  225. deltran({
  226. id: row.id
  227. })
  228. .toPromise()
  229. .then(response => {
  230. this.getList()
  231. })
  232. })
  233. .catch(() => {
  234. return false
  235. })
  236. },
  237. getList() {
  238. gain({
  239. compId: localStorage.getItem('ws-pf_compId'),
  240. currentPage: this.currentPage,
  241. pageSize: this.pageSize,
  242. searchType: this.searchType,
  243. start: this.start,
  244. end: this.end,
  245. searchKeyWord: this.searchKeyWord,
  246. })
  247. .toPromise()
  248. .then((response) => {
  249. this.gainList = response
  250. this.currentPage = response.current
  251. this.pageSize = response.size
  252. this.deptBudgetTotal = response.total
  253. })
  254. },
  255. handlestatus(status) {
  256. this.searchType = status
  257. if (status == 1) {
  258. this.primary = 1
  259. } else if (status == 2) {
  260. this.primary = 2
  261. } else {
  262. this.primary = 3
  263. }
  264. this.getList()
  265. },
  266. //编辑
  267. delivery(item) {
  268. this.$router.push({
  269. path: 'tranManagementTransportEdit',
  270. query: {
  271. id: item.id
  272. }
  273. })
  274. },
  275. //查看
  276. warehousing(item) {
  277. var free = 0
  278. for (var i = 0; i < item.warehouseNumViewList.length; i++) {
  279. free += Number(item.warehouseNumViewList[i].storage)
  280. }
  281. this.$router.push({
  282. path: 'tranManagementLook',
  283. query: {
  284. baseId: item.warehouseId,
  285. positionId: item.binNumberId,
  286. warehouseName: item.warehouseName,
  287. binNumber: item.binNumber,
  288. capacity: item.capacity - free
  289. }
  290. })
  291. },
  292. getSpanArr(data) {
  293. let that = this
  294. //页面展示的数据,不一定是全部的数据,所以每次都清空之前存储的 保证遍历的数据是最新的数据。以免造成数据渲染混乱
  295. that.spanArr = []
  296. that.pos = 0
  297. //遍历数据
  298. data.forEach((item, index) => {
  299. //判断是否是第一项
  300. // if (index === 0) {
  301. // this.spanArr.push(1)
  302. // this.pos = 0
  303. // } else {
  304. //不是第一项时,就根据标识去存储
  305. if (data[index].warehouseNumViewList.length > 1) {
  306. // 查找到符合条件的数据时每次要把之前存储的数据+1
  307. this.spanArr[this.pos] = data[index].warehouseNumViewList.length
  308. this.spanArr.push(0)
  309. } else {
  310. // 没有符合的数据时,要记住当前的index
  311. this.spanArr.push(1)
  312. this.pos = index
  313. }
  314. // }
  315. })
  316. },
  317. //查看//传参
  318. nocomplete(row) {
  319. this.$router.push({
  320. path: 'tranManagementLook',
  321. query: {
  322. id: row.id
  323. }
  324. })
  325. },
  326. //查看
  327. handleLook() {
  328. this.$router.push({
  329. path: 'tranManagementLook'
  330. })
  331. },
  332. //添加
  333. handleAdd() {
  334. this.$router.push({
  335. path: 'tranManagementTransportAdd'
  336. })
  337. },
  338. //编辑
  339. handleEdit() {
  340. this.$router.push({
  341. path: 'tranManagementTransportEdit'
  342. })
  343. },
  344. dateFormat(fmt, date) {
  345. let ret
  346. const opt = {
  347. 'Y+': date.getFullYear().toString(), // 年
  348. 'm+': (date.getMonth() + 1).toString(), // 月
  349. 'd+': date.getDate().toString(), // 日
  350. 'H+': date.getHours().toString() // 时
  351. // "M+": date.getMinutes().toString(), // 分
  352. // "S+": date.getSeconds().toString() // 秒
  353. // 有其他格式化字符需求可以继续添加,必须转化成字符串
  354. }
  355. for (let k in opt) {
  356. ret = new RegExp('(' + k + ')').exec(fmt)
  357. if (ret) {
  358. fmt = fmt.replace(
  359. ret[1],
  360. ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, '0')
  361. )
  362. }
  363. }
  364. return fmt
  365. },
  366. handleClose() {
  367. this.accessoryTFs = false
  368. },
  369. handleSizeChange(val) {
  370. console.log(`每页 ${val} 条`)
  371. this.pageSize = val
  372. this.getList()
  373. },
  374. handleCurrentChange(val) {
  375. this.currentPage = val
  376. console.log(`当前页: ${val}`)
  377. this.getList()
  378. },
  379. editClick(row) {
  380. var status = ''
  381. if (row.status == '待执行' || row.status == '已完成') {
  382. status = '执行中'
  383. } else if (row.status == '执行中') {
  384. status = '已完成'
  385. }
  386. //cancelButtonClass: "btn-custom-cancel"
  387. this.$confirm(`是否将状态改为${status}`, {
  388. confirmButtonText: '确定',
  389. cancelButtonText: '取消',
  390. type: 'warning'
  391. })
  392. .then(() => {
  393. states({
  394. id: row.id
  395. })
  396. .toPromise()
  397. .then(response => {
  398. this.$notify.success({
  399. title: '成功',
  400. message: '状态修改成功'
  401. })
  402. this.getList()
  403. })
  404. .catch(response => {
  405. // EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
  406. })
  407. })
  408. .catch(() => {
  409. return false
  410. })
  411. },
  412. selecttaskType(e) {
  413. for (var i = 0; i < this.taskTypeList.length; i++) {
  414. if (this.taskTypeList[i].value == e) {
  415. this.searchType = this.taskTypeList[i].type
  416. this.find()
  417. }
  418. }
  419. },
  420. handleExamine(row) {
  421. this.$router.push({
  422. name: 'salesContractExamine',
  423. query: {
  424. id: row.id
  425. }
  426. })
  427. },
  428. // 关闭 dialog时 处理文件url 初始化upload组件
  429. handleCloe() {
  430. this.dialogViewSpareMoney = false
  431. },
  432. }
  433. }
  434. </script>
  435. <style lang="scss" scoped>
  436. .vertical-text-left {
  437. width: 62px;
  438. text-align: right;
  439. }
  440. .el-pagination {
  441. padding-top: 20px;
  442. text-align: center;
  443. }
  444. .el-button--default {
  445. color: #8890b1;
  446. border-color: #e8eaf1;
  447. }
  448. /deep/.base_header_layout .grid-content.right .find.el-button--primary {
  449. width: 30px;
  450. border-top-left-radius: 0px;
  451. border-bottom-left-radius: 0px;
  452. }
  453. /deep/.findValue .el-input__inner {
  454. border-top-right-radius: 0px;
  455. border-bottom-right-radius: 0px;
  456. }
  457. /deep/.el-table tr td:first-child,
  458. /deep/.el-table tr th.is-leaf:first-child {
  459. border-left: 1px solid #e9ecf7;
  460. }
  461. .record,
  462. .adjustment,
  463. .record1 {
  464. display: inline-block;
  465. color: #5878e8;
  466. padding: 0 4px !important;
  467. position: relative;
  468. }
  469. .record:after {
  470. position: absolute;
  471. content: '';
  472. display: block;
  473. top: 5px;
  474. right: -2px;
  475. width: 1px;
  476. height: 12px;
  477. background: #e9ecf7;
  478. }
  479. /deep/.el-table td,
  480. /deep/.el-table th.is-leaf {
  481. border-right: 1px solid #E9ECF7;
  482. text-align: center;
  483. }
  484. .findValue.el-input {
  485. width: 100%;
  486. margin: 0;
  487. }
  488. .el-input {
  489. margin: 0 10px;
  490. width: 70%;
  491. }
  492. /deep/.search .el-button--small {
  493. padding: 0;
  494. }
  495. //操作按钮
  496. .record,
  497. .adjustment {
  498. display: inline-block;
  499. color: #5878e8;
  500. padding: 0 4px !important;
  501. position: relative;
  502. font-size: 14px;
  503. }
  504. .record:after {
  505. position: absolute;
  506. content: '';
  507. display: block;
  508. top: 5px;
  509. right: -2px;
  510. width: 1px;
  511. height: 12px;
  512. background: #e9ecf7;
  513. }
  514. //状态样式
  515. .executory,
  516. .inExecution,
  517. .done {
  518. width: 6px;
  519. height: 6px;
  520. display: inline-block;
  521. border-radius: 50%;
  522. position: relative;
  523. top: -1px;
  524. font-size: 14px;
  525. }
  526. .executory {
  527. background: #ff9f24;
  528. }
  529. .inExecution {
  530. background: #5878e8;
  531. }
  532. .done {
  533. background: #50cad4;
  534. }
  535. /deep/.el-row {
  536. -webkit-box-sizing: border-box;
  537. height: 50px;
  538. box-sizing: border-box;
  539. }
  540. /deep/.el-col-12 {
  541. width: 50%;
  542. height: 50px;
  543. }
  544. .el-button--primary {
  545. background-color: #5878e8;
  546. border-color: #5878e8;
  547. }
  548. .el-pagination {
  549. white-space: nowrap;
  550. padding: 2px 5px;
  551. color: #303133;
  552. font-weight: 700;
  553. text-align: center;
  554. }
  555. .el-select {
  556. width: 30%;
  557. margin-right: 10px;
  558. }
  559. /deep/.typeselect .el-input__inner {
  560. color: #8890B1;
  561. }
  562. // 操作历史
  563. .vertical-text-left {
  564. width: 62px;
  565. text-align: right;
  566. }
  567. .vertical-circle {
  568. width: 10px;
  569. height: 10px;
  570. border: 2px solid #5878e8;
  571. background-color: #ffffff;
  572. -webkit-border-radius: 100px;
  573. }
  574. .vertical-circle:first-child {
  575. color: red;
  576. }
  577. .vertical-text {
  578. margin: 0 10px;
  579. color: #8890b1;
  580. font-size: 12px;
  581. margin-top: -4px;
  582. }
  583. .vertical-line {
  584. height: 64px;
  585. border-left: 2px solid #e9ecf7;
  586. margin-left: 4px;
  587. padding: 0 3px;
  588. // border-image: -webkit-linear-gradient(#00eba7, #08b8e6) 30 30;
  589. // border-image: -moz-linear-gradient(#00eba7, #08b8e6) 30 30;
  590. // border-image: linear-gradient(#00eba7, #08b8e6) 30 30;
  591. }
  592. </style>