工艺管理-配方-设备BOM bug

yangwl
A0010407 1 year ago
parent 703951a9c1
commit 7466d725f9

@ -110,18 +110,13 @@
<ItemSelect ref="itemSelect" @onSelected="onItemSelectedEquipment" > </ItemSelect>
</el-form-item>
</el-col>
<!-- <el-col :span="12">
<el-col :span="12">
<el-form-item label="BOM材料" prop="material">
<el-input v-model="form.material" placeholder="请选择BOM材料" >
<el-button slot="append" @click="handleSelectBom" icon="el-icon-search"></el-button>
</el-input>
<ItemSelectBom ref="itemSelectBom" @onSelected="onItemSelectedBom" ></ItemSelectBom>
</el-form-item>
</el-col> -->
<el-col :span="12">
<el-form-item label="BOM材料" prop="material">
<el-input v-model="form.material" placeholder="请输入BOM材料" />
</el-form-item>
</el-col>
</el-row>
<el-row>
@ -174,12 +169,16 @@
<script>
import { listProcesscontent, getProcesscontent, delProcesscontent, addProcesscontent, updateProcesscontent } from "@/api/technology/recipecontent";
import ItemSelect from "./single.vue";
// import ItemSelectBom from "./singleBom.vue";
import ItemSelectBom from "./singleBom.vue";
import { Message } from 'element-ui'
export default {
name: "Processcontent",
components: {ItemSelect},
components: {ItemSelect,ItemSelectBom},
data() {
return {
checkMaterial :null,
checkDevice :null,
//
loading: true,
//
@ -312,44 +311,63 @@ export default {
}
});
},
//
onItemSelectedEquipment(obj){
if(obj != undefined && obj != null){
console.log('返回',obj);
if(this.form.device == null){
//obj = obj.slice(1);
console.log("if获取的",obj);
console.log("if获取的device",this.form.device);
console.log("device是空if获取的obj",obj);
console.log("device是空if获取的device",this.form.device);
this.form.device = obj;
}else{
console.log("else获取的",obj);
console.log("else获取的device",this.form.device);
this.form.device = this.form.device +","+obj;
if(obj != undefined && obj != null){
const a = obj.split(',');
const len = obj.split(',').length;
console.log('切割的数组',obj.split(','));
a.forEach(item => {
this.checkDevice = this.form.device.search(item) != -1;
console.log("check的值",this.checkDevice);
if(this.checkDevice == true){
console.log("重复添加",true);
Message.warning('您已经添加过该设备,请勿重复添加!!!');
}else if(this.checkDevice == false){
this.form.device = this.form.device +","+item;
}
})
}
}
},
//
onItemSelectedBom(obj){
if(this.form.material == null){
console.log("material是空if获取的obj",obj);
console.log("material是空if获取的material",this.form.material);
this.form.material = obj;
}else{
if(obj != undefined && obj != null){
const a = obj.split(',');
const len = obj.split(',').length;
console.log('切割的数组',obj.split(','));
a.forEach(item => {
this.checkMaterial = this.form.material.search(item) != -1;
console.log("check的值",this.check);
if(this.checkMaterial == true){
console.log("重复添加",true);
Message.warning('您已经添加过该物料Bom,请勿重复添加!!!');
}else if(this.checkMaterial == false){
this.form.material = this.form.material +","+item;
}
})
}
}
}
},
// onItemSelectedBom(obj){
// if(obj != undefined && obj != null){
// console.log('',obj);
// if(this.form.material == null){
// //obj = obj.slice(1);
// console.log("if",obj);
// console.log("ifmaterial",this.form.material);
// this.form.material = obj;
// }else{
// console.log("else",obj);
// console.log("elsematerial",this.form.material);
// this.form.material = this.form.material +","+obj;
// }
// }
// },
//
handleSelectEquipment(){
this.$refs.itemSelect.showFlag = true;
},
//
// handleSelectBom(){
// this.$refs.itemSelectBom.showFlag = true;
// },
//
handleSelectBom(){
this.$refs.itemSelectBom.showFlag = true;
},
/** 删除按钮操作 */
handleDelete(row) {
const contentIds = row.contentId || this.ids;

@ -84,6 +84,7 @@ import { listProcess, getProcess, delProcess, addProcess, updateProcess ,listEqu
import { treeselect } from "@/api/wms/equipment";
// import Treeselect from "@riophae/vue-treeselect";
// import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import { Message } from 'element-ui'
export default {
name: "MdItemSingle",
@ -108,6 +109,9 @@ export default {
}, {
id: 'equ_type_bzx',
label: '包装线'
},{
id: 'equ_type_dsj',
label: '吊筛机'
}
]
}],

