13404089107
2025-05-28 a60dc30be50598fe2d1acb42f8171ec69e37b436
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
<template>
  <!-- 设置传代计划数弹窗 -->
  <el-dialog
    :title="planForm.formStatus == 'add' ? '新增菌种传代项' : '菌种传代项详情'"
    :visible.sync="planDialogVisible"
    width="40%"
    :close-on-click-modal="false"
  >
    <el-form
      :model="planForm"
      :rules="planRules"
      ref="planForm"
      label-position="top"
    >
      <el-row :gutter="20">
        <el-col :span="16">
          <el-form-item label="菌株类型" required>
            <div class="type-box" v-if="planForm.formStatus == 'add'">
              <div
                @click="handleType(index)"
                v-for="(item, index) in [
                  '原始祖代菌株SO',
                  '分离菌落 CO',
                  '祖代菌株 O',
                ]"
                :key="item"
                class="type-box-item"
                :class="index + 1 == planForm.strainType && 'activeType'"
              >
                <div class="type-box-item-text">{{ item }}</div>
                <img
                  v-if="index + 1 == planForm.strainType"
                  class="type-box-item-select"
                  src="../../../assets/public/selectType.png"
                />
              </div>
            </div>
            <div v-else class="type-box">
              <div class="type-box-item activeType">
                {{
                  ["原始祖代菌株SO", "分离菌落 CO", "祖代菌株 O"][
                    planForm.strainType - 1
                  ]
                }}
              </div>
            </div>
          </el-form-item>
        </el-col>
        <el-col :span="20" v-if="planForm.strainType == 1">
          <el-form-item label="来源获得" prop="source">
            <el-input
              :disabled="planForm.formStatus != 'add'"
              v-model="planForm.source"
              placeholder="请输入"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="10" v-else>
          <el-form-item label="菌落编号" prop="colonyNumber">
            <el-input
              :disabled="planForm.formStatus != 'add'"
              v-model="planForm.colonyNumber"
              placeholder="请输入"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="10">
          <el-form-item label="菌种名称" prop="strainName">
            <el-input
              :disabled="planForm.formStatus != 'add'"
              v-model="planForm.strainName"
              placeholder="请输入"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="10">
          <el-form-item label="菌种编号" prop="strainCode">
            <el-input
              :disabled="planForm.formStatus != 'add'"
              v-model="planForm.strainCode"
              placeholder="请输入"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="10">
          <el-form-item label="保存/废弃" required>
            <div class="flex-row" v-if="planForm.formStatus == 'add'">
              <div
                @click="handleStatus('save')"
                :class="planForm.status === 1 && 'active'"
              >
                保存
              </div>
              <div
                @click="handleStatus('discard')"
                :class="planForm.status === 2 && 'active'"
              >
                废弃
              </div>
            </div>
            <div v-else class="activeStatus">
              {{ planForm.status === 1 ? "保存" : "废弃" }}
            </div>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20" v-if="planForm.status === 2">
        <el-col :span="10">
          <el-form-item label="废弃原因说明" required>
            <el-input
              :disabled="planForm.formStatus != 'add'"
              v-model="planForm.remark"
              placeholder="请输入"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="10">
          <el-form-item label="菌种入库时间">
            <el-input disabled v-model="planForm.confirmTime"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row v-if="planForm.formStatus != 'add'" :gutter="20">
        <el-col v-if="planForm.vaccinateSignature" :span="10">
          <el-form-item label="接种操作人签字">
            <el-image :src="planForm.vaccinateSignature" />
          </el-form-item>
        </el-col>
        <el-col v-if="planForm.preserveSignature" :span="10">
          <el-form-item label="菌种保藏人签字">
            <el-image :src="planForm.preserveSignature" />
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <div v-if="planForm.formStatus == 'add'" class="dialog-footer">
      <el-button>保存草稿</el-button>
      <el-button type="primary" @click="handleAddPlan">提交</el-button>
    </div>
  </el-dialog>
