|
|
|
@ -45,18 +45,18 @@
|
|
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<!-- <el-form-item label="激活标识" prop="activeFlag">-->
|
|
|
|
|
<!-- <el-select v-model="queryParams.activeFlag" placeholder="请选择激活标识" clearable>-->
|
|
|
|
|
<!-- <el-option-->
|
|
|
|
|
<!-- v-for="dict in dict.type.active_flag"-->
|
|
|
|
|
<!-- :key="dict.value"-->
|
|
|
|
|
<!-- :label="dict.label"-->
|
|
|
|
|
<!-- :value="dict.value"-->
|
|
|
|
|
<!-- />-->
|
|
|
|
|
<!-- </el-select>-->
|
|
|
|
|
<!-- </el-form-item>-->
|
|
|
|
|
<!-- <el-form-item label="激活标识" prop="activeFlag">-->
|
|
|
|
|
<!-- <el-select v-model="queryParams.activeFlag" placeholder="请选择激活标识" clearable>-->
|
|
|
|
|
<!-- <el-option-->
|
|
|
|
|
<!-- v-for="dict in dict.type.active_flag"-->
|
|
|
|
|
<!-- :key="dict.value"-->
|
|
|
|
|
<!-- :label="dict.label"-->
|
|
|
|
|
<!-- :value="dict.value"-->
|
|
|
|
|
<!-- />-->
|
|
|
|
|
<!-- </el-select>-->
|
|
|
|
|
<!-- </el-form-item>-->
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
|
|
|
<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>
|
|
|
|
@ -70,7 +70,8 @@
|
|
|
|
|
size="mini"
|
|
|
|
|
@click="handleAdd"
|
|
|
|
|
v-hasPermi="['mes:materialBom:add']"
|
|
|
|
|
>新增</el-button>
|
|
|
|
|
>新增
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button
|
|
|
|
@ -79,9 +80,10 @@
|
|
|
|
|
icon="el-icon-sort"
|
|
|
|
|
size="mini"
|
|
|
|
|
@click="toggleExpandAll"
|
|
|
|
|
>展开/折叠</el-button>
|
|
|
|
|
>展开/折叠
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
|
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
<el-table
|
|
|
|
@ -92,24 +94,24 @@
|
|
|
|
|
:default-expand-all="isExpandAll"
|
|
|
|
|
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
|
|
|
|
>
|
|
|
|
|
<el-table-column label="父级标识" prop="parentId" v-if="columns[1].visible"/>
|
|
|
|
|
<el-table-column label="父级标识" prop="parentId" v-if="columns[1].visible"/>
|
|
|
|
|
<el-table-column label="祖级列表" align="center" prop="ancestors" v-if="columns[2].visible"/>
|
|
|
|
|
<el-table-column label="物料ID" align="center" prop="materialId" v-if="columns[3].visible"/>
|
|
|
|
|
<el-table-column label="物料名称" align="left" prop="materialName" v-if="columns[4].visible"/>
|
|
|
|
|
<el-table-column label="BOM说明" align="center" prop="materialBomDesc" v-if="columns[15].visible"/>
|
|
|
|
|
<el-table-column label="物料名称" align="left" prop="materialName" v-if="columns[4].visible"/>
|
|
|
|
|
<el-table-column label="BOM说明" align="center" prop="materialBomDesc" v-if="columns[15].visible"/>
|
|
|
|
|
<el-table-column label="标准数量" align="center" prop="standardAmount" v-if="columns[5].visible"/>
|
|
|
|
|
<el-table-column label="顶级标识" align="center" prop="topFlag" v-if="columns[6].visible">
|
|
|
|
|
<el-table-column label="顶级标识" align="center" prop="topFlag" v-if="columns[6].visible">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<dict-tag :options="dict.type.active_flag" :value="scope.row.topFlag"/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="校验类型" align="center" prop="checkType" v-if="columns[7].visible">
|
|
|
|
|
<el-table-column label="校验类型" align="center" prop="checkType" v-if="columns[7].visible">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<dict-tag :options="dict.type.check_type" :value="scope.row.checkType"/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="项目ID" align="center" prop="projectId" v-if="columns[8].visible"/>
|
|
|
|
|
<el-table-column label="激活标识" align="center" prop="activeFlag" v-if="columns[9].visible">
|
|
|
|
|
<el-table-column label="激活标识" align="center" prop="activeFlag" v-if="columns[9].visible">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<dict-tag :options="dict.type.active_flag" :value="scope.row.activeFlag"/>
|
|
|
|
|
</template>
|
|
|
|
@ -123,21 +125,24 @@
|
|
|
|
|
icon="el-icon-edit"
|
|
|
|
|
@click="handleUpdate(scope.row)"
|
|
|
|
|
v-hasPermi="['mes:materialBom:edit']"
|
|
|
|
|
>修改</el-button>
|
|
|
|
|
>修改
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button
|
|
|
|
|
size="mini"
|
|
|
|
|
type="text"
|
|
|
|
|
icon="el-icon-plus"
|
|
|
|
|
@click="handleAdd(scope.row)"
|
|
|
|
|
v-hasPermi="['mes:materialBom:add']"
|
|
|
|
|
>新增子BOM</el-button>
|
|
|
|
|
>新增子BOM
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button
|
|
|
|
|
size="mini"
|
|
|
|
|
type="text"
|
|
|
|
|
icon="el-icon-delete"
|
|
|
|
|
@click="handleDelete(scope.row)"
|
|
|
|
|
v-hasPermi="['mes:materialBom:remove']"
|
|
|
|
|
>删除</el-button>
|
|
|
|
|
>删除
|
|
|
|
|
</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
@ -145,43 +150,44 @@
|
|
|
|
|
<!-- 添加或修改物料BOM信息对话框 -->
|
|
|
|
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
|
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
|
|
|
|
<el-form-item label="父级BOM" prop="parentId" >
|
|
|
|
|
<el-form-item label="父级BOM" prop="parentId">
|
|
|
|
|
<treeselect v-model="form.parentId" :options="materialBomOptions" :normalizer="normalizer" disabled/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<!-- <el-form-item label="物料ID" prop="materialId">-->
|
|
|
|
|
<!-- <el-input v-model="form.materialId" placeholder="请输入物料ID" />-->
|
|
|
|
|
<!-- </el-form-item>-->
|
|
|
|
|
<!-- <el-form-item label="物料ID" prop="materialId">-->
|
|
|
|
|
<!-- <el-input v-model="form.materialId" placeholder="请输入物料ID" />-->
|
|
|
|
|
<!-- </el-form-item>-->
|
|
|
|
|
<el-form-item label="子级BOM" prop="materialName">
|
|
|
|
|
<el-input v-model="form.materialName" placeholder="请点击右侧检索子BOM" readonly>
|
|
|
|
|
<el-button slot="append" icon="el-icon-search" @click="handleMaterialAdd"></el-button>
|
|
|
|
|
<el-button slot="append" icon="el-icon-search" @click="handleMaterialAdd"></el-button>
|
|
|
|
|
</el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="BOM说明" prop="materialBomDesc" >
|
|
|
|
|
<el-input v-model="form.materialBomDesc" placeholder="请输入BOM说明(BOM版本)" />
|
|
|
|
|
<el-form-item label="BOM说明" prop="materialBomDesc">
|
|
|
|
|
<el-input v-model="form.materialBomDesc" placeholder="请输入BOM说明(BOM版本)"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="标准数量" prop="standardAmount">
|
|
|
|
|
<el-input-number v-model="form.standardAmount" :min="1" placeholder="请输入标准数量" />
|
|
|
|
|
<el-input-number v-model="form.standardAmount" :min="1" placeholder="请输入标准数量"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<!-- <el-form-item label="顶级标识" prop="topFlag">-->
|
|
|
|
|
<!-- <el-radio-group v-model="form.topFlag">-->
|
|
|
|
|
<!-- <el-radio-->
|
|
|
|
|
<!-- v-for="dict in dict.type.active_flag"-->
|
|
|
|
|
<!-- :key="dict.value"-->
|
|
|
|
|
<!-- :label="parseInt(dict.value)"-->
|
|
|
|
|
<!-- >{{dict.label}}</el-radio>-->
|
|
|
|
|
<!-- </el-radio-group>-->
|
|
|
|
|
<!-- </el-form-item>-->
|
|
|
|
|
<!-- <el-form-item label="顶级标识" prop="topFlag">-->
|
|
|
|
|
<!-- <el-radio-group v-model="form.topFlag">-->
|
|
|
|
|
<!-- <el-radio-->
|
|
|
|
|
<!-- v-for="dict in dict.type.active_flag"-->
|
|
|
|
|
<!-- :key="dict.value"-->
|
|
|
|
|
<!-- :label="parseInt(dict.value)"-->
|
|
|
|
|
<!-- >{{dict.label}}</el-radio>-->
|
|
|
|
|
<!-- </el-radio-group>-->
|
|
|
|
|
<!-- </el-form-item>-->
|
|
|
|
|
<el-form-item label="校验类型" prop="checkType">
|
|
|
|
|
<el-radio-group v-model="form.checkType">
|
|
|
|
|
<el-radio
|
|
|
|
|
v-for="dict in dict.type.check_type"
|
|
|
|
|
:key="dict.value"
|
|
|
|
|
:label="dict.value"
|
|
|
|
|
>{{dict.label}}</el-radio>
|
|
|
|
|
>{{ dict.label }}
|
|
|
|
|
</el-radio>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="项目ID" prop="projectId">
|
|
|
|
|
<el-input v-model="form.projectId" placeholder="请输入项目ID" />
|
|
|
|
|
<el-input v-model="form.projectId" placeholder="请输入项目ID"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="激活标识" prop="activeFlag">
|
|
|
|
|
<el-radio-group v-model="form.activeFlag">
|
|
|
|
@ -189,11 +195,12 @@
|
|
|
|
|
v-for="dict in dict.type.active_flag"
|
|
|
|
|
:key="dict.value"
|
|
|
|
|
:label="dict.value"
|
|
|
|
|
>{{dict.label}}</el-radio>
|
|
|
|
|
>{{ dict.label }}
|
|
|
|
|
</el-radio>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="备注" prop="remark">
|
|
|
|
|
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
|
|
|
|
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
|
@ -203,7 +210,7 @@
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
<!-- 添加物料信息对话框 -->
|
|
|
|
|
<el-dialog title="选择物料信息" :visible.sync="materialOpen" append-to-body>
|
|
|
|
|
<el-dialog title="选择物料信息" :visible.sync="materialOpen" append-to-body>
|
|
|
|
|
<add-bom @selection="handleSelection" ref="materialRef"></add-bom>
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
|
|
<el-button type="primary" @click="submitMaterialForm">确 定</el-button>
|
|
|
|
@ -215,10 +222,17 @@
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { listMaterialBom, getMaterialBom, delMaterialBom, addMaterialBom, updateMaterialBom } from "@/api/mes/materialBom";
|
|
|
|
|
import {
|
|
|
|
|
listMaterialBom,
|
|
|
|
|
getMaterialBom,
|
|
|
|
|
delMaterialBom,
|
|
|
|
|
addMaterialBom,
|
|
|
|
|
updateMaterialBom
|
|
|
|
|
} from "@/api/mes/materialBom";
|
|
|
|
|
import Treeselect from "@riophae/vue-treeselect";
|
|
|
|
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
|
|
import addBom from '@//views/mes/materialBom/addBom.vue';
|
|
|
|
|
import {verifyBOMIsProduction} from "@//api/mes/productOrder";
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: "MaterialBom",
|
|
|
|
@ -265,36 +279,36 @@ export default {
|
|
|
|
|
// 表单校验
|
|
|
|
|
rules: {
|
|
|
|
|
materialId: [
|
|
|
|
|
{ required: true, message: "物料ID不能为空", trigger: "blur" }
|
|
|
|
|
{required: true, message: "物料ID不能为空", trigger: "blur"}
|
|
|
|
|
],
|
|
|
|
|
materialBomDesc: [
|
|
|
|
|
{required: true, message: "BOM说明不能为空", trigger: "blur"}
|
|
|
|
|
],
|
|
|
|
|
standardAmount: [
|
|
|
|
|
{ required: true, message: "标准数量不能为空", trigger: "blur" }
|
|
|
|
|
{required: true, message: "标准数量不能为空", trigger: "blur"}
|
|
|
|
|
],
|
|
|
|
|
activeFlag: [
|
|
|
|
|
{ required: true, message: "激活标识不能为空", trigger: "change" }
|
|
|
|
|
{required: true, message: "激活标识不能为空", trigger: "change"}
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
columns: [
|
|
|
|
|
{ key: 0, label: `主键标识`, visible: false },
|
|
|
|
|
{ key: 1, label: `父级标识`, visible: false },
|
|
|
|
|
{ key: 2, label: `祖级列表`, visible: false },
|
|
|
|
|
{ key: 3, label: `物料ID`, visible: false },
|
|
|
|
|
{ key: 4, label: `物料名称`, visible: true },
|
|
|
|
|
{ key: 5, label: `标准数量`, visible: true },
|
|
|
|
|
{ key: 6, label: `顶级标识`, visible: true },
|
|
|
|
|
{ key: 7, label: `校验类型`, visible: true },
|
|
|
|
|
{ key: 8, label: `项目ID`, visible: false },
|
|
|
|
|
{ key: 9, label: `激活标识`, visible: false },
|
|
|
|
|
{ key: 10, label: `备注`, visible: false },
|
|
|
|
|
{ key: 11, label: `创建人`, visible: true },
|
|
|
|
|
{ key: 12, label: `创建时间`, visible: true },
|
|
|
|
|
{ key: 13, label: `更新人`, visible: true },
|
|
|
|
|
{ key: 14, label: `更新时间`, visible: true },
|
|
|
|
|
{ key: 15, label: `BOM说明`, visible: true },
|
|
|
|
|
],
|
|
|
|
|
columns: [
|
|
|
|
|
{key: 0, label: `主键标识`, visible: false},
|
|
|
|
|
{key: 1, label: `父级标识`, visible: false},
|
|
|
|
|
{key: 2, label: `祖级列表`, visible: false},
|
|
|
|
|
{key: 3, label: `物料ID`, visible: false},
|
|
|
|
|
{key: 4, label: `物料名称`, visible: true},
|
|
|
|
|
{key: 5, label: `标准数量`, visible: true},
|
|
|
|
|
{key: 6, label: `顶级标识`, visible: true},
|
|
|
|
|
{key: 7, label: `校验类型`, visible: true},
|
|
|
|
|
{key: 8, label: `项目ID`, visible: false},
|
|
|
|
|
{key: 9, label: `激活标识`, visible: false},
|
|
|
|
|
{key: 10, label: `备注`, visible: false},
|
|
|
|
|
{key: 11, label: `创建人`, visible: true},
|
|
|
|
|
{key: 12, label: `创建时间`, visible: true},
|
|
|
|
|
{key: 13, label: `更新人`, visible: true},
|
|
|
|
|
{key: 14, label: `更新时间`, visible: true},
|
|
|
|
|
{key: 15, label: `BOM说明`, visible: true},
|
|
|
|
|
],
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
@ -320,11 +334,11 @@ export default {
|
|
|
|
|
children: node.children
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
/** 查询物料BOM信息下拉树结构 */
|
|
|
|
|
/** 查询物料BOM信息下拉树结构 */
|
|
|
|
|
getTreeselect() {
|
|
|
|
|
listMaterialBom().then(response => {
|
|
|
|
|
this.materialBomOptions = [];
|
|
|
|
|
const data = { materialBomId: 0, materialName: '顶级节点', children: [] };
|
|
|
|
|
const data = {materialBomId: 0, materialName: '顶级节点', children: []};
|
|
|
|
|
data.children = this.handleTree(response.data, "materialBomId", "parentId");
|
|
|
|
|
this.materialBomOptions.push(data);
|
|
|
|
|
});
|
|
|
|
@ -371,13 +385,22 @@ export default {
|
|
|
|
|
this.getTreeselect();
|
|
|
|
|
if (row != null && row.materialBomId) {
|
|
|
|
|
this.form.parentId = row.materialBomId;
|
|
|
|
|
verifyBOMIsProduction(row.materialBomId).then(res => {
|
|
|
|
|
if (res.data) {
|
|
|
|
|
throw Error()
|
|
|
|
|
}
|
|
|
|
|
//BOM说明,顶级不能为空,在选择bom时可以用此字段区分
|
|
|
|
|
this.rules.materialBomDesc[0].required = this.form.parentId === 0;
|
|
|
|
|
this.open = true;
|
|
|
|
|
this.title = "添加物料BOM信息";
|
|
|
|
|
|
|
|
|
|
}).catch((e) => {
|
|
|
|
|
this.$modal.msgError("该物料BOM已被生产工单选择,无法新增!");
|
|
|
|
|
return;
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
this.form.parentId = 0;
|
|
|
|
|
}
|
|
|
|
|
//BOM说明,顶级不能为空,在选择bom时可以用此字段区分
|
|
|
|
|
this.rules.materialBomDesc[0].required = this.form.parentId === 0;
|
|
|
|
|
this.open = true;
|
|
|
|
|
this.title = "添加物料BOM信息";
|
|
|
|
|
},
|
|
|
|
|
/** 新增按钮操作 */
|
|
|
|
|
handleMaterialAdd() {
|
|
|
|
@ -397,14 +420,20 @@ export default {
|
|
|
|
|
this.getTreeselect();
|
|
|
|
|
if (row != null) {
|
|
|
|
|
this.form.parentId = row.materialBomId;
|
|
|
|
|
verifyBOMIsProduction(row.materialBomId).then(res => {
|
|
|
|
|
if (res.data) {
|
|
|
|
|
this.$modal.msgError("该物料BOM已被生产工单选择,无法修改!");
|
|
|
|
|
} else {
|
|
|
|
|
getMaterialBom(row.materialBomId).then(response => {
|
|
|
|
|
this.form = response.data;
|
|
|
|
|
//BOM说明,顶级不能为空,在选择bom时可以用此字段区分
|
|
|
|
|
this.rules.materialBomDesc[0].required = this.form.parentId === 0;
|
|
|
|
|
this.open = true;
|
|
|
|
|
this.title = "修改物料BOM信息";
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
getMaterialBom(row.materialBomId).then(response => {
|
|
|
|
|
this.form = response.data;
|
|
|
|
|
//BOM说明,顶级不能为空,在选择bom时可以用此字段区分
|
|
|
|
|
this.rules.materialBomDesc[0].required = this.form.parentId === 0;
|
|
|
|
|
this.open = true;
|
|
|
|
|
this.title = "修改物料BOM信息";
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
/** 提交按钮 */
|
|
|
|
|
submitForm() {
|
|
|
|
@ -428,7 +457,7 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
handleSelection(selection) {
|
|
|
|
|
this.ids = selection.map(item => item.materialBomId)
|
|
|
|
|
this.single = selection.length!==1
|
|
|
|
|
this.single = selection.length !== 1
|
|
|
|
|
this.multiple = !selection.length
|
|
|
|
|
},
|
|
|
|
|
/** 提交物料信息按钮 */
|
|
|
|
@ -440,12 +469,21 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
/** 删除按钮操作 */
|
|
|
|
|
handleDelete(row) {
|
|
|
|
|
this.$modal.confirm('是否确认删除物料BOM信息编号为"' + row.materialBomId + '"的数据项?').then(function() {
|
|
|
|
|
return delMaterialBom(row.materialBomId);
|
|
|
|
|
}).then(() => {
|
|
|
|
|
this.getList();
|
|
|
|
|
this.$modal.msgSuccess("删除成功");
|
|
|
|
|
}).catch(() => {});
|
|
|
|
|
verifyBOMIsProduction(row.materialBomId).then(res => {
|
|
|
|
|
if (res.data) {
|
|
|
|
|
throw Error()
|
|
|
|
|
}
|
|
|
|
|
this.$modal.confirm('是否确认删除物料名称为"' + row.materialName + '"的数据项?').then(function () {
|
|
|
|
|
return delMaterialBom(row.materialBomId);
|
|
|
|
|
}).then(() => {
|
|
|
|
|
this.getList();
|
|
|
|
|
this.$modal.msgSuccess("删除成功");
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
});
|
|
|
|
|
}).catch((e) => {
|
|
|
|
|
this.$modal.msgError("该物料BOM已被生产工单选择,无法删除!");
|
|
|
|
|
return;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|