spring
2025-03-25 af62acf44d4424689378b1f0c6bb99b98d47565f
车间绑定修改
已修改3个文件
69 ■■■■■ 文件已修改
src/components/Preview/filePreview.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/structural/capabilityAndLaboratory/capability/index.vue 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/structural/capabilityAndLaboratory/capabilityComponents/testObjectEditForm.vue 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/Preview/filePreview.vue
@@ -100,7 +100,7 @@
      const fileName = this.currentFile.fileName || this.fileUrl.split('/').pop().split('?')[0]
      let state = /\.(jpg|jpeg|png|gif)$/i.test(fileName)
      this.imgUrl = this.fileUrl
      console.log("文件名:", fileName, "是否图片:", state)
      // console.log("文件名:", fileName, "是否图片:", state)
      return state;
    },
    isPdf() {
src/views/structural/capabilityAndLaboratory/capability/index.vue
@@ -283,16 +283,16 @@
                this.bindPartFirst(row);
              },
            },
            {
              name: '车间绑定',
              type: 'text',
              clickFun: (row) => {
                this.bindWokshop1(row);
              },
              disabled: (row) => {
                return row.objectType != '原辅料' && row.objectType != '包材'
              }
            },
            // {
            //   name: '车间绑定',
            //   type: 'text',
            //   clickFun: (row) => {
            //     this.bindWokshop1(row);
            //   },
            //   disabled: (row) => {
            //     return row.objectType != '原辅料' && row.objectType != '包材'
            //   }
            // },
          ]
        }
      ],
@@ -315,7 +315,7 @@
      productColumn: [
        { label: '产品名称', prop: 'name' },
        { label: '产品名称EN', prop: 'nameEn' },
        { label: '车间名称', prop: 'workShopName' },
        // { label: '车间名称', prop: 'workShopName' },
        {
          dataType: 'action',
          label: '操作',
@@ -413,7 +413,7 @@
    this.getDicts("product_classification").then((response) => {
      this.productClassification = this.dictToValue(response.data);
    });
    this.selectWorkShop()
    // this.selectWorkShop()
  },
  computed: {
    title() {
@@ -586,15 +586,15 @@
    // 产品维护
    upProduct(row) {
      this.currentObj = row;
      if (this.currentObj.objectType == '原辅料') {
        if (this.productColumn.length < 4) {
          this.productColumn.splice(2, 0, { label: '车间名称', prop: 'workShopName' })
        }
      } else {
        if (this.productColumn.length == 4) {
          this.productColumn.splice(2, 1)
        }
      }
      // if (this.currentObj.objectType == '原辅料') {
      //   if (this.productColumn.length < 4) {
      //     this.productColumn.splice(2, 0, { label: '车间名称', prop: 'workShopName' })
      //   }
      // } else {
      //   if (this.productColumn.length == 4) {
      //     this.productColumn.splice(2, 1)
      //   }
      // }
      this.diaProduct = true
      this.objectId = row.id
      this.productPage.current = 1
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 => {