From 8319ca8d93e46780a48d6100b3804d5660fe0e7d Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期五, 05 九月 2025 13:46:08 +0800
Subject: [PATCH] feat: 页面

---
 src/views/ServiceChargeManage/ServiceChargeManage.vue |  124 ++++++++++++++++++++++++-----------------
 1 files changed, 73 insertions(+), 51 deletions(-)

diff --git a/src/views/ServiceChargeManage/ServiceChargeManage.vue b/src/views/ServiceChargeManage/ServiceChargeManage.vue
index 868fbbf..cdc4296 100644
--- a/src/views/ServiceChargeManage/ServiceChargeManage.vue
+++ b/src/views/ServiceChargeManage/ServiceChargeManage.vue
@@ -46,7 +46,7 @@
         </template>
         <template #btn>
           <el-button type="primary" link @click="handleDownloadTemplate()">缁撶畻鍗曟ā鏉�</el-button>
-          <el-button type="primary" @click="openDialog()">涓婁紶缁撶畻鍗�</el-button>
+          <el-button type="primary" @click="handleAdd()">涓婁紶缁撶畻鍗�</el-button>
           <el-button type="primary" @click="handleDownloadTemplate()">瀵煎嚭</el-button>
         </template>
       </ProTableQueryFilterBar>
@@ -55,18 +55,34 @@
         :columns="ServiceChargeManageColumns"
         :operationBtns="operationBtns"
       >
-        <template #operationBtn-uploadBtn="{ data, row }">
+        <template #operationBtn-uploadBtn="{ row }">
           <BlFileUpload
-            v-model:file-url="row.listFiles"
-            multiple
+            v-model:file-url="editForm.settlementUrl"
             ref="uploadRef"
             :showTip="false"
             :show-file-list="false"
             class="pro-table-operation-btn upload-style-btn"
             :on-success="(event) => handleUploadSuccess(event, row)"
             :limitFileSize="null"
+            :limit="1"
+            accept="xlsx,xls"
           >
             <el-button text type="primary" class="pro-table-operation-btn">涓婁紶</el-button>
+          </BlFileUpload>
+        </template>
+        <template #operationBtn-reUploadBtn="{ data, row }">
+          <BlFileUpload
+            v-model:file-url="editForm.settlementUrl"
+            ref="uploadRef"
+            :showTip="false"
+            :show-file-list="false"
+            class="pro-table-operation-btn upload-style-btn"
+            :on-success="(event) => handleUploadSuccess(event, row)"
+            :limitFileSize="null"
+            :limit="1"
+            accept="xlsx,xls"
+          >
+            <el-button text type="primary" class="pro-table-operation-btn">閲嶆柊涓婁紶</el-button>
           </BlFileUpload>
         </template>
       </ProTableV2>
@@ -93,7 +109,12 @@
   BlFileUpload,
 } from '@bole-core/components';
 import { ServiceChargeManageColumns } from './constants';
-import { EnumTaskSettlementStatusText, EnumTaskSettlementOrderStatusText } from '@/constants';
+import {
+  EnumTaskSettlementStatusText,
+  EnumTaskSettlementOrderStatusText,
+  EnumTaskSettlementOrderStatus,
+  EnumTaskSettlementStatus,
+} from '@/constants';
 import { downloadFileByUrl } from '@/utils';
 import * as taskServices from '@/services/api/task';
 import { ModelValueType } from 'element-plus';
