tranManagementVehicleDispatching.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739
  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. index:0,
  343. }
  344. },
  345. activated() {
  346. this.getList()
  347. },
  348. computed: {
  349. total: function () {
  350. if (this.deptBudgetList.tranCarInfoList.length > 0) {
  351. var maxStorage = 0
  352. for (var i = 0; i < this.deptBudgetList.tranCarInfoList.length; i++) {
  353. maxStorage += Number(
  354. this.deptBudgetList.tranCarInfoList[i].loadWeight
  355. )
  356. }
  357. return maxStorage
  358. }
  359. },
  360. },
  361. methods: {
  362. //返回按钮
  363. revert() {
  364. this.$router.go(-1)
  365. },
  366. del(index) {
  367. if (this.deptBudgetList.tranCarInfoList.length > 1) {
  368. this.deptBudgetList.tranCarInfoList.splice(index, 1)
  369. }
  370. },
  371. add() {
  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. //提交按钮
  386. submit() {
  387. for (var i = this.index; i < this.deptBudgetList.tranCarInfoList.length; i++) {
  388. if (!this.deptBudgetList.tranCarInfoList[i].driver) {
  389. this.$message({
  390. message: '姓名不能为空!',
  391. type: 'warning',
  392. })
  393. return
  394. }
  395. for(var j = 0 ; j < this.carList.length ; j++){
  396. if (this.carList[j].driverName == this.deptBudgetList.tranCarInfoList[i].driver && this.carList[j].disableStatusFlag == 1) {
  397. this.$message({
  398. message: this.deptBudgetList.tranCarInfoList[i].driver+'该司机已被禁用!',
  399. type: 'warning',
  400. })
  401. return
  402. }
  403. }
  404. }
  405. this.$confirm(`提交成功后,任务将下发给司机,是否确定提交?`, {
  406. cancelButtonText: '取消',
  407. confirmButtonText: '确定',
  408. type: 'warning',
  409. })
  410. .then(() => {
  411. this.$refs.deptBudgetList.validate((valid) => {
  412. if (valid) {
  413. var tranCarInfo = {}
  414. tranCarInfo.id = this.deptBudgetList.id
  415. tranCarInfo.infoId = this.deptBudgetList.infoId
  416. tranCarInfo.tranCarInfoList = this.deptBudgetList.tranCarInfoList
  417. dispatchCat(tranCarInfo)
  418. .toPromise()
  419. .then((response) => {
  420. this.$message.success('派车成功')
  421. this.$router.go(-1)
  422. })
  423. } else {
  424. EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
  425. return false
  426. }
  427. })
  428. })
  429. .catch(() => {
  430. return false
  431. })
  432. },
  433. handleClose() {
  434. this.accessoryTFs = false
  435. },
  436. getList() {
  437. seeCat({ id: this.$route.query.id })
  438. .toPromise()
  439. .then((response) => {
  440. if (response.tranCarInfoList.length > 0) {
  441. this.index = response.tranCarInfoList.length
  442. for (var i = 0; i < response.tranCarInfoList.length; i++) {
  443. if (response.tranCarInfoList[i].id) {
  444. response.tranCarInfoList[i].disabled = true
  445. }
  446. }
  447. }
  448. this.deptBudgetList = response
  449. if (this.deptBudgetList.tranCarInfoList.length == 0) {
  450. this.deptBudgetList.tranCarInfoList = [
  451. {
  452. driverName: '',
  453. driverPhone: '',
  454. carLength: 0,
  455. carLengthKey: '',
  456. loadWeight: null,
  457. carModel: '',
  458. carModelKey: '',
  459. carNumber: '',
  460. disabled: false,
  461. tranType: '1',
  462. },
  463. ]
  464. }
  465. })
  466. nameXiala({ compId: this.compId })
  467. .toPromise()
  468. .then((response) => {
  469. this.carList = response
  470. })
  471. },
  472. carchange(val, index) {
  473. for (var i = 0; i < this.carList.length; i++) {
  474. if (this.carList[i].driverName == val) {
  475. this.deptBudgetList.tranCarInfoList[index].driverPhone =
  476. this.carList[i].driverPhone
  477. arrange({ id: this.carList[i].id })
  478. .toPromise()
  479. .then((response) => {
  480. console.log(this, response)
  481. this.deptBudgetList.tranCarInfoList[index].carNo =
  482. response.carNumber
  483. if (response.carLoad != null) {
  484. this.deptBudgetList.tranCarInfoList[index].loadWeight =
  485. response.carLoad
  486. } else {
  487. this.deptBudgetList.tranCarInfoList[index].loadWeight = 0
  488. }
  489. this.deptBudgetList.tranCarInfoList[index].carModel =
  490. response.carModel
  491. this.deptBudgetList.tranCarInfoList[index].carLength =
  492. response.carLength
  493. this.deptBudgetList.tranCarInfoList[index].carLengthKey =
  494. response.carLengthKey
  495. this.deptBudgetList.tranCarInfoList[index].carModelKey =
  496. response.carModelKey
  497. })
  498. }
  499. }
  500. },
  501. phonechange(val, index) {
  502. for (var i = 0; i < this.carList.length; i++) {
  503. if (this.carList[i].driverPhone == val) {
  504. this.deptBudgetList.tranCarInfoList[index].driver =
  505. this.carList[i].driverName
  506. arrange({ id: this.carList[i].id })
  507. .toPromise()
  508. .then((response) => {
  509. console.log(this, response)
  510. this.deptBudgetList.tranCarInfoList[index].carNo =
  511. response.carNumber
  512. if (response.carLoad != null) {
  513. this.deptBudgetList.tranCarInfoList[index].loadWeight =
  514. response.carLoad
  515. } else {
  516. this.deptBudgetList.tranCarInfoList[index].loadWeight = 0
  517. }
  518. this.deptBudgetList.tranCarInfoList[index].carModel =
  519. response.carModel
  520. this.deptBudgetList.tranCarInfoList[index].carLength =
  521. response.carLength
  522. this.deptBudgetList.tranCarInfoList[index].carLengthKey =
  523. response.carLengthKey
  524. this.deptBudgetList.tranCarInfoList[index].carModelKey =
  525. response.carModelKey
  526. })
  527. }
  528. }
  529. },
  530. // selecttaskType(e) {
  531. // for (var i = 0; i < this.taskTypeList.length; i++) {
  532. // if (this.taskTypeList[i].value == e) {
  533. // this.searchType = this.taskTypeList[i].type
  534. // }
  535. // }
  536. // },
  537. // approve() {},
  538. // listQuery() {},
  539. },
  540. }
  541. </script>
  542. <style lang="scss" scoped>
  543. /deep/.basicInformation {
  544. height: 87vh;
  545. overflow: scroll;
  546. .ws-info-table {
  547. border: none;
  548. }
  549. .el-form-item {
  550. width: 33.3333%;
  551. border: none;
  552. height: 50px;
  553. .el-form-item__label {
  554. background: transparent;
  555. border: none;
  556. }
  557. .el-form-item__content {
  558. border: none;
  559. }
  560. }
  561. }
  562. .title {
  563. position: relative;
  564. padding-left: 10px;
  565. }
  566. .title::before {
  567. content: '';
  568. display: inline-block;
  569. width: 5px;
  570. height: 30px;
  571. background: #5473e8;
  572. position: absolute;
  573. left: 0;
  574. }
  575. .el-form {
  576. padding: 0 10%;
  577. }
  578. .el-button--primary {
  579. background-color: #5878e8;
  580. border-color: #5878e8;
  581. }
  582. .el-col {
  583. background: #f6f7fc;
  584. }
  585. .bg-right {
  586. text-align: right;
  587. padding: 16px 20px;
  588. }
  589. .center {
  590. width: 90%;
  591. margin: 0 auto;
  592. }
  593. //表格文字
  594. /deep/.ws-info-table .el-form-item .el-form-item__label {
  595. text-align: center;
  596. font-size: 14px;
  597. font-weight: 400;
  598. color: #8890b1;
  599. line-height: 16px;
  600. }
  601. //蓝标
  602. .small-title {
  603. position: relative;
  604. padding: 10px;
  605. font-weight: 600;
  606. }
  607. .small-title::before {
  608. position: absolute;
  609. content: '';
  610. display: block;
  611. background: #5473e8;
  612. width: 4px;
  613. height: 14px;
  614. left: 0px;
  615. top: 13px;
  616. padding: 4px 2px;
  617. }
  618. .position {
  619. position: relative;
  620. }
  621. .position .zaizhong {
  622. width: 16%;
  623. }
  624. //减号
  625. .del {
  626. position: absolute;
  627. // right: -38px;
  628. top: 9px;
  629. cursor: pointer;
  630. right: 0;
  631. display: inline-block;
  632. font-size: 20px;
  633. width: 20px;
  634. height: 10px;
  635. line-height: 0px;
  636. }
  637. .driver .el-form-item {
  638. width: 16.63%;
  639. }
  640. /deep/.ws-info-table .el-form-item .el-form-item__content {
  641. background: #f5f7fa;
  642. border-radius: 4px;
  643. color: #8890b1;
  644. font-size: 14px;
  645. }
  646. /deep/.driver .ws-info-table .el-form-item .el-form-item__label {
  647. width: 72px;
  648. }
  649. /deep/.liaison .ws-info-table .el-form-item {
  650. width: 16.66%;
  651. color: #8890b1;
  652. font-size: 14px;
  653. }
  654. /deep/.ws-info-table .el-form-item {
  655. border: none;
  656. height: 50px;
  657. }
  658. /deep/.liaison .ws-info-table .el-form-item .el-form-item__label {
  659. width: 40%;
  660. border: 0px solid #d8dce6;
  661. background: #f5f7fa;
  662. text-align: center;
  663. }
  664. /deep/.liaison {
  665. background: #f5f7fa;
  666. border-radius: 4px;
  667. border: 0px solid #d8dce6;
  668. }
  669. /deep/.liaison .ws-info-table .el-form-item .el-form-item__content {
  670. border: none;
  671. background: #f5f7fa;
  672. }
  673. .catNos {
  674. width: 100%;
  675. height: 30px;
  676. margin-top: 10px;
  677. margin-left: 20px;
  678. font-size: 14px;
  679. }
  680. /deep/.liaison .ws-info-table .el-form-item .el-form-item__content {
  681. // border: 0px solid #d8dce6;
  682. border-radius: 0px;
  683. border-left: none;
  684. border-bottom: none;
  685. border-top: none;
  686. }
  687. /deep/.liaison .ws-info-table {
  688. background: #f6f7fc;
  689. border-radius: 4px;
  690. border: 1px solid #d8dce6;
  691. margin-top: 20px;
  692. }
  693. //送达/未送达
  694. .noservice,
  695. .service {
  696. display: inline-block;
  697. border-radius: 4px;
  698. border: 1px solid #d8dce6;
  699. padding: 2px;
  700. font-size: 12px;
  701. }
  702. .noservice {
  703. background: #c4cada;
  704. color: #ffffff;
  705. }
  706. .service {
  707. background: #e5f1f7;
  708. color: #50cad4;
  709. }
  710. //添加司机
  711. .add {
  712. width: 100px;
  713. height: 34px;
  714. background: #f6f7fb;
  715. border-radius: 17px;
  716. color: #5473e8;
  717. font-size: 14px;
  718. border: none;
  719. }
  720. .add img {
  721. display: inline-block;
  722. margin-top: 3px;
  723. margin-left: -12px;
  724. }
  725. .add .spans {
  726. display: table-caption;
  727. width: 56px;
  728. height: 20px;
  729. line-height: 18px;
  730. }
  731. </style>