addPurInwardOrderCon.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. <template>
  2. <div class="addSaleOrderSend">
  3. <page-title>新增运输订单派车</page-title>
  4. <!-- 零星订单表的数据 -->
  5. <div class="saleOrder">
  6. <dilTable v-bind.sync="option" @func="func"></dilTable>
  7. </div>
  8. <!-- 表单选择车辆-->
  9. <div class="from">
  10. <div class="line">
  11. <span class="text">线路</span>
  12. <el-input
  13. v-model="lineName"
  14. placeholder="请选择线路"
  15. disabled
  16. ></el-input>
  17. <el-button type="primary" @click="onClick(1)">浏览</el-button>
  18. </div>
  19. <div class="orderType">
  20. <span class="text">订单类型</span>
  21. <el-select v-model="orderType" placeholder="请选择">
  22. <el-option
  23. v-for="item in orderTypeList"
  24. :key="item.value"
  25. :label="item.label"
  26. :value="item.value"
  27. >
  28. </el-option>
  29. </el-select>
  30. </div>
  31. <div class="vehicle">
  32. <span class="text">车辆</span>
  33. <el-button type="primary" @click="onClick(2)">浏览</el-button>
  34. <span class="span"></span>
  35. </div>
  36. </div>
  37. <!-- 派车表格 -->
  38. <div class="selectionTable from">
  39. <el-table
  40. :data="selectionList"
  41. border
  42. style="width: 100%"
  43. highlight-current-row
  44. >
  45. <el-table-column type="index" label="序号" width="50">
  46. </el-table-column>
  47. <el-table-column
  48. v-for="(item, i) in tableTop"
  49. :key="i"
  50. :prop="item.prop"
  51. :label="item.label"
  52. :width="item.width"
  53. align="center"
  54. show-overflow-tooltip
  55. >
  56. </el-table-column>
  57. <!-- 操作列 -->
  58. <el-table-column fixed="right" label="操作" width="100">
  59. <template slot-scope="scope">
  60. <el-button
  61. @click="deleteRow(scope.$index)"
  62. type="text"
  63. icon="el-icon-close"
  64. size="big"
  65. ></el-button>
  66. </template>
  67. </el-table-column>
  68. </el-table>
  69. </div>
  70. <el-drawer
  71. :visible.sync="lineDrawer"
  72. :with-header="false"
  73. :destroy-on-close="true"
  74. direction="rtl"
  75. size="40%"
  76. :show-close="true"
  77. :wrapperClosable="false"
  78. close-on-press-escape
  79. >
  80. <el-input
  81. placeholder="请输入内容"
  82. v-model="lineText"
  83. style="margin-top: 10px; margin-left: 20px; width: 250px"
  84. clearable
  85. >
  86. </el-input>
  87. <el-button
  88. type="primary"
  89. class="btn"
  90. @click="selectClick"
  91. style="margin-left: 5px"
  92. >
  93. <i class="el-icon-search"></i>查询
  94. </el-button>
  95. <el-button
  96. type="primary"
  97. class="btn"
  98. @click="AddTruckClick"
  99. style="margin-left: 5px"
  100. >
  101. <i class="el-icon-check"></i>确定
  102. </el-button>
  103. <div class="tablecls">
  104. <!-- 查询所有的车辆 -->
  105. <dilTable
  106. v-bind.sync="line"
  107. @radio-change="currentRadioChange2"
  108. ></dilTable>
  109. </div>
  110. </el-drawer>
  111. <!-- 车辆模态框 -->
  112. <el-drawer
  113. :visible.sync="truckDrawer"
  114. :with-header="false"
  115. :destroy-on-close="true"
  116. direction="rtl"
  117. size="40%"
  118. :show-close="true"
  119. :wrapperClosable="false"
  120. close-on-press-escape
  121. >
  122. <el-input
  123. placeholder="请输入内容"
  124. v-model="truckText"
  125. style="margin-top: 10px; margin-left: 20px; width: 250px"
  126. clearable
  127. >
  128. </el-input>
  129. <el-button
  130. type="primary"
  131. class="btn"
  132. @click="selectTruckClick"
  133. style="margin-left: 5px"
  134. >
  135. <i class="el-icon-search"></i>查询
  136. </el-button>
  137. <el-button
  138. type="primary"
  139. class="btn"
  140. @click="AddTruckClick"
  141. style="margin-left: 5px"
  142. >
  143. <i class="el-icon-check"></i>确定
  144. </el-button>
  145. <div class="tablecls">
  146. <!-- 查询所有的车辆 -->
  147. <dilTable
  148. v-bind.sync="truck"
  149. :isHeigth="isHeigth"
  150. :shiyHeigth="shiyHeigth"
  151. :isKuang="isKuang"
  152. @selection-change="currentRadioChange1"
  153. ></dilTable>
  154. </div>
  155. </el-drawer>
  156. <div class="button_box">
  157. <el-button @click="cancel">取消</el-button>
  158. <el-button type="primary" @click="makeSure" :disabled="disabled"
  159. >确定</el-button
  160. >
  161. </div>
  162. </div>
  163. </template>
  164. <script>
  165. import PageTitle from "@/components/Page/Title";
  166. import { getCookie } from "@/utils/util.js";
  167. export default {
  168. components: { PageTitle },
  169. data() {
  170. return {
  171. shiyHeigth: 140,
  172. isHeigth: true,
  173. isKuang: false,
  174. planId: null,
  175. disabled: false,
  176. //线路名称
  177. lineId: null,
  178. lineName: null,
  179. lineText: null,
  180. materialId: null,
  181. lineDrawer: false,
  182. //线路的表格
  183. line: {
  184. requestUrl: "",
  185. selectionType: "radio"
  186. },
  187. //订单类型
  188. orderTypeList: [
  189. {
  190. value: 10,
  191. label: "采购内转(铁专线-新区)"
  192. },
  193. {
  194. value: 20,
  195. label: "采购内转(铁专线-老区)"
  196. },
  197. {
  198. value: 15,
  199. label: "拼装车皮进厂(老区专线-老区)"
  200. },
  201. {
  202. value: 16,
  203. label: "一焦化采购内转"
  204. },
  205. {
  206. value: 23,
  207. label: "厂外内转-老区"
  208. },
  209. {
  210. value: 24,
  211. label: "厂外内转-二厂"
  212. }
  213. ],
  214. orderType: null,
  215. //已经选择车辆物资信息
  216. selectionList: [],
  217. //销售订单物资信息
  218. option: {
  219. // 表格请求数据的地址
  220. requestUrl: "",
  221. // 控制显示当选列
  222. isPagination: false
  223. },
  224. //是否打开选择车辆的模态框
  225. truckDrawer: false,
  226. //车辆的表格
  227. truck: {
  228. requestUrl: "",
  229. selectionType: "select"
  230. },
  231. tableTop: [
  232. {
  233. prop: "capacityNumber",
  234. label: "车牌号"
  235. }
  236. ],
  237. truckText: null,
  238. //当前多选选中的车辆
  239. selectTruck: []
  240. };
  241. },
  242. created() {
  243. this.option.requestUrl =
  244. "/api/v1/ams/getPurRequirementList?apiId=431&requirementStatus=1&planStatus=3&planId=" +
  245. this.$route.params.planId;
  246. if (getCookie("orgCode") == "chengyunshang") {
  247. this.truck.requestUrl =
  248. "/api/v1/uc/getAllCapacityByCarrierLike?apiId=429&carrierSsoId=" +
  249. getCookie("userId");
  250. this.line.requestUrl = "/api/v1/rms/getAllLineDesk?apiId=249&lineType=1";
  251. } else if (getCookie("orgCode") == "biemeierchejian") {
  252. this.truck.requestUrl =
  253. "/api/v1/uc/getAllCapacityByCarrierLike?apiId=429&carrierSsoId=929059510763524096" +
  254. "&con=" +
  255. "铁专线精煤";
  256. this.line.requestUrl =
  257. "/api/v1/rms/getAllLineDesk?apiId=249&lineType=1" +
  258. "&con=" +
  259. "采购内转";
  260. } else {
  261. this.truck.requestUrl =
  262. "/api/v1/uc/getAllCapacityByCarrierLike?apiId=429&carrierSsoId=" + null;
  263. this.line.requestUrl = "/api/v1/rms/getAllLineDesk?apiId=249&lineType=1";
  264. }
  265. },
  266. methods: {
  267. func(res) {
  268. console.log(res.list[0].materialId);
  269. this.materialId = res.list[0].materialId;
  270. },
  271. makeSure() {
  272. console.log(typeof this.orderType);
  273. this.disabled = true;
  274. if (this.lineId == null) {
  275. if (
  276. this.orderType == 10 ||
  277. this.orderType == 20 ||
  278. this.orderType == 23 ||
  279. this.orderType == 24
  280. ) {
  281. this.$message.error("未选择路线");
  282. this.disabled = false;
  283. return;
  284. }
  285. }
  286. if (this.selectionList.length == 0) {
  287. this.$message.error("未选择车辆");
  288. this.disabled = false;
  289. return;
  290. }
  291. if (this.orderType == null || this.orderType == "null") {
  292. this.$message.error("请选择订单类型");
  293. this.disabled = false;
  294. return;
  295. }
  296. this.axios
  297. .post("/api/v1/oms/addPurInwardOrder", {
  298. materialId: this.materialId,
  299. lineId: this.lineId,
  300. orderType: this.orderType,
  301. orderId: this.orderId,
  302. planId: this.$route.params.planId,
  303. mapList: this.selectionList,
  304. orgCode: getCookie("orgCode")
  305. })
  306. .then(res => {
  307. if (res.data.code == "200") {
  308. this.$message.success("派车成功");
  309. this.disabled = false;
  310. this.cancel();
  311. }
  312. });
  313. },
  314. //点击取消按钮的事件
  315. cancel() {
  316. this.$router.push("/purInwardTruckOrder");
  317. },
  318. //点击删除按钮删除当前点击的对象
  319. deleteRow(index) {
  320. this.selectionList.splice(index, 1);
  321. },
  322. //车辆模态框的确定事件
  323. AddTruckClick() {
  324. if (this.a == 2) {
  325. this.selectTruck.forEach(e => {
  326. this.selectionList.push({
  327. capacityId: e.capacityId,
  328. capacityNumber: e.capacityNumber
  329. });
  330. });
  331. this.truckDrawer = false;
  332. } else {
  333. this.lineDrawer = false;
  334. }
  335. },
  336. //车辆模态框框计算
  337. selectTruckClick() {
  338. if (getCookie("orgCode") == "chengyunshang") {
  339. this.truck.requestUrl =
  340. "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" +
  341. getCookie("userId") +
  342. "&index=" +
  343. this.truckText +
  344. "&i=" +
  345. new Date();
  346. } else {
  347. this.truck.requestUrl =
  348. "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" +
  349. null +
  350. "&index=" +
  351. this.truckText +
  352. "&i=" +
  353. new Date();
  354. }
  355. },
  356. //车辆表格
  357. currentRadioChange1(select) {
  358. this.selectTruck = [];
  359. this.selectTruck = select;
  360. },
  361. currentRadioChange2(selection) {
  362. this.lineId = selection.lineId;
  363. if (selection.lineName == null && selection.lineDesk == null) {
  364. this.lineName = "";
  365. } else {
  366. this.lineName = selection.lineName + " " + selection.lineDesk;
  367. this.lineId = selection.lineId;
  368. }
  369. },
  370. onClick(num) {
  371. this.a = num;
  372. if (num == 2) {
  373. if (getCookie("orgCode") == "chengyunshang") {
  374. this.truck.requestUrl =
  375. "/api/v1/uc/getAllCapacityByCarrierLike?apiId=429&carrierSsoId=" +
  376. getCookie("userId") +
  377. "&i=" +
  378. new Date();
  379. } else if (getCookie("orgCode") == "biemeierchejian") {
  380. this.truck.requestUrl =
  381. "/api/v1/uc/getAllCapacityByCarrierLike?apiId=429&carrierSsoId=929059510763524096" +
  382. "&con=" +
  383. "铁专线精煤" +
  384. "&i=" +
  385. new Date();
  386. } else {
  387. this.truck.requestUrl =
  388. "/api/v1/uc/getAllCapacityByCarrierLike?apiId=429&carrierSsoId=" +
  389. null +
  390. "&i=" +
  391. new Date();
  392. }
  393. this.truckDrawer = true;
  394. } else {
  395. this.lineDrawer = true;
  396. this.line.requestUrl =
  397. "/api/v1/rms/getAllLineDesk?apiId=249&lineType=1&i=" + new Date();
  398. }
  399. },
  400. //线路表格的框计算
  401. selectClick() {
  402. this.line.requestUrl =
  403. "/api/v1/rms/getAllLineDesk?apiId=249&lineType=1&con=" + this.lineText;
  404. }
  405. }
  406. };
  407. </script>
  408. <style lang="scss" scoped>
  409. .addSaleOrderSend {
  410. .from {
  411. margin-top: 20px;
  412. .line {
  413. display: flex;
  414. justify-content: center;
  415. align-items: center;
  416. .el-input {
  417. width: 250px;
  418. margin-left: 10px;
  419. margin-right: 10px;
  420. }
  421. }
  422. .vehicle {
  423. display: flex;
  424. justify-content: center;
  425. align-items: center;
  426. margin-top: 20px;
  427. .el-button {
  428. width: 250px;
  429. margin-left: 10px;
  430. margin-right: 10px;
  431. }
  432. .span {
  433. width: 70px;
  434. }
  435. }
  436. }
  437. .orderType {
  438. display: flex;
  439. justify-content: center;
  440. align-items: center;
  441. margin-top: 20px;
  442. margin-right: 130px;
  443. .el-select {
  444. padding-left: 10px;
  445. }
  446. }
  447. .tablecls {
  448. margin-top: 20px;
  449. }
  450. .button_box {
  451. display: flex;
  452. justify-content: center;
  453. margin: 20px;
  454. .el-button {
  455. width: 100px;
  456. margin-left: 20px;
  457. }
  458. }
  459. }
  460. </style>