transportationReservationAdd.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  1. <template>
  2. <!-- 新增运输作业页面 -->
  3. <div id="contractDetails">
  4. <page-title>运输预约</page-title>
  5. <div class="material from">
  6. <span class="text">物资:</span>
  7. <el-input class="input" v-model="materialName" disabled> </el-input>
  8. <el-button type="primary" @click="ondrawer(1)">浏览</el-button>
  9. </div>
  10. <div class="forwardingUnit from">
  11. <span class="text">发货单位:</span>
  12. <el-input class="input" v-model="supplierName" disabled> </el-input>
  13. <el-button type="primary" @click="ondrawer(2)">浏览</el-button>
  14. </div>
  15. <div class="remark from">
  16. <span class="text">船名:</span>
  17. <el-input class="input" v-model="remark" @blur="onBlur"> </el-input>
  18. <span class="span"></span>
  19. </div>
  20. <div class="forwardingUnit from">
  21. <span class="text">卸货点:</span>
  22. <el-input class="input" v-model="unloadPointName" disabled> </el-input>
  23. <el-button type="primary" @click="ondrawer(4)">浏览</el-button>
  24. </div>
  25. <div class="lineId from">
  26. <span class="text">选择路线:</span>
  27. <el-input class="input" v-model="lineName" disabled> </el-input>
  28. <el-button type="primary" @click="ondrawer(5)">浏览</el-button>
  29. </div>
  30. <div class="lineId from">
  31. <span class="text">采购订单号:</span>
  32. <el-input class="input" v-model="purchaseOrderNo" disabled> </el-input>
  33. <el-button type="primary" @click="ondrawer(6)" v-if="materialId && supplierId">浏览</el-button>
  34. <span v-else class="span"></span>
  35. </div>
  36. <div class="orderType from">
  37. <span class="text">订单类别:</span>
  38. <el-select
  39. class="select"
  40. v-model="orderType"
  41. placeholder="请选择"
  42. disabled
  43. >
  44. <el-option
  45. v-for="item in orderTypeList"
  46. :key="item.value"
  47. :label="item.label"
  48. :value="item.value"
  49. >
  50. </el-option>
  51. </el-select>
  52. <span class="span"></span>
  53. </div>
  54. <div class="contractTitle from">
  55. <dil-form :formId="219" v-model="form1"></dil-form>
  56. </div>
  57. <div class="truckList1">
  58. <div class="truckList from">
  59. <span class="text">选择车辆:</span>
  60. <el-button type="primary" @click="ondrawer(3)" class="truckBtn"
  61. >浏览</el-button
  62. >
  63. </div>
  64. </div>
  65. <div class="lineId from">
  66. <span class="text">该批车辆是否一车多趟:</span>
  67. <el-switch
  68. v-model="isMoreTrips"
  69. active-text="是"
  70. inactive-text="否">
  71. </el-switch>
  72. </div>
  73. <div class="truckListTable">
  74. <el-table
  75. :data="selectionList"
  76. border
  77. style="width: 100%"
  78. highlight-current-row
  79. >
  80. <el-table-column type="index" width="50" label="序号" align="center">
  81. </el-table-column>
  82. <el-table-column
  83. v-for="(item, i) in tableTop"
  84. :key="i"
  85. :prop="item.prop"
  86. :label="item.label"
  87. align="center"
  88. show-overflow-tooltip
  89. >
  90. <template slot="scope" v-if="item.th_name !== '重量'">
  91. <span>{{ item.label }}</span>
  92. </template>
  93. <!-- 插入输入框 -->
  94. <template slot-scope="scope">
  95. <template v-if="item.slot">
  96. <template v-if="item.prop == 'orderMaterialWeight'">
  97. <el-input
  98. style="width: 250px"
  99. v-model.number="scope.row.orderMaterialWeight"
  100. ></el-input>
  101. </template>
  102. </template>
  103. <template v-else>
  104. <span>{{ scope.row[item.prop] }}</span>
  105. </template>
  106. </template>
  107. </el-table-column>
  108. <el-table-column fixed="right" label="操作" width="100">
  109. <template slot-scope="scope">
  110. <el-button type="text" size="small" @click="onClick(scope.$index)"
  111. >删除</el-button
  112. >
  113. </template>
  114. </el-table-column>
  115. </el-table>
  116. </div>
  117. <!-- 模态窗口 -->
  118. <el-drawer :visible.sync="drawer" :direction="direction" size="40%">
  119. <div style="margin-bottom: 10px">
  120. <el-input
  121. placeholder="请输入内容"
  122. v-model="input"
  123. style="margin-top: 10px; margin-right: 10px; width: 250px"
  124. clearable
  125. ></el-input>
  126. <el-button type="primary" class="btn" @click="onclick">
  127. <i class="el-icon-search"></i>查询
  128. </el-button>
  129. </div>
  130. <div v-show="onDrawerNumber == 1">
  131. <dilTable
  132. v-bind.sync="frist"
  133. @radio-change="currentRadioChange1"
  134. ></dilTable>
  135. </div>
  136. <div v-show="onDrawerNumber == 2">
  137. <dilTable
  138. v-bind.sync="secend"
  139. @radio-change="currentRadioChange2"
  140. ></dilTable>
  141. </div>
  142. <div v-show="onDrawerNumber == 3">
  143. <dilTable
  144. v-bind.sync="third"
  145. @selection-change="currentRadioChange3"
  146. ></dilTable>
  147. </div>
  148. <div v-show="onDrawerNumber == 4">
  149. <dilTable
  150. v-bind.sync="unloadPoint"
  151. @radio-change="currentRadioChange4"
  152. ></dilTable>
  153. </div>
  154. <div v-show="onDrawerNumber == 5">
  155. <dilTable
  156. v-bind.sync="line"
  157. @radio-change="currentRadioChange5"
  158. ></dilTable>
  159. </div>
  160. <div v-show="onDrawerNumber == 6">
  161. <dilTable
  162. v-bind.sync="purchaseOrder"
  163. @radio-change="currentRadioChange6"
  164. ></dilTable>
  165. </div>
  166. </el-drawer>
  167. <div class="button_box">
  168. <el-button @click="onClickCancel">返回</el-button>
  169. <el-button type="primary" @click="onClickConfirm">确认</el-button>
  170. </div>
  171. </div>
  172. </template>
  173. <script>
  174. import PageTitle from "@/components/Page/Title";
  175. import { sjTime, isNumber, isIntegerNumber } from "@/utils/sharedJsFile";
  176. import { getCookie } from "@/utils/util.js";
  177. export default {
  178. components: { PageTitle },
  179. data() {
  180. return {
  181. //采购订单号
  182. purchaseOrderNo:'',
  183. isMoreTrips:false,
  184. //订单类别
  185. orderTypeList: [
  186. {
  187. value: 17,
  188. label: "老厂区",
  189. },
  190. {
  191. value: 18,
  192. label: "新厂区",
  193. },
  194. ],
  195. // 线路名称
  196. lineName: "",
  197. //线路id
  198. lineId: null,
  199. // 件数与重量的开关
  200. value: false,
  201. //船名
  202. remark: null,
  203. // 车辆表格表头
  204. tableTop: [
  205. {
  206. prop: "capacityNumber",
  207. label: "车牌号",
  208. width: "140",
  209. },
  210. {
  211. prop: "carrierName",
  212. label: "承运商",
  213. width: "140",
  214. },
  215. {
  216. prop: "orderMaterialWeight",
  217. label: "重量",
  218. slot: true,
  219. },
  220. ],
  221. //车辆表格数据
  222. selectionList: [],
  223. // 表单
  224. form1: {},
  225. //采购订单id
  226. purchaseOrderId: "",
  227. //物资名称
  228. materialName: "",
  229. //发货单位名称
  230. supplierName: "",
  231. //发货单位id
  232. supplierId: null,
  233. //物资id
  234. materialId: null,
  235. //是否需要打开模态窗口
  236. drawer: false,
  237. //卸货点id
  238. unloadPointId: "",
  239. //卸货点名称
  240. unloadPointName: "",
  241. //订单类别
  242. orderType: null,
  243. onDrawerNumber: 1,
  244. direction: "rtl",
  245. input: "",
  246. frist: {
  247. requestUrl: "/api/v1/uc/queryAPOMaterialByLike?apiId=244&startNum=050",
  248. selectionType: "radio",
  249. mapList1: [],
  250. },
  251. secend: {
  252. requestUrl:
  253. "/api/v1/uc/getSupplierMesByMaterialId?apiId=247&materialId=",
  254. selectionType: "radio",
  255. mapList2: [],
  256. },
  257. third: {
  258. requestUrl: "",
  259. selectionType: "select",
  260. mapList3: [],
  261. },
  262. unloadPoint: {
  263. requestUrl: "/api/v1/uc/getUnloadingMesByLike?apiId=374",
  264. selectionType: "radio",
  265. },
  266. line: {
  267. requestUrl: "/api/v1/rms/getAllLineDesk?apiId=249&lineType=3",
  268. selectionType: "radio",
  269. },
  270. purchaseOrder:{
  271. requestUrl: "/api/v1/ams/getPurchaseOrderList?apiId=81",
  272. selectionType: "radio",
  273. }
  274. };
  275. },
  276. watch: {
  277. drawer(val) {
  278. if (!val) {
  279. this.input = null;
  280. }
  281. },
  282. },
  283. created() {
  284. if (getCookie("orgCode") == "chengyunshang") {
  285. this.third.requestUrl =
  286. "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" +
  287. getCookie("userId");
  288. } else {
  289. this.third.requestUrl =
  290. "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" + null;
  291. }
  292. },
  293. methods: {
  294. onClick(index) {
  295. this.selectionList.splice(index, 1);
  296. },
  297. onBlur() {
  298. this.getPurchaseOrderNo();
  299. },
  300. getPurchaseOrderNo() {
  301. let map = {
  302. materialId: this.materialId,
  303. supplierId: this.supplierId,
  304. };
  305. if (this.remark) {
  306. map.remark = this.remark;
  307. }
  308. console.log(this.map);
  309. if (this.materialId && this.supplierId) {
  310. this.axios.post("/api/v1/oms/selectNewOrderId", map).then((res) => {
  311. console.log(res);
  312. if (res.data.code == "200") {
  313. if (res.data.data == null) {
  314. this.$message({
  315. message: "没有匹配的采购订单号!",
  316. type: "warning",
  317. });
  318. this.form1 = [];
  319. } else {
  320. console.log();
  321. this.remark = res.data.data.remark;
  322. this.purchaseOrderId = res.data.data.purchaseOrderId;
  323. this.purchaseOrderNo=res.data.data.purchaseOrderNo;
  324. if (res.data.data.receiveUnitId == 1) {
  325. this.orderType = 17;
  326. } else {
  327. this.orderType = 18;
  328. }
  329. }
  330. } else {
  331. this.$message.error("请求失败");
  332. }
  333. });
  334. }
  335. },
  336. onclick() {
  337. if (this.onDrawerNumber == 1) {
  338. this.frist.requestUrl =
  339. "/api/v1/uc/queryAPOMaterialByLike?apiId=244&startNum=050&index=" +
  340. this.input;
  341. } else if (this.onDrawerNumber == 2) {
  342. this.secend.requestUrl =
  343. "/api/v1/uc/getSupplierMesByMaterialId?apiId=247&materialId=" +
  344. this.materialId +
  345. "&index=" +
  346. this.input;
  347. } else if (this.onDrawerNumber == 3) {
  348. //判断是否是承运商查询车辆
  349. if (getCookie("orgCode") == "chengyunshang") {
  350. this.third.requestUrl =
  351. "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" +
  352. getCookie("userId") +
  353. "&index=" +
  354. this.input;
  355. } else {
  356. this.third.requestUrl =
  357. "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" +
  358. null +
  359. "&index=" +
  360. this.input;
  361. }
  362. } else if (this.onDrawerNumber == 4) {
  363. this.unloadPoint.requestUrl =
  364. "/api/v1/uc/getUnloadingMesByLike?apiId=347&index=" + this.input;
  365. } else if (this.onDrawerNumber == 5) {
  366. this.option.requestUrl =
  367. "/api/v1/rms/getAllLineDesk?apiId=249&lineType=3&con=" + this.input;
  368. }else if (this.onDrawerNumber == 6) {
  369. console.log("caig")
  370. this.purchaseOrder.requestUrl =
  371. "/api/v1/ams/getPurchaseOrderList?apiId=81&con=" + this.input+"&i="+new Date();
  372. }
  373. },
  374. ondrawer(num) {
  375. this.drawer = true;
  376. this.onDrawerNumber = num;
  377. if (num == 2) {
  378. this.secend.requestUrl =
  379. "/api/v1/uc/getSupplierMesByMaterialId?apiId=247&materialId=" +
  380. this.materialId;
  381. } else if (num == 3) {
  382. //判断是否是承运商查询车辆
  383. if (getCookie("orgCode") == "chengyunshang") {
  384. this.third.requestUrl =
  385. "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" +
  386. getCookie("userId") +
  387. "&i=" + new Date();
  388. } else {
  389. this.third.requestUrl =
  390. "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" +
  391. null + "&i=" + new Date();
  392. }
  393. } else if (num == 4) {
  394. this.unloadPoint.requestUrl =
  395. "/api/v1/uc/getUnloadingMesByLike?apiId=347&i=" + new Date();
  396. } else if (num == 5) {
  397. this.option.requestUrl =
  398. "/api/v1/rms/getAllLineDesk?apiId=249&lineType=3&i=" + new Date();
  399. }else if (num == 6) {
  400. this.purchaseOrder.requestUrl =
  401. "/api/v1/ams/getPurchaseOrderList?apiId=81&i=" + new Date();
  402. }
  403. },
  404. // 返回
  405. onClickCancel() {
  406. this.$router.push("/transportReserveRan");
  407. },
  408. currentRadioChange1(selection) {
  409. this.materialName = selection.materialName;
  410. this.materialId = selection.materialId;
  411. this.getPurchaseOrderNo();
  412. },
  413. currentRadioChange2(selection) {
  414. this.supplierName = selection.supplierName;
  415. this.supplierId = selection.supplierId;
  416. this.getPurchaseOrderNo();
  417. },
  418. currentRadioChange4(selection) {
  419. this.unloadPointId = selection.warehouseId;
  420. this.unloadPointName = selection.warehouseName;
  421. },
  422. currentRadioChange5(selection) {
  423. this.lineName = selection.lineName;
  424. this.lineId = selection.lineId;
  425. },
  426. currentRadioChange6(selection) {
  427. this.purchaseOrderNo = selection.purchaseOrderNo;
  428. this.purchaseOrderId = selection.purchaseOrderId;
  429. },
  430. currentRadioChange3(selection) {
  431. this.selectionList = [];
  432. this.selectionList = selection;
  433. },
  434. // 确认
  435. onClickConfirm() {
  436. var state = 0;
  437. if (
  438. this.materialId &&
  439. this.supplierId &&
  440. this.form1.purchaseOrderId &&
  441. this.unloadPointId &&
  442. sjTime(this.form1.orderEntryTime) &&
  443. this.lineId
  444. ) {
  445. state = 1;
  446. } else {
  447. if (!this.materialId) {
  448. this.$message({
  449. message: "请选择物资!",
  450. type: "warning",
  451. });
  452. } else if (!this.supplierId) {
  453. this.$message({
  454. message: "请选择发货单位!",
  455. type: "warning",
  456. });
  457. } else if (!this.purchaseOrderId) {
  458. this.$message({
  459. message: "没有匹配的采购订单号!",
  460. type: "warning",
  461. });
  462. } else if (!this.unloadPointId) {
  463. this.$message({
  464. message: "请选择卸货地点!",
  465. type: "warning",
  466. });
  467. } else if (!this.lineId) {
  468. this.$message({
  469. message: "请选择运输路线!",
  470. type: "warning",
  471. });
  472. } else if (!sjTime(this.form1.orderEntryTime)) {
  473. this.$message({
  474. message: "请选择预估进厂时间!",
  475. type: "warning",
  476. });
  477. }
  478. }
  479. if (this.selectionList.length == 0) {
  480. this.$message({
  481. message: "请选择车辆!",
  482. type: "warning",
  483. });
  484. state = 0;
  485. } else {
  486. this.selectionList.forEach((e) => {
  487. if (e.orderMaterialWeight) {
  488. if (isNumber(e.orderMaterialWeight)) {
  489. if (isIntegerNumber(e.orderMaterialWeight)) {
  490. state = 1;
  491. } else {
  492. this.$message({
  493. message: "重量只能是整数!",
  494. type: "warning",
  495. });
  496. state = 0;
  497. }
  498. } else {
  499. this.$message({
  500. message: "重量只能是数字!",
  501. type: "warning",
  502. });
  503. state = 0;
  504. }
  505. } else {
  506. state = 1;
  507. }
  508. });
  509. }
  510. if (state == 1) {
  511. let map = {
  512. materialId: this.materialId,
  513. supplierId: this.supplierId,
  514. purchaseOrderId: this.purchaseOrderId,
  515. unloadPointId: this.unloadPointId,
  516. orderEntryTime: sjTime(this.form1.orderEntryTime),
  517. driverCapacityIdList: this.selectionList,
  518. orderType: this.orderType,
  519. lineId: this.lineId,
  520. isMoreTrips:this.isMoreTrips,
  521. };
  522. console.log(map, map);
  523. this.axios.post("/api/v1/oms/addPurOrder", map).then((res) => {
  524. if (res.data.code == "200") {
  525. this.$message({
  526. message: "添加成功!",
  527. type: "success",
  528. });
  529. this.$router.push("/transportationReservation");
  530. }
  531. });
  532. }
  533. },
  534. },
  535. };
  536. </script>
  537. <style lang="scss">
  538. .contractDetails {
  539. width: 100%;
  540. }
  541. .from {
  542. display: flex;
  543. align-items: center;
  544. justify-content: center;
  545. margin-top: 5px;
  546. margin-bottom: 20px;
  547. }
  548. .remark {
  549. display: flex;
  550. justify-content: center;
  551. .text {
  552. display: inline-block;
  553. width: 100px;
  554. text-align: right;
  555. }
  556. .input {
  557. width: 250px;
  558. margin-right: 20px;
  559. }
  560. }
  561. .lineId {
  562. display: flex;
  563. justify-content: center;
  564. .text {
  565. display: inline-block;
  566. width: 170px;
  567. text-align: right;
  568. }
  569. .input {
  570. width: 250px;
  571. margin-right: 20px;
  572. }
  573. .span{
  574. display: inline-block;
  575. width: 70px;
  576. height: 1px;
  577. }
  578. }
  579. .material {
  580. display: flex;
  581. justify-content: center;
  582. margin-top: 20px;
  583. .text {
  584. display: inline-block;
  585. width: 170px;
  586. text-align: right;
  587. }
  588. .input {
  589. width: 250px;
  590. margin-right: 20px;
  591. }
  592. }
  593. .orderType {
  594. display: flex;
  595. justify-content: center;
  596. .text {
  597. display: inline-block;
  598. width: 110px;
  599. text-align: right;
  600. }
  601. .select {
  602. width: 250px;
  603. }
  604. .span {
  605. display: inline-block;
  606. width: 30px;
  607. height: 10px;
  608. }
  609. }
  610. .contractTitle {
  611. display: flex;
  612. justify-content: center;
  613. .el-form-item {
  614. display: flex;
  615. justify-content: center;
  616. .el-form-item__label {
  617. display: flex;
  618. align-items: center;
  619. }
  620. .el-input {
  621. width: 250px;
  622. }
  623. }
  624. }
  625. .forwardingUnit {
  626. display: flex;
  627. justify-content: center;
  628. .text {
  629. display: inline-block;
  630. width: 170px;
  631. text-align: right;
  632. }
  633. .input {
  634. width: 250px;
  635. margin-right: 20px;
  636. }
  637. }
  638. .truckList1 {
  639. width: 100%;
  640. .truckList {
  641. width: 96%;
  642. .text {
  643. display: inline-block;
  644. width: 120px;
  645. text-align: right;
  646. }
  647. .truckBtn {
  648. width: 250px;
  649. }
  650. }
  651. }
  652. .button_box {
  653. display: flex;
  654. justify-content: center;
  655. align-items: center;
  656. width: 100%;
  657. height: 100px;
  658. }
  659. </style>