@ -3,14 +3,28 @@
v-if="showFlag"
:visible.sync="showFlag"
:modal= false
width="1100px"
center
width="1000px"
>
<el-row :gutter="20">
<!--分类数据-->
<!-- <el-col :span="4" :xs="24">
<div class="head-container">
<el-tree
:data="treeData"
node-key="id"
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="tree"
default-expand-all
@node-click="handleNodeClick"
/>
</div>
</el-col> -->
<!--BOM数据-->
<el-col :span="24" :xs="24">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="110px">
<el-form-item label="BOM物料编码" prop="itemCode" style="width:350px">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="105px" align="center">
<el-form-item label="BOM物料编码" prop="itemCode">
<el-input
v-model="queryParams.itemCode"
placeholder="请输入BOM物料编码"
@ -19,7 +33,7 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="BOM物料名称" prop="itemName" style="width:350px">
<el-form-item label="BOM物料名称" prop="itemName">
<el-input
v-model="queryParams.itemName"
placeholder="请输入BOM物料名称"
@ -33,7 +47,7 @@
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="itemList" @selection-change="handleBomSelectionChange" ref="myTable">
<el-table v-loading="loading" :data="itemList" @selection-change="handleBomSelectionChange" ref="myTable" >
<el-table-column width="50" align="center" type="selection">
<!-- <template v-slot="scope">
<el-radio v-model="selectedItemId" :label="scope.row.itemId" @change="handleRowChange(scope.row)">{{""}}</el-radio>
@ -41,9 +55,9 @@
</el-table-column>
<!-- 序号 -->
<el-table-column type="index" width="90" align="center" :index="indexMethod" label="序号"></el-table-column>
<el-table-column label="BOM物料编码" align="center" key="itemCode" prop="materialCode" v-if="columns[0].visible" >
<el-table-column label="BOM物料编码" align="center" key="itemCode" prop="bomCode" v-if="columns[0].visible" >
</el-table-column>
<el-table-column label="BOM物料名称" align="left" key="itemName" prop="materialDesc" v-if="columns[1].visible" :show-overflow-tooltip="true" />
<el-table-column label="BOM物料名称" align="left" key="itemName" prop="bomName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
</el-table>
<pagination
@ -56,9 +70,9 @@
</el-col>
</el-row>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitBomForm"> </el-button>
<el-button @click="showFlag=false"> </el-button>
</div>
<el-button type="primary" @click="submitBomForm"> </el-button>
<el-button @click="showFlag=false"> </el-button>
</div>
</el-dialog>
</template>
@ -69,6 +83,27 @@ export default {
// components: { Treeselect },
data() {
return {
// treeData: [{
// id: '1',
// label: 'BOM',
// children: [{
// id: 'equ_type_lg',
// label: ''
// }, {
// id: 'equ_type_cxj',
// label: ''
// }, {
// id: 'equ_type_hf',
// label: ''
// }, {
// id: 'equ_type_spj',
// label: ''
// }, {
// id: 'equ_type_bzx',
// label: '线'
// }
// ]
// }],
showFlag:false,
//
selectedItemId: undefined,
@ -86,7 +121,7 @@ export default {
//
itemTypeOptions: undefined,
//
materialCode: undefined,
bomCode: undefined,
defaultProps: {
id: "id",
label: "label"
@ -96,7 +131,7 @@ export default {
pageNum: 1,
pageSize: 10,
itemName: undefined,
materialCode: undefined,
bomCode: undefined,
itemTypeId: 0,
itemCodeGet: '',
},
@ -165,8 +200,8 @@ export default {
//
handleNodeClick(data) {
this.queryParams.materialCode = data.id;
console.log(this.materialCode);
this.queryParams.bomCode = data.id;
console.log(this.bomCode);
this.handleQuery();
},
@ -198,7 +233,7 @@ export default {
//
handleBomSelectionChange(selection) {
this.ids = selection.map(item => item.materialCode);
this.ids = selection.map(item => item.bomCode);
this.single = selection.length!==1;
this.multiple = !selection.length;
console.log("多选框",this.ids);
@ -229,13 +264,13 @@ export default {
submitBomForm() {
const data = this.ids;
console.log("数据",data);
const equipmentCode = data.toString();
console.log("拆分数据",materialCode);
const bomCode = data.toString();
console.log("拆分数据",bomCode);
console.log("原来的数据",this.queryParams.itemCodeGet);
if(this.queryParams.itemCodeGet == ""){
this.queryParams.itemCodeGet = materialCode;
this.queryParams.itemCodeGet = bomCode;
}else{
this.queryParams.itemCodeGet = this.queryParams.itemCodeGet + ','+ materialCode;
this.queryParams.itemCodeGet = this.queryParams.itemCodeGet + ','+ bomCode;
}
this.selectedRows = this.queryParams.itemCodeGet;
this.$emit('onSelected', this.selectedRows);

Loading…
Cancel
Save