tranManagementTransport.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
  1. <!--运输任务-->
  2. <template>
  3. <div>
  4. <BaseHeaderLayout :leftSpan="15">
  5. <template slot="left">
  6. <span style='width: 134px;
  7. display: inline-block;'>起点:</span>
  8. <el-input
  9. label="起点"
  10. placeholder="请输入起点"
  11. clearable
  12. maxlength="200"
  13. type="input"
  14. ></el-input>
  15. <span style='width: 134px;
  16. display: inline-block;'>终点:</span>
  17. <el-input
  18. label="终点"
  19. placeholder="请输入终点"
  20. clearable
  21. maxlength="200"
  22. type="input"
  23. ></el-input>
  24. <el-input
  25. v-model="warehouseName"
  26. placeholder="可按合同编号或运输任务编号查找"
  27. clearable
  28. maxlength="500"
  29. type="input"
  30. class="findValue"
  31. ></el-input>
  32. <!-- v-hasPermission="'procurement.sparepart.directShip'" -->
  33. <div class="search">
  34. <ws-button class="find" type="primary" @click="lookUp()"
  35. ><img
  36. width="16"
  37. height="16"
  38. style="
  39. vertical-align: text-top;
  40. position: relative;
  41. top: 0px;
  42. left: -8px;
  43. "
  44. src="../../../public/img/sousuo.png"
  45. alt=""
  46. /></ws-button>
  47. </div>
  48. </template>
  49. <template slot="right">
  50. <ws-button class="but" type="primary" @click="handleAdd()"
  51. >添加</ws-button
  52. >
  53. </template>
  54. </BaseHeaderLayout>
  55. <div>
  56. <ws-button class="but" :type="primary==1?'primary':''" @click="handlestatus(1)">
  57. 执行中</ws-button
  58. >
  59. <ws-button class="but" :type="primary==2?'primary':''" @click="handlestatus(2)">已完成</ws-button>
  60. <ws-button class="but" :type="primary==3?'primary':''" @click="handlestatus('')">全部任务</ws-button>
  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">
  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="140">
  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. primary:1,
  204. pageSize: 10,
  205. searchType: 1,
  206. searchTypeText: '未完成',
  207. searchKeyWord: '',
  208. contractType: 2,
  209. // 提交类型
  210. submitType: true,
  211. size: 10,
  212. spanArr: [],
  213. warehouseName: '',
  214. compId: sessionStorage.getItem('ws-pf_compId'),
  215. deptCircularPage: {},
  216. historyList: [],
  217. pickerBeginDateBefore: {
  218. disabledDate: (time) => {
  219. return time.getTime() > Date.now()
  220. },
  221. },
  222. accessoryTFs: false,
  223. }
  224. },
  225. activated() {
  226. this.getList()
  227. this.showType = this.isShow
  228. },
  229. methods: {
  230. //添加
  231. add() {
  232. this.$router.push({ path: 'tranManagementTransportAdd' })
  233. },
  234. //查找
  235. lookUp() {
  236. this.currentPage = 1
  237. this.getList()
  238. },
  239. deleteclick(row) {
  240. //cancelButtonClass: "btn-custom-cancel"
  241. this.$confirm(`运输任务删除后不可恢复,是否确定删除?`, {
  242. confirmButtonText: '确定',
  243. cancelButtonText: '取消',
  244. type: 'warning',
  245. })
  246. .then(() => {
  247. console.log(row)
  248. deltran({
  249. id: row.id,
  250. })
  251. .toPromise()
  252. .then((response) => {
  253. this.getList()
  254. })
  255. })
  256. .catch(() => {
  257. return false
  258. })
  259. },
  260. getList() {
  261. gain({
  262. compId: sessionStorage.getItem('ws-pf_compId'),
  263. currentPage: this.currentPage,
  264. pageSize: this.pageSize,
  265. searchType: this.searchType,
  266. searchKeyWord: this.searchKeyWord,
  267. })
  268. .toPromise()
  269. .then((response) => {
  270. this.gainList = response
  271. })
  272. },
  273. handlestatus(status) {
  274. this.searchType = status
  275. if(status==1){
  276. this.primary=1
  277. }else if(status==2){
  278. this.primary=2
  279. }else{
  280. this.primary=3
  281. }
  282. this.getList()
  283. },
  284. //编辑
  285. delivery(item) {
  286. this.$router.push({
  287. path: 'tranManagementTransportEdit',
  288. query: {
  289. id: item.id,
  290. },
  291. })
  292. },
  293. //查看
  294. warehousing(item) {
  295. var free = 0
  296. for (var i = 0; i < item.warehouseNumViewList.length; i++) {
  297. free += Number(item.warehouseNumViewList[i].storage)
  298. }
  299. this.$router.push({
  300. path: 'tranManagementLook',
  301. query: {
  302. baseId: item.warehouseId,
  303. positionId: item.binNumberId,
  304. warehouseName: item.warehouseName,
  305. binNumber: item.binNumber,
  306. capacity: item.capacity - free,
  307. },
  308. })
  309. },
  310. getSpanArr(data) {
  311. let that = this
  312. //页面展示的数据,不一定是全部的数据,所以每次都清空之前存储的 保证遍历的数据是最新的数据。以免造成数据渲染混乱
  313. that.spanArr = []
  314. that.pos = 0
  315. //遍历数据
  316. data.forEach((item, index) => {
  317. //判断是否是第一项
  318. // if (index === 0) {
  319. // this.spanArr.push(1)
  320. // this.pos = 0
  321. // } else {
  322. //不是第一项时,就根据标识去存储
  323. if (data[index].warehouseNumViewList.length > 1) {
  324. // 查找到符合条件的数据时每次要把之前存储的数据+1
  325. this.spanArr[this.pos] = data[index].warehouseNumViewList.length
  326. this.spanArr.push(0)
  327. } else {
  328. // 没有符合的数据时,要记住当前的index
  329. this.spanArr.push(1)
  330. this.pos = index
  331. }
  332. // }
  333. })
  334. },
  335. //查看//传参
  336. nocomplete(row) {
  337. this.$router.push({
  338. path: 'tranManagementLook',
  339. query: {
  340. id: row.id,
  341. },
  342. })
  343. },
  344. //查看
  345. handleLook() {
  346. this.$router.push({ path: 'tranManagementLook' })
  347. },
  348. //添加
  349. handleAdd() {
  350. this.$router.push({ path: 'tranManagementTransportAdd' })
  351. },
  352. //编辑
  353. handleEdit() {
  354. this.$router.push({ path: 'tranManagementTransportEdit' })
  355. },
  356. dateFormat(fmt, date) {
  357. let ret
  358. const opt = {
  359. 'Y+': date.getFullYear().toString(), // 年
  360. 'm+': (date.getMonth() + 1).toString(), // 月
  361. 'd+': date.getDate().toString(), // 日
  362. 'H+': date.getHours().toString(), // 时
  363. // "M+": date.getMinutes().toString(), // 分
  364. // "S+": date.getSeconds().toString() // 秒
  365. // 有其他格式化字符需求可以继续添加,必须转化成字符串
  366. }
  367. for (let k in opt) {
  368. ret = new RegExp('(' + k + ')').exec(fmt)
  369. if (ret) {
  370. fmt = fmt.replace(
  371. ret[1],
  372. ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, '0')
  373. )
  374. }
  375. }
  376. return fmt
  377. },
  378. handleClose() {
  379. this.accessoryTFs = false
  380. },
  381. handleSizeChange(val) {
  382. console.log(`每页 ${val} 条`)
  383. this.pageSize = val
  384. this.getList()
  385. },
  386. handleCurrentChange(val) {
  387. this.currentPage = val
  388. console.log(`当前页: ${val}`)
  389. this.getList()
  390. },
  391. editClick(row) {
  392. var status = ''
  393. if (row.status == '待执行' || row.status == '已完成') {
  394. status = '执行中'
  395. } else if (row.status == '执行中') {
  396. status = '已完成'
  397. }
  398. //cancelButtonClass: "btn-custom-cancel"
  399. this.$confirm(`是否将状态改为${status}`, {
  400. confirmButtonText: '确定',
  401. cancelButtonText: '取消',
  402. type: 'warning',
  403. })
  404. .then(() => {
  405. editstatus({ id: row.id })
  406. .toPromise()
  407. .then((response) => {
  408. this.$notify.success({
  409. title: '成功',
  410. message: '状态修改成功',
  411. })
  412. this.getList()
  413. })
  414. .catch((response) => {
  415. // EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
  416. })
  417. })
  418. .catch(() => {
  419. return false
  420. })
  421. },
  422. selecttaskType(e) {
  423. for (var i = 0; i < this.taskTypeList.length; i++) {
  424. if (this.taskTypeList[i].value == e) {
  425. this.searchType = this.taskTypeList[i].type
  426. }
  427. }
  428. },
  429. handleExamine(row) {
  430. this.$router.push({
  431. name: 'salesContractExamine',
  432. query: { id: row.id },
  433. })
  434. },
  435. // 关闭 dialog时 处理文件url 初始化upload组件
  436. handleCloe() {
  437. this.dialogViewSpareMoney = false
  438. },
  439. history(row) {
  440. billoperatehis({ id: row.id })
  441. .toPromise()
  442. .then((response) => {
  443. this.historyList = response
  444. })
  445. },
  446. find() {
  447. this.currentPage = 1
  448. this.getList()
  449. },
  450. async exportlist() {
  451. const { data } = await export1(
  452. {
  453. compId: sessionStorage.getItem('ws-pf_compId'),
  454. contractType: this.contractType,
  455. currentPage: this.currentPage,
  456. pageSize: this.pageSize,
  457. searchType: this.searchType,
  458. searchKeyWord: this.searchKeyWord,
  459. startDate: this.startDate,
  460. endDate: this.endDate,
  461. },
  462. {},
  463. { responseType: 'blob' }
  464. ).toPromise()
  465. downloadFile({
  466. res: data,
  467. fileName: `${
  468. this.date.year + (this.date.month ? `-${this.date.month}` : '')
  469. }_采购合同`,
  470. type: 'xls',
  471. })
  472. },
  473. },
  474. }
  475. </script>
  476. <style lang="scss" scoped>
  477. .connert {
  478. width: 90%;
  479. margin: 0 auto;
  480. }
  481. .vertical-text-left {
  482. width: 62px;
  483. text-align: right;
  484. }
  485. .el-button--primary {
  486. background-color: #5878e8;
  487. border-color: #5878e8;
  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. .completed.el-button--default {
  504. border-color: #5878e8;
  505. background-color: #f6f7fc;
  506. color: #5878e8;
  507. }
  508. .putstorage.el-button--default,
  509. .deliverystorage.el-button--default {
  510. border-color: #8890b1;
  511. background-color: #fff;
  512. color: #8890b1;
  513. }
  514. /deep/.el-table tr td:first-child,
  515. /deep/.el-table tr th.is-leaf:first-child {
  516. border-left: 1px solid #e9ecf7;
  517. }
  518. .record,
  519. .adjustment {
  520. display: inline-block;
  521. color: #5878e8;
  522. padding: 0 4px !important;
  523. position: relative;
  524. }
  525. .record:after {
  526. position: absolute;
  527. content: '';
  528. display: block;
  529. top: 5px;
  530. right: -2px;
  531. width: 1px;
  532. height: 12px;
  533. background: #e9ecf7;
  534. }
  535. /deep/.base_header_layout .grid-content {
  536. margin-bottom: 60px;
  537. }
  538. /deep/.el-table td, /deep/.el-table th.is-leaf {
  539. border-right: 1px solid transparent;
  540. }
  541. .findValue.el-input {
  542. width: 50%;
  543. margin:0;
  544. }
  545. .el-input{
  546. margin:0 10px;
  547. }
  548. /deep/.search .el-button--small{
  549. padding:0;
  550. }
  551. </style>