瀏覽代碼

成本分配表-小数位调整

jbb 2 年之前
父節點
當前提交
0fff7dc5d8
共有 2 個文件被更改,包括 252 次插入52 次删除
  1. 109 29
      src/views/reportForms/cost-allocation-table.vue
  2. 143 23
      src/views/reportForms/cost-allocation-table/tabs.vue

+ 109 - 29
src/views/reportForms/cost-allocation-table.vue

@@ -302,8 +302,28 @@ export default {
           scopedSlots: { customRender: 'accidentNum' }
         },
         { title: '事故承担方', width: 120, dataIndex: 'accidentUndertaker', className: 'replacecolor' },
-        { title: '美元金额', width: 120, dataIndex: 'amount', className: 'replacecolor' },
-        { title: '人民币金额', width: 120, dataIndex: 'amountrmb', className: 'replacecolor' },
+        { 
+          title: '美元金额', 
+          width: 120, 
+          dataIndex: 'amount', 
+          className: 'replacecolor' ,
+          customRender: (text, record, index) => {
+            if(text!==''&&text){
+              return Number(text).toFixed(2)
+            }
+          },
+        },
+        { 
+          title: '人民币金额', 
+          width: 120, 
+          dataIndex: 'amountrmb', 
+          className: 'replacecolor' ,
+          customRender: (text, record, index) => {
+            if(text!==''&&text){
+              return Number(text).toFixed(4)
+            }
+          },
+        },
         { title: '事故单主题', width: 120, dataIndex: 'accidentTheme', className: 'replacecolor' },
         { title: '责任人', width: 120, dataIndex: 'responsibilityPerson1', className: 'replacecolor' },
         // { title: '币种', width: 120, dataIndex: 'moneyType', className: 'replacecolor' },
@@ -316,10 +336,48 @@ export default {
         { title: '账套号', width: 120, dataIndex: 'setNo', className: 'replacecolor' },
         { title: '支出单号', width: 120, dataIndex: 'disbursementSlipNo', className: 'replacecolor' },
         { title: '费用项目', dataIndex: 'expenseItem', width: 120, className: 'replacecolor' },
-        { title: '美元', dataIndex: 'disbursedOriginalmoney', width: 120, className: 'replacecolor' },
-        { title: '人民币(不含税)', dataIndex: 'disbursedLocalmoney', width: 120, className: 'replacecolor' },
-        { title: '人民币(税额)', dataIndex: 'shuiemoney', width: 120, className: 'replacecolor' },
-        { title: '人民币(价税合计)', dataIndex: 'totalTaxIncrease', width: 120, className: 'replacecolor' },
+        { 
+          title: '美元', 
+          dataIndex: 'disbursedOriginalmoney', 
+          width: 120,
+          className: 'replacecolor' ,
+          customRender: (text, record, index) => {
+            if(text!==''&&text){
+              return Number(text).toFixed(2)
+            }
+          },
+          },
+        { 
+          title: '人民币(不含税)', 
+          dataIndex: 'disbursedLocalmoney', 
+          width: 120, className: 'replacecolor',
+          customRender: (text, record, index) => {
+            if(text!==''&&text){
+              return Number(text).toFixed(2)
+            }
+          },
+         },
+        { 
+          title: '人民币(税额)', 
+          dataIndex: 'shuiemoney', 
+          width: 120, 
+          className: 'replacecolor',
+          customRender: (text, record, index) => {
+            if(text!==''&&text){
+              return Number(text).toFixed(2)
+            }
+          },
+         },
+        { 
+          title: '人民币(价税合计)', 
+          dataIndex: 'totalTaxIncrease', 
+          width: 120, 
+          className: 'replacecolor',
+          customRender: (text, record, index) => {
+            if(text!==''&&text){
+              return Number(text).toFixed(2)
+            }
+          }, },
         { title: '发票号', dataIndex: 'invoicenum', width: 120, className: 'replacecolor' },
         { title: '制单人', dataIndex: 'preparedBy', width: 120, className: 'replacecolor' }
       ],
