| | |
| | | </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 |
| | |
| | | currentRouting: {}, // 当前选择的工艺 |
| | | operations: [], // 当前选择工艺对应的工序 |
| | | operationIndex: 10, |
| | | operationSortable: null, |
| | | currentBom: {}, // 当前选择的产品结构 |
| | | components: [], // 当前选择产品结构对应的结构组件 |
| | | factoryOptions: [], |
| | |
| | | }, |
| | | false |
| | | ) |
| | | }, |
| | | beforeDestroy() { |
| | | if (this.operationSortable) { |
| | | this.operationSortable.destroy() |
| | | this.operationSortable = null |
| | | } |
| | | }, |
| | | created() { |
| | | this.dataForm.id = Number(this.$route.query.id) |
| | |
| | | dataType: '生产要求', |
| | | routingOperationId: newValue |
| | | }) |
| | | }, |
| | | operationIndex() { |
| | | this.rowDrop() |
| | | } |
| | | }, |
| | | computed: { |
| | |
| | | }, |
| | | 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) { |
| | |
| | | }) |
| | | } |
| | | }) |
| | | }) |
| | | }) |
| | | }, |
| | | dragEnd(e) { |
| | | this.operations.forEach((e, i) => { |