spring
2025-03-25 af62acf44d4424689378b1f0c6bb99b98d47565f
src/views/structural/capabilityAndLaboratory/capabilityComponents/testObjectEditForm.vue
@@ -24,6 +24,12 @@
              :value="item.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="车间:" prop="objectType" v-if="editForm.objectType == '原辅料' || editForm.objectType == '包材'">
          <el-select v-model="editForm.workShopId" placeholder="请选择" size="small">
            <el-option v-for="item in workshopList" :key="item.id" :label="item.name" :value="item.id">
            </el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="closeDia">取 消</el-button>
@@ -37,6 +43,7 @@
import { obtainItemParameterList } from "@/api/structural/laboratoryScope";
import { addTestObject, upTestObject } from "@/api/structural/capability";
import { selectWorkShop } from "@/api/structural/workshop.js"
export default {
  name: "EditForm",
@@ -55,6 +62,7 @@
        specimenNameEn: '', // 检验对象EN
        // code: '', // 对象代号
        objectType: '', // 对象类型
        workShopId: '',//车间
      },
      laboratoryList: [],
      editFormRules: {
@@ -67,18 +75,29 @@
        objectType: [
          { required: true, message: '请输入对象类型', trigger: 'change' }
        ],
        workShopId: [
          { required: true, message: '请选择车间', trigger: 'change' }
        ],
      },
      operationType: ''
      operationType: '',
      workshopList: []
    }
  },
  // 方法集合
  methods: {
    selectWorkShop() {
      selectWorkShop({ size: -1, current: -1 }).then(res => {
        this.workshopList = res.data.records
      })
    },
    openDia(type, row) {
      this.operationType = type
      this.obtainItemParameterList()
      this.selectWorkShop()
      this.editFormDia = true
      if (type === 'add') {
        this.resetForm("editForm");
        this.editForm = {}
      } else {
        this.editForm = { ...row }
      }
@@ -88,6 +107,10 @@
      this.$refs.editForm.validate(valid => {
        if (valid) {
          this.editLoad = true
          if (this.editForm.objectType != '原辅料' && this.editForm.objectType != '包材') {
            this.editForm.workShopId = ''
          }
          this.editForm.workShopName = this.editForm.workShopId ? this.workshopList.find(m => m.id == this.editForm.workShopId).name : ''
          if (this.editForm.id) {
            // 修改
            upTestObject(this.editForm).then(res => {