<template>
|
<el-dialog
|
v-diadrag
|
title="执行"
|
top="5vh"
|
:close-on-click-modal="false"
|
:visible.sync="visible"
|
width="35%"
|
>
|
<el-table :data="dataList" stripe style="width: 100%" height="200px" border>
|
<el-table-column
|
prop="processNo"
|
label="编号"
|
width="160px"
|
></el-table-column>
|
<el-table-column
|
prop="defaultLocation"
|
label="默认库位"
|
width="180px"
|
></el-table-column>
|
<el-table-column
|
prop="targetLocation"
|
label="目标库位"
|
label-width="180px"
|
>
|
<template scope="scope">
|
<el-input
|
size="small"
|
clearable
|
v-model="scope.row.targetLocation"
|
placeholder=""
|
>
|
<el-button
|
slot="append"
|
icon="el-icon-search"
|
@click="openSelectTypePart(scope.$index, scope.row)"
|
></el-button
|
></el-input> </template
|
></el-table-column>
|
</el-table>
|
|
<span slot="footer" class="dialog-footer">
|
<el-button @click="visible = false">取消</el-button>
|
<el-button
|
type="primary"
|
:disabled="isSubmit"
|
v-thinclick="`dataFormSubmit`"
|
>确定</el-button
|
>
|
</span>
|
<!-- 库位 -->
|
<loactionForm
|
:currshowlist.sync="addtableVisible"
|
ref="addtable"
|
@refreshDataList="getDataState"
|
/>
|
</el-dialog>
|
</template>
|
<script>
|
import {
|
showDefaultLocation,
|
executeByIds
|
} from '@/api/quality/unqualifiedprocess'
|
import loactionForm from './loaction-form'
|
|
export default {
|
data() {
|
return {
|
visible: false,
|
isSubmit: false,
|
addtableVisible: false,
|
// paramObject: '',
|
tableIndex: null,
|
ids: null,
|
idNum: [],
|
dataList: [
|
{
|
id: 0,
|
handler: null,
|
processNo: null,
|
defaultLocation: null,
|
targetLocation: null
|
}
|
],
|
dataForm: [
|
{
|
id: 0,
|
handler: null,
|
processNo: null,
|
defaultLocation: null,
|
targetLocation: null
|
}
|
]
|
}
|
},
|
components: {
|
loactionForm
|
},
|
methods: {
|
init(row) {
|
this.$nextTick(() => {
|
this.idNum = []
|
for (let i = 0; i < row.length; i++) {
|
this.idNum.push({ id: row[i].id })
|
}
|
|
this.ids = []
|
row.forEach((item) => {
|
this.ids.push(item.id)
|
})
|
this.showDefaultLocation()
|
})
|
},
|
showDefaultLocation() {
|
showDefaultLocation(this.ids).then((res) => {
|
this.dataForm = res.data.data
|
this.dataList = []
|
this.stateNum = []
|
console.log(this.dataForm)
|
for (let i = 0; i < this.dataForm.length; i++) {
|
if (this.dataForm[i].isShow) {
|
this.stateNum.push(this.dataForm[i].isShow)
|
this.dataList.push(this.dataForm[i])
|
this.visible = true
|
return
|
}
|
}
|
if (!this.stateNum.indexOf('true') != -1) {
|
this.visible = false
|
executeByIds(this.idNum).then((data) => {
|
this.$message.success('保存成功')
|
this.$emit('refreshDataList')
|
})
|
}
|
})
|
},
|
openSelectTypePart(index, row) {
|
// console.log(row)
|
// if (row.processMode == 1 || row.processMode == 2) {
|
// this.paramObject = '6'
|
// }
|
// if (row.processMode == 4) {
|
// this.paramObject = '4'
|
// }
|
// if (row.processMode == 3) {
|
// this.paramObject = ''
|
// }
|
this.addtableVisible = true
|
this.tableIndex = index
|
},
|
getDataState(val) {
|
console.log(val)
|
if (val) {
|
Object.assign(this.dataForm[this.tableIndex], {
|
targetLocation: val.locName,
|
targetLocationId: val.id
|
})
|
}
|
},
|
// 表单提交
|
dataFormSubmit() {
|
this.isSubmit = true
|
executeByIds(this.dataForm)
|
.then((data) => {
|
this.$message.success('保存成功')
|
this.visible = false
|
this.isSubmit = false
|
this.$emit('refreshDataList')
|
})
|
.catch((error) => {
|
this.isSubmit = false
|
console.log(error)
|
})
|
}
|
}
|
}
|
</script>
|