fix:更新合同借阅 #20

Merged
zsq merged 1 commits from develop into main 2026-04-28 17:57:51 +08:00
9 changed files with 216 additions and 182 deletions
Showing only changes of commit 5955674382 - Show all commits

View File

@ -7,7 +7,7 @@ import {
import { ProTable } from '@ant-design/pro-components'; import { ProTable } from '@ant-design/pro-components';
import { Space } from 'antd'; import { Space } from 'antd';
import Show from './modals/Show'; import Show from './modals/Show';
export default function Index({ title = '我的发起' }) { export default function Index({ title = '我的已办' }) {
return ( return (
<MyPageContainer <MyPageContainer
title={title} title={title}

View File

@ -0,0 +1,162 @@
import {
MyButtons,
MyColumns,
MyProTableProps,
MyTableActions,
MyToolBarActions,
} from '@/common';
import { Apis } from '@/gen/Apis';
import { ContractArchiveBorrowStatusEnum } from '@/gen/Enums';
import EmployeeShow from '@/pages/company/employees/modals/EmployeeShow';
import CodeInfo from '@/pages/contract/contract_archives/modals/Show';
import { ProTable } from '@ant-design/pro-components';
import Read from '../read/modals/Read';
import Create from './modals/Create';
import Show from './modals/Show';
import Update from './modals/Update';
export default function Index({ title = '合同档案借用' }) {
return (
<ProTable
{...MyProTableProps.props}
request={async (params, sort) =>
MyProTableProps.request(
params,
sort,
Apis.Contract.ContractArchiveBorrows.List,
)
}
headerTitle="合同借用列表"
toolBarRender={(action) => [
<MyToolBarActions
key="toolbar"
actions={{
add: <Create key="Create" reload={action?.reload} title={title} />,
read: <Read key="Read" reload={action?.reload} title="合同借阅" />,
}}
/>,
]}
columns={[
MyColumns.ID({
search: false,
}),
MyColumns.EnumTag({
title: '借用状态',
dataIndex: 'borrow_status',
valueEnum: ContractArchiveBorrowStatusEnum,
}),
// MyColumns.EnumTag({
// title: '归还状态',
// dataIndex: 'return_status',
// valueEnum: ContractArchiveFileReturnStatusEnum,
// }),
{
title: '档案编号',
dataIndex: ['contract_archive', 'code'],
render: (_, item: any) => (
<CodeInfo
item={{ ...item, type: 'link', id: item?.contract_archives_id }}
title={item?.contract_archive?.code}
/>
),
},
{
title: '借用信息',
search: false,
render: (_, item: any) => {
if (!item?.contract_archive_borrow_files) {
return '-';
}
return (
<div>
{item.contract_archive_borrow_files.map(
(res: any, index: number) => (
<div key={index} style={{ marginBottom: 4 }}>
: {res?.contract_archive_file?.name}:
{res?.contract_archive_file?.borrow_number}:
{res?.contract_archive_file?.lost_number}:
{
res?.contract_archive_file?.contract_archive_file
?.lost_number
}
: {res?.contract_archive_file?.damaged_number}
</div>
),
)}
</div>
);
},
},
{
title: '借用人',
dataIndex: 'borrower_name',
search: false,
render: (_, item: any) => (
<EmployeeShow
item={{ ...item, type: 'link', id: item?.borrower_id }}
title={item?.borrower_name}
/>
),
},
{
title: '借用日期',
dataIndex: 'borrow_date',
search: false,
},
{
title: '应归还日期',
dataIndex: 'expected_return_date',
search: false,
},
MyColumns.Boolean({
title: '需要归还',
dataIndex: 'is_need_return',
search: false,
}),
{
title: '登记人',
dataIndex: ['registrar', 'name'],
search: false,
render: (_, item: any) => (
<EmployeeShow
item={{ ...item, type: 'link', id: item?.operator_id }}
title={item?.operator_name}
/>
),
},
// MyColumns.CreatedAt(),
MyColumns.UpdatedAt(),
MyColumns.Option({
width: 100,
render: (_, item: any, _index, action) => (
<MyTableActions
actions={{
show: (
<Show item={item} reload={action?.reload} title={title} />
),
record: (
<MyButtons.Default
title="登记"
type="primary"
disabled={item?.borrow_status !== 'Approved'}
isConfirm={true}
description={`是否确认借用人已领取?`}
onConfirm={() =>
Apis.Contract.ContractArchiveBorrows.Borrow({
id: item.id,
}).then(() => action?.reload())
}
/>
),
update: (
<Update item={item} reload={action?.reload} title={title} />
),
}}
/>
),
}),
]}
/>
);
}

View File

@ -1,22 +1,23 @@
import { import { MyPageContainer } from '@/common';
MyButtons, import { Tabs } from 'antd';
MyColumns, import { useState } from 'react';
MyPageContainer, import Borrows from './borrows';
MyProTableProps, import Read from './read';
MyTableActions,
MyToolBarActions,
} from '@/common';
import { Apis } from '@/gen/Apis';
import { ContractArchiveBorrowStatusEnum } from '@/gen/Enums';
import EmployeeShow from '@/pages/company/employees/modals/EmployeeShow';
import CodeInfo from '@/pages/contract/contract_archives/modals/Show';
import { ProTable } from '@ant-design/pro-components';
import Create from './modals/Create';
import Show from './modals/Show';
import Update from './modals/Update';
import Read from './read/modals/Read';
export default function Index({ title = '合同档案借用' }) { export default function Index({ title = '合同档案借用' }) {
const [activeKey, setActiveKey] = useState('Borrows');
const items = [
{
key: 'Borrows',
label: '合同借用',
children: <Borrows />,
},
{
key: 'Read',
label: '合同借阅',
children: <Read />,
},
];
return ( return (
<MyPageContainer <MyPageContainer
title={title} title={title}
@ -24,150 +25,13 @@ export default function Index({ title = '合同档案借用' }) {
tabKey="contract_borrows" tabKey="contract_borrows"
tabLabel={title} tabLabel={title}
> >
<ProTable <Tabs
{...MyProTableProps.props} type="card"
request={async (params, sort) => activeKey={activeKey}
MyProTableProps.request( items={items}
params, onChange={(key) => {
sort, setActiveKey(key);
Apis.Contract.ContractArchiveBorrows.List,
)
}
headerTitle="合同借用列表"
toolBarRender={(action) => [
<MyToolBarActions
key="toolbar"
actions={{
add: (
<Create key="Create" reload={action?.reload} title={title} />
),
read: (
<Read key="Read" reload={action?.reload} title="合同借阅" />
),
}} }}
/>,
]}
columns={[
MyColumns.ID({
search: false,
}),
MyColumns.EnumTag({
title: '借用状态',
dataIndex: 'borrow_status',
valueEnum: ContractArchiveBorrowStatusEnum,
}),
// MyColumns.EnumTag({
// title: '归还状态',
// dataIndex: 'return_status',
// valueEnum: ContractArchiveFileReturnStatusEnum,
// }),
{
title: '档案编号',
dataIndex: ['contract_archive', 'code'],
render: (_, item: any) => (
<CodeInfo
item={{ ...item, type: 'link', id: item?.contract_archives_id }}
title={item?.contract_archive?.code}
/>
),
},
{
title: '借用信息',
search: false,
render: (_, item: any) => {
if (!item?.contract_archive_borrow_files) {
return '-';
}
return (
<div>
{item.contract_archive_borrow_files.map(
(res: any, index: number) => (
<div key={index} style={{ marginBottom: 4 }}>
: {res?.contract_archive_file?.name}:
{res?.contract_archive_file?.borrow_number}:
{res?.contract_archive_file?.lost_number}:
{
res?.contract_archive_file?.contract_archive_file
?.lost_number
}
: {res?.contract_archive_file?.damaged_number}
</div>
),
)}
</div>
);
},
},
{
title: '借用人',
dataIndex: 'borrower_name',
search: false,
render: (_, item: any) => (
<EmployeeShow
item={{ ...item, type: 'link', id: item?.borrower_id }}
title={item?.borrower_name}
/>
),
},
{
title: '借用日期',
dataIndex: 'borrow_date',
search: false,
},
{
title: '应归还日期',
dataIndex: 'expected_return_date',
search: false,
},
MyColumns.Boolean({
title: '需要归还',
dataIndex: 'is_need_return',
search: false,
}),
{
title: '登记人',
dataIndex: ['registrar', 'name'],
search: false,
render: (_, item: any) => (
<EmployeeShow
item={{ ...item, type: 'link', id: item?.operator_id }}
title={item?.operator_name}
/>
),
},
// MyColumns.CreatedAt(),
MyColumns.UpdatedAt(),
MyColumns.Option({
width: 100,
render: (_, item: any, _index, action) => (
<MyTableActions
actions={{
show: (
<Show item={item} reload={action?.reload} title={title} />
),
record: (
<MyButtons.Default
title="登记"
type="primary"
disabled={item?.borrow_status !== 'Approved'}
isConfirm={true}
description={`是否确认借用人已领取?`}
onConfirm={() =>
Apis.Contract.ContractArchiveBorrows.Borrow({
id: item.id,
}).then(() => action?.reload())
}
/>
),
update: (
<Update item={item} reload={action?.reload} title={title} />
),
}}
/>
),
}),
]}
/> />
</MyPageContainer> </MyPageContainer>
); );

View File

@ -49,11 +49,13 @@ export default function Show(props: MyBetaModalFormProps) {
{data?.read_reason} {data?.read_reason}
</ProDescriptions.Item> </ProDescriptions.Item>
<ProDescriptions.Item label="借阅文件" span={2}> <ProDescriptions.Item label="借阅文件" span={2}>
{!data?.read_files || data.read_files.length === 0 ? ( {!data?.contract_archive_read_files ||
data.contract_archive_read_files.length === 0 ? (
'-' '-'
) : ( ) : (
<div> <div>
{data.read_files.map((file: any, index: number) => ( {data.contract_archive_read_files.map(
(file: any, index: number) => (
<div <div
key={index} key={index}
style={{ style={{
@ -63,11 +65,15 @@ export default function Show(props: MyBetaModalFormProps) {
borderRadius: 4, borderRadius: 4,
}} }}
> >
<div style={{ fontWeight: 'bold', marginBottom: 4 }}> <div
{index + 1}: {file?.file?.name} style={{ fontWeight: 'bold', marginBottom: 4 }}
>
{index + 1}:
{file?.contract_archive_file?.name}
</div> </div>
</div> </div>
))} ),
)}
</div> </div>
)} )}
</ProDescriptions.Item> </ProDescriptions.Item>

View File

@ -154,9 +154,11 @@ export default function Index({ title = '合同拟制' }) {
title: '有效期', title: '有效期',
search: false, search: false,
render: (_, item: any) => { render: (_, item: any) => {
return `${dayjs(item.start_time).format('YYYY-MM-DD')}${dayjs( return item.start_time
? `${dayjs(item.start_time).format('YYYY-MM-DD')}${dayjs(
item.end_time, item.end_time,
).format('YYYY-MM-DD')}`; ).format('YYYY-MM-DD')}`
: '-';
}, },
}, },
{ {

View File

@ -110,7 +110,7 @@ export default function Index({ title = '客户列表' }) {
}, },
MyColumns.EnumTag({ MyColumns.EnumTag({
title: '关联身份', title: '关联身份',
dataIndex: 'relation_with_owner', dataIndex: 'residential_relation',
valueEnum: HouseOccupantsResidentialRelationEnum, valueEnum: HouseOccupantsResidentialRelationEnum,
search: false, search: false,
}), }),