Преглед изворни кода

feat(财务): 添加支付与收款枚举并优化相关组件

liujt пре 4 месеци
родитељ
комит
e2bf34aa50

+ 39 - 0
src/enum/dict.js

@@ -436,3 +436,42 @@ export const paymentTypeOp = [
     label: '尾款'
   }
 ]
+
+export const payAndReceiveEnum = [
+  {
+    label: '对账单',
+    value: 1
+  },
+  {
+    label: '合同',
+    value: 2
+  },
+  {
+    label: '销售订单',
+    value: 3
+  },
+  {
+    label: '售后管理',
+    value: 4
+  },
+  {
+    label: '发货单',
+    value: 5
+  },
+  {
+    label: '采购收货单',
+    value: 6
+  },
+  {
+    label: '收款计划单',
+    value: 7
+  },
+  {
+    label: '付款计划单',
+    value: 8
+  },
+  {
+    label: '其他',
+    value: 99
+  },
+];

+ 27 - 23
src/views/bpm/handleTask/components/financialManage/invoiceManage/components/tableInfoNew.vue

@@ -409,7 +409,7 @@
     }
   },
     methods: {
-      convertToArrayFormat(data) {
+      convertToArrayFormat(data, type) {
           const result = [];
           Object.keys(data.productMap).forEach(key => {
             console.log('key!!!', key);
@@ -425,31 +425,35 @@
                 amountTotalPrice: amountTotalPrice,
                 defaultAmountTotalPrice: defaultAmountTotalPrice,
                 ...detail,
-                invoiceAmount: '',
+                invoiceAmount: detail.invoiceAmount || 0,
               });
             });
           });
+
+          if(type == 'setValue') {
+            // Allocate defaultAmountTotalPrice to invoiceAmount for each key group
+            const uniqueKeys = [...new Set(result.map(item => item.key))];
+            uniqueKeys.forEach(key => {
+              const sameKeyItems = result.filter(item => item.key === key);
+              if (sameKeyItems.length > 0) {
+                const defaultAmountTotalPrice = parseFloat(sameKeyItems[0].defaultAmountTotalPrice) || 0;
+                let remainingTotal = defaultAmountTotalPrice;
+                
+                sameKeyItems.forEach(item => {
+                  if (remainingTotal <= 0) {
+                    item.invoiceAmount = 0;
+                  } else {
+                    const unInvoiceAmount = parseFloat(item.unInvoiceAmount) || 0;
+                    const allocateAmount = Math.min(remainingTotal, unInvoiceAmount);
+                    item.invoiceAmount = allocateAmount.toFixed(2);
+                    remainingTotal -= allocateAmount;
+                  }
+                });
+              }
+            });
+          }
+          
           
-          // Allocate defaultAmountTotalPrice to invoiceAmount for each key group
-          const uniqueKeys = [...new Set(result.map(item => item.key))];
-          uniqueKeys.forEach(key => {
-            const sameKeyItems = result.filter(item => item.key === key);
-            if (sameKeyItems.length > 0) {
-              const defaultAmountTotalPrice = parseFloat(sameKeyItems[0].defaultAmountTotalPrice) || 0;
-              let remainingTotal = defaultAmountTotalPrice;
-              
-              sameKeyItems.forEach(item => {
-                if (remainingTotal <= 0) {
-                  item.invoiceAmount = 0;
-                } else {
-                  const unInvoiceAmount = parseFloat(item.unInvoiceAmount) || 0;
-                  const allocateAmount = Math.min(remainingTotal, unInvoiceAmount);
-                  item.invoiceAmount = allocateAmount.toFixed(2);
-                  remainingTotal -= allocateAmount;
-                }
-              });
-            }
-          });
           
           return result;
       },
@@ -532,7 +536,7 @@
       putValue(data) {
         let tempData = JSON.parse(JSON.stringify(data));
         console.log('tableInfoNew putValue', tempData);
-        tempData.detailList = this.convertToArrayFormat(tempData);
+        tempData.detailList = this.convertToArrayFormat(tempData, 'putValue');
         console.log('data.detailList', data.detailList);
         this.tableForm = tempData;
         console.log('tableInfoNew putValue~~~', this.tableForm);

+ 3 - 7
src/views/bpm/handleTask/components/financialManage/payableManage/components/detailDialog.vue

@@ -74,13 +74,7 @@
             style="margin-bottom: 22px"
           >
             <el-input
-              :value="
-                form.sourceType == 2
-                  ? '合同'
-                  : form.sourceType == 3
-                  ? '采购订单'
-                  : '对账单'
-              "
+              :value="form.sourceTypeName"
               disabled
             ></el-input>
           </el-form-item>
@@ -188,11 +182,13 @@
       async getInfo(id) {
         await this.getClassifyList(24, 'accountingSubjectList');
         let data = await getFinPayableInfoAPI(id);
+        data.sourceTypeName = payAndReceiveEnum.find(item=>item.value==data.sourceType)?.label;
         this.form = data;
         let invoiceData = {};
         if (data.invoiceId) {
           invoiceData = await invoiceApplyInfoAPI(data.invoiceId);
         }
+        
         this.form.accountingSubjectCode = invoiceData.accountingSubjectCode;
         this.form.accountingSubjectId = invoiceData.accountingSubjectId || '';
         this.form.accountingSubjectName = invoiceData.accountingSubjectName || '';

+ 3 - 11
src/views/bpm/handleTask/components/financialManage/receivableManage/components/detailDialog.vue

@@ -74,17 +74,7 @@
             style="margin-bottom: 22px"
           >
             <el-input
-              :value="
-                form.sourceType == 2
-                  ? '合同'
-                  : form.sourceType == 3
-                  ? '销售订单'
-                  : form.sourceType == 4
-                  ? '售后管理'
-                  : form.sourceType == 5
-                  ? '发货单'
-                  : '对账单'
-              "
+              :value="form.sourceTypeName"
               disabled
             ></el-input>
           </el-form-item>
@@ -134,6 +124,7 @@
     getFinReceivableInfoAPI
   } from '@/api/bpm/components/financialManage/receivableManage';
   import { getTreeByPid } from '@/api/classifyManage';
+  import { payAndReceiveEnum } from '@/enum/dict';
   // import fileMain from "@/components/addDoc/index.vue";
 
   export default {
@@ -196,6 +187,7 @@
       async getInfo(id) {
         await this.getClassifyList(24, 'accountingSubjectList');
         let data = await getFinReceivableInfoAPI(id);
+        data.sourceTypeName = payAndReceiveEnum.find(item=>item.value==data.sourceType)?.label;
         this.form = data;
         console.log('获取详情', data);
         let invoiceData = {};