chenhj
15 小时以前 a3c7a21828653c2c74c20b1f69baf6a9fbfb8e1c
车间订单处理工艺文件工序排序错误问题
已修改1个文件
35 ■■■■ 文件已修改
src/views/plan/manufacturingorder/productorder-form.vue 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/plan/manufacturingorder/productorder-form.vue
@@ -311,10 +311,12 @@
                          </el-row> -->
                          <el-table
                            :key="operationIndex"
                            :data-operation-index="operationIndex"
                            id="operationTable"
                            ref="operationTable"
                            class="basic-template-table"
                            :data="operations"
                            row-key="id"
                            height="593px"
                            border
                            highlight-current-row
@@ -1278,6 +1280,7 @@
      currentRouting: {}, // 当前选择的工艺
      operations: [], // 当前选择工艺对应的工序
      operationIndex: 10,
      operationSortable: null,
      currentBom: {}, // 当前选择的产品结构
      components: [], // 当前选择产品结构对应的结构组件
      factoryOptions: [],
@@ -1334,6 +1337,12 @@
      },
      false
    )
  },
  beforeDestroy() {
    if (this.operationSortable) {
      this.operationSortable.destroy()
      this.operationSortable = null
    }
  },
  created() {
    this.dataForm.id = Number(this.$route.query.id)
@@ -1457,6 +1466,9 @@
        dataType: '生产要求',
        routingOperationId: newValue
      })
    },
    operationIndex() {
      this.rowDrop()
    }
  },
  computed: {
@@ -1483,11 +1495,24 @@
  },
  methods: {
    rowDrop() {
      if (this.operationSortable) {
        this.operationSortable.destroy()
        this.operationSortable = null
      }
      this.$nextTick(() => {
        requestAnimationFrame(() => {
      const that = this
      const tbody = document.querySelector(
        '#operationTable .el-table__body-wrapper tbody'
      )
      Sortable.create(tbody, {
          const root =
            this.$el.querySelector(
              `#operationTable[data-operation-index="${this.operationIndex}"]`
            ) || this.$el.querySelector('#operationTable')
          const tbody = root
            ? root.querySelector('.el-table__body-wrapper tbody')
            : null
          if (!tbody) return
          this.operationSortable = Sortable.create(tbody, {
        // 结束拖拽
        onEnd({ newIndex, oldIndex }) {
          if (newIndex > oldIndex) {
@@ -1535,6 +1560,8 @@
            })
        }
      })
        })
      })
    },
    dragEnd(e) {
      this.operations.forEach((e, i) => {