@@ -352,7 +410,8 @@ export default {
             this.PrintButton = false
              this.loading = false
             this.detailsPlanNum = res.result //所有详情
-            this.detailsPlanNum.outdata = ( this.detailsPlanNum.outdata==''&&! this.detailsPlanNum.outdata)?'':moment( this.detailsPlanNum.outdata).format('YYYY-MM-DD')
+            //调整表头格式
+            this.adjustingHeader()
             this.accidentListData = res.result.syCostAllocationAccidentList //事故单
             this.accidentCalculation(this.accidentListData)
             // var accidentNum = 0
@@ -391,7 +450,7 @@ export default {
               s+=Number(item.transferCost)
             })
             //  this.$refs.unitTabs.sumInfo.fabricAmount = s.toFixed(3) //合计中的面料总额
-             this.$refs.unitTabs.sumInfo.fabricAmount = (this.detailsPlanNum.fabriccostIncludestax!==''&&this.detailsPlanNum.fabriccostIncludestax)?(this.detailsPlanNum.fabriccostIncludestax).toFixed(2):'' //合计中的面料总额
+             this.$refs.unitTabs.sumInfo.fabricAmount = (this.detailsPlanNum.fabriccostIncludestax!==''&&this.detailsPlanNum.fabriccostIncludestax)?(Number(this.detailsPlanNum.fabriccostIncludestax)).toFixed(2):'' //合计中的面料总额
              this.$refs.unitTabs.sumInfo.fabricExcludTax =(Number(this.$refs.unitTabs.sumInfo.fabricAmount)/1.13).toFixed(2)//合计中的不含税面料总额
             // this.detailsPlanNum.fabriccostIncludestax = s.toFixed(3) //表头中面料含税总额
             // this.detailsPlanNum.fabriccostNotincludestax = (s/1.13).toFixed(3) //表头中面料不含税总额
@@ -423,7 +482,7 @@ export default {
               }
             })
             this.$refs.unitTabs.sumInfo.exportPriceUSD = (s/2).toFixed(2)//出运美元外销总价
-            this.$refs.unitTabs.sumInfo.shipQua =(v/2).toFixed(0)//出货数量合计
+            this.$refs.unitTabs.sumInfo.shipQua =(v/2).toFixed(4)//出货数量合计
             this.$refs.unitTabs.sumInfo.shipProcesFees =(d/2).toFixed(2)//出运加工费
             this.$refs.unitTabs.sumInfo.exportedAmountRMB =(b/2).toFixed(2)//出运人民币外销金额 f
             this.$refs.unitTabs.sumInfo.excludingTaxProcessing =e.toFixed(2)//
@@ -442,6 +501,26 @@ export default {
       })
     },
 
