tranManagementTransport.vue 16 KB

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