tranManagementVehicleDispatching.vue 20 KB

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