|
@@ -5,7 +5,6 @@
|
|
|
<header-title title="基本信息"></header-title>
|
|
<header-title title="基本信息"></header-title>
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
|
|
<el-row>
|
|
<el-row>
|
|
|
-
|
|
|
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
|
<el-form-item label="产品名称:" prop="name">
|
|
<el-form-item label="产品名称:" prop="name">
|
|
|
<el-input disabled v-model="form.name" readonly />
|
|
<el-input disabled v-model="form.name" readonly />
|
|
@@ -18,9 +17,6 @@
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
|
<el-form-item label="型号:" prop="modelType">
|
|
<el-form-item label="型号:" prop="modelType">
|
|
|
<el-input disabled v-model="form.modelType" placeholder="自动带入" />
|
|
<el-input disabled v-model="form.modelType" placeholder="自动带入" />
|
|
@@ -33,40 +29,28 @@
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
|
|
|
|
|
-
|
|
|
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
|
<el-form-item label="规格:" prop="specification">
|
|
<el-form-item label="规格:" prop="specification">
|
|
|
<el-input disabled v-model="form.specification" placeholder="自动带入" />
|
|
<el-input disabled v-model="form.specification" placeholder="自动带入" />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
|
|
|
|
|
-
|
|
|
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
|
<el-form-item label="计量单位:" prop="measuringUnit">
|
|
<el-form-item label="计量单位:" prop="measuringUnit">
|
|
|
<el-input disabled v-model="form.measuringUnit" placeholder="自动带入" />
|
|
<el-input disabled v-model="form.measuringUnit" placeholder="自动带入" />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
</el-row>
|
|
</el-row>
|
|
|
|
|
|
|
|
-
|
|
|
|
|
<header-title title="物料BOM">
|
|
<header-title title="物料BOM">
|
|
|
<div>
|
|
<div>
|
|
|
<el-button size="small" icon="el-icon-plus" class="ele-btn-icon" type="primary"
|
|
<el-button size="small" icon="el-icon-plus" class="ele-btn-icon" type="primary"
|
|
|
@click="handleAdd">新增</el-button>
|
|
@click="handleAdd">新增</el-button>
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
</div>
|
|
</div>
|
|
|
</header-title>
|
|
</header-title>
|
|
|
|
|
|
|
|
- <el-card v-for="(bomItem, index) in form.list" :key="index">
|
|
|
|
|
-
|
|
|
|
|
|
|
+ <el-card v-for="(bomItem, index) in form.bomList" :key="index">
|
|
|
<el-row>
|
|
<el-row>
|
|
|
-
|
|
|
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
|
<el-form-item label="BOM编码:">
|
|
<el-form-item label="BOM编码:">
|
|
|
{{ bomItem.code }}
|
|
{{ bomItem.code }}
|
|
@@ -95,7 +79,6 @@
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
|
|
|
|
|
-
|
|
|
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
|
<el-form-item label="生产版本:" prop="produceVersionId">
|
|
<el-form-item label="生产版本:" prop="produceVersionId">
|
|
|
<el-select v-model="bomItem.produceVersionId" filterable placeholder="清选择" disabled
|
|
<el-select v-model="bomItem.produceVersionId" filterable placeholder="清选择" disabled
|
|
@@ -126,75 +109,46 @@
|
|
|
</el-row>
|
|
</el-row>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
</el-row>
|
|
</el-row>
|
|
|
|
|
|
|
|
-
|
|
|
|
|
<el-row>
|
|
<el-row>
|
|
|
-
|
|
|
|
|
<div class="ele-body">
|
|
<div class="ele-body">
|
|
|
- <ele-pro-table ref="table" :datasource="bomItem.materialList" row-key="id" :columns="columns">
|
|
|
|
|
- <!-- 表头工具栏 -->
|
|
|
|
|
|
|
+ <ele-pro-table ref="table" :columns="columns" :need-page="false" row-key="id"
|
|
|
|
|
+ :datasource="bomItem.subDetailList" min-height="200px">
|
|
|
<template v-slot:toolbar>
|
|
<template v-slot:toolbar>
|
|
|
- <el-button size="small" icon="el-icon-plus" class="ele-btn-icon" type="primary"
|
|
|
|
|
- @click.native="openParam(index)">添加物料</el-button>
|
|
|
|
|
-
|
|
|
|
|
- <el-button size="small" type="danger" icon="el-icon-delete"
|
|
|
|
|
- @click="removeBom(index)">删除</el-button>
|
|
|
|
|
-
|
|
|
|
|
- </template>
|
|
|
|
|
|
|
+ <el-button type="primary" size="small" @click="openEdit(index)">编辑</el-button>
|
|
|
|
|
|
|
|
- <!-- 操作列 -->
|
|
|
|
|
- <template v-slot:action="{ row }">
|
|
|
|
|
- <el-popconfirm class="ele-action" title="确定要删除当前物料吗?" @confirm="remove(index, row)">
|
|
|
|
|
|
|
+ <el-popconfirm class="ele-action" title="确定要删除此物料BOM?" @confirm="remove(bomItem)">
|
|
|
<template v-slot:reference>
|
|
<template v-slot:reference>
|
|
|
- <el-link type="danger" :underline="false" icon="el-icon-delete">
|
|
|
|
|
|
|
+ <el-button type="danger" size="small" icon="el-icon-delete">
|
|
|
删除
|
|
删除
|
|
|
- </el-link>
|
|
|
|
|
|
|
+ </el-button>
|
|
|
</template>
|
|
</template>
|
|
|
</el-popconfirm>
|
|
</el-popconfirm>
|
|
|
</template>
|
|
</template>
|
|
|
</ele-pro-table>
|
|
</ele-pro-table>
|
|
|
</div>
|
|
</div>
|
|
|
-
|
|
|
|
|
</el-row>
|
|
</el-row>
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
</el-card>
|
|
</el-card>
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
</el-form>
|
|
</el-form>
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- <!-- 选择物料弹窗 -->
|
|
|
|
|
- <materialDialog ref="materiaRef" @chooseModal="chooseModal"></materialDialog>
|
|
|
|
|
-
|
|
|
|
|
<!-- 物料Bom -->
|
|
<!-- 物料Bom -->
|
|
|
- <MaterialAdd :visible.sync="materialShow" :categoryId="categoryId" ref="materialAddRef"></MaterialAdd>
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+ <MaterialAdd :visible.sync="materialShow" :data="current" :categoryId="categoryId" @done="done"
|
|
|
|
|
+ ref="materialAddRef">
|
|
|
|
|
+ </MaterialAdd>
|
|
|
</ele-modal>
|
|
</ele-modal>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
-import materialDialog from '@/components/material'
|
|
|
|
|
-import MaterialAdd from './MaterialAdd.vue'
|
|
|
|
|
-import { pageList } from '@/api/technology/version/version.js';
|
|
|
|
|
-import { getCategoryBom } from '@/api/material/product'
|
|
|
|
|
|
|
|
|
|
|
|
+import MaterialAdd from './MaterialAdd.vue';
|
|
|
|
|
+import { pageList } from '@/api/technology/version/version.js';
|
|
|
|
|
+import { getCategoryBom } from '@/api/material/product';
|
|
|
|
|
+import { bomDelete } from '@/api/material/BOM';
|
|
|
import factorySelect from '@/components/CommomSelect/factory-select.vue';
|
|
import factorySelect from '@/components/CommomSelect/factory-select.vue';
|
|
|
|
|
+
|
|
|
export default {
|
|
export default {
|
|
|
components: {
|
|
components: {
|
|
|
- materialDialog,
|
|
|
|
|
MaterialAdd,
|
|
MaterialAdd,
|
|
|
factorySelect
|
|
factorySelect
|
|
|
},
|
|
},
|
|
@@ -215,91 +169,76 @@ export default {
|
|
|
specification: '',
|
|
specification: '',
|
|
|
measuringUnit: '',
|
|
measuringUnit: '',
|
|
|
|
|
|
|
|
- list: [
|
|
|
|
|
- ]
|
|
|
|
|
-
|
|
|
|
|
|
|
+ bomList: []
|
|
|
};
|
|
};
|
|
|
return {
|
|
return {
|
|
|
defaultForm,
|
|
defaultForm,
|
|
|
// 表单数据
|
|
// 表单数据
|
|
|
form: {
|
|
form: {
|
|
|
- ...defaultForm,
|
|
|
|
|
-
|
|
|
|
|
|
|
+ ...defaultForm
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
versionList: [],
|
|
versionList: [],
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
// 表单验证规则
|
|
// 表单验证规则
|
|
|
rules: {
|
|
rules: {
|
|
|
categoryName: [
|
|
categoryName: [
|
|
|
{ required: true, message: '请输入产品名称', trigger: 'blur' }
|
|
{ required: true, message: '请输入产品名称', trigger: 'blur' }
|
|
|
- ],
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+ ]
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
-
|
|
|
|
|
columns: [
|
|
columns: [
|
|
|
-
|
|
|
|
|
{
|
|
{
|
|
|
- prop: 'code',
|
|
|
|
|
- label: '编码'
|
|
|
|
|
|
|
+ type: 'index',
|
|
|
|
|
+ width: 55,
|
|
|
|
|
+ align: 'center'
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- prop: 'name',
|
|
|
|
|
- label: '名称',
|
|
|
|
|
- showOverflowTooltip: true
|
|
|
|
|
|
|
+ label: '子项编号',
|
|
|
|
|
+ prop: 'subCode',
|
|
|
|
|
+ action: 'subCode'
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- prop: 'brandNum',
|
|
|
|
|
- label: '牌号'
|
|
|
|
|
|
|
+ label: '物料名称',
|
|
|
|
|
+ prop: 'categoryName',
|
|
|
|
|
+ action: 'categoryName'
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- prop: 'modelType',
|
|
|
|
|
- label: '型号'
|
|
|
|
|
|
|
+ label: '物料编码',
|
|
|
|
|
+ prop: 'categoryCode'
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- prop: 'weightUnit',
|
|
|
|
|
- label: '重量单位'
|
|
|
|
|
|
|
+ label: '牌号',
|
|
|
|
|
+ prop: 'brandNum'
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- prop: 'netWeight',
|
|
|
|
|
- label: '净重'
|
|
|
|
|
|
|
+ label: '型号',
|
|
|
|
|
+ prop: 'modelType'
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
{
|
|
{
|
|
|
- columnKey: 'action',
|
|
|
|
|
- label: '操作',
|
|
|
|
|
-
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- resizable: false,
|
|
|
|
|
- slot: 'action',
|
|
|
|
|
- showOverflowTooltip: true
|
|
|
|
|
|
|
+ label: '净重',
|
|
|
|
|
+ prop: 'count'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '重量单位',
|
|
|
|
|
+ prop: 'unit'
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
],
|
|
],
|
|
|
|
|
|
|
|
-
|
|
|
|
|
statusList: [
|
|
statusList: [
|
|
|
{ label: '草稿', value: -1 },
|
|
{ label: '草稿', value: -1 },
|
|
|
{ label: '失效', value: 0 },
|
|
{ label: '失效', value: 0 },
|
|
|
{ label: '生效', value: 1 }
|
|
{ label: '生效', value: 1 }
|
|
|
],
|
|
],
|
|
|
|
|
|
|
|
-
|
|
|
|
|
// 提交状态
|
|
// 提交状态
|
|
|
loading: false,
|
|
loading: false,
|
|
|
|
|
|
|
|
-
|
|
|
|
|
categoryId: null,
|
|
categoryId: null,
|
|
|
|
|
|
|
|
- tableData: [],
|
|
|
|
|
|
|
+ current: null,
|
|
|
|
|
|
|
|
materialShow: false
|
|
materialShow: false
|
|
|
-
|
|
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
@@ -309,87 +248,71 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- openParam(index) {
|
|
|
|
|
- this.tableData = this.form.list[index].materialList
|
|
|
|
|
- this.$refs.materiaRef.open(this.tableData, '选择物料', '1', index)
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- chooseModal(data, id, idx) {
|
|
|
|
|
- this.$set(this.form.list[idx], 'materialList', data)
|
|
|
|
|
-
|
|
|
|
|
|
|
+ openEdit(index) {
|
|
|
|
|
+ this.current = this.form.bomList[index];
|
|
|
|
|
+ console.log(this.current);
|
|
|
|
|
+ this.materialShow = true;
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- /* 删除 */
|
|
|
|
|
- remove(index, row) {
|
|
|
|
|
- console.log(row)
|
|
|
|
|
- this.form.list[index].materialList = this.form.list[index].materialList.filter((d) => d.id !== row.id)
|
|
|
|
|
-
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
/* 表格数据源 */
|
|
/* 表格数据源 */
|
|
|
datasource({ page, limit, where }) {
|
|
datasource({ page, limit, where }) {
|
|
|
- return []
|
|
|
|
|
|
|
+ return [];
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
-
|
|
|
|
|
async getVersionList() {
|
|
async getVersionList() {
|
|
|
const res = await pageList({
|
|
const res = await pageList({
|
|
|
pageNum: 1,
|
|
pageNum: 1,
|
|
|
size: 100
|
|
size: 100
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- this.versionList = res.list
|
|
|
|
|
|
|
+ this.versionList = res.list;
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
handleAdd() {
|
|
handleAdd() {
|
|
|
- this.materialShow = true
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- removeBom(index) {
|
|
|
|
|
- this.form.list.splice(index, 1)
|
|
|
|
|
|
|
+ this.current = null;
|
|
|
|
|
+ this.materialShow = true;
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
/* 更新visible */
|
|
/* 更新visible */
|
|
|
updateVisible(value) {
|
|
updateVisible(value) {
|
|
|
this.$emit('update:visible', value);
|
|
this.$emit('update:visible', value);
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
async getCategoryBomFn() {
|
|
async getCategoryBomFn() {
|
|
|
- const res = await getCategoryBom(this.categoryId)
|
|
|
|
|
- this.form.list = res.bomList
|
|
|
|
|
- console.log(res)
|
|
|
|
|
|
|
+ const res = await getCategoryBom(this.categoryId);
|
|
|
|
|
+ this.form.bomList = res.bomList;
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
|
|
+ remove(row) {
|
|
|
|
|
+ bomDelete([row.id])
|
|
|
|
|
+ .then((message) => {
|
|
|
|
|
+ this.$message.success(message);
|
|
|
|
|
+ this.getCategoryBomFn();
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch((e) => {
|
|
|
|
|
+ this.$message.error(e.message);
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ done() {
|
|
|
|
|
+ this.materialShow = false
|
|
|
|
|
+ this.getCategoryBomFn();
|
|
|
|
|
+ },
|
|
|
|
|
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
watch: {
|
|
watch: {
|
|
|
async visible(visible) {
|
|
async visible(visible) {
|
|
|
if (visible) {
|
|
if (visible) {
|
|
|
- this.getVersionList()
|
|
|
|
|
|
|
+ this.getVersionList();
|
|
|
if (this.data) {
|
|
if (this.data) {
|
|
|
- this.categoryId = this.data.id
|
|
|
|
|
- this.getCategoryBomFn()
|
|
|
|
|
|
|
+ this.categoryId = this.data.id;
|
|
|
|
|
+ this.getCategoryBomFn();
|
|
|
this.$util.assignObject(this.form, {
|
|
this.$util.assignObject(this.form, {
|
|
|
...this.data
|
|
...this.data
|
|
|
});
|
|
});
|
|
|
-
|
|
|
|
|
} else {
|
|
} else {
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
} else {
|
|
} else {
|
|
|
this.$refs.form.clearValidate();
|
|
this.$refs.form.clearValidate();
|
|
|
this.form = { ...this.defaultForm };
|
|
this.form = { ...this.defaultForm };
|