tranManagementTransport.vue 17 KB

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