ysy 2 лет назад
Родитель
Сommit
ae58aca8ec

+ 89 - 3
src/views/material/product/components/MaterialModal.vue

@@ -1,6 +1,6 @@
 
 <template>
-    <ele-modal width="1160px" :visible="visible" v-if="visible" :append-to-body="true" :close-on-click-modal="true"
+    <ele-modal width="1260px" :visible="visible" v-if="visible" :append-to-body="true" :close-on-click-modal="true"
         custom-class="ele-dialog-form" title="选择物料" @update:visible="updateVisible">
         <header-title title="基本信息"></header-title>
         <el-form ref="form" :model="form" :rules="rules" label-width="120px">
@@ -42,6 +42,22 @@
                 </el-col>
             </el-row>
 
+
+            <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>
+
+             
+             
+                <el-tab-pane label="添加工序" name="add" :closable="false" >
+                </el-tab-pane>
+            </el-tabs>
+
+                        
             <header-title title="物料BOM">
                 <div>
                     <el-button size="small" icon="el-icon-plus" class="ele-btn-icon" type="primary"
@@ -130,12 +146,29 @@
                     </div>
                 </el-row>
             </el-card>
+
+
+
         </el-form>
 
         <!-- 物料Bom -->
         <MaterialAdd :visible.sync="materialShow" :data="current" :categoryId="categoryId" @done="done"
             ref="materialAddRef">
         </MaterialAdd>
+
+        <!-- 添加工序 -->
+
+        <ele-modal width="1720px" :visible="addDialog" :append-to-body="true" :close-on-click-modal="true"
+            @update:visible="closeAdd">
+            <Production :tableData="tableData" ref="ProductionCom" />
+            <template v-slot:footer>
+                <el-button @click="closeAdd">取消</el-button>
+                <el-button type="primary" @click="addParamrter">
+                    添加
+                </el-button>
+            </template>
+        </ele-modal>
+
     </ele-modal>
 </template>
   
@@ -146,11 +179,13 @@ 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 Production from '@/views/technology/route/components/production/index.vue'
 
 export default {
     components: {
         MaterialAdd,
-        factorySelect
+        factorySelect,
+        Production
     },
     props: {
         // 弹窗是否打开
@@ -247,7 +282,13 @@ export default {
 
             current: null,
 
-            materialShow: false
+            materialShow: false,
+
+            tabsList: [],
+            tableData: [],
+
+            addDialog: false,
+            tabsValue: null
         };
     },
     computed: {
@@ -308,6 +349,46 @@ export default {
             this.getCategoryBomFn();
         },
 
+        handleTab() {
+            if(this.tabsValue == 'add') {
+                this.tableData = this.tabsList
+                this.addDialog = true;
+            }
+         
+        },
+
+        removeTab(targetName) {
+      
+        let tabs = this.tabsList;
+        let activeName = this.tabsValue;
+        if (activeName === targetName) {
+          tabs.forEach((tab, index) => {
+            if (tab.workCenterId === targetName) {
+              let nextTab = tabs[index + 1] || tabs[index - 1];
+              if (nextTab) {
+                activeName = nextTab.name;
+              }
+            }
+          });
+        }
+        
+        this.tabsValue = activeName;
+        this.tabsList = tabs.filter(tab => tab.workCenterId !== targetName);
+      },
+
+        /*关闭选择参数*/
+        closeAdd() {
+            this.$refs.ProductionCom.$refs.table.setSelectedRows([]);
+            this.addDialog = false;
+        },
+
+        addParamrter() {
+            let arr = this.$refs.ProductionCom.selection;
+            this.tabsList = arr
+            this.addDialog = false;
+
+        }
+
     },
 
     watch: {
@@ -330,4 +411,9 @@ export default {
     }
 };
 </script>
+
+
+
+<style lang="scss" scoped>
+</style>
   

+ 2 - 1
src/views/technology/route/components/production/index.vue

@@ -34,7 +34,8 @@ export default {
   },
   props: {
     tableData: {
-      type: Array
+      type: Array,
+      default: () => []
     }
   },
   data() {