addSaleOrderSteelSend.vue 26 KB

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