transportReserveFuAdd.vue 15 KB

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