This commit is contained in:
zds
2022-10-21 14:39:35 +08:00
parent c418d0267b
commit d4c01560ef

View File

@@ -145,33 +145,30 @@
>
生成工令
</el-button>
<el-button
slot="right"
class="filter-item"
type="primary"
icon="el-icon-top"
size="mini"
@click="moveUp2"
>
上移
</el-button>
<el-button
slot="right"
class="filter-item"
type="primary"
icon="el-icon-bottom"
size="mini"
@click="moveDown2"
>
下移
</el-button>
</crudOperation>
<!--表格渲染-->
<el-table ref="table" v-loading="crud.loading" :max-height="590" :data="crud.data" size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
<el-table-column
min-width="115"
label="重排调整"
align="center"
fixed="right"
>
<template slot-scope="scope">
<el-button
type="primary"
size="mini"
icon="el-icon-top"
@click="moveUp(scope.$index, scope.row)"
>
</el-button>
<el-button
type="primary"
size="mini"
icon="el-icon-bottom"
@click="moveDown(scope.$index, scope.row)"
>
</el-button>
</template>
</el-table-column>
<el-table ref="table" v-loading="crud.loading" highlight-current-row :max-height="590" :data="crud.data" size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler" @current-change="handleDtlCurrentChange">
<el-table-column
v-permission="['admin','workorder:del','workorder:edit']"
min-width="125"
@@ -189,6 +186,7 @@
</template>
</el-table-column>
<el-table-column fixed="left" :selectable="checkboxT" type="selection" min-width="35" />
<el-table-column type="index" label="序号" min-width="40" align="center" />
<el-table-column prop="plan_code" label="日计划编码" min-width="105" />
<el-table-column :formatter="seriesFormat" min-width="70" prop="product_series_id" label="系列产线" />
<el-table-column prop="device_name" label="关键设备" min-width="80" />
@@ -272,6 +270,7 @@ export default {
XLList: [],
fileList: [],
checkrows: [],
now_row: null,
form: {},
rules: {
}}
@@ -299,6 +298,7 @@ export default {
},
methods: {
[CRUD.HOOK.beforeRefresh]() {
this.now_row = null
return true
},
checkboxT(row) {
@@ -399,6 +399,48 @@ export default {
this.crud.loading = false
})
},
handleDtlCurrentChange(current) {
if (current !== null) {
this.now_row = current
} else {
this.now_row = null
}
},
moveUp2() {
if (this.now_row === null) {
return this.crud.notify('请选中一条数据!')
}
const data = this.crud.data
for (let i = 0; i < data.length; i++) {
if (data[i].plan_code === this.now_row.plan_code) {
if (i > 0) {
const upDate = this.crud.data[i - 1]
this.crud.data.splice(i - 1, 1)
this.crud.data.splice(i, 0, upDate)
} else {
this.$message.error('已经是第一条,不可上移')
}
}
}
},
moveDown2() {
if (this.now_row === null) {
return this.crud.notify('请选中一条数据!')
}
const data = this.crud.data
for (let i = 0; i < data.length; i++) {
if (data[i].plan_code === this.now_row.plan_code) {
if ((i + 1) === this.crud.data.length) {
this.$message.error('已经是最后一条,不可下移')
} else {
const downDate = this.crud.data[i + 1]
this.crud.data.splice(i + 1, 1)
this.crud.data.splice(i, 0, downDate)
break
}
}
}
},
querytable() {
this.crud.toQuery()
}