Browse Source

✨ feat(contract): add received amount and audit time fields

- add receivedAmount field to contract schema with 0.01 precision validation
- add auditTime date field to contract schema, default to null
- add receivedAmount and auditTime to update contract DTO

♻️ refactor(contract): optimize contract table and audit time format

- adjust contract table horizontal scroll width from 1200 to 1600 for better display
- modify auditTime to pass Date object directly instead of ISO string
yourname 7 months ago
parent
commit
9c59501356

+ 2 - 2
src/client/admin/pages/Contracts.tsx

@@ -129,7 +129,7 @@ const Contracts: React.FC = () => {
         param: { id },
         param: { id },
         json: {
         json: {
           status: 'active',
           status: 'active',
-          auditTime: new Date().toISOString()
+          auditTime: new Date()
         }
         }
       });
       });
       if (!response.ok) throw new Error('Failed to audit contract');
       if (!response.ok) throw new Error('Failed to audit contract');
@@ -359,7 +359,7 @@ const Contracts: React.FC = () => {
         }}
         }}
         onChange={handleTableChange}
         onChange={handleTableChange}
         bordered
         bordered
-        scroll={{ x: 1200 }}
+        scroll={{ x: 1600 }}
       />
       />
       
       
       <Modal
       <Modal

+ 16 - 0
src/server/modules/contracts/hetong.entity.ts

@@ -131,6 +131,14 @@ export const HetongSchema = z.object({
     description: '合同状态:pending待审/active合同有效',
     description: '合同状态:pending待审/active合同有效',
     example: 'pending'
     example: 'pending'
   }),
   }),
+  receivedAmount: z.number().multipleOf(0.01).openapi({
+    description: '已收款金额',
+    example: 0.00
+  }),
+  auditTime: z.date().nullable().openapi({
+    description: '审核时间',
+    example: null
+  }),
   startDate: z.date().openapi({
   startDate: z.date().openapi({
     description: '开始日期',
     description: '开始日期',
     example: '2023-02-01'
     example: '2023-02-01'
@@ -288,5 +296,13 @@ export const UpdateHetongDto = z.object({
   filePath: z.string().max(512).nullable().optional().openapi({
   filePath: z.string().max(512).nullable().optional().openapi({
     description: '合同文件路径',
     description: '合同文件路径',
     example: '/uploads/contracts/2023/HT-2023-0001.pdf'
     example: '/uploads/contracts/2023/HT-2023-0001.pdf'
+  }),
+  receivedAmount: z.coerce.number().multipleOf(0.01).optional().openapi({
+    description: '已收款金额',
+    example: 50000.00
+  }),
+  auditTime: z.coerce.date().optional().openapi({
+    description: '审核时间',
+    example: '2023-01-16T00:00:00Z'
   })
   })
 });
 });