spring
2025-03-19 1f69274b3f62e60378d7c5dbce05357366aaf2a6
src/views/structural/capabilityAndLaboratory/capability/index.vue
@@ -126,7 +126,7 @@
import {
  addProduct,
  delItemParameter, delProduct, delTestObject, selectItemParameterList, selectProductListByObjectId,
  selectTestObjectList, upProduct, updateWorkShop
  selectTestObjectList, upProduct, updateWorkShop, updateObjectWorkShop
} from "@/api/structural/capability";
import limsTable from "@/components/Table/lims-table.vue";
import EditForm from "@/views/structural/capabilityAndLaboratory/capabilityComponents/EditForm.vue";
@@ -244,6 +244,7 @@
            }
          },
        },
        { label: '车间名称', prop: 'workShopName' },
        { label: '创建人', prop: 'createUserName' },
        { label: '更新人', prop: 'updateUserName' },
        { label: '创建时间', prop: 'createTime' },
@@ -281,6 +282,16 @@
              clickFun: (row) => {
                this.bindPartFirst(row);
              },
            },
            {
              name: '车间绑定',
              type: 'text',
              clickFun: (row) => {
                this.bindWokshop1(row);
              },
              disabled: (row) => {
                return row.objectType != '原材料'
              }
            },
          ]
        }
@@ -674,9 +685,17 @@
    bindPartSecond(row) {
      this.bindPart(row, 1)
    },
    // 产品-车间绑定
    bindWokshop(row) {
      this.workshopForm.workShopId = row.workShopId
      this.currentProduct = row;
      this.workshopVisible = true
    },
    // 对象-车间绑定
    bindWokshop1(row) {
      this.$set(this.workshopForm, 'workShopId', row.workShopId)
      this.currentProduct = {};
      this.currentObj = row;
      this.workshopVisible = true
    },
    // 厂家密度绑定
@@ -720,20 +739,39 @@
      this.$refs['workshopForm'].validate((valid) => {
        if (valid) {
          this.uploading = true
          if (this.currentProduct.id) {
            // 产品绑定车间
          updateWorkShop({
            id: this.currentProduct.id,
              id: this.currentProduct.id ? this.currentProduct.id : null,
            workShopId: this.workshopForm.workShopId,
            name: this.workshopList.find(m => m.id == this.workshopForm.workShopId).name
              workShopName: this.workshopList.find(m => m.id == this.workshopForm.workShopId).name,
          }).then(res => {
            this.uploading = false
            if (res.code === 200) {
              this.$message.success('新增成功')
                this.$message.success('绑定成功')
              this.getProductList();
              this.workshopVisible = false
            }
          }).catch(err => {
            this.uploading = false
          })
          } else {
            // 对象绑定车间
            updateObjectWorkShop({
              id: this.currentObj.id ? this.currentObj.id : null,
              workShopId: this.workshopForm.workShopId,
              workShopName: this.workshopList.find(m => m.id == this.workshopForm.workShopId).name,
            }).then(res => {
              this.uploading = false
              if (res.code === 200) {
                this.$message.success('绑定成功')
                this.refreshTable()
                this.workshopVisible = false
              }
            }).catch(err => {
              this.uploading = false
            })
          }
        }
      })
    }