wagonLoadbu.vue 15 KB

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