fix:更新金刚区1
All checks were successful
Build and Push Docker Image / build (push) Successful in 3m39s

This commit is contained in:
Your Name 2026-01-28 18:25:20 +08:00
parent 4c4992d8d5
commit 5644ee4325
4 changed files with 286 additions and 3 deletions

View File

@ -0,0 +1,89 @@
import {
MyBetaModalFormProps,
MyButtons,
MyFormItems,
MyModalFormProps,
rulesHelper,
} from '@/common';
import { Apis } from '@/gen/Apis';
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.Company.CompanyQuickActions.Store>
{...MyModalFormProps.props}
title="添加金刚区"
wrapperCol={{ span: 24 }}
width="600px"
trigger={<MyButtons.Create title="添加金刚区" />}
key={new Date().getTime()}
form={form}
onOpenChange={(open: any) => {
if (open) {
form.resetFields(); // 清空表单数据
}
}}
onFinish={async (values: any) =>
Apis.Company.CompanyQuickActions.Store({
...values,
is_show: values?.is_show || 0,
is_bind_house: values?.is_bind_house || 0,
companies_id: props?.item?.id,
})
.then(() => {
props.reload?.();
message.success('添加成功!');
return true;
})
.catch(() => false)
}
columns={[
{
key: 'name',
title: '名称',
colProps: { span: 24 },
formItemProps: { ...rulesHelper.text },
},
{
key: 'skip_url',
title: '跳转链接',
colProps: { span: 24 },
formItemProps: { ...rulesHelper.text },
},
{
key: 'sort',
title: '排序',
tooltip: '越小越靠前',
valueType: 'digit',
colProps: { span: 8 },
fieldProps: {
style: { width: '100%' },
},
},
{
title: '是否显示',
key: 'is_show',
valueType: 'switch',
colProps: { span: 8 },
},
{
title: '是否要绑房打开',
key: 'is_bind_house',
tooltip: '是:必须绑房后才能使用功能,否:不绑房也可以使用当前功能',
valueType: 'switch',
colProps: { span: 8 },
},
MyFormItems.UploadImages({
key: 'icon',
title: '图标',
max: 1,
colProps: { span: 24 },
formItemProps: { ...rulesHelper.array },
}),
]}
/>
);
}

View File

@ -0,0 +1,90 @@
import {
MyBetaModalFormProps,
MyButtons,
MyFormItems,
MyModalFormProps,
rulesHelper,
} from '@/common';
import { Apis } from '@/gen/Apis';
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.Company.CompanyQuickActions.Update>
{...MyModalFormProps.props}
title="编辑金刚区"
wrapperCol={{ span: 24 }}
width="600px"
trigger={<MyButtons.Edit title="编辑" />}
key={new Date().getTime()}
form={form}
onOpenChange={(open: any) => {
if (open && props.item) {
form.setFieldsValue(props.item);
}
}}
onFinish={async (values: any) =>
Apis.Company.CompanyQuickActions.Update({
...values,
is_show: values?.is_show || 0,
is_bind_house: values?.is_bind_house || 0,
companies_id: props?.item?.companies_id,
id: props?.item?.id ?? 0,
})
.then(() => {
props.reload?.();
message.success('编辑成功!');
return true;
})
.catch(() => false)
}
columns={[
{
key: 'name',
title: '名称',
colProps: { span: 24 },
formItemProps: { ...rulesHelper.text },
},
{
key: 'skip_url',
title: '跳转链接',
colProps: { span: 24 },
formItemProps: { ...rulesHelper.text },
},
{
key: 'sort',
title: '排序',
tooltip: '越小越靠前',
valueType: 'digit',
colProps: { span: 8 },
fieldProps: {
style: { width: '100%' },
},
},
{
title: '是否显示',
key: 'is_show',
valueType: 'switch',
colProps: { span: 8 },
},
{
title: '是否要绑房打开',
key: 'is_bind_house',
tooltip: '是:必须绑房后才能使用功能,否:不绑房也可以使用当前功能',
valueType: 'switch',
colProps: { span: 8 },
},
MyFormItems.UploadImages({
key: 'icon',
title: '图标',
max: 1,
colProps: { span: 24 },
formItemProps: { ...rulesHelper.array },
}),
]}
/>
);
}

View File

@ -0,0 +1,95 @@
import {
MyButtons,
MyColumns,
MyPageContainer,
MyProTableProps,
} from '@/common';
import { Apis } from '@/gen/Apis';
import { ProTable } from '@ant-design/pro-components';
import { useSearchParams } from '@umijs/max';
import { Space } from 'antd';
import Create from '../modals/JinGangQuCreate';
import Update from '../modals/JinGangQuUpdate';
export default function Index({ title = '金刚区配置' }) {
const [searchParams] = useSearchParams();
return (
<MyPageContainer
title={title}
enableTabs={true}
tabKey={`company-set-gan-info-${searchParams.get('id')}`}
tabLabel={title}
>
<ProTable
{...MyProTableProps.props}
request={async (params, sort) =>
MyProTableProps.request(
{ ...params, companies_id: searchParams.get('id') },
sort,
Apis.Company.CompanyQuickActions.List,
)
}
bordered
toolBarRender={(action) => [
<Create
key="Create"
reload={action?.reload}
item={{ id: searchParams.get('id') }}
title={title}
/>,
]}
search={false}
columns={[
MyColumns.ID(),
{
title: '标题',
dataIndex: 'name',
},
{
title: '跳转地址',
dataIndex: 'skip_url',
},
MyColumns.Boolean({
title: '是否显示',
dataIndex: 'is_show',
}),
MyColumns.Boolean({
title: '是否要绑房',
dataIndex: 'is_bind_house',
}),
{
title: '图标',
dataIndex: 'icon',
search: false,
render: (_, item) => (
<img
src={item?.icon?.[0]?.url || ''}
alt="图标"
style={{ width: 40, height: 40 }}
/>
),
},
{
title: '排序',
dataIndex: 'sort',
},
MyColumns.CreatedAt(),
MyColumns.Option({
render: (_, item: any, index, action) => (
<Space>
<Update item={item} reload={action?.reload} title={title} />
<MyButtons.Delete
onConfirm={() =>
Apis.Company.CompanyQuickActions.Delete({
id: item.id,
}).then(() => action?.reload())
}
/>
</Space>
),
}),
]}
/>
</MyPageContainer>
);
}

View File

@ -28,18 +28,27 @@ export default function CustomerEnd(props: MyBetaModalFormProps) {
</div>
</ProCard>
{/* <ProCard
<ProCard
title="金刚区图标配置"
type="inner"
bordered
extra={
<MyButtons.Default title="去配置" type="primary" size="small" />
<MyButtons.Default
title="去配置"
type="primary"
size="small"
onClick={() => {
navigate(
`/company/list/pages/set_gan_info?id=${props?.item?.id}`,
);
}}
/>
}
>
<div style={{ height: '80px' }}>
</div>
</ProCard> */}
</ProCard>
</ProCard>
</div>
);