Explorar o código

BOM管理优化:新增流程提交对话框组件并重构发布逻辑

yusheng hai 9 meses
pai
achega
3303f7ebf5
Modificáronse 1 ficheiros con 73 adicións e 33 borrados
  1. 73 33
      src/views/material/BOMmanage/index.vue

+ 73 - 33
src/views/material/BOMmanage/index.vue

@@ -136,7 +136,13 @@
     </el-dialog>
 
     <LCdetail ref="detailRef"></LCdetail>
-
+    <process-submit-dialog
+      api-fun-name="purchaseinquiryStatusAPI"
+      :processSubmitDialogFlag.sync="processSubmitDialogFlag"
+      v-if="processSubmitDialogFlag"
+      ref="processSubmitDialogRef"
+      @reload="reload"
+    ></process-submit-dialog>
     <BomDetailsPop ref="bomDrawer"></BomDetailsPop>
   </div>
 </template>
@@ -144,6 +150,7 @@
 <script>
   import tabMixins from '@/mixins/tableColumnsMixin';
   import { produceTypeList } from '@/enum/dict.js';
+  import processSubmitDialog from '@/components/processSubmitDialog/processSubmitDialog.vue';
 
   import BOMSearch from './components/BOM-search.vue';
   import {
@@ -157,13 +164,16 @@
   import LCdetail from './components/LCdetail.vue';
   import { getByCode } from '@/api/system/dictionary-data';
   import BomDetailsPop from '../BOMmanage/detailsPop.vue';
+  import { mapGetters } from 'vuex';
+
   export default {
     name: 'SystemDictionary',
-    components: { BOMSearch, LCdetail, BomDetailsPop },
+    components: { BOMSearch, LCdetail, BomDetailsPop,processSubmitDialog },
     mixins: [tabMixins],
     data() {
       return {
         produceTypeList,
+        processSubmitDialogFlag:false,
         // 表格列配置
         columns: [
           {
@@ -396,7 +406,7 @@
         isSubmit: false,
         JsRId: null,
         radioSubmit: 1,
-
+        currentNodeData: {},
         pageSize: this.$store.state.tablePageSize,
         cacheKeyUrl: '68be265a-material-BOMmanage',
         isUpload: true
@@ -406,7 +416,8 @@
     computed: {
       clientEnvironmentId() {
         return this.$store.state.user.info.clientEnvironmentId;
-      }
+      },
+      ...mapGetters(['user'])
     },
 
     created() {
@@ -450,42 +461,71 @@
       },
 
       handSubmit(row) {
+        this.currentNodeData = row;
         if (this.clientEnvironmentId == 5) {
-          this.JsRId = row.id;
+          // this.JsRId = row.id;
           this.isSubmit = true;
         } else {
-          this.$alert('确定要发布吗?', '提示', {
-            confirmButtonText: '确定',
-            cancelButtonText: '取消',
-            type: 'warning'
-          })
-            .then(() => {
-              bomSubmit({ businessId: row.id }).then((res) => {
-                if (res?.code == '0') {
-                  this.$message.success('发布成功');
-                  this.reload();
-                }
-              });
-            })
-            .catch(() => {});
+          this.submit();
+          // this.$alert('确定要发布吗?', '提示', {
+          //   confirmButtonText: '确定',
+          //   cancelButtonText: '取消',
+          //   type: 'warning'
+          // })
+          //   .then(() => {
+          //     bomSubmit({ businessId: row.id }).then((res) => {
+          //       if (res?.code == '0') {
+          //         this.$message.success('发布成功');
+          //         this.reload();
+          //       }
+          //     });
+          //   })
+          //   .catch(() => {});
         }
       },
+      submit(businessKey) {
+        this.processSubmitDialogFlag = true;
+        this.$nextTick(() => {
+          let params = {
+            businessId: this.currentNodeData.id,
+            businessKey: businessKey || 'bom_approver',
+            formCreateUserId: this.user.info.userId,
+            variables: {
+              businessCode: this.currentNodeData.code,
+              businessName: this.currentNodeData.name,
+              businessType:
+                this.activeName == 1
+                  ? 'PBOM'
+                  : this.activeName == 2
+                  ? 'MBOM'
+                  : this.activeName == 3
+                  ? 'ABOM'
+                  : 'EBOM'
+            }
+          };
 
+          this.$refs.processSubmitDialogRef.init(params);
+        });
+      },
       handJsSubmit() {
-        let URL = this.radioSubmit == 1 ? jsBomSubmit : deviceBomSubmit;
-        this.$alert('确定要发布吗?', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        })
-          .then(() => {
-            URL({ businessId: this.JsRId }).then((res) => {
-              this.isSubmit = false;
-              this.$message.success('发布成功');
-              this.reload();
-            });
-          })
-          .catch(() => {});
+        this.submit(
+          this.radioSubmit == 1 ? 'bom_release' : 'bom_release_device'
+        );
+        this.isSubmit = false;
+        // let URL = this.radioSubmit == 1 ? jsBomSubmit : deviceBomSubmit;
+        // this.$alert('确定要发布吗?', '提示', {
+        //   confirmButtonText: '确定',
+        //   cancelButtonText: '取消',
+        //   type: 'warning'
+        // })
+        //   .then(() => {
+        //     URL({ businessId: this.JsRId }).then((res) => {
+        //       this.isSubmit = false;
+        //       this.$message.success('发布成功');
+        //       this.reload();
+        //     });
+        //   })
+        //   .catch(() => {});
       },
 
       /* 表格数据源 */