From 50b6007b336a65b7deb6c77c9fdc608865067608 Mon Sep 17 00:00:00 2001
From: 张诺 <2864490065@qq.com>
Date: 星期五, 25 七月 2025 16:31:57 +0800
Subject: [PATCH] 昭德改善销售数量

---
 src/views/salesOutbound/index.vue |   84 +++++++++++++++++++++++++++--------------
 1 files changed, 55 insertions(+), 29 deletions(-)

diff --git a/src/views/salesOutbound/index.vue b/src/views/salesOutbound/index.vue
index 09430b9..fef7e86 100644
--- a/src/views/salesOutbound/index.vue
+++ b/src/views/salesOutbound/index.vue
@@ -2,27 +2,20 @@
   <div class="app-container">
     <el-form :inline="true" :model="queryParams" class="search-form">
       <el-form-item label="閿�鍞棩鏈�">
-        <el-date-picker
-            v-model="queryParams.saleDate"
-            type="date"
-            placeholder="璇烽�夋嫨"
-            value-format="YYYY-MM-DD"
-            format="YYYY-MM-DD"
-            clearable
-        />
-      </el-form-item>
-      <el-form-item label="瀹㈡埛">
-        <el-input
-            v-model="queryParams.customer"
-            placeholder="璇疯緭鍏�"
-            clearable
-            :style="{ width: '100%' }"
-        />
+				<el-date-picker
+					v-model="queryParams.saleDate"
+					type="date"
+					value-format="YYYY-MM-DD"
+					format="YYYY-MM-DD"
+					clearable
+					style="width: 100%"
+					placeholder="璇烽�夋嫨鏃ユ湡"
+				/>
       </el-form-item>
       <el-form-item label="鐓ょ">
         <el-input
             v-model="queryParams.coal"
-            placeholder="璇疯緭鍏�"
+            placeholder="璇疯緭鍏ョ叅绉�"
             clearable
             :style="{ width: '100%' }"
         />
@@ -44,7 +37,7 @@
       </el-tabs>
       <!-- 鎿嶄綔鎸夐挳鍖� -->
       <el-space>
-        <el-button type="primary" :icon="Plus" @click="openDia()">鏂板缓</el-button>
+        <el-button type="primary" :icon="Plus" @click="openDia(undefined, 'add')">鏂板缓</el-button>
         <el-button type="danger" :icon="Delete" @click="handleDelete">鍒犻櫎</el-button>
         <el-button type="info" plain :icon="Download" @click="handleExport">瀵煎嚭</el-button>
       </el-space>
@@ -56,15 +49,18 @@
                 @selection-change="handleSelectionChange"
                 :show-selection="true"
                 :border="true"
+                :operations="operationsArr"
                 style="width: 100%;height: calc(100vh - 30em)"
-                @edit="openDia"></ETable>
+                @edit="(row) => openDia(row, 'edit')"
+                @viewRow="(row) => openDia(row, 'view')"
+        ></ETable>
       </div>
       <pagination
           v-if="total>0"
-          :page-num="pageNum"
-          :page-size="pageSize"
+          :page="pageNum"
+          :limit="pageSize"
           :total="total"
-          @pagination="handleQuery"
+          @pagination="handlePagination"
           :layout="'total, prev, pager, next, jumper'"
       />
     </el-card>
@@ -76,6 +72,7 @@
 import {ref, reactive, onMounted} from "vue";
 const { proxy } = getCurrentInstance()
 import {Delete, Download, Plus} from "@element-plus/icons-vue";
+import { ElMessage } from "element-plus";
 import ETable from "@/components/Table/ETable.vue";
 import Pagination from "@/components/Pagination/index.vue";
 import FormDia from "@/views/salesOutbound/components/formDia.vue";
@@ -88,6 +85,7 @@
   { name: "out", label: "閿�鍞嚭搴�" },
 ]);
 // 琛ㄦ牸鏁版嵁
+const operationsArr = ref(['edit', 'viewRow']);
 const tableLoading = ref(false);
 const tableData = ref([]);
 const columns = ref([
@@ -100,7 +98,8 @@
   { prop: "saleQuantity", label: "閿�鍞暟閲�", minWidth: 120 },
   { prop: "salePrice", label: "閿�鍞崟浠�(鍚◣)", minWidth: 150 },
   { prop: "totalAmount", label: "閿�鍞�讳环(鍚◣)", minWidth: 120 },
-  { prop: "freight", label: "杩愯垂", minWidth: 90 },
+  { prop: "salesFreight", label: "閿�鍞繍璐�", minWidth: 90 },
+  { prop: "purchasingFreight", label: "閲囪喘杩愯垂", minWidth: 90 },
   { prop: "taxCoal", label: "璐攢鐓ょ◣鐜�(%)", minWidth: 120 },
   { prop: "taxTrans", label: "杩愯緭绋庣巼(%)", minWidth: 120 },
   { prop: "grossProfit", label: "姣涘埄娑�", minWidth: 90 },
@@ -114,9 +113,8 @@
 const pageSize = ref(10);
 // 鏌ヨ鍙傛暟
 const queryParams = reactive({
-  saleDate: "",
-  customer: "",
-  coal: "",
+	saleDate: "",
+	coal: "",
 })
 onMounted(() => {
   handleQuery()
@@ -144,10 +142,15 @@
   });
   handleQuery();
 };
+// 鍒嗛〉澶勭悊
+const handlePagination = (val) => {
+	pageNum.value = val.page;
+	pageSize.value = val.limit;
+	getList();
+};
 // 鏂板鍑哄簱
-const openDia = (row) => {
+const openDia = (row, type) => {
   console.log(row)
-  const type = row === undefined ? 'add' : 'edit'
   nextTick(() => {
     formDia.value?.openDialog(type, row)
   })
@@ -168,7 +171,30 @@
 };
 // 瀵煎嚭鍑哄簱
 const handleExport = () => {
-
+  const config = { api: "/salesRecord/export", name: "閿�鍞嚭搴�" };
+  proxy.$modal
+    .confirm(
+      "鏄惁瑕佸鍑�" +
+        (selectedRows.value.length > 0
+          ? `閫変腑鐨�${selectedRows.value.length}鏉
+          : "鍏ㄩ儴") +
+        "鏁版嵁锛�"
+    )
+    .then((res) => {
+      if (!res) return;
+        exportData(config.api, config.name);
+    })
+    .catch(() => {
+      ElMessage.error("瀵煎嚭澶辫触锛岃閲嶈瘯");
+    });
+};
+const exportData = (api, name) => {
+  proxy.download(
+    api,
+    { exportIds: selectedRows.value.map((row) => row.id) },
+    `${new Date().getTime()}${name}${new Date().toLocaleDateString("en-CA")}.xlsx`
+  );
+  ElMessage.success("瀵煎嚭鏁版嵁锛�" + name);
 };
 // 閫夋嫨琛�
 const handleSelectionChange = (selection) => {

--
Gitblit v1.9.3