tranManagementTransport.vue 17 KB

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