tranManagementTransport.vue 17 KB

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