|
@@ -8,10 +8,10 @@ import { hetongClient } from '@/client/api';
|
|
|
import type { InferResponseType } from 'hono/client';
|
|
import type { InferResponseType } from 'hono/client';
|
|
|
import dayjs from 'dayjs';
|
|
import dayjs from 'dayjs';
|
|
|
|
|
|
|
|
-// 合同状态枚举
|
|
|
|
|
-const CONTRACT_STATUS = {
|
|
|
|
|
- PENDING: '待审',
|
|
|
|
|
- ACTIVE: '合同有效'
|
|
|
|
|
|
|
+// 合同状态映射
|
|
|
|
|
+const CONTRACT_STATUS_MAP = {
|
|
|
|
|
+ pending: '待审',
|
|
|
|
|
+ active: '合同有效'
|
|
|
} as const;
|
|
} as const;
|
|
|
|
|
|
|
|
// 定义类型
|
|
// 定义类型
|
|
@@ -128,7 +128,7 @@ const Contracts: React.FC = () => {
|
|
|
const response = await hetongClient[':id'].$put({
|
|
const response = await hetongClient[':id'].$put({
|
|
|
param: { id },
|
|
param: { id },
|
|
|
json: {
|
|
json: {
|
|
|
- status: '合同有效',
|
|
|
|
|
|
|
+ status: 'active',
|
|
|
auditTime: new Date().toISOString()
|
|
auditTime: new Date().toISOString()
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
@@ -221,7 +221,7 @@ const Contracts: React.FC = () => {
|
|
|
dataIndex: 'amount',
|
|
dataIndex: 'amount',
|
|
|
key: 'amount',
|
|
key: 'amount',
|
|
|
width: 120,
|
|
width: 120,
|
|
|
- render: (amount: number, record: HetongItem) =>
|
|
|
|
|
|
|
+ render: (amount: number, record: HetongItem) =>
|
|
|
`${record.currency || 'CNY'} ${Number(amount).toLocaleString()}`,
|
|
`${record.currency || 'CNY'} ${Number(amount).toLocaleString()}`,
|
|
|
align: 'right' as const,
|
|
align: 'right' as const,
|
|
|
},
|
|
},
|
|
@@ -250,11 +250,11 @@ const Contracts: React.FC = () => {
|
|
|
key: 'status',
|
|
key: 'status',
|
|
|
width: 100,
|
|
width: 100,
|
|
|
render: (status: string) => (
|
|
render: (status: string) => (
|
|
|
- <span style={{
|
|
|
|
|
- color: status === '合同有效' ? 'green' : 'orange',
|
|
|
|
|
|
|
+ <span style={{
|
|
|
|
|
+ color: status === 'active' ? 'green' : 'orange',
|
|
|
fontWeight: 'bold'
|
|
fontWeight: 'bold'
|
|
|
}}>
|
|
}}>
|
|
|
- {status}
|
|
|
|
|
|
|
+ {CONTRACT_STATUS_MAP[status as keyof typeof CONTRACT_STATUS_MAP] || status}
|
|
|
</span>
|
|
</span>
|
|
|
),
|
|
),
|
|
|
},
|
|
},
|
|
@@ -279,7 +279,7 @@ const Contracts: React.FC = () => {
|
|
|
fixed: 'right' as const,
|
|
fixed: 'right' as const,
|
|
|
render: (_: any, record: HetongItem) => (
|
|
render: (_: any, record: HetongItem) => (
|
|
|
<Space size="small">
|
|
<Space size="small">
|
|
|
- {record.status === '待审' && (
|
|
|
|
|
|
|
+ {(record as any).status === 'pending' && (
|
|
|
<Popconfirm
|
|
<Popconfirm
|
|
|
title="确认审核此合同?"
|
|
title="确认审核此合同?"
|
|
|
description={`将合同"${record.contractNumber}"状态设为"合同有效"`}
|
|
description={`将合同"${record.contractNumber}"状态设为"合同有效"`}
|
|
@@ -359,6 +359,7 @@ const Contracts: React.FC = () => {
|
|
|
}}
|
|
}}
|
|
|
onChange={handleTableChange}
|
|
onChange={handleTableChange}
|
|
|
bordered
|
|
bordered
|
|
|
|
|
+ scroll={{ x: 1200 }}
|
|
|
/>
|
|
/>
|
|
|
|
|
|
|
|
<Modal
|
|
<Modal
|
|
@@ -462,13 +463,14 @@ const Contracts: React.FC = () => {
|
|
|
<Form.Item
|
|
<Form.Item
|
|
|
name="status"
|
|
name="status"
|
|
|
label="合同状态"
|
|
label="合同状态"
|
|
|
|
|
+ initialValue="pending"
|
|
|
rules={[{ required: true, message: '请选择合同状态' }]}
|
|
rules={[{ required: true, message: '请选择合同状态' }]}
|
|
|
>
|
|
>
|
|
|
<Select
|
|
<Select
|
|
|
placeholder="请选择合同状态"
|
|
placeholder="请选择合同状态"
|
|
|
options={[
|
|
options={[
|
|
|
- { label: '待审', value: '待审' },
|
|
|
|
|
- { label: '合同有效', value: '合同有效' }
|
|
|
|
|
|
|
+ { label: '待审', value: 'pending' },
|
|
|
|
|
+ { label: '合同有效', value: 'active' }
|
|
|
]}
|
|
]}
|
|
|
/>
|
|
/>
|
|
|
</Form.Item>
|
|
</Form.Item>
|