addRequirement.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  1. <template>
  2. <!-- 新增运输作业页面 -->
  3. <div class="addPurRequirement">
  4. <page-title>运输预约</page-title>
  5. <div class="purchaseOrder from">
  6. <span class="text">卸货厂区:</span>
  7. <el-select v-model="purchaseOrgId" placeholder="请选择" @change="onchange()" ref="selectlb">
  8. <el-option
  9. v-for="item in purchaseOrgList"
  10. :key="item.value"
  11. :label="item.label"
  12. :value="item.value"
  13. >
  14. </el-option>
  15. </el-select>
  16. </div>
  17. <div class="material from">
  18. <span class="text">物资:</span>
  19. <el-input class="input" v-model="materialName" disabled> </el-input>
  20. <el-button type="primary" @click="ondrawer(1)">浏览</el-button>
  21. </div>
  22. <div class="forwardingUnit from">
  23. <span class="text">发货单位:</span>
  24. <el-input class="input" v-model="supplierName" disabled> </el-input>
  25. <el-button type="primary" @click="ondrawer(2)">浏览</el-button>
  26. </div>
  27. <div class="forwardingUnit from">
  28. <span class="text">卸货点:</span>
  29. <el-input class="input" v-model="unloadPointName" disabled> </el-input>
  30. <el-button type="primary" @click="ondrawer(4)">浏览</el-button>
  31. </div>
  32. <div class="purchaseOrderNo from">
  33. <span class="text">采购订单号:</span>
  34. <el-input class="input" v-model="purchaseOrderNo" disabled> </el-input>
  35. </div>
  36. <div class="carrier from">
  37. <el-form
  38. :inline="true"
  39. class="demo-form-inline"
  40. label-width="80px"
  41. >
  42. <el-form-item label="选择承运商:">
  43. <el-autocomplete
  44. class="inline-input"
  45. v-model="stateCarrier"
  46. :fetch-suggestions="querySearchCarrier"
  47. placeholder="请输入承运商名称"
  48. :trigger-on-focus="false"
  49. @select="handleSelectCarrier"
  50. >
  51. <template slot-scope="{ item }">
  52. <div class="name">{{ item.carrierName }}</div>
  53. </template>
  54. </el-autocomplete>
  55. </el-form-item>
  56. </el-form>
  57. </div>
  58. <!-- 模态窗口 -->
  59. <el-drawer :visible.sync="drawer" :direction="direction" size="40%">
  60. <div style="margin-bottom: 10px">
  61. <el-input
  62. placeholder="请输入内容"
  63. v-model="input"
  64. style="margin-top: 10px; margin-right: 10px; width: 250px"
  65. clearable
  66. ></el-input>
  67. <el-button type="primary" class="btn" @click="onclick(a)">
  68. <i class="el-icon-search"></i>查询
  69. </el-button>
  70. </div>
  71. <div v-show="a == 1">
  72. <dilTable
  73. v-bind.sync="frist"
  74. @radio-change="currentRadioChange1"
  75. ></dilTable>
  76. </div>
  77. <div v-show="a == 2">
  78. <dilTable
  79. v-bind.sync="secend"
  80. @radio-change="currentRadioChange2"
  81. ></dilTable>
  82. </div>
  83. <div v-show="a == 3">
  84. <dilTable
  85. v-bind.sync="third"
  86. @selection-change="currentRadioChange3"
  87. ></dilTable>
  88. </div>
  89. <div v-show="a == 4">
  90. <dilTable
  91. v-bind.sync="unloadPoint"
  92. @radio-change="currentRadioChange4"
  93. ></dilTable>
  94. </div>
  95. </el-drawer>
  96. <div class="button_box">
  97. <el-button @click="onClickCancel">返回</el-button>
  98. <el-button type="primary" @click="onClickConfirm" :disabled = "disabled">确认</el-button>
  99. </div>
  100. </div>
  101. </template>
  102. <script>
  103. import PageTitle from "@/components/Page/Title";
  104. import { sjTime, isNumber, isIntegerNumber } from "@/utils/sharedJsFile";
  105. import { getCookie } from "@/utils/util.js";
  106. export default {
  107. components: { PageTitle },
  108. data() {
  109. return {
  110. disabled:false,
  111. //船名
  112. remark: null,
  113. //车辆表格数据
  114. selectionList: [],
  115. stateCarrier:null,
  116. purchaseOrgId:null,
  117. // 表单
  118. form1: {},
  119. //采购订单号
  120. purchaseOrderNo:"",
  121. //采购订单id
  122. purchaseOrderId: "",
  123. //物资名称
  124. materialName: "",
  125. //发货单位名称
  126. supplierName: "",
  127. //发货单位id
  128. supplierId: null,
  129. carrierId:null,
  130. //物资id
  131. materialId: null,
  132. //是否需要打开模态窗口
  133. drawer: false,
  134. //卸货点id
  135. unloadPointId: "",
  136. //卸货点名称
  137. unloadPointName: "",
  138. a: 1,
  139. direction: "rtl",
  140. input: "",
  141. frist: {
  142. requestUrl: "/api/v1/uc/queryAPOMaterialByLike?apiId=244&startNum=050",
  143. selectionType: "radio",
  144. mapList1: [],
  145. },
  146. secend: {
  147. requestUrl:
  148. "/api/v1/uc/getSupplierMesByMaterialId?apiId=247&materialId=",
  149. selectionType: "radio",
  150. mapList2: [],
  151. },
  152. third: {
  153. requestUrl: "",
  154. selectionType: "select",
  155. mapList3: [],
  156. },
  157. unloadPoint: {
  158. requestUrl: "",
  159. selectionType: "radio",
  160. },
  161. purchaseOrgLable:null,
  162. purchaseOrgList : [
  163. {
  164. value:1,
  165. label:'一厂'
  166. },{
  167. value:2,
  168. label:'二厂'
  169. }
  170. ]
  171. };
  172. },
  173. watch: {
  174. drawer(val) {
  175. if (!val) {
  176. this.input = null;
  177. }
  178. },
  179. },
  180. created() {
  181. this.unloadPoint.requestUrl = "/api/v1/uc/getUnloadingMesByLike?apiId=374"
  182. },
  183. methods: {
  184. onClick(index) {
  185. this.selectionList.splice(index, 1);
  186. },
  187. onBlur() {
  188. this.getPurchaseOrderNo();
  189. },
  190. onchange(){
  191. this.getPurchaseOrderNo();
  192. console.log(this.purchaseOrgId)
  193. if(this.purchaseOrgId == 1) {
  194. this.purchaseOrgLable = "一厂"
  195. console.log(this.purchaseOrgLable)
  196. }else{
  197. this.purchaseOrgLable = "二厂"
  198. console.log(this.purchaseOrgLable)
  199. }
  200. },
  201. getPurchaseOrderNo() {
  202. let map = {
  203. materialId: this.materialId,
  204. supplierId: this.supplierId,
  205. purchaseOrgId:this.purchaseOrgId
  206. };
  207. if (this.remark) {
  208. map.remark = this.remark;
  209. }
  210. console.log(map);
  211. if (this.materialId && this.supplierId && this.purchaseOrgId) {
  212. this.axios.post("/api/v1/oms/selectNewOrderId", map).then((res) => {
  213. console.log(res);
  214. if (res.data.code == "200") {
  215. if (res.data.data == null) {
  216. this.$message({
  217. message: "没有匹配的采购订单号!",
  218. type: "warning",
  219. });
  220. this.purchaseOrderNo = null
  221. this.form1 = [];
  222. } else {
  223. console.log();
  224. console.log(res.data.data)
  225. this.remark = res.data.data.remark;
  226. this.purchaseOrderId = res.data.data.purchaseOrderId;
  227. this.purchaseOrderNo = res.data.data.purchaseOrderNo ;
  228. }
  229. } else {
  230. this.$message.error("请求失败");
  231. }
  232. });
  233. }
  234. },
  235. onclick(a) {
  236. if (a == 1) {
  237. this.frist.requestUrl =
  238. "/api/v1/uc/queryAPOMaterialByLike?apiId=244&startNum=050&index=" +
  239. this.input;
  240. } else if (a == 2) {
  241. this.secend.requestUrl =
  242. "/api/v1/uc/getSupplierMesByMaterialId?apiId=247&materialId=" +
  243. this.materialId +
  244. "&index=" +
  245. this.input;
  246. } else if (a == 4) {
  247. this.unloadPoint.requestUrl =
  248. "/api/v1/uc/getUnloadingMesByLike?apiId=374&index=" + this.input + "&i=" + new Date();
  249. }
  250. },
  251. ondrawer(num) {
  252. this.drawer = true;
  253. this.a = num;
  254. if (num == 2) {
  255. this.secend.requestUrl =
  256. "/api/v1/uc/getSupplierMesByMaterialId?apiId=247&materialId=" +
  257. this.materialId;
  258. }
  259. },
  260. //承运商弹出层
  261. handleSelectCarrier(item){
  262. this.carrierId = item.carrierId
  263. item.carrierName = this.stateCarrier
  264. },
  265. //以下是承运商边输边查搜索
  266. querySearchCarrier(queryString, cb) {
  267. this.axios.post('/api/v1/uc/getCarrierMesByLike?index='+queryString).then((res)=>{
  268. if(res.data.code == "200"){
  269. var restaurantsCarrier = res.data.data
  270. console.log(restaurantsCarrier,"restaurantsCarrier");
  271. var results = queryString ? restaurantsCarrier.filter(this.createFilterCarrier(queryString)) :restaurantsCarrier;
  272. // 调用 callback 返回建议列表的数据
  273. cb(results);
  274. }
  275. })
  276. },
  277. createFilterCarrier(queryString) {
  278. return (restaurantsCarrier) => {
  279. return (restaurantsCarrier.value.toLowerCase().indexOf(queryString.toLowerCase()) > -1);
  280. };
  281. },
  282. //以上是承运商边输边查搜索
  283. // 返回
  284. onClickCancel() {
  285. this.$router.push("/purInwardRequirement");
  286. },
  287. currentRadioChange1(selection) {
  288. this.materialName = selection.materialName;
  289. this.materialId = selection.materialId;
  290. this.getPurchaseOrderNo();
  291. },
  292. currentRadioChange2(selection) {
  293. this.supplierName = selection.supplierName;
  294. this.supplierId = selection.supplierId;
  295. this.getPurchaseOrderNo();
  296. },
  297. currentRadioChange4(selection) {
  298. this.unloadPointId = selection.warehouseId;
  299. this.unloadPointName = selection.warehouseName;
  300. },
  301. currentRadioChange3(selection) {
  302. this.selectionList = [];
  303. this.selectionList = selection;
  304. },
  305. // 确认
  306. onClickConfirm() {
  307. console.log(this.purchaseOrgLable,this.materialName,this.supplierName,this.purchaseOrderNo,this.unloadPointName,this.stateCarrier)
  308. debugger
  309. this.disabled = true
  310. var state = 0;
  311. if (
  312. this.materialId &&
  313. this.supplierId &&
  314. this.purchaseOrderId &&
  315. this.unloadPointId
  316. ) {
  317. state = 1;
  318. } else {
  319. if (!this.materialId) {
  320. this.$message({
  321. message: "请选择物资!",
  322. type: "warning",
  323. });
  324. this.disabled = false
  325. } else if (!this.supplierId) {
  326. this.$message({
  327. message: "请选择发货单位!",
  328. type: "warning",
  329. });
  330. this.disabled = false
  331. } else if (!this.purchaseOrderId) {
  332. this.$message({
  333. message: "没有匹配的采购订单号!",
  334. type: "warning",
  335. });
  336. this.disabled = false
  337. } else if (!this.unloadPointId) {
  338. this.$message({
  339. message: "请选择卸货地点!",
  340. type: "warning",
  341. });
  342. this.disabled = false
  343. }
  344. }
  345. if (state == 1) {
  346. let map = {
  347. materialId: this.materialId,
  348. purchaseOrderId: this.purchaseOrderId,
  349. unloadPointId: this.unloadPointId,
  350. carrierId:this.carrierId,
  351. userId:getCookie("orgCode")
  352. };
  353. console.log(map, map);
  354. this.axios.post("/api/v1/ams/addPurInwardRequirement", map).then((res) => {
  355. if (res.data.code == "200") {
  356. this.$message({
  357. message: "添加成功!",
  358. type: "success",
  359. });
  360. this.disabled = false
  361. this.onClickCancel()
  362. }
  363. });
  364. }
  365. },
  366. },
  367. };
  368. </script>
  369. <style lang="scss" scope>
  370. .addPurRequirement{
  371. .contractDetails {
  372. width: 100%;
  373. }
  374. .from {
  375. display: flex;
  376. align-items: center;
  377. justify-content: center;
  378. margin-top: 5px;
  379. margin-bottom: 20px;
  380. }
  381. .remark {
  382. display: flex;
  383. justify-content: center;
  384. .text {
  385. display: inline-block;
  386. width: 100px;
  387. text-align: right;
  388. }
  389. .input {
  390. width: 250px;
  391. margin-right: 20px;
  392. }
  393. }
  394. .lineId {
  395. display: flex;
  396. justify-content: center;
  397. .text {
  398. display: inline-block;
  399. width: 170px;
  400. text-align: right;
  401. }
  402. .input {
  403. width: 250px;
  404. margin-right: 20px;
  405. }
  406. }
  407. .material {
  408. display: flex;
  409. justify-content: center;
  410. margin-top: 20px;
  411. .text {
  412. display: inline-block;
  413. width: 170px;
  414. text-align: right;
  415. }
  416. .input {
  417. width: 250px;
  418. margin-right: 20px;
  419. }
  420. }
  421. .orderType {
  422. display: flex;
  423. justify-content: center;
  424. .text {
  425. display: inline-block;
  426. width: 110px;
  427. text-align: right;
  428. }
  429. .select {
  430. width: 250px;
  431. }
  432. .span {
  433. display: inline-block;
  434. width: 30px;
  435. height: 10px;
  436. }
  437. }
  438. .contractTitle {
  439. display: flex;
  440. justify-content: center;
  441. .el-form-item {
  442. display: flex;
  443. justify-content: center;
  444. .el-form-item__label {
  445. display: flex;
  446. align-items: center;
  447. }
  448. .el-input {
  449. width: 250px;
  450. }
  451. }
  452. }
  453. .forwardingUnit {
  454. display: flex;
  455. justify-content: center;
  456. .text {
  457. display: inline-block;
  458. width: 170px;
  459. text-align: right;
  460. }
  461. .input {
  462. width: 250px;
  463. margin-right: 20px;
  464. }
  465. }
  466. .purchaseOrderNo{
  467. display: flex;
  468. justify-content: center;
  469. .text{
  470. display: inline-block;
  471. width: 170px;
  472. text-align: right;
  473. }
  474. .input {
  475. width: 250px;
  476. margin-right: 90px;
  477. }
  478. }
  479. .carrier{
  480. display: flex;
  481. .el-autocomplete{
  482. width: 250px;
  483. }
  484. }
  485. .button_box {
  486. display: flex;
  487. justify-content: center;
  488. align-items: center;
  489. width: 100%;
  490. height: 100px;
  491. }
  492. }
  493. </style>