addRequirement.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493
  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. this.disabled = true
  309. var state = 0;
  310. if (
  311. this.materialId &&
  312. this.supplierId &&
  313. this.purchaseOrderId &&
  314. this.unloadPointId
  315. ) {
  316. state = 1;
  317. } else {
  318. if (!this.materialId) {
  319. this.$message({
  320. message: "请选择物资!",
  321. type: "warning",
  322. });
  323. this.disabled = false
  324. } else if (!this.supplierId) {
  325. this.$message({
  326. message: "请选择发货单位!",
  327. type: "warning",
  328. });
  329. this.disabled = false
  330. } else if (!this.purchaseOrderId) {
  331. this.$message({
  332. message: "没有匹配的采购订单号!",
  333. type: "warning",
  334. });
  335. this.disabled = false
  336. } else if (!this.unloadPointId) {
  337. this.$message({
  338. message: "请选择卸货地点!",
  339. type: "warning",
  340. });
  341. this.disabled = false
  342. }
  343. }
  344. if (state == 1) {
  345. let map = {
  346. materialId: this.materialId,
  347. purchaseOrderId: this.purchaseOrderId,
  348. unloadPointId: this.unloadPointId,
  349. carrierId:this.carrierId,
  350. userId:getCookie("orgCode")
  351. };
  352. console.log(map, map);
  353. this.axios.post("/api/v1/ams/addPurInwardRequirement", map).then((res) => {
  354. if (res.data.code == "200") {
  355. this.$message({
  356. message: "添加成功!",
  357. type: "success",
  358. });
  359. this.disabled = false
  360. this.onClickCancel()
  361. }
  362. });
  363. }
  364. },
  365. },
  366. };
  367. </script>
  368. <style lang="scss" scope>
  369. .addPurRequirement{
  370. .contractDetails {
  371. width: 100%;
  372. }
  373. .from {
  374. display: flex;
  375. align-items: center;
  376. justify-content: center;
  377. margin-top: 5px;
  378. margin-bottom: 20px;
  379. }
  380. .remark {
  381. display: flex;
  382. justify-content: center;
  383. .text {
  384. display: inline-block;
  385. width: 100px;
  386. text-align: right;
  387. }
  388. .input {
  389. width: 250px;
  390. margin-right: 20px;
  391. }
  392. }
  393. .lineId {
  394. display: flex;
  395. justify-content: center;
  396. .text {
  397. display: inline-block;
  398. width: 170px;
  399. text-align: right;
  400. }
  401. .input {
  402. width: 250px;
  403. margin-right: 20px;
  404. }
  405. }
  406. .material {
  407. display: flex;
  408. justify-content: center;
  409. margin-top: 20px;
  410. .text {
  411. display: inline-block;
  412. width: 170px;
  413. text-align: right;
  414. }
  415. .input {
  416. width: 250px;
  417. margin-right: 20px;
  418. }
  419. }
  420. .orderType {
  421. display: flex;
  422. justify-content: center;
  423. .text {
  424. display: inline-block;
  425. width: 110px;
  426. text-align: right;
  427. }
  428. .select {
  429. width: 250px;
  430. }
  431. .span {
  432. display: inline-block;
  433. width: 30px;
  434. height: 10px;
  435. }
  436. }
  437. .contractTitle {
  438. display: flex;
  439. justify-content: center;
  440. .el-form-item {
  441. display: flex;
  442. justify-content: center;
  443. .el-form-item__label {
  444. display: flex;
  445. align-items: center;
  446. }
  447. .el-input {
  448. width: 250px;
  449. }
  450. }
  451. }
  452. .forwardingUnit {
  453. display: flex;
  454. justify-content: center;
  455. .text {
  456. display: inline-block;
  457. width: 170px;
  458. text-align: right;
  459. }
  460. .input {
  461. width: 250px;
  462. margin-right: 20px;
  463. }
  464. }
  465. .purchaseOrderNo{
  466. display: flex;
  467. justify-content: center;
  468. .text{
  469. display: inline-block;
  470. width: 170px;
  471. text-align: right;
  472. }
  473. .input {
  474. width: 250px;
  475. margin-right: 90px;
  476. }
  477. }
  478. .carrier{
  479. display: flex;
  480. .el-autocomplete{
  481. width: 250px;
  482. }
  483. }
  484. .button_box {
  485. display: flex;
  486. justify-content: center;
  487. align-items: center;
  488. width: 100%;
  489. height: 100px;
  490. }
  491. }
  492. </style>