queueFCancel.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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>
  50. </div>
  51. </div>
  52. </template>
  53. <script>
  54. export default {
  55. data() {
  56. return {
  57. inputText: "",
  58. tableData: []
  59. };
  60. },
  61. mounted() {
  62. this.information();
  63. },
  64. methods: {
  65. information() {
  66. this.axios.post("/api/v1/qms/getQueueCancel").then(res => {
  67. this.tableData = res.data.data;
  68. this.getSpanArr(this.tableData);
  69. });
  70. },
  71. onclick(num) {
  72. if (num == 0) {
  73. this.option.requestUrl =
  74. "/api/v1/qms/getQueueCancel?apiId=131&con=" +
  75. this.inputText +
  76. "&i=" +
  77. new Date();
  78. } else if (num == 1) {
  79. this.$router.push({
  80. path: "/addqueueFCancel"
  81. });
  82. }
  83. },
  84. //记录每一行的合并数
  85. getSpanArr(data) {
  86. //每次调用方法初始化
  87. this.spanArr = [];
  88. for (var i = 0; i < data.length; i++) {
  89. if (i === 0) {
  90. this.spanArr.push(1);
  91. this.pos = 0;
  92. } else {
  93. // 判断当前元素与上一个元素是否相同
  94. if (data[i].orderNumber === data[i - 1].orderNumber) {
  95. this.spanArr[this.pos] += 1;
  96. this.spanArr.push(0);
  97. } else {
  98. this.spanArr.push(1);
  99. this.pos = i;
  100. }
  101. }
  102. }
  103. },
  104. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  105. if (
  106. columnIndex === 0 ||
  107. columnIndex === 1 ||
  108. columnIndex === 2 ||
  109. columnIndex === 3 ||
  110. columnIndex === 4
  111. ) {
  112. const _row = this.spanArr[rowIndex];
  113. const _col = _row > 0 ? 1 : 0;
  114. return {
  115. rowspan: _row,
  116. colspan: _col
  117. };
  118. }
  119. }
  120. }
  121. };
  122. </script>
  123. <style lang="scss">
  124. .sale {
  125. .top {
  126. width: 100%;
  127. height: 80px;
  128. display: flex;
  129. align-items: center;
  130. padding-left: 40px;
  131. }
  132. .input {
  133. width: 250px;
  134. margin-right: 20px;
  135. }
  136. .btn1 {
  137. margin-left: 20px;
  138. }
  139. }
  140. </style>