@@ -106,40 +127,43 @@
 });
 
 const operationBtns = defineOperationBtns([
-  // {
-  //   data: {
-  //     enCode: 'uploadBtn',
-  //     name: '涓婁紶',
-  //   },
-  //   emits: {
-  //     onClick: (role) => openDialog(role),
-  //   },
-  //   extraProps: {
-  //     hide: () => false,
-  //   },
-  // },
-  // {
-  //   data: {
-  //     enCode: 'reUploadBtn',
-  //     name: '閲嶆柊涓婁紶',
-  //   },
-  //   emits: {
-  //     onClick: (role) => openDialog(role),
-  //   },
-  //   extraProps: {
-  //     hide: () => false,
-  //   },
-  // },
+  {
+    data: {
+      enCode: 'uploadBtn',
+      name: '涓婁紶',
+    },
+    extraProps: {
+      hide: (row: API.GetSettlementTasksQueryResultItem) =>
+        row.settlementOrderStatus !== EnumTaskSettlementOrderStatus.Wait,
+    },
+  },
+  {
+    data: {
+      enCode: 'reUploadBtn',
+      name: '閲嶆柊涓婁紶',
+    },
+    extraProps: {
+      hide: (row: API.GetSettlementTasksQueryResultItem) =>
+        !(
+          row.settlementOrderStatus === EnumTaskSettlementOrderStatus.Completed &&
+          row.settlementStatus === EnumTaskSettlementStatus.Wait
+        ),
+    },
+  },
   {
     data: {
       enCode: 'settleBtn',
       name: '缁撶畻',
     },
     emits: {
-      onClick: (role) => openSettleDialog(role),
+      onClick: (role: API.GetSettlementTasksQueryResultItem) => openSettleDialog(role),
     },
     extraProps: {
-      hide: () => false,
+      hide: (role: API.GetSettlementTasksQueryResultItem) =>
+        !(
+          role.settlementOrderStatus === EnumTaskSettlementOrderStatus.Completed &&
+          role.settlementStatus === EnumTaskSettlementStatus.Wait
+        ),
     },
   },
   {
@@ -161,7 +185,11 @@
       name: '璇︽儏',
     },
     emits: {
-      onClick: (role) => goDetail(role),
+      onClick: (role: API.GetSettlementTasksQueryResultItem) => goDetail(role.id),
+    },
+    extraProps: {
+      hide: (role: API.GetSettlementTasksQueryResultItem) =>
+        role.settlementOrderStatus === EnumTaskSettlementOrderStatus.Wait,
     },
   },
   {
@@ -245,28 +273,20 @@
   }
 );
 
-const { dialogProps, handleAdd, handleEdit, editForm } = useFormDialog({
+const { dialogProps, handleAdd, editForm } = useFormDialog({
   onConfirm: handleAddOrEdit,
   defaultFormParams: {
+    code: '',
     id: '',
     name: '',
     settlementUrl: [] as UploadUserFile[],
   },
 });
 
-function openDialog(row?: API.GetSettlementTasksQueryResultItem) {
-  if (row) {
-    handleEdit({
-      id: row?.id,
-      name: row?.name,
-      settlementUrl: [] as UploadUserFile[],
-    });
-  } else {
-    handleAdd();
-  }
+async function handleAddOrEdit() {
+  console.log('editForm: ', editForm);
+  goDetail(editForm.id, editForm.settlementUrl[0]?.path);
 }
-
-async function handleAddOrEdit() {}
 
 const {
   dialogProps: dialogSettleProps,
@@ -301,8 +321,8 @@
     id: row.id,
     name: row.name,
     code: row.code,
-    settlementUserCount: row.settlementUserCount,
-    settlementAmount: row.settlementAmount,
+    settlementUserCount: row.settlementUserCount ?? 0,
+    settlementAmount: row.settlementAmount ?? 0,
   });
 }
 
@@ -324,16 +344,18 @@
   response: UploadUserFile & { file: File & { uid: number } },
   row: API.GetSettlementTasksQueryResultItem
 ) {
-  if (response.url) {
-    goDetail(row, response.url);
+  if (response.path) {
+    goDetail(row.id, response.path);
   }
 }
 
-function goDetail(row: API.GetSettlementTasksQueryResultItem, url?: string) {
+function goDetail(id: string, url?: string) {
   router.push({
     name: 'ServiceChargeDetail',
+    params: {
+      id: id,
+    },
     query: {
-      id: row.id,
       url: url ? url : '',
     },
   });

--
Gitblit v1.9.1