|
|
|
<template>
|
|
|
|
<el-dialog title="BOM物料选择"
|
|
|
|
v-if="showFlag"
|
|
|
|
:visible.sync="showFlag"
|
|
|
|
:modal= false
|
|
|
|
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="105px" align="center">
|
|
|
|
<el-form-item label="BOM物料编码" prop="itemCode">
|
|
|
|
<el-input
|
|
|
|
v-model="queryParams.component"
|
|
|
|
placeholder="请输入BOM物料编码"
|
|
|
|
clearable
|
|
|
|
style="width: 240px"
|
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
|
/>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="产品名称" prop="itemName">
|
|
|
|
<el-input
|
|
|
|
v-model="queryParams.componentName"
|
|
|
|
placeholder="请输入产品名称"
|
|
|
|
clearable
|
|
|
|
style="width: 240px"
|
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
|
/>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item>
|
|
|
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
|
|
<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-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>
|
|
|
|
</template> -->
|
|
|
|
</el-table-column>
|
|
|
|
<!-- 序号 -->
|
|
|
|
<el-table-column type="index" width="90" align="center" :index="indexMethod" label="序号"></el-table-column>
|
|
|
|
<el-table-column label="BOM物料组件编码" align="left" key="component" prop="component" v-if="columns[2].visible" :show-overflow-tooltip="true" />
|
|
|
|
<el-table-column label="BOM物料组件名称" align="left" key="componentName" prop="componentName" v-if="columns[3].visible" :show-overflow-tooltip="true" />
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
<pagination
|
|
|
|
v-show="total>0"
|
|
|
|
:total="total"
|
|
|
|
:page.sync="queryParams.pageNum"
|
|
|
|
:limit.sync="queryParams.pageSize"
|
|
|
|
@pagination="getList"
|
|
|
|
/>
|
|
|
|
</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-dialog>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
|
|
|
|
import {listBom} from "@/api/technology/process";
|
|
|
|
export default {
|
|
|
|
name: "ItemSingleBom",
|
|
|
|
// components: { Treeselect },
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
showFlag:false,
|
|
|
|
// 选中数组
|
|
|
|
selectedItemId: undefined,
|
|
|
|
selectedRows: undefined,
|
|
|
|
// 非单个禁用
|
|
|
|
single: true,
|
|
|
|
// 非多个禁用
|
|
|
|
multiple: true,
|
|
|
|
// 显示搜索条件
|
|
|
|
showSearch: true,
|
|
|
|
// 总条数
|
|
|
|
total: 0,
|
|
|
|
// BOM产品表格数据
|
|
|
|
itemList: null,
|
|
|
|
// 树选项
|
|
|
|
itemTypeOptions: undefined,
|
|
|
|
//树名称
|
|
|
|
bomCode: undefined,
|
|
|
|
defaultProps: {
|
|
|
|
id: "id",
|
|
|
|
label: "label"
|
|
|
|
},
|
|
|
|
// 查询参数
|
|
|
|
queryParams: {
|
|
|
|
pageNum: 1,
|
|
|
|
pageSize: 10,
|
|
|
|
itemName: undefined,
|
|
|
|
component: '',
|
|
|
|
//itemTypeId: 0,
|
|
|
|
itemCodeGet: '',
|
|
|
|
componentName : ''
|
|
|
|
},
|
|
|
|
// 列信息
|
|
|
|
columns: [
|
|
|
|
{ key: 0, label: `BOM物料编码`, visible: true },
|
|
|
|
{ key: 1, label: `产品名称`, visible: true },
|
|
|
|
{ key: 2, label: `BOM物料组件编码`, visible: true },
|
|
|
|
{ key: 3, label: `BOM物料组件名称`, visible: true }
|
|
|
|
]
|
|
|
|
};
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
this.getList();
|
|
|
|
// this.getTreeselect();
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
handleEquipmentSelectionChange (val) {
|
|
|
|
this.itemList = val
|
|
|
|
},
|
|
|
|
|
|
|
|
// 生成表头序号
|
|
|
|
indexMethod(index){
|
|
|
|
return index+1 ;
|
|
|
|
},
|
|
|
|
//
|
|
|
|
|
|
|
|
/** 查询BOM列表*/
|
|
|
|
getList() {
|
|
|
|
this.loading = true;
|
|
|
|
this.queryParams.bomCode = this.queryParams.itemCode;
|
|
|
|
this.queryParams.productDescZh = this.queryParams.itemName;
|
|
|
|
listBom(this.queryParams).then(response => {
|
|
|
|
this.itemList = response.rows;
|
|
|
|
this.total = response.total;
|
|
|
|
this.loading = false;
|
|
|
|
}
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
|
|
|
/** 查询分类下拉树结构 */
|
|
|
|
// getTreeselect() {
|
|
|
|
// treeselect().then(response => {
|
|
|
|
// this.itemTypeOptions = response.rows;
|
|
|
|
// console.log(response.rows);
|
|
|
|
// num = response.total;
|
|
|
|
// for (let id of response.rows) {
|
|
|
|
// if(id == 'equ_type_lg'){
|
|
|
|
// lable = '料罐';
|
|
|
|
// }else if(id == 'equ_type_hf'){
|
|
|
|
// lable = '烘房';
|
|
|
|
// }else if(id == 'equ_type_cpj'){
|
|
|
|
// lable = '收坯机';
|
|
|
|
// }else if(id == 'equ_type_bzx'){
|
|
|
|
// lable = '包装线';
|
|
|
|
// }else if(id == 'equ_type_cxj'){
|
|
|
|
// lable = '成型机';
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
// },
|
|
|
|
|
|
|
|
// 筛选节点
|
|
|
|
filterNode(value, data) {
|
|
|
|
console.log(value, data);
|
|
|
|
if (!value) return true;
|
|
|
|
return data.label.indexOf(value) !== -1;
|
|
|
|
},
|
|
|
|
|
|
|
|
// 节点单击事件
|
|
|
|
handleNodeClick(data) {
|
|
|
|
this.queryParams.bomCode = data.id;
|
|
|
|
console.log(this.bomCode);
|
|
|
|
this.handleQuery();
|
|
|
|
},
|
|
|
|
|
|
|
|
/** 搜索按钮操作 */
|
|
|
|
handleQuery() {
|
|
|
|
this.queryParams.pageNum = 1;
|
|
|
|
this.getList();
|
|
|
|
},
|
|
|
|
|
|
|
|
/** 重置按钮操作 */
|
|
|
|
resetQuery() {
|
|
|
|
this.resetForm("queryForm");
|
|
|
|
this.handleQuery();
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 多选框选中数据
|
|
|
|
handleBomSelectionChange(selection) {
|
|
|
|
this.ids = selection.map(item => item.component);
|
|
|
|
this.single = selection.length!==1;
|
|
|
|
this.multiple = !selection.length;
|
|
|
|
console.log("多选框",this.ids);
|
|
|
|
},
|
|
|
|
|
|
|
|
submitBomForm() {
|
|
|
|
const data = this.ids;
|
|
|
|
console.log("数据",data);
|
|
|
|
const bomCode = data.toString();
|
|
|
|
console.log("拆分数据",bomCode);
|
|
|
|
console.log("原来的数据",this.queryParams.itemCodeGet);
|
|
|
|
if(this.queryParams.itemCodeGet == ""){
|
|
|
|
this.queryParams.itemCodeGet = bomCode;
|
|
|
|
}else{
|
|
|
|
this.queryParams.itemCodeGet = this.queryParams.itemCodeGet + ','+ bomCode;
|
|
|
|
}
|
|
|
|
this.selectedRows = this.queryParams.itemCodeGet;
|
|
|
|
this.$emit('onSelected', this.selectedRows);
|
|
|
|
this.showFlag = false;
|
|
|
|
this.queryParams.itemCodeGet = "";
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|