Compare commits

...

22 Commits
master ... 2.0

Author SHA1 Message Date
LiuJiaNan 98d0ca5ecf 2.0.9 2026-06-27 16:31:33 +08:00
LiuJiaNan 7f9d837d70 docs(readme): 丰富并完善组件库文档内容 2026-06-27 11:25:13 +08:00
LiuJiaNan d161defcfc fix(PreviewImg): 修正图片组件样式属性名称
- 将Image组件的样式属性由wrapperStyle改为styles
- 更新styles属性值结构,添加root对象包裹样式
- 修正样式生效问题,确保图片边距正确显示
2026-06-26 14:57:57 +08:00
LiuJiaNan f9d8c02b8a 2.0.8 2026-06-26 10:37:14 +08:00
LiuJiaNan 233aab315b refactor(uploadFile): 调整aqd文件上传类型枚举及相关hook适配
- 将aqd上传类型枚举KEY由1调整为1000,保持唯一且合理
- useGetFile hook支持同时校验gwj和aqd两套上传类型枚举
- useUploadFile hook支持同时根据gwj和aqd两套上传枚举获取路径和类型校验
- 修正相关导入和使用,避免因枚举冲突导致逻辑错误
2026-06-26 10:37:03 +08:00
LiuJiaNan dc93ad7edf 2.0.7 2026-06-26 10:09:36 +08:00
LiuJiaNan d9beea6669 style(form): 调整底部固定按钮和FormItemsRenderer渲染逻辑
- 提升 FormBuilder 和 Page 组件底部操作区 zIndex,解决遮挡问题
- FormItemsRenderer 添加对隐藏项的支持,避免渲染隐藏表单项
- 优化动态表单项渲染顺序,确保联动机制及时生效
- 重构 renderDynamicFormItem,统一渲染动态更新表单项逻辑
- 新增上传文件类型及路径枚举,规范文件上传类型管理
- 补充完善组件库文档,增加使用说明和类型定义注释
2026-06-26 10:04:03 +08:00
LiuJiaNan f5753e779d 2.0.6 2026-06-24 14:33:32 +08:00
LiuJiaNan 8566185de1 feat(history): 支持自定义历史记录对象实现返回功能
- FormBuilder 组件新增 history 属性,允许注入自定义历史记录对象
- 优化 FormBuilder 的取消操作,优先调用 history.goBack 方法
- HeaderBack 组件修改返回点击事件,支持使用自定义 history 对象
- Page 组件返回按钮支持自定义历史记录回退行为
- README 更新,新增版本信息及 antd6 升级说明
2026-06-24 14:33:24 +08:00
LiuJiaNan 582bbc0470 2.0.5 2026-06-23 16:33:42 +08:00
LiuJiaNan 896b394752 fix(SelectTree): 允许 Gwj 组件的额外属性
- 在类型定义中添加索引签名支持任意属性
- 增强了 EnterpriseType 属性的灵活性
- 解决类型限制带来的扩展困难问题
2026-06-23 16:33:33 +08:00
LiuJiaNan 31571d1466 fix(components): 修正 Divider 组件弃用属性 2026-06-23 14:47:44 +08:00
LiuJiaNan 5e9764fdfb 2.0.4 2026-06-23 14:11:49 +08:00
LiuJiaNan b4adc46214 fix(forms): 修复 Select 组件 showSearch 属性传递和样式问题
- 将 FormItemsRenderer 中 Select 组件的 showSearch 属性改为对象格式以支持 optionFilterProp
- 修改 Basic Select 组件中 showSearch 属性为对象格式以支持 optionFilterProp
- 修复 FormItemsRenderer 中表单项容器样式,添加 minWidth 以避免布局问题
2026-06-23 14:06:40 +08:00
LiuJiaNan e9962bf995 2.0.3 2026-06-23 13:51:48 +08:00
LiuJiaNan 05621be758 feat(formBuilder): 支持动态 col 样式及标题,增强 FormList 行定制能力
- 新增 colStyle 属性,支持 Col 内联样式函数动态计算
- 新增 colTitle 属性,支持 Col 内部标题节点动态渲染
- 新增 rowStyle 属性,允许 FormList 每行样式动态定义
- 新增 rowTitle 属性,支持 FormList 每行标题动态渲染
2026-06-23 13:51:16 +08:00
LiuJiaNan 585b03329b refactor(types): 移除已弃用的 onGetNodePathsIsIncludeOneself 和 callback 参数
- 删除 Cascader、LeftTree、SelectTree 组件中已弃用的 onGetNodePathsIsIncludeOneself 类型定义
- 删除 useTable hook 中已弃用的 callback 类型定义
- 组件实现中移除对 onGetNodePathsIsIncludeOneself 参数的支持和警告提示
- 统一使用 getNodePathsIsIncludeOneself 参数代替已废弃参数
- 移除 useTable hook 中对 callback 参数的警告和调用,建议使用 onSuccess
2026-06-23 13:50:34 +08:00
LiuJiaNan c3268aff48 2.0.2 2026-06-22 11:32:20 +08:00
LiuJiaNan 8bbdff2506 fix(modal): 修复Modal组件maskClosable属性用法错误
- 将Modal组件中的maskClosable属性改为mask={{ closable: false }}
2026-06-22 11:32:13 +08:00
LiuJiaNan acc9a1106a 2.0.1 2026-06-22 10:49:30 +08:00
LiuJiaNan 1cc778a90a fix(form): 修复表单项隐藏逻辑错误 2026-06-22 10:49:23 +08:00
LiuJiaNan 390d8c7799 升级antd到6.0 2026-06-22 08:49:36 +08:00
29 changed files with 1745 additions and 128 deletions

