tranManagementVehicleDispatching.vue 20 KB

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