addWagonLoad.vue 12 KB

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