+    //调整表头格式
+    adjustingHeader(){
+      this.detailsPlanNum.outdata = ( this.detailsPlanNum.outdata==''||!this.detailsPlanNum.outdata)?'':moment( this.detailsPlanNum.outdata).format('YYYY-MM-DD')
+      this.detailsPlanNum.planQuantity=( this.detailsPlanNum.planQuantity==''|| !this.detailsPlanNum.planQuantity)?'':Number( this.detailsPlanNum.planQuantity).toFixed(4)//计划数量
+      this.detailsPlanNum.usdTotalexportprice=( this.detailsPlanNum.usdTotalexportprice==''|| !this.detailsPlanNum.usdTotalexportprice)?'':Number( this.detailsPlanNum.usdTotalexportprice).toFixed(2)//美元外销总价
+      this.detailsPlanNum.rmbExpense=( this.detailsPlanNum.rmbExpense==''|| !this.detailsPlanNum.rmbExpense)?'':Number( this.detailsPlanNum.rmbExpense).toFixed(2)//人民币费用支出
+      this.detailsPlanNum.actualShipquantity=( this.detailsPlanNum.actualShipquantity==''|| !this.detailsPlanNum.actualShipquantity)?'':Number( this.detailsPlanNum.actualShipquantity).toFixed(4)//实际出库数量
+      this.detailsPlanNum.rmbExportamount=( this.detailsPlanNum.rmbExportamount==''|| !this.detailsPlanNum.rmbExportamount)?'':Number( this.detailsPlanNum.rmbExportamount).toFixed(2)//人民币外销金额
+      this.detailsPlanNum.usdExpense=( this.detailsPlanNum.usdExpense==''|| !this.detailsPlanNum.usdExpense)?'':Number( this.detailsPlanNum.usdExpense).toFixed(2)//美元费用支出
+      this.detailsPlanNum.rmbProcesscost=( this.detailsPlanNum.rmbProcesscost==''|| !this.detailsPlanNum.rmbProcesscost)?'':Number( this.detailsPlanNum.rmbProcesscost).toFixed(2)//加工费(人民币)
+      this.detailsPlanNum.accidentUsdamount=( this.detailsPlanNum.accidentUsdamount==''|| !this.detailsPlanNum.accidentUsdamount)?'':Number( this.detailsPlanNum.accidentUsdamount).toFixed(2)//事故单美元金额
+      this.detailsPlanNum.fabriccostIncludestax=( this.detailsPlanNum.fabriccostIncludestax==''|| !this.detailsPlanNum.fabriccostIncludestax)?'':Number( this.detailsPlanNum.fabriccostIncludestax).toFixed(2)//面料含税成本
+      this.detailsPlanNum.excipiencostIncludestax=( this.detailsPlanNum.excipiencostIncludestax==''|| !this.detailsPlanNum.excipiencostIncludestax)?'':Number( this.detailsPlanNum.excipiencostIncludestax).toFixed(2)//辅料含税成本
+      this.detailsPlanNum.salesordersLocaltotal=( this.detailsPlanNum.salesordersLocaltotal==''|| !this.detailsPlanNum.salesordersLocaltotal)?'':Number( this.detailsPlanNum.salesordersLocaltotal).toFixed(2)//销售本币金额
+      this.detailsPlanNum.accidentcnyAmount=( this.detailsPlanNum.accidentcnyAmount==''|| !this.detailsPlanNum.accidentcnyAmount)?'':Number( this.detailsPlanNum.accidentcnyAmount).toFixed(2)//事故单人民币金额   
+      this.detailsPlanNum.fabriccostNotincludestax=( this.detailsPlanNum.fabriccostNotincludestax==''|| !this.detailsPlanNum.fabriccostNotincludestax)?'':Number( this.detailsPlanNum.fabriccostNotincludestax).toFixed(2)//面料不含税成本   
+      this.detailsPlanNum.excipiencostNotincludestax=( this.detailsPlanNum.excipiencostNotincludestax==''|| !this.detailsPlanNum.excipiencostNotincludestax)?'':Number( this.detailsPlanNum.excipiencostNotincludestax).toFixed(2)//辅料料不含税成本   
+      this.detailsPlanNum.salesrrdersOriginaltotal=( this.detailsPlanNum.salesrrdersOriginaltotal==''|| !this.detailsPlanNum.salesrrdersOriginaltotal)?'':Number( this.detailsPlanNum.salesrrdersOriginaltotal).toFixed(2)//销售订单原币金额   
+    },
+
     //计算短出货值
     calculation(val){
       var  average = 0
@@ -485,13 +564,13 @@ export default {
         }
         if(this.$refs.unitTabs.shipData.length!==0 ){this.$refs.unitTabs.shipData.push(allObj)}
         this.$refs.unitTabs.shipData.map(item=>{
-          item.shipQuantity = Number(item.shipQuantity).toFixed(0)
-          item.exportUnitPrice = Number(item.exportUnitPrice).toFixed(4)
-          item.exportPrice = Number(item.exportPrice).toFixed(2)
-          item.rmbAmount = Number(item.rmbAmount).toFixed(2)
-          item.procesUnitPricermb = Number(item.procesUnitPricermb).toFixed(4)
-          item.procesUnitPriceusd = Number(item.procesUnitPriceusd).toFixed(4)
-          item.processCost = Number(item.processCost).toFixed(4)
+          item.shipQuantity = Number(item.shipQuantity)
+          item.exportUnitPrice = Number(item.exportUnitPrice)
+          item.exportPrice = Number(item.exportPrice)
+          item.rmbAmount = Number(item.rmbAmount)
+          item.procesUnitPricermb = Number(item.procesUnitPricermb)
+          item.procesUnitPriceusd = Number(item.procesUnitPriceusd)
+          item.processCost = Number(item.processCost)
         })
     },
     //辅料中的合计行
