addWagonLoadEmergency.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639
  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="254" 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,isNumber } 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:null,
  171. toTheStationId:1,
  172. sendStation:null,
  173. toTheStation:"老区轨道衡"
  174. };
  175. },
  176. created(){
  177. this.form1 = {
  178. arrivalStationId:1,
  179. }
  180. },
  181. methods: {
  182. currentRadioChange1(selection) {
  183. this.input = null;
  184. this.materialName = selection.materialName;
  185. this.materialId = selection.materialId;
  186. this.getPurchaseOrderNo();
  187. },
  188. currentRadioChange2(selection) {
  189. this.supplierName = selection.supplierName;
  190. this.supplierId = selection.supplierId;
  191. this.getPurchaseOrderNo();
  192. },
  193. currentRadioChange4(selection) {
  194. this.unloadPointId = selection.warehouseId;
  195. this.unloadPointName = selection.warehouseName;
  196. },
  197. ondrawer(num) {
  198. this.drawer = true;
  199. this.a = num;
  200. if (num == 2) {
  201. this.secend.requestUrl =
  202. "/api/v1/uc/getSupplierMesByMaterialId?apiId=247&materialId=" +
  203. this.materialId;
  204. }
  205. },
  206. onBlur() {
  207. this.getPurchaseOrderNo();
  208. },
  209. getPurchaseOrderNo() {
  210. let map = {
  211. materialId: this.materialId,
  212. supplierId: this.supplierId,
  213. };
  214. if (this.remark) {
  215. map.remark = this.remark;
  216. }
  217. console.log(this.map);
  218. if (this.materialId && this.supplierId) {
  219. this.axios.post("/api/v1/oms/selectNewOrderId", map).then((res) => {
  220. console.log(res);
  221. if (res.data.code == "200") {
  222. if (res.data.data == null) {
  223. this.$message({
  224. message: "没有匹配的采购订单号!",
  225. type: "warning",
  226. });
  227. this.form1 = [];
  228. } else {
  229. this.remark = res.data.data.remark;
  230. this.purchaseOrderId = res.data.data.purchaseOrderId;
  231. this.form1 = { purchaseOrderNo: res.data.data.purchaseOrderNo };
  232. }
  233. } else {
  234. this.$message.error("请求失败");
  235. }
  236. });
  237. }
  238. },
  239. onClick(a) {
  240. if (a == 1) {
  241. this.frist.requestUrl =
  242. "/api/v1/uc/queryAPOMaterialByLike?apiId=244&startNum=050&index=" +
  243. this.inputText;
  244. } else if (a == 2) {
  245. this.secend.requestUrl =
  246. "/api/v1/uc/getSupplierMesByMaterialId?apiId=247&materialId=" +
  247. this.materialId +
  248. "&index=" +
  249. this.inputText;
  250. } else if (a == 4) {
  251. this.unloadPoint.requestUrl =
  252. "/api/v1/uc/getUnloadingMesByLike?apiId=374&index=" + this.inputText;
  253. }
  254. },
  255. onchang() {
  256. var state = false;
  257. var cptop = this.input.substring(0, 2);
  258. var cptop1 = this.input.substring(0, 3);
  259. if (
  260. cptop == "45" ||
  261. cptop == "46" ||
  262. cptop == "42" ||
  263. cptop == "47" ||
  264. cptop == "15" ||
  265. cptop == "16" ||
  266. cptop == "17" ||
  267. cptop == "18"
  268. ) {
  269. state = true;
  270. } else if (
  271. cptop1 == "140" ||
  272. cptop1 == "141" ||
  273. cptop1 == "142" ||
  274. cptop1 == "143" ||
  275. cptop1 == "145"
  276. ) {
  277. state = true;
  278. } else {
  279. this.$message({
  280. type: "warning",
  281. message: "车皮号格式不对,请重新输入!",
  282. });
  283. }
  284. if (state) {
  285. if (this.input.length == 7) {
  286. this.list.push(this.input);
  287. this.input = "";
  288. } else {
  289. this.$message({
  290. type: "warning",
  291. message: "车皮号长度不足7位数,请重新输入!",
  292. });
  293. }
  294. }
  295. },
  296. onclick(index) {
  297. this.list.splice(index, 1);
  298. },
  299. //发站弹出层
  300. handleSelectSendStation(item) {
  301. this.sendStationId = item.arrivalId;
  302. this.sendStation = item.arrivalName;
  303. },
  304. //以下是发站边输边查搜索
  305. querySearchSendStation(queryString, cb) {
  306. this.axios
  307. .get("/api/v1/uc/getArrivalByLike?index=" + this.sendStation)
  308. .then((res) => {
  309. if (res.data.code == "200") {
  310. var restaurantsSupplier = res.data.data;
  311. console.log(restaurantsSupplier)
  312. var results = queryString
  313. ? restaurantsSupplier.filter(
  314. this.createFilterSendStation(queryString)
  315. )
  316. : restaurantsSupplier;
  317. // 调用 callback 返回建议列表的数据
  318. cb(results);
  319. }
  320. });
  321. },
  322. //发站
  323. createFilterSendStation(queryString) {
  324. return (restaurantsSupplier) => {
  325. return (
  326. restaurantsSupplier.arrivalName
  327. .toLowerCase()
  328. .indexOf(queryString.toLowerCase()) > -1
  329. );
  330. };
  331. },
  332. //到站弹出层
  333. handleSelectToTheStation(item) {
  334. this.toTheStationId = item.arrivalId;
  335. this.toTheStation = item.arrivalName;
  336. },
  337. //以下是到站边输边查搜索
  338. querySearchToTheStation(queryString, cb) {
  339. this.axios
  340. .get("/api/v1/uc/getArrivalByLike?index=" + this.toTheStation)
  341. .then((res) => {
  342. if (res.data.code == "200") {
  343. var restaurantsSupplier = res.data.data;
  344. console.log(restaurantsSupplier)
  345. var results = queryString
  346. ? restaurantsSupplier.filter(
  347. this.createFilterToTheStation(queryString)
  348. )
  349. : restaurantsSupplier;
  350. // 调用 callback 返回建议列表的数据
  351. cb(results);
  352. }
  353. });
  354. },
  355. //到站
  356. createFilterToTheStation(queryString) {
  357. return (restaurantsSupplier) => {
  358. return (
  359. restaurantsSupplier.arrivalName
  360. .toLowerCase()
  361. .indexOf(queryString.toLowerCase()) > -1
  362. );
  363. };
  364. },
  365. // 确定
  366. makeSure() {
  367. let state = 0;
  368. if (
  369. this.list.length > 0 &&
  370. this.materialId &&
  371. this.supplierId &&
  372. this.unloadPointId &&
  373. this.purchaseOrderId &&
  374. this.sendStationId &&
  375. this.toTheStationId &&
  376. this.form1.resultLoadingDate
  377. ) {
  378. state = 1;
  379. } else {
  380. console.log(this.list.length);
  381. if (this.list.length == 0) {
  382. this.$message({
  383. type: "warning",
  384. message: "请输入车皮号!",
  385. });
  386. } else {
  387. if (this.materialId) {
  388. if (this.supplierId) {
  389. if (this.unloadPointId) {
  390. if (this.purchaseOrderId) {
  391. if (this.sendStationId) {
  392. if (this.toTheStationId) {
  393. if (this.form1.resultLoadingDate) {
  394. } else {
  395. this.$message({
  396. type: "warning",
  397. message: "请选择装车时间!",
  398. });
  399. }
  400. } else {
  401. this.$message({
  402. type: "warning",
  403. message: "请选择到站!",
  404. });
  405. }
  406. } else {
  407. this.$message({
  408. type: "warning",
  409. message: "请选择发站!",
  410. });
  411. }
  412. } else {
  413. this.$message({
  414. type: "warning",
  415. message: "该物资没有采购订单号!",
  416. });
  417. }
  418. } else {
  419. this.$message({
  420. type: "warning",
  421. message: "请选择卸货地点!",
  422. });
  423. }
  424. } else {
  425. this.$message({
  426. type: "warning",
  427. message: "请选择发货单位!",
  428. });
  429. }
  430. } else {
  431. this.$message({
  432. type: "warning",
  433. message: "请选择物资!",
  434. });
  435. }
  436. }
  437. }
  438. if(state == 1){
  439. let map = {
  440. wagonNoList:this.list,
  441. unloadingPointId:this.unloadPointId,
  442. purchaseOrderRailPlanId:this.purchaseOrderId,
  443. materialId:this.materialId,
  444. sendUnitId:this.supplierId,
  445. resultIsclear:this.form1.resultIsclear,
  446. resultClass: this.form1.resultClass,
  447. sendStationId: this.sendStationId,
  448. arrivalStationId: this.toTheStationId,
  449. resultLoadingDate: sjTime(this.form1.resultLoadingDate),
  450. resultRemarks: this.form1.resultRemarks,
  451. resultType:2,
  452. }
  453. this.axios.post('/api/v1/tms/insertTmstrainLoadingResult',map).then((res)=>{
  454. console.log(res);
  455. if(res.data.code == "200"){
  456. this.$message({
  457. type: "success",
  458. message: "新增成功",
  459. });
  460. this.$router.go(-1);
  461. }
  462. })
  463. }
  464. },
  465. // 取消
  466. cancel() {
  467. this.$router.go(-1);
  468. },
  469. },
  470. };
  471. </script>
  472. <style lang='scss'>
  473. .addWagonLoad {
  474. color: #606266;
  475. font-size: 0.675rem;
  476. font-weight: 500;
  477. .cp {
  478. width: 49%;
  479. display: flex;
  480. justify-content: center;
  481. align-items: center;
  482. padding-top: 0.625rem;
  483. padding-bottom: 0.625rem;
  484. margin-left: 364px;
  485. .cp_title {
  486. .cp_top {
  487. width: 3.125rem;
  488. padding-right: 1.55rem;
  489. }
  490. }
  491. }
  492. .cpList {
  493. display: flex;
  494. justify-content: center;
  495. width: 100%;
  496. height: 10rem;
  497. .list {
  498. width: 45%;
  499. border: #000 0.0625rem solid;
  500. padding: 0.625rem;
  501. display: flex;
  502. flex-wrap: wrap;
  503. .cpList1 {
  504. background-color: #c9c7c7;
  505. height: 1.875rem;
  506. margin-right: 0.5rem;
  507. padding: 0.625rem;
  508. display: flex;
  509. align-items: center;
  510. justify-content: center;
  511. position: relative;
  512. .itu {
  513. position: absolute;
  514. top: -0.125rem;
  515. right: 0.0625rem;
  516. width: 0.625rem;
  517. height: 0.625rem;
  518. }
  519. }
  520. }
  521. }
  522. .matching {
  523. width: 100%;
  524. height: 3.125rem;
  525. display: flex;
  526. justify-content: center;
  527. align-items: center;
  528. .text {
  529. width: 8.75rem;
  530. }
  531. .span {
  532. display: inline-block;
  533. width: 310px;
  534. height: 0.0625rem;
  535. }
  536. }
  537. .material {
  538. display: flex;
  539. justify-content: center;
  540. align-items: center;
  541. height: 3.75rem;
  542. margin-left: 27rem;
  543. width: 20rem;
  544. .text {
  545. text-align: right;
  546. width: 8.125rem;
  547. }
  548. }
  549. .forwardingUnit {
  550. display: flex;
  551. justify-content: center;
  552. align-items: center;
  553. height: 3.75rem;
  554. margin-left: 27rem;
  555. width: 20rem;
  556. .text {
  557. text-align: right;
  558. width: 8.125rem;
  559. }
  560. }
  561. .remark {
  562. display: flex;
  563. justify-content: center;
  564. align-items: center;
  565. height: 3.75rem;
  566. .text {
  567. text-align: right;
  568. width: 5.625rem;
  569. }
  570. .span {
  571. display: inline-block;
  572. width: 1.875rem;
  573. height: 1.25rem;
  574. }
  575. .el-input{
  576. width: 13.5rem;
  577. margin-right: 2.375rem;
  578. }
  579. }
  580. .purchaseOrder {
  581. display: flex;
  582. justify-content: center;
  583. align-items: center;
  584. .span {
  585. display: inline-block;
  586. width: 1.875rem;
  587. height: 0.0625rem;
  588. }
  589. }
  590. .form {
  591. display: flex;
  592. .form_box {
  593. width: 340px;
  594. margin-left: 37%;
  595. margin-right: 20px;
  596. .el-form {
  597. .preview-group {
  598. .el-form-item {
  599. .el-form-item__label {
  600. display: inline-block;
  601. width: 70px !important;
  602. }
  603. .el-form-item__content {
  604. .el-select {
  605. width: 250px;
  606. }
  607. .el-input {
  608. width: 250px;
  609. }
  610. .el-textarea{
  611. .el-textarea__inner{
  612. width: 220px;
  613. margin-top: 0.03rem;
  614. }
  615. }
  616. }
  617. }
  618. }
  619. }
  620. }
  621. }
  622. .button-box {
  623. display: flex;
  624. justify-content: center;
  625. padding-top: 30px;
  626. }
  627. .fromOther .el-input__inner{
  628. width: 250px;
  629. }
  630. }
  631. </style>