ysy 2 rokov pred
rodič
commit
7f18817f59

+ 4 - 0
src/views/material/product/components/MaterialAdd.vue

@@ -6,7 +6,9 @@
             <header-title title="物料BOM"> </header-title>
 
             <el-row>
+              
                 <el-col :span="8">
+                  
                     <el-form-item label="BOM编码:" prop="code">
                         <el-input v-model="form.code" disabled />
                     </el-form-item>
@@ -143,6 +145,7 @@ export default {
         // 修改回显的数据
         categoryId: [String, Number],
         data: Object,
+        taskId:  [String, Number],
     },
     data() {
 
@@ -360,6 +363,7 @@ export default {
 
                 if (!this.isUpdate) {
                     delete this.form.id;
+                    this.form['taskId'] = this.taskId
                 }
 
                 const data = {

+ 33 - 21
src/views/material/product/components/MaterialModal.vue

@@ -43,25 +43,17 @@
             </el-row>
 
 
+            <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, index) in tabsList" :key="index" :label="item.name" :name="item.workCenterId">
-            
+                <el-tab-pane v-for="(item) in tabsList" :key="item.name" :label="item.name" :name="item.id">
             
-
             
-                </el-tab-pane>
 
-             
-             
-                <el-tab-pane label="添加工序" name="add" :closable="false" >
-                </el-tab-pane>
-            </el-tabs>
-
-                        
-            <header-title title="物料BOM">
+                    <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">新增</el-button>
+                        @click="handleAdd(item.id)">新增</el-button>
                 </div>
             </header-title>
 
@@ -147,12 +139,22 @@
                 </el-row>
             </el-card>
 
+            
+                </el-tab-pane>
+
+             
+      
+            </el-tabs>
+
+                        
+     
+
 
 
         </el-form>
 
         <!-- 物料Bom -->
-        <MaterialAdd :visible.sync="materialShow" :data="current" :categoryId="categoryId" @done="done"
+        <MaterialAdd :visible.sync="materialShow" :taskId="taskId" :data="current" :categoryId="categoryId" @done="done"
             ref="materialAddRef">
         </MaterialAdd>
 
@@ -287,6 +289,9 @@ export default {
             tabsList: [],
             tableData: [],
 
+
+            taskId: null,
+
             addDialog: false,
             tabsValue: null
         };
@@ -318,7 +323,8 @@ export default {
             this.versionList = res.list;
         },
 
-        handleAdd() {
+        handleAdd(id) {
+            this.taskId = id
             this.current = null;
             this.materialShow = true;
         },
@@ -349,11 +355,13 @@ export default {
             this.getCategoryBomFn();
         },
 
-        handleTab() {
-            if(this.tabsValue == 'add') {
-                this.tableData = this.tabsList
+        handleAddTab() {
+            this.tableData = this.tabsList
                 this.addDialog = true;
-            }
+        },
+
+        handleTab() {
+        
          
         },
 
@@ -363,7 +371,7 @@ export default {
         let activeName = this.tabsValue;
         if (activeName === targetName) {
           tabs.forEach((tab, index) => {
-            if (tab.workCenterId === targetName) {
+            if (tab.id === targetName) {
               let nextTab = tabs[index + 1] || tabs[index - 1];
               if (nextTab) {
                 activeName = nextTab.name;
@@ -373,7 +381,7 @@ export default {
         }
         
         this.tabsValue = activeName;
-        this.tabsList = tabs.filter(tab => tab.workCenterId !== targetName);
+        this.tabsList = tabs.filter(tab => tab.id !== targetName);
       },
 
         /*关闭选择参数*/
@@ -387,6 +395,10 @@ export default {
             this.tabsList = arr
             this.addDialog = false;
 
+            if( this.tabsList.length > 0) {
+                this.tabsValue = this.tabsList[0].id
+            }
+
         }
 
     },