Преглед на файлове

工艺详情页面分离

chris преди 3 години
родител
ревизия
0c059d1839
променени са 2 файла, в които са добавени 32 реда и са изтрити 5 реда
  1. 7 1
      src/views/modules/msg-center/approve-add-or-update.vue
  2. 25 4
      src/views/modules/tech/crafts-detail.vue

+ 7 - 1
src/views/modules/msg-center/approve-add-or-update.vue

@@ -18,6 +18,9 @@
     <div v-show="businessType === 'pro_product_flow'">
       <product-detail ref="productDetail" @approveFinished="approveFinished"/>
     </div>
+    <div v-show="businessType === 'pro_technology_flow'">
+      <craft-detail ref="craftDetail" @approveFinished="approveFinished"/>
+    </div>
   </div>
 </template>
 
@@ -28,10 +31,11 @@
   import purchaseDetail from '../sale/purchase-detail'
   import templateOutDetail from '../warehouse/template-delivery-detail'
   import productDetail from '../tech/product-detail'
+  import craftDetail from '../tech/crafts-detail'
   export default {
     name: 'approve-add-or-update',
     components: {
-      stockOrderDetail, contractDetail, orderDetail, purchaseDetail, templateOutDetail, productDetail
+      stockOrderDetail, contractDetail, orderDetail, purchaseDetail, templateOutDetail, productDetail, craftDetail
     },
     data () {
       return {
@@ -57,6 +61,8 @@
           this.display ? this.$refs.templateOutDetail.init(this.businessId) : this.$refs.templateOutDetail.init(this.businessId, businessType)
         } else if (this.businessType === 'pro_product_flow') {
           this.display ? this.$refs.productDetail.init(this.businessId) : this.$refs.productDetail.init(this.businessId, businessType)
+        } else if (this.businessType === 'pro_technology_flow') {
+          this.display ? this.$refs.craftDetail.init(this.businessId) : this.$refs.craftDetail.init(this.businessId, businessType)
         } else {
           this.$message.error('流程类别不支持,请联系管理员!')
         }

+ 25 - 4
src/views/modules/tech/crafts-detail.vue

@@ -23,6 +23,9 @@
           </el-collapse-item>
         </el-collapse>
       </div>
+      <div v-show="isFlow">
+        <approve-component ref="approve" @approveFinished="approveFinished"/>
+      </div>
       <e-desc title="基本信息" column="3">
         <e-desc-item label="工艺名称">{{dataForm.techName}}</e-desc-item>
         <e-desc-item label="工艺版本">{{dataForm.techVersion}}</e-desc-item>
@@ -46,14 +49,16 @@
   import { dealStepData, dealStepLogs } from '@/api/util'
   import uploadComponent from '../common/upload-component'
   import { getInfo } from '@/api/crafts'
+  import ApproveComponent from '../common/approve-component'
   export default {
     name: 'crafts-detail',
     components: {
-      EDesc, EDescItem, uploadComponent
+      EDesc, EDescItem, uploadComponent, ApproveComponent
     },
     data () {
       return {
         visible: false,
+        isFlow: false,
         id: 0,
         dataForm: {},
         stepList: [],
@@ -62,16 +67,17 @@
       }
     },
     methods: {
-      async init (id) {
+      async init (id, businessType) {
         this.visible = true
+        this.isFlow = !!(businessType && businessType !== '')
         this.id = id || 0
         this.dataForm = {}
         this.stepList = []
         this.logList = []
         this.fileList = []
-        this.getDetails()
+        this.getDetails(businessType)
       },
-      getDetails () {
+      getDetails (businessType) {
         getInfo(this.id).then(({data}) => {
           if (data && data.code === '200') {
             this.dataForm = data.data
@@ -90,8 +96,23 @@
                 })
               })
             }
+            // 初始化审批Form
+            this.showApproveForm(businessType, this.id)
           }
         })
+      },
+      // 初始化审批Form
+      showApproveForm (businessType, businessId) {
+        if (this.isFlow) {
+          this.$nextTick(() => {
+            this.$refs.approve.init(businessType, businessId)
+          })
+        }
+      },
+      // 审批完成
+      approveFinished () {
+        this.visible = false
+        this.$emit('approveFinished')
       }
     }
   }