addWagonLoad.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  1. <template>
  2. <!-- 添加车皮装车实绩 -->
  3. <div class="addWagonLoad">
  4. <page-title>新增</page-title>
  5. <div class="cp">
  6. <span style="width:80px">车皮号:</span>
  7. <el-input
  8. placeholder="请输入内容"
  9. v-model="input"
  10. @change="onchang"
  11. clearable
  12. >
  13. </el-input>
  14. </div>
  15. <div class="cpList">
  16. <div class="list">
  17. <span class="cpList1" v-for="(item, i) in list" :key="i">
  18. {{ item }}
  19. <i class="el-icon-close itu" @click="onclick(i)"></i>
  20. </span>
  21. </div>
  22. </div>
  23. <div class="material from">
  24. <span class="text">物资:</span>
  25. <el-input v-model="materialName" disabled> </el-input>
  26. <el-button type="primary" @click="ondrawer(1)">浏览</el-button>
  27. </div>
  28. <div class="forwardingUnit from">
  29. <span class="text">发货单位:</span>
  30. <el-input v-model="supplierName" disabled> </el-input>
  31. <el-button type="primary" @click="ondrawer(2)">浏览</el-button>
  32. </div>
  33. <div class="remark from">
  34. <span class="text">船名:</span>
  35. <el-input class="el-input" v-model="remark" @blur="onBlur"> </el-input>
  36. <span class="span"></span>
  37. </div>
  38. <div class="forwardingUnit from">
  39. <span class="text">卸货点:</span>
  40. <el-input v-model="unloadPointName" disabled> </el-input>
  41. <el-button type="primary" @click="ondrawer(4)">浏览</el-button>
  42. </div>
  43. <div class="fromOther">
  44. <el-form :inline="true" class="demo-form-inline" label-width="80px" style="margin-left:550px;">
  45. <el-form-item label="发站:">
  46. <el-autocomplete
  47. class="inline-input"
  48. v-model="sendStation"
  49. :fetch-suggestions="querySearchSendStation"
  50. placeholder="请输入发站名称"
  51. :trigger-on-focus="false"
  52. @select="handleSelectSendStation"
  53. >
  54. <template slot-scope="{ item }">
  55. <div class="name">{{ item.arrivalName }}</div>
  56. </template>
  57. </el-autocomplete>
  58. </el-form-item>
  59. </el-form>
  60. <el-form :inline="true" class="demo-form-inline" label-width="80px" style="margin-left:550px;">
  61. <el-form-item label="到站:">
  62. <el-autocomplete
  63. class="inline-input"
  64. v-model="toTheStation"
  65. :fetch-suggestions="querySearchToTheStation"
  66. placeholder="请输入到站名称"
  67. :trigger-on-focus="false"
  68. @select="handleSelectToTheStation"
  69. >
  70. <template slot-scope="{ item }">
  71. <div class="name">{{ item.arrivalName }}</div>
  72. </template>
  73. </el-autocomplete>
  74. </el-form-item>
  75. </el-form>
  76. </div>
  77. <div class="form">
  78. <div class="form_box" style="margin-right: 10rem">
  79. <dil-form :formId="102" v-model="form1" ref="from1"></dil-form>
  80. </div>
  81. </div>
  82. <div class="button-box">
  83. <el-button @click="cancel">取消</el-button>
  84. <el-button type="primary" @click="makeSure">确定</el-button>
  85. </div>
  86. <!-- 模态窗口 -->
  87. <el-drawer :visible.sync="drawer" :direction="direction" size="30%">
  88. <el-input
  89. placeholder="请输入内容"
  90. v-model="inputText"
  91. style="margin-top: 0.625rem; margin-left: 1.25rem;width:250px"
  92. clearable
  93. ></el-input>
  94. <el-button
  95. type="primary"
  96. class="btn"
  97. @click="onClick(a)"
  98. style="margin-bottom: 0.9375rem"
  99. >
  100. <i class="el-icon-search"></i>查询
  101. </el-button>
  102. <div v-show="a == 1">
  103. <dilTable
  104. v-bind.sync="frist"
  105. @radio-change="currentRadioChange1"
  106. ></dilTable>
  107. </div>
  108. <div v-show="a == 2">
  109. <dilTable
  110. v-bind.sync="secend"
  111. @radio-change="currentRadioChange2"
  112. ></dilTable>
  113. </div>
  114. <div v-show="a == 4">
  115. <dilTable
  116. v-bind.sync="unloadPoint"
  117. @radio-change="currentRadioChange4"
  118. ></dilTable>
  119. </div>
  120. </el-drawer>
  121. </div>
  122. </template>
  123. <script>
  124. import PageTitle from "@/components/Page/Title";
  125. import { sjTime } from "@/utils/sharedJsFile";
  126. export default {
  127. components: { PageTitle },
  128. data() {
  129. return {
  130. list: [],
  131. form1: {},
  132. input: "",
  133. value: undefined,
  134. //船名
  135. remark: null,
  136. //采购订单id
  137. purchaseOrderId: null,
  138. //物资名称
  139. materialName: null,
  140. //发货单位名称
  141. supplierName: null,
  142. //发货单位id
  143. supplierId: null,
  144. //物资id
  145. materialId: null,
  146. //是否需要打开模态窗口
  147. drawer: false,
  148. //卸货点id
  149. unloadPointId: null,
  150. //卸货点名称
  151. unloadPointName: null,
  152. a: 1,
  153. direction: "rtl",
  154. inputText: "",
  155. frist: {
  156. requestUrl: "/api/v1/uc/queryAPOMaterialByLike?apiId=244&startNum=050",
  157. selectionType: "radio",
  158. mapList1: [],
  159. },
  160. secend: {
  161. requestUrl:
  162. "/api/v1/uc/getSupplierMesByMaterialId?apiId=247&materialId=",
  163. selectionType: "radio",
  164. mapList2: [],
  165. },
  166. unloadPoint: {
  167. requestUrl: "/api/v1/uc/getUnloadingMesByLike?apiId=374",
  168. selectionType: "radio",
  169. },
  170. sendStationId:2,
  171. toTheStationId:1,
  172. sendStation:"万州港",
  173. toTheStation:"老区轨道衡"
  174. };
  175. },
  176. methods: {
  177. currentRadioChange1(selection) {
  178. this.input = null;
  179. this.materialName = selection.materialName;
  180. this.materialId = selection.materialId;
  181. this.getPurchaseOrderNo();
  182. },
  183. currentRadioChange2(selection) {
  184. this.supplierName = selection.supplierName;
  185. this.supplierId = selection.supplierId;
  186. this.getPurchaseOrderNo();
  187. },
  188. currentRadioChange4(selection) {
  189. this.unloadPointId = selection.warehouseId;
  190. this.unloadPointName = selection.warehouseName;
  191. },
  192. ondrawer(num) {
  193. this.drawer = true;
  194. this.a = num;
  195. if (num == 2) {
  196. this.secend.requestUrl =
  197. "/api/v1/uc/getSupplierMesByMaterialId?apiId=247&materialId=" +
  198. this.materialId;
  199. }
  200. },
  201. onBlur() {
  202. this.getPurchaseOrderNo();
  203. },
  204. getPurchaseOrderNo() {
  205. let map = {
  206. materialId: this.materialId,
  207. supplierId: this.supplierId,
  208. };
  209. if (this.remark) {
  210. map.remark = this.remark;
  211. }
  212. console.log(this.map);
  213. if (this.materialId && this.supplierId) {
  214. this.axios.post("/api/v1/oms/selectNewOrderId", map).then((res) => {
  215. console.log(res);
  216. if (res.data.code == "200") {
  217. if (res.data.data == null) {
  218. this.$message({
  219. message: "没有匹配的采购订单号!",
  220. type: "warning",
  221. });
  222. this.form1 = [];
  223. } else {
  224. this.remark = res.data.data.remark;
  225. this.purchaseOrderId = res.data.data.purchaseOrderId;
  226. this.form1 = { purchaseOrderNo: res.data.data.purchaseOrderNo };
  227. }
  228. } else {
  229. this.$message.error("请求失败");
  230. }
  231. });
  232. }
  233. },
  234. onClick(a) {
  235. if (a == 1) {
  236. this.frist.requestUrl =
  237. "/api/v1/uc/queryAPOMaterialByLike?apiId=244&startNum=050&index=" +
  238. this.inputText;
  239. } else if (a == 2) {
  240. this.secend.requestUrl =
  241. "/api/v1/uc/getSupplierMesByMaterialId?apiId=247&materialId=" +
  242. this.materialId +
  243. "&index=" +
  244. this.inputText;
  245. } else if (a == 4) {
  246. this.unloadPoint.requestUrl =
  247. "/api/v1/uc/getUnloadingMesByLike?apiId=374&index=" + this.inputText;
  248. }
  249. },
  250. //发站弹出层
  251. handleSelectSendStation(item) {
  252. this.sendStationId = item.arrivalId;
  253. this.sendStation = item.arrivalName;
  254. },
  255. //以下是发站边输边查搜索
  256. querySearchSendStation(queryString, cb) {
  257. this.axios
  258. .get("/api/v1/uc/getArrivalByLike?index=" + this.sendStation)
  259. .then((res) => {
  260. if (res.data.code == "200") {
  261. var restaurantsSupplier = res.data.data;
  262. console.log(restaurantsSupplier)
  263. var results = queryString
  264. ? restaurantsSupplier.filter(
  265. this.createFilterSendStation(queryString)
  266. )
  267. : restaurantsSupplier;
  268. // 调用 callback 返回建议列表的数据
  269. cb(results);
  270. }
  271. });
  272. },
  273. //发站
  274. createFilterSendStation(queryString) {
  275. return (restaurantsSupplier) => {
  276. return (
  277. restaurantsSupplier.arrivalName
  278. .toLowerCase()
  279. .indexOf(queryString.toLowerCase()) > -1
  280. );
  281. };
  282. },
  283. //到站弹出层
  284. handleSelectToTheStation(item) {
  285. this.toTheStationId = item.arrivalId;
  286. this.toTheStation = item.arrivalName;
  287. },
  288. //以下是到站边输边查搜索
  289. querySearchToTheStation(queryString, cb) {
  290. this.axios
  291. .get("/api/v1/uc/getArrivalByLike?index=" + this.toTheStation)
  292. .then((res) => {
  293. if (res.data.code == "200") {
  294. var restaurantsSupplier = res.data.data;
  295. console.log(restaurantsSupplier)
  296. var results = queryString
  297. ? restaurantsSupplier.filter(
  298. this.createFilterToTheStation(queryString)
  299. )
  300. : restaurantsSupplier;
  301. // 调用 callback 返回建议列表的数据
  302. cb(results);
  303. }
  304. });
  305. },
  306. //到站
  307. createFilterToTheStation(queryString) {
  308. return (restaurantsSupplier) => {
  309. return (
  310. restaurantsSupplier.arrivalName
  311. .toLowerCase()
  312. .indexOf(queryString.toLowerCase()) > -1
  313. );
  314. };
  315. },
  316. onchang() {
  317. var state = false;
  318. var cptop = this.input.substring(0, 2);
  319. var cptop1 = this.input.substring(0, 3);
  320. if (
  321. cptop == "45" ||
  322. cptop == "46" ||
  323. cptop == "42" ||
  324. cptop == "47" ||
  325. cptop == "15" ||
  326. cptop == "16" ||
  327. cptop == "17" ||
  328. cptop == "18"
  329. ) {
  330. state = true;
  331. } else if (
  332. cptop1 == "140" ||
  333. cptop1 == "141" ||
  334. cptop1 == "142" ||
  335. cptop1 == "143" ||
  336. cptop1 == "145"
  337. ) {
  338. state = true;
  339. } else {
  340. this.$message({
  341. type: "warning",
  342. message: "车皮号格式不对,请重新输入!",
  343. });
  344. }
  345. if (state) {
  346. if (this.input.length == 7) {
  347. this.list.push(this.input);
  348. this.input = "";
  349. } else {
  350. this.$message({
  351. type: "warning",
  352. message: "车皮号长度不足7位数,请重新输入!",
  353. });
  354. }
  355. }
  356. },
  357. onclick(index) {
  358. this.list.splice(index, 1);
  359. },
  360. // 确定
  361. makeSure() {
  362. let state = 0;
  363. if (
  364. this.list.length > 0 &&
  365. this.materialId &&
  366. this.supplierId &&
  367. this.unloadPointId &&
  368. this.purchaseOrderId &&
  369. this.form1.resultIsclear &&
  370. this.form1.resultClass &&
  371. this.sendStationId &&
  372. this.toTheStationId &&
  373. this.form1.resultLoadingDate
  374. ) {
  375. state = 1;
  376. } else {
  377. console.log(this.list.length);
  378. if (this.list.length == 0) {
  379. this.$message({
  380. type: "warning",
  381. message: "请输入车皮号!",
  382. });
  383. } else {
  384. if (this.materialId) {
  385. if (this.supplierId) {
  386. if (this.unloadPointId) {
  387. if (this.purchaseOrderId) {
  388. if (this.form1.resultIsclear) {
  389. if (this.form1.resultIsclear) {
  390. if (this.form1.sendStationId) {
  391. if (this.form1.arrivalStationId) {
  392. if (this.form1.resultLoadingDate) {
  393. } else {
  394. this.$message({
  395. type: "warning",
  396. message: "请选择装车时间!",
  397. });
  398. }
  399. } else {
  400. this.$message({
  401. type: "warning",
  402. message: "请选择到站!",
  403. });
  404. }
  405. } else {
  406. this.$message({
  407. type: "warning",
  408. message: "请选择发站!",
  409. });
  410. }
  411. } else {
  412. this.$message({
  413. type: "warning",
  414. message: "请选择班别!",
  415. });
  416. }
  417. } else {
  418. this.$message({
  419. type: "warning",
  420. message: "请选择是否清场!",
  421. });
  422. }
  423. } else {
  424. this.$message({
  425. type: "warning",
  426. message: "该物资没有采购订单号!",
  427. });
  428. }
  429. } else {
  430. this.$message({
  431. type: "warning",
  432. message: "请选择卸货地点!",
  433. });
  434. }
  435. } else {
  436. this.$message({
  437. type: "warning",
  438. message: "请选择发货单位!",
  439. });
  440. }
  441. } else {
  442. this.$message({
  443. type: "warning",
  444. message: "请选择物资!",
  445. });
  446. }
  447. }
  448. }
  449. if(state == 1){
  450. let map = {
  451. wagonNoList:this.list,
  452. unloadingPointId:this.unloadPointId,
  453. purchaseOrderRailPlanId:this.purchaseOrderId,
  454. materialId:this.materialId,
  455. sendUnitId:this.supplierId,
  456. resultIsclear:this.form1.resultIsclear,
  457. resultClass: this.form1.resultClass,
  458. sendStationId: this.sendStationId,
  459. arrivalStationId: this.toTheStationId,
  460. resultLoadingDate: sjTime(this.form1.resultLoadingDate),
  461. resultRemarks: this.form1.resultRemarks,
  462. resultType:1,
  463. }
  464. this.axios.post('/api/v1/tms/insertTmstrainLoadingResult',map).then((res)=>{
  465. console.log(res);
  466. if(res.data.code == "200"){
  467. this.$message({
  468. type: "success",
  469. message: "新增成功",
  470. });
  471. this.$router.push("/wagonLoad");
  472. }
  473. })
  474. }
  475. },
  476. // 取消
  477. cancel() {
  478. this.$router.go(-1);
  479. },
  480. },
  481. };
  482. </script>
  483. <style lang='scss'>
  484. .addWagonLoad {
  485. color: #606266;
  486. font-size: 0.675rem;
  487. font-weight: 500;
  488. .cp {
  489. width: 49%;
  490. display: flex;
  491. justify-content: center;
  492. align-items: center;
  493. padding-top: 0.625rem;
  494. padding-bottom: 0.625rem;
  495. margin-left: 364px;
  496. .cp_title {
  497. .cp_top {
  498. width: 3.125rem;
  499. padding-right: 1.55rem;
  500. }
  501. }
  502. }
  503. .cpList {
  504. display: flex;
  505. justify-content: center;
  506. width: 100%;
  507. height: 10rem;
  508. .list {
  509. width: 45%;
  510. border: #000 0.0625rem solid;
  511. padding: 0.625rem;
  512. display: flex;
  513. flex-wrap: wrap;
  514. .cpList1 {
  515. background-color: #c9c7c7;
  516. height: 1.875rem;
  517. margin-right: 0.5rem;
  518. padding: 0.625rem;
  519. display: flex;
  520. align-items: center;
  521. justify-content: center;
  522. position: relative;
  523. .itu {
  524. position: absolute;
  525. top: -0.125rem;
  526. right: 0.0625rem;
  527. width: 0.625rem;
  528. height: 0.625rem;
  529. }
  530. }
  531. }
  532. }
  533. .matching {
  534. width: 100%;
  535. height: 3.125rem;
  536. display: flex;
  537. justify-content: center;
  538. align-items: center;
  539. .text {
  540. width: 8.75rem;
  541. }
  542. .span {
  543. display: inline-block;
  544. width: 310px;
  545. height: 0.0625rem;
  546. }
  547. }
  548. .material {
  549. display: flex;
  550. justify-content: center;
  551. align-items: center;
  552. height: 3.75rem;
  553. margin-left: 27rem;
  554. width: 20rem;
  555. .text {
  556. text-align: right;
  557. width: 8.125rem;
  558. }
  559. }
  560. .forwardingUnit {
  561. display: flex;
  562. justify-content: center;
  563. align-items: center;
  564. height: 3.75rem;
  565. margin-left: 27rem;
  566. width: 20rem;
  567. .text {
  568. text-align: right;
  569. width: 8.125rem;
  570. }
  571. }
  572. .remark {
  573. display: flex;
  574. justify-content: center;
  575. align-items: center;
  576. height: 3.75rem;
  577. .text {
  578. text-align: right;
  579. width: 5.625rem;
  580. }
  581. .span {
  582. display: inline-block;
  583. width: 1.875rem;
  584. height: 1.25rem;
  585. }
  586. .el-input{
  587. width: 13.5rem;
  588. margin-right: 2.375rem;
  589. }
  590. }
  591. .purchaseOrder {
  592. display: flex;
  593. justify-content: center;
  594. align-items: center;
  595. .span {
  596. display: inline-block;
  597. width: 1.875rem;
  598. height: 0.0625rem;
  599. }
  600. }
  601. .form {
  602. display: flex;
  603. .form_box {
  604. width: 340px;
  605. margin-left: 37%;
  606. margin-right: 20px;
  607. .el-form {
  608. .preview-group {
  609. .el-form-item {
  610. .el-form-item__label {
  611. display: inline-block;
  612. width: 70px !important;
  613. }
  614. .el-form-item__content {
  615. .el-select {
  616. width: 250px;
  617. }
  618. .el-input {
  619. width: 250px;
  620. }
  621. .el-textarea{
  622. .el-textarea__inner{
  623. width: 225px;
  624. margin-top: 0.03rem;
  625. }
  626. }
  627. }
  628. }
  629. }
  630. }
  631. }
  632. }
  633. .button-box {
  634. display: flex;
  635. justify-content: center;
  636. padding-top: 30px;
  637. }
  638. .fromOther .el-input__inner{
  639. width: 250px;
  640. }
  641. }
  642. </style>