@@ -522,16 +601,16 @@ export default {
         })
       var allObj ={
           goodsName:'合计',
-          ingredientsTransferQuantity:ingredientsTransferQuantityALll.toFixed(3),
-          transferCost:transferCostAll.toFixed(3),
-          usageQuantity:usageQuantityAll.toFixed(3),
-          purchaseQuantity:purchaseQuantityAll.toFixed(3),
-          ingredientsRemainingQuantity:ingredientsRemainingQuantityAll.toFixed(3),
-          loss:lossAll.toFixed(3),
-          rmbAmount:rmbAmountAll.toFixed(3),
-          usdAmount:usdAmountAll.toFixed(3),
-          priceExcludingtax:priceExcludingtaxAll.toFixed(3),
-          dosage:dosageAll.toFixed(3)
+          ingredientsTransferQuantity:ingredientsTransferQuantityALll,
+          transferCost:transferCostAll,
+          usageQuantity:usageQuantityAll,
+          purchaseQuantity:purchaseQuantityAll,
+          ingredientsRemainingQuantity:ingredientsRemainingQuantityAll,
+          loss:lossAll,
+          rmbAmount:rmbAmountAll,
+          usdAmount:usdAmountAll,
+          priceExcludingtax:priceExcludingtaxAll,
+          dosage:dosageAll
         }
      if(this.$refs.unitTabs.ingData[this.$refs.unitTabs.ingData.length-1].goodsName=='合计'){this.$refs.unitTabs.ingData.pop()}
         if(this.$refs.unitTabs.ingData.length!==0 ){  this.$refs.unitTabs.ingData.push(allObj)}
@@ -550,11 +629,12 @@ export default {
      })
      var obj={
       setNo:'合计',
-      disbursedLocalmoney:disbursedLocalmoneyALL.toFixed(3),
-      disbursedOriginalmoney:disbursedOriginalmoneyALL.toFixed(3),
+      disbursedLocalmoney:disbursedLocalmoneyALL,
+      disbursedOriginalmoney:disbursedOriginalmoneyALL,
       shuiemoney:shuiemoneyAll.toFixed(3),
-      totalTaxIncrease:(disbursedLocalmoneyALL+shuiemoneyAll).toFixed(3)
+      totalTaxIncrease:(disbursedLocalmoneyALL+shuiemoneyAll)
      }
+     console.log(this.costPayData[this.costPayData.length-1])
      if(this.costPayData[this.costPayData.length-1].setNo=='合计'){this.costPayData.pop()}
      if(this.costPayData.length!==0){ this.costPayData.push(obj)}
     },

+ 143 - 23
src/views/reportForms/cost-allocation-table/tabs.vue

@@ -25,12 +25,12 @@
             </span>
             <!-- 面料 -转入数量 弹框-->
             <span slot="fabInQuaSlot" slot-scope="text">
-              <a>{{ text }}</a>
+              <a>{{ Number(text).toFixed(4) }}</a>
             </span>
 
             <!-- 余下数量-->
             <span slot="fabRemaQuaSlot" slot-scope="text">
-              <a>{{ text }}</a>
+              <a>{{ Number(text).toFixed(4) }}</a>
             </span>
             <!-- 备注 -->
             <span slot="remarks" slot-scope="text,record">
@@ -58,11 +58,11 @@
           </span>
             <!--辅料-转入数量 弹框-->
             <span slot="ingInQuaSlot" slot-scope="text">
