develop #1
14
src/gen/ApiTypes.d.ts
vendored
14
src/gen/ApiTypes.d.ts
vendored
@ -682,6 +682,13 @@ declare namespace ApiTypes {
|
|||||||
"new_password": string; // 新密码
|
"new_password": string; // 新密码
|
||||||
"re_new_password": string; // 重复新密码
|
"re_new_password": string; // 重复新密码
|
||||||
};
|
};
|
||||||
|
type PreUpload = {
|
||||||
|
"filename": string; // 文件名称
|
||||||
|
"alc": string; // 访问限制 public-read, private
|
||||||
|
};
|
||||||
|
type TemporaryUrl = {
|
||||||
|
"filename": string; // 文件名称
|
||||||
|
};
|
||||||
}
|
}
|
||||||
namespace ConvenienceServices {
|
namespace ConvenienceServices {
|
||||||
type List = {
|
type List = {
|
||||||
@ -739,6 +746,10 @@ declare namespace ApiTypes {
|
|||||||
"remark"?: string; // 备注
|
"remark"?: string; // 备注
|
||||||
"roles_id"?: string[]; // 角色ID数组
|
"roles_id"?: string[]; // 角色ID数组
|
||||||
};
|
};
|
||||||
|
type ResetPassword = {
|
||||||
|
"id": number; // id
|
||||||
|
"password": string; // 密码[hidden]
|
||||||
|
};
|
||||||
type Show = {
|
type Show = {
|
||||||
"id": number; // id
|
"id": number; // id
|
||||||
};
|
};
|
||||||
@ -1616,6 +1627,9 @@ declare namespace ApiTypes {
|
|||||||
"visited_remark"?: string; // 访问说明
|
"visited_remark"?: string; // 访问说明
|
||||||
"visited_attachment"?: string[]; // 访问附件
|
"visited_attachment"?: string[]; // 访问附件
|
||||||
};
|
};
|
||||||
|
type Closed = {
|
||||||
|
"id": number; // id
|
||||||
|
};
|
||||||
type Delete = {
|
type Delete = {
|
||||||
"id": number; // id
|
"id": number; // id
|
||||||
};
|
};
|
||||||
|
|||||||
@ -318,6 +318,12 @@ export const Apis = {
|
|||||||
ChangePassword(data: ApiTypes.Common.Auth.ChangePassword): Promise<MyResponseType> {
|
ChangePassword(data: ApiTypes.Common.Auth.ChangePassword): Promise<MyResponseType> {
|
||||||
return request('company/common/auth/change_password', { data });
|
return request('company/common/auth/change_password', { data });
|
||||||
},
|
},
|
||||||
|
PreUpload(data: ApiTypes.Common.Auth.PreUpload): Promise<MyResponseType> {
|
||||||
|
return request('company/common/auth/pre_upload', { data });
|
||||||
|
},
|
||||||
|
TemporaryUrl(data: ApiTypes.Common.Auth.TemporaryUrl): Promise<MyResponseType> {
|
||||||
|
return request('company/common/auth/temporary_url', { data });
|
||||||
|
},
|
||||||
},
|
},
|
||||||
ConvenienceServices: {
|
ConvenienceServices: {
|
||||||
List(data?: ApiTypes.Common.ConvenienceServices.List): Promise<MyResponseType> {
|
List(data?: ApiTypes.Common.ConvenienceServices.List): Promise<MyResponseType> {
|
||||||
@ -348,6 +354,9 @@ export const Apis = {
|
|||||||
Update(data: ApiTypes.Company.CompanyEmployees.Update): Promise<MyResponseType> {
|
Update(data: ApiTypes.Company.CompanyEmployees.Update): Promise<MyResponseType> {
|
||||||
return request('company/company/company_employees/update', { data });
|
return request('company/company/company_employees/update', { data });
|
||||||
},
|
},
|
||||||
|
ResetPassword(data: ApiTypes.Company.CompanyEmployees.ResetPassword): Promise<MyResponseType> {
|
||||||
|
return request('company/company/company_employees/reset_password', { data });
|
||||||
|
},
|
||||||
Show(data: ApiTypes.Company.CompanyEmployees.Show): Promise<MyResponseType> {
|
Show(data: ApiTypes.Company.CompanyEmployees.Show): Promise<MyResponseType> {
|
||||||
return request('company/company/company_employees/show', { data });
|
return request('company/company/company_employees/show', { data });
|
||||||
},
|
},
|
||||||
@ -900,6 +909,9 @@ export const Apis = {
|
|||||||
Visited(data: ApiTypes.WorkOrder.HouseWorkOrders.Visited): Promise<MyResponseType> {
|
Visited(data: ApiTypes.WorkOrder.HouseWorkOrders.Visited): Promise<MyResponseType> {
|
||||||
return request('company/work_order/house_work_orders/visited', { data });
|
return request('company/work_order/house_work_orders/visited', { data });
|
||||||
},
|
},
|
||||||
|
Closed(data: ApiTypes.WorkOrder.HouseWorkOrders.Closed): Promise<MyResponseType> {
|
||||||
|
return request('company/work_order/house_work_orders/closed', { data });
|
||||||
|
},
|
||||||
Delete(data: ApiTypes.WorkOrder.HouseWorkOrders.Delete): Promise<MyResponseType> {
|
Delete(data: ApiTypes.WorkOrder.HouseWorkOrders.Delete): Promise<MyResponseType> {
|
||||||
return request('company/work_order/house_work_orders/delete', { data });
|
return request('company/work_order/house_work_orders/delete', { data });
|
||||||
},
|
},
|
||||||
|
|||||||
1728
src/gen/Enums.ts
1728
src/gen/Enums.ts
File diff suppressed because it is too large
Load Diff
@ -1,84 +0,0 @@
|
|||||||
import { MyColumns, MyPageContainer, MyProTableProps } from '@/common';
|
|
||||||
import { Apis } from '@/gen/Apis';
|
|
||||||
import { ProTable } from '@ant-design/pro-components';
|
|
||||||
import { Space } from 'antd';
|
|
||||||
import Show from './modals/Show';
|
|
||||||
|
|
||||||
export default function Index({ title = '审批列表' }) {
|
|
||||||
return (
|
|
||||||
<MyPageContainer
|
|
||||||
title={title}
|
|
||||||
enableTabs={true}
|
|
||||||
tabKey="all_approval_instances"
|
|
||||||
tabLabel={title}
|
|
||||||
>
|
|
||||||
<ProTable
|
|
||||||
{...MyProTableProps.props}
|
|
||||||
request={async (params, sort) =>
|
|
||||||
MyProTableProps.request(
|
|
||||||
params,
|
|
||||||
sort,
|
|
||||||
Apis.Approval.ApprovalInstances.List,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
headerTitle={title}
|
|
||||||
columns={[
|
|
||||||
MyColumns.ID({ search: false }),
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
title: '状态',
|
|
||||||
dataIndex: 'status',
|
|
||||||
// valueEnum: ApprovalInstancesStatusEnum,
|
|
||||||
}),
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
dataIndex: 'type',
|
|
||||||
title: '类型',
|
|
||||||
// valueEnum: ApprovalTemplatesTypeEnum,
|
|
||||||
search: false,
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
title: '申请事项',
|
|
||||||
dataIndex: 'title',
|
|
||||||
search: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '关联项目',
|
|
||||||
dataIndex: ['asset_project', 'name'],
|
|
||||||
search: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '申请人',
|
|
||||||
dataIndex: ['applicant', 'name'],
|
|
||||||
search: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '当前审批人',
|
|
||||||
dataIndex: ['approval_records', 'approver_name'],
|
|
||||||
search: false,
|
|
||||||
render: (_, item: any) =>
|
|
||||||
`${item?.approval_records?.[0]?.company_employee?.name || ''}-${
|
|
||||||
item?.approval_records?.[0]?.company_employee?.phone || ''
|
|
||||||
}`,
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
title: '项目ID',
|
|
||||||
dataIndex: 'asset_projects_id',
|
|
||||||
hidden: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '申请人',
|
|
||||||
dataIndex: 'applicant_name',
|
|
||||||
hidden: true,
|
|
||||||
},
|
|
||||||
MyColumns.Option({
|
|
||||||
render: (_, item: any, index, action) => (
|
|
||||||
<Space key={index}>
|
|
||||||
<Show item={item} reload={action?.reload} title={title} />
|
|
||||||
</Space>
|
|
||||||
),
|
|
||||||
}),
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
</MyPageContainer>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,254 +0,0 @@
|
|||||||
import {
|
|
||||||
MyBetaModalFormProps,
|
|
||||||
MyButtons,
|
|
||||||
MyModalFormProps,
|
|
||||||
renderTextHelper,
|
|
||||||
} from '@/common';
|
|
||||||
|
|
||||||
import { Apis } from '@/gen/Apis';
|
|
||||||
import {
|
|
||||||
ContractsSettlementModeEnum,
|
|
||||||
ContractTemplatesIncomeExpenseTypeEnum,
|
|
||||||
RefundsTypeEnum,
|
|
||||||
} from '@/gen/Enums';
|
|
||||||
import BIllInfo from '@/pages/bills/house_bills/modals/BIllInfo';
|
|
||||||
import {
|
|
||||||
BetaSchemaForm,
|
|
||||||
ProCard,
|
|
||||||
ProDescriptions,
|
|
||||||
} from '@ant-design/pro-components';
|
|
||||||
import { useNavigate } from '@umijs/max';
|
|
||||||
import { Form, Space, Steps } from 'antd';
|
|
||||||
|
|
||||||
export default function Update(props: MyBetaModalFormProps) {
|
|
||||||
const [form] = Form.useForm();
|
|
||||||
const navigate = useNavigate();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<BetaSchemaForm<ApiTypes.Archive.HouseRegisters.Update>
|
|
||||||
{...MyModalFormProps.props}
|
|
||||||
title={props.title}
|
|
||||||
trigger={<MyButtons.Default title="查看" type="primary" />}
|
|
||||||
wrapperCol={{ span: 24 }}
|
|
||||||
width="600px"
|
|
||||||
key={new Date().getTime()}
|
|
||||||
form={form}
|
|
||||||
onOpenChange={() => {
|
|
||||||
if (props?.item?.id) {
|
|
||||||
Apis.Approval.ApprovalInstances.Show({
|
|
||||||
id: props.item?.model_id,
|
|
||||||
}).then((res) => {
|
|
||||||
form.setFieldsValue({
|
|
||||||
info_display: res?.data,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
columns={[
|
|
||||||
{
|
|
||||||
// title: '登记信息',
|
|
||||||
dataIndex: 'info_display',
|
|
||||||
valueType: 'text',
|
|
||||||
renderFormItem: (_, config) => (
|
|
||||||
<Space direction="vertical" style={{ width: '100%' }}>
|
|
||||||
<div>
|
|
||||||
{/* 退款详情 */}
|
|
||||||
{config?.value?.type === 'Refund' && (
|
|
||||||
<ProCard size="small">
|
|
||||||
<ProDescriptions size="small" column={2}>
|
|
||||||
<ProDescriptions.Item label="申请事项" span={2}>
|
|
||||||
{config?.value?.title || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="账单类型">
|
|
||||||
<renderTextHelper.Tag
|
|
||||||
Enums={RefundsTypeEnum}
|
|
||||||
value={config?.value?.model?.type}
|
|
||||||
/>
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="退款金额">
|
|
||||||
<Space>
|
|
||||||
{config?.value?.model?.refund_amount || '-'}
|
|
||||||
元
|
|
||||||
<BIllInfo
|
|
||||||
item={{
|
|
||||||
id: config?.value?.model?.refundable_id,
|
|
||||||
type: 'link',
|
|
||||||
}}
|
|
||||||
title="查看账单"
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="付款信息" span={2}>
|
|
||||||
{config?.value?.model?.payer_name || '-'}|
|
|
||||||
{config?.value?.model?.payer_bank || '-'}|
|
|
||||||
{config?.value?.model?.payer_account || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="收款信息" span={2}>
|
|
||||||
{config?.value?.model?.payee_name || '-'}
|
|
||||||
{config?.value?.model?.payee_bank || '-'}
|
|
||||||
{config?.value?.model?.payee_account || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="申请人" span={2}>
|
|
||||||
{props?.item?.applicant?.name || '-'}:
|
|
||||||
{props?.item?.applicant?.phone || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="申请时间">
|
|
||||||
{props?.item?.created_at || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
</ProDescriptions>
|
|
||||||
</ProCard>
|
|
||||||
)}
|
|
||||||
{/* 合同详情 */}
|
|
||||||
{config?.value?.type === 'Contract' && (
|
|
||||||
<ProCard size="small">
|
|
||||||
<ProDescriptions size="small" column={2}>
|
|
||||||
<ProDescriptions.Item label="合同名称" span={2}>
|
|
||||||
{config?.value?.model?.name || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
|
|
||||||
<ProDescriptions.Item label="合同编号" span={2}>
|
|
||||||
<Space>
|
|
||||||
{config?.value?.model?.code || '-'}
|
|
||||||
<BIllInfo
|
|
||||||
item={{
|
|
||||||
id: config?.value?.model?.refundable_id,
|
|
||||||
type: 'Contract',
|
|
||||||
}}
|
|
||||||
title="查看合同"
|
|
||||||
/>
|
|
||||||
<MyButtons.View
|
|
||||||
title="查看"
|
|
||||||
key="configInfo"
|
|
||||||
onClick={() => {
|
|
||||||
navigate(
|
|
||||||
`/contract/contracts/show/${config?.value?.model?.id}`,
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="收支类型">
|
|
||||||
<renderTextHelper.Tag
|
|
||||||
Enums={ContractTemplatesIncomeExpenseTypeEnum}
|
|
||||||
value={config?.value?.model?.income_expense_type}
|
|
||||||
/>
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="合同性质">
|
|
||||||
<renderTextHelper.Tag
|
|
||||||
// Enums={ContractsContractNatureEnum}
|
|
||||||
value={config?.value?.model?.contract_nature}
|
|
||||||
/>
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="合同类型">
|
|
||||||
{config?.value?.model?.contract_type_name || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="结算模式">
|
|
||||||
<renderTextHelper.Tag
|
|
||||||
Enums={ContractsSettlementModeEnum}
|
|
||||||
value={config?.value?.model?.settlement_mode}
|
|
||||||
/>
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="合同金额">
|
|
||||||
{config?.value?.model?.total_amount || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="保证金金额">
|
|
||||||
{config?.value?.model?.deposit_amount || '无'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="签约主体">
|
|
||||||
{config?.value?.model?.sign_subject || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="签约部门">
|
|
||||||
{config?.value?.model?.sign_department || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="关联项目">
|
|
||||||
{config?.value?.model?.project_name || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="合同对接人">
|
|
||||||
{config?.value?.model?.contract_liaison || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="合同有效期" span={2}>
|
|
||||||
{config?.value?.model?.start_time?.substring(0, 10)}至
|
|
||||||
{config?.value?.model?.end_time?.substring(0, 10)}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="申请人" span={2}>
|
|
||||||
{props?.item?.applicant?.name || '-'}:
|
|
||||||
{props?.item?.applicant?.phone || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="申请时间" span={2}>
|
|
||||||
{props?.item?.created_at || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="附件" span={2}>
|
|
||||||
{config?.value?.model?.attachments.map((item: any) => {
|
|
||||||
const handleDownload = async (
|
|
||||||
e: React.MouseEvent,
|
|
||||||
) => {
|
|
||||||
e.preventDefault();
|
|
||||||
try {
|
|
||||||
const response = await fetch(item.url);
|
|
||||||
const blob = await response.blob();
|
|
||||||
const url = window.URL.createObjectURL(blob);
|
|
||||||
const a = document.createElement('a');
|
|
||||||
a.href = url;
|
|
||||||
a.download = item.name;
|
|
||||||
document.body.appendChild(a);
|
|
||||||
a.click();
|
|
||||||
window.URL.revokeObjectURL(url);
|
|
||||||
document.body.removeChild(a);
|
|
||||||
} catch (error) {
|
|
||||||
console.error('下载失败:', error);
|
|
||||||
// 如果下载失败,则在新窗口打开
|
|
||||||
window.open(item.url, '_blank');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div key={item.url}>
|
|
||||||
<a href={item.url} onClick={handleDownload}>
|
|
||||||
{item.name};
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
</ProDescriptions>
|
|
||||||
</ProCard>
|
|
||||||
)}
|
|
||||||
<ProCard>
|
|
||||||
<ProDescriptions>
|
|
||||||
<ProDescriptions.Item label="审核记录">
|
|
||||||
<Space direction="vertical" style={{ width: '100%' }}>
|
|
||||||
<Steps
|
|
||||||
progressDot
|
|
||||||
direction="vertical"
|
|
||||||
current={config?.value?.approval_records.length}
|
|
||||||
items={config?.value?.approval_records.map(
|
|
||||||
(item: any) =>
|
|
||||||
item?.node_type === 'Approver'
|
|
||||||
? {
|
|
||||||
title: `${
|
|
||||||
item.company_employee?.name || '-'
|
|
||||||
}-${item?.company_employee?.phone}`,
|
|
||||||
description: `${
|
|
||||||
item.status === 'Approved'
|
|
||||||
? `通过 - ${item.opinion || '-'} - ${
|
|
||||||
item.created_at || '-'
|
|
||||||
}`
|
|
||||||
: '待审核'
|
|
||||||
}`,
|
|
||||||
}
|
|
||||||
: '',
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
</ProDescriptions>
|
|
||||||
</ProCard>
|
|
||||||
</div>
|
|
||||||
</Space>
|
|
||||||
),
|
|
||||||
colProps: { span: 24 },
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,82 +0,0 @@
|
|||||||
import { MyColumns, MyPageContainer, MyProTableProps } from '@/common';
|
|
||||||
import { Apis } from '@/gen/Apis';
|
|
||||||
import { ProTable } from '@ant-design/pro-components';
|
|
||||||
import { useNavigate } from '@umijs/max';
|
|
||||||
import { Space } from 'antd';
|
|
||||||
import Audit from '../pending/modals/Audit';
|
|
||||||
|
|
||||||
export default function Index({ title = '待我审批' }) {
|
|
||||||
const navigate = useNavigate();
|
|
||||||
return (
|
|
||||||
<MyPageContainer
|
|
||||||
title={title}
|
|
||||||
enableTabs={true}
|
|
||||||
tabKey="approval_instances"
|
|
||||||
tabLabel={title}
|
|
||||||
>
|
|
||||||
<ProTable
|
|
||||||
{...MyProTableProps.props}
|
|
||||||
request={async (params, sort) =>
|
|
||||||
MyProTableProps.request(
|
|
||||||
{
|
|
||||||
status: 'Pending',
|
|
||||||
...params,
|
|
||||||
},
|
|
||||||
sort,
|
|
||||||
Apis.Approval.ApprovalInstances.PendingList,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
headerTitle="待我审批"
|
|
||||||
columns={[
|
|
||||||
MyColumns.ID({ search: false }),
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
title: '状态',
|
|
||||||
dataIndex: 'status',
|
|
||||||
// valueEnum: ApprovalInstancesStatusEnum,
|
|
||||||
}),
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
dataIndex: ['approval_instance', 'type'],
|
|
||||||
title: '类型',
|
|
||||||
// valueEnum: ApprovalTemplatesTypeEnum,
|
|
||||||
search: false,
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
title: '申请事项',
|
|
||||||
dataIndex: ['approval_instance', 'title'],
|
|
||||||
search: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '关联项目',
|
|
||||||
dataIndex: ['approval_instance', 'asset_project', 'name'],
|
|
||||||
search: false,
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
title: '申请人',
|
|
||||||
dataIndex: 'approver_name',
|
|
||||||
},
|
|
||||||
|
|
||||||
// {
|
|
||||||
// title: '有效期',
|
|
||||||
// search: false,
|
|
||||||
// render: (_, item: any) => {
|
|
||||||
// return `${dayjs(
|
|
||||||
// item?.approval_instance?.model?.start_time,
|
|
||||||
// ).format('YYYY-MM-DD')}至${dayjs(
|
|
||||||
// item?.approval_instance?.model?.end_time,
|
|
||||||
// ).format('YYYY-MM-DD')}`;
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
MyColumns.CreatedAt(),
|
|
||||||
MyColumns.Option({
|
|
||||||
render: (_, item: any, index, action) => (
|
|
||||||
<Space key={index}>
|
|
||||||
<Audit item={item} reload={action?.reload} title={title} />
|
|
||||||
</Space>
|
|
||||||
),
|
|
||||||
}),
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
</MyPageContainer>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,70 +0,0 @@
|
|||||||
import { MyColumns, MyPageContainer, MyProTableProps } from '@/common';
|
|
||||||
import { Apis } from '@/gen/Apis';
|
|
||||||
import { ProTable } from '@ant-design/pro-components';
|
|
||||||
import { Space } from 'antd';
|
|
||||||
import Show from './modals/Show';
|
|
||||||
export default function Index({ title = '抄送我的' }) {
|
|
||||||
return (
|
|
||||||
<MyPageContainer
|
|
||||||
title={title}
|
|
||||||
enableTabs={true}
|
|
||||||
tabKey="my_apply_list"
|
|
||||||
tabLabel={title}
|
|
||||||
>
|
|
||||||
<ProTable
|
|
||||||
{...MyProTableProps.props}
|
|
||||||
request={async (params, sort) =>
|
|
||||||
MyProTableProps.request(
|
|
||||||
params,
|
|
||||||
sort,
|
|
||||||
Apis.Approval.ApprovalInstances.CcList,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
headerTitle={title}
|
|
||||||
columns={[
|
|
||||||
MyColumns.ID({ search: false }),
|
|
||||||
{
|
|
||||||
title: '申请事项',
|
|
||||||
dataIndex: 'title',
|
|
||||||
search: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '关联项目',
|
|
||||||
dataIndex: ['asset_project', 'name'],
|
|
||||||
search: false,
|
|
||||||
},
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
title: '状态',
|
|
||||||
dataIndex: 'status',
|
|
||||||
// valueEnum: ApprovalInstancesStatusEnum,
|
|
||||||
}),
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
dataIndex: 'type',
|
|
||||||
title: '业务类型',
|
|
||||||
// valueEnum: ApprovalTemplatesTypeEnum,
|
|
||||||
search: false,
|
|
||||||
}),
|
|
||||||
|
|
||||||
// {
|
|
||||||
// title: '项目ID',
|
|
||||||
// dataIndex: 'asset_projects_id',
|
|
||||||
// hidden: true,
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// title: '申请人',
|
|
||||||
// dataIndex: 'applicant_name',
|
|
||||||
// search: false,
|
|
||||||
// },
|
|
||||||
MyColumns.CreatedAt(),
|
|
||||||
MyColumns.Option({
|
|
||||||
render: (_, item: any, index, action) => (
|
|
||||||
<Space key={index}>
|
|
||||||
<Show item={item} reload={action?.reload} title={title} />
|
|
||||||
</Space>
|
|
||||||
),
|
|
||||||
}),
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
</MyPageContainer>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,255 +0,0 @@
|
|||||||
import {
|
|
||||||
MyBetaModalFormProps,
|
|
||||||
MyButtons,
|
|
||||||
MyModalFormProps,
|
|
||||||
renderTextHelper,
|
|
||||||
} from '@/common';
|
|
||||||
|
|
||||||
import { Apis } from '@/gen/Apis';
|
|
||||||
import {
|
|
||||||
ContractsContractNatureEnum,
|
|
||||||
ContractsSettlementModeEnum,
|
|
||||||
ContractTemplatesIncomeExpenseTypeEnum,
|
|
||||||
RefundsTypeEnum,
|
|
||||||
} from '@/gen/Enums';
|
|
||||||
import BIllInfo from '@/pages/bills/house_bills/modals/BIllInfo';
|
|
||||||
import {
|
|
||||||
BetaSchemaForm,
|
|
||||||
ProCard,
|
|
||||||
ProDescriptions,
|
|
||||||
} from '@ant-design/pro-components';
|
|
||||||
import { useNavigate } from '@umijs/max';
|
|
||||||
import { Form, Space, Steps } from 'antd';
|
|
||||||
|
|
||||||
export default function Update(props: MyBetaModalFormProps) {
|
|
||||||
const [form] = Form.useForm();
|
|
||||||
const navigate = useNavigate();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<BetaSchemaForm<ApiTypes.Archive.HouseRegisters.Update>
|
|
||||||
{...MyModalFormProps.props}
|
|
||||||
title={props.title}
|
|
||||||
trigger={<MyButtons.Default title="查看" type="primary" />}
|
|
||||||
wrapperCol={{ span: 24 }}
|
|
||||||
width="600px"
|
|
||||||
key={new Date().getTime()}
|
|
||||||
form={form}
|
|
||||||
onOpenChange={() => {
|
|
||||||
if (props?.item?.id) {
|
|
||||||
Apis.Approval.ApprovalInstances.Show({
|
|
||||||
id: props.item?.model_id,
|
|
||||||
}).then((res) => {
|
|
||||||
form.setFieldsValue({
|
|
||||||
info_display: res?.data,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
columns={[
|
|
||||||
{
|
|
||||||
// title: '登记信息',
|
|
||||||
dataIndex: 'info_display',
|
|
||||||
valueType: 'text',
|
|
||||||
renderFormItem: (_, config) => (
|
|
||||||
<Space direction="vertical" style={{ width: '100%' }}>
|
|
||||||
<div>
|
|
||||||
{/* 退款详情 */}
|
|
||||||
{config?.value?.type === 'Refund' && (
|
|
||||||
<ProCard size="small">
|
|
||||||
<ProDescriptions size="small" column={2}>
|
|
||||||
<ProDescriptions.Item label="申请事项" span={2}>
|
|
||||||
{config?.value?.title || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="账单类型">
|
|
||||||
<renderTextHelper.Tag
|
|
||||||
Enums={RefundsTypeEnum}
|
|
||||||
value={config?.value?.model?.type}
|
|
||||||
/>
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="退款金额">
|
|
||||||
<Space>
|
|
||||||
{config?.value?.model?.refund_amount || '-'}
|
|
||||||
元
|
|
||||||
<BIllInfo
|
|
||||||
item={{
|
|
||||||
id: config?.value?.model?.refundable_id,
|
|
||||||
type: 'link',
|
|
||||||
}}
|
|
||||||
title="查看账单"
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="付款信息" span={2}>
|
|
||||||
{config?.value?.model?.payer_name || '-'}|
|
|
||||||
{config?.value?.model?.payer_bank || '-'}|
|
|
||||||
{config?.value?.model?.payer_account || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="收款信息" span={2}>
|
|
||||||
{config?.value?.model?.payee_name || '-'}
|
|
||||||
{config?.value?.model?.payee_bank || '-'}
|
|
||||||
{config?.value?.model?.payee_account || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="申请人" span={2}>
|
|
||||||
{props?.item?.applicant?.name || '-'}:
|
|
||||||
{props?.item?.applicant?.phone || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="申请时间">
|
|
||||||
{props?.item?.created_at || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
</ProDescriptions>
|
|
||||||
</ProCard>
|
|
||||||
)}
|
|
||||||
{/* 合同详情 */}
|
|
||||||
{config?.value?.type === 'Contract' && (
|
|
||||||
<ProCard size="small">
|
|
||||||
<ProDescriptions size="small" column={2}>
|
|
||||||
<ProDescriptions.Item label="合同名称" span={2}>
|
|
||||||
{config?.value?.model?.name || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
|
|
||||||
<ProDescriptions.Item label="合同编号" span={2}>
|
|
||||||
<Space>
|
|
||||||
{config?.value?.model?.code || '-'}
|
|
||||||
<BIllInfo
|
|
||||||
item={{
|
|
||||||
id: config?.value?.model?.refundable_id,
|
|
||||||
type: 'Contract',
|
|
||||||
}}
|
|
||||||
title="查看合同"
|
|
||||||
/>
|
|
||||||
<MyButtons.View
|
|
||||||
title="查看"
|
|
||||||
key="configInfo"
|
|
||||||
onClick={() => {
|
|
||||||
navigate(
|
|
||||||
`/contract/contracts/show/${config?.value?.model?.id}`,
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="收支类型">
|
|
||||||
<renderTextHelper.Tag
|
|
||||||
Enums={ContractTemplatesIncomeExpenseTypeEnum}
|
|
||||||
value={config?.value?.model?.income_expense_type}
|
|
||||||
/>
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="合同性质">
|
|
||||||
<renderTextHelper.Tag
|
|
||||||
Enums={ContractsContractNatureEnum}
|
|
||||||
value={config?.value?.model?.contract_nature}
|
|
||||||
/>
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="合同类型">
|
|
||||||
{config?.value?.model?.contract_type_name || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="结算模式">
|
|
||||||
<renderTextHelper.Tag
|
|
||||||
Enums={ContractsSettlementModeEnum}
|
|
||||||
value={config?.value?.model?.settlement_mode}
|
|
||||||
/>
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="合同金额">
|
|
||||||
{config?.value?.model?.total_amount || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="保证金金额">
|
|
||||||
{config?.value?.model?.deposit_amount || '无'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="签约主体">
|
|
||||||
{config?.value?.model?.sign_subject || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="签约部门">
|
|
||||||
{config?.value?.model?.sign_department || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="关联项目">
|
|
||||||
{config?.value?.model?.project_name || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="合同对接人">
|
|
||||||
{config?.value?.model?.contract_liaison || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="合同有效期" span={2}>
|
|
||||||
{config?.value?.model?.start_time?.substring(0, 10)}至
|
|
||||||
{config?.value?.model?.end_time?.substring(0, 10)}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="申请人" span={2}>
|
|
||||||
{props?.item?.applicant?.name || '-'}:
|
|
||||||
{props?.item?.applicant?.phone || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="申请时间" span={2}>
|
|
||||||
{props?.item?.created_at || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="附件" span={2}>
|
|
||||||
{config?.value?.model?.attachments.map((item: any) => {
|
|
||||||
const handleDownload = async (
|
|
||||||
e: React.MouseEvent,
|
|
||||||
) => {
|
|
||||||
e.preventDefault();
|
|
||||||
try {
|
|
||||||
const response = await fetch(item.url);
|
|
||||||
const blob = await response.blob();
|
|
||||||
const url = window.URL.createObjectURL(blob);
|
|
||||||
const a = document.createElement('a');
|
|
||||||
a.href = url;
|
|
||||||
a.download = item.name;
|
|
||||||
document.body.appendChild(a);
|
|
||||||
a.click();
|
|
||||||
window.URL.revokeObjectURL(url);
|
|
||||||
document.body.removeChild(a);
|
|
||||||
} catch (error) {
|
|
||||||
console.error('下载失败:', error);
|
|
||||||
// 如果下载失败,则在新窗口打开
|
|
||||||
window.open(item.url, '_blank');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div key={item.url}>
|
|
||||||
<a href={item.url} onClick={handleDownload}>
|
|
||||||
{item.name};
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
</ProDescriptions>
|
|
||||||
</ProCard>
|
|
||||||
)}
|
|
||||||
<ProCard>
|
|
||||||
<ProDescriptions>
|
|
||||||
<ProDescriptions.Item label="审核记录">
|
|
||||||
<Space direction="vertical" style={{ width: '100%' }}>
|
|
||||||
<Steps
|
|
||||||
progressDot
|
|
||||||
direction="vertical"
|
|
||||||
current={config?.value?.approval_records.length}
|
|
||||||
items={config?.value?.approval_records.map(
|
|
||||||
(item: any) =>
|
|
||||||
item?.node_type === 'Approver'
|
|
||||||
? {
|
|
||||||
title: `${
|
|
||||||
item.company_employee?.name || '-'
|
|
||||||
}-${item?.company_employee?.phone}`,
|
|
||||||
description: `${
|
|
||||||
item.status === 'Approved'
|
|
||||||
? `通过 - ${item.opinion || '-'} - ${
|
|
||||||
item.created_at || '-'
|
|
||||||
}`
|
|
||||||
: '待审核'
|
|
||||||
}`,
|
|
||||||
}
|
|
||||||
: '',
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
</ProDescriptions>
|
|
||||||
</ProCard>
|
|
||||||
</div>
|
|
||||||
</Space>
|
|
||||||
),
|
|
||||||
colProps: { span: 24 },
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,95 +0,0 @@
|
|||||||
import {
|
|
||||||
MyButtons,
|
|
||||||
MyColumns,
|
|
||||||
MyPageContainer,
|
|
||||||
MyProTableProps,
|
|
||||||
} from '@/common';
|
|
||||||
import { Apis } from '@/gen/Apis';
|
|
||||||
import { ProTable } from '@ant-design/pro-components';
|
|
||||||
import { Space } from 'antd';
|
|
||||||
export default function Index({ title = '我的发起' }) {
|
|
||||||
return (
|
|
||||||
<MyPageContainer
|
|
||||||
title={title}
|
|
||||||
enableTabs={true}
|
|
||||||
tabKey="my_apply_list"
|
|
||||||
tabLabel={title}
|
|
||||||
>
|
|
||||||
<ProTable
|
|
||||||
{...MyProTableProps.props}
|
|
||||||
request={async (params, sort) =>
|
|
||||||
MyProTableProps.request(
|
|
||||||
params,
|
|
||||||
sort,
|
|
||||||
Apis.Approval.ApprovalInstances.MyApplyList,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
headerTitle={title}
|
|
||||||
columns={[
|
|
||||||
MyColumns.ID({ search: false }),
|
|
||||||
{
|
|
||||||
title: '申请事项',
|
|
||||||
dataIndex: 'title',
|
|
||||||
search: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '关联项目',
|
|
||||||
dataIndex: ['asset_project', 'name'],
|
|
||||||
search: false,
|
|
||||||
},
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
title: '状态',
|
|
||||||
dataIndex: 'status',
|
|
||||||
// valueEnum: ApprovalInstancesStatusEnum,
|
|
||||||
}),
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
dataIndex: 'type',
|
|
||||||
title: '业务类型',
|
|
||||||
// valueEnum: ApprovalTemplatesTypeEnum,
|
|
||||||
search: false,
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
title: '当前审批人',
|
|
||||||
dataIndex: ['approval_records', 'approver_name'],
|
|
||||||
search: false,
|
|
||||||
render: (_, item: any) =>
|
|
||||||
`${item?.approval_records?.[0]?.company_employee?.name || ''}-${
|
|
||||||
item?.approval_records?.[0]?.company_employee?.phone || ''
|
|
||||||
}`,
|
|
||||||
},
|
|
||||||
// {
|
|
||||||
// title: '项目ID',
|
|
||||||
// dataIndex: 'asset_projects_id',
|
|
||||||
// hidden: true,
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// title: '申请人',
|
|
||||||
// dataIndex: 'applicant_name',
|
|
||||||
// search: false,
|
|
||||||
// },
|
|
||||||
MyColumns.CreatedAt(),
|
|
||||||
MyColumns.Option({
|
|
||||||
render: (_, item: any, index, action) => (
|
|
||||||
<Space key={index}>
|
|
||||||
{/* <Update item={item} reload={action?.reload} title={title} /> */}
|
|
||||||
<MyButtons.Default
|
|
||||||
title="撤销"
|
|
||||||
isConfirm
|
|
||||||
description="确认撤销该申请吗?"
|
|
||||||
disabled={item.status !== 'Pending'}
|
|
||||||
color="danger"
|
|
||||||
variant="solid"
|
|
||||||
onConfirm={() =>
|
|
||||||
Apis.Approval.ApprovalInstances.Cancel({
|
|
||||||
id: item.id,
|
|
||||||
}).then(() => action?.reload())
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
),
|
|
||||||
}),
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
</MyPageContainer>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,59 +0,0 @@
|
|||||||
import { MyColumns, MyPageContainer, MyProTableProps } from '@/common';
|
|
||||||
import { Apis } from '@/gen/Apis';
|
|
||||||
import { ProTable } from '@ant-design/pro-components';
|
|
||||||
import { Space } from 'antd';
|
|
||||||
import Show from './modals/Show';
|
|
||||||
export default function Index({ title = '我的发起' }) {
|
|
||||||
return (
|
|
||||||
<MyPageContainer
|
|
||||||
title={title}
|
|
||||||
enableTabs={true}
|
|
||||||
tabKey="my_apply_list"
|
|
||||||
tabLabel={title}
|
|
||||||
>
|
|
||||||
<ProTable
|
|
||||||
{...MyProTableProps.props}
|
|
||||||
request={async (params, sort) =>
|
|
||||||
MyProTableProps.request(
|
|
||||||
params,
|
|
||||||
sort,
|
|
||||||
Apis.Approval.ApprovalInstances.ProcessedList,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
headerTitle={title}
|
|
||||||
columns={[
|
|
||||||
MyColumns.ID({ search: false }),
|
|
||||||
{
|
|
||||||
title: '申请事项',
|
|
||||||
dataIndex: 'title',
|
|
||||||
search: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '关联项目',
|
|
||||||
dataIndex: ['asset_project', 'name'],
|
|
||||||
search: false,
|
|
||||||
},
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
title: '状态',
|
|
||||||
dataIndex: 'status',
|
|
||||||
// valueEnum: ApprovalInstancesStatusEnum,
|
|
||||||
}),
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
dataIndex: 'type',
|
|
||||||
title: '业务类型',
|
|
||||||
// valueEnum: ApprovalTemplatesTypeEnum,
|
|
||||||
search: false,
|
|
||||||
}),
|
|
||||||
MyColumns.CreatedAt(),
|
|
||||||
MyColumns.Option({
|
|
||||||
render: (_, item: any, index, action) => (
|
|
||||||
<Space key={index}>
|
|
||||||
<Show item={item} reload={action?.reload} title={title} />
|
|
||||||
</Space>
|
|
||||||
),
|
|
||||||
}),
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
</MyPageContainer>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,255 +0,0 @@
|
|||||||
import {
|
|
||||||
MyBetaModalFormProps,
|
|
||||||
MyButtons,
|
|
||||||
MyModalFormProps,
|
|
||||||
renderTextHelper,
|
|
||||||
} from '@/common';
|
|
||||||
|
|
||||||
import { Apis } from '@/gen/Apis';
|
|
||||||
import {
|
|
||||||
ContractsContractNatureEnum,
|
|
||||||
ContractsSettlementModeEnum,
|
|
||||||
ContractTemplatesIncomeExpenseTypeEnum,
|
|
||||||
RefundsTypeEnum,
|
|
||||||
} from '@/gen/Enums';
|
|
||||||
import BIllInfo from '@/pages/bills/house_bills/modals/BIllInfo';
|
|
||||||
import {
|
|
||||||
BetaSchemaForm,
|
|
||||||
ProCard,
|
|
||||||
ProDescriptions,
|
|
||||||
} from '@ant-design/pro-components';
|
|
||||||
import { useNavigate } from '@umijs/max';
|
|
||||||
import { Form, Space, Steps } from 'antd';
|
|
||||||
|
|
||||||
export default function Update(props: MyBetaModalFormProps) {
|
|
||||||
const [form] = Form.useForm();
|
|
||||||
const navigate = useNavigate();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<BetaSchemaForm<ApiTypes.Archive.HouseRegisters.Update>
|
|
||||||
{...MyModalFormProps.props}
|
|
||||||
title={props.title}
|
|
||||||
trigger={<MyButtons.Default title="查看" type="primary" />}
|
|
||||||
wrapperCol={{ span: 24 }}
|
|
||||||
width="600px"
|
|
||||||
key={new Date().getTime()}
|
|
||||||
form={form}
|
|
||||||
onOpenChange={() => {
|
|
||||||
if (props?.item?.id) {
|
|
||||||
Apis.Approval.ApprovalInstances.Show({
|
|
||||||
id: props.item?.model_id,
|
|
||||||
}).then((res) => {
|
|
||||||
form.setFieldsValue({
|
|
||||||
info_display: res?.data,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
columns={[
|
|
||||||
{
|
|
||||||
// title: '登记信息',
|
|
||||||
dataIndex: 'info_display',
|
|
||||||
valueType: 'text',
|
|
||||||
renderFormItem: (_, config) => (
|
|
||||||
<Space direction="vertical" style={{ width: '100%' }}>
|
|
||||||
<div>
|
|
||||||
{/* 退款详情 */}
|
|
||||||
{config?.value?.type === 'Refund' && (
|
|
||||||
<ProCard size="small">
|
|
||||||
<ProDescriptions size="small" column={2}>
|
|
||||||
<ProDescriptions.Item label="申请事项" span={2}>
|
|
||||||
{config?.value?.title || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="账单类型">
|
|
||||||
<renderTextHelper.Tag
|
|
||||||
Enums={RefundsTypeEnum}
|
|
||||||
value={config?.value?.model?.type}
|
|
||||||
/>
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="退款金额">
|
|
||||||
<Space>
|
|
||||||
{config?.value?.model?.refund_amount || '-'}
|
|
||||||
元
|
|
||||||
<BIllInfo
|
|
||||||
item={{
|
|
||||||
id: config?.value?.model?.refundable_id,
|
|
||||||
type: 'link',
|
|
||||||
}}
|
|
||||||
title="查看账单"
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="付款信息" span={2}>
|
|
||||||
{config?.value?.model?.payer_name || '-'}|
|
|
||||||
{config?.value?.model?.payer_bank || '-'}|
|
|
||||||
{config?.value?.model?.payer_account || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="收款信息" span={2}>
|
|
||||||
{config?.value?.model?.payee_name || '-'}
|
|
||||||
{config?.value?.model?.payee_bank || '-'}
|
|
||||||
{config?.value?.model?.payee_account || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="申请人" span={2}>
|
|
||||||
{props?.item?.applicant?.name || '-'}:
|
|
||||||
{props?.item?.applicant?.phone || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="申请时间" span={2}>
|
|
||||||
{props?.item?.created_at || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
</ProDescriptions>
|
|
||||||
</ProCard>
|
|
||||||
)}
|
|
||||||
{/* 合同详情 */}
|
|
||||||
{config?.value?.type === 'Contract' && (
|
|
||||||
<ProCard size="small">
|
|
||||||
<ProDescriptions size="small" column={2}>
|
|
||||||
<ProDescriptions.Item label="合同名称" span={2}>
|
|
||||||
{config?.value?.model?.name || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
|
|
||||||
<ProDescriptions.Item label="合同编号" span={2}>
|
|
||||||
<Space>
|
|
||||||
{config?.value?.model?.code || '-'}
|
|
||||||
<BIllInfo
|
|
||||||
item={{
|
|
||||||
id: config?.value?.model?.refundable_id,
|
|
||||||
type: 'Contract',
|
|
||||||
}}
|
|
||||||
title="查看合同"
|
|
||||||
/>
|
|
||||||
<MyButtons.View
|
|
||||||
title="查看"
|
|
||||||
key="configInfo"
|
|
||||||
onClick={() => {
|
|
||||||
navigate(
|
|
||||||
`/contract/contracts/show/${config?.value?.model?.id}`,
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="收支类型">
|
|
||||||
<renderTextHelper.Tag
|
|
||||||
Enums={ContractTemplatesIncomeExpenseTypeEnum}
|
|
||||||
value={config?.value?.model?.income_expense_type}
|
|
||||||
/>
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="合同性质">
|
|
||||||
<renderTextHelper.Tag
|
|
||||||
Enums={ContractsContractNatureEnum}
|
|
||||||
value={config?.value?.model?.contract_nature}
|
|
||||||
/>
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="合同类型">
|
|
||||||
{config?.value?.model?.contract_type_name || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="结算模式">
|
|
||||||
<renderTextHelper.Tag
|
|
||||||
Enums={ContractsSettlementModeEnum}
|
|
||||||
value={config?.value?.model?.settlement_mode}
|
|
||||||
/>
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="合同金额">
|
|
||||||
{config?.value?.model?.total_amount || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="保证金金额">
|
|
||||||
{config?.value?.model?.deposit_amount || '无'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="签约主体">
|
|
||||||
{config?.value?.model?.sign_subject || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="签约部门">
|
|
||||||
{config?.value?.model?.sign_department || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="关联项目">
|
|
||||||
{config?.value?.model?.project_name || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="合同对接人">
|
|
||||||
{config?.value?.model?.contract_liaison || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="合同有效期" span={2}>
|
|
||||||
{config?.value?.model?.start_time?.substring(0, 10)}至
|
|
||||||
{config?.value?.model?.end_time?.substring(0, 10)}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="申请人" span={2}>
|
|
||||||
{props?.item?.applicant?.name || '-'}:
|
|
||||||
{props?.item?.applicant?.phone || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="申请时间" span={2}>
|
|
||||||
{props?.item?.created_at || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="附件" span={2}>
|
|
||||||
{config?.value?.model?.attachments.map((item: any) => {
|
|
||||||
const handleDownload = async (
|
|
||||||
e: React.MouseEvent,
|
|
||||||
) => {
|
|
||||||
e.preventDefault();
|
|
||||||
try {
|
|
||||||
const response = await fetch(item.url);
|
|
||||||
const blob = await response.blob();
|
|
||||||
const url = window.URL.createObjectURL(blob);
|
|
||||||
const a = document.createElement('a');
|
|
||||||
a.href = url;
|
|
||||||
a.download = item.name;
|
|
||||||
document.body.appendChild(a);
|
|
||||||
a.click();
|
|
||||||
window.URL.revokeObjectURL(url);
|
|
||||||
document.body.removeChild(a);
|
|
||||||
} catch (error) {
|
|
||||||
console.error('下载失败:', error);
|
|
||||||
// 如果下载失败,则在新窗口打开
|
|
||||||
window.open(item.url, '_blank');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div key={item.url}>
|
|
||||||
<a href={item.url} onClick={handleDownload}>
|
|
||||||
{item.name};
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
</ProDescriptions>
|
|
||||||
</ProCard>
|
|
||||||
)}
|
|
||||||
<ProCard>
|
|
||||||
<ProDescriptions>
|
|
||||||
<ProDescriptions.Item label="审核记录">
|
|
||||||
<Space direction="vertical" style={{ width: '100%' }}>
|
|
||||||
<Steps
|
|
||||||
progressDot
|
|
||||||
direction="vertical"
|
|
||||||
current={config?.value?.approval_records?.length}
|
|
||||||
items={config?.value?.approval_records?.map(
|
|
||||||
(item: any) =>
|
|
||||||
item?.node_type === 'Approver'
|
|
||||||
? {
|
|
||||||
title: `${
|
|
||||||
item.company_employee?.name || '-'
|
|
||||||
}-${item?.company_employee?.phone}`,
|
|
||||||
description: `${
|
|
||||||
item.status === 'Approved'
|
|
||||||
? `通过 - ${item.opinion || '-'} - ${
|
|
||||||
item.created_at || '-'
|
|
||||||
}`
|
|
||||||
: '待审核'
|
|
||||||
}`,
|
|
||||||
}
|
|
||||||
: '',
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
</ProDescriptions>
|
|
||||||
</ProCard>
|
|
||||||
</div>
|
|
||||||
</Space>
|
|
||||||
),
|
|
||||||
colProps: { span: 24 },
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,81 +0,0 @@
|
|||||||
import {
|
|
||||||
MyButtons,
|
|
||||||
MyColumns,
|
|
||||||
MyPageContainer,
|
|
||||||
MyProTableProps,
|
|
||||||
} from '@/common';
|
|
||||||
import { Apis } from '@/gen/Apis';
|
|
||||||
import { ApprovalInstancesStatusEnum } from '@/gen/Enums';
|
|
||||||
import { ProTable } from '@ant-design/pro-components';
|
|
||||||
import { Space } from 'antd';
|
|
||||||
import Audit from './modals/Audit';
|
|
||||||
export default function Index({ title = '我的待办' }) {
|
|
||||||
return (
|
|
||||||
<MyPageContainer
|
|
||||||
title={title}
|
|
||||||
enableTabs={true}
|
|
||||||
tabKey="my_apply_list"
|
|
||||||
tabLabel={title}
|
|
||||||
>
|
|
||||||
<ProTable
|
|
||||||
{...MyProTableProps.props}
|
|
||||||
request={async (params, sort) =>
|
|
||||||
MyProTableProps.request(
|
|
||||||
{
|
|
||||||
...params,
|
|
||||||
status: ApprovalInstancesStatusEnum.Pending.value,
|
|
||||||
},
|
|
||||||
sort,
|
|
||||||
Apis.Approval.ApprovalInstances.PendingList,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
headerTitle={title}
|
|
||||||
columns={[
|
|
||||||
MyColumns.ID({ search: false }),
|
|
||||||
{
|
|
||||||
title: '申请事项',
|
|
||||||
dataIndex: ['approval_instance', 'title'],
|
|
||||||
search: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '关联项目',
|
|
||||||
dataIndex: ['approval_instance', 'asset_project', 'name'],
|
|
||||||
search: false,
|
|
||||||
},
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
title: '状态',
|
|
||||||
dataIndex: ['approval_instance', 'status'],
|
|
||||||
// valueEnum: ApprovalInstancesStatusEnum,
|
|
||||||
}),
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
dataIndex: ['approval_instance', 'type'],
|
|
||||||
title: '业务类型',
|
|
||||||
// valueEnum: ApprovalTemplatesTypeEnum,
|
|
||||||
search: false,
|
|
||||||
}),
|
|
||||||
MyColumns.CreatedAt(),
|
|
||||||
MyColumns.Option({
|
|
||||||
render: (_, item: any, index, action) => (
|
|
||||||
<Space key={index}>
|
|
||||||
<Audit item={item} reload={action?.reload} title={title} />
|
|
||||||
<MyButtons.Default
|
|
||||||
title="撤销"
|
|
||||||
isConfirm
|
|
||||||
description="确认撤销该申请吗?"
|
|
||||||
disabled={item.status !== 'Pending'}
|
|
||||||
color="danger"
|
|
||||||
variant="solid"
|
|
||||||
onConfirm={() =>
|
|
||||||
Apis.Approval.ApprovalInstances.Cancel({
|
|
||||||
id: item.id,
|
|
||||||
}).then(() => action?.reload())
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
),
|
|
||||||
}),
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
</MyPageContainer>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,326 +0,0 @@
|
|||||||
import {
|
|
||||||
MyBetaModalFormProps,
|
|
||||||
MyButtons,
|
|
||||||
MyFormItems,
|
|
||||||
MyModalFormProps,
|
|
||||||
renderTextHelper,
|
|
||||||
rulesHelper,
|
|
||||||
} from '@/common';
|
|
||||||
|
|
||||||
import { Apis } from '@/gen/Apis';
|
|
||||||
import {
|
|
||||||
ContractsContractNatureEnum,
|
|
||||||
ContractsSettlementModeEnum,
|
|
||||||
ContractTemplatesIncomeExpenseTypeEnum,
|
|
||||||
HouseRegistersStatusEnum,
|
|
||||||
RefundsTypeEnum,
|
|
||||||
} from '@/gen/Enums';
|
|
||||||
import BIllInfo from '@/pages/bills/house_bills/modals/BIllInfo';
|
|
||||||
import {
|
|
||||||
BetaSchemaForm,
|
|
||||||
ProCard,
|
|
||||||
ProDescriptions,
|
|
||||||
} from '@ant-design/pro-components';
|
|
||||||
import { useNavigate } from '@umijs/max';
|
|
||||||
import { Form, message, Space, Steps } from 'antd';
|
|
||||||
|
|
||||||
export default function Update(props: MyBetaModalFormProps) {
|
|
||||||
const [form] = Form.useForm();
|
|
||||||
const navigate = useNavigate();
|
|
||||||
|
|
||||||
// 监听status字段变化,动态设置默认审批意见
|
|
||||||
const handleStatusChange = (changedValues: any) => {
|
|
||||||
if (changedValues.status) {
|
|
||||||
if (changedValues.status === HouseRegistersStatusEnum.Approved.value) {
|
|
||||||
form.setFieldsValue({ opinion: '同意' });
|
|
||||||
} else if (
|
|
||||||
changedValues.status === HouseRegistersStatusEnum.Rejected.value
|
|
||||||
) {
|
|
||||||
form.setFieldsValue({ opinion: '不同意' });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<BetaSchemaForm<ApiTypes.Archive.HouseRegisters.Update>
|
|
||||||
{...MyModalFormProps.props}
|
|
||||||
title={props.title}
|
|
||||||
trigger={<MyButtons.Default title="审核" type="primary" />}
|
|
||||||
wrapperCol={{ span: 24 }}
|
|
||||||
width="600px"
|
|
||||||
key={new Date().getTime()}
|
|
||||||
form={form}
|
|
||||||
onOpenChange={() => {
|
|
||||||
if (props?.item?.id) {
|
|
||||||
Apis.Approval.ApprovalInstances.Show({
|
|
||||||
id: props.item?.approval_instances_id,
|
|
||||||
}).then((res) => {
|
|
||||||
form.setFieldsValue({
|
|
||||||
info_display: res?.data,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
initialValues={{
|
|
||||||
// 默认选择通过,审批意见为同意
|
|
||||||
status: HouseRegistersStatusEnum.Approved.value,
|
|
||||||
opinion: '同意',
|
|
||||||
}}
|
|
||||||
onValuesChange={handleStatusChange}
|
|
||||||
onFinish={async (values: any) =>
|
|
||||||
Apis.Approval.ApprovalInstances.Approve({
|
|
||||||
record_id: props.item?.id ?? 0,
|
|
||||||
...values,
|
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
props.reload?.();
|
|
||||||
message.success(props.title + '成功');
|
|
||||||
return true;
|
|
||||||
})
|
|
||||||
.catch(() => false)
|
|
||||||
}
|
|
||||||
columns={[
|
|
||||||
{
|
|
||||||
// title: '登记信息',
|
|
||||||
dataIndex: 'info_display',
|
|
||||||
valueType: 'text',
|
|
||||||
renderFormItem: (_, config) => (
|
|
||||||
<Space direction="vertical" style={{ width: '100%' }}>
|
|
||||||
<div>
|
|
||||||
{/* 退款详情 */}
|
|
||||||
{config?.value?.type === 'Refund' && (
|
|
||||||
<ProCard size="small">
|
|
||||||
<ProDescriptions size="small" column={2}>
|
|
||||||
<ProDescriptions.Item label="申请事项" span={2}>
|
|
||||||
{config?.value?.title || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="账单类型">
|
|
||||||
<renderTextHelper.Tag
|
|
||||||
Enums={RefundsTypeEnum}
|
|
||||||
value={config?.value?.model?.type}
|
|
||||||
/>
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="退款金额">
|
|
||||||
<Space>
|
|
||||||
{config?.value?.model?.refund_amount || '-'}
|
|
||||||
元
|
|
||||||
<BIllInfo
|
|
||||||
item={{
|
|
||||||
id: config?.value?.model?.refundable_id,
|
|
||||||
type: 'link',
|
|
||||||
}}
|
|
||||||
title="查看账单"
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="付款信息" span={2}>
|
|
||||||
{config?.value?.model?.payer_name || '-'}|
|
|
||||||
{config?.value?.model?.payer_bank || '-'}|
|
|
||||||
{config?.value?.model?.payer_account || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="收款信息" span={2}>
|
|
||||||
{config?.value?.model?.payee_name || '-'}
|
|
||||||
{config?.value?.model?.payee_bank || '-'}
|
|
||||||
{config?.value?.model?.payee_account || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
|
|
||||||
<ProDescriptions.Item label="申请时间">
|
|
||||||
{props?.item?.created_at || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
</ProDescriptions>
|
|
||||||
</ProCard>
|
|
||||||
)}
|
|
||||||
{/* 合同详情 */}
|
|
||||||
{config?.value?.type === 'Contract' && (
|
|
||||||
<ProCard size="small">
|
|
||||||
<ProDescriptions size="small" column={2}>
|
|
||||||
<ProDescriptions.Item label="合同名称" span={2}>
|
|
||||||
{config?.value?.model?.name || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
|
|
||||||
<ProDescriptions.Item label="合同编号" span={2}>
|
|
||||||
<Space>
|
|
||||||
{config?.value?.model?.code || '-'}
|
|
||||||
<BIllInfo
|
|
||||||
item={{
|
|
||||||
id: config?.value?.model?.refundable_id,
|
|
||||||
type: 'Contract',
|
|
||||||
}}
|
|
||||||
title="查看合同"
|
|
||||||
/>
|
|
||||||
<MyButtons.View
|
|
||||||
title="查看"
|
|
||||||
key="configInfo"
|
|
||||||
onClick={() => {
|
|
||||||
navigate(
|
|
||||||
`/contract/contracts/show/${config?.value?.model?.id}`,
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="收支类型">
|
|
||||||
<renderTextHelper.Tag
|
|
||||||
Enums={ContractTemplatesIncomeExpenseTypeEnum}
|
|
||||||
value={config?.value?.model?.income_expense_type}
|
|
||||||
/>
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="合同性质">
|
|
||||||
<renderTextHelper.Tag
|
|
||||||
Enums={ContractsContractNatureEnum}
|
|
||||||
value={config?.value?.model?.contract_nature}
|
|
||||||
/>
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="合同类型">
|
|
||||||
{config?.value?.model?.contract_type_name || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="结算模式">
|
|
||||||
<renderTextHelper.Tag
|
|
||||||
Enums={ContractsSettlementModeEnum}
|
|
||||||
value={config?.value?.model?.settlement_mode}
|
|
||||||
/>
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="合同金额">
|
|
||||||
{config?.value?.model?.total_amount || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="保证金金额">
|
|
||||||
{config?.value?.model?.deposit_amount || '无'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="签约主体">
|
|
||||||
{config?.value?.model?.sign_subject || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="签约部门">
|
|
||||||
{config?.value?.model?.sign_department || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="关联项目">
|
|
||||||
{config?.value?.model?.project_name || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="合同对接人">
|
|
||||||
{config?.value?.model?.contract_liaison || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="合同有效期" span={2}>
|
|
||||||
{config?.value?.model?.start_time?.substring(0, 10)}至
|
|
||||||
{config?.value?.model?.end_time?.substring(0, 10)}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="申请时间" span={2}>
|
|
||||||
{props?.item?.created_at || '-'}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
<ProDescriptions.Item label="附件" span={2}>
|
|
||||||
{config?.value?.model?.attachments.map((item: any) => {
|
|
||||||
const handleDownload = async (
|
|
||||||
e: React.MouseEvent,
|
|
||||||
) => {
|
|
||||||
e.preventDefault();
|
|
||||||
try {
|
|
||||||
const response = await fetch(item.url);
|
|
||||||
const blob = await response.blob();
|
|
||||||
const url = window.URL.createObjectURL(blob);
|
|
||||||
const a = document.createElement('a');
|
|
||||||
a.href = url;
|
|
||||||
a.download = item.name;
|
|
||||||
document.body.appendChild(a);
|
|
||||||
a.click();
|
|
||||||
window.URL.revokeObjectURL(url);
|
|
||||||
document.body.removeChild(a);
|
|
||||||
} catch (error) {
|
|
||||||
console.error('下载失败:', error);
|
|
||||||
// 如果下载失败,则在新窗口打开
|
|
||||||
window.open(item.url, '_blank');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div key={item.url}>
|
|
||||||
<a href={item.url} onClick={handleDownload}>
|
|
||||||
{item.name};
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
</ProDescriptions>
|
|
||||||
</ProCard>
|
|
||||||
)}
|
|
||||||
<ProCard>
|
|
||||||
<ProDescriptions>
|
|
||||||
<ProDescriptions.Item label="审核记录">
|
|
||||||
<Space direction="vertical" style={{ width: '100%' }}>
|
|
||||||
<Steps
|
|
||||||
progressDot
|
|
||||||
direction="vertical"
|
|
||||||
current={config?.value?.approval_records.length}
|
|
||||||
items={config?.value?.approval_records.map(
|
|
||||||
(item: any) =>
|
|
||||||
item?.node_type === 'Approver'
|
|
||||||
? {
|
|
||||||
title: `${
|
|
||||||
item.company_employee?.name || '-'
|
|
||||||
}-${item?.company_employee?.phone}`,
|
|
||||||
description: `${
|
|
||||||
item.status === 'Approved'
|
|
||||||
? `通过 - ${item.opinion || '-'} - ${
|
|
||||||
item.created_at || '-'
|
|
||||||
}`
|
|
||||||
: '待审核'
|
|
||||||
}`,
|
|
||||||
}
|
|
||||||
: '',
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
</ProDescriptions.Item>
|
|
||||||
</ProDescriptions>
|
|
||||||
</ProCard>
|
|
||||||
</div>
|
|
||||||
</Space>
|
|
||||||
),
|
|
||||||
colProps: { span: 24 },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
valueType: 'group',
|
|
||||||
// title: '审核操作',
|
|
||||||
columns: [
|
|
||||||
MyFormItems.EnumRadio({
|
|
||||||
key: 'status',
|
|
||||||
title: '审核操作',
|
|
||||||
colProps: { span: 24 },
|
|
||||||
valueEnum: () => {
|
|
||||||
let obj: any = JSON.parse(
|
|
||||||
JSON.stringify(HouseRegistersStatusEnum),
|
|
||||||
);
|
|
||||||
delete obj.Pending;
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
required: true,
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
valueType: 'dependency',
|
|
||||||
name: ['status'],
|
|
||||||
columns: ({ status }) => {
|
|
||||||
return status === 'Rejected'
|
|
||||||
? [
|
|
||||||
{
|
|
||||||
title: '审批意见',
|
|
||||||
dataIndex: 'opinion',
|
|
||||||
valueType: 'textarea',
|
|
||||||
formItemProps: { ...rulesHelper.text },
|
|
||||||
colProps: { span: 24 },
|
|
||||||
},
|
|
||||||
]
|
|
||||||
: [
|
|
||||||
{
|
|
||||||
title: '审批意见',
|
|
||||||
dataIndex: 'opinion',
|
|
||||||
valueType: 'textarea',
|
|
||||||
formItemProps: { ...rulesHelper.text },
|
|
||||||
colProps: { span: 24 },
|
|
||||||
},
|
|
||||||
];
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,76 +0,0 @@
|
|||||||
import {
|
|
||||||
MyButtons,
|
|
||||||
MyColumns,
|
|
||||||
MyPageContainer,
|
|
||||||
MyProTableProps,
|
|
||||||
} from '@/common';
|
|
||||||
import { Apis } from '@/gen/Apis';
|
|
||||||
import { ProTable } from '@ant-design/pro-components';
|
|
||||||
import { Space } from 'antd';
|
|
||||||
import Create from './modals/Create';
|
|
||||||
import Update from './modals/Update';
|
|
||||||
|
|
||||||
export default function Index({ title = '审批模板' }) {
|
|
||||||
return (
|
|
||||||
<MyPageContainer
|
|
||||||
title={title}
|
|
||||||
enableTabs={true}
|
|
||||||
tabKey="contract_types"
|
|
||||||
tabLabel={title}
|
|
||||||
>
|
|
||||||
<ProTable
|
|
||||||
{...MyProTableProps.props}
|
|
||||||
request={async (params, sort) =>
|
|
||||||
MyProTableProps.request(
|
|
||||||
params,
|
|
||||||
sort,
|
|
||||||
Apis.Approval.ApprovalTemplates.List,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
headerTitle={title}
|
|
||||||
toolBarRender={(action) => [
|
|
||||||
<Create key="Create" reload={action?.reload} title={title} />,
|
|
||||||
]}
|
|
||||||
columns={[
|
|
||||||
MyColumns.ID({
|
|
||||||
search: false,
|
|
||||||
}),
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
title: '业务类型',
|
|
||||||
dataIndex: 'type',
|
|
||||||
// valueEnum: ApprovalTemplatesTypeEnum,
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
title: '模版名称',
|
|
||||||
dataIndex: 'name',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '模版编码',
|
|
||||||
dataIndex: 'code',
|
|
||||||
search: false,
|
|
||||||
},
|
|
||||||
|
|
||||||
MyColumns.ToggleEnabled({
|
|
||||||
onToggleEnabled: Apis.Approval.ApprovalTemplates.ToggleEnabled,
|
|
||||||
search: false,
|
|
||||||
}),
|
|
||||||
MyColumns.CreatedAt(),
|
|
||||||
MyColumns.Option({
|
|
||||||
render: (_, item: any, index, action) => (
|
|
||||||
<Space key={index}>
|
|
||||||
<Update item={item} reload={action?.reload} title={title} />
|
|
||||||
<MyButtons.Delete
|
|
||||||
onConfirm={() =>
|
|
||||||
Apis.Approval.ApprovalTemplates.SoftDelete({
|
|
||||||
id: item.id,
|
|
||||||
}).then(() => action?.reload())
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
),
|
|
||||||
}),
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
</MyPageContainer>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,138 +0,0 @@
|
|||||||
import {
|
|
||||||
MyBetaModalFormProps,
|
|
||||||
MyButtons,
|
|
||||||
MyFormItems,
|
|
||||||
MyModalFormProps,
|
|
||||||
rulesHelper,
|
|
||||||
} from '@/common';
|
|
||||||
import { Selects } from '@/components/Select';
|
|
||||||
import { Apis } from '@/gen/Apis';
|
|
||||||
import { ApprovalTemplateNodesNodeTypeEnum } from '@/gen/Enums';
|
|
||||||
import { BetaSchemaForm } from '@ant-design/pro-components';
|
|
||||||
import { Form, message } from 'antd';
|
|
||||||
|
|
||||||
export default function Create(props: MyBetaModalFormProps) {
|
|
||||||
const [form] = Form.useForm();
|
|
||||||
return (
|
|
||||||
<BetaSchemaForm<ApiTypes.Approval.ApprovalTemplates.Store>
|
|
||||||
{...MyModalFormProps.props}
|
|
||||||
title={`添加${props.title}`}
|
|
||||||
wrapperCol={{ span: 24 }}
|
|
||||||
width="700px"
|
|
||||||
key={new Date().getTime()}
|
|
||||||
form={form}
|
|
||||||
onOpenChange={(open: any) => {
|
|
||||||
if (open) {
|
|
||||||
form.resetFields(); // 清空表单数据
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
trigger={<MyButtons.Create title={`${props.title}`} />}
|
|
||||||
onFinish={async (values) =>
|
|
||||||
Apis.Approval.ApprovalTemplates.Store({
|
|
||||||
...values,
|
|
||||||
is_enabled: true,
|
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
props.reload?.();
|
|
||||||
message.success(props.title + '成功');
|
|
||||||
return true;
|
|
||||||
})
|
|
||||||
.catch(() => false)
|
|
||||||
}
|
|
||||||
columns={[
|
|
||||||
MyFormItems.EnumRadio({
|
|
||||||
key: 'type',
|
|
||||||
title: '业务类型',
|
|
||||||
// valueEnum: ApprovalTemplatesTypeEnum,
|
|
||||||
required: true,
|
|
||||||
colProps: { span: 24 },
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
key: 'name',
|
|
||||||
title: '模板名称',
|
|
||||||
formItemProps: { ...rulesHelper.text },
|
|
||||||
colProps: { span: 12 },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'code',
|
|
||||||
title: '模板编码',
|
|
||||||
formItemProps: { ...rulesHelper.text },
|
|
||||||
colProps: { span: 12 },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
valueType: 'formList',
|
|
||||||
dataIndex: 'nodes',
|
|
||||||
title: '设置审批节点',
|
|
||||||
fieldProps: {
|
|
||||||
copyIconProps: false,
|
|
||||||
// deleteIconProps: false,
|
|
||||||
},
|
|
||||||
formItemProps: {
|
|
||||||
...rulesHelper.array,
|
|
||||||
wrapperCol: { span: 24 },
|
|
||||||
},
|
|
||||||
columns: [
|
|
||||||
{
|
|
||||||
valueType: 'group',
|
|
||||||
colProps: { span: 24 },
|
|
||||||
columns: [
|
|
||||||
MyFormItems.EnumSelect({
|
|
||||||
key: 'node_type',
|
|
||||||
title: `类型`,
|
|
||||||
valueEnum: ApprovalTemplateNodesNodeTypeEnum,
|
|
||||||
colProps: { span: 5 },
|
|
||||||
formItemProps: {
|
|
||||||
...rulesHelper.text,
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
title: '节点名称',
|
|
||||||
key: 'name',
|
|
||||||
colProps: { span: 6 },
|
|
||||||
formItemProps: {
|
|
||||||
...rulesHelper.text,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
// MyFormItems.EnumSelect({
|
|
||||||
// key: 'approve_type',
|
|
||||||
// title: `审批方式`,
|
|
||||||
// valueEnum: ApprovalTemplateNodesApproveTypeEnum,
|
|
||||||
// colProps: { span: 5 },
|
|
||||||
// }),
|
|
||||||
|
|
||||||
{
|
|
||||||
valueType: 'dependency',
|
|
||||||
name: ['node_type'],
|
|
||||||
columns: ({ node_type }) => {
|
|
||||||
return [
|
|
||||||
Selects.Employees({
|
|
||||||
key: 'members',
|
|
||||||
title: `审批人员`,
|
|
||||||
colProps: { span: 13 },
|
|
||||||
fieldProps: {
|
|
||||||
mode: 'multiple',
|
|
||||||
maxCount:
|
|
||||||
node_type ===
|
|
||||||
ApprovalTemplateNodesNodeTypeEnum.Approver.value
|
|
||||||
? 1
|
|
||||||
: 9,
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
];
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '备注',
|
|
||||||
key: 'description',
|
|
||||||
colProps: { span: 24 },
|
|
||||||
valueType: 'textarea',
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,144 +0,0 @@
|
|||||||
import {
|
|
||||||
MyBetaModalFormProps,
|
|
||||||
MyButtons,
|
|
||||||
MyFormItems,
|
|
||||||
MyModalFormProps,
|
|
||||||
rulesHelper,
|
|
||||||
} from '@/common';
|
|
||||||
import { Selects } from '@/components/Select';
|
|
||||||
import { Apis } from '@/gen/Apis';
|
|
||||||
import { ApprovalTemplateNodesNodeTypeEnum } from '@/gen/Enums';
|
|
||||||
import { BetaSchemaForm } from '@ant-design/pro-components';
|
|
||||||
import { Form, message } from 'antd';
|
|
||||||
|
|
||||||
export default function Update(props: MyBetaModalFormProps) {
|
|
||||||
const [form] = Form.useForm();
|
|
||||||
return (
|
|
||||||
<BetaSchemaForm<ApiTypes.Approval.ApprovalTemplates.Update>
|
|
||||||
{...MyModalFormProps.props}
|
|
||||||
title={`编辑${props.title}`}
|
|
||||||
trigger={<MyButtons.Edit />}
|
|
||||||
key={new Date().getTime()}
|
|
||||||
wrapperCol={{ span: 24 }}
|
|
||||||
width="700px"
|
|
||||||
form={form}
|
|
||||||
onOpenChange={(open: any) => {
|
|
||||||
if (open && props.item) {
|
|
||||||
Apis.Approval.ApprovalTemplates.Show({
|
|
||||||
id: props.item?.id ?? 0,
|
|
||||||
}).then((res: any) => {
|
|
||||||
form.setFieldsValue({
|
|
||||||
...res?.data,
|
|
||||||
nodes: res?.data?.approval_template_nodes?.map((item: any) => ({
|
|
||||||
...item,
|
|
||||||
members: item?.approval_template_node_members?.map(
|
|
||||||
(member: any) => member?.company_employees_id,
|
|
||||||
),
|
|
||||||
})),
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
onFinish={async (values) =>
|
|
||||||
Apis.Approval.ApprovalTemplates.Update({
|
|
||||||
...values,
|
|
||||||
id: props.item?.id ?? 0,
|
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
props.reload?.();
|
|
||||||
message.success(props.title + '编辑成功');
|
|
||||||
return true;
|
|
||||||
})
|
|
||||||
.catch(() => false)
|
|
||||||
}
|
|
||||||
columns={[
|
|
||||||
MyFormItems.EnumRadio({
|
|
||||||
key: 'type',
|
|
||||||
title: '业务类型',
|
|
||||||
// valueEnum: ApprovalTemplatesTypeEnum,
|
|
||||||
required: true,
|
|
||||||
colProps: { span: 24 },
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
key: 'name',
|
|
||||||
title: '名称',
|
|
||||||
formItemProps: { ...rulesHelper.text },
|
|
||||||
colProps: { span: 12 },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'code',
|
|
||||||
title: '模板编码',
|
|
||||||
formItemProps: { ...rulesHelper.text },
|
|
||||||
colProps: { span: 12 },
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
valueType: 'formList',
|
|
||||||
dataIndex: 'nodes',
|
|
||||||
title: '审批节点',
|
|
||||||
fieldProps: {
|
|
||||||
copyIconProps: false,
|
|
||||||
// deleteIconProps: false,
|
|
||||||
},
|
|
||||||
formItemProps: {
|
|
||||||
...rulesHelper.array,
|
|
||||||
wrapperCol: { span: 24 },
|
|
||||||
},
|
|
||||||
columns: [
|
|
||||||
{
|
|
||||||
valueType: 'group',
|
|
||||||
colProps: { span: 24 },
|
|
||||||
columns: [
|
|
||||||
MyFormItems.EnumSelect({
|
|
||||||
key: 'node_type',
|
|
||||||
title: `类型`,
|
|
||||||
valueEnum: ApprovalTemplateNodesNodeTypeEnum,
|
|
||||||
colProps: { span: 5 },
|
|
||||||
formItemProps: {
|
|
||||||
...rulesHelper.text,
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
title: '节点名称',
|
|
||||||
key: 'name',
|
|
||||||
colProps: { span: 6 },
|
|
||||||
formItemProps: {
|
|
||||||
...rulesHelper.text,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
valueType: 'dependency',
|
|
||||||
name: ['node_type'],
|
|
||||||
columns: ({ node_type }) => {
|
|
||||||
return [
|
|
||||||
Selects.Employees({
|
|
||||||
key: 'members',
|
|
||||||
title: `审批人员`,
|
|
||||||
colProps: { span: 13 },
|
|
||||||
fieldProps: {
|
|
||||||
mode: 'multiple',
|
|
||||||
maxCount:
|
|
||||||
node_type ===
|
|
||||||
ApprovalTemplateNodesNodeTypeEnum.Approver.value
|
|
||||||
? 1
|
|
||||||
: 9,
|
|
||||||
maxTagTextLength: 3,
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
];
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '备注',
|
|
||||||
key: 'description',
|
|
||||||
colProps: { span: 24 },
|
|
||||||
valueType: 'textarea',
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -96,11 +96,12 @@ export default function Index({ title = '项目公告' }) {
|
|||||||
{
|
{
|
||||||
title: '关联项目',
|
title: '关联项目',
|
||||||
dataIndex: ['asset_project', 'name'],
|
dataIndex: ['asset_project', 'name'],
|
||||||
search: {
|
// search: {
|
||||||
transform: (value) => {
|
// transform: (value) => {
|
||||||
return { project_name: value };
|
// return { project_name: value };
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
|
search: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '公告标题',
|
title: '公告标题',
|
||||||
|
|||||||
@ -40,11 +40,12 @@ export default function Index({ ...rest }) {
|
|||||||
{
|
{
|
||||||
title: '关联项目',
|
title: '关联项目',
|
||||||
dataIndex: ['asset_project', 'name'],
|
dataIndex: ['asset_project', 'name'],
|
||||||
search: {
|
// search: {
|
||||||
transform: (value) => {
|
// transform: (value) => {
|
||||||
return { project_name: value };
|
// return { project_name: value };
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
|
search: false,
|
||||||
},
|
},
|
||||||
MyColumns.EnumTag({
|
MyColumns.EnumTag({
|
||||||
title: '类型',
|
title: '类型',
|
||||||
|
|||||||
@ -35,11 +35,12 @@ export default function Index({ ...rest }) {
|
|||||||
{
|
{
|
||||||
title: '关联项目',
|
title: '关联项目',
|
||||||
dataIndex: ['asset_project', 'name'],
|
dataIndex: ['asset_project', 'name'],
|
||||||
search: {
|
// search: {
|
||||||
transform: (value) => {
|
// transform: (value) => {
|
||||||
return { project_name: value };
|
// return { project_name: value };
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
|
search: false,
|
||||||
},
|
},
|
||||||
MyColumns.EnumTag({
|
MyColumns.EnumTag({
|
||||||
title: '类型',
|
title: '类型',
|
||||||
|
|||||||
@ -66,11 +66,12 @@ export default function Index({ title = '便民服务' }) {
|
|||||||
{
|
{
|
||||||
title: '关联项目',
|
title: '关联项目',
|
||||||
dataIndex: ['asset_project', 'name'],
|
dataIndex: ['asset_project', 'name'],
|
||||||
search: {
|
// search: {
|
||||||
transform: (value) => {
|
// transform: (value) => {
|
||||||
return { project_name: value };
|
// return { project_name: value };
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
|
search: false,
|
||||||
},
|
},
|
||||||
MyColumns.EnumTag({
|
MyColumns.EnumTag({
|
||||||
title: '类型',
|
title: '类型',
|
||||||
|
|||||||
@ -1,9 +1,6 @@
|
|||||||
import { MyColumns, MyProTableProps, useCurrentPermissions } from '@/common';
|
import { MyColumns, MyProTableProps, useCurrentPermissions } from '@/common';
|
||||||
import { Apis } from '@/gen/Apis';
|
import { Apis } from '@/gen/Apis';
|
||||||
import {
|
import { HouseOrdersPaymentMethodEnum } from '@/gen/Enums';
|
||||||
BillPaymentsStatusEnum,
|
|
||||||
HouseOrdersPaymentMethodEnum,
|
|
||||||
} from '@/gen/Enums';
|
|
||||||
import { ProTable } from '@ant-design/pro-components';
|
import { ProTable } from '@ant-design/pro-components';
|
||||||
import { Space } from 'antd';
|
import { Space } from 'antd';
|
||||||
import Review from './modals/Review';
|
import Review from './modals/Review';
|
||||||
@ -40,7 +37,7 @@ export default function Index() {
|
|||||||
title: '状态',
|
title: '状态',
|
||||||
dataIndex: 'status',
|
dataIndex: 'status',
|
||||||
search: false,
|
search: false,
|
||||||
valueEnum: BillPaymentsStatusEnum,
|
// valueEnum: BillPaymentsStatusEnum,
|
||||||
}),
|
}),
|
||||||
MyColumns.EnumTag({
|
MyColumns.EnumTag({
|
||||||
title: '支付方式',
|
title: '支付方式',
|
||||||
|
|||||||
@ -1,11 +1,5 @@
|
|||||||
import { MyColumns, MyProTableProps, useCurrentPermissions } from '@/common';
|
import { MyColumns, MyProTableProps, useCurrentPermissions } from '@/common';
|
||||||
import { Apis } from '@/gen/Apis';
|
import { Apis } from '@/gen/Apis';
|
||||||
import {
|
|
||||||
BillPaymentsTypeEnum,
|
|
||||||
BillsStatusEnum,
|
|
||||||
ContractBillsCostTypeEnum,
|
|
||||||
HouseOrdersPaymentMethodEnum,
|
|
||||||
} from '@/gen/Enums';
|
|
||||||
import { ProTable } from '@ant-design/pro-components';
|
import { ProTable } from '@ant-design/pro-components';
|
||||||
import { Space } from 'antd';
|
import { Space } from 'antd';
|
||||||
import PayCreate from './modals/PayCreate';
|
import PayCreate from './modals/PayCreate';
|
||||||
@ -44,24 +38,24 @@ export default function Index() {
|
|||||||
MyColumns.EnumTag({
|
MyColumns.EnumTag({
|
||||||
title: '状态',
|
title: '状态',
|
||||||
dataIndex: 'status',
|
dataIndex: 'status',
|
||||||
valueEnum: BillsStatusEnum,
|
// valueEnum: BillsStatusEnum,
|
||||||
}),
|
}),
|
||||||
MyColumns.EnumTag({
|
MyColumns.EnumTag({
|
||||||
title: '支付方式',
|
title: '支付方式',
|
||||||
dataIndex: 'payment_method',
|
dataIndex: 'payment_method',
|
||||||
valueEnum: HouseOrdersPaymentMethodEnum,
|
// valueEnum: HouseOrdersPaymentMethodEnum,
|
||||||
search: false,
|
search: false,
|
||||||
}),
|
}),
|
||||||
MyColumns.EnumTag({
|
MyColumns.EnumTag({
|
||||||
title: '费用项目',
|
title: '费用项目',
|
||||||
dataIndex: 'type',
|
dataIndex: 'type',
|
||||||
valueEnum: BillPaymentsTypeEnum,
|
// valueEnum: BillPaymentsTypeEnum,
|
||||||
search: false,
|
search: false,
|
||||||
}),
|
}),
|
||||||
MyColumns.EnumTag({
|
MyColumns.EnumTag({
|
||||||
title: '费用类型',
|
title: '费用类型',
|
||||||
dataIndex: 'flow_type',
|
dataIndex: 'flow_type',
|
||||||
valueEnum: ContractBillsCostTypeEnum,
|
// valueEnum: ContractBillsCostTypeEnum,
|
||||||
search: false,
|
search: false,
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
|
|||||||
@ -5,12 +5,7 @@ import {
|
|||||||
MyProTableProps,
|
MyProTableProps,
|
||||||
} from '@/common';
|
} from '@/common';
|
||||||
import { Apis } from '@/gen/Apis';
|
import { Apis } from '@/gen/Apis';
|
||||||
import {
|
import { HouseBillsBillStatusEnum, HouseBillsTypeEnum } from '@/gen/Enums';
|
||||||
ApprovalTemplatesTypeEnum,
|
|
||||||
HouseBillsBillStatusEnum,
|
|
||||||
HouseBillsTypeEnum,
|
|
||||||
RefundsTypeEnum,
|
|
||||||
} from '@/gen/Enums';
|
|
||||||
import { ProTable } from '@ant-design/pro-components';
|
import { ProTable } from '@ant-design/pro-components';
|
||||||
import { useNavigate } from '@umijs/max';
|
import { useNavigate } from '@umijs/max';
|
||||||
import { Space } from 'antd';
|
import { Space } from 'antd';
|
||||||
@ -58,14 +53,20 @@ export default function Index({ title = '账单明细' }) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
render: (_, record) => {
|
render: (_, record) => {
|
||||||
return (
|
return record.asset_houses_id ? (
|
||||||
<MyButtons.View
|
<MyButtons.View
|
||||||
title={record?.asset_house?.full_name || '-'}
|
title={record?.asset_house?.full_name || '-'}
|
||||||
type="link"
|
type="link"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
navigate(`/bills/summary/show/${record?.asset_houses_id}`);
|
record.asset_houses_id
|
||||||
|
? navigate(
|
||||||
|
`/bills/summary/show/${record.asset_houses_id}`,
|
||||||
|
)
|
||||||
|
: '';
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
) : (
|
||||||
|
'车位| ' + record.asset_car_port.full_name
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -145,9 +146,9 @@ export default function Index({ title = '账单明细' }) {
|
|||||||
item={{
|
item={{
|
||||||
...item,
|
...item,
|
||||||
// 跟据发起的页面传递的type来判断退款类型
|
// 跟据发起的页面传递的type来判断退款类型
|
||||||
type: RefundsTypeEnum.HouseOrder.value,
|
// type: RefundsTypeEnum.HouseOrder.value,
|
||||||
// 审批模板的类型
|
// 审批模板的类型
|
||||||
approval_type: ApprovalTemplatesTypeEnum.Refund.value,
|
// approval_type: ApprovalTemplatesTypeEnum.Refund.value,
|
||||||
total_paid_amount: item.total_paid_amount,
|
total_paid_amount: item.total_paid_amount,
|
||||||
}}
|
}}
|
||||||
reload={action?.reload}
|
reload={action?.reload}
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import {
|
|||||||
} from '@/common';
|
} from '@/common';
|
||||||
import { Selects } from '@/components/Select';
|
import { Selects } from '@/components/Select';
|
||||||
import { Apis } from '@/gen/Apis';
|
import { Apis } from '@/gen/Apis';
|
||||||
import { ApprovalTemplateNodesNodeTypeEnum } from '@/gen/Enums';
|
|
||||||
import { BetaSchemaForm } from '@ant-design/pro-components';
|
import { BetaSchemaForm } from '@ant-design/pro-components';
|
||||||
import { Form, message } from 'antd';
|
import { Form, message } from 'antd';
|
||||||
import { useRef, useState } from 'react';
|
import { useRef, useState } from 'react';
|
||||||
@ -159,7 +158,7 @@ export default function Update(props: MyBetaModalFormProps) {
|
|||||||
MyFormItems.EnumSelect({
|
MyFormItems.EnumSelect({
|
||||||
key: 'node_type',
|
key: 'node_type',
|
||||||
// title: `类型`,
|
// title: `类型`,
|
||||||
valueEnum: ApprovalTemplateNodesNodeTypeEnum,
|
// valueEnum: ApprovalTemplateNodesNodeTypeEnum,
|
||||||
colProps: { span: 5 },
|
colProps: { span: 5 },
|
||||||
formItemProps: {
|
formItemProps: {
|
||||||
...rulesHelper.text,
|
...rulesHelper.text,
|
||||||
@ -194,12 +193,12 @@ export default function Update(props: MyBetaModalFormProps) {
|
|||||||
fieldProps: {
|
fieldProps: {
|
||||||
mode: 'multiple',
|
mode: 'multiple',
|
||||||
showSearch: true,
|
showSearch: true,
|
||||||
maxCount:
|
// maxCount:
|
||||||
node_type ===
|
// node_type ===
|
||||||
ApprovalTemplateNodesNodeTypeEnum.Approver
|
// ApprovalTemplateNodesNodeTypeEnum.Approver
|
||||||
.value
|
// .value
|
||||||
? 1
|
// ? 1
|
||||||
: 9,
|
// : 9,
|
||||||
maxTagTextLength: 3,
|
maxTagTextLength: 3,
|
||||||
labelRender: (res: any) => {
|
labelRender: (res: any) => {
|
||||||
console.log(res, '222');
|
console.log(res, '222');
|
||||||
|
|||||||
209
src/pages/bills/order_online/index.tsx
Normal file
209
src/pages/bills/order_online/index.tsx
Normal file
@ -0,0 +1,209 @@
|
|||||||
|
import {
|
||||||
|
MyColumns,
|
||||||
|
MyImportModal,
|
||||||
|
MyPageContainer,
|
||||||
|
MyProTableProps,
|
||||||
|
useCurrentPermissions,
|
||||||
|
} from '@/common';
|
||||||
|
import { MyExport } from '@/components/MyExport';
|
||||||
|
import { Selects } from '@/components/Select';
|
||||||
|
import { Apis } from '@/gen/Apis';
|
||||||
|
import {
|
||||||
|
HouseBillsBillStatusEnum,
|
||||||
|
HouseOrdersPaymentMethodEnum,
|
||||||
|
} from '@/gen/Enums';
|
||||||
|
import { ProTable } from '@ant-design/pro-components';
|
||||||
|
import { Space } from 'antd';
|
||||||
|
import { useState } from 'react';
|
||||||
|
import SerialNumber from './modals/SerialNumber';
|
||||||
|
import SerialNumbers from './modals/SerialNumbers';
|
||||||
|
import Show from './modals/Show';
|
||||||
|
|
||||||
|
export default function Index({ title = '线上收款单' }) {
|
||||||
|
const [getParams, setParams] = useState({});
|
||||||
|
const [selectedRows, setSelectedRows] = useState<any[]>([]);
|
||||||
|
const getCurrentPermissions = useCurrentPermissions();
|
||||||
|
|
||||||
|
let toolBarRender = (action: any) => {
|
||||||
|
return getCurrentPermissions({
|
||||||
|
import: (
|
||||||
|
<MyImportModal
|
||||||
|
key="import"
|
||||||
|
title="导入流水"
|
||||||
|
type="default"
|
||||||
|
size="middle"
|
||||||
|
templateApi={Apis.HouseOrder.HouseOrders.DownloadSerialNumberTemplate}
|
||||||
|
importApi={Apis.HouseOrder.HouseOrders.ImportSerialNumber}
|
||||||
|
reload={action?.reload}
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
export: (
|
||||||
|
<MyExport
|
||||||
|
key="export"
|
||||||
|
item={getParams}
|
||||||
|
download={Apis.HouseOrder.HouseOrders}
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
serialNumbers: (
|
||||||
|
<SerialNumbers
|
||||||
|
items={selectedRows}
|
||||||
|
reload={action?.reload}
|
||||||
|
title="批量关联"
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
let tableRender = (item: any, action: any) => {
|
||||||
|
return getCurrentPermissions({
|
||||||
|
show: <Show item={item} reload={action?.reload} title="查看" />,
|
||||||
|
serialNumber: (
|
||||||
|
<SerialNumber item={item} reload={action?.reload} title="关联流水" />
|
||||||
|
),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
return (
|
||||||
|
<MyPageContainer
|
||||||
|
title={title}
|
||||||
|
enableTabs={true}
|
||||||
|
tabKey="houseorders"
|
||||||
|
tabLabel={title}
|
||||||
|
>
|
||||||
|
<ProTable
|
||||||
|
{...MyProTableProps.props}
|
||||||
|
headerTitle="收款单明细"
|
||||||
|
rowSelection={{
|
||||||
|
onChange: (_, selectedRows) => {
|
||||||
|
setSelectedRows(selectedRows);
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
request={async (params, sort) => {
|
||||||
|
setParams(params);
|
||||||
|
return MyProTableProps.request(
|
||||||
|
{
|
||||||
|
...params,
|
||||||
|
// payment_methods: [
|
||||||
|
// HouseOrdersPaymentMethodEnum.TongLian.value,
|
||||||
|
// HouseOrdersPaymentMethodEnum.WeChat.value,
|
||||||
|
// HouseOrdersPaymentMethodEnum.Alipay.value,
|
||||||
|
// ],
|
||||||
|
},
|
||||||
|
sort,
|
||||||
|
Apis.HouseOrder.HouseOrders.List,
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
toolBarRender={(action: any) => [toolBarRender(action)]}
|
||||||
|
columns={[
|
||||||
|
// MyColumns.ID({ search: false }),
|
||||||
|
Selects?.AssetProjects({
|
||||||
|
title: '选择项目',
|
||||||
|
key: 'asset_projects_id',
|
||||||
|
hidden: true,
|
||||||
|
}),
|
||||||
|
{
|
||||||
|
title: '收款单ID',
|
||||||
|
dataIndex: 'id',
|
||||||
|
search: false,
|
||||||
|
},
|
||||||
|
MyColumns.Boolean({
|
||||||
|
dataIndex: 'is_serial_number',
|
||||||
|
title: '关联流水',
|
||||||
|
hidden: true,
|
||||||
|
}),
|
||||||
|
|
||||||
|
{
|
||||||
|
title: '项目名称',
|
||||||
|
dataIndex: ['asset_project', 'name'],
|
||||||
|
search: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '房屋',
|
||||||
|
dataIndex: ['asset_house', 'full_name'],
|
||||||
|
render: (_, record) =>
|
||||||
|
record.house_order_items?.[0]?.asset_house?.full_name || '-',
|
||||||
|
search: {
|
||||||
|
transform: (value) => {
|
||||||
|
return { full_name: value };
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
MyColumns.EnumTag({
|
||||||
|
title: '收款方式',
|
||||||
|
dataIndex: 'payment_method',
|
||||||
|
valueEnum: HouseOrdersPaymentMethodEnum,
|
||||||
|
}),
|
||||||
|
MyColumns.EnumTag({
|
||||||
|
title: '支付状态',
|
||||||
|
dataIndex: 'order_status',
|
||||||
|
valueEnum: HouseBillsBillStatusEnum,
|
||||||
|
search: false,
|
||||||
|
}),
|
||||||
|
|
||||||
|
{
|
||||||
|
title: '收款金额',
|
||||||
|
dataIndex: 'actual_paid_amount',
|
||||||
|
search: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '收款手续费',
|
||||||
|
dataIndex: 'fee',
|
||||||
|
search: false,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
title: '收款日期',
|
||||||
|
dataIndex: 'paid_time',
|
||||||
|
valueType: 'dateRange',
|
||||||
|
hidden: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '收款日期',
|
||||||
|
dataIndex: 'paid_time',
|
||||||
|
valueType: 'date',
|
||||||
|
// render: (_, record) => {
|
||||||
|
// return record?.paid_time?.substring(0, 10);
|
||||||
|
// },
|
||||||
|
search: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '收款账户',
|
||||||
|
dataIndex: ['receipt_account', 'company_name'],
|
||||||
|
// search: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '收款银行',
|
||||||
|
dataIndex: ['receipt_account', 'company_bank'],
|
||||||
|
// search: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '收款账号',
|
||||||
|
dataIndex: ['receipt_account', 'company_account'],
|
||||||
|
// search: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '银行流水',
|
||||||
|
dataIndex: 'accept_serial_number',
|
||||||
|
// search: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '关联编号',
|
||||||
|
dataIndex: 'payment_no',
|
||||||
|
search: false,
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// title: '录入人',
|
||||||
|
// dataIndex: 'creator',
|
||||||
|
// search: false,
|
||||||
|
// },
|
||||||
|
MyColumns.CreatedAt(),
|
||||||
|
MyColumns.Option({
|
||||||
|
render: (_, item: any, index, action) => (
|
||||||
|
<Space key={index}>
|
||||||
|
<>{tableRender(item, action)}</>
|
||||||
|
</Space>
|
||||||
|
),
|
||||||
|
}),
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</MyPageContainer>
|
||||||
|
);
|
||||||
|
}
|
||||||
244
src/pages/bills/order_online/modals/Audit.tsx
Normal file
244
src/pages/bills/order_online/modals/Audit.tsx
Normal file
@ -0,0 +1,244 @@
|
|||||||
|
import {
|
||||||
|
MyBetaModalFormProps,
|
||||||
|
MyButtons,
|
||||||
|
MyColumns,
|
||||||
|
MyFormItems,
|
||||||
|
MyModalFormProps,
|
||||||
|
MyProTableProps,
|
||||||
|
renderTextHelper,
|
||||||
|
rulesHelper,
|
||||||
|
} from '@/common';
|
||||||
|
|
||||||
|
import { Apis } from '@/gen/Apis';
|
||||||
|
import {
|
||||||
|
HouseBillsTypeEnum,
|
||||||
|
HouseOrdersAuditStatusEnum,
|
||||||
|
HouseOrdersPaymentMethodEnum,
|
||||||
|
HouseRegistersStatusEnum,
|
||||||
|
} from '@/gen/Enums';
|
||||||
|
import {
|
||||||
|
BetaSchemaForm,
|
||||||
|
ProCard,
|
||||||
|
ProDescriptions,
|
||||||
|
ProTable,
|
||||||
|
} from '@ant-design/pro-components';
|
||||||
|
import { Form, message, Space } from 'antd';
|
||||||
|
export default function Audit(props: MyBetaModalFormProps) {
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<BetaSchemaForm<ApiTypes.Bill.HouseBills.Update>
|
||||||
|
{...MyModalFormProps.props}
|
||||||
|
title={props.title}
|
||||||
|
trigger={<MyButtons.Default title="审核" type="primary" />}
|
||||||
|
// wrapperCol={{ span: 24 }}
|
||||||
|
layout="horizontal"
|
||||||
|
labelCol={{ span: 0 }}
|
||||||
|
wrapperCol={{ span: 24 }}
|
||||||
|
labelAlign="left"
|
||||||
|
width="800px"
|
||||||
|
key={new Date().getTime()}
|
||||||
|
form={form}
|
||||||
|
onFinish={async (values: any) =>
|
||||||
|
Apis.HouseOrder.HouseOrders.Audit({
|
||||||
|
id: props.item?.id ?? 0,
|
||||||
|
accept_name: props.item?.receipt_account?.company_name || '',
|
||||||
|
accept_bank: props.item?.receipt_account?.company_bank || '',
|
||||||
|
accept_account: props.item?.receipt_account?.company_account || '',
|
||||||
|
...values,
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
props.reload?.();
|
||||||
|
message.success(props.title + '成功');
|
||||||
|
return true;
|
||||||
|
})
|
||||||
|
.catch(() => false)
|
||||||
|
}
|
||||||
|
columns={[
|
||||||
|
{
|
||||||
|
// title: '登记信息',
|
||||||
|
dataIndex: 'info_display',
|
||||||
|
valueType: 'text',
|
||||||
|
renderFormItem: () => (
|
||||||
|
<Space direction="vertical" style={{ width: '100%' }}>
|
||||||
|
<ProCard size="small">
|
||||||
|
<ProDescriptions bordered size="small" column={2}>
|
||||||
|
<ProDescriptions.Item label="房屋名称" span={2}>
|
||||||
|
<Space>
|
||||||
|
{props?.item?.house_order_items?.[0].asset_house
|
||||||
|
?.full_name || '-'}
|
||||||
|
<renderTextHelper.Tag
|
||||||
|
Enums={HouseOrdersAuditStatusEnum}
|
||||||
|
value={props?.item?.audit_status}
|
||||||
|
/>
|
||||||
|
</Space>
|
||||||
|
</ProDescriptions.Item>
|
||||||
|
<ProDescriptions.Item label="收款账号" span={2}>
|
||||||
|
{props?.item?.receipt_account?.company_name} ;
|
||||||
|
{props?.item?.receipt_account?.company_bank} ;
|
||||||
|
{props?.item?.receipt_account?.company_account}
|
||||||
|
</ProDescriptions.Item>
|
||||||
|
{/* <ProDescriptions.Item label="关联流水" span={2}>
|
||||||
|
{props?.item?.accept_serial_number || '未提供'}
|
||||||
|
</ProDescriptions.Item> */}
|
||||||
|
<ProDescriptions.Item label="收款金额">
|
||||||
|
{props?.item?.actual_paid_amount || '-'}
|
||||||
|
</ProDescriptions.Item>
|
||||||
|
<ProDescriptions.Item label="录入人">
|
||||||
|
{props?.item?.creator || '-'}-
|
||||||
|
{props?.item?.creator_phone || '-'}
|
||||||
|
</ProDescriptions.Item>
|
||||||
|
<ProDescriptions.Item label="录入时间">
|
||||||
|
{props?.item?.created_at || '-'}
|
||||||
|
</ProDescriptions.Item>
|
||||||
|
</ProDescriptions>
|
||||||
|
</ProCard>
|
||||||
|
<ProCard title="" size="small">
|
||||||
|
<ProTable
|
||||||
|
{...MyProTableProps.props}
|
||||||
|
search={false}
|
||||||
|
toolBarRender={false}
|
||||||
|
pagination={false}
|
||||||
|
dataSource={props?.item?.house_order_items}
|
||||||
|
rowKey={(record, index) => record?.id || index}
|
||||||
|
size="small"
|
||||||
|
columns={[
|
||||||
|
{
|
||||||
|
title: '关联账单',
|
||||||
|
render: (_, record) => {
|
||||||
|
return `${record.house_bill.year}-${String(
|
||||||
|
record.house_bill.month,
|
||||||
|
).padStart(2, '0')}`;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
MyColumns.EnumTag({
|
||||||
|
title: '类型',
|
||||||
|
dataIndex: ['house_bill', 'type'],
|
||||||
|
valueEnum: HouseBillsTypeEnum,
|
||||||
|
}),
|
||||||
|
{
|
||||||
|
title: '未收金额',
|
||||||
|
dataIndex: 'amount',
|
||||||
|
search: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '本次收取金额',
|
||||||
|
dataIndex: 'paid_amount',
|
||||||
|
search: false,
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</ProCard>
|
||||||
|
</Space>
|
||||||
|
),
|
||||||
|
colProps: { span: 24 },
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
valueType: 'group',
|
||||||
|
title: '',
|
||||||
|
columns: [
|
||||||
|
MyFormItems.EnumRadio({
|
||||||
|
key: 'payment_method',
|
||||||
|
title: '收款方式',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
valueEnum: () => {
|
||||||
|
const obj: Record<string, any> = JSON.parse(
|
||||||
|
JSON.stringify(HouseOrdersPaymentMethodEnum),
|
||||||
|
);
|
||||||
|
delete obj.WeChat;
|
||||||
|
delete obj.Alipay;
|
||||||
|
delete obj.TongLian;
|
||||||
|
delete obj.Prepayment;
|
||||||
|
return obj;
|
||||||
|
},
|
||||||
|
formItemProps: {
|
||||||
|
...rulesHelper.text,
|
||||||
|
labelCol: { span: 4 },
|
||||||
|
wrapperCol: { span: 20 },
|
||||||
|
},
|
||||||
|
initialValue: props?.item?.payment_method,
|
||||||
|
}),
|
||||||
|
{
|
||||||
|
key: 'paid_time',
|
||||||
|
title: '收款日期',
|
||||||
|
valueType: 'date',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
formItemProps: {
|
||||||
|
...rulesHelper.text,
|
||||||
|
labelCol: { span: 4 },
|
||||||
|
wrapperCol: { span: 20 },
|
||||||
|
},
|
||||||
|
initialValue: props?.item?.paid_time
|
||||||
|
? new Date(props?.item?.paid_time)
|
||||||
|
: undefined,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
valueType: 'group',
|
||||||
|
// title: '审核操作',
|
||||||
|
columns: [
|
||||||
|
MyFormItems.EnumRadio({
|
||||||
|
key: 'audit_status',
|
||||||
|
title: '审核操作',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
valueEnum: () => {
|
||||||
|
let obj: any = JSON.parse(
|
||||||
|
JSON.stringify(HouseRegistersStatusEnum),
|
||||||
|
);
|
||||||
|
delete obj.Pending;
|
||||||
|
return obj;
|
||||||
|
},
|
||||||
|
formItemProps: {
|
||||||
|
...rulesHelper.text,
|
||||||
|
labelCol: { span: 4 },
|
||||||
|
wrapperCol: { span: 20 },
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
|
||||||
|
{
|
||||||
|
valueType: 'dependency',
|
||||||
|
name: ['audit_status'],
|
||||||
|
columns: ({ audit_status }) => {
|
||||||
|
return audit_status ===
|
||||||
|
HouseOrdersAuditStatusEnum.Rejected.value
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
title: '驳回原因',
|
||||||
|
dataIndex: 'reason',
|
||||||
|
valueType: 'textarea',
|
||||||
|
formItemProps: {
|
||||||
|
...rulesHelper.text,
|
||||||
|
labelCol: { span: 4 },
|
||||||
|
wrapperCol: { span: 20 },
|
||||||
|
},
|
||||||
|
colProps: { span: 24 },
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: [
|
||||||
|
{
|
||||||
|
key: 'accept_serial_number',
|
||||||
|
title: '关联流水',
|
||||||
|
valueType: 'text',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
initialValue: props?.item?.accept_serial_number,
|
||||||
|
formItemProps: {
|
||||||
|
...rulesHelper.text,
|
||||||
|
labelCol: { span: 4 },
|
||||||
|
wrapperCol: { span: 20 },
|
||||||
|
},
|
||||||
|
fieldProps: {
|
||||||
|
placeholder: '请输入银行流水',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
77
src/pages/bills/order_online/modals/PayUpdate.tsx
Normal file
77
src/pages/bills/order_online/modals/PayUpdate.tsx
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
import {
|
||||||
|
MyBetaModalFormProps,
|
||||||
|
MyButtons,
|
||||||
|
MyFormItems,
|
||||||
|
MyModalFormProps,
|
||||||
|
rulesHelper,
|
||||||
|
} from '@/common';
|
||||||
|
import { Apis } from '@/gen/Apis';
|
||||||
|
import { HouseOrdersPaymentMethodEnum } from '@/gen/Enums';
|
||||||
|
import { BetaSchemaForm } from '@ant-design/pro-components';
|
||||||
|
import { Form, message } from 'antd';
|
||||||
|
|
||||||
|
export default function Update(props: MyBetaModalFormProps) {
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
return (
|
||||||
|
<BetaSchemaForm<ApiTypes.Bill.HouseBills.Update>
|
||||||
|
{...MyModalFormProps.props}
|
||||||
|
title={`${props.title}更新`}
|
||||||
|
trigger={<MyButtons.Edit />}
|
||||||
|
wrapperCol={{ span: 24 }}
|
||||||
|
width="800px"
|
||||||
|
key={new Date().getTime()}
|
||||||
|
form={form}
|
||||||
|
onOpenChange={(open: any) => {
|
||||||
|
if (open && props.item) {
|
||||||
|
form.setFieldsValue({
|
||||||
|
...props.item,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
onFinish={async (values) =>
|
||||||
|
Apis.Bill.HouseBills.Update({ ...values, id: props.item?.id ?? 0 })
|
||||||
|
.then(() => {
|
||||||
|
props.reload?.();
|
||||||
|
message.success(props.title + '成功');
|
||||||
|
return true;
|
||||||
|
})
|
||||||
|
.catch(() => false)
|
||||||
|
}
|
||||||
|
columns={[
|
||||||
|
MyFormItems.EnumRadio({
|
||||||
|
key: 'payment_method',
|
||||||
|
title: '收款方式',
|
||||||
|
colProps: { span: 10 },
|
||||||
|
valueEnum: () => {
|
||||||
|
const obj: Record<string, any> = JSON.parse(
|
||||||
|
JSON.stringify(HouseOrdersPaymentMethodEnum),
|
||||||
|
);
|
||||||
|
delete obj.WeChat;
|
||||||
|
delete obj.Alipay;
|
||||||
|
delete obj.TongLian;
|
||||||
|
delete obj.Prepayment;
|
||||||
|
return obj;
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
}),
|
||||||
|
|
||||||
|
{
|
||||||
|
key: 'paid_time',
|
||||||
|
title: '收款日期',
|
||||||
|
valueType: 'date',
|
||||||
|
formItemProps: { ...rulesHelper.text },
|
||||||
|
colProps: { span: 6 },
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
colProps: { span: 24 },
|
||||||
|
renderFormItem: () => (
|
||||||
|
<span style={{ color: '#5b5b5bff' }}>
|
||||||
|
提示:确认后,需财务审核。
|
||||||
|
</span>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -8,28 +8,30 @@ import { Apis } from '@/gen/Apis';
|
|||||||
import { BetaSchemaForm } from '@ant-design/pro-components';
|
import { BetaSchemaForm } from '@ant-design/pro-components';
|
||||||
import { Form, message } from 'antd';
|
import { Form, message } from 'antd';
|
||||||
|
|
||||||
export default function QuestionCategoriesUpdate(props: MyBetaModalFormProps) {
|
export default function OrganizationHasProjects(props: MyBetaModalFormProps) {
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BetaSchemaForm<ApiTypes.Survey.QuestionCategories.Update>
|
<BetaSchemaForm<ApiTypes.HouseOrder.HouseOrders.UpdateSerialNumber>
|
||||||
{...MyModalFormProps.props}
|
{...MyModalFormProps.props}
|
||||||
form={form}
|
title={`关联银行流水`}
|
||||||
title={`编辑${props.title}`}
|
|
||||||
wrapperCol={{ span: 24 }}
|
wrapperCol={{ span: 24 }}
|
||||||
key={new Date().getTime()}
|
|
||||||
width="500px"
|
width="500px"
|
||||||
trigger={<MyButtons.Edit title="编辑" />}
|
trigger={<MyButtons.Edit title={`流水`} size="small" />}
|
||||||
|
key={new Date().getTime()}
|
||||||
|
form={form}
|
||||||
onOpenChange={(open: any) => {
|
onOpenChange={(open: any) => {
|
||||||
if (open && props.item) {
|
if (open && props.item) {
|
||||||
form.setFieldsValue(props.item);
|
form.setFieldsValue({
|
||||||
|
...props.item,
|
||||||
|
serial_number: props?.item?.accept_serial_number || '',
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
onFinish={async (values) =>
|
onFinish={async (values: any) =>
|
||||||
Apis.Survey.QuestionCategories.Update({
|
Apis.HouseOrder.HouseOrders.UpdateSerialNumber({
|
||||||
...values,
|
...values,
|
||||||
is_enabled: values?.is_enabled ? true : false,
|
id: props?.item?.id,
|
||||||
id: props.item?.id ?? 0,
|
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
props.reload?.();
|
props.reload?.();
|
||||||
@ -39,18 +41,12 @@ export default function QuestionCategoriesUpdate(props: MyBetaModalFormProps) {
|
|||||||
.catch(() => false)
|
.catch(() => false)
|
||||||
}
|
}
|
||||||
columns={[
|
columns={[
|
||||||
{ key: 'name', title: '名称', formItemProps: { ...rulesHelper.text } },
|
|
||||||
{
|
{
|
||||||
key: 'description',
|
key: 'serial_number',
|
||||||
title: '描述',
|
title: '银行流水号',
|
||||||
valueType: 'textarea',
|
formItemProps: { ...rulesHelper.text },
|
||||||
|
colProps: { span: 24 },
|
||||||
},
|
},
|
||||||
{
|
|
||||||
key: 'is_enabled',
|
|
||||||
title: '是否启用',
|
|
||||||
valueType: 'switch',
|
|
||||||
},
|
|
||||||
// MyFormItems.ColorPicker(),
|
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
157
src/pages/bills/order_online/modals/SerialNumbers.tsx
Normal file
157
src/pages/bills/order_online/modals/SerialNumbers.tsx
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
import {
|
||||||
|
MyBetaModalFormProps,
|
||||||
|
MyButtons,
|
||||||
|
MyModalFormProps,
|
||||||
|
rulesHelper,
|
||||||
|
} from '@/common';
|
||||||
|
import { Apis } from '@/gen/Apis';
|
||||||
|
import { BetaSchemaForm } from '@ant-design/pro-components';
|
||||||
|
import { Form, message } from 'antd';
|
||||||
|
|
||||||
|
interface BatchSerialNumbersProps extends MyBetaModalFormProps {
|
||||||
|
items?: any[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function BatchSerialNumbers(props: BatchSerialNumbersProps) {
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
const { items = [] } = props;
|
||||||
|
// 计算总收款金额
|
||||||
|
const totalAmount = items.reduce((sum, item) => {
|
||||||
|
return sum + Number(item.actual_paid_amount || 0);
|
||||||
|
}, 0);
|
||||||
|
// 计算总收款手续费
|
||||||
|
const totalFee = items.reduce((sum, item) => {
|
||||||
|
return sum + Number(item.fee || 0);
|
||||||
|
}, 0);
|
||||||
|
// 计算到账金额(总收款金额 - 总手续费)
|
||||||
|
const actualReceivedAmount = totalAmount - totalFee;
|
||||||
|
// 获取收款账号信息(所有项目都相同)
|
||||||
|
const receiptAccount = items[0]?.receipt_account || {};
|
||||||
|
// 验证是否所有项目都有相同的收款账号
|
||||||
|
const validateSameAccount = () => {
|
||||||
|
if (items.length === 0) return true;
|
||||||
|
|
||||||
|
const firstAccount = items[0].receipt_account?.company_account;
|
||||||
|
return items.every(
|
||||||
|
(item) => item.receipt_account?.company_account === firstAccount,
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<BetaSchemaForm<ApiTypes.HouseOrder.HouseOrders.BatchUpdateSerialNumber>
|
||||||
|
{...MyModalFormProps.props}
|
||||||
|
title={`关联银行流水`}
|
||||||
|
layout="horizontal"
|
||||||
|
labelCol={{ span: 6 }}
|
||||||
|
wrapperCol={{ span: 18 }}
|
||||||
|
labelAlign="left"
|
||||||
|
width="500px"
|
||||||
|
trigger={
|
||||||
|
<MyButtons.Edit
|
||||||
|
title={props.title || `批量关联`}
|
||||||
|
size="middle"
|
||||||
|
disabled={items.length === 0}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
key={new Date().getTime()}
|
||||||
|
form={form}
|
||||||
|
onOpenChange={(open: any) => {
|
||||||
|
if (open && items.length > 0) {
|
||||||
|
form.resetFields(); // 清空表单数据
|
||||||
|
// 验证收款账号是否相同
|
||||||
|
if (!validateSameAccount()) {
|
||||||
|
message.error('请选择相同收款账号的收款单');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
onFinish={async (values: any) => {
|
||||||
|
// 再次验证收款账号是否相同
|
||||||
|
if (!validateSameAccount()) {
|
||||||
|
message.error('请选择相同收款账号的收款单');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Apis.HouseOrder.HouseOrders.BatchUpdateSerialNumber({
|
||||||
|
...values,
|
||||||
|
ids: items.map((item) => item.id),
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
props.reload?.();
|
||||||
|
message.success(props.title + '成功');
|
||||||
|
return true;
|
||||||
|
})
|
||||||
|
.catch(() => false);
|
||||||
|
}}
|
||||||
|
columns={[
|
||||||
|
{
|
||||||
|
key: 'company_name',
|
||||||
|
title: '收款账户',
|
||||||
|
valueType: 'text',
|
||||||
|
initialValue: receiptAccount.company_name || '-',
|
||||||
|
fieldProps: {
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
|
colProps: { span: 24 },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'company_bank',
|
||||||
|
title: '收款银行',
|
||||||
|
valueType: 'text',
|
||||||
|
initialValue: receiptAccount.company_bank || '-',
|
||||||
|
fieldProps: {
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
|
colProps: { span: 24 },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'company_account',
|
||||||
|
title: '收款账号',
|
||||||
|
valueType: 'text',
|
||||||
|
initialValue: receiptAccount.company_account || '-',
|
||||||
|
fieldProps: {
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
|
colProps: { span: 24 },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'total_amount',
|
||||||
|
title: '收款单汇总',
|
||||||
|
valueType: 'number',
|
||||||
|
initialValue: totalAmount,
|
||||||
|
fieldProps: {
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
|
colProps: { span: 24 },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'totalFee',
|
||||||
|
title: '手续费汇总',
|
||||||
|
valueType: 'number',
|
||||||
|
initialValue: totalFee,
|
||||||
|
fieldProps: {
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
|
colProps: { span: 24 },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'actual_received_amount',
|
||||||
|
title: '应到账金额',
|
||||||
|
valueType: 'number',
|
||||||
|
initialValue: actualReceivedAmount,
|
||||||
|
fieldProps: {
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
|
colProps: { span: 24 },
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
key: 'serial_number',
|
||||||
|
title: '银行流水号',
|
||||||
|
formItemProps: { ...rulesHelper.text },
|
||||||
|
colProps: { span: 24 },
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
115
src/pages/bills/order_online/modals/Show.tsx
Normal file
115
src/pages/bills/order_online/modals/Show.tsx
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
import {
|
||||||
|
MyBetaModalFormProps,
|
||||||
|
MyColumns,
|
||||||
|
MyProTableProps,
|
||||||
|
renderTextHelper,
|
||||||
|
} from '@/common';
|
||||||
|
import { MyModal } from '@/components/MyModal';
|
||||||
|
|
||||||
|
import {
|
||||||
|
HouseBillsTypeEnum,
|
||||||
|
HouseOrdersAuditStatusEnum,
|
||||||
|
HouseOrdersPaymentMethodEnum,
|
||||||
|
} from '@/gen/Enums';
|
||||||
|
import { ProCard, ProDescriptions, ProTable } from '@ant-design/pro-components';
|
||||||
|
import { Space } from 'antd';
|
||||||
|
|
||||||
|
export default function Show(props: MyBetaModalFormProps) {
|
||||||
|
return (
|
||||||
|
<MyModal
|
||||||
|
title={props.title || '查看'}
|
||||||
|
width={800}
|
||||||
|
// onOpen={() => getShow()}
|
||||||
|
node={
|
||||||
|
<Space direction="vertical" style={{ width: '100%' }}>
|
||||||
|
<ProCard size="small">
|
||||||
|
<ProDescriptions bordered size="small" column={2}>
|
||||||
|
<ProDescriptions.Item label="房屋名称" span={2}>
|
||||||
|
<Space>
|
||||||
|
{props?.item?.house_order_items?.[0].asset_house?.full_name ||
|
||||||
|
'-'}
|
||||||
|
<renderTextHelper.Tag
|
||||||
|
Enums={HouseOrdersAuditStatusEnum}
|
||||||
|
value={props?.item?.audit_status}
|
||||||
|
/>
|
||||||
|
</Space>
|
||||||
|
</ProDescriptions.Item>
|
||||||
|
<ProDescriptions.Item label="收款账号" span={2}>
|
||||||
|
{props?.item?.receipt_account?.company_name} ;
|
||||||
|
{props?.item?.receipt_account?.company_bank} ;
|
||||||
|
{props?.item?.receipt_account?.company_account}
|
||||||
|
</ProDescriptions.Item>
|
||||||
|
<ProDescriptions.Item label="关联流水" span={2}>
|
||||||
|
{props?.item?.accept_serial_number || '-'}
|
||||||
|
</ProDescriptions.Item>
|
||||||
|
<ProDescriptions.Item label="收款方式">
|
||||||
|
{Object.values(HouseOrdersPaymentMethodEnum).find(
|
||||||
|
(item) => item.value === props?.item?.payment_method,
|
||||||
|
)?.text || '-'}
|
||||||
|
</ProDescriptions.Item>
|
||||||
|
<ProDescriptions.Item label="收款日期">
|
||||||
|
{props?.item?.paid_time || '-'}
|
||||||
|
</ProDescriptions.Item>
|
||||||
|
|
||||||
|
<ProDescriptions.Item label="收款金额">
|
||||||
|
{props?.item?.actual_paid_amount || '-'}
|
||||||
|
</ProDescriptions.Item>
|
||||||
|
<ProDescriptions.Item label="录入人">
|
||||||
|
{props?.item?.creator || '-'}-
|
||||||
|
{props?.item?.creator_phone || '-'}
|
||||||
|
</ProDescriptions.Item>
|
||||||
|
<ProDescriptions.Item label="录入时间">
|
||||||
|
{props?.item?.created_at || '-'}
|
||||||
|
</ProDescriptions.Item>
|
||||||
|
<ProDescriptions.Item label="审核状态" span={2}>
|
||||||
|
<renderTextHelper.Tag
|
||||||
|
Enums={HouseOrdersAuditStatusEnum}
|
||||||
|
value={props?.item?.audit_status}
|
||||||
|
/>
|
||||||
|
</ProDescriptions.Item>
|
||||||
|
<ProDescriptions.Item label="驳回原因" span={2}>
|
||||||
|
{props?.item?.reason || '-'}
|
||||||
|
</ProDescriptions.Item>
|
||||||
|
</ProDescriptions>
|
||||||
|
</ProCard>
|
||||||
|
<ProCard size="small">
|
||||||
|
<ProTable
|
||||||
|
{...MyProTableProps.props}
|
||||||
|
search={false}
|
||||||
|
toolBarRender={false}
|
||||||
|
pagination={false}
|
||||||
|
dataSource={props?.item?.house_order_items}
|
||||||
|
rowKey={(record, index) => record?.id || index}
|
||||||
|
size="small"
|
||||||
|
columns={[
|
||||||
|
{
|
||||||
|
title: '关联账单',
|
||||||
|
render: (_, record) => {
|
||||||
|
return `${record.house_bill.year}-${String(
|
||||||
|
record.house_bill.month,
|
||||||
|
).padStart(2, '0')}`;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
MyColumns.EnumTag({
|
||||||
|
title: '类型',
|
||||||
|
dataIndex: ['house_bill', 'type'],
|
||||||
|
valueEnum: HouseBillsTypeEnum,
|
||||||
|
}),
|
||||||
|
{
|
||||||
|
title: '未收金额',
|
||||||
|
dataIndex: 'amount',
|
||||||
|
search: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '本次收取金额',
|
||||||
|
dataIndex: 'paid_amount',
|
||||||
|
search: false,
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</ProCard>
|
||||||
|
</Space>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -45,7 +45,7 @@ export default function CreatePropertyFee(props: MyBetaModalFormProps) {
|
|||||||
Apis.HouseCharge.HouseChargeStandards.Store({
|
Apis.HouseCharge.HouseChargeStandards.Store({
|
||||||
...values,
|
...values,
|
||||||
charge_type: HouseBillsTypeEnum.CarPortFee.value,
|
charge_type: HouseBillsTypeEnum.CarPortFee.value,
|
||||||
type: 'House',
|
type: 'CarPort',
|
||||||
is_apportionment:
|
is_apportionment:
|
||||||
values.charge_type === HouseBillsTypeEnum.SharedWaterFee.value ||
|
values.charge_type === HouseBillsTypeEnum.SharedWaterFee.value ||
|
||||||
values.charge_type === HouseBillsTypeEnum.SharedElectricityFee.value
|
values.charge_type === HouseBillsTypeEnum.SharedElectricityFee.value
|
||||||
|
|||||||
@ -39,15 +39,15 @@ export default function TaskShow(props: MyBetaModalFormProps) {
|
|||||||
{
|
{
|
||||||
title: '关联房屋',
|
title: '关联房屋',
|
||||||
dataIndex: 'full_name',
|
dataIndex: 'full_name',
|
||||||
render: (_, record) => (
|
// render: (_, record) => (
|
||||||
<MyButtons.View
|
// <MyButtons.View
|
||||||
title={record.full_name}
|
// title={record.full_name}
|
||||||
type="link"
|
// type="link"
|
||||||
onClick={() => {
|
// onClick={() => {
|
||||||
navigate(`/bills/summary/show/${record.asset_houses_id}`);
|
// navigate(`/bills/summary/show/${record.asset_houses_id}`);
|
||||||
}}
|
// }}
|
||||||
/>
|
// />
|
||||||
),
|
// ),
|
||||||
search: { transform: (value) => ({ full_name: value }) },
|
search: { transform: (value) => ({ full_name: value }) },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -7,11 +7,10 @@ import {
|
|||||||
useCurrentPermissions,
|
useCurrentPermissions,
|
||||||
} from '@/common';
|
} from '@/common';
|
||||||
import { Apis } from '@/gen/Apis';
|
import { Apis } from '@/gen/Apis';
|
||||||
import { CompanyEmployeesTypeEnum } from '@/gen/Enums';
|
|
||||||
import { ProTable } from '@ant-design/pro-components';
|
import { ProTable } from '@ant-design/pro-components';
|
||||||
import { Dropdown, Space } from 'antd';
|
import { Dropdown, Space } from 'antd';
|
||||||
import Change from './modals/Change';
|
import Change from './modals/Change';
|
||||||
import CompletePhone from './modals/CompletePhone';
|
|
||||||
import EmployeeCreate from './modals/EmployeeCreate';
|
import EmployeeCreate from './modals/EmployeeCreate';
|
||||||
import EmployeeUpdate from './modals/EmployeeUpdate';
|
import EmployeeUpdate from './modals/EmployeeUpdate';
|
||||||
import Role from './modals/Role';
|
import Role from './modals/Role';
|
||||||
@ -41,14 +40,14 @@ export default function Index({ title = '员工管理' }) {
|
|||||||
key: '2',
|
key: '2',
|
||||||
label: (
|
label: (
|
||||||
<MyButtons.Default
|
<MyButtons.Default
|
||||||
title="重置密码"
|
title="重置"
|
||||||
type="default"
|
type="default"
|
||||||
isConfirm={true}
|
isConfirm={true}
|
||||||
description={`确定要重置用户「${item.name}」的密码为「Gc#123」吗?`}
|
description={`确定要重置用户「${item.name}」的密码为「12345678」吗?`}
|
||||||
onConfirm={() =>
|
onConfirm={() =>
|
||||||
Apis.Company.CompanyEmployees.ResetPassword({
|
Apis.Company.CompanyEmployees.ResetPassword({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
password: 'Gc#123',
|
password: '12345678',
|
||||||
}).then(() => action?.reload())
|
}).then(() => action?.reload())
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@ -92,14 +91,7 @@ export default function Index({ title = '员工管理' }) {
|
|||||||
Apis.Company.CompanyEmployees.List,
|
Apis.Company.CompanyEmployees.List,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
toolBarRender={(action) => [
|
toolBarRender={(action) => [toolBarRender(action)]}
|
||||||
<CompletePhone
|
|
||||||
key="CompletePhone"
|
|
||||||
reload={action?.reload}
|
|
||||||
title="补全手机号"
|
|
||||||
/>,
|
|
||||||
toolBarRender(action),
|
|
||||||
]}
|
|
||||||
columns={[
|
columns={[
|
||||||
MyColumns.ID({
|
MyColumns.ID({
|
||||||
search: false,
|
search: false,
|
||||||
@ -121,32 +113,33 @@ export default function Index({ title = '员工管理' }) {
|
|||||||
title: '手机号',
|
title: '手机号',
|
||||||
dataIndex: 'phone',
|
dataIndex: 'phone',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: '角色',
|
|
||||||
dataIndex: 'roles',
|
|
||||||
renderText: renderTextHelper.TagList,
|
|
||||||
hideInSearch: true,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: '岗位',
|
title: '岗位',
|
||||||
dataIndex: ['position', 'name'],
|
dataIndex: ['position', 'name'],
|
||||||
search: false,
|
search: false,
|
||||||
},
|
},
|
||||||
MyColumns.EnumTag({
|
{
|
||||||
title: '来源',
|
title: '系统角色',
|
||||||
dataIndex: 'type',
|
dataIndex: 'roles',
|
||||||
valueEnum: CompanyEmployeesTypeEnum,
|
renderText: renderTextHelper.TagList,
|
||||||
}),
|
hideInSearch: true,
|
||||||
MyColumns.SoftDelete({
|
},
|
||||||
title: '启/禁用',
|
|
||||||
onRestore: Apis.Company.CompanyEmployees.Restore,
|
// MyColumns.EnumTag({
|
||||||
onSoftDelete: Apis.Company.CompanyEmployees.SoftDelete,
|
// title: '来源',
|
||||||
search: false,
|
// dataIndex: 'type',
|
||||||
setPermissions: getCurrentPermissions({
|
// // valueEnum: CompanyEmployeesTypeEnum,
|
||||||
enableDisable: true,
|
// }),
|
||||||
}),
|
// MyColumns.SoftDelete({
|
||||||
}),
|
// title: '启/禁用',
|
||||||
MyColumns.UpdatedAt(),
|
// onRestore: Apis.Company.CompanyEmployees.Restore,
|
||||||
|
// onSoftDelete: Apis.Company.CompanyEmployees.SoftDelete,
|
||||||
|
// search: false,
|
||||||
|
// setPermissions: getCurrentPermissions({
|
||||||
|
// enableDisable: true,
|
||||||
|
// }),
|
||||||
|
// }),
|
||||||
|
// MyColumns.UpdatedAt(),
|
||||||
// MyColumns.CreatedAt(),
|
// MyColumns.CreatedAt(),
|
||||||
MyColumns.Option({
|
MyColumns.Option({
|
||||||
render: (_, item: any, index, action) => (
|
render: (_, item: any, index, action) => (
|
||||||
|
|||||||
@ -1,99 +0,0 @@
|
|||||||
import { MyBetaModalFormProps, MyButtons, MyModalFormProps } from '@/common';
|
|
||||||
import { Apis } from '@/gen/Apis';
|
|
||||||
import { BetaSchemaForm } from '@ant-design/pro-components';
|
|
||||||
import { Form, message } from 'antd';
|
|
||||||
|
|
||||||
export default function CompletePhone(props: MyBetaModalFormProps) {
|
|
||||||
const [form] = Form.useForm();
|
|
||||||
|
|
||||||
// 验证多行手机号
|
|
||||||
const validatePhones = (_: any, value?: string) => {
|
|
||||||
if (!value || !value.trim()) {
|
|
||||||
return Promise.reject('请输入手机号');
|
|
||||||
}
|
|
||||||
|
|
||||||
const phones = value.trim().split(/\r?\n/).filter(Boolean);
|
|
||||||
if (phones.length === 0) {
|
|
||||||
return Promise.reject('请输入至少一个手机号');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (phones.length > 20000) {
|
|
||||||
return Promise.reject('最多支持20000条数据');
|
|
||||||
}
|
|
||||||
|
|
||||||
const phoneRegex = /^1[3-9]\d{9}$/;
|
|
||||||
const invalidPhones = phones.filter((phone) => !phoneRegex.test(phone));
|
|
||||||
|
|
||||||
if (invalidPhones.length > 0) {
|
|
||||||
return Promise.reject(
|
|
||||||
`手机号格式不正确:${invalidPhones.slice(0, 3).join(', ')}${
|
|
||||||
invalidPhones.length > 3 ? '...等' : ''
|
|
||||||
}`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Promise.resolve();
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<BetaSchemaForm
|
|
||||||
{...MyModalFormProps.props}
|
|
||||||
title="批量补全手机号"
|
|
||||||
trigger={
|
|
||||||
<MyButtons.Default
|
|
||||||
title="批量补全手机号"
|
|
||||||
type="primary"
|
|
||||||
size="middle"
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
wrapperCol={{ span: 24 }}
|
|
||||||
width={600}
|
|
||||||
key={new Date().getTime()}
|
|
||||||
form={form}
|
|
||||||
onOpenChange={(open: boolean) => {
|
|
||||||
if (open) {
|
|
||||||
form.resetFields();
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
onFinish={async (values: any) => {
|
|
||||||
try {
|
|
||||||
// 按换行分割手机号并过滤空值
|
|
||||||
const phoneArray = values.phoneInput
|
|
||||||
.trim()
|
|
||||||
.split(/\r?\n/)
|
|
||||||
.filter(Boolean);
|
|
||||||
|
|
||||||
// 提交多行手机号
|
|
||||||
await Apis.Company.CompanyEmployees.CompletePhone({
|
|
||||||
phone: phoneArray,
|
|
||||||
});
|
|
||||||
|
|
||||||
props.reload?.();
|
|
||||||
message.success('手机号补全成功');
|
|
||||||
return true;
|
|
||||||
} catch (error) {
|
|
||||||
console.error('补全手机号失败:', error);
|
|
||||||
message.error('补全手机号失败,请重试');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
columns={[
|
|
||||||
{
|
|
||||||
key: 'phoneInput',
|
|
||||||
title:
|
|
||||||
'请在输入框里粘贴手机号。每行一个值,不超过2000条(excel中的数据,可直接复制/粘贴)',
|
|
||||||
valueType: 'textarea',
|
|
||||||
fieldProps: {
|
|
||||||
placeholder: '请输入手机号,多个【按回车键】换行隔开',
|
|
||||||
autoSize: { minRows: 8, maxRows: 12 },
|
|
||||||
style: { resize: 'vertical' },
|
|
||||||
},
|
|
||||||
colProps: { span: 24 },
|
|
||||||
formItemProps: {
|
|
||||||
rules: [{ validator: validatePhones }],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -8,7 +8,7 @@ import {
|
|||||||
import { Selects } from '@/components/Select';
|
import { Selects } from '@/components/Select';
|
||||||
import { SysSelects } from '@/components/SysSelects';
|
import { SysSelects } from '@/components/SysSelects';
|
||||||
import { Apis } from '@/gen/Apis';
|
import { Apis } from '@/gen/Apis';
|
||||||
import { CompanyEmployeesTypeEnum, SexEnum } from '@/gen/Enums';
|
import { SexEnum } from '@/gen/Enums';
|
||||||
import { BetaSchemaForm } from '@ant-design/pro-components';
|
import { BetaSchemaForm } from '@ant-design/pro-components';
|
||||||
import { Form, message } from 'antd';
|
import { Form, message } from 'antd';
|
||||||
|
|
||||||
@ -35,8 +35,8 @@ export default function Create(props: MyBetaModalFormProps) {
|
|||||||
Apis.Company.CompanyEmployees.Store({
|
Apis.Company.CompanyEmployees.Store({
|
||||||
...values,
|
...values,
|
||||||
companies_id: values?.companies_id || props?.item?.id,
|
companies_id: values?.companies_id || props?.item?.id,
|
||||||
type: CompanyEmployeesTypeEnum.External.value,
|
// type: CompanyEmployeesTypeEnum.External.value,
|
||||||
password: 'Gc#123',
|
password: '12345678',
|
||||||
organizations_id:
|
organizations_id:
|
||||||
values?.organizations_id?.[values.organizations_id.length - 1],
|
values?.organizations_id?.[values.organizations_id.length - 1],
|
||||||
})
|
})
|
||||||
|
|||||||
@ -15,7 +15,7 @@ export default function Update(props: MyBetaModalFormProps) {
|
|||||||
<BetaSchemaForm<ApiTypes.Company.CompanyEmployees.Update>
|
<BetaSchemaForm<ApiTypes.Company.CompanyEmployees.Update>
|
||||||
{...MyModalFormProps.props}
|
{...MyModalFormProps.props}
|
||||||
title={`角色调整`}
|
title={`角色调整`}
|
||||||
trigger={<MyButtons.Default title="角色调整" type="primary" />}
|
trigger={<MyButtons.Default title="角色" type="primary" />}
|
||||||
wrapperCol={{ span: 24 }}
|
wrapperCol={{ span: 24 }}
|
||||||
width="500px"
|
width="500px"
|
||||||
key={new Date().getTime()}
|
key={new Date().getTime()}
|
||||||
|
|||||||
@ -5,10 +5,6 @@ import {
|
|||||||
MyProTableProps,
|
MyProTableProps,
|
||||||
} from '@/common';
|
} from '@/common';
|
||||||
import { Apis } from '@/gen/Apis';
|
import { Apis } from '@/gen/Apis';
|
||||||
import {
|
|
||||||
GoodsReleasesAuditStatusEnum,
|
|
||||||
GoodsReleasesPassedTypeEnum,
|
|
||||||
} from '@/gen/Enums';
|
|
||||||
import { ProTable } from '@ant-design/pro-components';
|
import { ProTable } from '@ant-design/pro-components';
|
||||||
import { useNavigate } from '@umijs/max';
|
import { useNavigate } from '@umijs/max';
|
||||||
import { Space, Tooltip } from 'antd';
|
import { Space, Tooltip } from 'antd';
|
||||||
@ -51,7 +47,7 @@ export default function Index({ title = '物品放行' }) {
|
|||||||
MyColumns.EnumTag({
|
MyColumns.EnumTag({
|
||||||
title: '申请状态',
|
title: '申请状态',
|
||||||
dataIndex: 'status',
|
dataIndex: 'status',
|
||||||
valueEnum: GoodsReleasesAuditStatusEnum,
|
// valueEnum: GoodsReleasesAuditStatusEnum,
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
title: '房屋',
|
title: '房屋',
|
||||||
@ -71,7 +67,7 @@ export default function Index({ title = '物品放行' }) {
|
|||||||
MyColumns.EnumTag({
|
MyColumns.EnumTag({
|
||||||
title: '通行类型',
|
title: '通行类型',
|
||||||
dataIndex: 'passed_type',
|
dataIndex: 'passed_type',
|
||||||
valueEnum: GoodsReleasesPassedTypeEnum,
|
// valueEnum: GoodsReleasesPassedTypeEnum,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -163,10 +159,11 @@ export default function Index({ title = '物品放行' }) {
|
|||||||
MyColumns.Option({
|
MyColumns.Option({
|
||||||
render: (_, item: any, index, action) => (
|
render: (_, item: any, index, action) => (
|
||||||
<Space key={index}>
|
<Space key={index}>
|
||||||
{item?.status ===
|
{/* {item?.status ===
|
||||||
GoodsReleasesAuditStatusEnum.Pending.value && (
|
GoodsReleasesAuditStatusEnum.Pending.value && (
|
||||||
<Audit item={item} reload={action?.reload} title={title} />
|
<Audit item={item} reload={action?.reload} title={title} />
|
||||||
)}
|
)} */}
|
||||||
|
<Audit item={item} reload={action?.reload} title={title} />
|
||||||
<MyButtons.Default
|
<MyButtons.Default
|
||||||
key="Create"
|
key="Create"
|
||||||
size="small"
|
size="small"
|
||||||
|
|||||||
@ -1,14 +1,11 @@
|
|||||||
import {
|
import {
|
||||||
MyBetaModalFormProps,
|
MyBetaModalFormProps,
|
||||||
MyButtons,
|
MyButtons,
|
||||||
MyFormItems,
|
|
||||||
MyModalFormProps,
|
MyModalFormProps,
|
||||||
MyProTableProps,
|
MyProTableProps,
|
||||||
renderTextHelper,
|
|
||||||
rulesHelper,
|
rulesHelper,
|
||||||
} from '@/common';
|
} from '@/common';
|
||||||
import { Apis } from '@/gen/Apis';
|
import { Apis } from '@/gen/Apis';
|
||||||
import { GoodsReleasesPassedTypeEnum } from '@/gen/Enums';
|
|
||||||
import {
|
import {
|
||||||
BetaSchemaForm,
|
BetaSchemaForm,
|
||||||
ProCard,
|
ProCard,
|
||||||
@ -71,12 +68,12 @@ export default function Update(props: MyBetaModalFormProps) {
|
|||||||
<ProDescriptions.Item label="申请时间">
|
<ProDescriptions.Item label="申请时间">
|
||||||
{props?.item?.created_at || '-'}
|
{props?.item?.created_at || '-'}
|
||||||
</ProDescriptions.Item>
|
</ProDescriptions.Item>
|
||||||
<ProDescriptions.Item label="当前状态">
|
{/* <ProDescriptions.Item label="当前状态">
|
||||||
<renderTextHelper.Tag
|
<renderTextHelper.Tag
|
||||||
Enums={GoodsReleasesPassedTypeEnum}
|
Enums={GoodsReleasesPassedTypeEnum}
|
||||||
value={props?.item?.status}
|
value={props?.item?.status}
|
||||||
/>
|
/>
|
||||||
</ProDescriptions.Item>
|
</ProDescriptions.Item> */}
|
||||||
</ProDescriptions>
|
</ProDescriptions>
|
||||||
</ProCard>
|
</ProCard>
|
||||||
|
|
||||||
@ -114,19 +111,19 @@ export default function Update(props: MyBetaModalFormProps) {
|
|||||||
{
|
{
|
||||||
valueType: 'group',
|
valueType: 'group',
|
||||||
columns: [
|
columns: [
|
||||||
MyFormItems.EnumRadio({
|
// MyFormItems.EnumRadio({
|
||||||
key: 'status',
|
// key: 'status',
|
||||||
title: '审核操作',
|
// title: '审核操作',
|
||||||
colProps: { span: 24 },
|
// colProps: { span: 24 },
|
||||||
valueEnum: () => {
|
// valueEnum: () => {
|
||||||
let obj: any = JSON.parse(
|
// let obj: any = JSON.parse(
|
||||||
JSON.stringify(GoodsReleasesPassedTypeEnum),
|
// JSON.stringify(GoodsReleasesPassedTypeEnum),
|
||||||
);
|
// );
|
||||||
delete obj.Pending;
|
// delete obj.Pending;
|
||||||
return obj;
|
// return obj;
|
||||||
},
|
// },
|
||||||
required: true,
|
// required: true,
|
||||||
}),
|
// }),
|
||||||
{
|
{
|
||||||
valueType: 'dependency',
|
valueType: 'dependency',
|
||||||
name: ['status'],
|
name: ['status'],
|
||||||
|
|||||||
@ -6,7 +6,6 @@ import {
|
|||||||
} from '@/common';
|
} from '@/common';
|
||||||
import MyModalsHouseSelectList from '@/components/ModalsHouseSelectList';
|
import MyModalsHouseSelectList from '@/components/ModalsHouseSelectList';
|
||||||
import { Apis } from '@/gen/Apis';
|
import { Apis } from '@/gen/Apis';
|
||||||
import { GoodsReleasesPassedTypeEnum } from '@/gen/Enums';
|
|
||||||
import { BetaSchemaForm, ProCard } from '@ant-design/pro-components';
|
import { BetaSchemaForm, ProCard } from '@ant-design/pro-components';
|
||||||
import { useNavigate } from '@umijs/max';
|
import { useNavigate } from '@umijs/max';
|
||||||
import { Form, message, Space } from 'antd';
|
import { Form, message, Space } from 'antd';
|
||||||
@ -99,8 +98,8 @@ export default function Index({ title = '物品放行申请' }) {
|
|||||||
},
|
},
|
||||||
MyFormItems.EnumRadio({
|
MyFormItems.EnumRadio({
|
||||||
key: 'passed_type',
|
key: 'passed_type',
|
||||||
title: '装修类型',
|
title: '通行类型',
|
||||||
valueEnum: GoodsReleasesPassedTypeEnum,
|
// valueEnum: GoodsReleasesPassedTypeEnum,
|
||||||
colProps: { span: 6 },
|
colProps: { span: 6 },
|
||||||
formItemProps: { ...rulesHelper.text },
|
formItemProps: { ...rulesHelper.text },
|
||||||
}),
|
}),
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import {
|
|||||||
rulesHelper,
|
rulesHelper,
|
||||||
} from '@/common';
|
} from '@/common';
|
||||||
import { Apis } from '@/gen/Apis';
|
import { Apis } from '@/gen/Apis';
|
||||||
import { GoodsReleasesPassedTypeEnum } from '@/gen/Enums';
|
|
||||||
import { BetaSchemaForm, ProCard } from '@ant-design/pro-components';
|
import { BetaSchemaForm, ProCard } from '@ant-design/pro-components';
|
||||||
import { useNavigate, useSearchParams } from '@umijs/max';
|
import { useNavigate, useSearchParams } from '@umijs/max';
|
||||||
import { Form, Space } from 'antd';
|
import { Form, Space } from 'antd';
|
||||||
@ -96,7 +95,7 @@ export default function Index({ title = '物品放行审核' }) {
|
|||||||
MyFormItems.EnumRadio({
|
MyFormItems.EnumRadio({
|
||||||
key: 'passed_type',
|
key: 'passed_type',
|
||||||
title: '装修类型',
|
title: '装修类型',
|
||||||
valueEnum: GoodsReleasesPassedTypeEnum,
|
// valueEnum: GoodsReleasesPassedTypeEnum,
|
||||||
colProps: { span: 8 },
|
colProps: { span: 8 },
|
||||||
formItemProps: { ...rulesHelper.text },
|
formItemProps: { ...rulesHelper.text },
|
||||||
}),
|
}),
|
||||||
|
|||||||
@ -1,73 +0,0 @@
|
|||||||
import {
|
|
||||||
MyButtons,
|
|
||||||
MyColumns,
|
|
||||||
MyProTableProps,
|
|
||||||
useCurrentPermissions,
|
|
||||||
} from '@/common';
|
|
||||||
import { Apis } from '@/gen/Apis';
|
|
||||||
import { ProTable } from '@ant-design/pro-components';
|
|
||||||
import { Space } from 'antd';
|
|
||||||
import Create from '../modals/QuestionCategoriesCreate';
|
|
||||||
import Update from '../modals/QuestionCategoriesUpdate';
|
|
||||||
|
|
||||||
export default function QuestionCategoriesList({ title = '题目分类' }) {
|
|
||||||
const getCurrentPermissions = useCurrentPermissions();
|
|
||||||
let toolBarRender = (action: any) => {
|
|
||||||
return getCurrentPermissions(
|
|
||||||
{
|
|
||||||
add: <Create key="Create" reload={action?.reload} title={title} />,
|
|
||||||
},
|
|
||||||
'MyQuestionCategoriesList',
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
let tableRender = (item: any, action: any) => {
|
|
||||||
return getCurrentPermissions(
|
|
||||||
{
|
|
||||||
update: <Update item={item} reload={action?.reload} title={title} />,
|
|
||||||
delete: (
|
|
||||||
<MyButtons.Delete
|
|
||||||
onConfirm={() =>
|
|
||||||
Apis.Survey.QuestionCategories.Delete({ id: item.id }).then(() =>
|
|
||||||
action?.reload(),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
'MyQuestionCategoriesList',
|
|
||||||
);
|
|
||||||
};
|
|
||||||
return (
|
|
||||||
<ProTable
|
|
||||||
{...MyProTableProps.props}
|
|
||||||
search={false}
|
|
||||||
headerTitle="分类列表"
|
|
||||||
request={async (params, sort) =>
|
|
||||||
MyProTableProps.request(
|
|
||||||
params,
|
|
||||||
sort,
|
|
||||||
Apis.Survey.QuestionCategories.List,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
toolBarRender={(action) => [toolBarRender(action)]}
|
|
||||||
columns={[
|
|
||||||
MyColumns.ID({
|
|
||||||
search: false,
|
|
||||||
}),
|
|
||||||
{ dataIndex: 'name', title: '名称' },
|
|
||||||
{ dataIndex: 'description', title: '描述' },
|
|
||||||
MyColumns.Boolean({ dataIndex: 'is_enabled', title: '是否启用' }),
|
|
||||||
MyColumns.Option({
|
|
||||||
width: 120,
|
|
||||||
|
|
||||||
render: (_, item: any, index, action) => (
|
|
||||||
<Space key={`item_${index}`}>
|
|
||||||
<>{tableRender(item, action)}</>
|
|
||||||
</Space>
|
|
||||||
),
|
|
||||||
}),
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,80 +0,0 @@
|
|||||||
import {
|
|
||||||
MyButtons,
|
|
||||||
MyColumns,
|
|
||||||
MyProTableProps,
|
|
||||||
useCurrentPermissions,
|
|
||||||
} from '@/common';
|
|
||||||
import { Apis } from '@/gen/Apis';
|
|
||||||
import { QuestionsTypeEnum } from '@/gen/Enums';
|
|
||||||
import { ProTable } from '@ant-design/pro-components';
|
|
||||||
import { Space } from 'antd';
|
|
||||||
import Create from '../modals/QuestionsCreate';
|
|
||||||
import Update from '../modals/QuestionsUpdate';
|
|
||||||
|
|
||||||
export default function QuestionsList({ title = '题目' }) {
|
|
||||||
const getCurrentPermissions = useCurrentPermissions();
|
|
||||||
let toolBarRender = (action: any) => {
|
|
||||||
return getCurrentPermissions(
|
|
||||||
{
|
|
||||||
add: <Create key="Create" reload={action?.reload} title={title} />,
|
|
||||||
},
|
|
||||||
'MyQuestionsList',
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
let tableRender = (item: any, action: any) => {
|
|
||||||
return (
|
|
||||||
getCurrentPermissions({
|
|
||||||
update: <Update item={item} reload={action?.reload} title={title} />,
|
|
||||||
delete: (
|
|
||||||
<MyButtons.Delete
|
|
||||||
onConfirm={() =>
|
|
||||||
Apis.Survey.Questions.Delete({ id: item.id }).then(() =>
|
|
||||||
action?.reload(),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
}),
|
|
||||||
'MyQuestionsList'
|
|
||||||
);
|
|
||||||
};
|
|
||||||
return (
|
|
||||||
<ProTable
|
|
||||||
{...MyProTableProps.props}
|
|
||||||
headerTitle={`${title}列表`}
|
|
||||||
request={async (params, sort) =>
|
|
||||||
MyProTableProps.request(params, sort, Apis.Survey.Questions.List)
|
|
||||||
}
|
|
||||||
toolBarRender={(action) => [toolBarRender(action)]}
|
|
||||||
columns={[
|
|
||||||
MyColumns.ID({
|
|
||||||
search: false,
|
|
||||||
}),
|
|
||||||
{ dataIndex: 'title', title: '题目' },
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
title: '类型',
|
|
||||||
dataIndex: 'type',
|
|
||||||
valueEnum: QuestionsTypeEnum,
|
|
||||||
}),
|
|
||||||
{ dataIndex: 'placeholder', title: '提示', search: false },
|
|
||||||
MyColumns.Boolean({
|
|
||||||
dataIndex: 'required',
|
|
||||||
title: '是否必答',
|
|
||||||
search: false,
|
|
||||||
}),
|
|
||||||
MyColumns.Boolean({
|
|
||||||
dataIndex: 'is_enabled',
|
|
||||||
title: '是否启用',
|
|
||||||
search: false,
|
|
||||||
}),
|
|
||||||
MyColumns.Option({
|
|
||||||
width: 120,
|
|
||||||
render: (_, item: any, index, action) => (
|
|
||||||
<Space key={`item_${index}`}>{tableRender(item, action)}</Space>
|
|
||||||
),
|
|
||||||
}),
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,113 +0,0 @@
|
|||||||
import {
|
|
||||||
MyButtons,
|
|
||||||
MyColumns,
|
|
||||||
MyProTableProps,
|
|
||||||
useCurrentPermissions,
|
|
||||||
} from '@/common';
|
|
||||||
import { isInTimeRange } from '@/common/utils/day';
|
|
||||||
import { Apis } from '@/gen/Apis';
|
|
||||||
import { SurveyReleasesTypeEnum } from '@/gen/Enums';
|
|
||||||
import { ProTable } from '@ant-design/pro-components';
|
|
||||||
import { Space } from 'antd';
|
|
||||||
import Create from '../modals/SurveyReleasesCreate';
|
|
||||||
import Update from '../modals/SurveyReleasesUpdate';
|
|
||||||
|
|
||||||
export default function SurveyReleasesList({ title = '问卷发布列表' }) {
|
|
||||||
const getCurrentPermissions = useCurrentPermissions();
|
|
||||||
let toolBarRender = (action: any) => {
|
|
||||||
return getCurrentPermissions(
|
|
||||||
{
|
|
||||||
add: <Create key="Create" reload={action?.reload} title="发布" />,
|
|
||||||
},
|
|
||||||
'MySurveyReleasesList',
|
|
||||||
);
|
|
||||||
};
|
|
||||||
let tableRender = (item: any, action: any) => {
|
|
||||||
return getCurrentPermissions(
|
|
||||||
{
|
|
||||||
publish: (
|
|
||||||
<MyButtons.Default
|
|
||||||
isConfirm
|
|
||||||
title="立即发布"
|
|
||||||
description="确定要发布?"
|
|
||||||
disabled={item?.release_type !== 'Manual' || item.status}
|
|
||||||
onConfirm={() =>
|
|
||||||
Apis.Survey.SurveyReleases.Publish({ id: item.id }).then(() =>
|
|
||||||
action?.reload(),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
cancel: (
|
|
||||||
<MyButtons.Default
|
|
||||||
isConfirm
|
|
||||||
title="下架"
|
|
||||||
description="确定要下架问卷?"
|
|
||||||
disabled={
|
|
||||||
!item.status && !isInTimeRange(item?.start_date, item?.end_date)
|
|
||||||
}
|
|
||||||
onConfirm={() =>
|
|
||||||
Apis.Survey.SurveyReleases.Cancel({ id: item.id }).then(() =>
|
|
||||||
action?.reload(),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
update: <Update item={item} reload={action?.reload} title={title} />,
|
|
||||||
delete: (
|
|
||||||
<MyButtons.Delete
|
|
||||||
onConfirm={() =>
|
|
||||||
Apis.Survey.SurveyReleases.Delete({ id: item.id }).then(() =>
|
|
||||||
action?.reload(),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
'MySurveyReleasesList',
|
|
||||||
);
|
|
||||||
};
|
|
||||||
return (
|
|
||||||
<ProTable
|
|
||||||
{...MyProTableProps.props}
|
|
||||||
headerTitle={`${title}`}
|
|
||||||
request={async (params, sort) =>
|
|
||||||
MyProTableProps.request(params, sort, Apis.Survey.SurveyReleases.List)
|
|
||||||
}
|
|
||||||
toolBarRender={(action) => [toolBarRender(action)]}
|
|
||||||
columns={[
|
|
||||||
MyColumns.ID({
|
|
||||||
search: false,
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
title: '问卷ID',
|
|
||||||
hidden: true,
|
|
||||||
dataIndex: 'surveys_id',
|
|
||||||
// search: {
|
|
||||||
// transform: (value) => {
|
|
||||||
// return { surveys_id: value };
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
},
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
title: '方式',
|
|
||||||
dataIndex: 'release_type',
|
|
||||||
valueEnum: SurveyReleasesTypeEnum,
|
|
||||||
}),
|
|
||||||
MyColumns.Boolean({
|
|
||||||
title: '是否发布',
|
|
||||||
dataIndex: 'status',
|
|
||||||
}),
|
|
||||||
{ dataIndex: ['survey', 'name'], title: '发布的问卷', search: false },
|
|
||||||
{ dataIndex: 'start_date', title: '开始时间', search: false },
|
|
||||||
{ dataIndex: 'end_date', title: '结束时间', search: false },
|
|
||||||
MyColumns.CreatedAt(),
|
|
||||||
MyColumns.Option({
|
|
||||||
render: (_, item: any, index, action) => (
|
|
||||||
<Space key={`item_${index}`}>{tableRender(item, action)}</Space>
|
|
||||||
),
|
|
||||||
}),
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,39 +0,0 @@
|
|||||||
import { MyColumns, MyProTableProps } from '@/common';
|
|
||||||
import { Apis } from '@/gen/Apis';
|
|
||||||
import { ProTable } from '@ant-design/pro-components';
|
|
||||||
import MyShow from '../modals/SurveyResponsesShow';
|
|
||||||
export default function SurveyResponsesList({ title = '问卷回收' }) {
|
|
||||||
return (
|
|
||||||
<ProTable
|
|
||||||
{...MyProTableProps.props}
|
|
||||||
headerTitle={`${title}`}
|
|
||||||
request={async (params, sort) =>
|
|
||||||
MyProTableProps.request(params, sort, Apis.Survey.SurveyResponses.List)
|
|
||||||
}
|
|
||||||
columns={[
|
|
||||||
MyColumns.ID({
|
|
||||||
search: false,
|
|
||||||
}),
|
|
||||||
{ dataIndex: ['survey', 'name'], title: '问卷', search: false },
|
|
||||||
{ dataIndex: 'survey_id', title: '问卷ID', hidden: true },
|
|
||||||
{ dataIndex: 'release_id', title: '发布ID', hidden: true },
|
|
||||||
{ dataIndex: 'customers_id', title: '客户ID', hidden: true },
|
|
||||||
{ dataIndex: 'customer_phone', title: '客户手机号', hidden: true },
|
|
||||||
{
|
|
||||||
dataIndex: 'customer',
|
|
||||||
title: '回答客户',
|
|
||||||
search: false,
|
|
||||||
render: (_, item: any) => {
|
|
||||||
return `${item?.customer?.phone}_${item?.customer?.name}`;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ dataIndex: 'total_score', title: '总得分', search: false },
|
|
||||||
MyColumns.CreatedAt(),
|
|
||||||
MyColumns.Option({
|
|
||||||
width: 120,
|
|
||||||
render: (_, item: any) => <MyShow key="show" item={item} />,
|
|
||||||
}),
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,91 +0,0 @@
|
|||||||
import {
|
|
||||||
MyButtons,
|
|
||||||
MyColumns,
|
|
||||||
MyProTableProps,
|
|
||||||
useCurrentPermissions,
|
|
||||||
} from '@/common';
|
|
||||||
import { Apis } from '@/gen/Apis';
|
|
||||||
import { PlusOutlined } from '@ant-design/icons';
|
|
||||||
import { ProTable } from '@ant-design/pro-components';
|
|
||||||
import { useNavigate } from '@umijs/max';
|
|
||||||
import { Space } from 'antd';
|
|
||||||
|
|
||||||
export default function SurveysList({ title = '问卷设置' }) {
|
|
||||||
const navigate = useNavigate();
|
|
||||||
const getCurrentPermissions = useCurrentPermissions();
|
|
||||||
let toolBarRender = () => {
|
|
||||||
return getCurrentPermissions(
|
|
||||||
{
|
|
||||||
add: (
|
|
||||||
<MyButtons.Default
|
|
||||||
key="Create"
|
|
||||||
size="middle"
|
|
||||||
type="primary"
|
|
||||||
icon={<PlusOutlined />}
|
|
||||||
onClick={() => {
|
|
||||||
navigate('/marketing/survey/pages/create_surveys');
|
|
||||||
}}
|
|
||||||
title="新增问卷"
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
'MySurveysList',
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
let tableRender = (item: any, action: any) => {
|
|
||||||
return (
|
|
||||||
getCurrentPermissions({
|
|
||||||
update: (
|
|
||||||
<MyButtons.Default
|
|
||||||
key="update"
|
|
||||||
type="primary"
|
|
||||||
onClick={() => {
|
|
||||||
navigate(`/marketing/survey/pages/update_surveys?id=${item.id}`);
|
|
||||||
}}
|
|
||||||
title="编辑"
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
delete: (
|
|
||||||
<MyButtons.Delete
|
|
||||||
onConfirm={() =>
|
|
||||||
Apis.Survey.Surveys.Delete({ id: item.id }).then(() =>
|
|
||||||
action?.reload(),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
}),
|
|
||||||
'MySurveysList'
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<ProTable
|
|
||||||
{...MyProTableProps.props}
|
|
||||||
headerTitle={`${title}`}
|
|
||||||
request={async (params, sort) =>
|
|
||||||
MyProTableProps.request(params, sort, Apis.Survey.Surveys.List)
|
|
||||||
}
|
|
||||||
toolBarRender={() => [toolBarRender()]}
|
|
||||||
columns={[
|
|
||||||
MyColumns.ID({
|
|
||||||
search: false,
|
|
||||||
}),
|
|
||||||
{ dataIndex: 'name', title: '问卷' },
|
|
||||||
MyColumns.Boolean({
|
|
||||||
dataIndex: 'is_enabled',
|
|
||||||
title: '是否启用',
|
|
||||||
search: false,
|
|
||||||
}),
|
|
||||||
MyColumns.CreatedAt(),
|
|
||||||
MyColumns.Option({
|
|
||||||
width: 120,
|
|
||||||
render: (_, item: any, index, action) => (
|
|
||||||
<Space key={`item_${index}`}>{tableRender(item, action)}</Space>
|
|
||||||
),
|
|
||||||
}),
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,48 +0,0 @@
|
|||||||
import { MyPageContainer, useCurrentPermissions } from '@/common';
|
|
||||||
import type { TabsProps } from 'antd';
|
|
||||||
import { Tabs } from 'antd';
|
|
||||||
import MyQuestionCategoriesList from './components/QuestionCategoriesList';
|
|
||||||
import MyQuestionsList from './components/QuestionsList';
|
|
||||||
import MySurveyReleasesList from './components/SurveyReleasesList';
|
|
||||||
import MySurveyResponsesList from './components/SurveyResponsesList';
|
|
||||||
import MySurveysList from './components/SurveysList';
|
|
||||||
export default function Index({ title = '问卷调查' }) {
|
|
||||||
const getCurrentPermissions = useCurrentPermissions();
|
|
||||||
const items: TabsProps['items'] = getCurrentPermissions({
|
|
||||||
MySurveyReleasesList: {
|
|
||||||
key: 'MySurveyReleasesList',
|
|
||||||
label: '问卷发布',
|
|
||||||
children: <MySurveyReleasesList />,
|
|
||||||
},
|
|
||||||
MySurveysList: {
|
|
||||||
key: 'MySurveysList',
|
|
||||||
label: '问卷设置',
|
|
||||||
children: <MySurveysList />,
|
|
||||||
},
|
|
||||||
MySurveyResponsesList: {
|
|
||||||
key: 'MySurveyResponsesList',
|
|
||||||
label: '问卷回收',
|
|
||||||
children: <MySurveyResponsesList />,
|
|
||||||
},
|
|
||||||
MyQuestionsList: {
|
|
||||||
key: 'MyQuestionsList',
|
|
||||||
label: '问卷题库',
|
|
||||||
children: <MyQuestionsList />,
|
|
||||||
},
|
|
||||||
MyQuestionCategoriesList: {
|
|
||||||
key: 'MyQuestionCategoriesList',
|
|
||||||
label: '题目分类',
|
|
||||||
children: <MyQuestionCategoriesList />,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
return (
|
|
||||||
<MyPageContainer
|
|
||||||
title={title}
|
|
||||||
enableTabs={true}
|
|
||||||
tabKey="marketing-survey"
|
|
||||||
tabLabel={title}
|
|
||||||
>
|
|
||||||
<Tabs type="card" items={items} />
|
|
||||||
</MyPageContainer>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,56 +0,0 @@
|
|||||||
import {
|
|
||||||
MyBetaModalFormProps,
|
|
||||||
MyButtons,
|
|
||||||
MyModalFormProps,
|
|
||||||
rulesHelper,
|
|
||||||
} from '@/common';
|
|
||||||
import { Apis } from '@/gen/Apis';
|
|
||||||
import { BetaSchemaForm } from '@ant-design/pro-components';
|
|
||||||
import { Form, message } from 'antd';
|
|
||||||
|
|
||||||
export default function QuestionCategoriesCreate(props: MyBetaModalFormProps) {
|
|
||||||
const [form] = Form.useForm();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<BetaSchemaForm<ApiTypes.Survey.QuestionCategories.Store>
|
|
||||||
{...MyModalFormProps.props}
|
|
||||||
form={form}
|
|
||||||
title={`添加${props.title}`}
|
|
||||||
wrapperCol={{ span: 24 }}
|
|
||||||
key={new Date().getTime()}
|
|
||||||
width="500px"
|
|
||||||
trigger={<MyButtons.Create title={`添加${props.title}`} />}
|
|
||||||
onOpenChange={(open: any) => {
|
|
||||||
if (open) {
|
|
||||||
form.resetFields(); // 清空表单数据
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
onFinish={async (values) =>
|
|
||||||
Apis.Survey.QuestionCategories.Store({
|
|
||||||
...values,
|
|
||||||
is_enabled: values?.is_enabled ? true : false,
|
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
props.reload?.();
|
|
||||||
message.success(`添加${props.title}成功`);
|
|
||||||
return true;
|
|
||||||
})
|
|
||||||
.catch(() => false)
|
|
||||||
}
|
|
||||||
columns={[
|
|
||||||
{ key: 'name', title: '名称', formItemProps: { ...rulesHelper.text } },
|
|
||||||
{
|
|
||||||
key: 'description',
|
|
||||||
title: '描述',
|
|
||||||
valueType: 'textarea',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'is_enabled',
|
|
||||||
title: '是否启用',
|
|
||||||
valueType: 'switch',
|
|
||||||
},
|
|
||||||
// MyFormItems.ColorPicker(),
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,92 +0,0 @@
|
|||||||
import {
|
|
||||||
MyBetaModalFormProps,
|
|
||||||
MyButtons,
|
|
||||||
MyFormItems,
|
|
||||||
MyModalFormProps,
|
|
||||||
rulesHelper,
|
|
||||||
} from '@/common';
|
|
||||||
import { Selects } from '@/components/Select';
|
|
||||||
import { Apis } from '@/gen/Apis';
|
|
||||||
import { QuestionsTypeEnum } from '@/gen/Enums';
|
|
||||||
import { BetaSchemaForm } from '@ant-design/pro-components';
|
|
||||||
import { Form, message } from 'antd';
|
|
||||||
|
|
||||||
export default function QuestionsCreate(props: MyBetaModalFormProps) {
|
|
||||||
const [form] = Form.useForm();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<BetaSchemaForm<ApiTypes.Survey.Questions.Store>
|
|
||||||
{...MyModalFormProps.props}
|
|
||||||
form={form}
|
|
||||||
title={`添加${props.title}`}
|
|
||||||
wrapperCol={{ span: 24 }}
|
|
||||||
key={new Date().getTime()}
|
|
||||||
width="600px"
|
|
||||||
trigger={<MyButtons.Create title={`添加${props.title}`} />}
|
|
||||||
onOpenChange={(open: any) => {
|
|
||||||
if (open) {
|
|
||||||
form.resetFields(); // 清空表单数据
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
onFinish={async (values) => {
|
|
||||||
console.log(values);
|
|
||||||
return Apis.Survey.Questions.Store({
|
|
||||||
...values,
|
|
||||||
is_enabled: values?.is_enabled ? true : false,
|
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
props.reload?.();
|
|
||||||
message.success(props.title + '成功');
|
|
||||||
return true;
|
|
||||||
})
|
|
||||||
.catch(() => false);
|
|
||||||
}}
|
|
||||||
columns={[
|
|
||||||
MyFormItems.EnumRadio({
|
|
||||||
key: 'type',
|
|
||||||
title: '类型',
|
|
||||||
valueEnum: QuestionsTypeEnum,
|
|
||||||
colProps: { span: 12 },
|
|
||||||
formItemProps: { ...rulesHelper.text },
|
|
||||||
}),
|
|
||||||
Selects?.QuestionCategories({
|
|
||||||
colProps: { span: 12 },
|
|
||||||
required: true,
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
key: 'title',
|
|
||||||
title: '题目',
|
|
||||||
colProps: { span: 24 },
|
|
||||||
formItemProps: { ...rulesHelper.text },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'placeholder',
|
|
||||||
title: '提示',
|
|
||||||
colProps: { span: 12 },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'max_length',
|
|
||||||
title: '回答最大字数',
|
|
||||||
valueType: 'digit',
|
|
||||||
fieldProps: {
|
|
||||||
style: { width: '100%' },
|
|
||||||
},
|
|
||||||
colProps: { span: 12, suffix: '个字' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'required',
|
|
||||||
title: '是否必答',
|
|
||||||
valueType: 'switch',
|
|
||||||
colProps: { span: 12 },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'is_enabled',
|
|
||||||
title: '是否启用',
|
|
||||||
valueType: 'switch',
|
|
||||||
colProps: { span: 12 },
|
|
||||||
},
|
|
||||||
// MyFormItems.ColorPicker(),
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,92 +0,0 @@
|
|||||||
import {
|
|
||||||
MyBetaModalFormProps,
|
|
||||||
MyButtons,
|
|
||||||
MyFormItems,
|
|
||||||
MyModalFormProps,
|
|
||||||
rulesHelper,
|
|
||||||
} from '@/common';
|
|
||||||
import { Selects } from '@/components/Select';
|
|
||||||
import { Apis } from '@/gen/Apis';
|
|
||||||
import { QuestionsTypeEnum } from '@/gen/Enums';
|
|
||||||
import { BetaSchemaForm } from '@ant-design/pro-components';
|
|
||||||
import { Form, message } from 'antd';
|
|
||||||
|
|
||||||
export default function QuestionsUpdate(props: MyBetaModalFormProps) {
|
|
||||||
const [form] = Form.useForm();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<BetaSchemaForm<ApiTypes.Survey.Questions.Update>
|
|
||||||
{...MyModalFormProps.props}
|
|
||||||
form={form}
|
|
||||||
title={`编辑${props.title}`}
|
|
||||||
wrapperCol={{ span: 24 }}
|
|
||||||
key={new Date().getTime()}
|
|
||||||
width="500px"
|
|
||||||
trigger={<MyButtons.Edit title="编辑" />}
|
|
||||||
onOpenChange={(open: any) => {
|
|
||||||
if (open && props.item) {
|
|
||||||
form.setFieldsValue(props.item);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
onFinish={async (values) =>
|
|
||||||
Apis.Survey.Questions.Update({
|
|
||||||
...values,
|
|
||||||
is_enabled: values?.is_enabled ? true : false,
|
|
||||||
id: props.item?.id ?? 0,
|
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
props.reload?.();
|
|
||||||
message.success(props.title + '成功');
|
|
||||||
return true;
|
|
||||||
})
|
|
||||||
.catch(() => false)
|
|
||||||
}
|
|
||||||
columns={[
|
|
||||||
MyFormItems.EnumRadio({
|
|
||||||
key: 'type',
|
|
||||||
title: '类型',
|
|
||||||
valueEnum: QuestionsTypeEnum,
|
|
||||||
colProps: { span: 12 },
|
|
||||||
formItemProps: { ...rulesHelper.text },
|
|
||||||
}),
|
|
||||||
Selects?.QuestionCategories({
|
|
||||||
colProps: { span: 12 },
|
|
||||||
required: true,
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
key: 'title',
|
|
||||||
title: '题目',
|
|
||||||
colProps: { span: 24 },
|
|
||||||
formItemProps: { ...rulesHelper.text },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'placeholder',
|
|
||||||
title: '提示',
|
|
||||||
colProps: { span: 12 },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'max_length',
|
|
||||||
title: '回答最大字数',
|
|
||||||
valueType: 'digit',
|
|
||||||
fieldProps: {
|
|
||||||
style: { width: '100%' },
|
|
||||||
},
|
|
||||||
colProps: { span: 12, suffix: '个字' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'required',
|
|
||||||
title: '是否必答',
|
|
||||||
valueType: 'switch',
|
|
||||||
colProps: { span: 12 },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'is_enabled',
|
|
||||||
title: '是否启用',
|
|
||||||
valueType: 'switch',
|
|
||||||
colProps: { span: 12 },
|
|
||||||
},
|
|
||||||
// MyFormItems.ColorPicker(),
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,78 +0,0 @@
|
|||||||
import {
|
|
||||||
MyBetaModalFormProps,
|
|
||||||
MyButtons,
|
|
||||||
MyFormItems,
|
|
||||||
MyModalFormProps,
|
|
||||||
rulesHelper,
|
|
||||||
} from '@/common';
|
|
||||||
import { Selects } from '@/components/Select';
|
|
||||||
import { Apis } from '@/gen/Apis';
|
|
||||||
import { SurveyReleasesTypeEnum } from '@/gen/Enums';
|
|
||||||
import { BetaSchemaForm } from '@ant-design/pro-components';
|
|
||||||
import { Form, message } from 'antd';
|
|
||||||
export default function SurveyReleasesCreate(props: MyBetaModalFormProps) {
|
|
||||||
const [form] = Form.useForm();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<BetaSchemaForm<ApiTypes.Survey.SurveyReleases.Store>
|
|
||||||
{...MyModalFormProps.props}
|
|
||||||
form={form}
|
|
||||||
title={`添加${props.title}`}
|
|
||||||
wrapperCol={{ span: 24 }}
|
|
||||||
key={new Date().getTime()}
|
|
||||||
width="600px"
|
|
||||||
trigger={<MyButtons.Create title={`添加${props.title}`} />}
|
|
||||||
onOpenChange={(open: any) => {
|
|
||||||
if (open) {
|
|
||||||
form.resetFields(); // 清空表单数据
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
onFinish={async (values) => {
|
|
||||||
console.log(values);
|
|
||||||
return Apis.Survey.SurveyReleases.Store({
|
|
||||||
...values,
|
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
props.reload?.();
|
|
||||||
message.success(props.title + '成功');
|
|
||||||
return true;
|
|
||||||
})
|
|
||||||
.catch(() => false);
|
|
||||||
}}
|
|
||||||
columns={[
|
|
||||||
Selects?.Surveys({
|
|
||||||
colProps: { span: 24 },
|
|
||||||
required: true,
|
|
||||||
}),
|
|
||||||
MyFormItems.EnumRadio({
|
|
||||||
key: 'release_type',
|
|
||||||
title: '发布方式',
|
|
||||||
valueEnum: SurveyReleasesTypeEnum,
|
|
||||||
colProps: { span: 24 },
|
|
||||||
formItemProps: { ...rulesHelper.text },
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
key: 'start_date',
|
|
||||||
title: '有效日期开始',
|
|
||||||
valueType: 'dateTime',
|
|
||||||
colProps: { span: 12 },
|
|
||||||
formItemProps: { ...rulesHelper.text },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'end_date',
|
|
||||||
title: '有效日期结束',
|
|
||||||
colProps: { span: 12 },
|
|
||||||
valueType: 'dateTime',
|
|
||||||
formItemProps: { ...rulesHelper.text },
|
|
||||||
},
|
|
||||||
MyFormItems.UploadImages({
|
|
||||||
key: 'cover_image',
|
|
||||||
title: '封面图',
|
|
||||||
colProps: { span: 24 },
|
|
||||||
max: 1,
|
|
||||||
}),
|
|
||||||
// MyFormItems.ColorPicker(),
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,79 +0,0 @@
|
|||||||
import {
|
|
||||||
MyBetaModalFormProps,
|
|
||||||
MyButtons,
|
|
||||||
MyFormItems,
|
|
||||||
MyModalFormProps,
|
|
||||||
rulesHelper,
|
|
||||||
} from '@/common';
|
|
||||||
import { Selects } from '@/components/Select';
|
|
||||||
import { Apis } from '@/gen/Apis';
|
|
||||||
import { SurveyReleasesTypeEnum } from '@/gen/Enums';
|
|
||||||
import { BetaSchemaForm } from '@ant-design/pro-components';
|
|
||||||
import { Form, message } from 'antd';
|
|
||||||
export default function SurveyReleasesCreate(props: MyBetaModalFormProps) {
|
|
||||||
const [form] = Form.useForm();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<BetaSchemaForm<ApiTypes.Survey.SurveyReleases.Update>
|
|
||||||
{...MyModalFormProps.props}
|
|
||||||
form={form}
|
|
||||||
title={`添加${props.title}`}
|
|
||||||
wrapperCol={{ span: 24 }}
|
|
||||||
key={new Date().getTime()}
|
|
||||||
width="600px"
|
|
||||||
trigger={<MyButtons.Edit title="编辑" disabled={props?.item?.status} />}
|
|
||||||
onOpenChange={(open: any) => {
|
|
||||||
if (open && props.item) {
|
|
||||||
form.setFieldsValue(props.item);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
onFinish={async (values) => {
|
|
||||||
console.log(values);
|
|
||||||
return Apis.Survey.SurveyReleases.Update({
|
|
||||||
...values,
|
|
||||||
id: props.item?.id ?? 0,
|
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
props.reload?.();
|
|
||||||
message.success('编辑成功');
|
|
||||||
return true;
|
|
||||||
})
|
|
||||||
.catch(() => false);
|
|
||||||
}}
|
|
||||||
columns={[
|
|
||||||
Selects?.Surveys({
|
|
||||||
colProps: { span: 24 },
|
|
||||||
required: true,
|
|
||||||
}),
|
|
||||||
MyFormItems.EnumRadio({
|
|
||||||
key: 'release_type',
|
|
||||||
title: '发布方式',
|
|
||||||
valueEnum: SurveyReleasesTypeEnum,
|
|
||||||
colProps: { span: 24 },
|
|
||||||
formItemProps: { ...rulesHelper.text },
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
key: 'start_date',
|
|
||||||
title: '有效日期开始',
|
|
||||||
valueType: 'dateTime',
|
|
||||||
colProps: { span: 12 },
|
|
||||||
formItemProps: { ...rulesHelper.text },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'end_date',
|
|
||||||
title: '有效日期结束',
|
|
||||||
colProps: { span: 12 },
|
|
||||||
valueType: 'dateTime',
|
|
||||||
formItemProps: { ...rulesHelper.text },
|
|
||||||
},
|
|
||||||
MyFormItems.UploadImages({
|
|
||||||
key: 'cover_image',
|
|
||||||
title: '封面图',
|
|
||||||
colProps: { span: 24 },
|
|
||||||
max: 1,
|
|
||||||
}),
|
|
||||||
// MyFormItems.ColorPicker(),
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,67 +0,0 @@
|
|||||||
import { MyBetaModalFormProps } from '@/common';
|
|
||||||
import { MyModal } from '@/components/MyModal';
|
|
||||||
import { Apis } from '@/gen/Apis';
|
|
||||||
import { List } from 'antd';
|
|
||||||
import { useRef, useState } from 'react';
|
|
||||||
interface DataType {
|
|
||||||
key: React.Key;
|
|
||||||
id: React.Key;
|
|
||||||
is_enabled: boolean;
|
|
||||||
}
|
|
||||||
const scoreInfo = {
|
|
||||||
'1': '非常不满意',
|
|
||||||
'2': '比较不满意',
|
|
||||||
'3': '满意',
|
|
||||||
'4': '比较满意',
|
|
||||||
'5': '非常满意',
|
|
||||||
};
|
|
||||||
|
|
||||||
export default function SurveyResponsesShow(
|
|
||||||
props: MyBetaModalFormProps & {
|
|
||||||
onChange?: (selectedRows: DataType[]) => void;
|
|
||||||
},
|
|
||||||
) {
|
|
||||||
const modalRef = useRef<any>();
|
|
||||||
const [data, setShow] = useState<any>({});
|
|
||||||
const loadShow = () => {
|
|
||||||
Apis.Survey.SurveyResponses.Show({ id: props?.item?.id }).then((res) => {
|
|
||||||
setShow(res?.data);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<MyModal
|
|
||||||
title="回答详情"
|
|
||||||
width="800px"
|
|
||||||
myRef={modalRef}
|
|
||||||
onOpen={() => {
|
|
||||||
loadShow();
|
|
||||||
console.log(props?.item?.list);
|
|
||||||
}}
|
|
||||||
node={
|
|
||||||
<>
|
|
||||||
<List
|
|
||||||
itemLayout="horizontal"
|
|
||||||
dataSource={data?.questions_with_answers}
|
|
||||||
renderItem={(item: any, index: number) => (
|
|
||||||
<List.Item>
|
|
||||||
<List.Item.Meta
|
|
||||||
title={`${index + 1}.题目:${item?.title}`}
|
|
||||||
description={
|
|
||||||
item?.type === 'Score'
|
|
||||||
? `客户选择:${
|
|
||||||
scoreInfo[
|
|
||||||
item?.answer?.score as keyof typeof scoreInfo
|
|
||||||
]
|
|
||||||
}(${item?.answer?.score}分)`
|
|
||||||
: `客户回答:${item?.answer?.answer_content}`
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</List.Item>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
}
|
|
||||||
></MyModal>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,99 +0,0 @@
|
|||||||
import {
|
|
||||||
MyBetaModalFormProps,
|
|
||||||
MyButtons,
|
|
||||||
MyColumns,
|
|
||||||
MyProTableProps,
|
|
||||||
} from '@/common';
|
|
||||||
import { MyModal } from '@/components/MyModal';
|
|
||||||
import { Apis } from '@/gen/Apis';
|
|
||||||
import { QuestionsTypeEnum } from '@/gen/Enums';
|
|
||||||
import { ProTable } from '@ant-design/pro-components';
|
|
||||||
import { type TableProps } from 'antd';
|
|
||||||
import { useRef, useState } from 'react';
|
|
||||||
interface DataType {
|
|
||||||
key: React.Key;
|
|
||||||
id: React.Key;
|
|
||||||
is_enabled: boolean;
|
|
||||||
}
|
|
||||||
export default function SurveysSelectList(
|
|
||||||
props: MyBetaModalFormProps & {
|
|
||||||
onChange?: (selectedRows: DataType[]) => void;
|
|
||||||
},
|
|
||||||
) {
|
|
||||||
const modalRef = useRef<any>();
|
|
||||||
const [getSelectedRow, setSelectedRow] = useState<any>([]);
|
|
||||||
const rowSelection: TableProps<any>['rowSelection'] = {
|
|
||||||
onChange: (selectedRowKeys: React.Key[], selectedRows: DataType[]) => {
|
|
||||||
setSelectedRow(selectedRows);
|
|
||||||
},
|
|
||||||
getCheckboxProps: (record: DataType) => ({
|
|
||||||
disabled: !record.is_enabled, // Column configuration not to be checked
|
|
||||||
checked: props?.item?.list?.some((item: any) => {
|
|
||||||
console.log(item, record);
|
|
||||||
return item?.id === record?.id;
|
|
||||||
}),
|
|
||||||
}),
|
|
||||||
defaultSelectedRowKeys:
|
|
||||||
props?.item?.list?.map((item: any) => item?.id) || [],
|
|
||||||
};
|
|
||||||
return (
|
|
||||||
<MyModal
|
|
||||||
title={'选择题目'}
|
|
||||||
width="1000px"
|
|
||||||
myRef={modalRef}
|
|
||||||
size="middle"
|
|
||||||
onOpen={() => {
|
|
||||||
setSelectedRow(props?.item?.list);
|
|
||||||
console.log(props?.item?.list);
|
|
||||||
}}
|
|
||||||
node={
|
|
||||||
<ProTable
|
|
||||||
{...MyProTableProps.props}
|
|
||||||
request={async (params, sort) =>
|
|
||||||
MyProTableProps.request(params, sort, Apis.Survey.Questions.List)
|
|
||||||
}
|
|
||||||
rowSelection={{ type: 'checkbox', ...rowSelection }}
|
|
||||||
options={false}
|
|
||||||
tableAlertOptionRender={() => {
|
|
||||||
return (
|
|
||||||
<MyButtons.Default
|
|
||||||
key="okSelect"
|
|
||||||
size="middle"
|
|
||||||
type="primary"
|
|
||||||
onClick={() => {
|
|
||||||
getSelectedRow?.forEach((item: any) => {
|
|
||||||
item.question_id = item?.id;
|
|
||||||
});
|
|
||||||
props?.onChange?.(getSelectedRow);
|
|
||||||
modalRef.current?.close();
|
|
||||||
}}
|
|
||||||
title="确定选项"
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
columns={[
|
|
||||||
MyColumns.ID({
|
|
||||||
search: false,
|
|
||||||
}),
|
|
||||||
{ dataIndex: 'title', title: '题目' },
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
title: '类型',
|
|
||||||
dataIndex: 'type',
|
|
||||||
valueEnum: QuestionsTypeEnum,
|
|
||||||
}),
|
|
||||||
{ dataIndex: 'placeholder', title: '提示', search: false },
|
|
||||||
MyColumns.Boolean({
|
|
||||||
dataIndex: 'required',
|
|
||||||
title: '是否必答',
|
|
||||||
search: false,
|
|
||||||
}),
|
|
||||||
MyColumns.Boolean({
|
|
||||||
dataIndex: 'is_enabled',
|
|
||||||
title: '是否启用',
|
|
||||||
}),
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
></MyModal>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,169 +0,0 @@
|
|||||||
import {
|
|
||||||
MyButtons,
|
|
||||||
MyColumns,
|
|
||||||
MyModalFormProps,
|
|
||||||
MyPageContainer,
|
|
||||||
rulesHelper,
|
|
||||||
} from '@/common';
|
|
||||||
import { Apis } from '@/gen/Apis';
|
|
||||||
import { QuestionsTypeEnum } from '@/gen/Enums';
|
|
||||||
import type { ProColumns } from '@ant-design/pro-components';
|
|
||||||
import {
|
|
||||||
BetaSchemaForm,
|
|
||||||
DragSortTable,
|
|
||||||
ProCard,
|
|
||||||
} from '@ant-design/pro-components';
|
|
||||||
import { useNavigate } from '@umijs/max';
|
|
||||||
import { Form, message, Space } from 'antd';
|
|
||||||
import { useState } from 'react';
|
|
||||||
import MySurveysSelectList from '../modals/SurveysSelectList';
|
|
||||||
export default function Index({ title = '新增问卷' }) {
|
|
||||||
const [dataSource, setDataSource] = useState<ApiTypes.Survey.Surveys.Store[]>(
|
|
||||||
[],
|
|
||||||
);
|
|
||||||
const [form] = Form.useForm();
|
|
||||||
const navigate = useNavigate();
|
|
||||||
|
|
||||||
const columns: ProColumns[] = [
|
|
||||||
{
|
|
||||||
title: '排序',
|
|
||||||
dataIndex: 'sort',
|
|
||||||
width: 60,
|
|
||||||
className: 'drag-visible',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '题目',
|
|
||||||
dataIndex: 'title',
|
|
||||||
},
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
title: '类型',
|
|
||||||
dataIndex: 'type',
|
|
||||||
valueEnum: QuestionsTypeEnum,
|
|
||||||
}),
|
|
||||||
MyColumns.Boolean({
|
|
||||||
dataIndex: 'required',
|
|
||||||
title: '是否必答',
|
|
||||||
search: false,
|
|
||||||
}),
|
|
||||||
MyColumns.Option({
|
|
||||||
render: (_, item: any, index) => (
|
|
||||||
<Space key={index}>
|
|
||||||
<MyButtons.Delete
|
|
||||||
onConfirm={() => {
|
|
||||||
setDataSource(
|
|
||||||
dataSource.filter((res: any) => res?.id !== item?.id),
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
),
|
|
||||||
}),
|
|
||||||
];
|
|
||||||
|
|
||||||
const handleDragSortEnd = (
|
|
||||||
beforeIndex: number,
|
|
||||||
afterIndex: number,
|
|
||||||
newDataSource: any,
|
|
||||||
) => {
|
|
||||||
console.log(newDataSource, 'newDataSource');
|
|
||||||
setDataSource(newDataSource);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<MyPageContainer
|
|
||||||
title={
|
|
||||||
<Space
|
|
||||||
style={{ cursor: 'pointer' }}
|
|
||||||
onClick={() => {
|
|
||||||
navigate(-1);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{/* <LeftCircleOutlined size={34} /> */}
|
|
||||||
{title}
|
|
||||||
</Space>
|
|
||||||
}
|
|
||||||
enableTabs={false}
|
|
||||||
tabKey="charge-standards-create"
|
|
||||||
tabLabel={title}
|
|
||||||
>
|
|
||||||
<ProCard>
|
|
||||||
<div style={{ width: 900, minHeight: '83vh', margin: '0 auto' }}>
|
|
||||||
<BetaSchemaForm<ApiTypes.Survey.Surveys.Store>
|
|
||||||
{...MyModalFormProps.props}
|
|
||||||
title={title}
|
|
||||||
// 基础表单
|
|
||||||
layoutType="Form"
|
|
||||||
labelCol={{ span: 4 }}
|
|
||||||
wrapperCol={{ span: 24 }}
|
|
||||||
labelAlign="left"
|
|
||||||
width="900px"
|
|
||||||
form={form}
|
|
||||||
onFinish={async (values: any) =>
|
|
||||||
Apis.Survey.Surveys.Store({
|
|
||||||
...values,
|
|
||||||
questions: dataSource,
|
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
navigate(-1);
|
|
||||||
message.success('新增成功');
|
|
||||||
return true;
|
|
||||||
})
|
|
||||||
.catch(() => false)
|
|
||||||
}
|
|
||||||
columns={[
|
|
||||||
{
|
|
||||||
key: 'name',
|
|
||||||
title: '问卷名称',
|
|
||||||
colProps: { span: 24 },
|
|
||||||
formItemProps: { ...rulesHelper.text },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'is_enabled',
|
|
||||||
title: '是否启用',
|
|
||||||
valueType: 'switch',
|
|
||||||
colProps: { span: 24 },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'description',
|
|
||||||
title: '问卷描述',
|
|
||||||
valueType: 'textarea',
|
|
||||||
colProps: { span: 24 },
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
colProps: { span: 24 },
|
|
||||||
renderFormItem: () => {
|
|
||||||
return (
|
|
||||||
<ProCard bordered>
|
|
||||||
<DragSortTable
|
|
||||||
headerTitle="题目列表(拖拽排序)"
|
|
||||||
toolBarRender={() => [
|
|
||||||
<MySurveysSelectList
|
|
||||||
key="select"
|
|
||||||
item={{ list: dataSource }}
|
|
||||||
onChange={(e: any) => {
|
|
||||||
setDataSource(e);
|
|
||||||
}}
|
|
||||||
/>,
|
|
||||||
]}
|
|
||||||
bordered
|
|
||||||
options={false}
|
|
||||||
columns={columns}
|
|
||||||
rowKey="id"
|
|
||||||
search={false}
|
|
||||||
pagination={false}
|
|
||||||
dataSource={dataSource || []}
|
|
||||||
dragSortKey="sort"
|
|
||||||
onDragSortEnd={handleDragSortEnd}
|
|
||||||
/>
|
|
||||||
</ProCard>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</ProCard>
|
|
||||||
</MyPageContainer>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,188 +0,0 @@
|
|||||||
import {
|
|
||||||
MyButtons,
|
|
||||||
MyColumns,
|
|
||||||
MyModalFormProps,
|
|
||||||
MyPageContainer,
|
|
||||||
rulesHelper,
|
|
||||||
} from '@/common';
|
|
||||||
import { Apis } from '@/gen/Apis';
|
|
||||||
import { QuestionsTypeEnum } from '@/gen/Enums';
|
|
||||||
import type { ProColumns } from '@ant-design/pro-components';
|
|
||||||
import {
|
|
||||||
BetaSchemaForm,
|
|
||||||
DragSortTable,
|
|
||||||
ProCard,
|
|
||||||
} from '@ant-design/pro-components';
|
|
||||||
import { useNavigate, useSearchParams } from '@umijs/max';
|
|
||||||
import { Form, message, Space } from 'antd';
|
|
||||||
import { useEffect, useState } from 'react';
|
|
||||||
import MySurveysSelectList from '../modals/SurveysSelectList';
|
|
||||||
export default function Index({ title = '新增问卷' }) {
|
|
||||||
const [data, setShow] = useState<any>({});
|
|
||||||
const [dataSource, setDataSource] = useState<ApiTypes.Survey.Surveys.Store[]>(
|
|
||||||
[],
|
|
||||||
);
|
|
||||||
const [form] = Form.useForm();
|
|
||||||
const navigate = useNavigate();
|
|
||||||
|
|
||||||
const columns: ProColumns[] = [
|
|
||||||
{
|
|
||||||
title: '排序',
|
|
||||||
dataIndex: 'sort',
|
|
||||||
width: 60,
|
|
||||||
className: 'drag-visible',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '题目',
|
|
||||||
dataIndex: 'title',
|
|
||||||
},
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
title: '类型',
|
|
||||||
dataIndex: 'type',
|
|
||||||
valueEnum: QuestionsTypeEnum,
|
|
||||||
}),
|
|
||||||
MyColumns.Boolean({
|
|
||||||
dataIndex: 'required',
|
|
||||||
title: '是否必答',
|
|
||||||
search: false,
|
|
||||||
}),
|
|
||||||
MyColumns.Option({
|
|
||||||
render: (_, item: any, index) => (
|
|
||||||
<Space key={index}>
|
|
||||||
<MyButtons.Delete
|
|
||||||
onConfirm={() => {
|
|
||||||
setDataSource(
|
|
||||||
dataSource.filter((res: any) => res?.id !== item?.id),
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
),
|
|
||||||
}),
|
|
||||||
];
|
|
||||||
|
|
||||||
const handleDragSortEnd = (
|
|
||||||
beforeIndex: number,
|
|
||||||
afterIndex: number,
|
|
||||||
newDataSource: any,
|
|
||||||
) => {
|
|
||||||
console.log(newDataSource, 'newDataSource');
|
|
||||||
setDataSource(newDataSource);
|
|
||||||
};
|
|
||||||
|
|
||||||
const [searchParams] = useSearchParams();
|
|
||||||
|
|
||||||
const loadShow = () => {
|
|
||||||
let paramsId: any = { id: searchParams.get('id') ?? 0 };
|
|
||||||
Apis.Survey.Surveys.Show(paramsId).then((res) => {
|
|
||||||
res?.data?.questions_with_order?.forEach((k: any) => {
|
|
||||||
k.question_id = k?.id;
|
|
||||||
});
|
|
||||||
setDataSource(res?.data?.questions_with_order || []);
|
|
||||||
setShow(res?.data);
|
|
||||||
form.setFieldsValue(res?.data); // 编辑赋值
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
loadShow();
|
|
||||||
}, [searchParams.get('id')]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<MyPageContainer
|
|
||||||
title={
|
|
||||||
<Space
|
|
||||||
style={{ cursor: 'pointer' }}
|
|
||||||
onClick={() => {
|
|
||||||
navigate(-1);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{/* <LeftCircleOutlined size={34} /> */}
|
|
||||||
{title}
|
|
||||||
</Space>
|
|
||||||
}
|
|
||||||
enableTabs={false}
|
|
||||||
tabKey="charge-standards-create"
|
|
||||||
tabLabel={title}
|
|
||||||
>
|
|
||||||
<ProCard>
|
|
||||||
<div style={{ width: 900, minHeight: '83vh', margin: '0 auto' }}>
|
|
||||||
<BetaSchemaForm<ApiTypes.Survey.Surveys.Store>
|
|
||||||
{...MyModalFormProps.props}
|
|
||||||
title={title}
|
|
||||||
// 基础表单
|
|
||||||
layoutType="Form"
|
|
||||||
labelCol={{ span: 4 }}
|
|
||||||
wrapperCol={{ span: 24 }}
|
|
||||||
labelAlign="left"
|
|
||||||
width="900px"
|
|
||||||
form={form}
|
|
||||||
onFinish={async (values: any) =>
|
|
||||||
Apis.Survey.Surveys.Update({
|
|
||||||
...values,
|
|
||||||
questions: dataSource,
|
|
||||||
id: data?.id,
|
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
navigate(-1);
|
|
||||||
message.success('编辑成功');
|
|
||||||
return true;
|
|
||||||
})
|
|
||||||
.catch(() => false)
|
|
||||||
}
|
|
||||||
columns={[
|
|
||||||
{
|
|
||||||
key: 'name',
|
|
||||||
title: '问卷名称',
|
|
||||||
colProps: { span: 24 },
|
|
||||||
formItemProps: { ...rulesHelper.text },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'is_enabled',
|
|
||||||
title: '是否启用',
|
|
||||||
valueType: 'switch',
|
|
||||||
colProps: { span: 24 },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'description',
|
|
||||||
title: '问卷描述',
|
|
||||||
valueType: 'textarea',
|
|
||||||
colProps: { span: 24 },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
colProps: { span: 24 },
|
|
||||||
renderFormItem: () => {
|
|
||||||
return (
|
|
||||||
<ProCard bordered>
|
|
||||||
<DragSortTable
|
|
||||||
headerTitle="题目列表(拖拽排序)"
|
|
||||||
toolBarRender={() => [
|
|
||||||
<MySurveysSelectList
|
|
||||||
key="select"
|
|
||||||
item={{ list: dataSource }}
|
|
||||||
onChange={(e: any) => {
|
|
||||||
setDataSource(e);
|
|
||||||
}}
|
|
||||||
/>,
|
|
||||||
]}
|
|
||||||
bordered
|
|
||||||
options={false}
|
|
||||||
columns={columns}
|
|
||||||
rowKey="id"
|
|
||||||
search={false}
|
|
||||||
pagination={false}
|
|
||||||
dataSource={dataSource || []}
|
|
||||||
dragSortKey="sort"
|
|
||||||
onDragSortEnd={handleDragSortEnd}
|
|
||||||
/>
|
|
||||||
</ProCard>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</ProCard>
|
|
||||||
</MyPageContainer>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,28 +1,26 @@
|
|||||||
import { MyPageContainer, useCurrentPermissions } from '@/common';
|
import { MyPageContainer } from '@/common';
|
||||||
import { useSearchParams } from '@umijs/max';
|
import { useSearchParams } from '@umijs/max';
|
||||||
import type { TabsProps } from 'antd';
|
|
||||||
import { Tabs } from 'antd';
|
import { Tabs } from 'antd';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import CommonMeter from './common_meter';
|
import CommonMeter from './common_meter';
|
||||||
import HouseMeter from './house_meter';
|
import HouseMeter from './house_meter';
|
||||||
|
|
||||||
export default function Index({ title = '资源管理' }) {
|
export default function Index({ title = '仪表管理' }) {
|
||||||
const [searchParams] = useSearchParams();
|
const [searchParams] = useSearchParams();
|
||||||
const getCurrentPermissions = useCurrentPermissions();
|
|
||||||
|
|
||||||
const [activeKey, setActiveKey] = useState('MyResources');
|
const [activeKey, setActiveKey] = useState('MyResources');
|
||||||
const items: TabsProps['items'] = getCurrentPermissions({
|
|
||||||
HouseMeter: {
|
const items = [
|
||||||
|
{
|
||||||
key: 'HouseMeter',
|
key: 'HouseMeter',
|
||||||
label: '房屋表',
|
label: '房屋表',
|
||||||
children: <HouseMeter />,
|
children: <HouseMeter />,
|
||||||
},
|
},
|
||||||
CommonMeter: {
|
{
|
||||||
key: 'CommonMeter',
|
key: 'CommonMeter',
|
||||||
label: '公摊表',
|
label: '公摊表',
|
||||||
children: <CommonMeter />,
|
children: <CommonMeter />,
|
||||||
},
|
},
|
||||||
});
|
];
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (searchParams?.get('key')) {
|
if (searchParams?.get('key')) {
|
||||||
setActiveKey(searchParams?.get('key') || '1');
|
setActiveKey(searchParams?.get('key') || '1');
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import {
|
|||||||
MyProTableProps,
|
MyProTableProps,
|
||||||
} from '@/common';
|
} from '@/common';
|
||||||
import { Apis } from '@/gen/Apis';
|
import { Apis } from '@/gen/Apis';
|
||||||
import { VisitorAppliesStatusEnum } from '@/gen/Enums';
|
|
||||||
import { ProTable } from '@ant-design/pro-components';
|
import { ProTable } from '@ant-design/pro-components';
|
||||||
import { message, Space } from 'antd';
|
import { message, Space } from 'antd';
|
||||||
import Review from './modals/Review';
|
import Review from './modals/Review';
|
||||||
@ -35,7 +34,7 @@ export default function Index({ title = '访客预约' }) {
|
|||||||
MyColumns.EnumTag({
|
MyColumns.EnumTag({
|
||||||
title: '申请状态',
|
title: '申请状态',
|
||||||
dataIndex: 'status',
|
dataIndex: 'status',
|
||||||
valueEnum: VisitorAppliesStatusEnum,
|
// valueEnum: VisitorAppliesStatusEnum,
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
title: '房屋',
|
title: '房屋',
|
||||||
|
|||||||
@ -170,7 +170,7 @@ export default function Index({ title = '客户投诉' }) {
|
|||||||
|
|
||||||
<MyButtons.Delete
|
<MyButtons.Delete
|
||||||
onConfirm={() =>
|
onConfirm={() =>
|
||||||
Apis.WorkOrder.HouseWorkOrders.SoftDelete({
|
Apis.WorkOrder.HouseWorkOrders.Delete({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
}).then(() => action?.reload())
|
}).then(() => action?.reload())
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,183 +0,0 @@
|
|||||||
import { MyButtons, MyColumns, MyProTableProps } from '@/common';
|
|
||||||
import { Apis } from '@/gen/Apis';
|
|
||||||
import {
|
|
||||||
HouseWorkOrdersAssignStatusEnum,
|
|
||||||
HouseWorkOrdersLevelEnum,
|
|
||||||
HouseWorkOrdersLocationEnum,
|
|
||||||
HouseWorkOrdersStatusEnum,
|
|
||||||
HouseWorkOrdersTypeEnum,
|
|
||||||
} from '@/gen/Enums';
|
|
||||||
import { ProTable } from '@ant-design/pro-components';
|
|
||||||
import { Image, Space } from 'antd';
|
|
||||||
import WorkOrderAssign from '../modals/WorkOrderAssign';
|
|
||||||
import WorkOrderShow from '../modals/WorkOrderShow';
|
|
||||||
import WorkOrderUpdate from '../modals/WorkOrderUpdate';
|
|
||||||
|
|
||||||
export default function Index({ title = '设备维保' }) {
|
|
||||||
return (
|
|
||||||
<ProTable
|
|
||||||
{...MyProTableProps.props}
|
|
||||||
headerTitle="设备维保"
|
|
||||||
request={async (params, sort) =>
|
|
||||||
MyProTableProps.request(
|
|
||||||
{
|
|
||||||
...params,
|
|
||||||
type: [HouseWorkOrdersTypeEnum.EquipmentMaintenance.value],
|
|
||||||
},
|
|
||||||
sort,
|
|
||||||
Apis.WorkOrder.HouseWorkOrders.List,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
// toolBarRender={(action) => [
|
|
||||||
// <WorkOrderCreate key="Create" reload={action?.reload} title={title} />,
|
|
||||||
// ]}
|
|
||||||
columns={[
|
|
||||||
MyColumns.ID({
|
|
||||||
search: false,
|
|
||||||
}),
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
title: '工单状态',
|
|
||||||
dataIndex: 'status',
|
|
||||||
valueEnum: HouseWorkOrdersStatusEnum,
|
|
||||||
}),
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
title: '工单类型',
|
|
||||||
dataIndex: 'type',
|
|
||||||
valueEnum: HouseWorkOrdersTypeEnum,
|
|
||||||
}),
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
title: '报修位置',
|
|
||||||
dataIndex: 'location',
|
|
||||||
valueEnum: HouseWorkOrdersLocationEnum,
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
title: '房屋信息',
|
|
||||||
dataIndex: ['asset_house', 'full_name'],
|
|
||||||
search: false,
|
|
||||||
ellipsis: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '工单描述',
|
|
||||||
dataIndex: 'content',
|
|
||||||
search: false,
|
|
||||||
width: 120, // 关键:固定列宽(若父容器过窄,可设 minWidth: 200 优先保证列宽)
|
|
||||||
render: (text) => (
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
width: '100%', // 继承列宽
|
|
||||||
// height: '60px', // 设置固定高度,约显示3行文本
|
|
||||||
overflow: 'hidden', // 超出隐藏
|
|
||||||
textOverflow: 'ellipsis', // 省略号
|
|
||||||
display: '-webkit-box',
|
|
||||||
WebkitBoxOrient: 'vertical',
|
|
||||||
WebkitLineClamp: 1, // 显示3行
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{text}
|
|
||||||
</div>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '附件',
|
|
||||||
dataIndex: 'attachments',
|
|
||||||
search: false,
|
|
||||||
render: (_, record) => {
|
|
||||||
if (
|
|
||||||
!Array.isArray(record.attachments) ||
|
|
||||||
record.attachments.length === 0
|
|
||||||
) {
|
|
||||||
return '无附件';
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 6 }}>
|
|
||||||
{record.attachments.map((item: any, index: number) => {
|
|
||||||
if (item.type && item.type.includes('image')) {
|
|
||||||
return (
|
|
||||||
<Image
|
|
||||||
key={index}
|
|
||||||
width={40}
|
|
||||||
height={30}
|
|
||||||
src={item.url}
|
|
||||||
style={{
|
|
||||||
marginRight: 8,
|
|
||||||
marginBottom: 8,
|
|
||||||
objectFit: 'cover',
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
} else if (item.type && item.type.includes('video')) {
|
|
||||||
return (
|
|
||||||
<video
|
|
||||||
key={index}
|
|
||||||
width={40}
|
|
||||||
height={30}
|
|
||||||
controls
|
|
||||||
style={{
|
|
||||||
marginRight: 8,
|
|
||||||
marginBottom: 8,
|
|
||||||
objectFit: 'cover',
|
|
||||||
}}
|
|
||||||
src={item.url}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
title: '分配状态',
|
|
||||||
dataIndex: 'assign_status',
|
|
||||||
valueEnum: HouseWorkOrdersAssignStatusEnum,
|
|
||||||
}),
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
title: '优先级',
|
|
||||||
dataIndex: 'level',
|
|
||||||
valueEnum: HouseWorkOrdersLevelEnum,
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
title: '处理人',
|
|
||||||
dataIndex: ['assign_employee', 'name'],
|
|
||||||
search: false,
|
|
||||||
render: (_, record) => {
|
|
||||||
return `${record?.assign_employee?.name || ''}-${
|
|
||||||
record?.assign_employee?.phone || ''
|
|
||||||
}`;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
MyColumns.CreatedAt(),
|
|
||||||
MyColumns.Option({
|
|
||||||
render: (_, item: any, index, action) => (
|
|
||||||
<Space key={index}>
|
|
||||||
<WorkOrderShow item={item} title="详情" reload={action?.reload} />
|
|
||||||
{item.status !== 'Completed' && (
|
|
||||||
<WorkOrderUpdate
|
|
||||||
item={item}
|
|
||||||
reload={action?.reload}
|
|
||||||
title={title}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
{item.assign_status === 'Unassigned' && (
|
|
||||||
<WorkOrderAssign
|
|
||||||
item={item}
|
|
||||||
reload={action?.reload}
|
|
||||||
title="指派"
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<MyButtons.Delete
|
|
||||||
onConfirm={() =>
|
|
||||||
Apis.WorkOrder.HouseWorkOrders.SoftDelete({
|
|
||||||
id: item.id,
|
|
||||||
}).then(() => action?.reload())
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
),
|
|
||||||
}),
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -170,7 +170,7 @@ export default function Index({ title = '报事工单' }) {
|
|||||||
|
|
||||||
<MyButtons.Delete
|
<MyButtons.Delete
|
||||||
onConfirm={() =>
|
onConfirm={() =>
|
||||||
Apis.WorkOrder.HouseWorkOrders.SoftDelete({
|
Apis.WorkOrder.HouseWorkOrders.Delete({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
}).then(() => action?.reload())
|
}).then(() => action?.reload())
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,186 +0,0 @@
|
|||||||
import { MyButtons, MyColumns, MyProTableProps } from '@/common';
|
|
||||||
import { Apis } from '@/gen/Apis';
|
|
||||||
import {
|
|
||||||
HouseWorkOrdersAssignStatusEnum,
|
|
||||||
HouseWorkOrdersLevelEnum,
|
|
||||||
HouseWorkOrdersLocationEnum,
|
|
||||||
HouseWorkOrdersStatusEnum,
|
|
||||||
HouseWorkOrdersTypeEnum,
|
|
||||||
} from '@/gen/Enums';
|
|
||||||
import { ProTable } from '@ant-design/pro-components';
|
|
||||||
import { Image, Space } from 'antd';
|
|
||||||
import WorkOrderAssign from '../modals/WorkOrderAssign';
|
|
||||||
import WorkOrderShow from '../modals/WorkOrderShow';
|
|
||||||
import WorkOrderUpdate from '../modals/WorkOrderUpdate';
|
|
||||||
|
|
||||||
export default function Index({ title = '装修工单' }) {
|
|
||||||
return (
|
|
||||||
<ProTable
|
|
||||||
{...MyProTableProps.props}
|
|
||||||
headerTitle="装修工单"
|
|
||||||
request={async (params, sort) =>
|
|
||||||
MyProTableProps.request(
|
|
||||||
{
|
|
||||||
...params,
|
|
||||||
type: [
|
|
||||||
HouseWorkOrdersTypeEnum.RenovationInspection.value,
|
|
||||||
HouseWorkOrdersTypeEnum.RenovationAcceptance.value,
|
|
||||||
],
|
|
||||||
},
|
|
||||||
sort,
|
|
||||||
Apis.WorkOrder.HouseWorkOrders.List,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
// toolBarRender={(action) => [
|
|
||||||
// <WorkOrderCreate key="Create" reload={action?.reload} title={title} />,
|
|
||||||
// ]}
|
|
||||||
columns={[
|
|
||||||
MyColumns.ID({
|
|
||||||
search: false,
|
|
||||||
}),
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
title: '工单状态',
|
|
||||||
dataIndex: 'status',
|
|
||||||
valueEnum: HouseWorkOrdersStatusEnum,
|
|
||||||
}),
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
title: '工单类型',
|
|
||||||
dataIndex: 'type',
|
|
||||||
valueEnum: HouseWorkOrdersTypeEnum,
|
|
||||||
}),
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
title: '报修位置',
|
|
||||||
dataIndex: 'location',
|
|
||||||
valueEnum: HouseWorkOrdersLocationEnum,
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
title: '房屋信息',
|
|
||||||
dataIndex: ['asset_house', 'full_name'],
|
|
||||||
search: false,
|
|
||||||
ellipsis: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '工单描述',
|
|
||||||
dataIndex: 'content',
|
|
||||||
search: false,
|
|
||||||
width: 120, // 关键:固定列宽(若父容器过窄,可设 minWidth: 200 优先保证列宽)
|
|
||||||
render: (text) => (
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
width: '100%', // 继承列宽
|
|
||||||
// height: '60px', // 设置固定高度,约显示3行文本
|
|
||||||
overflow: 'hidden', // 超出隐藏
|
|
||||||
textOverflow: 'ellipsis', // 省略号
|
|
||||||
display: '-webkit-box',
|
|
||||||
WebkitBoxOrient: 'vertical',
|
|
||||||
WebkitLineClamp: 1, // 显示3行
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{text}
|
|
||||||
</div>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '附件',
|
|
||||||
dataIndex: 'attachments',
|
|
||||||
search: false,
|
|
||||||
render: (_, record) => {
|
|
||||||
if (
|
|
||||||
!Array.isArray(record.attachments) ||
|
|
||||||
record.attachments.length === 0
|
|
||||||
) {
|
|
||||||
return '无附件';
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 6 }}>
|
|
||||||
{record.attachments.map((item: any, index: number) => {
|
|
||||||
if (item.type && item.type.includes('image')) {
|
|
||||||
return (
|
|
||||||
<Image
|
|
||||||
key={index}
|
|
||||||
width={40}
|
|
||||||
height={30}
|
|
||||||
src={item.url}
|
|
||||||
style={{
|
|
||||||
marginRight: 8,
|
|
||||||
marginBottom: 8,
|
|
||||||
objectFit: 'cover',
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
} else if (item.type && item.type.includes('video')) {
|
|
||||||
return (
|
|
||||||
<video
|
|
||||||
key={index}
|
|
||||||
width={40}
|
|
||||||
height={30}
|
|
||||||
controls
|
|
||||||
style={{
|
|
||||||
marginRight: 8,
|
|
||||||
marginBottom: 8,
|
|
||||||
objectFit: 'cover',
|
|
||||||
}}
|
|
||||||
src={item.url}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
title: '分配状态',
|
|
||||||
dataIndex: 'assign_status',
|
|
||||||
valueEnum: HouseWorkOrdersAssignStatusEnum,
|
|
||||||
}),
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
title: '优先级',
|
|
||||||
dataIndex: 'level',
|
|
||||||
valueEnum: HouseWorkOrdersLevelEnum,
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
title: '处理人',
|
|
||||||
dataIndex: ['assign_employee', 'name'],
|
|
||||||
search: false,
|
|
||||||
render: (_, record) => {
|
|
||||||
return `${record?.assign_employee?.name || ''}-${
|
|
||||||
record?.assign_employee?.phone || ''
|
|
||||||
}`;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
MyColumns.CreatedAt(),
|
|
||||||
MyColumns.Option({
|
|
||||||
render: (_, item: any, index, action) => (
|
|
||||||
<Space key={index}>
|
|
||||||
<WorkOrderShow item={item} title="详情" reload={action?.reload} />
|
|
||||||
{item.status !== 'Completed' && (
|
|
||||||
<WorkOrderUpdate
|
|
||||||
item={item}
|
|
||||||
reload={action?.reload}
|
|
||||||
title={title}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
{item.assign_status === 'Unassigned' && (
|
|
||||||
<WorkOrderAssign
|
|
||||||
item={item}
|
|
||||||
reload={action?.reload}
|
|
||||||
title="指派"
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<MyButtons.Delete
|
|
||||||
onConfirm={() =>
|
|
||||||
Apis.WorkOrder.HouseWorkOrders.SoftDelete({
|
|
||||||
id: item.id,
|
|
||||||
}).then(() => action?.reload())
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
),
|
|
||||||
}),
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -172,7 +172,7 @@ export default function Index({ title = '工单管理' }) {
|
|||||||
)}
|
)}
|
||||||
<MyButtons.Delete
|
<MyButtons.Delete
|
||||||
onConfirm={() =>
|
onConfirm={() =>
|
||||||
Apis.WorkOrder.HouseWorkOrders.SoftDelete({
|
Apis.WorkOrder.HouseWorkOrders.Delete({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
}).then(() => action?.reload())
|
}).then(() => action?.reload())
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,183 +0,0 @@
|
|||||||
import { MyButtons, MyColumns, MyProTableProps } from '@/common';
|
|
||||||
import { Apis } from '@/gen/Apis';
|
|
||||||
import {
|
|
||||||
HouseWorkOrdersAssignStatusEnum,
|
|
||||||
HouseWorkOrdersLevelEnum,
|
|
||||||
HouseWorkOrdersLocationEnum,
|
|
||||||
HouseWorkOrdersStatusEnum,
|
|
||||||
HouseWorkOrdersTypeEnum,
|
|
||||||
} from '@/gen/Enums';
|
|
||||||
import { ProTable } from '@ant-design/pro-components';
|
|
||||||
import { Image, Space } from 'antd';
|
|
||||||
import WorkOrderAssign from '../modals/WorkOrderAssign';
|
|
||||||
import WorkOrderShow from '../modals/WorkOrderShow';
|
|
||||||
import WorkOrderUpdate from '../modals/WorkOrderUpdate';
|
|
||||||
|
|
||||||
export default function Index({ title = '安防巡检' }) {
|
|
||||||
return (
|
|
||||||
<ProTable
|
|
||||||
{...MyProTableProps.props}
|
|
||||||
headerTitle="安防巡检"
|
|
||||||
request={async (params, sort) =>
|
|
||||||
MyProTableProps.request(
|
|
||||||
{
|
|
||||||
...params,
|
|
||||||
type: [HouseWorkOrdersTypeEnum.SecurityInspection.value],
|
|
||||||
},
|
|
||||||
sort,
|
|
||||||
Apis.WorkOrder.HouseWorkOrders.List,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
// toolBarRender={(action) => [
|
|
||||||
// <WorkOrderCreate key="Create" reload={action?.reload} title={title} />,
|
|
||||||
// ]}
|
|
||||||
columns={[
|
|
||||||
MyColumns.ID({
|
|
||||||
search: false,
|
|
||||||
}),
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
title: '工单状态',
|
|
||||||
dataIndex: 'status',
|
|
||||||
valueEnum: HouseWorkOrdersStatusEnum,
|
|
||||||
}),
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
title: '工单类型',
|
|
||||||
dataIndex: 'type',
|
|
||||||
valueEnum: HouseWorkOrdersTypeEnum,
|
|
||||||
}),
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
title: '报修位置',
|
|
||||||
dataIndex: 'location',
|
|
||||||
valueEnum: HouseWorkOrdersLocationEnum,
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
title: '房屋信息',
|
|
||||||
dataIndex: ['asset_house', 'full_name'],
|
|
||||||
search: false,
|
|
||||||
ellipsis: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '工单描述',
|
|
||||||
dataIndex: 'content',
|
|
||||||
search: false,
|
|
||||||
width: 120, // 关键:固定列宽(若父容器过窄,可设 minWidth: 200 优先保证列宽)
|
|
||||||
render: (text) => (
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
width: '100%', // 继承列宽
|
|
||||||
// height: '60px', // 设置固定高度,约显示3行文本
|
|
||||||
overflow: 'hidden', // 超出隐藏
|
|
||||||
textOverflow: 'ellipsis', // 省略号
|
|
||||||
display: '-webkit-box',
|
|
||||||
WebkitBoxOrient: 'vertical',
|
|
||||||
WebkitLineClamp: 1, // 显示3行
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{text}
|
|
||||||
</div>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '附件',
|
|
||||||
dataIndex: 'attachments',
|
|
||||||
search: false,
|
|
||||||
render: (_, record) => {
|
|
||||||
if (
|
|
||||||
!Array.isArray(record.attachments) ||
|
|
||||||
record.attachments.length === 0
|
|
||||||
) {
|
|
||||||
return '无附件';
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 6 }}>
|
|
||||||
{record.attachments.map((item: any, index: number) => {
|
|
||||||
if (item.type && item.type.includes('image')) {
|
|
||||||
return (
|
|
||||||
<Image
|
|
||||||
key={index}
|
|
||||||
width={40}
|
|
||||||
height={30}
|
|
||||||
src={item.url}
|
|
||||||
style={{
|
|
||||||
marginRight: 8,
|
|
||||||
marginBottom: 8,
|
|
||||||
objectFit: 'cover',
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
} else if (item.type && item.type.includes('video')) {
|
|
||||||
return (
|
|
||||||
<video
|
|
||||||
key={index}
|
|
||||||
width={40}
|
|
||||||
height={30}
|
|
||||||
controls
|
|
||||||
style={{
|
|
||||||
marginRight: 8,
|
|
||||||
marginBottom: 8,
|
|
||||||
objectFit: 'cover',
|
|
||||||
}}
|
|
||||||
src={item.url}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
title: '分配状态',
|
|
||||||
dataIndex: 'assign_status',
|
|
||||||
valueEnum: HouseWorkOrdersAssignStatusEnum,
|
|
||||||
}),
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
title: '优先级',
|
|
||||||
dataIndex: 'level',
|
|
||||||
valueEnum: HouseWorkOrdersLevelEnum,
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
title: '处理人',
|
|
||||||
dataIndex: ['assign_employee', 'name'],
|
|
||||||
search: false,
|
|
||||||
render: (_, record) => {
|
|
||||||
return `${record?.assign_employee?.name || ''}-${
|
|
||||||
record?.assign_employee?.phone || ''
|
|
||||||
}`;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
MyColumns.CreatedAt(),
|
|
||||||
MyColumns.Option({
|
|
||||||
render: (_, item: any, index, action) => (
|
|
||||||
<Space key={index}>
|
|
||||||
<WorkOrderShow item={item} title="详情" reload={action?.reload} />
|
|
||||||
{item.status !== 'Completed' && (
|
|
||||||
<WorkOrderUpdate
|
|
||||||
item={item}
|
|
||||||
reload={action?.reload}
|
|
||||||
title={title}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
{item.assign_status === 'Unassigned' && (
|
|
||||||
<WorkOrderAssign
|
|
||||||
item={item}
|
|
||||||
reload={action?.reload}
|
|
||||||
title="指派"
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<MyButtons.Delete
|
|
||||||
onConfirm={() =>
|
|
||||||
Apis.WorkOrder.HouseWorkOrders.SoftDelete({
|
|
||||||
id: item.id,
|
|
||||||
}).then(() => action?.reload())
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
),
|
|
||||||
}),
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -201,8 +201,6 @@ export default function Index({ title = '工单管理' }) {
|
|||||||
)}
|
)}
|
||||||
{item.assign_status === 'Unassigned' &&
|
{item.assign_status === 'Unassigned' &&
|
||||||
(item.type === 'Complaint' ||
|
(item.type === 'Complaint' ||
|
||||||
item.type === 'RenovationInspection' ||
|
|
||||||
item.type === 'RenovationAcceptance' ||
|
|
||||||
item.type === 'SecurityInspection') && (
|
item.type === 'SecurityInspection') && (
|
||||||
<AssignQuick
|
<AssignQuick
|
||||||
item={item}
|
item={item}
|
||||||
@ -220,7 +218,7 @@ export default function Index({ title = '工单管理' }) {
|
|||||||
)}
|
)}
|
||||||
<MyButtons.Delete
|
<MyButtons.Delete
|
||||||
onConfirm={() =>
|
onConfirm={() =>
|
||||||
Apis.WorkOrder.HouseWorkOrders.SoftDelete({
|
Apis.WorkOrder.HouseWorkOrders.Delete({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
}).then(() => action?.reload())
|
}).then(() => action?.reload())
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,9 +37,8 @@ export default function Index({ title = '报修报事' }) {
|
|||||||
let obj: any = JSON.parse(
|
let obj: any = JSON.parse(
|
||||||
JSON.stringify(HouseWorkOrdersTypeEnum),
|
JSON.stringify(HouseWorkOrdersTypeEnum),
|
||||||
);
|
);
|
||||||
delete obj.RenovationAcceptance;
|
|
||||||
delete obj.EquipmentMaintenance;
|
delete obj.EquipmentMaintenance;
|
||||||
delete obj.RenovationInspection;
|
|
||||||
delete obj.Emergency;
|
delete obj.Emergency;
|
||||||
delete obj.EmergEquipmentMaintenancency;
|
delete obj.EmergEquipmentMaintenancency;
|
||||||
delete obj.SecurityInspection;
|
delete obj.SecurityInspection;
|
||||||
@ -59,23 +58,7 @@ export default function Index({ title = '报修报事' }) {
|
|||||||
<>
|
<>
|
||||||
{item.status === 'Pending' && (
|
{item.status === 'Pending' && (
|
||||||
<WorkOrderUpdate
|
<WorkOrderUpdate
|
||||||
item={{
|
item={item}
|
||||||
...item,
|
|
||||||
typeEnum: () => {
|
|
||||||
let obj: any = JSON.parse(
|
|
||||||
JSON.stringify(HouseWorkOrdersTypeEnum),
|
|
||||||
);
|
|
||||||
delete obj.RenovationAcceptance;
|
|
||||||
delete obj.EquipmentMaintenance;
|
|
||||||
delete obj.RenovationInspection;
|
|
||||||
delete obj.Emergency;
|
|
||||||
delete obj.EmergEquipmentMaintenancency;
|
|
||||||
delete obj.SecurityInspection;
|
|
||||||
delete obj.Complaint;
|
|
||||||
delete obj.QualityCheck;
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
reload={action?.reload}
|
reload={action?.reload}
|
||||||
title={title}
|
title={title}
|
||||||
/>
|
/>
|
||||||
@ -105,7 +88,7 @@ export default function Index({ title = '报修报事' }) {
|
|||||||
delete: (
|
delete: (
|
||||||
<MyButtons.Delete
|
<MyButtons.Delete
|
||||||
onConfirm={() =>
|
onConfirm={() =>
|
||||||
Apis.WorkOrder.HouseWorkOrders.SoftDelete({
|
Apis.WorkOrder.HouseWorkOrders.Delete({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
}).then(() => action?.reload())
|
}).then(() => action?.reload())
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,221 +0,0 @@
|
|||||||
import {
|
|
||||||
MyButtons,
|
|
||||||
MyColumns,
|
|
||||||
MyProTableProps,
|
|
||||||
useCurrentPermissions,
|
|
||||||
} from '@/common';
|
|
||||||
import { Selects } from '@/components/Select';
|
|
||||||
import { Apis } from '@/gen/Apis';
|
|
||||||
import {
|
|
||||||
HouseWorkOrdersAssignStatusEnum,
|
|
||||||
HouseWorkOrdersLevelEnum,
|
|
||||||
HouseWorkOrdersLocationEnum,
|
|
||||||
HouseWorkOrdersTypeEnum,
|
|
||||||
} from '@/gen/Enums';
|
|
||||||
import { ProTable } from '@ant-design/pro-components';
|
|
||||||
import { Space } from 'antd';
|
|
||||||
import WorkOrderAssign from '../list/modals/WorkOrderAssign';
|
|
||||||
import WorkOrderCreate from '../list/modals/WorkOrderCreate';
|
|
||||||
import WorkOrderShow from '../list/modals/WorkOrderShow';
|
|
||||||
import WorkOrderUpdate from '../list/modals/WorkOrderUpdate';
|
|
||||||
|
|
||||||
export const RenovationWorkOrdersStatusEnum = {
|
|
||||||
Pending: { text: '待处理', color: '#FFA500', value: 'Pending' },
|
|
||||||
Processing: { text: '处理中', color: '#1E90FF', value: 'Processing' },
|
|
||||||
Completed: { text: '已完成', color: '#28A745', value: 'Completed' },
|
|
||||||
Closed: { text: '已关闭', color: '#6C757D', value: 'Closed' },
|
|
||||||
};
|
|
||||||
|
|
||||||
export default function Index({ title = '装修工单' }) {
|
|
||||||
const getCurrentPermissions = useCurrentPermissions();
|
|
||||||
let toolBarRender = (action: any) => {
|
|
||||||
return getCurrentPermissions({
|
|
||||||
add: (
|
|
||||||
<WorkOrderCreate
|
|
||||||
key="Create"
|
|
||||||
reload={action?.reload}
|
|
||||||
title={title}
|
|
||||||
item={{
|
|
||||||
typeEnum: WorkTypeEnum,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
let tableRender = (item: any, action: any) => {
|
|
||||||
return getCurrentPermissions(
|
|
||||||
{
|
|
||||||
show: (
|
|
||||||
<WorkOrderShow item={item} title="详情" reload={action?.reload} />
|
|
||||||
),
|
|
||||||
assign: (
|
|
||||||
<>
|
|
||||||
{item.assign_status === 'Unassigned' &&
|
|
||||||
item.type !== 'SecurityInspection' && (
|
|
||||||
<WorkOrderAssign
|
|
||||||
item={item}
|
|
||||||
reload={action?.reload}
|
|
||||||
title="指派"
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
),
|
|
||||||
update: (
|
|
||||||
<>
|
|
||||||
{item.status === 'Pending' && (
|
|
||||||
<WorkOrderUpdate
|
|
||||||
item={{
|
|
||||||
...item,
|
|
||||||
typeEnum: WorkTypeEnum,
|
|
||||||
}}
|
|
||||||
reload={action?.reload}
|
|
||||||
title={title}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
),
|
|
||||||
delete: (
|
|
||||||
<MyButtons.Delete
|
|
||||||
onConfirm={() =>
|
|
||||||
Apis.WorkOrder.HouseWorkOrders.SoftDelete({
|
|
||||||
id: item.id,
|
|
||||||
}).then(() => action?.reload())
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
'MyDecorationWorkorder',
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const WorkTypeEnum: any = () => {
|
|
||||||
let obj: any = JSON.parse(JSON.stringify(HouseWorkOrdersTypeEnum));
|
|
||||||
delete obj.Repair;
|
|
||||||
delete obj.Incident;
|
|
||||||
delete obj.Complaint;
|
|
||||||
delete obj.RenovationInspection;
|
|
||||||
delete obj.RenovationAcceptance;
|
|
||||||
delete obj.Emergency;
|
|
||||||
delete obj.EquipmentMaintenance;
|
|
||||||
delete obj.QualityCheck;
|
|
||||||
return obj;
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<ProTable<Record<any, any>>
|
|
||||||
{...MyProTableProps.props}
|
|
||||||
headerTitle={title}
|
|
||||||
request={async (params, sort) => {
|
|
||||||
return MyProTableProps.request(
|
|
||||||
{
|
|
||||||
...params,
|
|
||||||
type: [HouseWorkOrdersTypeEnum.SecurityInspection.value],
|
|
||||||
},
|
|
||||||
sort,
|
|
||||||
Apis.WorkOrder.HouseWorkOrders.List,
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
toolBarRender={(action) => [toolBarRender(action)]}
|
|
||||||
columns={[
|
|
||||||
MyColumns.ID({ search: false }),
|
|
||||||
Selects?.AssetProjects({
|
|
||||||
title: '选择项目',
|
|
||||||
key: 'asset_projects_id',
|
|
||||||
hidden: true,
|
|
||||||
}),
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
title: '处理状态',
|
|
||||||
dataIndex: 'status',
|
|
||||||
valueEnum: RenovationWorkOrdersStatusEnum,
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
title: '项目名称',
|
|
||||||
dataIndex: 'project_name',
|
|
||||||
hidden: true,
|
|
||||||
},
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
title: '分配状态',
|
|
||||||
dataIndex: 'assign_status',
|
|
||||||
valueEnum: HouseWorkOrdersAssignStatusEnum,
|
|
||||||
}),
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
title: '工单类型',
|
|
||||||
dataIndex: 'type',
|
|
||||||
valueEnum: HouseWorkOrdersTypeEnum,
|
|
||||||
search: false,
|
|
||||||
}),
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
title: '报修位置',
|
|
||||||
dataIndex: 'location',
|
|
||||||
valueEnum: HouseWorkOrdersLocationEnum,
|
|
||||||
search: false,
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
title: '位置信息',
|
|
||||||
dataIndex: ['asset_house', 'full_name'],
|
|
||||||
render: (_, record) => {
|
|
||||||
return (
|
|
||||||
<Space>
|
|
||||||
{record?.asset_house?.full_name
|
|
||||||
? record?.asset_house?.full_name
|
|
||||||
: record?.asset_project?.name}
|
|
||||||
</Space>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
search: {
|
|
||||||
transform: (value) => {
|
|
||||||
return { house_name: value };
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '工单描述',
|
|
||||||
dataIndex: 'content',
|
|
||||||
search: false,
|
|
||||||
width: 120, // 关键:固定列宽(若父容器过窄,可设 minWidth: 200 优先保证列宽)
|
|
||||||
render: (text) => (
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
width: '100%', // 继承列宽
|
|
||||||
// height: '60px', // 设置固定高度,约显示3行文本
|
|
||||||
overflow: 'hidden', // 超出隐藏
|
|
||||||
textOverflow: 'ellipsis', // 省略号
|
|
||||||
display: '-webkit-box',
|
|
||||||
WebkitBoxOrient: 'vertical',
|
|
||||||
WebkitLineClamp: 1, // 显示3行
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{text}
|
|
||||||
</div>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
title: '优先级',
|
|
||||||
dataIndex: 'level',
|
|
||||||
valueEnum: HouseWorkOrdersLevelEnum,
|
|
||||||
search: false,
|
|
||||||
}),
|
|
||||||
|
|
||||||
{
|
|
||||||
title: '处理人',
|
|
||||||
dataIndex: ['assign_employee', 'name'],
|
|
||||||
search: false,
|
|
||||||
render: (_, record) => {
|
|
||||||
return `${record?.assign_employee?.name || ''}-${
|
|
||||||
record?.assign_employee?.phone || ''
|
|
||||||
}`;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
MyColumns.CreatedAt(),
|
|
||||||
MyColumns.Option({
|
|
||||||
render: (_, item: any, index, action) => (
|
|
||||||
<Space key={index}>
|
|
||||||
<>{tableRender(item, action)}</>
|
|
||||||
</Space>
|
|
||||||
),
|
|
||||||
}),
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,223 +0,0 @@
|
|||||||
import {
|
|
||||||
MyButtons,
|
|
||||||
MyColumns,
|
|
||||||
MyProTableProps,
|
|
||||||
useCurrentPermissions,
|
|
||||||
} from '@/common';
|
|
||||||
import { Selects } from '@/components/Select';
|
|
||||||
import { Apis } from '@/gen/Apis';
|
|
||||||
import {
|
|
||||||
HouseWorkOrdersAssignStatusEnum,
|
|
||||||
HouseWorkOrdersLevelEnum,
|
|
||||||
HouseWorkOrdersTypeEnum,
|
|
||||||
} from '@/gen/Enums';
|
|
||||||
import { ProTable } from '@ant-design/pro-components';
|
|
||||||
import { Space } from 'antd';
|
|
||||||
import WorkOrderCreate from '../list/modals/WorkOrderCreate';
|
|
||||||
import WorkOrderShow from '../list/modals/WorkOrderShow';
|
|
||||||
import WorkOrderUpdate from '../list/modals/WorkOrderUpdate';
|
|
||||||
import RenovationAssign from './modals/RenovationAssign';
|
|
||||||
|
|
||||||
export const RenovationWorkOrdersStatusEnum = {
|
|
||||||
Pending: { text: '待处理', color: '#FFA500', value: 'Pending' },
|
|
||||||
Processing: { text: '处理中', color: '#1E90FF', value: 'Processing' },
|
|
||||||
Completed: { text: '已完成', color: '#28A745', value: 'Completed' },
|
|
||||||
Closed: { text: '已关闭', color: '#6C757D', value: 'Closed' },
|
|
||||||
};
|
|
||||||
|
|
||||||
export default function Index({ title = '装修工单' }) {
|
|
||||||
const getCurrentPermissions = useCurrentPermissions();
|
|
||||||
let toolBarRender = (action: any) => {
|
|
||||||
return getCurrentPermissions({
|
|
||||||
add: (
|
|
||||||
<WorkOrderCreate
|
|
||||||
key="Create"
|
|
||||||
reload={action?.reload}
|
|
||||||
title={title}
|
|
||||||
item={{
|
|
||||||
typeEnum: WorkTypeEnum,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
let tableRender = (item: any, action: any) => {
|
|
||||||
return getCurrentPermissions(
|
|
||||||
{
|
|
||||||
show: (
|
|
||||||
<WorkOrderShow item={item} title="详情" reload={action?.reload} />
|
|
||||||
),
|
|
||||||
|
|
||||||
update: (
|
|
||||||
<>
|
|
||||||
{item.status === 'Pending' && (
|
|
||||||
<WorkOrderUpdate
|
|
||||||
item={{
|
|
||||||
...item,
|
|
||||||
typeEnum: WorkTypeEnum,
|
|
||||||
}}
|
|
||||||
reload={action?.reload}
|
|
||||||
title={title}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
),
|
|
||||||
assign: (
|
|
||||||
<>
|
|
||||||
{item.assign_status === 'Unassigned' &&
|
|
||||||
item.type !== 'SecurityInspection' && (
|
|
||||||
<RenovationAssign
|
|
||||||
item={item}
|
|
||||||
reload={action?.reload}
|
|
||||||
title="指派"
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
),
|
|
||||||
delete: (
|
|
||||||
<MyButtons.Delete
|
|
||||||
onConfirm={() =>
|
|
||||||
Apis.WorkOrder.HouseWorkOrders.SoftDelete({
|
|
||||||
id: item.id,
|
|
||||||
}).then(() => action?.reload())
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
'MyDecorationWorkorder',
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const WorkTypeEnum = () => {
|
|
||||||
let obj: any = JSON.parse(JSON.stringify(HouseWorkOrdersTypeEnum));
|
|
||||||
delete obj.Repair;
|
|
||||||
delete obj.Incident;
|
|
||||||
delete obj.Complaint;
|
|
||||||
delete obj.SecurityInspection;
|
|
||||||
delete obj.Emergency;
|
|
||||||
delete obj.EquipmentMaintenance;
|
|
||||||
delete obj.QualityCheck;
|
|
||||||
return obj;
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<ProTable<Record<any, any>>
|
|
||||||
{...MyProTableProps.props}
|
|
||||||
headerTitle={title}
|
|
||||||
request={async (params, sort) => {
|
|
||||||
return MyProTableProps.request(
|
|
||||||
{
|
|
||||||
...params,
|
|
||||||
type: [
|
|
||||||
HouseWorkOrdersTypeEnum.RenovationInspection.value,
|
|
||||||
HouseWorkOrdersTypeEnum.RenovationAcceptance.value,
|
|
||||||
],
|
|
||||||
},
|
|
||||||
sort,
|
|
||||||
Apis.WorkOrder.HouseWorkOrders.List,
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
toolBarRender={(action) => [toolBarRender(action)]}
|
|
||||||
columns={[
|
|
||||||
MyColumns.ID({ search: false }),
|
|
||||||
Selects?.AssetProjects({
|
|
||||||
title: '选择项目',
|
|
||||||
key: 'asset_projects_id',
|
|
||||||
hidden: true,
|
|
||||||
}),
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
title: '处理状态',
|
|
||||||
dataIndex: 'status',
|
|
||||||
valueEnum: RenovationWorkOrdersStatusEnum,
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
title: '项目名称',
|
|
||||||
dataIndex: 'project_name',
|
|
||||||
hidden: true,
|
|
||||||
},
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
title: '分配状态',
|
|
||||||
dataIndex: 'assign_status',
|
|
||||||
valueEnum: HouseWorkOrdersAssignStatusEnum,
|
|
||||||
}),
|
|
||||||
// MyColumns.EnumTag({
|
|
||||||
// title: '工单类型',
|
|
||||||
// dataIndex: 'type',
|
|
||||||
// valueEnum: HouseWorkOrdersTypeEnum,
|
|
||||||
// search: false,
|
|
||||||
// }),
|
|
||||||
// MyColumns.EnumTag({
|
|
||||||
// title: '报修位置',
|
|
||||||
// dataIndex: 'location',
|
|
||||||
// valueEnum: HouseWorkOrdersLocationEnum,
|
|
||||||
// search: false,
|
|
||||||
// }),
|
|
||||||
{
|
|
||||||
title: '位置信息',
|
|
||||||
dataIndex: ['asset_house', 'full_name'],
|
|
||||||
render: (_, record) => {
|
|
||||||
return (
|
|
||||||
<Space>
|
|
||||||
{record?.asset_house?.full_name
|
|
||||||
? record?.asset_house?.full_name
|
|
||||||
: record?.asset_project?.name}
|
|
||||||
</Space>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
search: {
|
|
||||||
transform: (value) => {
|
|
||||||
return { house_name: value };
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
// {
|
|
||||||
// title: '工单描述',
|
|
||||||
// dataIndex: 'content',
|
|
||||||
// search: false,
|
|
||||||
// width: 200, // 关键:固定列宽(若父容器过窄,可设 minWidth: 200 优先保证列宽)
|
|
||||||
// render: (text) => (
|
|
||||||
// <div
|
|
||||||
// style={{
|
|
||||||
// width: '100%', // 继承列宽
|
|
||||||
// // height: '60px', // 设置固定高度,约显示3行文本
|
|
||||||
// overflow: 'hidden', // 超出隐藏
|
|
||||||
// textOverflow: 'ellipsis', // 省略号
|
|
||||||
// display: '-webkit-box',
|
|
||||||
// WebkitBoxOrient: 'vertical',
|
|
||||||
// WebkitLineClamp: 3, // 显示3行
|
|
||||||
// }}
|
|
||||||
// >
|
|
||||||
// {text}
|
|
||||||
// </div>
|
|
||||||
// ),
|
|
||||||
// },
|
|
||||||
MyColumns.EnumTag({
|
|
||||||
title: '优先级',
|
|
||||||
dataIndex: 'level',
|
|
||||||
valueEnum: HouseWorkOrdersLevelEnum,
|
|
||||||
search: false,
|
|
||||||
}),
|
|
||||||
|
|
||||||
{
|
|
||||||
title: '处理人',
|
|
||||||
dataIndex: ['assign_employee', 'name'],
|
|
||||||
search: false,
|
|
||||||
render: (_, record) => {
|
|
||||||
return `${record?.assign_employee?.name || ''}-${
|
|
||||||
record?.assign_employee?.phone || ''
|
|
||||||
}`;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
MyColumns.CreatedAt(),
|
|
||||||
MyColumns.Option({
|
|
||||||
render: (_, item: any, index, action) => (
|
|
||||||
<Space key={index}>
|
|
||||||
<>{tableRender(item, action)}</>
|
|
||||||
</Space>
|
|
||||||
),
|
|
||||||
}),
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,129 +0,0 @@
|
|||||||
import {
|
|
||||||
MyBetaModalFormProps,
|
|
||||||
MyButtons,
|
|
||||||
MyFormItems,
|
|
||||||
MyModalFormProps,
|
|
||||||
rulesHelper,
|
|
||||||
} from '@/common';
|
|
||||||
import { Selects } from '@/components/Select';
|
|
||||||
import { Apis } from '@/gen/Apis';
|
|
||||||
import { HouseWorkOrdersTypeEnum } from '@/gen/Enums';
|
|
||||||
import { BetaSchemaForm } from '@ant-design/pro-components';
|
|
||||||
import { Form, message } from 'antd';
|
|
||||||
|
|
||||||
export default function WorkOrderAssign(
|
|
||||||
props: MyBetaModalFormProps & { item: any },
|
|
||||||
) {
|
|
||||||
const [form] = Form.useForm();
|
|
||||||
return (
|
|
||||||
<BetaSchemaForm<ApiTypes.WorkOrder.HouseWorkOrders.Assign>
|
|
||||||
{...MyModalFormProps.props}
|
|
||||||
title={`指派工单`}
|
|
||||||
wrapperCol={{ span: 19 }}
|
|
||||||
width="600px"
|
|
||||||
layout="horizontal"
|
|
||||||
labelCol={{ span: 5 }}
|
|
||||||
labelAlign="left"
|
|
||||||
trigger={
|
|
||||||
<MyButtons.Default title={props.title || '指派'} type="primary" />
|
|
||||||
}
|
|
||||||
key={new Date().getTime()}
|
|
||||||
form={form}
|
|
||||||
request={async () => {
|
|
||||||
const res = await Apis.WorkOrder.HouseWorkOrders.Show({
|
|
||||||
id: props.item.id,
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
title: res.data.title,
|
|
||||||
assign_employee_id: res.data.assign_employee_id,
|
|
||||||
content: res.data.content,
|
|
||||||
attachments: res.data.attachments,
|
|
||||||
complaint_type: res.data.complaint_type,
|
|
||||||
locationInfo: res.data.asset_house.full_name,
|
|
||||||
};
|
|
||||||
}}
|
|
||||||
onFinish={async (values: any) => {
|
|
||||||
Apis.WorkOrder.HouseWorkOrders.Assign({
|
|
||||||
...values,
|
|
||||||
id: props.item.id,
|
|
||||||
predict_complete_at: values.predict_complete_at,
|
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
props.reload?.();
|
|
||||||
message.success('指派工单成功');
|
|
||||||
return true;
|
|
||||||
})
|
|
||||||
.catch(() => false);
|
|
||||||
}}
|
|
||||||
columns={[
|
|
||||||
MyFormItems.EnumRadio({
|
|
||||||
key: 'type',
|
|
||||||
title: '工单类型',
|
|
||||||
colProps: { span: 24 },
|
|
||||||
valueEnum: HouseWorkOrdersTypeEnum,
|
|
||||||
readonly: true,
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
key: 'locationInfo',
|
|
||||||
title: '房屋信息',
|
|
||||||
colProps: { span: 24 },
|
|
||||||
readonly: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'content',
|
|
||||||
title: '工单描述',
|
|
||||||
colProps: { span: 24 },
|
|
||||||
readonly: true,
|
|
||||||
fieldProps: {
|
|
||||||
disabled: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ valueType: 'divider' },
|
|
||||||
|
|
||||||
// MyFormItems.EnumRadio({
|
|
||||||
// key: 'level',
|
|
||||||
// title: '优先级',
|
|
||||||
// colProps: { span: 24 },
|
|
||||||
// valueEnum: HouseWorkOrdersLevelEnum,
|
|
||||||
// required: true,
|
|
||||||
// }),
|
|
||||||
// {
|
|
||||||
// key: 'predict_complete_at',
|
|
||||||
// title: '完成时间要求',
|
|
||||||
// valueType: 'date',
|
|
||||||
// colProps: { span: 24 },
|
|
||||||
// formItemProps: { ...rulesHelper.text },
|
|
||||||
// fieldProps: {
|
|
||||||
// disabledDate: (current: any) => {
|
|
||||||
// // 只能选今天及以后的日期
|
|
||||||
// const today = new Date();
|
|
||||||
// today.setHours(0, 0, 0, 0); // 设置为今天的00:00:00
|
|
||||||
// return current && current < today;
|
|
||||||
// },
|
|
||||||
// addonAfter: '前',
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
Selects?.Employees({
|
|
||||||
title: '选择处理人',
|
|
||||||
key: 'assign_employees_id',
|
|
||||||
colProps: { span: 24 },
|
|
||||||
formItemProps: { ...rulesHelper.text },
|
|
||||||
params: {
|
|
||||||
companies_id: props.item.companies_id,
|
|
||||||
},
|
|
||||||
required: true,
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
key: 'assign_remark',
|
|
||||||
title: '备注',
|
|
||||||
valueType: 'textarea',
|
|
||||||
colProps: { span: 24 },
|
|
||||||
fieldProps: {
|
|
||||||
rows: 3,
|
|
||||||
// placeholder: '请输入指派备注(可选)',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user