Ver código fonte

成本分配列表-增加标记A标记B 计算方式

jingbb 7 meses atrás
pai
commit
fb0db3b94d

+ 5 - 7
src/views/cost-allocation-total/costDetailDrawer.vue

@@ -2,7 +2,6 @@
   <a-modal
     title="详情"
     v-model="detailModVis"
-    :confirmLoading="confirmLoading"
     width="86%"
     style="top:330px;left:100px;"
     @cancel="handlecLose"
@@ -327,7 +326,7 @@
     <!-- 弹框 -->
     <div>
       <!-- 主表 人民币费用支出  弹框 -->
-      <mainTableExpenseCNY-modal ref="mainTableExpenseCNYModal" :father="aa"></mainTableExpenseCNY-modal>
+      <mainTableExpenseCNY-modal ref="mainTableExpenseCNYModal" ></mainTableExpenseCNY-modal>
       <!-- 主表 美元费用支出  弹框 -->
       <mainTableExpenseUSD-modal ref="mainTableExpenseUSDModal" :father="bb"></mainTableExpenseUSD-modal>
       <!-- 事故单 -->
@@ -378,7 +377,8 @@ export default {
         planNum: ''
       }, // 详情所有数据
       remarks: '', // 备注
-
+      fileName:'',
+      disableMixinCreated:'1',
       // 事故单 表头
       accidentListColumns: [
         {
@@ -525,8 +525,6 @@ export default {
                   })
               })
               }
-            //调整表头格式
-            this.adjustingHeader()
             // this.accidentListData = res.result.syCostAllocationAccidentList //事故单
             // this.accidentCalculation(this.accidentListData)
             // var accidentNum = 0
