Przeglądaj źródła

Merge branch 'master' of http://139.196.39.194:9021/chenc/sen-yu-new-web

jbb 2 lat temu
rodzic
commit
93e5177268
1 zmienionych plików z 90 dodań i 22 usunięć
  1. 90 22
      src/views/reportForms/fabric-loss-table.vue

+ 90 - 22
src/views/reportForms/fabric-loss-table.vue

@@ -219,7 +219,7 @@
           :data-source="fabricLoss.fabricCostClothesList"
           bordered
           :pagination="false"
-          
+          :footer="clothesFooterShow"
         >
           <!-- 发票数量 -->
           <span slot="clInvoiceQuantity" slot-scope="text">
@@ -235,9 +235,10 @@
           :row-key="record => record.id"
           :loading="loading"
           :columns="costInvoiceIngredientColumns"
-          :data-source="fabricLoss.costInvoiceIngredientData"
+          :data-source="fabricLoss.fabricCostAssistList"
           bordered
           :pagination="false"
+          :footer="assistFooterShow"
         >
           <!-- 发票数量 -->
           <span slot="ingredientsInvoiceQuantity" slot-scope="text">
@@ -623,13 +624,32 @@ export default {
         { invoiceNum: '18TW-MYA-78', supplier: '供应商1', PurchaseinvoiceCost: '888.88', outData: '2018-05-18' },
         { invoiceNum: '18TW-MYA-34', supplier: '供应商1', PurchaseinvoiceCost: '888.88', outData: '2018-06-1' }
       ],
+      // 开票成本-成衣 表头动态,可能会隐藏人民币列
+      costInvoiceClothesColumns:[
+        { title: '发票号码', width: 120, dataIndex: 'cpbvcode', className: 'replacecolor' },
+        { title: '委外供应商', width: 120, dataIndex: 'cvenAbbName', className: 'replacecolor' },
+        { title: '成衣加工费(人民币)', width: 120, dataIndex: 'isum', className: 'replacecolor' },
+        { title: '成衣加工费(美元)', width: 120, dataIndex: 'ioriSum', className: 'replacecolor' },
+        
+        { title: '出运日期', width: 120, dataIndex: 'cshipTime', className: 'replacecolor' },
+        { title: '入库数量', width: 120, dataIndex: 'iquantity', className: 'replacecolor' },
+        {
+          title: '发票数量',
+          dataIndex: 'ipbvquantity',
 
+          width: 120,
+          className: 'replacecolor',
+          customCell: this.clInvoiceQuantityCustomCell,
+          scopedSlots: { customRender: 'clInvoiceQuantity' }
+        }
+      ],
       // 开票成本-成衣 表头
