tranManagementTransport.vue 16 KB

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