tranManagementTransport.vue 15 KB

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