puzhibing
6 天以前 0db8c9b94a9ac655549d5eba5c2a6c92ac386c06
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
<template>
  <el-dialog :close-on-click-modal="false" :visible.sync="visible"
    width="88%" top="5vh" custom-class="validation-detail-dialog" @open="handleOpen" @close="handleClose">
    <div class="validation-overview">
      <div class="stacked-field">
        <span class="field-label">菌种来源</span>
        <div class="value-box multiline-box source-box">{{ detail.strainSource || '-' }}</div>
      </div>
      <div class="project-header">
        <span class="project-label">项目组:</span>
        <span class="project-name">{{ detail.projectName || '-' }}</span>
      </div>
      <div class="detail-panel">
      <div class="single-field-row">
        <div class="inline-field code-field">
          <span class="field-label">鉴别菌株编号</span>
          <div class="value-box compact-box">{{ detail.identifyingStrainCode || '-' }}</div>
        </div>
      </div>
      <div class="stacked-field name-field">
        <span class="field-label">鉴别菌株名称</span>
        <div class="value-box multiline-box">{{ detail.identifyingStrainName || '-' }}</div>
      </div>
      <div class="paired-fields">
        <div class="inline-field">
          <span class="field-label">验证实验编号</span>
          <div class="value-box compact-box">{{ detail.validationExperimentCode || '-' }}</div>
        </div>
        <div class="inline-field time-field">
          <span class="field-label">实验时间</span>
          <div class="value-box compact-box">{{ detail.experimentTime | formatDate }}</div>
        </div>
      </div>
      <div class="paired-fields signature-row">
        <div class="inline-field">
          <span class="field-label">菌种实验员签字</span>
          <div class="signature-area">
            <el-image v-if="detail.handleSignature" :src="getFullUrl(detail.handleSignature)"
              :preview-src-list="[getFullUrl(detail.handleSignature)]" fit="contain" alt="菌种实验员签字" />
            <span v-else class="waiting-text">暂无签名</span>
          </div>
        </div>
        <div class="inline-field time-field">
          <span class="field-label">签字时间</span>
          <div class="value-box compact-box">{{ detail.handleTime || '-' }}</div>
        </div>
      </div>
      </div>
    </div>
    <div class="section-card" style="margin-top: 24px">
      <el-form ref="form" label-width="100px" :model="detail" label-position="top">
        <el-form-item label="实验结论" prop="result">
          <el-input type="textarea" :disabled="true" v-model="detail.result" :rows="3" placeholder="请输入" />
        </el-form-item>
        <el-form-item label="批准菌株用途" prop="purpose">
          <el-checkbox-group :disabled="true" v-model="detail.purpose">
            <el-checkbox label="1">传代</el-checkbox>
            <el-checkbox label="2">菌种保藏</el-checkbox>
            <el-checkbox label="3">废弃</el-checkbox>
          </el-checkbox-group>
        </el-form-item>
      </el-form>
    </div>
 
    <div class="section-card" style="margin-top: 12px">
      <el-table :data="tableData" border style="width: 100%" :row-class-name="getRowClassName">
        <el-table-column prop="conditions" label="菌种培养工艺条件" />
        <el-table-column prop="record" label="菌种培养工艺实况记录" />
        <el-table-column prop="workmanship" label="菌种培养标准工艺" />
        <el-table-column label="操作" width="120">
          <template #default="{ row }">
            <el-button type="text" @click="handleEdit(row)">详情</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
  </el-dialog>
</template>
 
<script>
import DetailConditionDialog from "./DetailConditionDialog.vue";
import { detail } from "./service.js";
import moment from "moment";
import { getFullUrl } from "@/utils/utils.js";
export default {
  name: "DetailConditionDialog",
  components: { DetailConditionDialog },
  props: {
    visible: Boolean,
    value: {
      type: Object,
      default: () => ({ condition: "", record: "", process: "" }),
    },
    value: {
      type: Object,
      default: () => ({})
    },
  },
 
  data() {
    return {
      detail: {
        strainSource: '',
        identifyingStrainCode: '',
        identifyingStrainName: '',
        validationExperimentCode: '',
        experimentTime: '',
        handleSignature: '', // 签名图片url
        result: '',
        purpose: []
      },
      activeTab: "conditions",
      initialTableData: [
        { conditions: '平板培养基', record: '', workmanship: '' },
        { conditions: '培养温度', record: '', workmanship: '' },
        { conditions: '培养时间', record: '', workmanship: '' },
        { conditions: '摇瓶培养基', record: '', workmanship: '' },
        { conditions: '接种量', record: '', workmanship: '' },
        { conditions: '培养时间', record: '', workmanship: '' },
        { conditions: '发酵时间', record: '', workmanship: '' },
        { conditions: '检测数据及结果', record: '', workmanship: '' }
      ],
      tableData: [
        { conditions: '平板培养基', record: '', workmanship: '' },
        { conditions: '培养温度', record: '', workmanship: '' },
        { conditions: '培养时间', record: '', workmanship: '' },
        { conditions: '摇瓶培养基', record: '', workmanship: '' },
        { conditions: '接种量', record: '', workmanship: '' },
        { conditions: '培养时间', record: '', workmanship: '' },
        { conditions: '发酵时间', record: '', workmanship: '' },
        { conditions: '检测数据及结果', record: '', workmanship: '' }
      ],
      dialogVisible: false,
      dialogIsEdit: false,
      dialogIsFixed: false,
      dialogValue: {},
      dialogIndex: null,
    };
  },
  filters: {
    formatDate(date) {
      if(date){
        return moment(date).format('YYYY-MM-DD')
      }else{
        return '-'
      }
    },
  },
  methods: {
    getFullUrl(url){
      if(url){
        return getFullUrl(url)
      }
      return ''
    },
    handleOpen() {
      if (this.value.id) {
        detail({ id: this.value.id }).then(res => {
          this.detail = {
            ...res,
            handleSignature: res.handleSignature || '', // 处理签名为空的情况
            purpose: res.purpose&&res.purpose.split(',') || [] // 处理 purpose 为空的情况
          }
          this.tableData = res.list || []
        })
      }
    },
    handleClose() {
      this.$emit("update:visible", false);
    },
    handleEdit(row) {
 
       this.$emit("viewDetail", row);
    },
 
    handleSave() {
      this.dialogVisible = true;
      this.dialogIsEdit = false;
      this.dialogIsFixed = false;
      this.dialogValue = { condition: "", record: "", process: "" };
      this.dialogIndex = null;
    },
    handleDraft() {
      // 存稿逻辑
    },
    handleDialogOk(val) {
      if (this.dialogIsEdit && this.dialogIndex !== null) {
        this.$set(this.tableData, this.dialogIndex, val);
      } else {
        this.tableData.push(val);
      }
    },
    getRowClassName({ rowIndex }) {
      return rowIndex < this.initialTableData.length ? "fixed-row" : "";
    },
  },
};
</script>
 
