tranManagementTransport.vue 16 KB

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