chris před 3 roky
rodič
revize
eac8172aab

+ 2 - 0
src/views/modules/common/approve-component.vue

@@ -36,6 +36,8 @@
     },
     methods: {
       async init (businessType, businessId) {
+        console.log('[approve-component]businessType = ' + businessType)
+        console.log('[approve-component]businessId = ' + businessId)
         this.visible = true
         this.dataForm = {
           busiType: businessType || '',

+ 26 - 2
src/views/modules/msg-center/approve-add-or-update.vue

@@ -6,16 +6,32 @@
     <div v-show="businessType === 'contract_review'">
       <contract-detail ref="contractDetail" @approveFinished="approveFinished"/>
     </div>
+    <div v-show="businessType === 'sale_order_flow'">
+      <order-detail ref="orderDetail" @approveFinished="approveFinished"/>
+    </div>
+    <div v-show="businessType === 'sale_purchase_flow'">
+      <purchase-detail ref="purchaseDetail" @approveFinished="approveFinished"/>
+    </div>
+    <div v-show="businessType === 'wh_template_record_flow'">
+      <template-out-detail ref="templateOutDetail" @approveFinished="approveFinished"/>
+    </div>
+    <div v-show="businessType === 'pro_product_flow'">
+      <product-detail ref="productDetail" @approveFinished="approveFinished"/>
+    </div>
   </div>
 </template>
 
 <script>
   import stockOrderDetail from '../warehouse/stock-order-detail'
   import contractDetail from '../cus/contract-detail'
+  import orderDetail from '../order/order-detail'
+  import purchaseDetail from '../sale/purchase-detail'
+  import templateOutDetail from '../warehouse/template-delivery-detail'
+  import productDetail from '../tech/product-detail'
   export default {
     name: 'approve-add-or-update',
     components: {
-      stockOrderDetail, contractDetail
+      stockOrderDetail, contractDetail, orderDetail, purchaseDetail, templateOutDetail, productDetail
     },
     data () {
       return {
@@ -33,8 +49,16 @@
           this.display ? this.$refs.stockOrderDetail.init(this.businessId) : this.$refs.stockOrderDetail.init(this.businessId, businessType)
         } else if (this.businessType === 'contract_review') {
           this.display ? this.$refs.contractDetail.init(this.businessId) : this.$refs.contractDetail.init(this.businessId, businessType)
+        } else if (this.businessType === 'sale_order_flow') {
+          this.display ? this.$refs.orderDetail.init(this.businessId) : this.$refs.orderDetail.init(this.businessId, businessType)
+        } else if (this.businessType === 'sale_purchase_flow') {
+          this.display ? this.$refs.purchaseDetail.init(this.businessId) : this.$refs.purchaseDetail.init(this.businessId, businessType)
+        } else if (this.businessType === 'wh_template_record_flow') {
+          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 {
-          this.$message.error('类型错误,请联系管理员!')
+          this.$message.error('流程类别不支持,请联系管理员!')
         }
       },
       approveFinished () {

+ 25 - 4
src/views/modules/order/order-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.orderCode}}</e-desc-item>
         <e-desc-item label="客户订单编码">{{dataForm.cusOrderCode}}</e-desc-item>
@@ -118,14 +121,16 @@
   import { dealStepData, dealStepLogs } from '@/api/util'
   import { getOrderDetail } from '@/api/sale'
   import uploadComponent from '../common/upload-component'
+  import ApproveComponent from '../common/approve-component'
   export default {
     name: 'order-detail',
     components: {
-      EDesc, EDescItem, uploadComponent
+      EDesc, EDescItem, uploadComponent, ApproveComponent
     },
     data () {
       return {
         visible: false,
+        isFlow: false,
         id: 0,
         dataForm: {},
         productDetails: [],
@@ -135,17 +140,18 @@
       }
     },
     methods: {
-      async init (id) {
+      async init (id, businessType) {
         this.visible = true
+        this.isFlow = !!(businessType && businessType !== '')
         this.id = id || 0
         this.dataForm = {}
         this.productDetails = []
         this.stepList = []
         this.logList = []
         this.fileList = []
-        this.getDetails()
+        this.getDetails(businessType)
       },
-      getDetails () {
+      getDetails (businessType) {
         getOrderDetail(this.id).then(({data}) => {
           if (data && data.code === '200') {
             this.dataForm = data.data
@@ -166,8 +172,23 @@
             if (data.data.saleROrderProductList) {
               this.productDetails = data.data.saleROrderProductList
             }
+            // 初始化审批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')
       }
     }
   }

+ 25 - 4
src/views/modules/sale/purchase-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.purchaseCode}}</e-desc-item>
         <e-desc-item label="付款方式" span="2">
@@ -129,14 +132,16 @@
   import EDescItem from '../common/e-desc-item'
   import { dealStepData, dealStepLogs } from '@/api/util'
   import { getPurchaseDetail } from '@/api/sale'
+  import ApproveComponent from '../common/approve-component'
   export default {
     name: 'purchase-detail',
     components: {
-      EDesc, EDescItem
+      EDesc, EDescItem, ApproveComponent
     },
     data () {
       return {
         visible: false,
+        isFlow: false,
         id: 0,
         dataForm: {},
         materialDetails: [],
@@ -158,17 +163,18 @@
       }
     },
     methods: {
-      async init (id) {
+      async init (id, businessType) {
         this.visible = true
+        this.isFlow = !!(businessType && businessType !== '')
         this.id = id || 0
         this.dataForm = {}
         this.materialDetails = []
         this.stepList = []
         this.logList = []
         this.idsPayType = []
-        this.getDetails()
+        this.getDetails(businessType)
       },
-      getDetails () {
+      getDetails (businessType) {
         getPurchaseDetail(this.id).then(({data}) => {
           if (data && data.code === '200') {
             this.dataForm = data.data
@@ -184,6 +190,8 @@
               this.materialDetails = data.data.details
               this.calTotal()
             }
+            // 初始化审批Form
+            this.showApproveForm(businessType, this.id)
           }
         })
       },
@@ -202,6 +210,19 @@
         let str = (Number(row.taxRate * 100)).toFixed(0)
         str += '%'
         return str
+      },
+      // 初始化审批Form
+      showApproveForm (businessType, businessId) {
+        if (this.isFlow) {
+          this.$nextTick(() => {
+            this.$refs.approve.init(businessType, businessId)
+          })
+        }
+      },
+      // 审批完成
+      approveFinished () {
+        this.visible = false
+        this.$emit('approveFinished')
       }
     }
   }

+ 25 - 4
src/views/modules/tech/product-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.productName}}</e-desc-item>
         <e-desc-item label="产品规格">{{dataForm.productSpec}}</e-desc-item>
@@ -127,14 +130,16 @@
   import { dealStepData, dealStepLogs } from '@/api/util'
   import uploadComponent from '../common/upload-component'
   import { getProductDetail } from '@/api/product'
+  import ApproveComponent from '../common/approve-component'
   export default {
     name: 'product-detail',
     components: {
-      EDesc, EDescItem, uploadComponent
+      EDesc, EDescItem, uploadComponent, ApproveComponent
     },
     data () {
       return {
         visible: false,
+        isFlow: false,
         id: 0,
         dataForm: {},
         materialList: [],
@@ -145,8 +150,9 @@
       }
     },
     methods: {
-      async init (id) {
+      async init (id, businessType) {
         this.visible = true
+        this.isFlow = !!(businessType && businessType !== '')
         this.id = id || 0
         this.dataForm = {}
         this.materialList = []
@@ -154,9 +160,9 @@
         this.stepList = []
         this.logList = []
         this.fileList = []
-        this.getDetails()
+        this.getDetails(businessType)
       },
-      getDetails () {
+      getDetails (businessType) {
         getProductDetail(this.id).then(({data}) => {
           if (data && data.code === '200') {
             this.dataForm = data.data
@@ -188,8 +194,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')
       }
     }
   }

+ 54 - 5
src/views/modules/warehouse/template-delivery-detail.vue

@@ -5,6 +5,27 @@
     :close-on-click-modal="false"
     :visible.sync="visible">
     <div style="margin-left: 20px;margin-right: 20px">
+      <!-- 工作流 -->
+      <div v-show="dataForm.workFlowBusinessExt">
+        <el-steps :active="dataForm.workFlowBusinessExt?dataForm.workFlowBusinessExt.workFlowProcessStepList.length + 2:0" align-center style="margin-bottom: 20px">
+          <template v-for="(item, i) in stepList">
+            <el-step :icon="item.icon" :title="item.title" :description="item.description"></el-step>
+          </template>
+        </el-steps>
+        <el-collapse style="margin-bottom: 20px">
+          <el-collapse-item>
+            <template slot="title">
+              <span style="color: red">审批日志(展开查看更多):</span>
+            </template>
+            <template v-for="(item, i) in logList">
+              <div>{{++i}}:{{item.approverName}}  {{item.createTime}}  {{item.approvalValue}}</div>
+            </template>
+          </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.recordCode}}</e-desc-item>
         <e-desc-item label="产品编号">{{dataForm.recordNumber}}</e-desc-item>
@@ -82,35 +103,63 @@
   import EDesc from '../common/e-desc'
   import EDescItem from '../common/e-desc-item'
   import { getDeliveryDetail } from '@/api/warehouse'
+  import { dealStepData, dealStepLogs } from '@/api/util'
+  import ApproveComponent from '../common/approve-component'
   export default {
     name: 'template-deliver-detail',
     components: {
-      EDesc, EDescItem
+      EDesc, EDescItem, ApproveComponent
     },
     data () {
       return {
         visible: false,
+        isFlow: false,
         id: 0,
         dataForm: {},
-        materialList: []
+        materialList: [],
+        stepList: [],
+        logList: []
       }
     },
     methods: {
-      async init (id) {
+      async init (id, businessType) {
         this.visible = true
+        this.isFlow = !!(businessType && businessType !== '')
+        this.stepList = []
+        this.logList = []
         this.id = id || 0
         this.dataForm = {}
         this.materialList = []
-        this.getDetails()
+        this.getDetails(businessType)
       },
-      getDetails () {
+      getDetails (businessType) {
         getDeliveryDetail(this.id).then(({data}) => {
           if (data && data.code === '200') {
             this.dataForm = data.data
+            // 流程图展示
+            if (data.data.workFlowBusinessExt) {
+              dealStepData(data.data.workFlowBusinessExt.workFlowProcessStepList, this.stepList)
+              dealStepLogs(data.data.workFlowBusinessExt.processLogList, this.logList)
+            }
             // 模板对应的零件
             this.materialList = data.data.whTemplateItemPlanList
+            // 初始化审批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')
       }
     }
   }