<style scoped lang="less">
::v-deep(.validation-detail-dialog) {
  max-width: 1320px;
}
 
.validation-overview {
  color: #303133;
  font-size: 15px;
}
 
.field-label {
  display: block;
  margin-bottom: 8px;
  color: #606266;
  font-weight: 600;
  line-height: 22px;
  white-space: nowrap;
}
 
.value-box {
  min-width: 0;
  padding: 8px 12px;
  color: #303133;
  background: #fff;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  box-sizing: border-box;
  line-height: 22px;
  word-break: break-word;
  overflow-wrap: anywhere;
}
 
.multiline-box {
  min-height: 72px;
  white-space: pre-wrap;
}
 
.source-box {
  min-height: 68px;
}
 
.validation-overview > .stacked-field {
  margin: 0 32px;
}
 
.validation-overview > .stacked-field .field-label {
  padding-left: 112px;
}
 
.project-header {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 10px 20px;
  margin: 16px 0;
  background: #f0f8fb;
  border: 1px solid #b9dfe6;
  border-radius: 6px;
  box-sizing: border-box;
 
  .project-label {
    margin: 0 8px 0 0;
    color: #4d5965;
    font-size: 16px;
  }
 
  .project-name {
    color: #1890ff;
    font-size: 18px;
    font-weight: 700;
    word-break: break-word;
  }
}
 
.detail-panel {
  padding: 24px 40px 28px;
  background: #f3f4f6;
  border: 1px solid #e2e6eb;
  border-radius: 6px;
  box-sizing: border-box;
}
 
.single-field-row {
  display: flex;
  padding-left: 42px;
}
 
.inline-field {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  column-gap: 12px;
  align-items: center;
  min-width: 0;
 
  .field-label {
    margin-bottom: 0;
  }
}
 
.code-field {
  width: 100%;
  max-width: 416px;
  grid-template-columns: 160px minmax(0, 1fr);
}
 
.compact-box {
  display: flex;
  align-items: center;
  min-height: 40px;
}
 
.name-field {
  margin-top: 22px;
}
 
.name-field .field-label {
  padding-left: 42px;
}
 
.paired-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 72px;
  margin-top: 22px;
  padding: 0 32px;
}
 
.time-field {
  grid-template-columns: 100px minmax(0, 1fr);
}
 
.paired-fields .compact-box,
.paired-fields .signature-area {
  width: 100%;
  max-width: 265px;
}
 
.signature-row {
  align-items: start;
}
 
.signature-row .signature-area {
  max-width: 260px;
}
 
.signature-area {
  width: 100%;
  height: 72px;
  background: #fff;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
 
.signature-area .el-image {
  width: 100%;
  height: 100%;
}
 
.waiting-text {
  color: #909399;
  font-size: 14px;
}
 
.section-card {
  margin-bottom: 0;
}
 
.footer-btns {
  display: flex;
  justify-content: center;
  padding: 24px;
  padding-bottom: 0;
  gap: 24px;
 
  .el-button {
    width: 150px;
  }
}
 
::v-deep(.fixed-row) {
  background-color: rgb(228, 248, 250) !important;
}
 
@media (max-width: 900px) {
  .detail-panel {
    padding: 20px;
  }
 
  .paired-fields {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 0;
  }
}
 
@media (max-width: 600px) {
  .inline-field {
    display: block;
  }
 
  .inline-field .field-label {
    margin-bottom: 8px;
  }
 
  .single-field-row {
    padding-left: 0;
  }
 
  .name-field .field-label,
  .validation-overview > .stacked-field .field-label {
    padding-left: 0;
  }
 
  .validation-overview > .stacked-field {
    margin: 0;
  }
}
</style>