小小儁爺
2026-04-28 709fa95bc62e339ec74d8d8084b7380a62a8474f
1.sop工艺   变成批量绑定
已修改2个文件
204 ■■■■ 文件已修改
src/api/SopManager.js 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/sopManager/sopRoute.vue 191 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/SopManager.js
@@ -40,8 +40,8 @@
export function ProcessSopMaxVersion(data) {
  return request({
    url: 'SopManageMent/ProcessSopMaxVersion',
    method: 'get',
    params: data
    method: 'post',
    data
  })
}
@@ -125,3 +125,12 @@
    params: data
  })
}
// 系统设置,产品编码查找关联的工艺信息
export function ProcessSopPartSelectRpute(data) {
  return request({
    url: 'SopManageMent/ProcessSopPartSelectRpute',
    method: 'post',
    data
  })
}
src/views/sopManager/sopRoute.vue
@@ -184,14 +184,14 @@
      v-el-drag-dialog
      title="文件上传"
      :visible.sync="dialogVisible"
      width="800px"
      width="1000px"
      :close-on-click-modal="false"
      top="15vh"
      top="5vh"
      @closed="handleClose"
      @close="handleClose"
    >
      <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px">
        <el-form-item label="产品信息" prop="partcode">
        <el-form-item label="产品信息">
          <el-button
            v-waves
            type="primary"
@@ -200,9 +200,12 @@
            @click="selectSuitpart"
          >选择物料
          </el-button>
          <div v-if="dialogForm.partcode.toString().trim().length>0">
            已选择{{ dialogForm.partcode }} {{ dialogForm.partname }}
          <div v-if="multipleSelection.length>0">
            已选择{{ multipleSelection.length }}个物料
          </div>
          <!--          <div v-if="dialogForm.partcode.toString().trim().length>0">-->
          <!--            已选择{{ dialogForm.partcode }} {{ dialogForm.partname }}-->
          <!--          </div>-->
          <!--          <el-select-->
          <!--            v-model="dialogForm.partcode"-->
          <!--            style="width: 200px"-->
@@ -247,6 +250,7 @@
            style="width: 200px"
            placeholder="请选择"
            filterable
            multiple
            collapse-tags
            :popper-append-to-body="false"
            @change="stepcodeChange"
@@ -276,9 +280,6 @@
            />
          </el-select>
        </el-form-item>
        <el-form-item label="版本号">
          <el-input v-model="dialogForm.fileversion" disabled style="width: 200px" />
        </el-form-item>
        <el-form-item label="文件上传" prop="Files">
          <div style="width: 200px;">
            <el-upload
@@ -301,6 +302,60 @@
              </el-button>
            </el-upload>
          </div>
        </el-form-item>
        <el-form-item label-width="120" label="对应版本号">
          <el-table
            :data="versionList"
            border
            style="width: 800px"
            :header-cell-style="this.$headerCellStyle"
            :cell-style="this.$cellStyle"
            height="300"
          >
            <el-table-column
              type="index"
              label="序号"
              width="60"
              align="center"
            />
            <el-table-column
              prop="materielcode"
              label="物料编码"
              show-tooltip-when-overflow
            />
            <el-table-column
              prop="materielname"
              label="物料名称"
              show-tooltip-when-overflow
            />
            <el-table-column
              prop="materielspec"
              label="规格型号"
              show-tooltip-when-overflow
            />
            <el-table-column
              prop="stepcode"
              label="工序编码"
              width="100"
              align="center"
            />
            <el-table-column
              prop="stepname"
              label="工序名称"
              width="100"
              align="center"
            />
            <el-table-column
              prop="file_version"
              label="版本号"
              width="100"
              align="center"
            />
          </el-table>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
