spring
2025-03-21 9e0426e8e28dd530663cdbe80f258d1622cc9e7d
src/views/structural/capabilityAndLaboratory/capability/index.vue
@@ -97,7 +97,8 @@
    <EditForm ref="editForm" @refreshList="refreshList1"></EditForm>
    <testObjectEditForm ref="testObjectEditForm" @refreshList="refreshList"></testObjectEditForm>
    <BindPartDialog v-if="bindPartDialog" :bindPartDialog="bindPartDialog" :currentRow="currentRow" :type="type"
      @closeBindPartDialog="closeBindPartDialog"></BindPartDialog>
      @closeBindPartDialog="closeBindPartDialog" :currentObj="currentObj">
    </BindPartDialog>
    <BindSupplierDensityDialog v-if="bindSupplierDensityDialog" :bindSupplierDensityDialog="bindSupplierDensityDialog"
      :currentRow="currentSupplierDensityRow" @closeBindPartDialog="closeBindSupplierDensityDialog">
    </BindSupplierDensityDialog>
@@ -125,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";
@@ -154,13 +155,13 @@
        { label: '试验室', prop: 'sonLaboratory' },
        { label: '要求描述', prop: 'askTell' },
        { label: '要求值', prop: 'ask' },
        { label: '试验条件', prop: 'radiusList' },
        { label: '计量单位', prop: 'unit' },
        { label: '工时(H)', prop: 'manHour' },
        { label: '预计时间(H)', prop: 'manDay' },
        { label: '工时分组', prop: 'manHourGroup' },
        { label: '创建时间', prop: 'createTime' },
        { label: '修改时间', prop: 'updateTime' },
        { label: '条件', prop: 'radiusList' },
        {
          dataType: 'action',
          fixed: 'right',
@@ -232,7 +233,7 @@
        { label: '检验对象', prop: 'specimenName' },
        { label: '检验对象EN', prop: 'specimenNameEn' },
        { label: '产品', prop: 'product' },
        { label: '对象代号', prop: 'code' },
        // { label: '对象代号', prop: 'code' },
        {
          label: '对象类型', prop: 'objectType',
          dataType: 'tag',
@@ -243,6 +244,7 @@
            }
          },
        },
        { label: '车间名称', prop: 'workShopName' },
        { label: '创建人', prop: 'createUserName' },
        { label: '更新人', prop: 'updateUserName' },
        { label: '创建时间', prop: 'createTime' },
@@ -274,13 +276,23 @@
                this.upProduct(row);
              },
            },
            // {
            //   name: '零件绑定',
            //   type: 'text',
            //   clickFun: (row) => {
            //     this.bindPartFirst(row);
            //   },
            // },
            {
              name: '零件绑定',
              type: 'text',
              clickFun: (row) => {
                this.bindPartFirst(row);
              },
            },
            {
              name: '车间绑定',
              type: 'text',
              clickFun: (row) => {
                this.bindWokshop1(row);
              },
              disabled: (row) => {
                return row.objectType != '原辅料' && row.objectType != '包材'
              }
            },
          ]
        }
      ],
@@ -336,20 +348,20 @@
                this.bindWokshop(row);
              },
              showHide: (row) => {
                if (this.currentObj.objectType != '原材料') {
                if (this.currentObj.objectType != '原辅料' && row.objectType != '包材') {
                  return false
                } else {
                  return true
                }
              }
            },
            {
              name: '厂家密度绑定',
              type: 'text',
              clickFun: (row) => {
                this.bindSupplierDensitySecond(row);
              },
            },
            // {
            //   name: '厂家密度绑定',
            //   type: 'text',
            //   clickFun: (row) => {
            //     this.bindSupplierDensitySecond(row);
            //   },
            // },
          ]
        }
      ],
@@ -502,6 +514,11 @@
      }
    },
    refresh() {
      this.itemParameterForm = {
        inspectionItem: null,
        inspectionItemSubclass: null,
        sample: null
      }
      this.resetForm('itemParameterForm')
      this.page.current = 1
      this.refreshTable()
@@ -569,7 +586,7 @@
    // 产品维护
    upProduct(row) {
      this.currentObj = row;
      if (this.currentObj.objectType == '原材料') {
      if (this.currentObj.objectType == '原辅料') {
        if (this.productColumn.length < 4) {
          this.productColumn.splice(2, 0, { label: '车间名称', prop: 'workShopName' })
        }
@@ -673,8 +690,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
    },
    // 厂家密度绑定
@@ -688,6 +714,9 @@
    },
    // 打开零件绑定弹框
    bindPart(row, index) {
      if (index == 0) {
        this.currentObj = row
      }
      this.type = index
      this.currentRow = row
      this.bindPartDialog = true
@@ -715,20 +744,39 @@
      this.$refs['workshopForm'].validate((valid) => {
        if (valid) {
          this.uploading = true
          updateWorkShop({
            id: this.currentProduct.id,
            workShopId: this.workshopForm.workShopId,
            name: this.workshopList.find(m => m.id == this.workshopForm.workShopId).name
          }).then(res => {
            this.uploading = false
            if (res.code === 200) {
              this.$message.success('新增成功')
              this.getProductList();
              this.workshopVisible = false
            }
          }).catch(err => {
            this.uploading = false
          })
          if (this.currentProduct.id) {
            // 产品绑定车间
            updateWorkShop({
              id: this.currentProduct.id ? this.currentProduct.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.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
            })
          }
        }
      })
    }