queueFApply.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. // 排队申请
  2. <template>
  3. <div class="sale">
  4. <div class="top">
  5. <span>车牌号:</span>
  6. <el-input
  7. placeholder="请输入内容"
  8. v-model="inputText"
  9. clearable
  10. class="input"
  11. >
  12. </el-input>
  13. <el-button type="primary" class="btn" @click="onclick">
  14. <i class="el-icon-search"></i>查询
  15. </el-button>
  16. </div>
  17. <div class="tab">
  18. <el-table
  19. :data="tableData"
  20. :span-method="objectSpanMethod"
  21. fit
  22. border
  23. style="width: 100%; margin-top: 20px"
  24. max-height="250px"
  25. >
  26. <el-table-column
  27. type="index"
  28. width="50"
  29. label="序号"
  30. fixed
  31. ></el-table-column>
  32. <el-table-column
  33. prop="orderNumber"
  34. label="运输订单号"
  35. show-overflow-tooltip="true"
  36. >
  37. </el-table-column>
  38. <el-table-column prop="capacityNumber" label="车牌号">
  39. </el-table-column>
  40. <el-table-column prop="resultApplyforTime" label="申请时间">
  41. </el-table-column>
  42. <el-table-column prop="resultDownTime" label="下发时间">
  43. </el-table-column>
  44. <el-table-column prop="materialName" label="物资名称">
  45. </el-table-column>
  46. <el-table-column prop="materialSpecification" label="物资规格">
  47. </el-table-column>
  48. <el-table-column prop="materialModel" label="物资型号">
  49. </el-table-column>
  50. <el-table-column prop="orderMaterialNumber" label="物资件数">
  51. </el-table-column>
  52. </el-table>
  53. </div>
  54. </div>
  55. </template>
  56. <script>
  57. export default {
  58. data() {
  59. return {
  60. inputText: "",
  61. tableData: []
  62. };
  63. },
  64. mounted() {
  65. this.information();
  66. },
  67. methods: {
  68. information() {
  69. this.axios.post("/api/v1/qms/getQueueApply").then(res => {
  70. console.log(res);
  71. this.tableData = res.data.data;
  72. this.getSpanArr(this.tableData);
  73. });
  74. },
  75. onclick() {
  76. this.option.requestUrl =
  77. "/api/v1/qms/getQueueApply?apiId=125&con=" +
  78. this.inputText +
  79. "&i=" +
  80. new Date();
  81. },
  82. //记录每一行的合并数
  83. getSpanArr(data) {
  84. //每次调用方法初始化
  85. this.spanArr = [];
  86. for (var i = 0; i < data.length; i++) {
  87. if (i === 0) {
  88. this.spanArr.push(1);
  89. this.pos = 0;
  90. } else {
  91. // 判断当前元素与上一个元素是否相同
  92. if (data[i].orderNumber === data[i - 1].orderNumber) {
  93. this.spanArr[this.pos] += 1;
  94. this.spanArr.push(0);
  95. } else {
  96. this.spanArr.push(1);
  97. this.pos = i;
  98. }
  99. }
  100. }
  101. },
  102. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  103. if (
  104. columnIndex === 0 ||
  105. columnIndex === 1 ||
  106. columnIndex === 2 ||
  107. columnIndex === 3 ||
  108. columnIndex === 4 ||
  109. columnIndex === 5
  110. ) {
  111. const _row = this.spanArr[rowIndex];
  112. const _col = _row > 0 ? 1 : 0;
  113. return {
  114. rowspan: _row,
  115. colspan: _col
  116. };
  117. }
  118. }
  119. }
  120. };
  121. </script>
  122. <style lang="scss">
  123. .sale {
  124. .top {
  125. width: 100%;
  126. height: 80px;
  127. display: flex;
  128. align-items: center;
  129. padding-left: 40px;
  130. }
  131. .input {
  132. width: 250px;
  133. margin-right: 20px;
  134. }
  135. }
  136. </style>