@@ -616,7 +614,7 @@ export default {
             this.$refs.unitTabs.sumInfo.shipProcesFees =(d/2).toFixed(2)//出运加工费
             this.$refs.unitTabs.sumInfo.exportedAmountRMB =(b/2).toFixed(2)//出运人民币外销金额 f
             this.detailsPlanNum.rmbExportamount = this.$refs.unitTabs.sumInfo.exportedAmountRMB //表头-外销总价(¥)
-             //调整表头格式
+            //调整表头格式
              this.adjustingHeader()
            if(Number(oneData.syCostAllocationShipdetail[0].procesUnitPriceusd)>0){
             this.$refs.unitTabs.sumInfo.excludingTaxProcessing =this.$refs.unitTabs.sumInfo.shipProcesFees//出运不含税加工费-合计信息
@@ -662,7 +660,7 @@ export default {
     openEnclosure(){
       this.$refs.attachmentDisplay.AttachmentModVis = true
       var attachList = [];
-      if (this.detailsPlanNum != null && this.detailsPlanNum.accessorItemList != null){
+      if (this.detailsPlanNum != null && this.detailsPlanNum.accessorItemList != null && this.detailsPlanNum.accessorItemList.length!==0){
         this.detailsPlanNum.accessorItemList.forEach(e=>{
           var attach = {};
           attach.name = e.filename;

+ 80 - 8
src/views/cost-allocation-total/list.vue

@@ -122,7 +122,7 @@
       </div>
       <a-table
         bordered
-        rowKey="id"
+        rowKey="planNum"
         :columns="costAllocationColumns"
         :data-source="costAllocationData"
         :loading="loading"
@@ -270,9 +270,13 @@ export default {
     // 分页查询
     getCostList() {
       this.$nextTick(() => {
+        this.loading = true
         costList(this.queryParam).then(res => {
           if (res.success) {
             this.costAllocationData = res.result.records
+            this.costAllocationData.map((item,index)=>{
+              this.getSign(item,index)
+            })
             this.pagination = {
               total: res.result.total,
               current: res.result.current,
@@ -281,9 +285,74 @@ export default {
           }else{
             this.$message.error(res.message);
           }
+        }).finally(() => {
+              this.loading = false
         })
       })
     },
+    getSign(item,index){
+      var rmbExportamoun = 0,
+      fabriccostIncludestax = 0,
+      fabriccostNotincludestax = 0,
+      excipiencostNotincludestax = 0,
+      rmbProcesscost = 0,
+      rmbExpense=0,
+      usdTotalexportprice = 0
+      //发运明细相关数据
+      var processCostAll = 0
+      item.syCostAllocation.processUnitList[0].syCostAllocationShipdetail.map((event,index)=>{
+        if(item.syCostAllocation.processUnitList[0].syCostAllocationShipdetail[index].outdata!=='合计'){
+          rmbExportamoun+=Number(event.rmbAmount)
+          processCostAll+=Number(event.processCost)
+          usdTotalexportprice+=(event.exportPrice)
+        }  
+      })
+      if(Number(item.syCostAllocation.processUnitList[0].syCostAllocationShipdetail[0].procesUnitPriceusd)>0){
+        rmbProcesscost =processCostAll//出运不含税加工费-合计信息
+      }else{
+        rmbProcesscost=(processCostAll/(1+(Number(item.syCostAllocation.taxrate)/100))).toFixed(2)//出运不含税加工费
+      }   
+      //面料sheet相关数据
+      var all = 0,//面料sheet-转入成本总计
+          allYu = 0//面料sheet-余下数量成本总计
+      item.syCostAllocation.processUnitList[0].syCostAllocationFabricList.map((event1,index)=>{
+          if(event1.remainingQuantitycost!=='' && event1.remainingQuantitycost){
+            event1.remainingQuantitycost = Number(event1.remainingQuantitycost).toFixed(2)
+             allYu +=Number(event1.remainingQuantitycost)
+           }
+           if(event1.transferCost&&event1.transferCost!==''){
+              all+=Number(event1.transferCost)
+            }
+      })
+      fabriccostIncludestax=(all+Number(item.syCostAllocation.fabriccostIncludestax)-allYu).toFixed(2)
+      fabriccostNotincludestax = (fabriccostIncludestax/(1+(Number(item.syCostAllocation.taxrate)/100))).toFixed(2)
+      //辅料sheet相关数据
+      var priceExcludingtaxAll = 0,
+          transferCostAll=0
+      item.syCostAllocation.processUnitList[0].syCostAllocationIngredientList.map((event2,index)=>{
+        if(item.syCostAllocation.processUnitList[0].syCostAllocationIngredientList[index].goodsName!=='合计'){
+          priceExcludingtaxAll+=event2.priceExcludingtax?Number(event2.priceExcludingtax):0,
+          transferCostAll+=event2.transferCost?Number(event2.transferCost):0  
+        }         
+      })
+      excipiencostNotincludestax=((priceExcludingtaxAll+transferCostAll)/(1+(Number((item.syCostAllocation.taxrate)/100)))).toFixed(2)
+      //费用支出sheet相关数据
+      var disbursedLocalmoneyALL=0,
+          shuiemoneyAll = 0
+      item.syCostAllocation.syCostAllocationCostpayList.map((event3,index)=>{
+        if(item.syCostAllocation.syCostAllocationCostpayList[index].setNo!=='合计'){
+          disbursedLocalmoneyALL+=event3.disbursedLocalmoney?Number(event3.disbursedLocalmoney):0
+          shuiemoneyAll+=Number(event3.shuiemoney) 
+        }         
+      })
+      rmbExpense = (disbursedLocalmoneyALL+shuiemoneyAll).toFixed(2)
+      // 标记A
+      var A =rmbExportamoun-fabriccostNotincludestax-excipiencostNotincludestax-rmbProcesscost-rmbExpense
+      var B = A/usdTotalexportprice
+      B= B>0?B:-B
+      item.signA = A<0?'red':'black'
+      item.signB = B<0.8?'blue':'black'
+    },
     cancelSumit(record){
       var syApprovalHistory={
         stuta:'取消提交',
@@ -314,13 +383,16 @@ export default {
       this.$refs.attachment.AttachmentModVis = true
       var attachmentArr = record.attachs.split(',')
       var attachList = [];
-      attachmentArr.forEach(item=>{
-        var attach = {};
-          attach.name = item;
-          attach.src=item;
-          attachList.push(attach);
-      })
-      this.$refs.attachment.attachmentData =  attachList;
+      if (attachmentArr.length!==0) {
+        attachmentArr.forEach(item=>{
+          var attach = {};
+            attach.name = item;
+            attach.src=item;
+            attachList.push(attach);
+        })
+        this.$refs.attachment.attachmentData =  attachList;
+      }
+      
     },
     //  审核
     check(record) {