addSaleOrderSteelSendCarrier.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818
  1. <template>
  2. <div class="addSaleOrderSend">
  3. <page-title>新增销售订单钢材派车</page-title>
  4. <!-- 派车表格 -->
  5. <div class="selectionTable from">
  6. <el-table
  7. :data="selectionList"
  8. border
  9. style="width: 100%"
  10. highlight-current-row
  11. :span-method="cellMerge"
  12. >
  13. <el-table-column
  14. v-for="(item, i) in tableTop"
  15. :key="i"
  16. :prop="item.prop"
  17. :label="item.label"
  18. :width="item.width"
  19. align="center"
  20. show-overflow-tooltip
  21. >
  22. <template slot="scope" v-if="item.label !== '车牌号'">
  23. <span>{{ item.label }}</span>
  24. </template>
  25. <template slot="scope" v-if="item.label !== '承运商'">
  26. <span>{{ item.label }}</span>
  27. </template>
  28. <template slot="scope" v-if="item.label !== '件数'">
  29. <span>{{ item.label }}</span>
  30. </template>
  31. <template slot="scope" v-if="item.label !== '运输线路'">
  32. <span>{{ item.label }}</span>
  33. </template>
  34. <template slot="scope" v-if="item.label !== '运输单价'">
  35. <span>{{ item.label }}</span>
  36. </template>
  37. <template slot="scope" v-if="item.label !== '订单有效期'">
  38. <span>{{ item.label }}</span>
  39. </template>
  40. <template slot="scope" v-if="item.label !== '收货客户'">
  41. <span>{{ item.label }}</span>
  42. </template>
  43. <template slot="scope" v-if="item.label !== '收货客户电话号码'">
  44. <span>{{ item.label }}</span>
  45. </template>
  46. <template slot="scope" v-if="item.label !== '备注'">
  47. <span>{{ item.label }}</span>
  48. </template>
  49. <!-- 插入输入框 -->
  50. <template slot-scope="scope">
  51. <template v-if="item.slot">
  52. <!-- 车牌号 -->
  53. <template v-if="item.prop == 'capacityNumber'">
  54. <el-autocomplete
  55. class="inline-input"
  56. v-model="scope.row.capacityNumber"
  57. :fetch-suggestions="querySearch"
  58. placeholder="(必填)"
  59. :trigger-on-focus="false"
  60. @select="handleSelect(scope.row, scope.$index)"
  61. @blur="checkRelationship(scope.$index)"
  62. @change="batchUpdateValue(scope.row, scope.$index)"
  63. ></el-autocomplete>
  64. </template>
  65. <!-- 司机电话号码 -->
  66. <template v-if="item.prop == 'driverTel'">
  67. <el-input
  68. class="textinput"
  69. placeholder="(必填)"
  70. @blur="checkIsTelephone(scope.$index)"
  71. v-model="scope.row.driverTel"
  72. ></el-input>
  73. </template>
  74. <!-- 承运商 -->
  75. <template v-if="item.prop == 'carrierName'">
  76. <el-select
  77. v-model="scope.row.carrierName"
  78. placeholder="请选择"
  79. @change="batchUpdateValue(scope.row, scope.$index)"
  80. disabled
  81. >
  82. <el-option
  83. v-for="item in carrierNameOptions[scope.$index]"
  84. :key="item.value"
  85. :label="item.label"
  86. :value="item.value"
  87. >
  88. </el-option>
  89. </el-select>
  90. </template>
  91. <!-- 物资件数 -->
  92. <template v-if="item.prop == 'orderPlanWeight'">
  93. <el-input
  94. class="textinput"
  95. @input="onInput"
  96. placeholder="(必填)"
  97. v-model.number="scope.row.orderPlanWeight"
  98. disabled
  99. ></el-input>
  100. </template>
  101. <!-- 物资重量 -->
  102. <template v-if="item.prop == 'materialWeight'">
  103. <el-input
  104. class="textinput"
  105. v-model.number="scope.row.materialWeight"
  106. disabled
  107. ></el-input>
  108. </template>
  109. <!-- 运输单价id -->
  110. <template v-if="item.prop == 'priceValue'">
  111. <el-input v-model="scope.row.priceValue" disabled> </el-input>
  112. </template>
  113. <!-- 订单有效期 -->
  114. <template v-if="item.prop == 'saleDateOfReceipt'">
  115. <el-date-picker
  116. class="textinput3"
  117. type="date"
  118. v-model.number="scope.row.saleDateOfReceipt"
  119. style="width:135px"
  120. disabled
  121. ></el-date-picker>
  122. </template>
  123. <!-- 收货客户 -->
  124. <template v-if="item.prop == 'saleOrderConsignee'">
  125. <el-input
  126. class="textinput4"
  127. placeholder="(非必填)"
  128. v-model.number="scope.row.saleOrderConsignee"
  129. disabled
  130. ></el-input>
  131. </template>
  132. <!-- 收货客户电话号码 -->
  133. <template v-if="item.prop == 'saleOrderConsigneeTel'">
  134. <el-input
  135. class="textinput5"
  136. placeholder="(非必填)"
  137. v-model.number="scope.row.saleOrderConsigneeTel"
  138. @input="onInput"
  139. disabled
  140. ></el-input>
  141. </template>
  142. </template>
  143. <template v-else>
  144. <span>{{ scope.row[item.prop] }}</span>
  145. </template>
  146. </template>
  147. </el-table-column>
  148. <!-- 操作列 -->
  149. <!-- <el-table-column fixed="right" label="操作" width="100">
  150. </el-table-column> -->
  151. </el-table>
  152. </div>
  153. <div class="button_box">
  154. <el-button @click="cancel">取消</el-button>
  155. <el-button type="primary" @click="makeSure" :loading="isLoading"
  156. >确定</el-button
  157. >
  158. </div>
  159. </div>
  160. </template>
  161. <script>
  162. import PageTitle from "@/components/Page/Title";
  163. import { getCookie } from "@/utils/util.js";
  164. import { isNumber } from "@/utils/sharedJsFile";
  165. export default {
  166. components: { PageTitle },
  167. data() {
  168. return {
  169. //是否正在加载
  170. isLoading: false,
  171. //存放每一行记录的合并数
  172. spanArr: [],
  173. //pos是spanArr的索引
  174. pos: 0,
  175. //加载
  176. selectLineLoading: false,
  177. //承运商下拉框中的值
  178. carrierNameOptions: [],
  179. //当前车序号物资
  180. selectionList: [],
  181. driverTel1: null,
  182. //是否可发送请求
  183. canSend: 1,
  184. statusStr: null,
  185. tableTop: [
  186. {
  187. prop: "truckNo",
  188. label: "车序号",
  189. width: "50"
  190. },
  191. {
  192. prop: "capacityNumber",
  193. label: "车牌号",
  194. width: "130",
  195. slot: true
  196. },
  197. {
  198. prop: "driverTel",
  199. label: "司机电话号码",
  200. width: "150",
  201. slot: true
  202. },
  203. {
  204. prop: "carrierName",
  205. label: "承运商",
  206. width: "240",
  207. slot: true
  208. },
  209. {
  210. prop: "materialName",
  211. label: "物资名称",
  212. width: "140"
  213. },
  214. {
  215. prop: "Specification",
  216. label: "规格型号",
  217. width: "140"
  218. },
  219. {
  220. prop: "orderPlanWeight",
  221. label: "件数",
  222. width: "80",
  223. slot: true
  224. },
  225. {
  226. prop: "materialWeight",
  227. label: "重量",
  228. width: "80",
  229. slot: true
  230. },
  231. {
  232. prop: "lineName",
  233. label: "厂内运输线路",
  234. width: "220"
  235. },
  236. {
  237. prop: "saleDateOfReceipt",
  238. label: "订单有效期",
  239. width: "150",
  240. slot: true
  241. },
  242. {
  243. prop: "saleShipperAddressName",
  244. label: "收货地址",
  245. width: "300"
  246. },
  247. {
  248. prop: "priceValue",
  249. label: "运输单价",
  250. width: "80",
  251. slot: true
  252. },
  253. {
  254. prop: "saleOrderConsignee",
  255. label: "收货客户",
  256. width: "150",
  257. slot: true
  258. },
  259. {
  260. prop: "saleOrderConsigneeTel",
  261. label: "收货客户电话号码",
  262. slot: true,
  263. width: "150"
  264. },
  265. {
  266. prop: "materialCode",
  267. label: "物资编码",
  268. width: "140"
  269. },
  270. {
  271. prop: "truckRemark",
  272. label: "备注",
  273. width: "140"
  274. }
  275. ]
  276. };
  277. },
  278. created() {
  279. this.getValue();
  280. },
  281. methods: {
  282. getValue() {
  283. let map = {};
  284. if (getCookie("orgCode") == "chengyunshang") {
  285. map.saleOrderId = this.$route.params.saleOrderId;
  286. map.carrierSsoId = getCookie("userId");
  287. } else {
  288. map.saleOrderId = this.$route.params.saleOrderId;
  289. }
  290. this.axios
  291. .post("/api/v1/ams/getCarrierTruckNoAndMaterialList", map)
  292. .then(res => {
  293. if (res.data.data.length == 0) {
  294. this.$confirm("该销售订单尚未排车!是否先进行排车?", "提示", {
  295. confirmButtonText: "确定",
  296. cancelButtonText: "取消",
  297. type: "warning",
  298. center: true
  299. })
  300. .then(() => {
  301. this.$router.push(
  302. "/addSaleOrderArrange/" + this.$route.params.saleOrderId
  303. );
  304. })
  305. .catch(() => {
  306. this.$message({ type: "info", message: "取消!" });
  307. });
  308. }
  309. console.log("res.data.data", res.data.data);
  310. this.statusStr = res.data.data[0].statusStr;
  311. //赋值派车表格
  312. res.data.data.forEach((e, i) => {
  313. if (e.saleOrderConsignee == "null") {
  314. e.saleOrderConsignee = null;
  315. }
  316. if (e.saleOrderConsigneeTel == "null") {
  317. e.saleOrderConsigneeTel = null;
  318. }
  319. //带承运商初始化派车表格
  320. var addmap = {
  321. truckNo: e.truckNo,
  322. saleOrderMaterialId: e.saleOrderMaterialId,
  323. capacityNumber: null,
  324. driverTel: null,
  325. carrierName: e.carrierName,
  326. carrierId: e.carrierId,
  327. materialId: e.materialId,
  328. materialName: e.materialName,
  329. Specification: e.materialModelSpecification,
  330. materialCode: e.materialCode,
  331. orderPlanWeight: e.materialNumber,
  332. materialWeight: e.materialWeight,
  333. lineName: null,
  334. lineId: null,
  335. saleShipperAddressId: e.placeId,
  336. saleShipperAddressName: e.place,
  337. saleDateOfReceipt: e.receiptDate,
  338. saleOrderConsignee: e.saleOrderConsignee,
  339. saleOrderConsigneeTel: e.saleOrderConsigneeTel,
  340. truckRemark: e.truckRemark
  341. };
  342. this.selectionList.push(addmap);
  343. //调用记录每一行的合并数的方法
  344. this.getSpanArr(this.selectionList);
  345. //初始化每个车的线路
  346. this.initializeLine();
  347. });
  348. });
  349. },
  350. onInput(val) {
  351. if (!isNumber(val)) {
  352. this.$message.warning("重量/电话号码请输入数字");
  353. }
  354. },
  355. //校验是否为车牌
  356. isVehicleNumber(vehicleNumber) {
  357. var result = false;
  358. if (vehicleNumber != null) {
  359. if (vehicleNumber.length == 7) {
  360. var express = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/;
  361. result = express.test(vehicleNumber);
  362. }
  363. }
  364. return result;
  365. },
  366. //绑定车牌号和承运商的关系
  367. bindRelationship(mapValue) {
  368. let RmsCapacity = {
  369. capacityTypeId: 1,
  370. capacityNumber: mapValue.capacityNumber,
  371. capacityCorlor: "黄",
  372. capacityOwneris: "否",
  373. capacityVip: "否",
  374. capacityBlacklist: "否",
  375. remark: null,
  376. carrierId: mapValue.carrierId,
  377. state: mapValue.carrierName
  378. };
  379. this.$confirm(
  380. "车牌号(" +
  381. mapValue.capacityNumber +
  382. ")与承运商未有绑定关系, 是否立即绑定该车牌号和承运商?",
  383. "提示",
  384. {
  385. confirmButtonText: "确定",
  386. cancelButtonText: "取消",
  387. type: "warning"
  388. }
  389. )
  390. .then(() => {
  391. this.axios
  392. .post("/api/v1/rms/insertCapacity", RmsCapacity)
  393. .then(res => {
  394. console.log("res", res);
  395. if (res.data.data == 0) {
  396. this.$message.success("该车牌号与承运商绑定关系成功!");
  397. }
  398. });
  399. })
  400. .catch(() => {
  401. this.$message({ type: "info", message: "已取消删除" });
  402. });
  403. },
  404. //失焦事件后确定车牌号与承运商是否有绑定关系
  405. checkRelationship(index) {
  406. if (this.selectionList[index].carrierId != null) {
  407. //暂存车牌号
  408. var capacityNumber1;
  409. if (this.isVehicleNumber(this.selectionList[index].capacityNumber)) {
  410. let mapValue = {
  411. capacityNumber: this.selectionList[index].capacityNumber,
  412. carrierId: this.selectionList[index].carrierId,
  413. carrierName: this.selectionList[index].carrierName
  414. };
  415. this.axios
  416. .post("/api/v1/uc/isInCapacityCarrier", mapValue)
  417. .then(res => {
  418. if (res.data.code == "201") {
  419. capacityNumber1 = res.data.data;
  420. if (capacityNumber1 == null) {
  421. this.selectionList[index].capacityNumber = null;
  422. this.$message.error("该车牌号未注册,请先前往注册!");
  423. } else {
  424. this.bindRelationship(mapValue);
  425. }
  426. }
  427. });
  428. }
  429. }
  430. },
  431. //车牌号弹出层
  432. handleSelect(row, index) {
  433. this.axios
  434. .post(
  435. "/api/v1/ams/matchingDriverTelRecently?capacityNumber=" +
  436. row.capacityNumber
  437. )
  438. .then(res => {
  439. row.driverTel = res.data.data;
  440. });
  441. },
  442. //以下是车牌号边输边查搜索
  443. querySearch(queryString, cb) {
  444. this.axios
  445. .post("/api/v1/uc/getCapacityByLike?index=" + queryString)
  446. .then(res => {
  447. if (res.data.code == "200") {
  448. var restaurants = res.data.data;
  449. var results = queryString
  450. ? restaurants.filter(this.createFilter(queryString))
  451. : restaurants;
  452. // 调用 callback 返回建议列表的数据
  453. cb(results);
  454. }
  455. });
  456. },
  457. createFilter(queryString) {
  458. return restaurants => {
  459. return (
  460. restaurants.value.toLowerCase().indexOf(queryString.toLowerCase()) >
  461. -1
  462. );
  463. };
  464. },
  465. //以上是车牌号边输边查搜索
  466. //校验是否为电话号码
  467. checkIsTelephone(index) {
  468. //电话号码校验
  469. console.log("电话号码"+this.selectionList[index].driverTel);
  470. var reg = /^[1][3456789]\d{9}$/;
  471. if (!reg.test(this.selectionList[index].driverTel)) {
  472. this.canSend = -1;
  473. this.$message.warning("电话号码格式不正确,请输入正确的电话号码!");
  474. } else {
  475. this.canSend = 1;
  476. }
  477. },
  478. //点击确定按钮的事件
  479. makeSure() {
  480. this.isLoading = true;
  481. //是否可发送请求
  482. if (this.canSend == -1) {
  483. this.$message.warning("电话号码格式不正确,请输入正确的电话号码!");
  484. } else {
  485. this.$confirm("是否确定进行钢材派单!", "提示", {
  486. confirmButtonText: "确定",
  487. cancelButtonText: "取消",
  488. type: "warning",
  489. center: true
  490. })
  491. .then(() => {
  492. var mapList = [];
  493. for (var i = 0; i < this.spanArr.length; i++) {
  494. if (this.spanArr[i] > 0 && this.selectionList[i].capacityNumber) {
  495. var mapItem = {
  496. //车牌号
  497. capacityNumber: null,
  498. //司机电话号码
  499. driverTel: null,
  500. //车序号主键
  501. saleOrderMaterialId: 0,
  502. //承运商Id
  503. carrierId: 0,
  504. //线路Id
  505. lineId: 0
  506. };
  507. mapItem.capacityNumber = this.selectionList[i].capacityNumber;
  508. mapItem.driverTel = this.selectionList[i].driverTel;
  509. mapItem.saleOrderMaterialId = this.selectionList[
  510. i
  511. ].saleOrderMaterialId;
  512. mapItem.carrierId = this.selectionList[i].carrierId;
  513. mapItem.lineId = this.selectionList[i].lineId;
  514. mapList.push(mapItem);
  515. }
  516. }
  517. this.axios
  518. .post("/api/v1/ams/dispatchSteelOrder", mapList)
  519. .then(res => {
  520. if (res.data.code == "200") {
  521. this.cancel();
  522. this.$message.success("派单成功!");
  523. this.isLoading = false;
  524. } else {
  525. this.$message.error("派单失败:" + res.data.data);
  526. this.isLoading = false;
  527. }
  528. this.isLoading = false;
  529. });
  530. })
  531. .catch(() => {
  532. this.$message({ type: "info", message: "取消!" });
  533. this.isLoading = false;
  534. });
  535. }
  536. },
  537. //点击取消按钮的事件
  538. cancel() {
  539. this.$router.push("/saleOrderSteelCarrier");
  540. },
  541. //批量修改内层值
  542. batchUpdateValue(row, index) {
  543. for (var i = index; i < this.spanArr[index] + index; i++) {
  544. this.selectionList[i].capacityNumber = row.capacityNumber;
  545. this.selectionList[i].driverTel = this.driverTel1;
  546. }
  547. },
  548. //初始化线路
  549. initializeLine() {
  550. for (var i = 0; i < this.spanArr.length; i++) {
  551. if (this.spanArr[i] == 1) {
  552. for (var j = i; j < this.spanArr[i] + i; j++) {
  553. this.selectionList[j].lineName =
  554. "总厂:销售钢材单拼路线" + " " + "进厂-计皮-装货-计毛-出厂";
  555. this.selectionList[j].lineId = 110001;
  556. }
  557. }
  558. if (this.spanArr[i] == 2) {
  559. for (var j = i; j < this.spanArr[i] + i; j++) {
  560. this.selectionList[j].lineName =
  561. "总厂:销售钢材二拼路线" +
  562. " " +
  563. "计皮-进厂-装货-计毛-计皮-装货-计毛-出厂";
  564. this.selectionList[j].lineId = 110002;
  565. }
  566. }
  567. if (this.spanArr[i] == 3) {
  568. for (var j = i; j < this.spanArr[i] + i; j++) {
  569. this.selectionList[j].lineName =
  570. "总厂:销售钢材三拼路线" +
  571. " " +
  572. "进厂-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-出厂";
  573. this.selectionList[j].lineId = 110003;
  574. }
  575. }
  576. if (this.spanArr[i] == 4) {
  577. for (var j = i; j < this.spanArr[i] + i; j++) {
  578. this.selectionList[j].lineName =
  579. "总厂:销售钢材四拼路线" +
  580. " " +
  581. "进厂-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-出厂";
  582. this.selectionList[j].lineId = 110004;
  583. }
  584. }
  585. if (this.spanArr[i] == 5) {
  586. for (var j = i; j < this.spanArr[i] + i; j++) {
  587. this.selectionList[j].lineName =
  588. "总厂:销售钢材五拼路线" +
  589. " " +
  590. "进厂-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-出厂";
  591. this.selectionList[j].lineId = 110005;
  592. }
  593. }
  594. if (this.spanArr[i] == 6) {
  595. for (var j = i; j < this.spanArr[i] + i; j++) {
  596. this.selectionList[j].lineName =
  597. "总厂:销售钢材六拼路线" +
  598. " " +
  599. "进厂-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-出厂";
  600. this.selectionList[j].lineId = 110006;
  601. }
  602. }
  603. if (this.spanArr[i] == 7) {
  604. for (var j = i; j < this.spanArr[i] + i; j++) {
  605. this.selectionList[j].lineName =
  606. "总厂:销售钢材七拼路线" +
  607. " " +
  608. "进厂-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-出厂";
  609. this.selectionList[j].lineId = 110007;
  610. }
  611. }
  612. if (this.spanArr[i] == 8) {
  613. for (var j = i; j < this.spanArr[i] + i; j++) {
  614. this.selectionList[j].lineName =
  615. "总厂:销售钢材八拼路线" +
  616. " " +
  617. "进厂-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-出厂";
  618. this.selectionList[j].lineId = 110008;
  619. }
  620. }
  621. if (this.spanArr[i] == 9) {
  622. for (var j = i; j < this.spanArr[i] + i; j++) {
  623. this.selectionList[j].lineName =
  624. "总厂:销售钢材九拼路线" +
  625. " " +
  626. "进厂-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-出厂";
  627. this.selectionList[j].lineId = 110009;
  628. }
  629. }
  630. if (this.spanArr[i] == 10) {
  631. for (var j = i; j < this.spanArr[i] + i; j++) {
  632. this.selectionList[j].lineName =
  633. "总厂:销售钢材十拼路线" +
  634. " " +
  635. "进厂-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-计皮-装货-计毛-出厂";
  636. this.selectionList[j].lineId = 110010;
  637. }
  638. }
  639. }
  640. },
  641. //记录每一行的合并数
  642. getSpanArr(data) {
  643. //每次调用方法初始化
  644. this.spanArr = [];
  645. for (var i = 0; i < data.length; i++) {
  646. if (i === 0) {
  647. this.spanArr.push(1);
  648. this.pos = 0;
  649. } else {
  650. // 判断当前元素与上一个元素是否相同
  651. if (data[i].truckNo === data[i - 1].truckNo) {
  652. this.spanArr[this.pos] += 1;
  653. this.spanArr.push(0);
  654. } else {
  655. this.spanArr.push(1);
  656. this.pos = i;
  657. }
  658. }
  659. }
  660. },
  661. //根据条件合并行
  662. cellMerge({ row, column, rowIndex, columnIndex }) {
  663. if (columnIndex === 0) {
  664. const _row = this.spanArr[rowIndex];
  665. const _col = _row > 0 ? 1 : 0;
  666. return {
  667. rowspan: _row,
  668. colspan: _col
  669. };
  670. }
  671. if (columnIndex === 1) {
  672. const _row = this.spanArr[rowIndex];
  673. const _col = _row > 0 ? 1 : 0;
  674. return {
  675. rowspan: _row,
  676. colspan: _col
  677. };
  678. }
  679. if (columnIndex === 2) {
  680. const _row = this.spanArr[rowIndex];
  681. const _col = _row > 0 ? 1 : 0;
  682. return {
  683. rowspan: _row,
  684. colspan: _col
  685. };
  686. }
  687. if (columnIndex === 3) {
  688. const _row = this.spanArr[rowIndex];
  689. const _col = _row > 0 ? 1 : 0;
  690. return {
  691. rowspan: _row,
  692. colspan: _col
  693. };
  694. }
  695. if (columnIndex === 8) {
  696. const _row = this.spanArr[rowIndex];
  697. const _col = _row > 0 ? 1 : 0;
  698. return {
  699. rowspan: _row,
  700. colspan: _col
  701. };
  702. }
  703. if (columnIndex === 9) {
  704. const _row = this.spanArr[rowIndex];
  705. const _col = _row > 0 ? 1 : 0;
  706. return {
  707. rowspan: _row,
  708. colspan: _col
  709. };
  710. }
  711. if (columnIndex === 10) {
  712. const _row = this.spanArr[rowIndex];
  713. const _col = _row > 0 ? 1 : 0;
  714. return {
  715. rowspan: _row,
  716. colspan: _col
  717. };
  718. }
  719. if (columnIndex === 11) {
  720. const _row = this.spanArr[rowIndex];
  721. const _col = _row > 0 ? 1 : 0;
  722. return {
  723. rowspan: _row,
  724. colspan: _col
  725. };
  726. }
  727. if (columnIndex === 12) {
  728. const _row = this.spanArr[rowIndex];
  729. const _col = _row > 0 ? 1 : 0;
  730. return {
  731. rowspan: _row,
  732. colspan: _col
  733. };
  734. }
  735. if (columnIndex === 13) {
  736. const _row = this.spanArr[rowIndex];
  737. const _col = _row > 0 ? 1 : 0;
  738. return {
  739. rowspan: _row,
  740. colspan: _col
  741. };
  742. }
  743. if (columnIndex === 15) {
  744. const _row = this.spanArr[rowIndex];
  745. const _col = _row > 0 ? 1 : 0;
  746. return {
  747. rowspan: _row,
  748. colspan: _col
  749. };
  750. }
  751. }
  752. }
  753. };
  754. </script>
  755. <style lang="scss">
  756. .addSaleOrderSend {
  757. .from {
  758. margin-top: 20px;
  759. .line {
  760. display: flex;
  761. justify-content: center;
  762. align-items: center;
  763. .el-input {
  764. width: 350px;
  765. margin-left: 10px;
  766. margin-right: 10px;
  767. }
  768. }
  769. .sendCar {
  770. display: flex;
  771. justify-content: center;
  772. align-items: center;
  773. .el-input {
  774. width: 70px;
  775. margin-left: 10px;
  776. margin-right: 10px;
  777. margin-top: 10px;
  778. }
  779. }
  780. .vehicle {
  781. display: flex;
  782. justify-content: center;
  783. align-items: center;
  784. margin-top: 20px;
  785. .el-button {
  786. width: 250px;
  787. margin-left: 10px;
  788. margin-right: 10px;
  789. }
  790. .span {
  791. width: 70px;
  792. }
  793. }
  794. }
  795. .tablecls {
  796. margin-top: 20px;
  797. }
  798. .button_box {
  799. display: flex;
  800. justify-content: center;
  801. margin: 20px;
  802. .el-button {
  803. width: 100px;
  804. margin-left: 20px;
  805. }
  806. }
  807. }
  808. </style>