tranManagementVehicleDispatching.vue 20 KB

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