|
|
@@ -59,79 +59,97 @@
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
- <header-title title="物料BOM"></header-title>
|
|
|
+ <header-title title="物料BOM">
|
|
|
+ <div>
|
|
|
+ <el-button size="small" icon="el-icon-plus" class="ele-btn-icon" type="primary"
|
|
|
+ @click="handleAdd">新增</el-button>
|
|
|
|
|
|
- <el-row>
|
|
|
+ </div>
|
|
|
+ </header-title>
|
|
|
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="BOM编码:" prop="bomCode">
|
|
|
- <el-input v-model="form.bomCode" @click.native="chooseBom" />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
+ <el-card v-for="(bomItem, index) in form.list" :key="index">
|
|
|
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="BOM名称:" prop="bomName">
|
|
|
- <el-input placeholder="自动带入" disabled v-model="form.bomName" />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
+ <el-row>
|
|
|
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="BOM版本:" prop="bomVersion">
|
|
|
- <el-input placeholder="自动带入" disabled v-model="form.bomVersion" />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="BOM编码:">
|
|
|
+ <el-input v-model="bomItem.bomCode" @click.native="chooseBom(index)" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="状态:" prop="status">
|
|
|
- <el-select v-model="form.status" placeholder="" filterable>
|
|
|
- <el-option v-for="item in statusList" :key="item.value" :label="item.label" :value="item.value">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="BOM名称:" prop="bomName">
|
|
|
+ <el-input placeholder="自动带入" disabled v-model="bomItem.bomName" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
|
|
|
-
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="生产版本:" prop="produceVersionId">
|
|
|
- <el-select v-model="form.produceVersionId" filterable placeholder="清选择" :style="{ width: '100%' }">
|
|
|
- <el-option v-for="item in versionList" :key="item.id" :label="item.code + '-' + item.name" :value="item.id">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="BOM版本:" prop="bomVersion">
|
|
|
+ <el-input placeholder="自动带入" disabled v-model="bomItem.bomVersion" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="状态:" prop="status">
|
|
|
+ <el-select v-model="bomItem.status" placeholder="" filterable>
|
|
|
+ <el-option v-for="item in statusList" :key="item.value" :label="item.label"
|
|
|
+ :value="item.value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
|
|
|
- </el-row>
|
|
|
|
|
|
|
|
|
- <el-row>
|
|
|
|
|
|
- <div class="ele-body">
|
|
|
- <ele-pro-table ref="table" :datasource="datasource" :columns="columns">
|
|
|
- <!-- 表头工具栏 -->
|
|
|
- <template v-slot:toolbar>
|
|
|
|
|
|
- <el-button size="small" icon="el-icon-plus" class="ele-btn-icon" type="primary"
|
|
|
- @click.native="openParam">添加物料BOM</el-button>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="生产版本:" prop="produceVersionId">
|
|
|
+ <el-select v-model="bomItem.produceVersionId" filterable placeholder="清选择"
|
|
|
+ :style="{ width: '100%' }">
|
|
|
+ <el-option v-for="item in versionList" :key="item.id" :label="item.code + '-' + item.name"
|
|
|
+ :value="item.id">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
|
|
|
- </template>
|
|
|
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-button size="small" type="danger" icon="el-icon-delete" @click="removeBom(index)"
|
|
|
+ style="margin-left: 120px">删除</el-button>
|
|
|
+ </el-col>
|
|
|
|
|
|
|
|
|
- <!-- 操作列 -->
|
|
|
- <template v-slot:action="{ row }">
|
|
|
- <el-popconfirm class="ele-action" title="确定要删除当前物料吗?" @confirm="remove(row)">
|
|
|
- <template v-slot:reference>
|
|
|
- <el-link type="danger" :underline="false" icon="el-icon-delete">
|
|
|
- 删除
|
|
|
- </el-link>
|
|
|
- </template>
|
|
|
- </el-popconfirm>
|
|
|
- </template>
|
|
|
- </ele-pro-table>
|
|
|
- </div>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+
|
|
|
+ <el-row>
|
|
|
+
|
|
|
+ <div class="ele-body">
|
|
|
+ <ele-pro-table ref="table" :datasource="bomItem.materialList" :columns="columns">
|
|
|
+ <!-- 表头工具栏 -->
|
|
|
+ <template v-slot:toolbar>
|
|
|
+ <el-button size="small" icon="el-icon-plus" class="ele-btn-icon" type="primary"
|
|
|
+ @click.native="openParam(index)">添加物料</el-button>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <!-- 操作列 -->
|
|
|
+ <template v-slot:action="{ row }">
|
|
|
+ <el-popconfirm class="ele-action" title="确定要删除当前物料吗?" @confirm="remove(row)">
|
|
|
+ <template v-slot:reference>
|
|
|
+ <el-link type="danger" :underline="false" icon="el-icon-delete">
|
|
|
+ 删除
|
|
|
+ </el-link>
|
|
|
+ </template>
|
|
|
+ </el-popconfirm>
|
|
|
+ </template>
|
|
|
+ </ele-pro-table>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </el-row>
|
|
|
+ </el-card>
|
|
|
|
|
|
- </el-row>
|
|
|
|
|
|
|
|
|
|
|
|
@@ -184,14 +202,27 @@ export default {
|
|
|
modelType: '',
|
|
|
brandNum: '',
|
|
|
specification: '',
|
|
|
- measuringUnit: ''
|
|
|
+ measuringUnit: '',
|
|
|
|
|
|
+ list: [
|
|
|
+ {
|
|
|
+ bomCode: '',
|
|
|
+ bomName: '',
|
|
|
+ bomVersion: '',
|
|
|
+ status: '',
|
|
|
+ produceVersionId: '',
|
|
|
+ materialList: []
|
|
|
+ }
|
|
|
+ ]
|
|
|
|
|
|
};
|
|
|
return {
|
|
|
defaultForm,
|
|
|
// 表单数据
|
|
|
- form: { ...defaultForm },
|
|
|
+ form: {
|
|
|
+ ...defaultForm,
|
|
|
+
|
|
|
+ },
|
|
|
|
|
|
versionList: [],
|
|
|
|
|
|
@@ -284,18 +315,17 @@ export default {
|
|
|
|
|
|
chooseModal(data) {
|
|
|
this.$refs.table.setData([...data, ...this.$refs.table.getData()]);
|
|
|
-
|
|
|
},
|
|
|
|
|
|
- chooseBom() {
|
|
|
- this.$refs.bomRefs.open(this.form)
|
|
|
+ chooseBom(index) {
|
|
|
+ this.$refs.bomRefs.open(this.form, index)
|
|
|
},
|
|
|
|
|
|
- changeBom(row) {
|
|
|
- this.$set(this.form, 'bomName', row.name)
|
|
|
- this.$set(this.form, 'bomId', row.id)
|
|
|
- this.$set(this.form, 'bomCode', row.code)
|
|
|
- this.$set(this.form, 'bomVersion', row.version)
|
|
|
+ changeBom(row, idx) {
|
|
|
+ this.$set(this.form.list[idx], 'bomName', row.name)
|
|
|
+ this.$set(this.form.list[idx], 'bomId', row.id)
|
|
|
+ this.$set(this.form.list[idx], 'bomCode', row.code)
|
|
|
+ this.$set(this.form.list[idx], 'bomVersion', row.version)
|
|
|
},
|
|
|
|
|
|
/* 删除 */
|
|
|
@@ -317,12 +347,27 @@ export default {
|
|
|
|
|
|
|
|
|
async getVersionList() {
|
|
|
- const res = await pageList({
|
|
|
- pageNum: 1,
|
|
|
- size: 100
|
|
|
- });
|
|
|
- this.versionList = res.list
|
|
|
- },
|
|
|
+ const res = await pageList({
|
|
|
+ pageNum: 1,
|
|
|
+ size: 100
|
|
|
+ });
|
|
|
+ this.versionList = res.list
|
|
|
+ },
|
|
|
+
|
|
|
+ handleAdd() {
|
|
|
+ this.form.list.push({
|
|
|
+ bomCode: '',
|
|
|
+ bomName: '',
|
|
|
+ bomVersion: '',
|
|
|
+ status: '',
|
|
|
+ produceVersionId: '',
|
|
|
+ materialList: []
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ removeBom(index) {
|
|
|
+ this.form.list.splice(index, 1)
|
|
|
+ },
|
|
|
|
|
|
|
|
|
/* 保存编辑 */
|
|
|
@@ -353,6 +398,7 @@ export default {
|
|
|
if (this.data) {
|
|
|
|
|
|
this.$util.assignObject(this.form, {
|
|
|
+ ...this.defaultForm,
|
|
|
...this.data
|
|
|
});
|
|
|
|