queueFCancel.vue 3.4 KB

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