wagonLoadAdd.vue 13 KB

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