gaoluyang
2025-02-19 7e35455e4bbad2edfe64bf6f56beff105c94eb94
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
<template>
  <div>
    <el-dialog title="数据查看" :visible.sync="isShow" width="80%" @closed="$emit('closeDataLook')">
      <ul class="tab">
        <li v-for="(m,i) in dataVisibleTitle" :key="i" :class="{active:i===dataVisibleIndex}" @click="handleDataVisibleTab(m,i)">{{m.label}}</li>
      </ul>
      <div>
        <lims-table :tableData="tableData" :column="column"
                    @pagination="pagination" height="500px" key="tableData"
                    :page="page" :tableLoading="tableLoading"></lims-table>
      </div>
    </el-dialog>
    <un-pass-retest-result :retestVisible="retestVisible" :retestInfo="retestInfo" @closeRetestLook="closeRetestLook" v-if="retestVisible"></un-pass-retest-result>
  </div>
</template>
 
<script>
import ValueTable from "@/components/Table/value-table.vue";
import UnPassRetestResult from "./unPassRetestResult.vue";
import limsTable from "@/components/Table/lims-table.vue";
import {getRetestResult, selectSampleAndProductByOrderId} from "@/api/business/rawMaterialOrder";
 
export default {
  name: "dataLookVisible",
  // import 引入的组件需要注入到对象中才能使用
  components: {limsTable, UnPassRetestResult, ValueTable},
  props: {
    dataDialogVisible: {
      type: Boolean,
      default: () => false
    },
    dataLookInfo: {
      type: Object,
      default: () => {}
    },
  },
  data() {
    // 这里存放数据
    return {
      tableData: [],
      tableLoading: false,
      column: [
        {label: '样品编号', prop: 'sampleCode'},
        {label: '样品名称', prop: 'sample'},
        {label: '检验项分类', prop: 'inspectionItemClass'},
        {label: '检验项', prop: 'inspectionItem'},
        {label: '检验子项', prop: 'inspectionItemSubclass'},
        {label: '单位', prop: 'unit'},
        {label: '样品型号', prop: 'model'},
        {label: '条件', prop: 'radius'},
        {label: '电缆标识', prop: 'cableTag'},
        {label: '试验要求', prop: 'tell'},
        {label: '检验结果', prop: 'lastValue'},
        {
          dataType: 'tag',
          label: '结果判定',
          prop: 'insResult',
          formatData: (params) => {
            if (params == 1) {
              return '合格'
            } else if (params == 0) {
              return '不合格'
            } else if (params == 3) {
              return '不判定'
            } else {
              return ''
            }
          },
          formatType: (params) => {
            if (params == 1) {
              return 'success'
            } else if (params == 0) {
              return 'danger'
            } else if (params == 3) {
              return ''
            }  else {
              return ''
            }
          }
        },
        {
          dataType: 'action',
          fixed: 'right',
          label: '操作',
          width: '170px',
          operation: [
            {
              name: '不合格复测查看',
              type: 'text',
              clickFun: (row) => {
                this.getRetestResult(row);
              },
              disabled: (row, index) =>  {
                return row.insResult!==0
              }
            },
          ]
        }
      ],
      page: {
        total:0,
        size:10,
        current:1
      },
      isShow: this.dataDialogVisible,
      dataVisibleTitle: [
        {
          label: '进厂检验',
          value: 0
        },
        {
          label: '季度检验',
          value: 1
        },
      ],
      dataVisibleIndex: 0, // 数据查看tab栏选择值
      entity: {
        id: null,
      },
      retestVisible: false,
      retestInfo: []
    }
  },
  mounted() {
    this.refreshTable()
  },
  // 方法集合
  methods: {
    // 切换数据查看tab栏
    handleDataVisibleTab (m, i) {
      this.dataVisibleIndex = i
      this.refreshTable()
    },
    // 查询回调
    refreshTable() {
      if (this.dataVisibleIndex === 0) {
        this.entity.id = this.dataLookInfo.enterOrderId
      } else {
        this.entity.id = this.dataLookInfo.quarterOrderId
      }
      this.tableLoading = true
      const params = {...this.entity}
      selectSampleAndProductByOrderId(params).then(res => {
        this.tableLoading = false
        if (res.code === 200) {
          this.tableData = res.data.records
          this.page.total = res.data.total
        }
      }).catch(err => {
        this.tableLoading = false
      })
    },
    pagination (page) {
      this.page.size = page.limit
      this.refreshTable()
    },
    // 查看不合格复测结果
    getRetestResult (row) {
      getRetestResult({insProductId: row.insProductId}).then(res => {
        this.retestVisible = true
        this.retestInfo = res.data
      })
    },
    closeRetestLook () {
      this.retestVisible = false
    },
  },
}
</script>
 
<style scoped>
.tab {
  list-style-type: none;
  display: flex;
  margin-top: 0 !important;
  padding-left: 0 !important;
}
 
.tab li {
  line-height: 24px;
  padding: 6px 14px;
  font-size: 14px;
  color: #333333;
  border: 1px solid #EEEEEE;
  cursor: pointer;
}
 
.tab li:nth-child(1) {
  border-radius: 8px 0 0 8px;
}
 
.tab li:nth-child(2) {
  border-radius: 0 8px 8px 0;
}
 
.tab li.active {
  border-color: #3A7BFA;
  color: #3A7BFA;
}
</style>