tranManagementVehicleDispatching.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  1. // 汽车调度
  2. <template>
  3. <div class="container">
  4. <el-row>
  5. <el-col :span="20">
  6. <h2 class="bg-left title">汽车调度</h2>
  7. </el-col>
  8. <el-col :span="4" class="bg-right">
  9. <el-button
  10. class="bg-bottom"
  11. type="primary"
  12. size="small"
  13. @click="revert()"
  14. ><img
  15. width="6"
  16. height="10"
  17. style="vertical-align: bottom; margin-right: 3px"
  18. src="../../../public/img/lujing.png"
  19. alt=""
  20. />返回</el-button
  21. >
  22. </el-col>
  23. </el-row>
  24. <div class="center">
  25. <ws-form ref="deptBudgetList" :model="deptBudgetList" :rules="rules">
  26. <div class="basicInformation">
  27. <h2>任务编号</h2>
  28. <ws-info-table>
  29. <!-- 任务编号 -->
  30. <ws-form-item label="任务编号" span="1" prop="processNo">
  31. <ws-input
  32. :disabled="readonly"
  33. v-model="deptBudgetList.processNo"
  34. placeholder="请输入任务编号"
  35. maxlength="20"
  36. size="small"
  37. />
  38. </ws-form-item>
  39. <!-- 货名 -->
  40. <ws-form-item label="货名" span="1">
  41. <ws-input
  42. :disabled="readonly"
  43. v-model="deptBudgetList.goodsName"
  44. placeholder="请输入货名"
  45. maxlength="20"
  46. size="small"
  47. />
  48. </ws-form-item>
  49. <!--重量(吨)-->
  50. <ws-form-item
  51. label="重量(吨)"
  52. span="1"
  53. prop="tare"
  54. class="readonly"
  55. >
  56. <ws-input
  57. :disabled="readonly"
  58. v-model="deptBudgetList.weight"
  59. placeholder="请输入重重"
  60. maxlength="100"
  61. size="small"
  62. />
  63. </ws-form-item>
  64. <!--发货地址-->
  65. <ws-form-item label="发货地址" span="1" prop="netWeight">
  66. {{ deptBudgetList.sendPrivate }}{{ deptBudgetList.sendCity
  67. }}{{ deptBudgetList.sendArea
  68. }}{{ deptBudgetList.sendDetailedAddress }}
  69. </ws-form-item>
  70. <!--发货人-->
  71. <ws-form-item label="发货人" span="1" prop="agent">
  72. <ws-input
  73. :disabled="readonly"
  74. v-model="deptBudgetList.sender"
  75. placeholder="请输入发货人姓名"
  76. maxlength="100"
  77. size="small"
  78. />
  79. </ws-form-item>
  80. <!--发货人电话-->
  81. <ws-form-item label="发货人电话" span="1" prop="agent">
  82. <ws-input
  83. :disabled="readonly"
  84. v-model="deptBudgetList.senderPhone"
  85. placeholder="请输入发货人电话"
  86. maxlength="100"
  87. size="small"
  88. />
  89. </ws-form-item>
  90. <!--收货地址-->
  91. <ws-form-item label="收货地址" span="1" prop="netWeight">
  92. {{ deptBudgetList.receivePrivate }}{{ deptBudgetList.receiveCity
  93. }}{{ deptBudgetList.receiveArea
  94. }}{{ deptBudgetList.receiveDetailedAddress }}
  95. </ws-form-item>
  96. <!--收货人-->
  97. <ws-form-item label="收货人" span="1" prop="receiver">
  98. <ws-input
  99. :disabled="readonly"
  100. v-model="deptBudgetList.receiver"
  101. placeholder="请输入收货人"
  102. maxlength="100"
  103. size="small"
  104. />
  105. </ws-form-item>
  106. <!--收货人电话-->
  107. <ws-form-item label="收货人电话" span="1" prop="receiverPhone">
  108. <ws-input
  109. :disabled="readonly"
  110. v-model="deptBudgetList.receiverPhone"
  111. placeholder="请输入收货人电话"
  112. maxlength="100"
  113. size="small"
  114. />
  115. </ws-form-item>
  116. <!--发货日期-->
  117. <ws-form-item
  118. label="发货日期"
  119. span="1"
  120. prop="inOutDate"
  121. class="deliverydate"
  122. >
  123. {{ deptBudgetList.deliveryDateStart }}
  124. </ws-form-item>
  125. <!--最晚发货日期-->
  126. <ws-form-item
  127. label="最晚发货日期"
  128. span="1"
  129. prop="inOutDate"
  130. class="deliverydate"
  131. >
  132. {{ deptBudgetList.deliveryDateEnd }}
  133. </ws-form-item>
  134. <!--合同编号-->
  135. <ws-form-item label="合同编号" span="1" prop="contractNo">
  136. <ws-input
  137. :disabled="readonly"
  138. v-model="deptBudgetList.contractNo"
  139. placeholder="请输入合同编号"
  140. maxlength="100"
  141. size="small"
  142. />
  143. </ws-form-item>
  144. </ws-info-table>
  145. <div class="small-title">派车</div>
  146. <div
  147. class="driver position"
  148. v-for="(item, index) in deptBudgetList.tranCarInfoList"
  149. >
  150. <ws-info-table>
  151. <!--司机-->
  152. <ws-form-item
  153. :label="'司机-' + (index + 1)"
  154. span="1"
  155. prop="driverName"
  156. class="siji"
  157. >
  158. <el-select
  159. :disabled="item.disabled"
  160. v-model="item.driver"
  161. placeholder="请选择司机"
  162. class="typeselect"
  163. @change="
  164. (val) => {
  165. carchange(val, index)
  166. }
  167. "
  168. >
  169. <el-option
  170. v-for="(items, index) in carList"
  171. :key="index"
  172. :label="items.driverName"
  173. :value="items.driverName"
  174. />
  175. </el-select>
  176. </ws-form-item>
  177. <!--司机电话-->
  178. <ws-form-item
  179. label="司机电话"
  180. span="1"
  181. prop="impurity"
  182. class="siji"
  183. >
  184. <el-select
  185. :disabled="item.disabled"
  186. v-model="item.driverPhone"
  187. placeholder="请选择司机"
  188. class="typeselect"
  189. @change="
  190. (val) => {
  191. phonechange(val, index)
  192. }
  193. "
  194. >
  195. <el-option
  196. v-for="(items, index) in carList"
  197. :key="index"
  198. :label="items.driverPhone"
  199. :value="items.driverPhone"
  200. />
  201. </el-select>
  202. </ws-form-item>
  203. <!--车牌号-->
  204. <ws-form-item label="车牌号" span="1" prop="carNo" class="siji">
  205. <ws-input
  206. :disabled="readonly"
  207. v-model="item.carNo"
  208. placeholder=""
  209. maxlength="120"
  210. size="small"
  211. />
  212. </ws-form-item>
  213. <!--车型-->
  214. <ws-form-item label="车型" span="1" prop="carModel" class="siji">
  215. <ws-input
  216. :disabled="readonly"
  217. v-model="item.carModel"
  218. placeholder="请输入车型"
  219. maxlength="120"
  220. size="small"
  221. />
  222. </ws-form-item>
  223. <!--车长-->
  224. <ws-form-item label="车长" span="1" prop="carLength" class="siji">
  225. <ws-input
  226. :disabled="readonly"
  227. v-model="item.carLength"
  228. placeholder="请输入车长"
  229. maxlength="120"
  230. size="small"
  231. />
  232. </ws-form-item>
  233. <!--载重吨-->
  234. <ws-form-item
  235. label="载重(吨)"
  236. span="1"
  237. prop="loadWeight"
  238. class="siji zaizhong"
  239. >
  240. <ws-input
  241. :disabled="readonly"
  242. v-model="item.loadWeight"
  243. placeholder="请输入载重(吨)"
  244. maxlength="120"
  245. size="small"
  246. />
  247. </ws-form-item>
  248. </ws-info-table>
  249. <img
  250. width="22"
  251. height="22"
  252. class="del"
  253. @click="del(index)"
  254. src="../../../public/img/del.png"
  255. alt=""
  256. />
  257. </div>
  258. <div style="text-align: right">
  259. 合计{{ total }}/{{ deptBudgetList.weight }}
  260. </div>
  261. <el-button class="add" type="primary" size="small" @click="add()"
  262. >添加司机</el-button
  263. >
  264. <div style="text-align: right; padding: 10px">
  265. <el-button
  266. class="bg-bottom-up"
  267. type="primary"
  268. size="small"
  269. @click="submit()"
  270. >提交</el-button
  271. >
  272. </div>
  273. </div>
  274. </ws-form>
  275. </div>
  276. </div>
  277. </template>
  278. <script>
  279. import { pullDown, addstorageputList } from '@/model/warehouse/index'
  280. import Pagination from '@/components/Pagination'
  281. import WsUpload from '@/components/WsUpload'
  282. import {
  283. seeCat,
  284. nameXiala,
  285. arrange,
  286. dispatchCat,
  287. } from '@/model/transport/index'
  288. // import { dayjs, fmoney, EventBus } from 'base-core-lib'
  289. import { dayjs, EventBus } from 'base-core-lib'
  290. export default {
  291. name: 'viewSpareMoney',
  292. components: {
  293. WsUpload,
  294. Pagination,
  295. },
  296. watch: {
  297. // vesselId(val) {
  298. // this.getList()
  299. // },
  300. isShow(val) {
  301. this.showType = val
  302. },
  303. },
  304. data() {
  305. return {
  306. // 是否显示
  307. showType: true,
  308. deptBudgetTotal: 0,
  309. currentPage: 1,
  310. pageSize: 10,
  311. searchType: 1,
  312. startDate: null,
  313. endDate: null,
  314. carList: [],
  315. // 提交类型
  316. readonly: true,
  317. appendixIdsAdd: '',
  318. onChange: {},
  319. gradeList: [],
  320. rules: {
  321. netWeight: [
  322. {
  323. required: true,
  324. type: 'number',
  325. message: '请输入活动名称',
  326. trigger: 'blur',
  327. },
  328. ],
  329. },
  330. size: 10,
  331. compId: sessionStorage.getItem('ws-pf_compId'),
  332. deptCircularPage: {},
  333. packtypeList: {},
  334. date: {
  335. year: dayjs().format('YYYY'),
  336. month: dayjs().format('MM'),
  337. },
  338. contractList: [],
  339. deptBudgetList: {
  340. tranCarInfoList: [],
  341. },
  342. historyList: [],
  343. pickerBeginDateBefore: {
  344. disabledDate: (time) => {
  345. return time.getTime() > Date.now()
  346. },
  347. },
  348. accessoryTFs: false,
  349. }
  350. },
  351. activated() {
  352. this.getList()
  353. },
  354. computed: {
  355. total: function () {
  356. var maxStorage = 0
  357. for (var i = 0; i < this.deptBudgetList.tranCarInfoList.length; i++) {
  358. maxStorage += Number(this.deptBudgetList.tranCarInfoList[i].loadWeight)
  359. }
  360. return maxStorage
  361. },
  362. },
  363. methods: {
  364. //返回按钮
  365. revert() {
  366. this.$router.push({ path: 'tranManagementVehicle' })
  367. },
  368. del(index) {
  369. if (this.freightspace.length > 1) {
  370. this.freightspace.splice(index, 1)
  371. }
  372. },
  373. add() {
  374. this.deptBudgetList.tranCarInfoList.push({
  375. driverName: '',
  376. driverPhone: '',
  377. carLength: 0,
  378. carLengthKey: '',
  379. loadWeight: null,
  380. carModel: '',
  381. carModelKey: '',
  382. carNumber: '',
  383. disabled: false,
  384. tranType: '1',
  385. })
  386. },
  387. selectwaterContent() {},
  388. //提交按钮
  389. submit() {
  390. this.$confirm(`提交成功后,任务将下发给司机,是否确定提交?`, {
  391. cancelButtonText: '取消',
  392. confirmButtonText: '确定',
  393. type: 'warning',
  394. })
  395. .then(() => {
  396. this.$refs.deptBudgetList.validate((valid) => {
  397. if (valid) {
  398. var tranCarInfo = {}
  399. tranCarInfo.id = this.deptBudgetList.id
  400. tranCarInfo.infoId = this.deptBudgetList.infoId
  401. tranCarInfo.tranCarInfoList = this.deptBudgetList.tranCarInfoList
  402. dispatchCat(tranCarInfo)
  403. .toPromise()
  404. .then((response) => {
  405. this.$message.success('派车成功')
  406. this.$router.go(-1)
  407. })
  408. } else {
  409. EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
  410. return false
  411. }
  412. })
  413. })
  414. .catch(() => {
  415. return false
  416. })
  417. },
  418. handleClose() {
  419. this.accessoryTFs = false
  420. },
  421. getList() {
  422. seeCat({ id: this.$route.query.id })
  423. .toPromise()
  424. .then((response) => {
  425. if (response.tranCarInfoList.length > 0) {
  426. for (var i = 0; i < response.tranCarInfoList.length; i++) {
  427. if (response.tranCarInfoList[i].id) {
  428. response.tranCarInfoList[i].disabled = true
  429. }
  430. }
  431. }
  432. this.deptBudgetList = response
  433. console.log(this.deptBudgetList)
  434. if (this.deptBudgetList.tranCarInfoList.length == 0) {
  435. this.deptBudgetList.tranCarInfoList = [
  436. {
  437. driverName: '',
  438. driverPhone: '',
  439. carLength: 0,
  440. carLengthKey: '',
  441. loadWeight: null,
  442. carModel: '',
  443. carModelKey: '',
  444. carNumber: '',
  445. disabled: false,
  446. tranType: '1',
  447. },
  448. ]
  449. }
  450. })
  451. nameXiala({ compId: this.compId })
  452. .toPromise()
  453. .then((response) => {
  454. this.carList = response
  455. })
  456. },
  457. carchange(val, index) {
  458. for (var i = 0; i < this.carList.length; i++) {
  459. if (this.carList[i].driverName == val) {
  460. this.deptBudgetList.tranCarInfoList[index].driverPhone =
  461. this.carList[i].driverPhone
  462. arrange({ id: this.carList[i].id })
  463. .toPromise()
  464. .then((response) => {
  465. console.log(this, response)
  466. this.deptBudgetList.tranCarInfoList[index].carNo =
  467. response.carNumber
  468. if (response.carLoad != null) {
  469. this.deptBudgetList.tranCarInfoList[index].loadWeight =
  470. response.carLoad
  471. } else {
  472. this.deptBudgetList.tranCarInfoList[index].loadWeight = 0
  473. }
  474. this.deptBudgetList.tranCarInfoList[index].carModel =
  475. response.carModel
  476. this.deptBudgetList.tranCarInfoList[index].carLength =
  477. response.carLength
  478. this.deptBudgetList.tranCarInfoList[index].carLengthKey =
  479. response.carLengthKey
  480. this.deptBudgetList.tranCarInfoList[index].carModelKey =
  481. response.carModelKey
  482. })
  483. }
  484. }
  485. },
  486. phonechange(val, index) {
  487. for (var i = 0; i < this.carList.length; i++) {
  488. if (this.carList[i].driverPhone == val) {
  489. this.deptBudgetList.tranCarInfoList[index].driver =
  490. this.carList[i].driver
  491. arrange({ id: this.carList[i].id })
  492. .toPromise()
  493. .then((response) => {
  494. console.log(this, response)
  495. this.deptBudgetList.tranCarInfoList[index].carNo =
  496. response.carNumber
  497. if (response.carLoad != null) {
  498. this.deptBudgetList.tranCarInfoList[index].loadWeight =
  499. response.carLoad
  500. } else {
  501. this.deptBudgetList.tranCarInfoList[index].loadWeight = 0
  502. }
  503. this.deptBudgetList.tranCarInfoList[index].carModel =
  504. response.carModel
  505. this.deptBudgetList.tranCarInfoList[index].carLength =
  506. response.carLength
  507. this.deptBudgetList.tranCarInfoList[index].carLengthKey =
  508. response.carLengthKey
  509. this.deptBudgetList.tranCarInfoList[index].carModelKey =
  510. response.carModelKey
  511. })
  512. }
  513. }
  514. },
  515. selecttaskType(e) {
  516. for (var i = 0; i < this.taskTypeList.length; i++) {
  517. if (this.taskTypeList[i].value == e) {
  518. this.searchType = this.taskTypeList[i].type
  519. }
  520. }
  521. },
  522. // fujian(row) {
  523. // if (
  524. // row.receiveAttachmentPath === null ||
  525. // row.receiveAttachmentPath === ''
  526. // ) {
  527. // EventBus.$emit(
  528. // 'warning',
  529. // this.$t('system.noticeCircular.NoInformation')
  530. // )
  531. // } else {
  532. // this.accessoryTFs = true
  533. // }
  534. // this.appendixIdss = row.receiveAttachmentPath
  535. // },
  536. approve() {},
  537. listQuery() {},
  538. },
  539. }
  540. </script>
  541. <style lang="scss" scoped>
  542. /deep/.basicInformation {
  543. .ws-info-table {
  544. border: none;
  545. }
  546. .el-form-item {
  547. width: 33.3333%;
  548. border: none;
  549. .el-form-item__label {
  550. background: transparent;
  551. border: none;
  552. }
  553. .el-form-item__content {
  554. border: none;
  555. }
  556. }
  557. }
  558. .title {
  559. position: relative;
  560. padding-left: 10px;
  561. }
  562. .title::before {
  563. content: '';
  564. display: inline-block;
  565. width: 5px;
  566. height: 30px;
  567. background: #5473e8;
  568. position: absolute;
  569. left: 0;
  570. }
  571. .el-form {
  572. padding: 0 10%;
  573. }
  574. .el-button--primary {
  575. background-color: #5878e8;
  576. border-color: #5878e8;
  577. }
  578. .el-col {
  579. background: #f6f7fc;
  580. }
  581. .bg-right {
  582. text-align: right;
  583. padding: 16px 20px;
  584. }
  585. .center {
  586. width: 80%;
  587. margin: 0 auto;
  588. }
  589. //表格文字
  590. /deep/.ws-info-table .el-form-item .el-form-item__label {
  591. text-align: left;
  592. font-size: 14px;
  593. font-weight: 400;
  594. color: #8890b1;
  595. line-height: 16px;
  596. }
  597. //蓝标
  598. .small-title {
  599. position: relative;
  600. padding: 10px;
  601. font-weight: 600;
  602. }
  603. .small-title::before {
  604. position: absolute;
  605. content: '';
  606. display: block;
  607. background: #5473e8;
  608. width: 4px;
  609. height: 14px;
  610. left: 0px;
  611. top: 13px;
  612. padding: 4px 2px;
  613. }
  614. .position {
  615. position: relative;
  616. }
  617. .position .zaizhong {
  618. width: 16%;
  619. }
  620. //减号
  621. .del {
  622. position: absolute;
  623. right: -28px;
  624. top: 29%;
  625. }
  626. .driver .el-form-item {
  627. width: 16.63%;
  628. }
  629. /deep/.driver .ws-info-table .el-form-item .el-form-item__label {
  630. width: 72px;
  631. }
  632. </style>