@@ -419,21 +474,24 @@
              highlight-current-row
              :header-cell-style="this.$headerCellStyle"
              :cell-style="this.$cellStyle"
              row-key="partcode"
              @row-click="rowClick2"
              :row-key="getRowKey"
              @select-all="handleSelectionAllChange"
              @select="handleSelectionChange"
            >
              <!--              @row-click="rowClick2"-->
              <el-table-column
                width="50"
                type="selection"
                :reserve-selection="true"
                fixed
              >
                <template slot-scope="{row}">
                  <el-radio
                    v-model="dialogForm.partcode"
                    :label="row.partcode"
                    style="color: transparent;padding-left: 10px;"
                  />
                </template>
                <!--                <template slot-scope="{row}">-->
                <!--                  <el-radio-->
                <!--                    v-model="dialogForm.partcode"-->
                <!--                    :label="row.partcode"-->
                <!--                    style="color: transparent;padding-left: 10px;"-->
                <!--                  />-->
                <!--                </template>-->
              </el-table-column>
              <el-table-column
                prop="rowNum"
@@ -457,6 +515,15 @@
              >
                <template slot-scope="{row}">
                  {{ row.partspec ? row.partspec : '/' }}
                </template>
              </el-table-column>
              <el-table-column
                prop="is_retdproc"
                label="是否绑定工艺"
              >
                <template slot-scope="{row}">
                  <el-tag v-if="row.is_retdproc==='Y'" size="small" type="success">已绑定</el-tag>
                  <el-tag v-else size="small" type="danger">未绑定</el-tag>
                </template>
              </el-table-column>
              <el-table-column
@@ -499,7 +566,13 @@
<script>
import Pagination from '@/components/Pagination'
import { ProcessSopAddSeave, ProcessSopDeleteSeave, ProcessSopSearch, ProcessSopMaxVersion } from '@/api/SopManager'
import {
  ProcessSopAddSeave,
  ProcessSopDeleteSeave,
  ProcessSopSearch,
  ProcessSopMaxVersion,
  ProcessSopPartSelectRpute
} from '@/api/SopManager'
import waves from '@/directive/waves'
import elDragDialog from '@/directive/el-drag-dialog'
import { PartSelect, TMaterielClassTree, TMaterielData } from '@/api/ProductModel'
@@ -521,8 +594,8 @@
      form: {
        check: 'N', // 是否选中最高版本
        search: '', // 搜索关键字
        prop: 'lm_date', // 排序字段
        order: 'desc', // 排序字段
        prop: 'materielcode,routecode,stepcode', // 排序字段
        order: 'asc', // 排序字段
        page: 1, // 第几页
        rows: 20 // 每页多少条
      },
@@ -536,7 +609,7 @@
        partname: '', //
        route: '', // 物料编码
        stepcode: '',
        stepcode: [],
        defilename: '',
        filetypecode: '', // 文件类型编码
        Files: '', // 文件
@@ -594,7 +667,9 @@
        prop: 'lm_date', // 排序字段
        order: 'desc' // 排序字段
      },
      suitobjectTotal: 0
      suitobjectTotal: 0,
      multipleSelection: [],
      versionList: []
    }
  },
