tranManagementTransport.vue 17 KB

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