zouyu
2025-03-18 bc44c8e3c9d85691ce3fa73ef1300a6fae46e365
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<style scoped>
.title {
  height: 60px;
  line-height: 60px;
}
 
.search {
  background-color: #fff;
  height: 80px;
  display: flex;
  align-items: center;
}
.search_thing {
  display: flex;
  align-items: center;
  height: 50px;
}
.search_label {
  width: 120px;
  font-size: 14px;
  text-align: right;
}
 
.search_input {
  width: calc(100% - 120px);
}
.table {
  margin-top: 10px;
  background-color: #fff;
  width: calc(100% - 40px);
  height: calc(100% - 60px - 80px - 10px - 40px);
  padding: 20px;
}
</style>
<template>
  <div class="below-standard-main bg-1">
    <div style="width: 100%; height: 100%">
      <div>
        <el-row class="title">
          <el-col :span="12" style="padding-left: 20px; text-align: left"
            >不合格管理</el-col
          >
        </el-row>
      </div>
      <div class="search">
        <div class="search_thing">
          <div class="search_label">规格型号:</div>
          <div class="search_input">
            <el-input
              size="small"
              placeholder="请输入"
              clearable
              v-model="entity.model"
              @keyup.enter.native="refreshTable()"
            ></el-input>
          </div>
        </div>
        <div class="search_thing">
          <div class="search_label">样品名称:</div>
          <div class="search_input">
            <el-input
              size="small"
              placeholder="请输入"
              clearable
              v-model="entity.sample"
              @keyup.enter.native="refreshTable()"
            ></el-input>
          </div>
        </div>
        <div class="search_thing" style="padding-left: 30px">
          <el-button size="small" @click="refresh()">重 置</el-button>
          <el-button size="small" type="primary" @click="refreshTable()"
            >查 询</el-button
          >
        </div>
      </div>
      <div class="table">
        <lims-table
          :tableData="tableData"
          :column="column"
          :tableLoading="tableLoading"
          :parentSpanMethod="spanMethod"
          :height="tableHeight+''"
          :page="page"
          @pagination="pagination"
        ></lims-table>
      </div>
    </div>
  </div>
</template>
 
<script>
import limsTable from "@/components/Table/lims-table.vue";
import {
  pageInsUnPass
} from "../../../api/business/unPass";
 
 
 
import { convertToHtml } from "mammoth";
export default {
  components: {
    limsTable,
  },
  data() {
    return {
      tableData: [],
      column:[
        {
          label: '委托编号',
          prop: 'entrustCode'
        },
        {
          label: '样品名称',
          prop: 'sample'
        },
        {
          label: '规格型号',
          prop: 'model'
        },
        {
          label: '检测项',
          prop: 'inspectionItem'
        },
        {
          label: '检测子项',
          prop: 'inspectionItemSubclass'
        },
        {
          label: '检测结果',
          prop: 'lastValue'
        },
        {
          label: '处理意见',
          prop: 'handleSuggestion'
        },
        {
          label: '检验人',
          prop: 'name'
        }
      ],
      tableLoading: false,
      page: {
        current: 1,
        size: 20,
        total: 0,
      },
      entity: {
          sample: null,
          model: null,
        },
      entityCopy: {},
      upIndex: 0,
      statusList: [],
    };
  },
  mounted() {
    this.entityCopy = this.HaveJson(this.entity);
    this.refreshTable();
  },
  created() {
    this.getTableHeight();
  },
  methods: {
    // 表格合并
    spanMethod({row,column,rowIndex,columnIndex}) {
      // 需要合并的列
      const needSpan = [1]
      if(needSpan.includes(columnIndex)) {
        // 如果是第一行 或者 当前行的值和上一行的值不一样 就要开始进行计算合并
        if(rowIndex == 0 || row.entrustCode != this.tableData[rowIndex -1 ].entrustCode) {
          // 向下找到和当前行不一样的行数
          let rowSpan = 1;
          while(rowIndex + rowSpan < this.tableData.length && row.entrustCode == this.tableData[rowIndex + rowSpan].entrustCode) {
            rowSpan++
          }
          return [rowSpan,1]
        }else {
          // 如果和上一行的值一样 就隐藏
          return [0,0]
        }
      }else{
        return [1,1]
      }
    },
    getTableHeight() {
      this.tableHeight = window.innerHeight - 50 - 46 - 60 - 80 - 30 - 30 - 32;
    },
    getData() {
      this.tableLoading = true;
      pageInsUnPass({
        current: this.page.current,
        size: this.page.size,
        model: this.entity.model,
        sample: this.entity.sample,
      }).then((res) => {
        this.tableLoading = false;
        this.tableData = res.data.records;
        this.page.total = res.data.total;
      });
    },
    pagination({page,limit}) {
      this.page.current = page;
      this.page.size = limit;
      this.getData();
    },
 
    refreshTable() {
      this.getData();
    },
    refresh() {
      this.entity = this.HaveJson(this.entityCopy);
      this.upIndex++;
      this.$nextTick(() => {
        this.getData();
      });
    },
  },
};
</script>