addPurInwardOrderCon.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448
  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=3";
  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=3" +
  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=3";
  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. this.disabled = true;
  273. if (this.lineId == null) {
  274. if (this.orderType == 10 || this.orderType == 20) {
  275. this.$message.error("未选择路线");
  276. this.disabled = false;
  277. return;
  278. }
  279. } else if (this.selectionList.length == 0) {
  280. this.$message.error("未选择车辆");
  281. this.disabled = false;
  282. return;
  283. }
  284. this.axios
  285. .post("/api/v1/oms/addPurInwardOrder", {
  286. materialId: this.materialId,
  287. lineId: this.lineId,
  288. orderType: this.orderType,
  289. orderId: this.orderId,
  290. planId: this.$route.params.planId,
  291. mapList: this.selectionList,
  292. orgCode: getCookie("orgCode")
  293. })
  294. .then(res => {
  295. if (res.data.code == "200") {
  296. this.$message.success("派车成功");
  297. this.disabled = false;
  298. this.cancel();
  299. }
  300. });
  301. },
  302. //点击取消按钮的事件
  303. cancel() {
  304. this.$router.push("/purInwardTruckOrder");
  305. },
  306. //点击删除按钮删除当前点击的对象
  307. deleteRow(index) {
  308. this.selectionList.splice(index, 1);
  309. },
  310. //车辆模态框的确定事件
  311. AddTruckClick() {
  312. if (this.a == 2) {
  313. this.selectTruck.forEach(e => {
  314. this.selectionList.push({
  315. capacityId: e.capacityId,
  316. capacityNumber: e.capacityNumber
  317. });
  318. });
  319. this.truckDrawer = false;
  320. } else {
  321. this.lineDrawer = false;
  322. }
  323. },
  324. //车辆模态框框计算
  325. selectTruckClick() {
  326. if (getCookie("orgCode") == "chengyunshang") {
  327. this.truck.requestUrl =
  328. "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" +
  329. getCookie("userId") +
  330. "&index=" +
  331. this.truckText +
  332. "&i=" +
  333. new Date();
  334. } else {
  335. this.truck.requestUrl =
  336. "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" +
  337. null +
  338. "&index=" +
  339. this.truckText +
  340. "&i=" +
  341. new Date();
  342. }
  343. },
  344. //车辆表格
  345. currentRadioChange1(select) {
  346. this.selectTruck = [];
  347. this.selectTruck = select;
  348. },
  349. currentRadioChange2(selection) {
  350. this.lineId = selection.lineId;
  351. if (selection.lineName == null && selection.lineDesk == null) {
  352. this.lineName = "";
  353. } else {
  354. this.lineName = selection.lineName + " " + selection.lineDesk;
  355. this.lineId = selection.lineId;
  356. }
  357. },
  358. onClick(num) {
  359. this.a = num;
  360. if (num == 2) {
  361. if (getCookie("orgCode") == "chengyunshang") {
  362. this.truck.requestUrl =
  363. "/api/v1/uc/getAllCapacityByCarrierLike?apiId=429&carrierSsoId=" +
  364. getCookie("userId") +
  365. "&i=" +
  366. new Date();
  367. } else if (getCookie("orgCode") == "biemeierchejian") {
  368. this.truck.requestUrl =
  369. "/api/v1/uc/getAllCapacityByCarrierLike?apiId=429&carrierSsoId=929059510763524096" +
  370. "&con=" +
  371. "铁专线精煤" +
  372. "&i=" +
  373. new Date();
  374. } else {
  375. this.truck.requestUrl =
  376. "/api/v1/uc/getAllCapacityByCarrierLike?apiId=429&carrierSsoId=" +
  377. null +
  378. "&i=" +
  379. new Date();
  380. }
  381. this.truckDrawer = true;
  382. } else {
  383. this.lineDrawer = true;
  384. this.line.requestUrl =
  385. "/api/v1/rms/getAllLineDesk?apiId=249&lineType=3&i=" + new Date();
  386. }
  387. },
  388. //线路表格的框计算
  389. selectClick() {
  390. this.line.requestUrl =
  391. "/api/v1/rms/getAllLineDesk?apiId=249&lineType=3&con=" + this.lineText;
  392. }
  393. }
  394. };
  395. </script>
  396. <style lang="scss" scoped>
  397. .addSaleOrderSend {
  398. .from {
  399. margin-top: 20px;
  400. .line {
  401. display: flex;
  402. justify-content: center;
  403. align-items: center;
  404. .el-input {
  405. width: 250px;
  406. margin-left: 10px;
  407. margin-right: 10px;
  408. }
  409. }
  410. .vehicle {
  411. display: flex;
  412. justify-content: center;
  413. align-items: center;
  414. margin-top: 20px;
  415. .el-button {
  416. width: 250px;
  417. margin-left: 10px;
  418. margin-right: 10px;
  419. }
  420. .span {
  421. width: 70px;
  422. }
  423. }
  424. }
  425. .orderType {
  426. display: flex;
  427. justify-content: center;
  428. align-items: center;
  429. margin-top: 20px;
  430. margin-right: 130px;
  431. .el-select {
  432. padding-left: 10px;
  433. }
  434. }
  435. .tablecls {
  436. margin-top: 20px;
  437. }
  438. .button_box {
  439. display: flex;
  440. justify-content: center;
  441. margin: 20px;
  442. .el-button {
  443. width: 100px;
  444. margin-left: 20px;
  445. }
  446. }
  447. }
  448. </style>