@@ -616,6 +691,20 @@
    this.getHeight()
  },
  methods: {
    getRowKey(row) {
      return row.partcode
    },
    handleSelectionAllChange(val) {
      this.multipleSelection = JSON.parse(JSON.stringify(val))
    },
    handleSelectionChange(val, row) {
      const arrAll = JSON.parse(JSON.stringify(val))
      if (this.multipleSelection.filter((item) => item.partcode === row.partcode).length === 0) {
        this.multipleSelection = arrAll
      } else {
        this.multipleSelection = arrAll.filter((item) => item.partcode !== row.partcode)
      }
    },
    selectSuitpart() {
      this.dialogVisibleSuitobject = true
      this.$nextTick(() => {
@@ -640,8 +729,19 @@
    },
    async  dialogVisibleConfirmSuitobject() {
      await this.partcodeChange(this.dialogForm.partcode)
      const { data: res } = await ProcessSopPartSelectRpute(this.multipleSelection.map(i => i.partcode))
      // await this.partcodeChange(this.dialogForm.partcode)
      if (this.mesSetting.route) {
        this.routeArr = res
      } else {
        this.stepcodeArr = res
      }
      this.dialogForm.route = ''
      this.dialogForm.stepcode = []
      this.dialogVisibleSuitobject = false
      this.versionList = []
      // await this.stepcodeChange()
    },
    rowClick2(row, event, column) {
@@ -743,7 +843,7 @@
        this.stepcodeArr = res
      }
      this.dialogForm.route = ''
      this.dialogForm.stepcode = ''
      this.dialogForm.stepcode = []
      await this.stepcodeChange()
    },
    async routeChange() {
@@ -753,19 +853,20 @@
      }
      const { data: res } = await RouteSelectStep(data)
      this.stepcodeArr = res
      this.dialogForm.stepcode = ''
      this.dialogForm.stepcode = []
      await this.stepcodeChange()
    },
    async stepcodeChange() {
      if (this.dialogForm.partcode && this.dialogForm.stepcode && this.dialogForm.filetypecode) {
      if (this.multipleSelection && this.dialogForm.filetypecode) {
        const data = {
          partcode: this.dialogForm.partcode,
          // partcode: this.dialogForm.partcode,
          partcode: this.multipleSelection.map(i => i.partcode),
          routecode: this.dialogForm.route,
          stepcode: this.dialogForm.stepcode,
          filetypecode: this.dialogForm.filetypecode
        }
        const { data: res } = await ProcessSopMaxVersion(data)
        this.dialogForm.fileversion = res
        this.versionList = res
      }
    },
@@ -818,8 +919,11 @@
      this.dialogForm.fileversion = ''
      this.dialogForm.stepcode = ''
      this.dialogForm.Files = ''
      this.multipleSelection = []
      this.versionList = []
      this.$refs.uploadFileRef.clearFiles()
      this.$refs.dialogForm.clearValidate()
      this.$refs.tableDataRef3.clearSelection()
    },
    // 对话框取消
    dialogVisibleCancel() {
@@ -840,13 +944,34 @@
      this.$refs.dialogForm.validate(valid => {
        if (valid) {
          if (this.multipleSelection.length === 0) {
            return this.$message.info('请先选择产品!')
          }
          // const sopPartVersionList = []
          // this.versionList.forEach(i => {
          //   sopPartVersionList.push({
          //     PartCode: i.materielcode,
          //     Routecode: this.dialogForm.route,
          //     StepCode: i.stepcode,
          //     Version: i.file_version
          //   })
          // })
          const formData = new FormData()
          formData.append('partcode', this.dialogForm.partcode)
          formData.append('routecode', this.dialogForm.route)
          formData.append('stepcode', this.dialogForm.stepcode)
          this.versionList.forEach((i, index) => {
            formData.append(`sopPartVersionList[${index}].PartCode`, i.materielcode)
            formData.append(`sopPartVersionList[${index}].Routecode`, this.dialogForm.route)
            formData.append(`sopPartVersionList[${index}].StepCode`, i.stepcode)
            formData.append(`sopPartVersionList[${index}].Version`, i.file_version)
          })
          // formData.append('sopPartVersionList', JSON.stringify(sopPartVersionList).toString())
          // formData.append('partcode', this.dialogForm.partcode)
          // formData.append('routecode', this.dialogForm.route)
          // formData.append('stepcode', this.dialogForm.stepcode)
          formData.append('filename', this.$refs.uploadFileRef.uploadFiles[0].name)
          formData.append('filetypecode', this.dialogForm.filetypecode)
          formData.append('version', this.dialogForm.fileversion)
          // formData.append('version', this.dialogForm.fileversion)
          formData.append('file', this.$refs.uploadFileRef.uploadFiles[0].raw)
          // for (var [key, value] of formData) {
          //   console.log(key, value)