-      costInvoiceClothesColumns: [
+      costInvoiceClothesColumnsAll: [
         { title: '发票号码', width: 120, dataIndex: 'cpbvcode', className: 'replacecolor' },
         { title: '委外供应商', width: 120, dataIndex: 'cvenAbbName', className: 'replacecolor' },
-        { title: '成衣加工费', width: 120, dataIndex: 'isum', className: 'replacecolor' },
-        { title: '出运日期', width: 120, dataIndex: 'outData', className: 'replacecolor' },
+        { title: '成衣加工费(人民币)', width: 120, dataIndex: 'isum', className: 'replacecolor' },
+        { title: '成衣加工费(美元)', width: 120, dataIndex: 'ioriSum', className: 'replacecolor' },        
+        { title: '出运日期', width: 120, dataIndex: 'cshipTime', className: 'replacecolor' },
         { title: '入库数量', width: 120, dataIndex: 'iquantity', className: 'replacecolor' },
         {
           title: '发票数量',
@@ -670,23 +690,23 @@ export default {
 
       // 开票成本-辅料 表头
       costInvoiceIngredientColumns: [
-        { title: '账套号', width: 120, dataIndex: 'setNo', className: 'replacecolor' },
-        { title: '订单号', width: 120, dataIndex: 'orderNum', className: 'replacecolor' },
-        { title: '工厂', width: 120, dataIndex: 'factory', className: 'replacecolor' },
-        { title: ' 类型', width: 120, dataIndex: 'type', className: 'replacecolor' },
+        { title: '账套号', width: 80, dataIndex: 'caccount', className: 'replacecolor' },
+        { title: '订单号', width: 120, dataIndex: 'cpoid', className: 'replacecolor' },
+        { title: '供应商', width: 120, dataIndex: 'cvenAbbName', className: 'replacecolor' },
+        { title: ' 类型', width: 350, dataIndex: 'cinvName', className: 'replacecolor',align:"left" },
         {
           title: '发票数量',
           width: 120,
-          dataIndex: 'ingredientsInvoiceQuantity',
+          dataIndex: 'iquantityInvoice',
           className: 'replacecolor',
           customCell: this.ingredientsInvoiceQuantityCustomCell,
           scopedSlots: { customRender: 'ingredientsInvoiceQuantity' }
         },
-        { title: '开票金额(人民币)', width: 120, dataIndex: 'invoiceAmountCNY', className: 'replacecolor' },
-        { title: '开票金额(美金)', width: 120, dataIndex: 'invoiceAmountUSD', className: 'replacecolor' },
-        { title: '单位', width: 120, dataIndex: 'unit', className: 'replacecolor' },
-        { title: '订单数', width: 120, dataIndex: 'orderQuantity', className: 'replacecolor' },
-        { title: '采购入库数', width: 120, dataIndex: 'purchaseInQuantity', className: 'replacecolor' }
+        { title: '开票金额(人民币)', width: 120, dataIndex: 'isum', className: 'replacecolor' },
+        { title: '开票金额(美元)', width: 120, dataIndex: 'ioriSum', className: 'replacecolor' },
+        { title: '单位', width: 120, dataIndex: 'ccomUnitName', className: 'replacecolor' },
+        { title: '订单数', width: 120, dataIndex: 'iquantity', className: 'replacecolor' },
+        { title: '采购入库数', width: 120, dataIndex: 'iquantityIn', className: 'replacecolor' }
       ],
       costInvoiceIngredientData: [
         { factory: '森加', type: '主标', ingredientsInvoiceQuantity: '45900', invoiceAmountCNY: '259.42' },
@@ -737,6 +757,11 @@ export default {
             this.loading = false;
             if (res.success) {
               this.fabricLoss = res.result;
+              this.costInvoiceClothesColumns =JSON.parse(JSON.stringify(this.costInvoiceClothesColumnsAll));
+              // 获取原币和本币金额是否完全相同,完全相同隐藏美元列
+              var findList = this.fabricLoss.fabricCostClothesList.filter(e=>e.ioriSum!=e.isum);
+              if (findList.length == 0)
+                this.costInvoiceClothesColumns.splice(3,1);
               // console.log('染损列表', this.dyeLossRateData)
             }else{
               this.fabricLoss = {fabricPoOrderList:[],fabricOMOrderList1:[],fabricOMOrderList2:[]};
@@ -861,8 +886,6 @@ export default {
 
     // 开票成本-成衣 ----合计行
     clothesFooterShow(data) {
-      console.log('开票成本-成衣 ----合计行')
-      console.log('data', data)
       return (
         <a-table
           rowKey={Math.random}
@@ -875,6 +898,20 @@ export default {
       )
     },
 
+    // 开票成本-辅料 ----合计行
+    assistFooterShow(data) {
+      return (
+        <a-table
+          rowKey={Math.random}
+          bordered={false}
+          pagination={false}
+          columns={this.costInvoiceIngredientColumns}
+          dataSource={this.assistFooterDataSource || []}
+          showHeader={false}
+        ></a-table>
+      )
+    },
+
     // 成衣-发票数量
     clInvoiceQuantityCustomCell(record) {
       return {
@@ -965,12 +1002,43 @@ export default {
     },
     clothesFooterDataSource() {
       // 开票成本-面料 合计
-      const total = Object.assign({}, this.costInvoiceClothesData[0])
-      for (const attr in total) {
-        total[attr] = '合计'
-        break
+      var item = {
+        "cpbvcode":"合计"
+      };
+      var isum = 0,ioriSum=0,iquantity=0,ipbvquantity=0;
+      for (let row of this.fabricLoss.fabricCostClothesList){
+        isum += row.isum*1;
+        ioriSum += row.ioriSum*1;
+        iquantity += row.iquantity*1;
+        ipbvquantity += row.ipbvquantity*1;
       }
-      return [total]
+      
+      item.isum= parseFloat(isum.toFixed(2));
+      item.ioriSum = parseFloat(ioriSum.toFixed(2));
+      item.iquantity = parseFloat(iquantity.toFixed(4));
+      item.ipbvquantity = parseFloat(ipbvquantity.toFixed(4));
+      return [item]
+    },
+    assistFooterDataSource() {
+      // 开票成本-辅料 合计
+      var item = {
+        "caccount":"合计"
+      };
+      var isum = 0,ioriSum=0,iquantity=0,iquantityIn=0,iquantityInvoice=0;
+      for (let row of this.fabricLoss.fabricCostAssistList){
+        isum += row.isum*1;
+        ioriSum += row.ioriSum*1;
+        iquantity += row.iquantity*1;
+        iquantityIn += row.iquantityIn*1;
+        iquantityInvoice += row.iquantityInvoice*1;
+      }
+      
+      item.isum= parseFloat(isum.toFixed(2));
+      item.ioriSum = parseFloat(ioriSum.toFixed(2));
+      item.iquantity = parseFloat(iquantity.toFixed(4));
+      item.iquantityIn = parseFloat(iquantityIn.toFixed(4));
+      item.iquantityInvoice = parseFloat(iquantityInvoice.toFixed(4));
+      return [item]
     }
   }
 }