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

master
A0010407 1 year ago
parent 703951a9c1
commit 7466d725f9

@ -110,18 +110,13 @@
<ItemSelect ref="itemSelect" @onSelected="onItemSelectedEquipment" > </ItemSelect> <ItemSelect ref="itemSelect" @onSelected="onItemSelectedEquipment" > </ItemSelect>
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- <el-col :span="12"> <el-col :span="12">
<el-form-item label="BOM材料" prop="material"> <el-form-item label="BOM材料" prop="material">
<el-input v-model="form.material" placeholder="请选择BOM材料" > <el-input v-model="form.material" placeholder="请选择BOM材料" >
<el-button slot="append" @click="handleSelectBom" icon="el-icon-search"></el-button> <el-button slot="append" @click="handleSelectBom" icon="el-icon-search"></el-button>
</el-input> </el-input>
<ItemSelectBom ref="itemSelectBom" @onSelected="onItemSelectedBom" ></ItemSelectBom> <ItemSelectBom ref="itemSelectBom" @onSelected="onItemSelectedBom" ></ItemSelectBom>
</el-form-item> </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-col>
</el-row> </el-row>
<el-row> <el-row>
@ -174,12 +169,16 @@
<script> <script>
import { listProcesscontent, getProcesscontent, delProcesscontent, addProcesscontent, updateProcesscontent } from "@/api/technology/recipecontent"; import { listProcesscontent, getProcesscontent, delProcesscontent, addProcesscontent, updateProcesscontent } from "@/api/technology/recipecontent";
import ItemSelect from "./single.vue"; import ItemSelect from "./single.vue";
// import ItemSelectBom from "./singleBom.vue"; import ItemSelectBom from "./singleBom.vue";
import { Message } from 'element-ui'
export default { export default {
name: "Processcontent", name: "Processcontent",
components: {ItemSelect}, components: {ItemSelect,ItemSelectBom},
data() { data() {
return { return {
checkMaterial :null,
checkDevice :null,
// //
loading: true, loading: true,
// //
@ -312,44 +311,63 @@ export default {
} }
}); });
}, },
//
onItemSelectedEquipment(obj){ onItemSelectedEquipment(obj){
if(obj != undefined && obj != null){
console.log('返回',obj);
if(this.form.device == null){ if(this.form.device == null){
//obj = obj.slice(1); console.log("device是空if获取的obj",obj);
console.log("if获取的",obj); console.log("device是空if获取的device",this.form.device);
console.log("if获取的device",this.form.device);
this.form.device = obj; this.form.device = obj;
}else{ }else{
console.log("else获取的",obj); if(obj != undefined && obj != null){
console.log("else获取的device",this.form.device); const a = obj.split(',');
this.form.device = this.form.device +","+obj; 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(){ handleSelectEquipment(){
this.$refs.itemSelect.showFlag = true; this.$refs.itemSelect.showFlag = true;
}, },
// //
// handleSelectBom(){ handleSelectBom(){
// this.$refs.itemSelectBom.showFlag = true; this.$refs.itemSelectBom.showFlag = true;
// }, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const contentIds = row.contentId || this.ids; 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 "@/api/wms/equipment";
// import Treeselect from "@riophae/vue-treeselect"; // import Treeselect from "@riophae/vue-treeselect";
// import "@riophae/vue-treeselect/dist/vue-treeselect.css"; // import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import { Message } from 'element-ui'
export default { export default {
name: "MdItemSingle", name: "MdItemSingle",
@ -108,6 +109,9 @@ export default {
}, { }, {
id: 'equ_type_bzx', id: 'equ_type_bzx',
label: '包装线' label: '包装线'
},{
id: 'equ_type_dsj',
label: '吊筛机'
} }
] ]
}], }],

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

Loading…
Cancel
Save