ERPTurbo_Admin/packages/app-operation/src/components/Channel/ChannelList.tsx
shenyifei 7260b089e9 refactor(material): 重构素材库组件实现
- 移除旧的 MaterialList 组件相关配置和引用
- 删除 formatParam 工具函数的不必要导入
- 新增 MaterialLibraryModal 和 CategoryTree 组件
- 将 UploadMaterial 组件重构为使用新的素材库选择方式
- 实现素材分类树的菜单展示和选择功能
- 添加素材库弹窗的图片和列表两种视图模式
- 集成素材选择、预览和确认功能
- 移除各组件中对旧 MaterialList 的依赖配置
2026-01-07 11:25:50 +08:00

221 lines
4.7 KiB
TypeScript

import {
BizContainer,
BizValueType,
ProFormUploadMaterial,
} from '@/components';
import { business } from '@/services';
import { useIntl } from '@@/exports';
import {
ProColumns,
ProFormText,
ProFormTextArea,
} from '@ant-design/pro-components';
import { ProDescriptionsItemProps } from '@ant-design/pro-descriptions';
export default function ChannelList() {
const intl = useIntl();
const intlPrefix = 'channel';
const formContext = [
<ProFormText
key={'title'}
name={'title'}
label={intl.formatMessage({ id: intlPrefix + '.form.title.label' })}
required={true}
placeholder={intl.formatMessage({
id: intlPrefix + '.form.title.placeholder',
})}
rules={[
{
required: true,
message: intl.formatMessage({
id: intlPrefix + '.form.title.required',
}),
},
]}
/>,
<ProFormTextArea
key={'subTitle'}
name={'subTitle'}
label={intl.formatMessage({ id: intlPrefix + '.form.subTitle.label' })}
required={true}
placeholder={intl.formatMessage({
id: intlPrefix + '.form.subTitle.placeholder',
})}
rules={[
{
required: true,
message: intl.formatMessage({
id: intlPrefix + '.form.subTitle.required',
}),
},
]}
/>,
<ProFormText
key={'domain'}
name={'domain'}
label={intl.formatMessage({ id: intlPrefix + '.form.domain.label' })}
required={true}
placeholder={intl.formatMessage({
id: intlPrefix + '.form.domain.placeholder',
})}
rules={[
{
required: true,
message: intl.formatMessage({
id: intlPrefix + '.form.domain.required',
}),
},
]}
/>,
<ProFormUploadMaterial
key={'logo'}
label={intl.formatMessage({
id: intlPrefix + '.form.logo.label',
})}
name={'logoList'}
transform={(value) => {
return {
logoList: value,
logo: value[0],
};
}}
fieldProps={{
maxCount: 1,
}}
/>,
<ProFormUploadMaterial
key={'backgroundImageUrl'}
label={intl.formatMessage({
id: intlPrefix + '.form.backgroundImageUrl.label',
})}
name={'backgroundImageUrlList'}
transform={(value) => {
return {
backgroundImageUrlList: value,
backgroundImageUrl: value[0],
};
}}
fieldProps={{
maxCount: 1,
}}
/>,
<ProFormText
key={'technicalSupport'}
name={'technicalSupport'}
label={intl.formatMessage({
id: intlPrefix + '.form.technicalSupport.label',
})}
required={true}
placeholder={intl.formatMessage({
id: intlPrefix + '.form.technicalSupport.placeholder',
})}
rules={[
{
required: true,
message: intl.formatMessage({
id: intlPrefix + '.form.technicalSupport.required',
}),
},
]}
/>,
];
const columns: ProColumns<BusinessAPI.ChannelVO, BizValueType>[] = [
{
title: intl.formatMessage({ id: intlPrefix + '.column.logo' }),
dataIndex: 'logo',
valueType: 'image',
hideInSearch: true,
},
{
title: intl.formatMessage({ id: intlPrefix + '.column.title' }),
dataIndex: 'title',
},
{
title: intl.formatMessage({ id: intlPrefix + '.column.subTitle' }),
dataIndex: 'subTitle',
hideInSearch: true,
},
{
title: intl.formatMessage({ id: intlPrefix + '.column.domain' }),
dataIndex: 'domain',
valueType: 'text',
hideInSearch: true,
},
{
title: intl.formatMessage({
id: intlPrefix + '.column.backgroundImageUrl',
}),
dataIndex: 'backgroundImageUrl',
valueType: 'image',
hideInSearch: true,
},
{
title: intl.formatMessage({
id: intlPrefix + '.column.technicalSupport',
}),
dataIndex: 'technicalSupport',
hideInSearch: true,
},
{
title: intl.formatMessage({ id: intlPrefix + '.column.createdAt' }),
dataIndex: 'createdAt',
valueType: 'dateTime',
hideInSearch: true,
},
];
const detailColumns: ProDescriptionsItemProps<
BusinessAPI.ChannelVO,
BizValueType
>[] = columns as ProDescriptionsItemProps<
BusinessAPI.ChannelVO,
BizValueType
>[];
return (
<BizContainer<
typeof business.channel,
BusinessAPI.ChannelVO,
BusinessAPI.ChannelPageQry,
BusinessAPI.ChannelCreateCmd,
BusinessAPI.ChannelUpdateCmd
>
rowKey={'channelId'}
permission={'operation-channel'}
func={business.channel}
method={'channel'}
methodUpper={'Channel'}
intlPrefix={intlPrefix}
modeType={'page'}
container={{}}
page={{
fieldProps: {},
columns,
}}
create={{
formType: 'drawer',
formContext,
}}
update={{
formType: 'drawer',
formContext,
// @ts-ignore
transform: (value) => {
return {
...value,
backgroundImageUrlList: [value.backgroundImageUrl],
logoList: [value.logo],
};
},
}}
destroy={{}}
detail={{
formType: 'drawer',
columns: detailColumns,
}}
/>
);
}