فهرست منبع

森语-员工档案

jbb 2 سال پیش
والد
کامیت
301ef2bd51
1فایلهای تغییر یافته به همراه42 افزوده شده و 9 حذف شده
  1. 42 9
      src/views/activiti/form/demoForm2.vue

+ 42 - 9
src/views/activiti/form/demoForm2.vue

@@ -670,6 +670,7 @@ export default {
         },
         //主子表计算 
          tableCalculation(value){
+            if(this.processData.businessTable == 'supplieses_apply_a' ){
              var number1 = 0,
                 number2 = 0
                 //寻找help信息中对应的modol值
@@ -695,6 +696,41 @@ export default {
                     this.$refs.KFB.setData({sum:sum})   
 
                })
+            }
+            if(this.processData.businessTable == 'incident_ticket'){
+                var all = 0,
+                currencys=[],
+                currency =''
+                value.map(item=>{
+                item.accident_sum = item.accident_sum?item.accident_sum:'0'
+                //计算表头总价
+                all+=Number(item.accident_sum)
+
+                //币种-自动带出
+                if(item.money_type){currencys.push(item.money_type)}  
+              })
+              //获取表格中只出现一次的币种-即为改变的币种
+              currencys.every(item=>{
+                const countOccurences = (arr, value) => arr.reduce((a, v) => v === value ? a + 1 : a + 0, 0)
+                if(countOccurences(currencys,item)==1){
+                  currency=item
+                  return false
+                }
+                return true
+              })
+              //赋值
+              value.map(item=>{
+                //若无只出现一次的币种  1.第一次表格增行  2.表格中有两条以上数据,再次增行
+                if(currency==''){
+                    item.money_type = currencys[0]
+                }else{
+                    item.money_type = currency
+                }
+               
+              })
+             
+              this.$refs.KFB.setData({total_money:all})   
+            }
          },
          specialTerms(value,key){
             var that = this
@@ -791,14 +827,11 @@ export default {
           if(key == 'employee_name' && this.processData.businessTable == 'separation_application'){//离职申请
             this.$refs.KFB.setData({job_title:this.postInfo[value]})   
           }
-          
-          if(this.processData.businessTable == 'incident_ticket' &&key=='child&incident_ticket_children'){
-              var all = 0
-              value.map(item=>{
-                item.accident_sum = item.accident_sum?item.accident_sum:'0'
-                all+=Number(item.accident_sum)
-              })
-              this.$refs.KFB.setData({total_money:all})   
+           
+          //森语-质量事故单
+          if(key=='child&incident_ticket_children'){
+           this.tableCalculation(value)
+            
           }
           //技能博物馆-----退休录入
           if(key == 'name' && this.processData.businessTable == 'bwg_retire_input'){//技能博物馆 ---- 退休录入
@@ -907,7 +940,7 @@ export default {
         }
                  
             //改变的表单是主子表类型时----物质申请单
-            if(this.processData.businessTable == 'supplieses_apply_a' && key =='child&supplieses_apply'){
+            if(key =='child&supplieses_apply'){
                 this.tableCalculation(value)
             }
             //特别字段