addSaleOrderSteelSend.vue 27 KB

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