退料编码类型改为表格勾选选择

This commit is contained in:
zzyuan 2024-11-20 10:07:18 +08:00
parent 40b1702b9e
commit 07001f3125
2 changed files with 97 additions and 60 deletions

View File

@ -158,7 +158,7 @@
</el-row> </el-row>
<el-table <el-table
v-loading="loading" v-loading="loading"
:data="equipmentList" :data="equipmentList"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
> >
<el-table-column <el-table-column
@ -287,7 +287,7 @@
</el-table> </el-table>
<el-dialog title="编码退料" :visible.sync="open" width="1000px" append-to-body> <el-dialog title="编码退料" :visible.sync="open" width="1000px" append-to-body>
<el-row :gutter="10" class="mb8"> <!-- <el-row :gutter="10" class="mb8">
<el-col :span="6"> <el-col :span="6">
<div style="width: 100%;height: 100%;display: flex;align-items: center;"> <div style="width: 100%;height: 100%;display: flex;align-items: center;">
<span style="width: 80px;">编码</span> <span style="width: 80px;">编码</span>
@ -303,12 +303,13 @@
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="primary" size="mini" @click="handleAddCode">添加编码</el-button> <el-button type="primary" size="mini" @click="handleAddCode">添加编码</el-button>
</el-col> </el-col>
</el-row> </el-row> -->
<el-table :data="maCodeList" width="100%" height="450px"> <el-table :data="machineList" width="100%" ref="codeTableList" height="450px" row-key="maId" @selection-change="codeSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" type="index" width="55" align="center"/> <el-table-column label="序号" type="index" width="55" align="center"/>
<el-table-column label="类型名称" prop="materialName" align="center" :show-overflow-tooltip="true"> <el-table-column label="类型名称" prop="typeName" align="center" :show-overflow-tooltip="true">
</el-table-column> </el-table-column>
<el-table-column label="规格型号" prop="typeName" align="center" :show-overflow-tooltip="true"> <el-table-column label="规格型号" prop="materialName" align="center" :show-overflow-tooltip="true">
</el-table-column> </el-table-column>
<el-table-column label="设备编码" prop="maCode" align="center" :show-overflow-tooltip="true"> <el-table-column label="设备编码" prop="maCode" align="center" :show-overflow-tooltip="true">
</el-table-column> </el-table-column>
@ -343,12 +344,12 @@
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" width="120px"> <!-- <el-table-column label="操作" align="center" width="120px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" type="danger" <el-button size="mini" type="danger"
@click="handleDeleteCode({ ...scope.row, index: scope.$index })">删除</el-button> @click="handleDeleteCode({ ...scope.row, index: scope.$index })">删除</el-button>
</template> </template>
</el-table-column> </el-table-column> -->
</el-table> </el-table>
<div style="width: 100%;height: 50px;display: flex;justify-content: flex-end;align-items: center;"> <div style="width: 100%;height: 50px;display: flex;justify-content: flex-end;align-items: center;">
<el-button type="primary" size="mini" @click="saveDevCode">保存</el-button> <el-button type="primary" size="mini" @click="saveDevCode">保存</el-button>
@ -927,71 +928,107 @@ export default {
template.useNum = node.data.useNum template.useNum = node.data.useNum
return template return template
}, },
//
getMachineById(typeId){ // changeMachine(val){
// console.log(val)
// this.maData = this.machineList.find(option => option.maId == val);
// // = this.machineList[index]
// },
//
async getMachineById(typeId){
let param = { let param = {
unitId:this.queryParams.unitId, unitId:this.queryParams.unitId,
proId:this.queryParams.proId, proId:this.queryParams.proId,
typeId:typeId typeId:typeId
} }
getMachineById(param).then((res) => { await getMachineById(param).then((res) => {
this.machineList=res.data this.machineList=res.data
this.machineList.forEach((item)=>{
item.bmFileInfos=[];
item.apDetection=""
})
}) })
}, },
changeMachine(val){
console.log(val)
this.maData = this.machineList.find(option => option.maId == val);
// = this.machineList[index]
},
//- //-
openAddCode(row){ async openAddCode(row){
this.rowData=row; this.rowData=row;
this.getMachineById(row.typeId) await this.getMachineById(row.typeId)
this.maId="" // this.maId=""
this.maCodeList=[] if(this.rowData.maCodeList&&this.rowData.maCodeList.length>0){
if(this.rowData.maCodeList&&this.rowData.maCodeList.length>0){ this.maCodeList = this.rowData.maCodeList;
this.maCodeList = this.rowData.maCodeList // console.log(this.maCodeList)
} // console.log(this.machineList)
if (this.rowId != '') {//
this.maCodeList.forEach((item)=>{
this.machineList.unshift(item)//
this.$nextTick(() => {
this.$refs.codeTableList.toggleRowSelection(item,true);
})
})
}else{//
// console.log("")
this.machineList.forEach((item)=>{
this.maCodeList.forEach((sub)=>{
if(sub.maId==item.maId){
this.$nextTick(() => {
setTimeout(()=>{
this.$refs.codeTableList.toggleRowSelection(item,true);
},500)
})
}
})
})
}
}else{
this.maCodeList=[]
}
this.open=true; this.open=true;
}, },
codeSelectionChange(selection) {
this.maCodeList=selection
// console.log(selection)
// this.queryParams.equipmentList = selection
},
// //
handleAddCode(){ handleAddCode(){
console.log(this.rowData)
console.log(this.maId)
console.log(this.maData)
if(this.maId!=""){
let obj = {
materialName:this.maData.materialName,
typeId:this.maData.typeId,
typeName:this.maData.typeName,
maId:this.maData.maId,
maCode:this.maData.maCode,
maStatus:this.maData.maStatus,
bmFileInfos:[],
apDetection:"",
}
let index = this.maCodeList.findIndex(v=>v.maId==this.maId)
if(index>-1){
this.$message.error('设备编码已存在!')
}else{
this.maCodeList.push(obj)
}
}else{
this.$message.error('请先填写设备编码!')
}
},
/** 删除按钮操作 */
handleDeleteCode(row) {
this.maCodeList.splice(row.index, 1)
},
//
saveDevCode(){
// console.log(this.rowData) // console.log(this.rowData)
// console.log(this.maCodeList) // console.log(this.maCodeList)
// console.log(this.maId)
// console.log(this.maData)
// if(this.maId!=""){
// let obj = {
// materialName:this.maData.materialName,
// typeId:this.maData.typeId,
// typeName:this.maData.typeName,
// maId:this.maData.maId,
// maCode:this.maData.maCode,
// maStatus:this.maData.maStatus,
// bmFileInfos:[],
// apDetection:"",
// }
// let index = this.maCodeList.findIndex(v=>v.maId==this.maId)
// if(index>-1){
// this.$message.error('')
// }else{
// this.maCodeList.push(obj)
// }
// }else{
// this.$message.error('')
// }
},
// /** */
// handleDeleteCode(row) {
// this.maCodeList.splice(row.index, 1)
// },
//
saveDevCode(){
console.log(this.rowData)
console.log(this.maCodeList)
this.rowData.maCodeList = this.maCodeList; this.rowData.maCodeList = this.maCodeList;
this.rowData.preNum = this.maCodeList.length; this.rowData.preNum = this.maCodeList.length;
this.open=false this.open=false
// console.log(this.equipmentList) console.log(this.equipmentList)
}, },
// //
beforeFileUpload(row){ beforeFileUpload(row){

View File

@ -81,7 +81,7 @@
<dict-tag :options="dict.type.purchase_task_status" :value="scope.row.taskStatus"/> <dict-tag :options="dict.type.purchase_task_status" :value="scope.row.taskStatus"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" align="center" prop="remark" /> <el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true"/>
<el-table-column label="操作" align="center" width="250"> <el-table-column label="操作" align="center" width="250">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button