addPurInwardOrder.vue 12 KB

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