</template>
<script>
export default {
  data() {
    return {
      planDialogVisible: false,
      planForm: {
        source: "", // 来源获得
        strainCode: "", // 菌种编号
        strainName: "", // 菌种名称
        colonyNumber: "", // 菌落编号
        strainType: "1", // 1原始祖代菌株 2分离菌落 3祖代菌株
        status: 1, // 1保存 2废弃
        type: 1, // 固定为1
        confirmTime: "",
        remark: "",
        formStatus: "add",
      },
      planRules: {
        strainCode: [
          { required: true, message: "请输入菌种编号", trigger: "blur" },
        ],
        colonyNumber: [
          { required: true, message: "请输入菌落编号", trigger: "blur" },
        ],
        strainName: [
          { required: true, message: "请输入菌种名称", trigger: "blur" },
        ],
        source: [
          { required: true, message: "请输入来源获得", trigger: "blur" },
        ],
      },
      dialogTitle: "",
    };
  },
  methods: {
    openInitData(value) {
      // 赋值当前时间
      // const now = new Date();
      // const pad = (n) => n.toString().padStart(2, "0");
      // this.planForm.storageTime = `${now.getFullYear()}-${pad(
      //   now.getMonth() + 1
      // )}-${pad(now.getDate())} ${pad(now.getHours())}:${pad(
      //   now.getMinutes()
      // )}:${pad(now.getSeconds())}`;
      this.planForm = value;
      this.openDialog();
    },
    openDialog() {
      this.planDialogVisible = true;
    },
    closeDialog() {
      this.planDialogVisible = false;
    },
    handleAddPlan() {
      this.$refs.planForm.validate((valid) => {
        if (valid) {
          if (!this.planForm.strainType) {
            this.$message.warning("请选择菌株类型");
            return;
          }
          this.$emit("addNodeSign", { ...this.planForm }, 1);
        }
      });
    },
    handleStatus(status) {
      if (this.planForm.formStatus !== "add") return;
      this.planForm.status = status === "save" ? 1 : 2;
      this.$forceUpdate();
    },
    handleType(index) {
      if (this.planForm.formStatus !== "add") return;
      this.planForm.strainType = index + 1;
      // 如果是分离菌落或祖代菌株,colonyNumber=source,否则清空
      this.planForm.colonyNumber = "";
    },
  },
};
</script>
<style scoped lang="less">
.dialog-footer {
  margin-top: 39px;
  display: flex;
  justify-content: center;
  gap: 60px;
 
  .el-button--primary {
    width: 150px;
    height: 40px;
    background: #049c9a;
    border-radius: 4px;
  }
 
  .el-button--default {
    width: 150px;
    height: 40px;
    border-radius: 4px;
  }
}
 
::v-deep .el-input-number .el-input__inner {
  text-align: left;
}
 
.el-input-number--small {
  width: 100%;
}
 
.flex-row {
  width: 370px;
  display: flex;
  align-items: center;
  font-size: 16px;
  color: #333333;
  padding: 4px;
  border-radius: 10px;
  border: 2px solid rgba(4, 156, 154, 0.5);
  font-family: "PingFangSCRegular";
 
  .flex-row-save {
    background: #049c9a;
    color: #fff;
  }
 
  div {
    width: 183px;
    height: 32px;
    text-align: center;
    flex-shrink: 0;
    cursor: pointer;
  }
 
  .active {
    font-family: "sourceHanSansCN-Medium";
    color: #049c9a;
    background: #ebfefd;
    box-shadow: 0px 0px 6px 0px rgba(10, 109, 108, 0.25);
    border-radius: 10px;
  }
}
 
.activeStatus {
  font-family: "sourceHanSansCN-Medium";
  color: #049c9a;
  background: #ebfefd;
  border-radius: 10px;
  width: 183px;
  line-height: 40px;
  border-radius: 10px;
  text-align: center;
  font-weight: 500;
  font-size: 16px;
}
 
.type-box {
  display: flex;
  align-items: center;
  gap: 11px;
 
  .activeType {
    background: #ebfefd;
    font-weight: 500;
    color: #049c9a;
  }
 
  &-item {
    cursor: pointer;
    position: relative;
    width: 150px;
    text-align: center;
    background: #f5f5f5;
    border-radius: 4px;
    font-weight: 400;
    font-size: 16px;
    color: #333333;
 
    &-text {
      line-height: 40px;
    }
 
    &-select {
      position: absolute;
      bottom: 0;
      right: 0;
      width: 21px;
      height: 17px;
    }
  }
}
</style>