spring
2025-03-06 0e7df1d78841c4121acd9b072565f7b1bf748023
src/views/structural/capabilityAndLaboratory/capabilityComponents/testObjectEditForm.vue
@@ -1,10 +1,12 @@
<template>
  <div>
    <el-dialog :title="operationType === 'add' ? '新增' : '编辑'" :visible.sync="editFormDia" width="500px" @close="closeDia">
    <el-dialog :title="operationType === 'add' ? '新增' : '编辑'" :visible.sync="editFormDia" width="500px"
      @close="closeDia">
      <el-form ref="editForm" :model="editForm" :rules="editFormRules" label-width="120px" label-position="right">
        <el-form-item label="场所:" prop="laboratoryId">
          <el-select v-model="editForm.laboratoryId" clearable placeholder="请选择" size="small" style="width: 100%">
            <el-option v-for="item in laboratoryList" :key="item.value" :label="item.label" :value="item.value"></el-option>
            <el-option v-for="item in laboratoryList" :key="item.value" :label="item.label"
              :value="item.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="检验对象:" prop="specimenName">
@@ -15,11 +17,6 @@
        </el-form-item>
        <el-form-item label="对象代号:" prop="code">
          <el-input v-model="editForm.code" clearable size="small"></el-input>
        </el-form-item>
        <el-form-item label="对象类型:" prop="objectType">
          <el-select v-model="editForm.objectType" clearable placeholder="请选择" size="small" style="width: 100%">
            <el-option v-for="item in dict.type.object_type" :key="item.value" :label="item.label" :value="item.value"></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
@@ -32,8 +29,8 @@
<script>
import {obtainItemParameterList} from "@/api/structural/laboratoryScope";
import {addTestObject, upTestObject} from "@/api/structural/capability";
import { obtainItemParameterList } from "@/api/structural/laboratoryScope";
import { addTestObject, upTestObject } from "@/api/structural/capability";
export default {
  name: "EditForm",
@@ -51,7 +48,6 @@
        specimenName: '', // 检验对象
        specimenNameEn: '', // 检验对象EN
        code: '', // 对象代号
        objectType: '', // 对象类型
      },
      laboratoryList: [],
      editFormRules: {
@@ -70,22 +66,22 @@
  },
  // 方法集合
  methods: {
    openDia (type, row) {
    openDia(type, row) {
      this.operationType = type
      this.obtainItemParameterList()
      this.editFormDia = true
      if (type === 'add') {
        this.resetForm("editForm");
      } else {
        this.editForm = {...row}
        this.editForm = { ...row }
      }
    },
    // 提交编辑
    handleEdit () {
    handleEdit() {
      this.$refs.editForm.validate(valid => {
        if (valid) {
          this.editLoad = true
          if(this.editForm.id){
          if (this.editForm.id) {
            // 修改
            upTestObject(this.editForm).then(res => {
              this.editLoad = false
@@ -98,7 +94,7 @@
            }).catch(e => {
              this.editLoad = false
            })
          }else{
          } else {
            // 新增
            addTestObject(this.editForm).then(res => {
              this.editLoad = false
@@ -116,7 +112,7 @@
      })
    },
    // 关闭弹框
    closeDia () {
    closeDia() {
      this.editFormDia = false
      this.resetForm("editForm");
    },
@@ -137,6 +133,4 @@
}
</script>
<style scoped>
</style>
<style scoped></style>