tranManagementTransport.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581
  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="起点" placeholder="请输入起点" clearable maxlength="200" type="input"></el-input>
  21. <span style="width: 134px; display: inline-block">终点:</span>
  22. <el-input label="终点" placeholder="请输入终点" clearable maxlength="200" type="input"></el-input>
  23. <el-input
  24. v-model="warehouseName"
  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="780"
  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>
  159. </div>
  160. </template>
  161. <script>
  162. import { gain, deltran } from '@/model/tasksport/index'
  163. import { downloadFile } from '@/utils/batchDown'
  164. import Pagination from '@/components/Pagination'
  165. import WsUpload from '@/components/WsUpload'
  166. import { dayjs, fmoney, EventBus } from 'base-core-lib'
  167. export default {
  168. name: 'viewSpareMoney',
  169. components: {
  170. WsUpload,
  171. Pagination
  172. },
  173. watch: {
  174. vesselId(val) {
  175. this.getList()
  176. },
  177. isShow(val) {
  178. this.showType = val
  179. }
  180. },
  181. data() {
  182. return {
  183. //弹出框
  184. dialogViewSpareMoney: false,
  185. dialogApproveFormVisible: false,
  186. // 船舶类型
  187. monetaryKey: null,
  188. // 表格显示数据
  189. tableDate: [],
  190. // 是否显示
  191. showType: true,
  192. // 年
  193. year: '',
  194. gainList: [],
  195. currentPage: 1,
  196. primary: 1,
  197. pageSize: 10,
  198. searchType: 1,
  199. searchTypeText: '未完成',
  200. searchKeyWord: '',
  201. contractType: 2,
  202. // 提交类型
  203. submitType: true,
  204. size: 10,
  205. spanArr: [],
  206. warehouseName: '',
  207. compId: sessionStorage.getItem('ws-pf_compId'),
  208. deptCircularPage: {},
  209. historyList: [],
  210. pickerBeginDateBefore: {
  211. disabledDate: time => {
  212. return time.getTime() > Date.now()
  213. }
  214. },
  215. accessoryTFs: false
  216. }
  217. },
  218. activated() {
  219. this.getList()
  220. this.showType = this.isShow
  221. },
  222. methods: {
  223. //添加
  224. add() {
  225. this.$router.push({ path: 'tranManagementTransportAdd' })
  226. },
  227. //查找
  228. lookUp() {
  229. this.currentPage = 1
  230. this.getList()
  231. },
  232. deleteclick(row) {
  233. //cancelButtonClass: "btn-custom-cancel"
  234. this.$confirm(`运输任务删除后不可恢复,是否确定删除?`, {
  235. confirmButtonText: '确定',
  236. cancelButtonText: '取消',
  237. type: 'warning'
  238. })
  239. .then(() => {
  240. console.log(row)
  241. deltran({
  242. id: row.id
  243. })
  244. .toPromise()
  245. .then(response => {
  246. this.getList()
  247. })
  248. })
  249. .catch(() => {
  250. return false
  251. })
  252. },
  253. getList() {
  254. gain({
  255. compId: sessionStorage.getItem('ws-pf_compId'),
  256. currentPage: this.currentPage,
  257. pageSize: this.pageSize,
  258. searchType: this.searchType,
  259. searchKeyWord: this.searchKeyWord
  260. })
  261. .toPromise()
  262. .then(response => {
  263. this.gainList = response
  264. })
  265. },
  266. handlestatus(status) {
  267. this.searchType = status
  268. if (status == 1) {
  269. this.primary = 1
  270. } else if (status == 2) {
  271. this.primary = 2
  272. } else {
  273. this.primary = 3
  274. }
  275. this.getList()
  276. },
  277. //编辑
  278. delivery(item) {
  279. this.$router.push({
  280. path: 'tranManagementTransportEdit',
  281. query: {
  282. id: item.id
  283. }
  284. })
  285. },
  286. //查看
  287. warehousing(item) {
  288. var free = 0
  289. for (var i = 0; i < item.warehouseNumViewList.length; i++) {
  290. free += Number(item.warehouseNumViewList[i].storage)
  291. }
  292. this.$router.push({
  293. path: 'tranManagementLook',
  294. query: {
  295. baseId: item.warehouseId,
  296. positionId: item.binNumberId,
  297. warehouseName: item.warehouseName,
  298. binNumber: item.binNumber,
  299. capacity: item.capacity - free
  300. }
  301. })
  302. },
  303. getSpanArr(data) {
  304. let that = this
  305. //页面展示的数据,不一定是全部的数据,所以每次都清空之前存储的 保证遍历的数据是最新的数据。以免造成数据渲染混乱
  306. that.spanArr = []
  307. that.pos = 0
  308. //遍历数据
  309. data.forEach((item, index) => {
  310. //判断是否是第一项
  311. // if (index === 0) {
  312. // this.spanArr.push(1)
  313. // this.pos = 0
  314. // } else {
  315. //不是第一项时,就根据标识去存储
  316. if (data[index].warehouseNumViewList.length > 1) {
  317. // 查找到符合条件的数据时每次要把之前存储的数据+1
  318. this.spanArr[this.pos] = data[index].warehouseNumViewList.length
  319. this.spanArr.push(0)
  320. } else {
  321. // 没有符合的数据时,要记住当前的index
  322. this.spanArr.push(1)
  323. this.pos = index
  324. }
  325. // }
  326. })
  327. },
  328. //查看//传参
  329. nocomplete(row) {
  330. this.$router.push({
  331. path: 'tranManagementLook',
  332. query: {
  333. id: row.id
  334. }
  335. })
  336. },
  337. //查看
  338. handleLook() {
  339. this.$router.push({ path: 'tranManagementLook' })
  340. },
  341. //添加
  342. handleAdd() {
  343. this.$router.push({ path: 'tranManagementTransportAdd' })
  344. },
  345. //编辑
  346. handleEdit() {
  347. this.$router.push({ path: 'tranManagementTransportEdit' })
  348. },
  349. dateFormat(fmt, date) {
  350. let ret
  351. const opt = {
  352. 'Y+': date.getFullYear().toString(), // 年
  353. 'm+': (date.getMonth() + 1).toString(), // 月
  354. 'd+': date.getDate().toString(), // 日
  355. 'H+': date.getHours().toString() // 时
  356. // "M+": date.getMinutes().toString(), // 分
  357. // "S+": date.getSeconds().toString() // 秒
  358. // 有其他格式化字符需求可以继续添加,必须转化成字符串
  359. }
  360. for (let k in opt) {
  361. ret = new RegExp('(' + k + ')').exec(fmt)
  362. if (ret) {
  363. fmt = fmt.replace(
  364. ret[1],
  365. ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, '0')
  366. )
  367. }
  368. }
  369. return fmt
  370. },
  371. handleClose() {
  372. this.accessoryTFs = false
  373. },
  374. handleSizeChange(val) {
  375. console.log(`每页 ${val} 条`)
  376. this.pageSize = val
  377. this.getList()
  378. },
  379. handleCurrentChange(val) {
  380. this.currentPage = val
  381. console.log(`当前页: ${val}`)
  382. this.getList()
  383. },
  384. editClick(row) {
  385. var status = ''
  386. if (row.status == '待执行' || row.status == '已完成') {
  387. status = '执行中'
  388. } else if (row.status == '执行中') {
  389. status = '已完成'
  390. }
  391. //cancelButtonClass: "btn-custom-cancel"
  392. this.$confirm(`是否将状态改为${status}`, {
  393. confirmButtonText: '确定',
  394. cancelButtonText: '取消',
  395. type: 'warning'
  396. })
  397. .then(() => {
  398. editstatus({ id: row.id })
  399. .toPromise()
  400. .then(response => {
  401. this.$notify.success({
  402. title: '成功',
  403. message: '状态修改成功'
  404. })
  405. this.getList()
  406. })
  407. .catch(response => {
  408. // EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
  409. })
  410. })
  411. .catch(() => {
  412. return false
  413. })
  414. },
  415. selecttaskType(e) {
  416. for (var i = 0; i < this.taskTypeList.length; i++) {
  417. if (this.taskTypeList[i].value == e) {
  418. this.searchType = this.taskTypeList[i].type
  419. }
  420. }
  421. },
  422. handleExamine(row) {
  423. this.$router.push({
  424. name: 'salesContractExamine',
  425. query: { id: row.id }
  426. })
  427. },
  428. // 关闭 dialog时 处理文件url 初始化upload组件
  429. handleCloe() {
  430. this.dialogViewSpareMoney = false
  431. },
  432. find() {
  433. this.currentPage = 1
  434. this.getList()
  435. },
  436. }
  437. }
  438. </script>
  439. <style lang="scss" scoped>
  440. .connert {
  441. width: 90%;
  442. margin: 0 auto;
  443. }
  444. .vertical-text-left {
  445. width: 62px;
  446. text-align: right;
  447. }
  448. .el-button--primary {
  449. background-color: #5878e8;
  450. border-color: #5878e8;
  451. }
  452. .el-button--default {
  453. color: #8890b1;
  454. border-color: #e8eaf1;
  455. }
  456. /deep/.base_header_layout .grid-content.right .find.el-button--primary {
  457. width: 30px;
  458. margin-left: 0;
  459. border-top-left-radius: 0px;
  460. border-bottom-left-radius: 0px;
  461. }
  462. /deep/.findValue .el-input__inner {
  463. border-top-right-radius: 0px;
  464. border-bottom-right-radius: 0px;
  465. }
  466. // .completed.el-button--default {
  467. // border-color: #5878e8;
  468. // background-color: #f6f7fc;
  469. // color: #5878e8;
  470. // }
  471. // .putstorage.el-button--default,
  472. // .deliverystorage.el-button--default {
  473. // border-color: #8890b1;
  474. // background-color: #fff;
  475. // color: #8890b1;
  476. // }
  477. /deep/.el-table tr td:first-child,
  478. /deep/.el-table tr th.is-leaf:first-child {
  479. border-left: 1px solid #e9ecf7;
  480. }
  481. .record,
  482. .adjustment {
  483. display: inline-block;
  484. color: #5878e8;
  485. padding: 0 4px !important;
  486. position: relative;
  487. }
  488. .record:after {
  489. position: absolute;
  490. content: '';
  491. display: block;
  492. top: 5px;
  493. right: -2px;
  494. width: 1px;
  495. height: 12px;
  496. background: #e9ecf7;
  497. }
  498. /deep/.base_header_layout .grid-content {
  499. margin-bottom: 60px;
  500. }
  501. /deep/.el-table td,
  502. /deep/.el-table th.is-leaf {
  503. border-right: 1px solid transparent;
  504. text-align: center;
  505. }
  506. .findValue.el-input {
  507. width: 100%;
  508. margin: 0;
  509. }
  510. .el-input {
  511. margin: 0 10px;
  512. width: 70%;
  513. }
  514. /deep/.search .el-button--small {
  515. padding: 0;
  516. }
  517. //操作按钮
  518. .record,
  519. .adjustment {
  520. display: inline-block;
  521. color: #5878e8;
  522. padding: 0 4px !important;
  523. position: relative;
  524. font-size: 14px;
  525. }
  526. .record:after {
  527. position: absolute;
  528. content: '';
  529. display: block;
  530. top: 5px;
  531. right: -2px;
  532. width: 1px;
  533. height: 12px;
  534. background: #e9ecf7;
  535. }
  536. //状态样式
  537. .executory,
  538. .inExecution,
  539. .done {
  540. width: 6px;
  541. height: 6px;
  542. display: inline-block;
  543. border-radius: 50%;
  544. position: relative;
  545. top: -1px;
  546. font-size: 14px;
  547. }
  548. .executory {
  549. background: #ff9f24;
  550. }
  551. .inExecution {
  552. background: #5878e8;
  553. }
  554. .done {
  555. background: #50cad4;
  556. }
  557. /deep/.el-row {
  558. -webkit-box-sizing: border-box;
  559. height: 50px;
  560. box-sizing: border-box;
  561. }
  562. /deep/.el-col-12 {
  563. width: 50%;
  564. height: 50px;
  565. }
  566. .el-button--primary {
  567. background-color: #5878e8;
  568. border-color: #5878e8;
  569. margin-left: 6px;
  570. }
  571. </style>