-              <a>{{ text }}</a>
+              <a>{{ Number(text).toFixed(4) }}</a>
             </span>
             <!--辅料-余下数量 弹框-->
             <span slot="ingRemQuaSlot" slot-scope="text">
-              <a>{{ text }}</a>
+              <a>{{ Number(text).toFixed(4) }}</a>
             </span>
             <!-- 备注 -->
             <span slot="remarks" slot-scope="text,record">
@@ -232,17 +232,57 @@ export default {
           dataIndex: 'transferCost',
           width: '8%',
           className: 'replacecolor',
+          customRender: (text, record, index) => {
+            if(text!==''&&text){
+              return Number(text).toFixed(2)
+            }
+          },
           // slots:{title:'transferCostTitle'} ,
         },
 
-        { title: '单耗/件', dataIndex: 'unitConsumption', width: '9%', className: 'replacecolor' },
-        { title: '使用数量', dataIndex: 'usageQuantity', width: '9%', className: 'replacecolor' },
-        { title: '计划数量', dataIndex: 'planQuantity', width: '9%', className: 'replacecolor' },
+        { 
+          title: '单耗/件', 
+          dataIndex: 'unitConsumption', 
+          width: '9%', 
+          className: 'replacecolor',
+          customRender: (text, record, index) => {
+            if(text!==''&&text){
+              return Number(text).toFixed(4)
+            }
+          },
+         },
+        { 
+          title: '使用数量', 
+          dataIndex: 'usageQuantity', 
+          width: '9%', 
+          className: 'replacecolor' ,
+          customRender: (text, record, index) => {
+            if(text!==''&&text){
+              return Number(text).toFixed(4)
+            }
+          },
+        },
+        { 
+          title: '计划数量', 
+          dataIndex: 'planQuantity', 
+          width: '9%',
+          className: 'replacecolor' ,
+          customRender: (text, record, index) => {
+            if(text!==''&&text){
+              return Number(text).toFixed(4)
+            }
+          },
+          },
         {
           title: '购入数量',
           dataIndex: 'purchaseQuantity',
           width: '9%',
-          className: 'replacecolor'
+          className: 'replacecolor',
+          customRender: (text, record, index) => {
+            if(text!==''&&text){
+              return Number(text).toFixed(4)
+            }
+          },
         },
         {
           title: '余下数量',
@@ -256,13 +296,23 @@ export default {
           title: '损耗',
           dataIndex: 'loss',
           width: '9%',
-          className: 'replacecolor'
+          className: 'replacecolor',
+          customRender: (text, record, index) => {
+            if(text!==''&&text){
+              return Number(text).toFixed(4)
+            }
+          },
         },
         {
           title: '余下数量的成本',
           dataIndex: 'remainingQuantitycost',
           width: '9%',
           className: 'replacecolor',
+          customRender: (text, record, index) => {
+            if(text!==''&&text){
+              return Number(text).toFixed(2)
+            }
+          },
           // slots:{title:'remainingQuantitycostTitle'} ,
 
         },
@@ -307,15 +357,35 @@ export default {
           dataIndex: 'transferCost',
           width: '6%',
           className: 'replacecolor',
+          customRender: (text, record, index) => {
+            if(text!==''&&text){
+              return Number(text).toFixed(2)
+            }
+          },
           // slots:{title:'transferCostTitle'} ,
         },
 
-        { title: '使用数量', dataIndex: 'usageQuantity', width: '8%', className: 'replacecolor' },
+        { 
+          title: '使用数量', 
+          dataIndex: 'usageQuantity', 
+          width: '8%', 
+          className: 'replacecolor',
+          customRender: (text, record, index) => {
+            if(text!==''&&text){
+              return Number(text).toFixed(4)
+            }
+          },
+         },
         {
           title: '购入数量',
           dataIndex: 'purchaseQuantity',
           width: '8%',
-          className: 'replacecolor'
+          className: 'replacecolor',
+          customRender: (text, record, index) => {
+            if(text!==''&&text){
+              return Number(text).toFixed(4)
+            }
+          },
         },
         {
           title: '余下数量',
@@ -329,13 +399,23 @@ export default {
           title: '损耗',
           dataIndex: 'loss',
           width: '6%',
-          className: 'replacecolor'
+          className: 'replacecolor',
+          customRender: (text, record, index) => {
+            if(text!==''&&text){
+              return Number(text).toFixed(4)
+            }
+          },
         },
         {
           title: '人民币金额',
           dataIndex: 'rmbAmount',
           width: '6%',
-          className: 'replacecolor'
+          className: 'replacecolor',
+          customRender: (text, record, index) => {
+            if(text!==''&&text){
+              return Number(text).toFixed(2)
+            }
+          },
         },
         {
           title: '美元金额',
@@ -346,14 +426,19 @@ export default {
             if (record.rmbAmount == record.usdAmount)
               return "";
             else
-              return record.usdAmount;
+              return Number(record.usdAmount).toFixed(2);
            } 
         },
         {
           title: '不含税金额',
           dataIndex: 'priceExcludingtax',
           width: '6%',
-          className: 'replacecolor'
+          className: 'replacecolor',
+          customRender: (text, record, index) => {
+            if(text!==''&&text){
+              return Number(text).toFixed(2)
+            }
+          },
         },
         // {
         //   title: '转出率',
@@ -371,7 +456,12 @@ export default {
           title: '用量',
           dataIndex: 'dosage',
           width: '6%',
-          className: 'replacecolor'
+          className: 'replacecolor',
+          customRender: (text, record, index) => {
+            if(text!==''&&text){
+              return Number(text).toFixed(4)
+            }
+          },
         },
         {
           title: '供应商',
@@ -433,31 +523,56 @@ export default {
           title: '出货数量',
           dataIndex: 'shipQuantity',
           width: '9%',
-          className: 'replacecolor'
+          className: 'replacecolor',
+          customRender: (text, record, index) => {
+            if(text!==''&&text){
+              return Number(text).toFixed(4)
+            }
+          },
         },
         {
           title: '外销单价',
           dataIndex: 'exportUnitPrice',
           width: '9%',
-          className: 'replacecolor'
+          className: 'replacecolor',
+          customRender: (text, record, index) => {
+            if(text!==''&&text){
+              return Number(text).toFixed(4)
+            }
+          },
         },
         {
           title: '外销总价',
           dataIndex: 'exportPrice',
           width: '9%',
-          className: 'replacecolor'
+          className: 'replacecolor',
+          customRender: (text, record, index) => {
+            if(text!==''&&text){
+              return Number(text).toFixed(2)
+            }
+          },
         },
         {
           title: '人民币金额',
           dataIndex: 'rmbAmount',
           width: '9%',
-          className: 'replacecolor'
+          className: 'replacecolor',
+          customRender: (text, record, index) => {
+            if(text!==''&&text){
+              return Number(text).toFixed(2)
+            }
+          },
         },
         {
           title: '加工单价(人民币)',
           dataIndex: 'procesUnitPricermb',
           width: '9%',
-          className: 'replacecolor'
+          className: 'replacecolor',
+          customRender: (text, record, index) => {
+            if(text!==''&&text){
+              return Number(text).toFixed(4)
+            }
+          },
         },
         {
           title: '加工单价(美元)',
@@ -468,14 +583,19 @@ export default {
             if (record.procesUnitPricermb == record.procesUnitPriceusd)
               return "";
             else
-              return record.procesUnitPriceusd;
+              return Number(record.procesUnitPriceusd).toFixed(4);
            } 
         },
         {
           title: '加工费(人民币)',
           dataIndex: 'processCost',
           width: '8%',
-          className: 'replacecolor'
+          className: 'replacecolor',
+          customRender: (text, record, index) => {
+            if(text!==''&&text){
+              return Number(text).toFixed(4)
+            }
+          },
         }
       ],
       shipData: [],