addWagonLoadEmergency.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  1. <template>
  2. <!-- 添加车皮装车实绩 -->
  3. <div class="addWagonLoad">
  4. <page-title>新增</page-title>
  5. <div class="cp">
  6. <span>车皮号:</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="form">
  44. <div class="form_box" style="margin-right: 10rem">
  45. <dil-form :formId="254" v-model="form1" ref="from1"></dil-form>
  46. </div>
  47. </div>
  48. <div class="button-box">
  49. <el-button @click="cancel">取消</el-button>
  50. <el-button type="primary" @click="makeSure">确定</el-button>
  51. </div>
  52. <!-- 模态窗口 -->
  53. <el-drawer :visible.sync="drawer" :direction="direction" size="30%">
  54. <el-input
  55. placeholder="请输入内容"
  56. v-model="inputText"
  57. style="margin-top: 0.625rem; margin-left: 1.25rem"
  58. clearable
  59. ></el-input>
  60. <el-button
  61. type="primary"
  62. class="btn"
  63. @click="onClick(a)"
  64. style="margin-bottom: 0.9375rem"
  65. >
  66. <i class="el-icon-search"></i>查询
  67. </el-button>
  68. <div v-show="a == 1">
  69. <dilTable
  70. v-bind.sync="frist"
  71. @radio-change="currentRadioChange1"
  72. ></dilTable>
  73. </div>
  74. <div v-show="a == 2">
  75. <dilTable
  76. v-bind.sync="secend"
  77. @radio-change="currentRadioChange2"
  78. ></dilTable>
  79. </div>
  80. <div v-show="a == 4">
  81. <dilTable
  82. v-bind.sync="unloadPoint"
  83. @radio-change="currentRadioChange4"
  84. ></dilTable>
  85. </div>
  86. </el-drawer>
  87. </div>
  88. </template>
  89. <script>
  90. import PageTitle from "@/components/Page/Title";
  91. import { sjTime,isNumber } from "@/utils/sharedJsFile";
  92. export default {
  93. components: { PageTitle },
  94. data() {
  95. return {
  96. list: [],
  97. form1: {},
  98. input: "",
  99. value: undefined,
  100. //船名
  101. remark: null,
  102. //采购订单id
  103. purchaseOrderId: null,
  104. //物资名称
  105. materialName: null,
  106. //发货单位名称
  107. supplierName: null,
  108. //发货单位id
  109. supplierId: null,
  110. //物资id
  111. materialId: null,
  112. //是否需要打开模态窗口
  113. drawer: false,
  114. //卸货点id
  115. unloadPointId: null,
  116. //卸货点名称
  117. unloadPointName: null,
  118. a: 1,
  119. direction: "rtl",
  120. inputText: "",
  121. frist: {
  122. requestUrl: "/api/v1/uc/queryAPOMaterialByLike?apiId=244&startNum=050",
  123. selectionType: "radio",
  124. mapList1: [],
  125. },
  126. secend: {
  127. requestUrl:
  128. "/api/v1/uc/getSupplierMesByMaterialId?apiId=247&materialId=",
  129. selectionType: "radio",
  130. mapList2: [],
  131. },
  132. unloadPoint: {
  133. requestUrl: "/api/v1/uc/getUnloadingMesByLike?apiId=374",
  134. selectionType: "radio",
  135. },
  136. };
  137. },
  138. created(){
  139. this.form1 = {
  140. sendStationId:1,
  141. arrivalStationId:2,
  142. }
  143. },
  144. methods: {
  145. currentRadioChange1(selection) {
  146. this.input = null;
  147. this.materialName = selection.materialName;
  148. this.materialId = selection.materialId;
  149. this.getPurchaseOrderNo();
  150. },
  151. currentRadioChange2(selection) {
  152. this.supplierName = selection.supplierName;
  153. this.supplierId = selection.supplierId;
  154. this.getPurchaseOrderNo();
  155. },
  156. currentRadioChange4(selection) {
  157. this.unloadPointId = selection.warehouseId;
  158. this.unloadPointName = selection.warehouseName;
  159. },
  160. ondrawer(num) {
  161. this.drawer = true;
  162. this.a = num;
  163. if (num == 2) {
  164. this.secend.requestUrl =
  165. "/api/v1/uc/getSupplierMesByMaterialId?apiId=247&materialId=" +
  166. this.materialId;
  167. }
  168. },
  169. onBlur() {
  170. this.getPurchaseOrderNo();
  171. },
  172. getPurchaseOrderNo() {
  173. let map = {
  174. materialId: this.materialId,
  175. supplierId: this.supplierId,
  176. };
  177. if (this.remark) {
  178. map.remark = this.remark;
  179. }
  180. console.log(this.map);
  181. if (this.materialId && this.supplierId) {
  182. this.axios.post("/api/v1/oms/selectNewOrderId", map).then((res) => {
  183. console.log(res);
  184. if (res.data.code == "200") {
  185. if (res.data.data == null) {
  186. this.$message({
  187. message: "没有匹配的采购订单号!",
  188. type: "warning",
  189. });
  190. this.form1 = [];
  191. } else {
  192. this.remark = res.data.data.remark;
  193. this.purchaseOrderId = res.data.data.purchaseOrderId;
  194. this.form1 = { purchaseOrderNo: res.data.data.purchaseOrderNo };
  195. }
  196. } else {
  197. this.$message.error("请求失败");
  198. }
  199. });
  200. }
  201. },
  202. onClick(a) {
  203. if (a == 1) {
  204. this.frist.requestUrl =
  205. "/api/v1/uc/queryAPOMaterialByLike?apiId=244&startNum=050&index=" +
  206. this.inputText;
  207. } else if (a == 2) {
  208. this.secend.requestUrl =
  209. "/api/v1/uc/getSupplierMesByMaterialId?apiId=247&materialId=" +
  210. this.materialId +
  211. "&index=" +
  212. this.inputText;
  213. } else if (a == 4) {
  214. this.unloadPoint.requestUrl =
  215. "/api/v1/uc/getUnloadingMesByLike?apiId=374&index=" + this.inputText;
  216. }
  217. },
  218. onchang() {
  219. var state = false;
  220. var cptop = this.input.substring(0, 2);
  221. var cptop1 = this.input.substring(0, 3);
  222. if (
  223. cptop == "45" ||
  224. cptop == "46" ||
  225. cptop == "42" ||
  226. cptop == "47" ||
  227. cptop == "15" ||
  228. cptop == "16" ||
  229. cptop == "17" ||
  230. cptop == "18"
  231. ) {
  232. state = true;
  233. } else if (
  234. cptop1 == "140" ||
  235. cptop1 == "141" ||
  236. cptop1 == "142" ||
  237. cptop1 == "143" ||
  238. cptop1 == "145"
  239. ) {
  240. state = true;
  241. } else {
  242. this.$message({
  243. type: "warning",
  244. message: "车皮号格式不对,请重新输入!",
  245. });
  246. }
  247. if (state) {
  248. if (this.input.length == 7) {
  249. this.list.push(this.input);
  250. this.input = "";
  251. } else {
  252. this.$message({
  253. type: "warning",
  254. message: "车皮号长度不足7位数,请重新输入!",
  255. });
  256. }
  257. }
  258. },
  259. onclick(index) {
  260. this.list.splice(index, 1);
  261. },
  262. // 确定
  263. makeSure() {
  264. let state = 0;
  265. if (
  266. this.list.length > 0 &&
  267. this.materialId &&
  268. this.supplierId &&
  269. this.unloadPointId &&
  270. this.purchaseOrderId &&
  271. this.form1.sendStationId &&
  272. this.form1.arrivalStationId &&
  273. this.form1.resultLoadingDate
  274. ) {
  275. state = 1;
  276. } else {
  277. console.log(this.list.length);
  278. if (this.list.length == 0) {
  279. this.$message({
  280. type: "warning",
  281. message: "请输入车皮号!",
  282. });
  283. } else {
  284. if (this.materialId) {
  285. if (this.supplierId) {
  286. if (this.unloadPointId) {
  287. if (this.purchaseOrderId) {
  288. if (this.form1.sendStationId) {
  289. if (this.form1.arrivalStationId) {
  290. if (this.form1.resultLoadingDate) {
  291. } else {
  292. this.$message({
  293. type: "warning",
  294. message: "请选择装车时间!",
  295. });
  296. }
  297. } else {
  298. this.$message({
  299. type: "warning",
  300. message: "请选择到站!",
  301. });
  302. }
  303. } else {
  304. this.$message({
  305. type: "warning",
  306. message: "请选择发站!",
  307. });
  308. }
  309. } else {
  310. this.$message({
  311. type: "warning",
  312. message: "该物资没有采购订单号!",
  313. });
  314. }
  315. } else {
  316. this.$message({
  317. type: "warning",
  318. message: "请选择卸货地点!",
  319. });
  320. }
  321. } else {
  322. this.$message({
  323. type: "warning",
  324. message: "请选择发货单位!",
  325. });
  326. }
  327. } else {
  328. this.$message({
  329. type: "warning",
  330. message: "请选择物资!",
  331. });
  332. }
  333. }
  334. }
  335. if(state == 1){
  336. let map = {
  337. wagonNoList:this.list,
  338. unloadingPointId:this.unloadPointId,
  339. purchaseOrderRailPlanId:this.purchaseOrderId,
  340. materialId:this.materialId,
  341. sendUnitId:this.supplierId,
  342. resultIsclear:this.form1.resultIsclear,
  343. resultClass: this.form1.resultClass,
  344. sendStationId: this.form1.sendStationId,
  345. arrivalStationId: this.form1.arrivalStationId,
  346. resultLoadingDate: sjTime(this.form1.resultLoadingDate),
  347. resultRemarks: this.form1.resultRemarks,
  348. resultType:2,
  349. }
  350. this.axios.post('/api/v1/tms/insertTmstrainLoadingResult',map).then((res)=>{
  351. console.log(res);
  352. if(res.data.code == "200"){
  353. this.$message({
  354. type: "success",
  355. message: "新增成功",
  356. });
  357. this.$router.go(-1);
  358. }
  359. })
  360. }
  361. },
  362. // 取消
  363. cancel() {
  364. this.$router.go(-1);
  365. },
  366. },
  367. };
  368. </script>
  369. <style lang='scss'>
  370. .addWagonLoad {
  371. color: #606266;
  372. font-size: 0.675rem;
  373. font-weight: 500;
  374. .cp {
  375. width: 49%;
  376. display: flex;
  377. justify-content: center;
  378. align-items: center;
  379. padding-top: 0.625rem;
  380. padding-bottom: 0.625rem;
  381. margin-left: 364px;
  382. .cp_title {
  383. .cp_top {
  384. width: 3.125rem;
  385. padding-right: 1.55rem;
  386. }
  387. }
  388. }
  389. .cpList {
  390. display: flex;
  391. justify-content: center;
  392. width: 100%;
  393. height: 10rem;
  394. .list {
  395. width: 45%;
  396. border: #000 0.0625rem solid;
  397. padding: 0.625rem;
  398. display: flex;
  399. flex-wrap: wrap;
  400. .cpList1 {
  401. background-color: #c9c7c7;
  402. height: 1.875rem;
  403. margin-right: 0.5rem;
  404. padding: 0.625rem;
  405. display: flex;
  406. align-items: center;
  407. justify-content: center;
  408. position: relative;
  409. .itu {
  410. position: absolute;
  411. top: -0.125rem;
  412. right: 0.0625rem;
  413. width: 0.625rem;
  414. height: 0.625rem;
  415. }
  416. }
  417. }
  418. }
  419. .matching {
  420. width: 100%;
  421. height: 3.125rem;
  422. display: flex;
  423. justify-content: center;
  424. align-items: center;
  425. .text {
  426. width: 8.75rem;
  427. }
  428. .span {
  429. display: inline-block;
  430. width: 310px;
  431. height: 0.0625rem;
  432. }
  433. }
  434. .material {
  435. display: flex;
  436. justify-content: center;
  437. align-items: center;
  438. height: 3.75rem;
  439. margin-left: 27rem;
  440. width: 20rem;
  441. .text {
  442. text-align: right;
  443. width: 8.125rem;
  444. }
  445. }
  446. .forwardingUnit {
  447. display: flex;
  448. justify-content: center;
  449. align-items: center;
  450. height: 3.75rem;
  451. margin-left: 27rem;
  452. width: 20rem;
  453. .text {
  454. text-align: right;
  455. width: 8.125rem;
  456. }
  457. }
  458. .remark {
  459. display: flex;
  460. justify-content: center;
  461. align-items: center;
  462. height: 3.75rem;
  463. .text {
  464. text-align: right;
  465. width: 5.625rem;
  466. }
  467. .span {
  468. display: inline-block;
  469. width: 1.875rem;
  470. height: 1.25rem;
  471. }
  472. .el-input{
  473. width: 13.5rem;
  474. margin-right: 2.375rem;
  475. }
  476. }
  477. .purchaseOrder {
  478. display: flex;
  479. justify-content: center;
  480. align-items: center;
  481. .span {
  482. display: inline-block;
  483. width: 1.875rem;
  484. height: 0.0625rem;
  485. }
  486. }
  487. .form {
  488. display: flex;
  489. .form_box {
  490. width: 340px;
  491. margin-left: 37%;
  492. margin-right: 20px;
  493. .el-form {
  494. .preview-group {
  495. .el-form-item {
  496. .el-form-item__label {
  497. display: inline-block;
  498. width: 70px !important;
  499. }
  500. .el-form-item__content {
  501. .el-select {
  502. width: 250px;
  503. }
  504. .el-input {
  505. width: 250px;
  506. }
  507. .el-textarea{
  508. .el-textarea__inner{
  509. width: 220px;
  510. margin-left: 65px;
  511. margin-top: 0.03rem;
  512. }
  513. }
  514. }
  515. }
  516. }
  517. }
  518. }
  519. }
  520. .button-box {
  521. display: flex;
  522. justify-content: center;
  523. padding-top: 30px;
  524. }
  525. }
  526. </style>