tranManagementTransport.vue 15 KB

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