yyb
11 小时以前 65193cc9b4e27aad36a65eca447e6c62f6ee037f
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
<template>
  <el-dialog v-model="dialogVisible" title="详情" width="720px">
    <div class="detail-content">
      <el-row :gutter="20" class="detail-row">
        <el-col :span="12">
          <p class="detail-item"><span class="detail-label">状态:</span><span class="detail-value">{{ formatInspectState(detailForm.inspectState) }}</span></p>
        </el-col>
        <el-col :span="12">
          <p class="detail-item"><span class="detail-label">检测日期:</span><span class="detail-value">{{ detailForm.checkTime || "-" }}</span></p>
        </el-col>
      </el-row>
      <el-row :gutter="20" class="detail-row">
        <el-col :span="12">
          <p class="detail-item"><span class="detail-label">类别:</span><span class="detail-value">{{ formatInspectType(detailForm.inspectType) }}</span></p>
        </el-col>
        <el-col :span="12">
          <p class="detail-item"><span class="detail-label">检验员:</span><span class="detail-value">{{ detailForm.checkName || "-" }}</span></p>
        </el-col>
      </el-row>
      <el-row :gutter="20" class="detail-row">
        <el-col :span="12">
          <p class="detail-item"><span class="detail-label">产品名称:</span><span class="detail-value">{{ detailForm.productName || "-" }}</span></p>
        </el-col>
        <el-col :span="12">
          <p class="detail-item"><span class="detail-label">规格型号:</span><span class="detail-value">{{ detailForm.model || "-" }}</span></p>
        </el-col>
      </el-row>
      <el-row :gutter="20" class="detail-row">
        <el-col :span="12">
          <p class="detail-item"><span class="detail-label">单位:</span><span class="detail-value">{{ detailForm.unit || "-" }}</span></p>
        </el-col>
        <el-col :span="12">
          <p class="detail-item"><span class="detail-label">数量:</span><span class="detail-value">{{ detailForm.quantity ?? "-" }}</span></p>
        </el-col>
      </el-row>
      <el-row :gutter="20" class="detail-row">
        <el-col :span="12">
          <p class="detail-item"><span class="detail-label">不合格现象:</span><span class="detail-value">{{ detailForm.defectivePhenomena || "-" }}</span></p>
        </el-col>
        <el-col :span="12">
          <p class="detail-item"><span class="detail-label">处理结果:</span><span class="detail-value">{{ detailForm.dealResult || "-" }}</span></p>
        </el-col>
      </el-row>
      <el-row :gutter="20" class="detail-row">
        <el-col :span="12">
          <p class="detail-item"><span class="detail-label">处理人:</span><span class="detail-value">{{ detailForm.dealName || "-" }}</span></p>
        </el-col>
        <el-col :span="12">
          <p class="detail-item"><span class="detail-label">处理日期:</span><span class="detail-value">{{ detailForm.dealTime || "-" }}</span></p>
        </el-col>
      </el-row>
      <el-row :gutter="20" class="detail-row">
        <el-col :span="12">
          <p class="detail-item"><span class="detail-label">工时损失:</span><span class="detail-value">{{ detailForm.lossWorking ?? "-" }}</span></p>
        </el-col>
        <el-col :span="12">
          <p class="detail-item"><span class="detail-label">材料费损失:</span><span class="detail-value">{{ detailForm.lossMaterial ?? "-" }}</span></p>
        </el-col>
      </el-row>
      <el-row class="detail-row">
        <el-col :span="24">
          <p class="detail-item">
            <span class="detail-label">原因分析:</span>
            <span class="detail-value detail-textarea">{{ detailForm.reasonAnalysis || "-" }}</span>
          </p>
        </el-col>
      </el-row>
      <el-row class="detail-row">
        <el-col :span="24">
          <p class="detail-item">
            <span class="detail-label">预防与纠正措施:</span>
            <span class="detail-value detail-textarea">{{ detailForm.preventiveCorrective || "-" }}</span>
          </p>
        </el-col>
      </el-row>
      <!-- <el-row class="detail-row">
        <el-col :span="24">
          <div class="detail-item">
            <span class="detail-label">附件:</span>
            <div class="detail-value">
              <div v-if="attachmentList.length" class="attachment-list">
                <p
                  v-for="(item, idx) in attachmentList"
                  :key="`${item.url}-${idx}`"
                  :href="item.url"
                  target="_blank"
                  rel="noopener noreferrer"
                  class="attachment-link"
                >
                  {{ item.name }}
                </p>
              </div>
              <span v-else>-</span>
            </div>
          </div>
        </el-col>
      </el-row> -->
    </div>
  </el-dialog>
</template>
 
<script setup>
import { computed, ref } from "vue";
 
const dialogVisible = ref(false);
const detailForm = ref({});
const baseApi = import.meta.env.VITE_APP_BASE_API;
 
const normalizeUrl = (url) => {
  if (!url) return "";
  if (String(url).startsWith("http")) return url;
  return `${baseApi}${url}`;
};
// const attachmentList = computed(() => {
//   const list = [];
//   const commonFileList = Array.isArray(detailForm.value?.commonFileList) ? detailForm.value.commonFileList : [];
//   commonFileList.forEach((item, index) => {
//     const url = normalizeUrl(item?.url || item?.tempPath);
//     if (!url) return;
//     list.push({
//       name: item?.name || `附件${index + 1}`,
//       url,
//     });
//   });
//   if (list.length) return list;
 
//   const photos = detailForm.value?.defectivePhotos;
//   if (!photos) return [];
//   return String(photos)
//     .split(",")
//     .map((item, index) => {
//       const path = item?.trim();
//       if (!path) return null;
//       return {
//         name: `附件${index + 1}`,
//         url: normalizeUrl(path),
//       };
//     })
//     .filter(Boolean);
// });
 
const formatInspectState = (value) => {
  if (value == 0) return "待处理";
  if (value == 1) return "已处理";
  return "-";
};
const formatInspectType = (value) => {
  if (value == 0) return "原材料检验";
  if (value == 1) return "过程检验";
  if (value == 2) return "出厂检验";
  return "-";
};
 
const openDialog = (row) => {
  detailForm.value = { ...(row || {}) };
  dialogVisible.value = true;
};
 
defineExpose({
  openDialog,
});
</script>
 
<style scoped>
.detail-content {
  line-height: 1.6;
  color: #606266;
  max-height: 60vh;
  overflow-y: auto;
  overflow-x: hidden;
}
.detail-row {
  margin-bottom: 10px;
}
.detail-item {
  margin: 0;
  display: flex;
  align-items: flex-start;
}
.detail-label {
  flex: 0 0 116px;
  color: #303133;
  font-weight: 600;
}
.detail-value {
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
}
.detail-value-multiline {
  white-space: pre-wrap;
  word-break: break-word;
}
.detail-textarea {
  display: block;
  min-height: 92px;
  max-height: 92px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 10px;
  border-radius: 4px;
  background: #f5f7fa;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}
.attachment-link {
  color: #409eff;
  text-decoration: none;
}
.attachment-link:hover {
  text-decoration: underline;
}
</style>