You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

285 lines
7.4 KiB
Vue

<template>
<div class="app-container">
2 years ago
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="88px">
<el-form-item label="BOM单号" prop="bomCode">
<el-input
v-model="queryParams.bomCode"
placeholder="请输入BOM单号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
2 years ago
<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-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['wms:bom:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
2 years ago
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['wms:bom:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['wms:bom:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
2 years ago
icon="el-icon-download"
size="mini"
2 years ago
@click="handleExport"
v-hasPermi="['wms:bom:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>-->
<el-table
v-loading="loading"
:data="bomList"
@selection-change="handleSelectionChange"
row-key="bomCode"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
>
<el-table-column type="selection" align="center" />
2 years ago
<!-- 序号 -->
<el-table-column type="index" width="90" align="center" :index="indexMethod" label="序号"></el-table-column>
<el-table-column label="BOM单号" width="120" align="center" prop="bomCode" />
<el-table-column label="物料编码" width="200" align="center" prop="productCode" />
<el-table-column label="组件上层物料编码" width="200" align="center" prop="cumc" />
<el-table-column label="组件编码" width="120" align="center" prop="component" />
<el-table-column label="BOM层次" align="center" prop="bomHierarchy" />
<el-table-column label="项目编号" align="center" prop="projectNo" />
<el-table-column label="标准用量" align="center" prop="standardDosage" />
<el-table-column label="损耗率" align="center" prop="lossRate" />
<el-table-column label="损耗额" align="center" prop="lossAmount" />
<el-table-column label="含损耗用量" align="center" prop="cilosses" />
2 years ago
<el-table-column label="组件数量单位" align="center" prop="componentUnit" />
<el-table-column label="组件采购标志" align="center" prop="componentProFlag" />
<el-table-column label="物料供应标识" align="center" prop="msi"/>
<el-table-column label="成本核算标识相关" align="center" prop="sanka"/>
<el-table-column label="创建人" align="center" prop="createBy" />
<el-table-column label="创建时间" width="200" align="center" prop="createTime" />
</el-table>
2 years ago
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
2 years ago
import { listBom, getBom, delBom, addBom, updateBom,listBomComponent} from "@/api/wms/bom";
export default {
name: "Bom",
data() {
return {
// 遮罩层
loading: true,
2 years ago
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
2 years ago
// 总条数
total: 0,
// BOM物料管理表格数据
bomList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
2 years ago
pageNum: 1,
pageSize: 10,
factoryCode: null,
productionVersion: null,
bomCode: null,
optionalBom: null,
optionalBomText: null,
pvvd: null,
pved: null,
bomCalculateNumber: null,
bomCalculateUnit: null,
bomBaseNumber: null,
bomBaseUnit: null,
componentUnit: null,
componentProFlag: null,
msi: null,
sanka: null,
attr1: null,
attr2: null,
attr3: null,
currentVersion: null
},
// 表单参数
form: {},
// 表单校验
rules: {
2 years ago
createTime: [
{ required: true, message: "创建时间不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getList();
},
methods: {
2 years ago
// 生成表头序号
indexMethod(index){
return index+1 ;
},
/** 查询BOM物料管理列表 */
getList() {
this.loading = true;
2 years ago
listBomComponent(this.queryParams).then(response => {
2 years ago
this.bomList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
2 years ago
factoryCode: null,
productionVersion: null,
bomCode: null,
optionalBom: null,
optionalBomText: null,
pvvd: null,
pved: null,
bomCalculateNumber: null,
bomCalculateUnit: null,
bomBaseNumber: null,
bomBaseUnit: null,
componentUnit: null,
componentProFlag: null,
msi: null,
sanka: null,
attr1: null,
attr2: null,
attr3: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
2 years ago
remark: null,
currentVersion: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
2 years ago
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
2 years ago
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.factoryCode)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
2 years ago
handleAdd() {
this.reset();
this.open = true;
2 years ago
this.title = "添加BOM物料管理";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
2 years ago
const factoryCode = row.factoryCode || this.ids
getBom(factoryCode).then(response => {
this.form = response.data;
this.open = true;
2 years ago
this.title = "修改BOM物料管理";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
2 years ago
if (this.form.factoryCode != null) {
updateBom(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addBom(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
2 years ago
const factoryCodes = row.factoryCode || this.ids;
this.$modal.confirm('是否确认删除BOM物料管理编号为"' + factoryCodes + '"的数据项?').then(function() {
return delBom(factoryCodes);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
2 years ago
},
/** 导出按钮操作 */
handleExport() {
this.download('wms/bom/export', {
...this.queryParams
}, `bom_${new Date().getTime()}.xlsx`)
}
}
};
</script>