1553
README.md

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
{ {
"name": "zy-react-library", "name": "zy-react-library",
"private": false, "private": false,
"version": "1.3.19", "version": "2.0.9",
"type": "module", "type": "module",
"description": "", "description": "",
"author": "LiuJiaNan", "author": "LiuJiaNan",
@ -30,13 +30,13 @@
}, },
"dependencies": { "dependencies": {
"@ahooksjs/use-url-state": "^3.5.1", "@ahooksjs/use-url-state": "^3.5.1",
"@ant-design/icons": "^5.6.1", "@ant-design/icons": "^6.2.5",
"@ant-design/pro-components": "^2.8.10", "@ant-design/pro-components": "^3.1.12-0",
"@cqsjjb/jjb-common-lib": "latest", "@cqsjjb/jjb-common-lib": "latest",
"@wangeditor/editor": "^5.1.23", "@wangeditor/editor": "^5.1.23",
"@wangeditor/editor-for-react": "^1.0.6", "@wangeditor/editor-for-react": "^1.0.6",
"ahooks": "^3.9.5", "ahooks": "^3.9.5",
"antd": "^5.27.6", "antd": "^6.4.4",
"dayjs": "^1.11.18", "dayjs": "^1.11.18",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"react": "^18.3.1", "react": "^18.3.1",

View File

@ -11,8 +11,6 @@ export interface BasicCascaderProps extends Omit<CascaderProps, "fieldNames"> {
idKey?: string; idKey?: string;
/** 树形数据 children 字段,默认 children */ /** 树形数据 children 字段,默认 children */
childrenKey?: string; childrenKey?: string;
/** @deprecated 已弃用,请使用 getNodePathsIsIncludeOneself */
onGetNodePathsIsIncludeOneself?: boolean;
/** 决定 onGetNodePaths 是否包含自身节点,默认 true */ /** 决定 onGetNodePaths 是否包含自身节点,默认 true */
getNodePathsIsIncludeOneself?: boolean; getNodePathsIsIncludeOneself?: boolean;
/** 获取父级节点 */ /** 获取父级节点 */

View File

@ -10,7 +10,6 @@ function BasicCascader(props) {
onGetData, onGetData,
onChange, onChange,
onGetNodePaths, onGetNodePaths,
onGetNodePathsIsIncludeOneself,
getNodePathsIsIncludeOneself = true, getNodePathsIsIncludeOneself = true,
placeholder = "", placeholder = "",
data = [], data = [],
@ -21,14 +20,6 @@ function BasicCascader(props) {
...restProps ...restProps
} = props; } = props;
// 如果使用了已弃用的参数给出警告
if (onGetNodePathsIsIncludeOneself !== undefined) {
console.warn("【BasicCascader】 onGetNodePathsIsIncludeOneself 参数已弃用,请使用 getNodePathsIsIncludeOneself 参数");
}
// 向后兼容,如果传入了旧参数,使用旧参数
const finalGetNodePathsIsIncludeOneself = onGetNodePathsIsIncludeOneself !== undefined ? onGetNodePathsIsIncludeOneself : getNodePathsIsIncludeOneself;
// 根据 level 处理树数据 // 根据 level 处理树数据
const processedData = useMemo(() => { const processedData = useMemo(() => {
return level return level
@ -43,7 +34,7 @@ function BasicCascader(props) {
const getNodePaths = (selectedOptions) => { const getNodePaths = (selectedOptions) => {
let nodePaths = selectedOptions; let nodePaths = selectedOptions;
if (!finalGetNodePathsIsIncludeOneself && selectedOptions) { if (!getNodePathsIsIncludeOneself && selectedOptions) {
nodePaths = selectedOptions.slice(0, -1); nodePaths = selectedOptions.slice(0, -1);
} }
return nodePaths || []; return nodePaths || [];

View File

@ -44,6 +44,11 @@ export interface FormBuilderProps<Values = any> extends Omit<FormProps, "form" |
form: FormInstance<Values>; form: FormInstance<Values>;
/** 表单提交时的回调函数 */ /** 表单提交时的回调函数 */
onFinish?: (values: Values) => void; onFinish?: (values: Values) => void;
/** 历史记录对象,用于返回上一页,默认使用 window.history.back */
history?: {
goBack?: () => void;
[key: string]: any;
};
} }
/** /**

View File

@ -21,6 +21,7 @@ const FormBuilder = (props) => {
showCancelButton = true, showCancelButton = true,
customActionButtons, customActionButtons,
extraActionButtons, extraActionButtons,
history,
loading = false, loading = false,
...restProps ...restProps
} = props; } = props;
@ -51,7 +52,7 @@ const FormBuilder = (props) => {
}, [showActionButtons]); }, [showActionButtons]);
const handleCancel = () => { const handleCancel = () => {
window.history.back(); history?.goBack ? history.goBack() : window.history.back();
}; };
return ( return (
@ -78,7 +79,7 @@ const FormBuilder = (props) => {
/> />
</Row> </Row>
{showActionButtons && ( {showActionButtons && (
<div style={{ position: "relative", zIndex: "9" }}> <div style={{ position: "relative", zIndex: "99" }}>
<div style={{ height: "32px" }}></div> <div style={{ height: "32px" }}></div>
<Row <Row
style={{ textAlign: "center", backgroundColor: "rgb(241, 241, 242)", padding: "10px 0", position: "fixed", bottom: "0", width: pageWidth, margin: "0 -44px" }} style={{ textAlign: "center", backgroundColor: "rgb(241, 241, 242)", padding: "10px 0", position: "fixed", bottom: "0", width: pageWidth, margin: "0 -44px" }}

View File

@ -1,9 +1,9 @@
import type { NamePath } from "@rc-component/form/lib/interface";
import type { ColProps } from "antd/es/col"; import type { ColProps } from "antd/es/col";
import type { FormItemProps, Rule } from "antd/es/form"; import type { FormItemProps, Rule } from "antd/es/form";
import type { FormListFieldData } from "antd/es/form/FormList"; import type { FormListFieldData } from "antd/es/form/FormList";
import type { Gutter } from "antd/es/grid/row"; import type { Gutter } from "antd/es/grid/row";
import type { NamePath } from "rc-field-form/lib/interface"; import type { CSSProperties, ReactElement, ReactNode } from "react";
import type { ReactElement, ReactNode } from "react";
import type { FORM_ITEM_RENDER_TYPE_MAP } from "../../enum/formItemRender"; import type { FORM_ITEM_RENDER_TYPE_MAP } from "../../enum/formItemRender";
import type { DeepPartial } from "./FormBuilder"; import type { DeepPartial } from "./FormBuilder";
@ -131,6 +131,10 @@ export interface FormOptionBase<
dependencies?: FormOptionProperty<IsOnlyForLabel, IsCustomizeRender, Dependencies[]>; dependencies?: FormOptionProperty<IsOnlyForLabel, IsCustomizeRender, Dependencies[]>;
/** 是否仅用于保存标签,不渲染到页面上,只在表单中保存数据,默认 false */ /** 是否仅用于保存标签,不渲染到页面上,只在表单中保存数据,默认 false */
onlyForLabel?: IsOnlyForLabel; onlyForLabel?: IsOnlyForLabel;
/** Col 的内联样式,会合并到 Col 的 style 上,支持函数动态计算 */
colStyle?: FormOptionProperty<IsOnlyForLabel, IsCustomizeRender, CSSProperties | ((formValues: AllValues) => CSSProperties)>;
/** Col 内部、Form.Item 之前渲染的标题节点,支持函数动态计算 */
colTitle?: FormOptionProperty<IsOnlyForLabel, IsCustomizeRender, ReactNode | ((formValues: AllValues) => ReactNode)>;
} }
/** /**
@ -157,6 +161,10 @@ export type FormOptionByRender<
checkboxCol?: FormOptionProperty<IsOnlyForLabel, IsCustomizeRender, RenderType extends "checkbox" ? number : never>; checkboxCol?: FormOptionProperty<IsOnlyForLabel, IsCustomizeRender, RenderType extends "checkbox" ? number : never>;
/** Form.List 独有的属性 */ /** Form.List 独有的属性 */
formListUniqueProps?: FormOptionProperty<IsOnlyForLabel, IsCustomizeRender, RenderType extends "formList" ? FormListUniqueProps | ((formValues: AllValues) => FormListUniqueProps) : never>; formListUniqueProps?: FormOptionProperty<IsOnlyForLabel, IsCustomizeRender, RenderType extends "formList" ? FormListUniqueProps | ((formValues: AllValues) => FormListUniqueProps) : never>;
/** FormList 每行的内联样式,仅 render 为 formList 时可用,支持函数按行计算 */
rowStyle?: FormOptionProperty<IsOnlyForLabel, IsCustomizeRender, RenderType extends "formList" ? CSSProperties | ((field: FormListFieldData, fieldIndex: number) => CSSProperties) : never>;
/** FormList 每行起始位置渲染的标题节点,仅 render 为 formList 时可用,支持函数按行计算 */
rowTitle?: FormOptionProperty<IsOnlyForLabel, IsCustomizeRender, RenderType extends "formList" ? ReactNode | ((field: FormListFieldData, fieldIndex: number) => ReactNode) : never>;
}; };
/** /**

View File

@ -84,12 +84,8 @@ const FormItemsRenderer = ({
}; };
}; };
// 获取传给formItem的属性 // 设置日期组件的属性
const getFormItemProps = (option) => { const setDateComponentProps = (option, formItemProps) => {
const formItemProps = typeof option.formItemProps === "function"
? option.formItemProps(getFormValues())
: (option.formItemProps || {});
// 为日期组件添加特殊处理 // 为日期组件添加特殊处理
if ([ if ([
FORM_ITEM_RENDER_ENUM.DATE, FORM_ITEM_RENDER_ENUM.DATE,
@ -117,6 +113,15 @@ const FormItemsRenderer = ({
formItemProps.getValueFromEvent = (_, dateString) => dateString; formItemProps.getValueFromEvent = (_, dateString) => dateString;
formItemProps.getValueProps = value => ({ value: Array.isArray(value) ? value.map(v => v ? dayjs(v) : undefined) : undefined }); formItemProps.getValueProps = value => ({ value: Array.isArray(value) ? value.map(v => v ? dayjs(v) : undefined) : undefined });
} }
};
// 获取传给 formItem 的属性
const getFormItemProps = (option) => {
const formItemProps = typeof option.formItemProps === "function"
? option.formItemProps(getFormValues())
: (option.formItemProps || {});
setDateComponentProps(option, formItemProps);
return formItemProps; return formItemProps;
}; };
@ -218,6 +223,39 @@ const FormItemsRenderer = ({
return { span: itemSpan, labelCol: itemLabelCol, wrapperCol: itemWrapperCol }; return { span: itemSpan, labelCol: itemLabelCol, wrapperCol: itemWrapperCol };
}; };
// 获取 col 样式
const getColStyle = (option) => {
return typeof option.colStyle === "function"
? option.colStyle(getFormValues())
: option.colStyle;
};
// 获取 col 标题Col 内部、Form.Item 之后)
const getColTitle = (option) => {
return typeof option.colTitle === "function"
? option.colTitle(getFormValues())
: option.colTitle;
};
// 获取 row 样式FormList 的每一行)
const getRowStyle = (option, field, fieldIndex) => {
return typeof option.rowStyle === "function"
? option.rowStyle(field, fieldIndex)
: option.rowStyle;
};
// 获取 row 标题FormList 每行末尾)
const getRowTitle = (option, field, fieldIndex) => {
return typeof option.rowTitle === "function"
? option.rowTitle(field, fieldIndex)
: option.rowTitle;
};
// 获取是否动态表单项
const getIsDynamicFormItem = (option, formItemProps) => {
return (option.shouldUpdate ?? option.dependencies) || (formItemProps.shouldUpdate ?? formItemProps.dependencies);
};
// 获取 hidden // 获取 hidden
const getHidden = (hidden) => { const getHidden = (hidden) => {
// 支持动态计算 hidden // 支持动态计算 hidden
@ -264,7 +302,7 @@ const FormItemsRenderer = ({
case FORM_ITEM_RENDER_ENUM.SELECT: case FORM_ITEM_RENDER_ENUM.SELECT:
return ( return (
<Select placeholder={placeholder} showSearch allowClear optionFilterProp="children" {...componentProps}> <Select placeholder={placeholder} showSearch={{ optionFilterProp: "children" }} allowClear {...componentProps}>
{(option.items || []).map((item) => { {(option.items || []).map((item) => {
const { value, label, disabled } = getSelectableItemAttributes(item, itemsFieldKey); const { value, label, disabled } = getSelectableItemAttributes(item, itemsFieldKey);
return ( return (
@ -420,8 +458,12 @@ const FormItemsRenderer = ({
delete formItemProps.dependencies; delete formItemProps.dependencies;
delete formItemProps.shouldUpdate; delete formItemProps.shouldUpdate;
if (getHidden(option.hidden))
return null;
return ( return (
<Col key={getKey(option) || index} span={col.span} style={style}> <Col key={getKey(option) || index} span={col.span} style={{ ...style, ...getColStyle(option) }}>
{getColTitle(option)}
<Form.Item <Form.Item
name={option.name} name={option.name}
label={renderLabel(option)} label={renderLabel(option)}
@ -443,6 +485,9 @@ const FormItemsRenderer = ({
const renderOtherTypeItem = ({ option, style, col, index, preserve }) => { const renderOtherTypeItem = ({ option, style, col, index, preserve }) => {
const componentProps = getComponentProps(option); const componentProps = getComponentProps(option);
if (getHidden(option.hidden))
return null;
// 如果是 customizeRender 类型,完全交给外部控制渲染 // 如果是 customizeRender 类型,完全交给外部控制渲染
if (option.customizeRender) { if (option.customizeRender) {
return ( return (
@ -470,7 +515,7 @@ const FormItemsRenderer = ({
if (option.render === FORM_ITEM_RENDER_ENUM.DIVIDER) { if (option.render === FORM_ITEM_RENDER_ENUM.DIVIDER) {
return ( return (
<Col key={getKey(option) || index} span={col.span} style={style}> <Col key={getKey(option) || index} span={col.span} style={style}>
<Divider orientation="left" {...componentProps}>{option.label}</Divider> <Divider titlePlacement="start" {...componentProps}>{option.label}</Divider>
</Col> </Col>
); );
} }
@ -478,43 +523,28 @@ const FormItemsRenderer = ({
return null; return null;
}; };
// 渲染需要动态更新的表单项
const renderDynamicFormItem = ({ option, index, style, col, preserve }) => {
const formItemProps = getFormItemProps(option);
return (
<Form.Item
key={getKey(option) || index}
noStyle
preserve={preserve}
shouldUpdate={option.shouldUpdate ?? formItemProps.shouldUpdate}
dependencies={option.dependencies ?? formItemProps.dependencies}
>
{() => {
return renderFormItem({ option, style, col, index, preserve });
}}
</Form.Item>
);
};
// 渲染 Form.List // 渲染 Form.List
const renderFormList = ({ option, index, col, style }) => { const renderFormList = ({ option, index, col, style }) => {
const formListUniqueProps = getFormListUniqueProps(option); const formListUniqueProps = getFormListUniqueProps(option);
const componentProps = getComponentProps(option); const componentProps = getComponentProps(option);
if (getHidden(option.hidden))
return null;
return ( return (
<Col key={getKey(option) || index} span={col.span} style={style}> <Col key={getKey(option) || index} span={col.span} style={{ ...style, ...getColStyle(option) }}>
{getColTitle(option)}
<Form.List name={option.name} {...componentProps}> <Form.List name={option.name} {...componentProps}>
{(fields, { add, remove, move }) => ( {(fields, { add, remove, move }) => (
<> <>
{fields.map((field, fieldIndex) => { {fields.map((field, fieldIndex) => {
const listOptions = getListOptions(formListUniqueProps.options, field, fieldIndex, add, remove, move); const listOptions = getListOptions(formListUniqueProps.options, field, fieldIndex, add, remove, move);
const rowStyle = getRowStyle(option, field, fieldIndex);
const rowTitle = getRowTitle(option, field, fieldIndex);
return ( return (
<Row gutter={gutter} key={field.key}> <Row gutter={gutter} key={field.key} style={rowStyle}>
{rowTitle}
{listOptions.map((listOption, listIndex) => { {listOptions.map((listOption, listIndex) => {
if (getHidden(listOption.hidden))
return null;
const col = getCol(listOption); const col = getCol(listOption);
const formItemProps = getFormItemProps(listOption); const formItemProps = getFormItemProps(listOption);
@ -525,6 +555,12 @@ const FormItemsRenderer = ({
index: `${fieldIndex}_${listIndex}`, index: `${fieldIndex}_${listIndex}`,
preserve: true, preserve: true,
}; };
// 如果配置了 shouldUpdate 或 dependencies使用 Form.Item 的联动机制
// 注意:动态检测必须在 renderOtherTypeItem 之前否则特殊类型customizeRender / onlyForLabel / DIVIDER无法响应联动
if (getIsDynamicFormItem(listOption, formItemProps))
return renderDynamicFormItem(params);
const otherTypeItem = renderOtherTypeItem(params); const otherTypeItem = renderOtherTypeItem(params);
if (otherTypeItem) if (otherTypeItem)
return otherTypeItem; return otherTypeItem;
@ -532,9 +568,6 @@ const FormItemsRenderer = ({
if (listOption.render === FORM_ITEM_RENDER_ENUM.FORM_LIST) if (listOption.render === FORM_ITEM_RENDER_ENUM.FORM_LIST)
return renderFormList(params); return renderFormList(params);
if ((listOption.shouldUpdate ?? listOption.dependencies) || (formItemProps.shouldUpdate ?? formItemProps.dependencies))
return renderDynamicFormItem(params);
// 判断一个项是否需要显示按钮(不是 onlyForLabel 且不是隐藏的) // 判断一个项是否需要显示按钮(不是 onlyForLabel 且不是隐藏的)
const isShow = (opt) => { const isShow = (opt) => {
return !getHidden(opt.hidden) && !opt.onlyForLabel; return !getHidden(opt.hidden) && !opt.onlyForLabel;
@ -562,8 +595,10 @@ const FormItemsRenderer = ({
if (listIndex === lastShowIndex || isNextNestedFormList || isNextNoShow) { if (listIndex === lastShowIndex || isNextNestedFormList || isNextNoShow) {
delete formItemProps.dependencies; delete formItemProps.dependencies;
delete formItemProps.shouldUpdate; delete formItemProps.shouldUpdate;
return ( return (
<Col key={getKey(listOption) || listIndex} span={col.span} style={style}> <Col key={getKey(listOption) || listIndex} span={col.span} style={{ ...style, ...getColStyle(listOption) }}>
{getColTitle(listOption)}
<Form.Item <Form.Item
label={renderLabel(listOption)} label={renderLabel(listOption)}
labelCol={col.labelCol} labelCol={col.labelCol}
@ -574,7 +609,7 @@ const FormItemsRenderer = ({
{...formItemProps} {...formItemProps}
> >
<div style={{ display: "flex", gap: 10, alignItems: "center", justifyContent: "space-between" }}> <div style={{ display: "flex", gap: 10, alignItems: "center", justifyContent: "space-between" }}>
<div style={{ flex: 1 }}> <div style={{ flex: 1, minWidth: 0 }}>
<Form.Item <Form.Item
noStyle noStyle
rules={getRules(listOption)} rules={getRules(listOption)}
@ -629,12 +664,35 @@ const FormItemsRenderer = ({
); );
}; };
// 渲染需要动态更新的表单项
const renderDynamicFormItem = ({ option, index, style, col, preserve }) => {
const formItemProps = getFormItemProps(option);
return (
<Form.Item
key={getKey(option) || index}
noStyle
preserve={preserve}
shouldUpdate={option.shouldUpdate ?? formItemProps.shouldUpdate}
dependencies={option.dependencies ?? formItemProps.dependencies}
>
{() => {
const otherTypeItem = renderOtherTypeItem({ option, style, col, index, preserve });
if (otherTypeItem)
return otherTypeItem;
if (option.render === FORM_ITEM_RENDER_ENUM.FORM_LIST)
return renderFormList({ option, index, col, style });
return renderFormItem({ option, style, col, index, preserve });
}}
</Form.Item>
);
};
return ( return (
<> <>
{options.map((option, index) => { {options.map((option, index) => {
if (getHidden(option.hidden))
return null;
const col = getCol(option); const col = getCol(option);
const style = getStyle(index); const style = getStyle(index);
const formItemProps = getFormItemProps(option); const formItemProps = getFormItemProps(option);
@ -647,6 +705,10 @@ const FormItemsRenderer = ({
preserve: false, preserve: false,
}; };
// 如果配置了 shouldUpdate 或 dependencies使用 Form.Item 的联动机制
if (getIsDynamicFormItem(option, formItemProps))
return renderDynamicFormItem(params);
// 处理特殊类型的表单项 // 处理特殊类型的表单项
const otherTypeItem = renderOtherTypeItem(params); const otherTypeItem = renderOtherTypeItem(params);
if (otherTypeItem) if (otherTypeItem)
@ -656,10 +718,6 @@ const FormItemsRenderer = ({
if (option.render === FORM_ITEM_RENDER_ENUM.FORM_LIST) if (option.render === FORM_ITEM_RENDER_ENUM.FORM_LIST)
return renderFormList(params); return renderFormList(params);
// 如果配置了 shouldUpdate 或 dependencies使用 Form.Item 的联动机制
if ((option.shouldUpdate ?? option.dependencies) || (formItemProps.shouldUpdate ?? formItemProps.dependencies))
return renderDynamicFormItem(params);
// 普通表单项(静态配置) // 普通表单项(静态配置)
return renderFormItem(params); return renderFormItem(params);
})} })}

View File

@ -17,12 +17,14 @@ function HeaderBack(props) {
<> <>
<div <div
className="back" className="back"
onClick={() => history?.goBack?.() || window.history.back()} onClick={() => {
history?.goBack ? history.goBack() : window.history.back();
}}
> >
<ArrowLeftOutlined style={{ fontSize: 14 }} /> <ArrowLeftOutlined style={{ fontSize: 14 }} />
<span>返回</span> <span>返回</span>
</div> </div>
<Divider type="vertical" style={{ backgroundColor: "#dcdfe6", marginLeft: 15, marginRight: 15 }} /> <Divider orientation="vertical" style={{ backgroundColor: "#dcdfe6", marginLeft: 15, marginRight: 15 }} />
</> </>
) )
} }

View File

@ -131,7 +131,7 @@ function HiddenInfo(props) {
return ( return (
<div> <div>
<Spin spinning={loading || downloadFileLoading}> <Spin spinning={loading || downloadFileLoading}>
<Divider orientation="left">隐患信息</Divider> <Divider titlePlacement="start">隐患信息</Divider>
<Descriptions <Descriptions
bordered bordered
column={1} column={1}
@ -193,7 +193,7 @@ function HiddenInfo(props) {
{ {
(info.hiddenUserPresetsCO && Object.keys(info.hiddenUserPresetsCO).length > 0) && ( (info.hiddenUserPresetsCO && Object.keys(info.hiddenUserPresetsCO).length > 0) && (
<> <>
<Divider orientation="left">整改信息发现人预填</Divider> <Divider titlePlacement="start">整改信息发现人预填</Divider>
<Descriptions <Descriptions
bordered bordered
column={1} column={1}
@ -223,7 +223,7 @@ function HiddenInfo(props) {
{ {
(info.hiddenConfirmUserCO && info.hiddenConfirmUserCO.length > 0) && ( (info.hiddenConfirmUserCO && info.hiddenConfirmUserCO.length > 0) && (
<> <>
<Divider orientation="left">隐患确认</Divider> <Divider titlePlacement="start">隐患确认</Divider>
{ {
info.hiddenConfirmUserCO.map(item => ( info.hiddenConfirmUserCO.map(item => (
<Descriptions <Descriptions
@ -256,7 +256,7 @@ function HiddenInfo(props) {
{ {
info.hiddenExtensionList && info.hiddenExtensionList.length > 0 && ( info.hiddenExtensionList && info.hiddenExtensionList.length > 0 && (
<> <>
<Divider orientation="left">延期信息</Divider> <Divider titlePlacement="start">延期信息</Divider>
{ {
info.hiddenExtensionList.map(item => ( info.hiddenExtensionList.map(item => (
<Descriptions <Descriptions
@ -319,7 +319,7 @@ function HiddenInfo(props) {
{ {
info.hiddenSpecialList && info.hiddenSpecialList.length > 0 && ( info.hiddenSpecialList && info.hiddenSpecialList.length > 0 && (
<> <>
<Divider orientation="left">特殊处置审核信息</Divider> <Divider titlePlacement="start">特殊处置审核信息</Divider>
{ {
info.hiddenSpecialList.map(item => ( info.hiddenSpecialList.map(item => (
<Descriptions <Descriptions
@ -405,7 +405,7 @@ function HiddenInfo(props) {
{ {
(info.hiddenRectifyUserCO && info.hiddenRectifyUserCO.length > 0) && ( (info.hiddenRectifyUserCO && info.hiddenRectifyUserCO.length > 0) && (
<> <>
<Divider orientation="left">整改信息</Divider> <Divider titlePlacement="start">整改信息</Divider>
{ {
info.hiddenRectifyUserCO.map((item, index) => ( info.hiddenRectifyUserCO.map((item, index) => (
<Descriptions <Descriptions
@ -454,7 +454,7 @@ function HiddenInfo(props) {
info.hiddenAcceptQualifiedUserCO.length > 0 info.hiddenAcceptQualifiedUserCO.length > 0
? ( ? (
<> <>
<Divider orientation="left">验收信息</Divider> <Divider titlePlacement="start">验收信息</Divider>
{ {
info.hiddenAcceptQualifiedUserCO.map((item, index) => ( info.hiddenAcceptQualifiedUserCO.map((item, index) => (
<Descriptions <Descriptions
@ -482,7 +482,7 @@ function HiddenInfo(props) {
info.hiddenAcceptUnqualifiedUserCO.length > 0 info.hiddenAcceptUnqualifiedUserCO.length > 0
? ( ? (
<> <>
<Divider orientation="left">验收打回信息</Divider> <Divider titlePlacement="start">验收打回信息</Divider>
{ {
info.hiddenAcceptUnqualifiedUserCO.map(item => ( info.hiddenAcceptUnqualifiedUserCO.map(item => (
<Descriptions <Descriptions
@ -507,7 +507,7 @@ function HiddenInfo(props) {
(info.hiddenInspecCO && Object.keys(info.hiddenInspecCO).length > 0) (info.hiddenInspecCO && Object.keys(info.hiddenInspecCO).length > 0)
? ( ? (
<> <>
<Divider orientation="left">安全环保验收信息</Divider> <Divider titlePlacement="start">安全环保验收信息</Divider>
<Descriptions <Descriptions
bordered bordered
column={1} column={1}

View File

@ -53,7 +53,7 @@ const ImportFile = (props) => {
open={visible} open={visible}
onCancel={handleClose} onCancel={handleClose}
width={600} width={600}
maskClosable={false} mask={{ closable: false }}
footer={[ footer={[
templateUrl && ( templateUrl && (
<Button key="export" onClick={handleExportTemplate}> <Button key="export" onClick={handleExportTemplate}>

View File

@ -11,8 +11,6 @@ export interface BasicLeftTreeProps extends Omit<TreeProps, "fieldNames"> {
idKey?: string; idKey?: string;
/** 树形数据 children 字段,默认 children */ /** 树形数据 children 字段,默认 children */
childrenKey?: string; childrenKey?: string;
/** @deprecated 已弃用,请使用 getNodePathsIsIncludeOneself */
onGetNodePathsIsIncludeOneself?: boolean;
/** 决定 onGetNodePaths 是否包含自身节点,默认 true */ /** 决定 onGetNodePaths 是否包含自身节点,默认 true */
getNodePathsIsIncludeOneself?: boolean; getNodePathsIsIncludeOneself?: boolean;
/** 获取父级节点 */ /** 获取父级节点 */

View File

@ -12,7 +12,6 @@ const BasicLeftTree = (props) => {
onGetData, onGetData,
onSelect, onSelect,
onGetNodePaths, onGetNodePaths,
onGetNodePathsIsIncludeOneself,
getNodePathsIsIncludeOneself = true, getNodePathsIsIncludeOneself = true,
expandedKeys: externalExpandedKeys, expandedKeys: externalExpandedKeys,
treeData = [], treeData = [],
@ -22,14 +21,6 @@ const BasicLeftTree = (props) => {
...restProps ...restProps
} = props; } = props;
// 如果使用了已弃用的参数给出警告
if (onGetNodePathsIsIncludeOneself !== undefined) {
console.warn("【BasicLeftTree】 onGetNodePathsIsIncludeOneself 参数已弃用,请使用 getNodePathsIsIncludeOneself 参数");
}
// 向后兼容,如果传入了旧参数,使用旧参数
const finalGetNodePathsIsIncludeOneself = onGetNodePathsIsIncludeOneself !== undefined ? onGetNodePathsIsIncludeOneself : getNodePathsIsIncludeOneself;
const [expandedKeys, setExpandedKeys] = useState([]); const [expandedKeys, setExpandedKeys] = useState([]);
const [searchValue, setSearchValue] = useState(""); const [searchValue, setSearchValue] = useState("");
const [autoExpandParent, setAutoExpandParent] = useState(true); const [autoExpandParent, setAutoExpandParent] = useState(true);
@ -90,7 +81,7 @@ const BasicLeftTree = (props) => {
targetId: selectedNodeId, targetId: selectedNodeId,
idKey, idKey,
childrenKey, childrenKey,
isIncludeOneself: finalGetNodePathsIsIncludeOneself, isIncludeOneself: getNodePathsIsIncludeOneself,
}); });
onGetNodePaths?.(parentNodes); onGetNodePaths?.(parentNodes);
} }

