|
@@ -6,6 +6,8 @@
|
|
|
<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 />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -45,109 +47,109 @@
|
|
|
|
|
|
|
|
<el-button type="primary" size="small" style="margin-bottom: 10px;" @click="handleAddTab">添加工序</el-button>
|
|
<el-button type="primary" size="small" style="margin-bottom: 10px;" @click="handleAddTab">添加工序</el-button>
|
|
|
|
|
|
|
|
- <el-tabs v-model="tabsValue" type="card" closable @tab-click="handleTab" @tab-remove="removeTab">
|
|
|
|
|
- <el-tab-pane v-for="(item) in tabsList" :key="item.name" :label="item.name" :name="item.id">
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+ <el-tabs v-model="tabsValue" type="card" closable @tab-click="handleTab" @tab-remove="removeTab">
|
|
|
|
|
+ <el-tab-pane v-for="(item, index) in tabsList" :key="item.id + index" :label="item.name" :name="item.id">
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
<header-title title="物料BOM" style="margin-top: 10px">
|
|
<header-title title="物料BOM" style="margin-top: 10px">
|
|
|
- <div>
|
|
|
|
|
- <el-button size="small" icon="el-icon-plus" class="ele-btn-icon" type="primary"
|
|
|
|
|
- @click="handleAdd(item.id)">新增</el-button>
|
|
|
|
|
- </div>
|
|
|
|
|
- </header-title>
|
|
|
|
|
-
|
|
|
|
|
- <el-card v-for="(bomItem, index) in form.bomList" :key="index">
|
|
|
|
|
- <el-row>
|
|
|
|
|
- <el-col :span="8">
|
|
|
|
|
- <el-form-item label="BOM编码:">
|
|
|
|
|
- {{ bomItem.code }}
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- </el-col>
|
|
|
|
|
-
|
|
|
|
|
- <el-col :span="8">
|
|
|
|
|
- <el-form-item label="BOM名称:" prop="name">
|
|
|
|
|
- {{ bomItem.name }}
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- </el-col>
|
|
|
|
|
-
|
|
|
|
|
- <el-col :span="8">
|
|
|
|
|
- <el-form-item label="版本号:" prop="version">
|
|
|
|
|
- {{ bomItem.version }}
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- </el-col>
|
|
|
|
|
-
|
|
|
|
|
- <el-col :span="8">
|
|
|
|
|
- <el-form-item label="状态:" prop="status">
|
|
|
|
|
- <el-select v-model="bomItem.status" placeholder="" filterable disabled>
|
|
|
|
|
- <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="生产版本:" prop="produceVersionId">
|
|
|
|
|
- <el-select v-model="bomItem.produceVersionId" filterable placeholder="请选择" disabled
|
|
|
|
|
- :style="{ width: '100%' }">
|
|
|
|
|
- <el-option v-for="item in versionList" :key="item.code" :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="所属工厂:" prop="factoryId">
|
|
|
|
|
- <factorySelect v-model="bomItem.factoryId" disabled />
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- </el-col>
|
|
|
|
|
-
|
|
|
|
|
- <el-col :span="8">
|
|
|
|
|
- <el-form-item label="基本数量:" prop="baseCount">
|
|
|
|
|
- <el-row>
|
|
|
|
|
- <el-col :span="12">
|
|
|
|
|
- {{ bomItem.baseCount }}
|
|
|
|
|
- </el-col>
|
|
|
|
|
- <el-col :span="2"> </el-col>
|
|
|
|
|
- <el-col :span="10">
|
|
|
|
|
- <DictSelection disabled dictName="计量单位:" v-model="bomItem.baseCountUnit" />
|
|
|
|
|
- </el-col>
|
|
|
|
|
- </el-row>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- </el-col>
|
|
|
|
|
- </el-row>
|
|
|
|
|
-
|
|
|
|
|
- <el-row>
|
|
|
|
|
- <div class="ele-body">
|
|
|
|
|
- <ele-pro-table ref="table" :columns="columns" :need-page="false" row-key="id"
|
|
|
|
|
- :datasource="bomItem.subDetailList" min-height="200px">
|
|
|
|
|
- <template v-slot:toolbar>
|
|
|
|
|
- <el-button type="primary" size="small" @click="openEdit(index)">编辑</el-button>
|
|
|
|
|
-
|
|
|
|
|
- <el-popconfirm class="ele-action" title="确定要删除此物料BOM?" @confirm="remove(bomItem)">
|
|
|
|
|
- <template v-slot:reference>
|
|
|
|
|
- <el-button type="danger" size="small" icon="el-icon-delete">
|
|
|
|
|
- 删除
|
|
|
|
|
- </el-button>
|
|
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <el-button size="small" icon="el-icon-plus" class="ele-btn-icon" type="primary"
|
|
|
|
|
+ @click="handleAdd(item.id)">新增</el-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </header-title>
|
|
|
|
|
+
|
|
|
|
|
+ <el-card v-for="(bomItem, index) in form.bomList" :key="index">
|
|
|
|
|
+ <el-row>
|
|
|
|
|
+ <el-col :span="8">
|
|
|
|
|
+ <el-form-item label="BOM编码:">
|
|
|
|
|
+ {{ bomItem.code }}
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+
|
|
|
|
|
+ <el-col :span="8">
|
|
|
|
|
+ <el-form-item label="BOM名称:" prop="name">
|
|
|
|
|
+ {{ bomItem.name }}
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+
|
|
|
|
|
+ <el-col :span="8">
|
|
|
|
|
+ <el-form-item label="版本号:" prop="version">
|
|
|
|
|
+ {{ bomItem.version }}
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+
|
|
|
|
|
+ <el-col :span="8">
|
|
|
|
|
+ <el-form-item label="状态:" prop="status">
|
|
|
|
|
+ <el-select v-model="bomItem.status" placeholder="" filterable disabled>
|
|
|
|
|
+ <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="生产版本:" prop="produceVersionId">
|
|
|
|
|
+ <el-select v-model="bomItem.produceVersionId" filterable placeholder="请选择" disabled
|
|
|
|
|
+ :style="{ width: '100%' }">
|
|
|
|
|
+ <el-option v-for="item in versionList" :key="item.code"
|
|
|
|
|
+ :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="所属工厂:" prop="factoryId">
|
|
|
|
|
+ <factorySelect v-model="bomItem.factoryId" disabled />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+
|
|
|
|
|
+ <el-col :span="8">
|
|
|
|
|
+ <el-form-item label="基本数量:" prop="baseCount">
|
|
|
|
|
+ <el-row>
|
|
|
|
|
+ <el-col :span="12">
|
|
|
|
|
+ {{ bomItem.baseCount }}
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ <el-col :span="2"> </el-col>
|
|
|
|
|
+ <el-col :span="10">
|
|
|
|
|
+ <DictSelection disabled dictName="计量单位:" v-model="bomItem.baseCountUnit" />
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ </el-row>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ </el-row>
|
|
|
|
|
+
|
|
|
|
|
+ <el-row>
|
|
|
|
|
+ <div class="ele-body">
|
|
|
|
|
+ <ele-pro-table ref="table" :columns="columns" :need-page="false" row-key="id"
|
|
|
|
|
+ :datasource="bomItem.subDetailList" min-height="200px">
|
|
|
|
|
+ <template v-slot:toolbar>
|
|
|
|
|
+ <el-button type="primary" size="small" @click="openEdit(index)">编辑</el-button>
|
|
|
|
|
+
|
|
|
|
|
+ <el-popconfirm class="ele-action" title="确定要删除此物料BOM?" @confirm="remove(bomItem)">
|
|
|
|
|
+ <template v-slot:reference>
|
|
|
|
|
+ <el-button type="danger" size="small" icon="el-icon-delete">
|
|
|
|
|
+ 删除
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-popconfirm>
|
|
|
</template>
|
|
</template>
|
|
|
- </el-popconfirm>
|
|
|
|
|
- </template>
|
|
|
|
|
- </ele-pro-table>
|
|
|
|
|
- </div>
|
|
|
|
|
- </el-row>
|
|
|
|
|
- </el-card>
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+ </ele-pro-table>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-row>
|
|
|
|
|
+ </el-card>
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
</el-tab-pane>
|
|
</el-tab-pane>
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
</el-tabs>
|
|
</el-tabs>
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -179,7 +181,7 @@
|
|
|
import MaterialAdd from './MaterialAdd.vue';
|
|
import MaterialAdd from './MaterialAdd.vue';
|
|
|
import { pageList } from '@/api/technology/version/version.js';
|
|
import { pageList } from '@/api/technology/version/version.js';
|
|
|
import { getCategoryBom } from '@/api/material/product';
|
|
import { getCategoryBom } from '@/api/material/product';
|
|
|
-import { bomDelete, saveBatch, bomTaskList } from '@/api/material/BOM';
|
|
|
|
|
|
|
+import { bomDelete, saveBatch, bomTaskList, bomTaskDelete, getByTaskId } from '@/api/material/BOM';
|
|
|
import factorySelect from '@/components/CommomSelect/factory-select.vue';
|
|
import factorySelect from '@/components/CommomSelect/factory-select.vue';
|
|
|
import Production from '@/views/technology/route/components/production/index.vue'
|
|
import Production from '@/views/technology/route/components/production/index.vue'
|
|
|
|
|
|
|
@@ -334,9 +336,9 @@ export default {
|
|
|
this.$emit('update:visible', value);
|
|
this.$emit('update:visible', value);
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- async getCategoryBomFn() {
|
|
|
|
|
- const res = await getCategoryBom(this.categoryId);
|
|
|
|
|
- this.form.bomList = res.bomList;
|
|
|
|
|
|
|
+ async getCategoryBomFn(taskId) {
|
|
|
|
|
+ const res = await getByTaskId(this.categoryId, taskId);
|
|
|
|
|
+ this.form.bomList = res;
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
remove(row) {
|
|
remove(row) {
|
|
@@ -350,49 +352,42 @@ export default {
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- done() {
|
|
|
|
|
|
|
+ done(taskId) {
|
|
|
this.materialShow = false
|
|
this.materialShow = false
|
|
|
- this.getCategoryBomFn();
|
|
|
|
|
|
|
+ this.getCategoryBomFn(taskId);
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
handleAddTab() {
|
|
handleAddTab() {
|
|
|
this.tableData = this.tabsList
|
|
this.tableData = this.tabsList
|
|
|
- this.addDialog = true;
|
|
|
|
|
|
|
+ this.addDialog = true;
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- handleTab() {
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+ handleTab(e) {
|
|
|
|
|
+ this.getCategoryBomFn(e.name);
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
removeTab(targetName) {
|
|
removeTab(targetName) {
|
|
|
-
|
|
|
|
|
- let tabs = this.tabsList;
|
|
|
|
|
- let activeName = this.tabsValue;
|
|
|
|
|
- if (activeName === targetName) {
|
|
|
|
|
- tabs.forEach((tab, index) => {
|
|
|
|
|
- if (tab.id === targetName) {
|
|
|
|
|
- let nextTab = tabs[index + 1] || tabs[index - 1];
|
|
|
|
|
- if (nextTab) {
|
|
|
|
|
- activeName = nextTab.name;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- this.tabsValue = activeName;
|
|
|
|
|
- this.tabsList = tabs.filter(tab => tab.id !== targetName);
|
|
|
|
|
- },
|
|
|
|
|
|
|
+
|
|
|
|
|
+ this.tabsList.forEach(e => {
|
|
|
|
|
+ if (e.id == targetName) {
|
|
|
|
|
+ bomTaskDelete([e.oldId]).then(res => {
|
|
|
|
|
+ this.taskListHead()
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
|
|
|
|
|
/*关闭选择参数*/
|
|
/*关闭选择参数*/
|
|
|
closeAdd() {
|
|
closeAdd() {
|
|
|
- this.$refs.ProductionCom.$refs.table.setSelectedRows([]);
|
|
|
|
|
|
|
+ // this.$refs.ProductionCom.$refs.table.setSelectedRows([]);
|
|
|
this.addDialog = false;
|
|
this.addDialog = false;
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
addParamrter() {
|
|
addParamrter() {
|
|
|
- let arr = [] ;
|
|
|
|
|
- arr = this.$refs.ProductionCom.selection.map(m => {
|
|
|
|
|
|
|
+ let arr = [];
|
|
|
|
|
+ arr = this.$refs.ProductionCom.selection.map(m => {
|
|
|
return {
|
|
return {
|
|
|
sourceTaskId: m.id,
|
|
sourceTaskId: m.id,
|
|
|
...m
|
|
...m
|
|
@@ -401,20 +396,20 @@ export default {
|
|
|
this.tabsList = arr
|
|
this.tabsList = arr
|
|
|
this.addDialog = false;
|
|
this.addDialog = false;
|
|
|
|
|
|
|
|
- if( this.tabsList.length > 0) {
|
|
|
|
|
|
|
+ if (this.tabsList.length > 0) {
|
|
|
this.tabsValue = this.tabsList[0].id
|
|
this.tabsValue = this.tabsList[0].id
|
|
|
|
|
|
|
|
this.saveBatchFn()
|
|
this.saveBatchFn()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
// 保存
|
|
// 保存
|
|
|
saveBatchFn() {
|
|
saveBatchFn() {
|
|
|
- let arr = [] ;
|
|
|
|
|
- arr = this.tabsList.map(m => {
|
|
|
|
|
|
|
+ let arr = [];
|
|
|
|
|
+ arr = this.tabsList.map(m => {
|
|
|
return {
|
|
return {
|
|
|
taskId: m.id,
|
|
taskId: m.id,
|
|
|
sort: m.sort,
|
|
sort: m.sort,
|
|
@@ -431,13 +426,14 @@ export default {
|
|
|
bomTaskList(this.categoryId).then(res => {
|
|
bomTaskList(this.categoryId).then(res => {
|
|
|
let arr = []
|
|
let arr = []
|
|
|
arr = res.map(m => {
|
|
arr = res.map(m => {
|
|
|
- return {
|
|
|
|
|
- sourceTaskId: m.id,
|
|
|
|
|
- id: m.taskId,
|
|
|
|
|
- name: m.taskName
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- this.tabsList = arr
|
|
|
|
|
|
|
+ return {
|
|
|
|
|
+ oldId: m.id,
|
|
|
|
|
+ sourceTaskId: m.id,
|
|
|
|
|
+ id: m.taskId,
|
|
|
|
|
+ name: m.taskName
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ this.tabsList = arr
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
|
|
|
|
@@ -447,10 +443,10 @@ export default {
|
|
|
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.categoryId = this.data.id;
|
|
|
- this.getCategoryBomFn();
|
|
|
|
|
|
|
+
|
|
|
this.$util.assignObject(this.form, {
|
|
this.$util.assignObject(this.form, {
|
|
|
...this.data
|
|
...this.data
|
|
|
});
|
|
});
|
|
@@ -469,6 +465,5 @@ export default {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-<style lang="scss" scoped>
|
|
|
|
|
-</style>
|
|
|
|
|
|
|
+<style lang="scss" scoped></style>
|
|
|
|
|
|