From 2e77330d87341624c88301562fd137b58f9a101a Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 25 十二月 2025 10:57:35 +0800
Subject: [PATCH] 1.海川开心-录入日期都默认当天,封装公用组件和方法

---
 src/views/reportAnalysis/projectProfit/index.vue |  181 +++++++++++++++++++++++++-------------------
 1 files changed, 102 insertions(+), 79 deletions(-)

diff --git a/src/views/reportAnalysis/projectProfit/index.vue b/src/views/reportAnalysis/projectProfit/index.vue
index 82031bb..f61cbe5 100644
--- a/src/views/reportAnalysis/projectProfit/index.vue
+++ b/src/views/reportAnalysis/projectProfit/index.vue
@@ -1,103 +1,126 @@
 <template>
-  <div class="app-container">
-    <el-form :model="filters" :inline="true" label-width="80px">
-      <el-form-item label="瀹㈡埛鍚嶇О">
-        <el-input v-model="filters.customerName" placeholder="璇疯緭鍏ュ鎴峰悕绉�" />
-      </el-form-item>
-      <el-form-item>
-        <el-button type="primary" @click="getTableData"> 鎼滅储 </el-button>
-        <el-button @click="resetFilters"> 閲嶇疆 </el-button>
-      </el-form-item>
-    </el-form>
-    <div class="table_list">
-      <PIMTable
-        :column="columns"
-        :tableLoading="loading"
-        :tableData="dataList"
-        :page="{
+	<div class="app-container">
+		<el-form :model="filters" :inline="true" label-width="80px">
+			<el-form-item label="瀹㈡埛鍚嶇О">
+				<el-input v-model="filters.customerName" placeholder="璇疯緭鍏ュ鎴峰悕绉�" clearable style="width: 240px"/>
+			</el-form-item>
+			<el-form-item>
+				<el-button type="primary" @click="getTableData"> 鎼滅储 </el-button>
+				<el-button @click="resetFilters"> 閲嶇疆 </el-button>
+				<el-button @click="handleOut"> 瀵煎嚭 </el-button>
+			</el-form-item>
+		</el-form>
+		<div class="table_list">
+			<PIMTable
+				rowKey="id"
+				:column="columns"
+				:tableLoading="loading"
+				:tableData="dataList"
+				:page="{
           current: pagination.currentPage,
           size: pagination.pageSize,
-          total: pagination.total,
+          total: pagination.total
         }"
-        @pagination="onCurrentChange"
-      ></PIMTable>
-    </div>
-  </div>
+				:isShowSummary="true"
+				:summaryMethod="summarizeMainTable"
+				@pagination="changePage"
+			></PIMTable>
+		</div>
+	</div>
 </template>
 
 <script setup>
 import { usePaginationApi } from "@/hooks/usePaginationApi";
 import { getPurchaseList } from "@/api/procurementManagement/projectProfit";
-import { onMounted } from "vue";
+import { onMounted, getCurrentInstance } from "vue";
+import { ElMessageBox } from "element-plus";
+
+const { proxy } = getCurrentInstance();
 
 defineOptions({
-  name: "椤圭洰鍒╂鼎",
+	name: "椤圭洰鍒╂鼎",
 });
 
 const {
-  loading,
-  filters,
-  columns,
-  dataList,
-  pagination,
-  getTableData,
-  resetFilters,
-  onCurrentChange,
+	loading,
+	filters,
+	columns,
+	dataList,
+	pagination,
+	getTableData,
+	resetFilters,
+	onCurrentChange,
 } = usePaginationApi(
-  getPurchaseList,
-  {
-    customerName: undefined,
-  },
-  [
-    {
-      label: "閿�鍞悎鍚屽彿",
-      align: "center",
-      prop: "customerContractNo",
-    },
-    {
-      label: "瀹㈡埛鍚嶇О",
-      align: "center",
-      prop: "customerName",
-    },
-    {
-      label: "椤圭洰鍚嶇О",
-      align: "center",
-      prop: "projectName",
-    },
-    {
-      label: "鍚堝悓閲戦",
-      align: "center",
-      prop: "contractAmount",
-    },
-    {
-      label: "閲囪喘閲戦",
-      align: "center",
-      prop: "purchaseAmount",
-    },
-    {
-      label: "鍒╂鼎",
-      align: "center",
-      prop: "balance",
-    },
-    {
-      label: "鍒╂鼎鐜�",
-      align: "center",
-      prop: "balanceRatio",
-    },
-    {
-      label: "澧炲�肩◣",
-      align: "center",
-      prop: "balanceAmount",
-    },
-  ]
+	getPurchaseList,
+	{
+		customerName: undefined,
+	},
+	[
+		{
+			label: "閿�鍞悎鍚屽彿",
+			align: "center",
+			prop: "customerContractNo",
+		},
+		{
+			label: "瀹㈡埛鍚嶇О",
+			align: "center",
+			prop: "customerName",
+		},
+		{
+			label: "鍚堝悓閲戦",
+			align: "center",
+			prop: "contractAmount",
+		},
+		{
+			label: "閲囪喘閲戦",
+			align: "center",
+			prop: "purchaseAmount",
+		},
+		{
+			label: "鍒╂鼎",
+			align: "center",
+			prop: "balance",
+		},
+		{
+			label: "鍒╂鼎鐜�",
+			align: "center",
+			prop: "balanceRatio",
+		},
+	]
 );
 
+const changePage = ({ page, limit }) => {
+	pagination.currentPage = page;
+	pagination.pageSize = limit;
+	onCurrentChange(page);
+};
+
+// 涓昏〃鍚堣鏂规硶
+const summarizeMainTable = (param) => {
+	return proxy.summarizeTable(param, ["contractAmount", "purchaseAmount", "balance"]);
+};
+
+// 瀵煎嚭
+const handleOut = () => {
+	ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+		confirmButtonText: "纭",
+		cancelButtonText: "鍙栨秷",
+		type: "warning",
+	})
+		.then(() => {
+			proxy.download("/purchase/report/export", {}, "椤圭洰鍒╂鼎.xlsx");
+		})
+		.catch(() => {
+			proxy.$modal.msg("宸插彇娑�");
+		});
+};
+
 onMounted(() => {
-  getTableData();
+	getTableData();
 });
 </script>
 <style lang="scss" scoped>
 .table_list {
-  margin-top: unset;
+	margin-top: unset;
 }
 </style>

--
Gitblit v1.9.3