View File

@ -267,7 +267,7 @@ const MapSelector = (props) => {
onCancel={handleClose} onCancel={handleClose}
width={1000} width={1000}
destroyOnHidden={false} destroyOnHidden={false}
maskClosable={false} mask={{ closable: false }}
afterClose={handleAfterClose} afterClose={handleAfterClose}
footer={[ footer={[
<Button key="back" onClick={handleClose}> <Button key="back" onClick={handleClose}>

View File

@ -55,13 +55,17 @@ function Page(props) {
{children && typeof children === "function" ? children() : children} {children && typeof children === "function" ? children() : children}
{ {
(isShowAllAction && isShowFooter) && ( (isShowAllAction && isShowFooter) && (
<div className="page-layout-footer" style={{ position: "relative", zIndex: "9" }}> <div className="page-layout-footer" style={{ position: "relative", zIndex: "99" }}>
<div style={{ height: "52px" }}></div> <div style={{ height: "52px" }}></div>
<div style={{ textAlign: "center", backgroundColor: "rgb(241, 241, 242)", padding: "10px 0", position: "fixed", bottom: "0", width: pageWidth, margin: "0px -20px" }}> <div style={{ textAlign: "center", backgroundColor: "rgb(241, 241, 242)", padding: "10px 0", position: "fixed", bottom: "0", width: pageWidth, margin: "0px -20px" }}>
{customActionButtons || ( {customActionButtons || (
<Space> <Space>
{extraActionButtons} {extraActionButtons}
<Button onClick={() => history?.goBack?.() || window.history.back()}> <Button
onClick={() => {
history?.goBack ? history.goBack() : window.history.back();
}}
>
{backButtonText} {backButtonText}
</Button> </Button>
</Space> </Space>

View File

@ -90,7 +90,7 @@ function Pdf(props) {
<Modal <Modal
style={{ top: isFullscreen ? 0 : 100, maxWidth: isFullscreen ? "100vw" : "calc(100vw - 32px)", paddingBottom: isFullscreen ? 0 : 24 }} style={{ top: isFullscreen ? 0 : 100, maxWidth: isFullscreen ? "100vw" : "calc(100vw - 32px)", paddingBottom: isFullscreen ? 0 : 24 }}
open={visible} open={visible}
maskClosable={false} mask={{ closable: false }}
width={isFullscreen ? "100vw" : pdfWidth + 100} width={isFullscreen ? "100vw" : pdfWidth + 100}
title={title} title={title}
onCancel={() => { onCancel={() => {

View File

@ -16,7 +16,7 @@ const PreviewImg = (props) => {
<Image <Image
key={item[fileUrlKey] || item} key={item[fileUrlKey] || item}
src={item[fileUrlKey] ? fileUrl + item[fileUrlKey] : fileUrl + item} src={item[fileUrlKey] ? fileUrl + item[fileUrlKey] : fileUrl + item}
wrapperStyle={{ marginRight: 10, marginBottom: 10 }} styles={{ root: { marginRight: 10, marginBottom: 10 } }}
width={100} width={100}
height={100} height={100}
alt="" alt=""

View File

@ -59,7 +59,7 @@ function BasicSelect(props) {
}, [data]); }, [data]);
return ( return (
<Select placeholder={`请选择${placeholder}`} showSearch allowClear optionFilterProp="children" onChange={handleChange} {...restProps}> <Select placeholder={`请选择${placeholder}`} showSearch={{ optionFilterProp: "children" }} allowClear onChange={handleChange} {...restProps}>
{data.map((item) => { {data.map((item) => {
const value = item[idKey]; const value = item[idKey];
const label = labelRender ? labelRender(item) : item[nameKey]; const label = labelRender ? labelRender(item) : item[nameKey];

View File

@ -11,8 +11,6 @@ export interface BasicSelectTreeProps extends Omit<TreeSelectProps, "fieldNames"
idKey?: string; idKey?: string;
/** 树形数据 children 字段,默认 children */ /** 树形数据 children 字段,默认 children */
childrenKey?: string; childrenKey?: string;
/** @deprecated 已弃用,请使用 getNodePathsIsIncludeOneself */
onGetNodePathsIsIncludeOneself?: boolean;
/** 决定 onGetNodePaths 是否包含自身节点,默认 true */ /** 决定 onGetNodePaths 是否包含自身节点,默认 true */
getNodePathsIsIncludeOneself?: boolean; getNodePathsIsIncludeOneself?: boolean;
/** 获取父级节点 */ /** 获取父级节点 */

View File

@ -11,7 +11,6 @@ function BasicSelectTree(props) {
onChange, onChange,
onGetLabel, onGetLabel,
onGetNodePaths, onGetNodePaths,
onGetNodePathsIsIncludeOneself,
getNodePathsIsIncludeOneself = true, getNodePathsIsIncludeOneself = true,
placeholder = "", placeholder = "",
treeData = [], treeData = [],
@ -23,14 +22,6 @@ function BasicSelectTree(props) {
...restProps ...restProps
} = props; } = props;
// 如果使用了已弃用的参数给出警告
if (onGetNodePathsIsIncludeOneself !== undefined) {
console.warn("【BasicSelectTree】 onGetNodePathsIsIncludeOneself 参数已弃用,请使用 getNodePathsIsIncludeOneself 参数");
}
// 向后兼容,如果传入了旧参数,使用旧参数
const finalGetNodePathsIsIncludeOneself = onGetNodePathsIsIncludeOneself !== undefined ? onGetNodePathsIsIncludeOneself : getNodePathsIsIncludeOneself;
const processedTreeData = useMemo(() => { const processedTreeData = useMemo(() => {
// 根据 level 处理树数据 // 根据 level 处理树数据
let result = level let result = level
@ -64,7 +55,7 @@ function BasicSelectTree(props) {
targetId, targetId,
idKey, idKey,
childrenKey, childrenKey,
isIncludeOneself: finalGetNodePathsIsIncludeOneself, isIncludeOneself: getNodePathsIsIncludeOneself,
}); });
parentNodes.push(...currentParentNodes); parentNodes.push(...currentParentNodes);
} }
@ -81,7 +72,7 @@ function BasicSelectTree(props) {
targetId, targetId,
idKey, idKey,
childrenKey, childrenKey,
isIncludeOneself: finalGetNodePathsIsIncludeOneself, isIncludeOneself: getNodePathsIsIncludeOneself,
}); });
onGetNodePaths?.(parentNodes); onGetNodePaths?.(parentNodes);
onGetLabel?.(parentNodes[parentNodes.length - 1][nameKey]); onGetLabel?.(parentNodes[parentNodes.length - 1][nameKey]);

View File

@ -30,6 +30,7 @@ export interface Params {
inType?: InType[]; inType?: InType[];
/** 企业类型 1-监管 2-企业 3-相关方 */ /** 企业类型 1-监管 2-企业 3-相关方 */
enterpriseType?: EnterpriseType | EnterpriseType[]; enterpriseType?: EnterpriseType | EnterpriseType[];
[key: string]: any;
} }
/** /**

View File

@ -60,7 +60,7 @@ function Signature(props) {
title="签字" title="签字"
width={800} width={800}
open={signatureModalOpen} open={signatureModalOpen}
maskClosable={false} mask={{ closable: false }}
onCancel={() => setSignatureModalOpen(false)} onCancel={() => setSignatureModalOpen(false)}
footer={[ footer={[
<Button key="clear" onClick={() => signatureCanvas.current.clear()}>重签</Button>, <Button key="clear" onClick={() => signatureCanvas.current.clear()}>重签</Button>,

View File

@ -92,7 +92,7 @@ const Video = forwardRef(({
关闭 关闭
</Button>, </Button>,
]} ]}
maskClosable={false} mask={{ closable: false }}
onCancel={() => setVisible(false)} onCancel={() => setVisible(false)}
> >
{playerElement} {playerElement}

13
src/enum/uploadFile/aqd/index.d.ts vendored Normal file
View File

@ -0,0 +1,13 @@
/**
*
*/
export declare const UPLOAD_FILE_TYPE_ENUM: {
1000: 1000; // template_task - 模板任务附件
};
/**
* path
*/
export declare const UPLOAD_FILE_PATH_ENUM: {
1000: "template_task";
};

View File

@ -0,0 +1,16 @@
/**
* 文件上传类型枚举
*/
/**
* 文件上传类型枚举
*/
export const UPLOAD_FILE_TYPE_ENUM = {
1000: 1000, // template_task - 模板任务附件
};
/**
* 文件上传类型对应的 path 枚举
*/
export const UPLOAD_FILE_PATH_ENUM = {
1000: "template_task",
};

View File

@ -1,6 +1,7 @@
import { request } from "@cqsjjb/jjb-common-lib/http.js"; import { request } from "@cqsjjb/jjb-common-lib/http.js";
import { useState } from "react"; import { useState } from "react";
import { UPLOAD_FILE_TYPE_ENUM } from "../../enum/uploadFile/gwj"; import { UPLOAD_FILE_TYPE_ENUM as UPLOAD_FILE_TYPE_ENUM_AQD } from "../../enum/uploadFile/aqd";
import { UPLOAD_FILE_TYPE_ENUM as UPLOAD_FILE_TYPE_ENUM_GWJ } from "../../enum/uploadFile/gwj";
import { addingPrefixToFile, getBaseGateway } from "../../utils"; import { addingPrefixToFile, getBaseGateway } from "../../utils";
/** /**
@ -34,7 +35,8 @@ function useGetFile(returnType = "object") {
} }
// 检查eqType是否在UPLOAD_FILE_TYPE_ENUM中 // 检查eqType是否在UPLOAD_FILE_TYPE_ENUM中
if (!Object.values(UPLOAD_FILE_TYPE_ENUM).includes(eqType)) { const isValidEqType = Object.values(UPLOAD_FILE_TYPE_ENUM_GWJ).includes(eqType) || Object.values(UPLOAD_FILE_TYPE_ENUM_AQD).includes(eqType);
if (!isValidEqType) {
console.error(`【getFile】 传入的 eqType 不在 UPLOAD_FILE_TYPE_ENUM 中,当前传入的 eqType 是 ${eqType}`); console.error(`【getFile】 传入的 eqType 不在 UPLOAD_FILE_TYPE_ENUM 中,当前传入的 eqType 是 ${eqType}`);
return; return;
} }

View File

@ -18,8 +18,6 @@ export interface UseTableOptions<TData extends Data, TParams extends Params> ext
params?: Record<string, any> | (() => Record<string, any>); params?: Record<string, any> | (() => Record<string, any>);
/** 表单数据转换函数,在每次请求之前调用,接收当前搜索的表单项,要求返回一个对象 */ /** 表单数据转换函数,在每次请求之前调用,接收当前搜索的表单项,要求返回一个对象 */
transform?: (formData: FormValues) => FormValues; transform?: (formData: FormValues) => FormValues;
/** @deprecated 已弃用,请使用 onSuccess */
callback?: (list: any[], data: any) => void;
/** 表单实例(通过 Form.useForm() 创建) */ /** 表单实例(通过 Form.useForm() 创建) */
form?: FormInstance; form?: FormInstance;
} }

View File

@ -96,13 +96,6 @@ function useTable(service, options) {
}, },
); );
if (restOptions.callback !== undefined) {
console.warn("【useTable】 callback 参数已弃用,请使用 onSuccess 参数");
}
// 执行回调函数
restOptions.callback && restOptions.callback(res?.data?.list || [], res?.data || {});
// 返回结果 // 返回结果
return { return {
...res, ...res,

View File

@ -1,6 +1,7 @@
import { request } from "@cqsjjb/jjb-common-lib/http.js"; import { request } from "@cqsjjb/jjb-common-lib/http.js";
import { useState } from "react"; import { useState } from "react";
import { UPLOAD_FILE_PATH_ENUM, UPLOAD_FILE_TYPE_ENUM } from "../../enum/uploadFile/gwj"; import { UPLOAD_FILE_PATH_ENUM as UPLOAD_FILE_PATH_ENUM_AQD, UPLOAD_FILE_TYPE_ENUM as UPLOAD_FILE_TYPE_ENUM_AQD } from "../../enum/uploadFile/aqd";
import { UPLOAD_FILE_PATH_ENUM as UPLOAD_FILE_PATH_ENUM_GWJ, UPLOAD_FILE_TYPE_ENUM as UPLOAD_FILE_TYPE_ENUM_GWJ } from "../../enum/uploadFile/gwj";
import { getBaseGateway } from "../../utils"; import { getBaseGateway } from "../../utils";
/** /**
@ -46,13 +47,14 @@ function useUploadFile(returnType = "object") {
} }
// 检查type是否在UPLOAD_FILE_TYPE_ENUM中 // 检查type是否在UPLOAD_FILE_TYPE_ENUM中
if (!Object.values(UPLOAD_FILE_TYPE_ENUM).includes(params.type)) { const isValidType = Object.values(UPLOAD_FILE_TYPE_ENUM_GWJ).includes(params.type) || Object.values(UPLOAD_FILE_TYPE_ENUM_AQD).includes(params.type);
if (!isValidType) {
console.error(`【uploadFile】 传入的 type 不在 UPLOAD_FILE_TYPE_ENUM 中,当前传入的 type 是 ${params.type}`); console.error(`【uploadFile】 传入的 type 不在 UPLOAD_FILE_TYPE_ENUM 中,当前传入的 type 是 ${params.type}`);
return; return;
} }
// 根据type获取对应的path // 根据type获取对应的path
const path = UPLOAD_FILE_PATH_ENUM[params.type]; const path = UPLOAD_FILE_PATH_ENUM_GWJ[params.type] || UPLOAD_FILE_PATH_ENUM_AQD[params.type];
if (!path) { if (!path) {
console.error(`【uploadFile】未找到 type ${params.type} 对应的 path `); console.error(`【uploadFile】未找到 type ${params.type} 对应的 path `);
return; return;