queueFCancel.vue 3.6 KB

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