cz пре 1 година
родитељ
комит
b8be941dba
1 измењених фајлова са 96 додато и 1 уклоњено
  1. 96 1
      src/views/finance/fundManage/comeAndGo/index.vue

+ 96 - 1
src/views/finance/fundManage/comeAndGo/index.vue

@@ -6,6 +6,7 @@
       :config="config"
       :loading="loading"
       :selectConfig="selectConfig"
+      :statConfig="statConfig"
       highlight-current-row
       :action-list="[
         {
@@ -204,6 +205,64 @@ const selectConfig = computed(() => {
     },
   ];
 });
+const headerData = ref({
+  incMoney: 0,
+  expMoney: 0,
+  balance: 0,
+  list: [],
+});
+const statConfig = computed(() => [
+  {
+    label: "统计",
+    data: [
+      //一个卡牌多数据配置
+      {
+        label: "合计",
+        type: 2,
+        data: [
+          {
+            label: "应收款",
+            num: proxy.moneyFormat(headerData.value.incMoney, 2),
+            color: "#C280FF",
+          },
+          {
+            label: "应付款",
+            num: proxy.moneyFormat(headerData.value.expMoney, 2),
+            color: "#C280FF",
+          },
+          {
+            label: "结余",
+            num: proxy.moneyFormat(headerData.value.balance, 2),
+            color: "#C280FF",
+          },
+        ],
+      },
+      ...headerData.value.list.map((x) => {
+        return {
+          label: x.name,
+          type: 1,
+          data: [
+            {
+              label: "应收款",
+              num: proxy.moneyFormat(x.incMoney, 2),
+              color: "#0084ff",
+            },
+            {
+              label: "应付款",
+              num: proxy.moneyFormat(x.expMoney, 2),
+              color: "#0084ff",
+            },
+            {
+              label: "结余",
+              num: proxy.moneyFormat(x.balance, 2),
+              color: "#0084ff",
+            },
+          ],
+        };
+      }),
+    ],
+  },
+]);
 const config = computed(() => {
   return [
     {
@@ -293,7 +352,6 @@ const getDict = () => {
       if (res.rows && res.rows.length > 0) {
         accountList.value = res.rows.map((item) => {
           return {
-            ...item,
             label: item.alias + " (" + item.accountOpening + ")",
             value: item.id,
           };
@@ -329,6 +387,43 @@ const getList = async (req) => {
       loading.value = false;
     }, 200);
   });
+
+  proxy
+    .post("/transaction/getHeadStatistic", sourceList.value.pagination)
+    .then((res) => {
+      const data = {
+        incMoney: res.incMoney,
+        expMoney: res.expMoney,
+        balance: parseFloat(
+          Number(res.incMoney) - Number(res.expMoney)
+        ).toFixed(2),
+      };
+      const arr = [];
+      for (const key in res.tranList) {
+        let value = res.tranList[key];
+        let obj = {
+          name: key,
+          incMoney: 0,
+          expMoney: 0,
+          balance: 0,
+        };
+        for (let index = 0; index < value.length; index++) {
+          const ele = value[index];
+          if (ele.type == 0) {
+            obj.expMoney = ele.sumAmount;
+          } else if (ele.type == 1) {
+            obj.incMoney = ele.sumAmount;
+          }
+        }
+        // 计算结余
+        obj.balance = parseFloat(
+          Number(obj.incMoney) - Number(obj.expMoney)
+        ).toFixed(2);
+        arr.push(obj);
+      }
+      data.list = arr;
+      headerData.value = data;
+    });
 };
 getDict();
 getList();