Compare commits
No commits in common. "2.0" and "master" have entirely different histories.
|
|
@ -16,7 +16,3 @@ yarn add zy-react-library
|
||||||
### v1.1.2 (2025-12-25)
|
### v1.1.2 (2025-12-25)
|
||||||
|
|
||||||
- 🎉 优化编译效果
|
- 🎉 优化编译效果
|
||||||
|
|
||||||
### v2.0.0 (2026-06-22)
|
|
||||||
|
|
||||||
- 🎉 升级到antd6
|
|
||||||
1551
UI_LIBRARY_DOCS.md
1551
UI_LIBRARY_DOCS.md
File diff suppressed because it is too large
Load Diff
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "zy-react-library",
|
"name": "zy-react-library",
|
||||||
"private": false,
|
"private": false,
|
||||||
"version": "2.0.8",
|
"version": "1.3.19",
|
||||||
"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": "^6.2.5",
|
"@ant-design/icons": "^5.6.1",
|
||||||
"@ant-design/pro-components": "^3.1.12-0",
|
"@ant-design/pro-components": "^2.8.10",
|
||||||
"@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": "^6.4.4",
|
"antd": "^5.27.6",
|
||||||
"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",
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@ 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;
|
||||||
/** 获取父级节点 */
|
/** 获取父级节点 */
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ function BasicCascader(props) {
|
||||||
onGetData,
|
onGetData,
|
||||||
onChange,
|
onChange,
|
||||||
onGetNodePaths,
|
onGetNodePaths,
|
||||||
|
onGetNodePathsIsIncludeOneself,
|
||||||
getNodePathsIsIncludeOneself = true,
|
getNodePathsIsIncludeOneself = true,
|
||||||
placeholder = "",
|
placeholder = "",
|
||||||
data = [],
|
data = [],
|
||||||
|
|
@ -20,6 +21,14 @@ 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
|
||||||
|
|
@ -34,7 +43,7 @@ function BasicCascader(props) {
|
||||||
|
|
||||||
const getNodePaths = (selectedOptions) => {
|
const getNodePaths = (selectedOptions) => {
|
||||||
let nodePaths = selectedOptions;
|
let nodePaths = selectedOptions;
|
||||||
if (!getNodePathsIsIncludeOneself && selectedOptions) {
|
if (!finalGetNodePathsIsIncludeOneself && selectedOptions) {
|
||||||
nodePaths = selectedOptions.slice(0, -1);
|
nodePaths = selectedOptions.slice(0, -1);
|
||||||
}
|
}
|
||||||
return nodePaths || [];
|
return nodePaths || [];
|
||||||
|
|
|
||||||
|
|
@ -44,11 +44,6 @@ 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;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ const FormBuilder = (props) => {
|
||||||
showCancelButton = true,
|
showCancelButton = true,
|
||||||
customActionButtons,
|
customActionButtons,
|
||||||
extraActionButtons,
|
extraActionButtons,
|
||||||
history,
|
|
||||||
loading = false,
|
loading = false,
|
||||||
...restProps
|
...restProps
|
||||||
} = props;
|
} = props;
|
||||||
|
|
@ -52,7 +51,7 @@ const FormBuilder = (props) => {
|
||||||
}, [showActionButtons]);
|
}, [showActionButtons]);
|
||||||
|
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
history?.goBack ? history.goBack() : window.history.back();
|
window.history.back();
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
@ -79,7 +78,7 @@ const FormBuilder = (props) => {
|
||||||
/>
|
/>
|
||||||
</Row>
|
</Row>
|
||||||
{showActionButtons && (
|
{showActionButtons && (
|
||||||
<div style={{ position: "relative", zIndex: "99" }}>
|
<div style={{ position: "relative", zIndex: "9" }}>
|
||||||
<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" }}
|
||||||
|
|
|
||||||
|
|
@ -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 { CSSProperties, ReactElement, ReactNode } from "react";
|
import type { NamePath } from "rc-field-form/lib/interface";
|
||||||
|
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,10 +131,6 @@ 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)>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -161,10 +157,6 @@ 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>;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -84,8 +84,12 @@ const FormItemsRenderer = ({
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// 设置日期组件的属性
|
// 获取传给formItem的属性
|
||||||
const setDateComponentProps = (option, formItemProps) => {
|
const getFormItemProps = (option) => {
|
||||||
|
const formItemProps = typeof option.formItemProps === "function"
|
||||||
|
? option.formItemProps(getFormValues())
|
||||||
|
: (option.formItemProps || {});
|
||||||
|
|
||||||
// 为日期组件添加特殊处理
|
// 为日期组件添加特殊处理
|
||||||
if ([
|
if ([
|
||||||
FORM_ITEM_RENDER_ENUM.DATE,
|
FORM_ITEM_RENDER_ENUM.DATE,
|
||||||
|
|
@ -113,15 +117,6 @@ 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;
|
||||||
};
|
};
|
||||||
|
|
@ -223,39 +218,6 @@ 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
|
||||||
|
|
@ -302,7 +264,7 @@ const FormItemsRenderer = ({
|
||||||
|
|
||||||
case FORM_ITEM_RENDER_ENUM.SELECT:
|
case FORM_ITEM_RENDER_ENUM.SELECT:
|
||||||
return (
|
return (
|
||||||
<Select placeholder={placeholder} showSearch={{ optionFilterProp: "children" }} allowClear {...componentProps}>
|
<Select placeholder={placeholder} showSearch allowClear optionFilterProp="children" {...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 (
|
||||||
|
|
@ -458,12 +420,8 @@ 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, ...getColStyle(option) }}>
|
<Col key={getKey(option) || index} span={col.span} style={style}>
|
||||||
{getColTitle(option)}
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name={option.name}
|
name={option.name}
|
||||||
label={renderLabel(option)}
|
label={renderLabel(option)}
|
||||||
|
|
@ -485,9 +443,6 @@ 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 (
|
||||||
|
|
@ -515,7 +470,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 titlePlacement="start" {...componentProps}>{option.label}</Divider>
|
<Divider orientation="left" {...componentProps}>{option.label}</Divider>
|
||||||
</Col>
|
</Col>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -523,28 +478,43 @@ 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, ...getColStyle(option) }}>
|
<Col key={getKey(option) || index} span={col.span} style={style}>
|
||||||
{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} style={rowStyle}>
|
<Row gutter={gutter} key={field.key}>
|
||||||
{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);
|
||||||
|
|
||||||
|
|
@ -555,12 +525,6 @@ 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;
|
||||||
|
|
@ -568,6 +532,9 @@ 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;
|
||||||
|
|
@ -595,10 +562,8 @@ 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, ...getColStyle(listOption) }}>
|
<Col key={getKey(listOption) || listIndex} span={col.span} style={style}>
|
||||||
{getColTitle(listOption)}
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={renderLabel(listOption)}
|
label={renderLabel(listOption)}
|
||||||
labelCol={col.labelCol}
|
labelCol={col.labelCol}
|
||||||
|
|
@ -609,7 +574,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, minWidth: 0 }}>
|
<div style={{ flex: 1 }}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
noStyle
|
noStyle
|
||||||
rules={getRules(listOption)}
|
rules={getRules(listOption)}
|
||||||
|
|
@ -664,35 +629,12 @@ 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);
|
||||||
|
|
@ -705,10 +647,6 @@ 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)
|
||||||
|
|
@ -718,6 +656,10 @@ 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);
|
||||||
})}
|
})}
|
||||||
|
|
|
||||||
|
|
@ -17,14 +17,12 @@ function HeaderBack(props) {
|
||||||
<>
|
<>
|
||||||
<div
|
<div
|
||||||
className="back"
|
className="back"
|
||||||
onClick={() => {
|
onClick={() => history?.goBack?.() || window.history.back()}
|
||||||
history?.goBack ? history.goBack() : window.history.back();
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<ArrowLeftOutlined style={{ fontSize: 14 }} />
|
<ArrowLeftOutlined style={{ fontSize: 14 }} />
|
||||||
<span>返回</span>
|
<span>返回</span>
|
||||||
</div>
|
</div>
|
||||||
<Divider orientation="vertical" style={{ backgroundColor: "#dcdfe6", marginLeft: 15, marginRight: 15 }} />
|
<Divider type="vertical" style={{ backgroundColor: "#dcdfe6", marginLeft: 15, marginRight: 15 }} />
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ function HiddenInfo(props) {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Spin spinning={loading || downloadFileLoading}>
|
<Spin spinning={loading || downloadFileLoading}>
|
||||||
<Divider titlePlacement="start">隐患信息</Divider>
|
<Divider orientation="left">隐患信息</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 titlePlacement="start">整改信息(发现人预填)</Divider>
|
<Divider orientation="left">整改信息(发现人预填)</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 titlePlacement="start">隐患确认</Divider>
|
<Divider orientation="left">隐患确认</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 titlePlacement="start">延期信息</Divider>
|
<Divider orientation="left">延期信息</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 titlePlacement="start">特殊处置审核信息</Divider>
|
<Divider orientation="left">特殊处置审核信息</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 titlePlacement="start">整改信息</Divider>
|
<Divider orientation="left">整改信息</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 titlePlacement="start">验收信息</Divider>
|
<Divider orientation="left">验收信息</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 titlePlacement="start">验收打回信息</Divider>
|
<Divider orientation="left">验收打回信息</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 titlePlacement="start">安全环保验收信息</Divider>
|
<Divider orientation="left">安全环保验收信息</Divider>
|
||||||
<Descriptions
|
<Descriptions
|
||||||
bordered
|
bordered
|
||||||
column={1}
|
column={1}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ const ImportFile = (props) => {
|
||||||
open={visible}
|
open={visible}
|
||||||
onCancel={handleClose}
|
onCancel={handleClose}
|
||||||
width={600}
|
width={600}
|
||||||
mask={{ closable: false }}
|
maskClosable={false}
|
||||||
footer={[
|
footer={[
|
||||||
templateUrl && (
|
templateUrl && (
|
||||||
<Button key="export" onClick={handleExportTemplate}>
|
<Button key="export" onClick={handleExportTemplate}>
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@ 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;
|
||||||
/** 获取父级节点 */
|
/** 获取父级节点 */
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ const BasicLeftTree = (props) => {
|
||||||
onGetData,
|
onGetData,
|
||||||
onSelect,
|
onSelect,
|
||||||
onGetNodePaths,
|
onGetNodePaths,
|
||||||
|
onGetNodePathsIsIncludeOneself,
|
||||||
getNodePathsIsIncludeOneself = true,
|
getNodePathsIsIncludeOneself = true,
|
||||||
expandedKeys: externalExpandedKeys,
|
expandedKeys: externalExpandedKeys,
|
||||||
treeData = [],
|
treeData = [],
|
||||||
|
|
@ -21,6 +22,14 @@ 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);
|
||||||
|
|
@ -81,7 +90,7 @@ const BasicLeftTree = (props) => {
|
||||||
targetId: selectedNodeId,
|
targetId: selectedNodeId,
|
||||||
idKey,
|
idKey,
|
||||||
childrenKey,
|
childrenKey,
|
||||||
isIncludeOneself: getNodePathsIsIncludeOneself,
|
isIncludeOneself: finalGetNodePathsIsIncludeOneself,
|
||||||
});
|
});
|
||||||
onGetNodePaths?.(parentNodes);
|
onGetNodePaths?.(parentNodes);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -267,7 +267,7 @@ const MapSelector = (props) => {
|
||||||
onCancel={handleClose}
|
onCancel={handleClose}
|
||||||
width={1000}
|
width={1000}
|
||||||
destroyOnHidden={false}
|
destroyOnHidden={false}
|
||||||
mask={{ closable: false }}
|
maskClosable={false}
|
||||||
afterClose={handleAfterClose}
|
afterClose={handleAfterClose}
|
||||||
footer={[
|
footer={[
|
||||||
<Button key="back" onClick={handleClose}>
|
<Button key="back" onClick={handleClose}>
|
||||||
|
|
|
||||||
|
|
@ -55,17 +55,13 @@ 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: "99" }}>
|
<div className="page-layout-footer" style={{ position: "relative", zIndex: "9" }}>
|
||||||
<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
|
<Button onClick={() => history?.goBack?.() || window.history.back()}>
|
||||||
onClick={() => {
|
|
||||||
history?.goBack ? history.goBack() : window.history.back();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{backButtonText}
|
{backButtonText}
|
||||||
</Button>
|
</Button>
|
||||||
</Space>
|
</Space>
|
||||||
|
|
|
||||||
|
|
@ -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}
|
||||||
mask={{ closable: false }}
|
maskClosable={false}
|
||||||
width={isFullscreen ? "100vw" : pdfWidth + 100}
|
width={isFullscreen ? "100vw" : pdfWidth + 100}
|
||||||
title={title}
|
title={title}
|
||||||
onCancel={() => {
|
onCancel={() => {
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ function BasicSelect(props) {
|
||||||
}, [data]);
|
}, [data]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Select placeholder={`请选择${placeholder}`} showSearch={{ optionFilterProp: "children" }} allowClear onChange={handleChange} {...restProps}>
|
<Select placeholder={`请选择${placeholder}`} showSearch allowClear optionFilterProp="children" 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];
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@ 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;
|
||||||
/** 获取父级节点 */
|
/** 获取父级节点 */
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ function BasicSelectTree(props) {
|
||||||
onChange,
|
onChange,
|
||||||
onGetLabel,
|
onGetLabel,
|
||||||
onGetNodePaths,
|
onGetNodePaths,
|
||||||
|
onGetNodePathsIsIncludeOneself,
|
||||||
getNodePathsIsIncludeOneself = true,
|
getNodePathsIsIncludeOneself = true,
|
||||||
placeholder = "",
|
placeholder = "",
|
||||||
treeData = [],
|
treeData = [],
|
||||||
|
|
@ -22,6 +23,14 @@ 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
|
||||||
|
|
@ -55,7 +64,7 @@ function BasicSelectTree(props) {
|
||||||
targetId,
|
targetId,
|
||||||
idKey,
|
idKey,
|
||||||
childrenKey,
|
childrenKey,
|
||||||
isIncludeOneself: getNodePathsIsIncludeOneself,
|
isIncludeOneself: finalGetNodePathsIsIncludeOneself,
|
||||||
});
|
});
|
||||||
parentNodes.push(...currentParentNodes);
|
parentNodes.push(...currentParentNodes);
|
||||||
}
|
}
|
||||||
|
|
@ -72,7 +81,7 @@ function BasicSelectTree(props) {
|
||||||
targetId,
|
targetId,
|
||||||
idKey,
|
idKey,
|
||||||
childrenKey,
|
childrenKey,
|
||||||
isIncludeOneself: getNodePathsIsIncludeOneself,
|
isIncludeOneself: finalGetNodePathsIsIncludeOneself,
|
||||||
});
|
});
|
||||||
onGetNodePaths?.(parentNodes);
|
onGetNodePaths?.(parentNodes);
|
||||||
onGetLabel?.(parentNodes[parentNodes.length - 1][nameKey]);
|
onGetLabel?.(parentNodes[parentNodes.length - 1][nameKey]);
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ export interface Params {
|
||||||
inType?: InType[];
|
inType?: InType[];
|
||||||
/** 企业类型 1-监管 2-企业 3-相关方 */
|
/** 企业类型 1-监管 2-企业 3-相关方 */
|
||||||
enterpriseType?: EnterpriseType | EnterpriseType[];
|
enterpriseType?: EnterpriseType | EnterpriseType[];
|
||||||
[key: string]: any;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ function Signature(props) {
|
||||||
title="签字"
|
title="签字"
|
||||||
width={800}
|
width={800}
|
||||||
open={signatureModalOpen}
|
open={signatureModalOpen}
|
||||||
mask={{ closable: false }}
|
maskClosable={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>,
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ const Video = forwardRef(({
|
||||||
关闭
|
关闭
|
||||||
</Button>,
|
</Button>,
|
||||||
]}
|
]}
|
||||||
mask={{ closable: false }}
|
maskClosable={false}
|
||||||
onCancel={() => setVisible(false)}
|
onCancel={() => setVisible(false)}
|
||||||
>
|
>
|
||||||
{playerElement}
|
{playerElement}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
/**
|
|
||||||
* 文件上传类型枚举
|
|
||||||
*/
|
|
||||||
export declare const UPLOAD_FILE_TYPE_ENUM: {
|
|
||||||
1000: 1000; // template_task - 模板任务附件
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件上传类型对应的 path 枚举
|
|
||||||
*/
|
|
||||||
export declare const UPLOAD_FILE_PATH_ENUM: {
|
|
||||||
1000: "template_task";
|
|
||||||
};
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
/**
|
|
||||||
* 文件上传类型枚举
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* 文件上传类型枚举
|
|
||||||
*/
|
|
||||||
export const UPLOAD_FILE_TYPE_ENUM = {
|
|
||||||
1000: 1000, // template_task - 模板任务附件
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件上传类型对应的 path 枚举
|
|
||||||
*/
|
|
||||||
export const UPLOAD_FILE_PATH_ENUM = {
|
|
||||||
1000: "template_task",
|
|
||||||
};
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
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 as UPLOAD_FILE_TYPE_ENUM_AQD } from "../../enum/uploadFile/aqd";
|
import { UPLOAD_FILE_TYPE_ENUM } from "../../enum/uploadFile/gwj";
|
||||||
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";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -35,8 +34,7 @@ function useGetFile(returnType = "object") {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查eqType是否在UPLOAD_FILE_TYPE_ENUM中
|
// 检查eqType是否在UPLOAD_FILE_TYPE_ENUM中
|
||||||
const isValidEqType = Object.values(UPLOAD_FILE_TYPE_ENUM_GWJ).includes(eqType) || Object.values(UPLOAD_FILE_TYPE_ENUM_AQD).includes(eqType);
|
if (!Object.values(UPLOAD_FILE_TYPE_ENUM).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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,13 @@ 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,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
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 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, UPLOAD_FILE_TYPE_ENUM } from "../../enum/uploadFile/gwj";
|
||||||
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";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -47,14 +46,13 @@ function useUploadFile(returnType = "object") {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查type是否在UPLOAD_FILE_TYPE_ENUM中
|
// 检查type是否在UPLOAD_FILE_TYPE_ENUM中
|
||||||
const isValidType = Object.values(UPLOAD_FILE_TYPE_ENUM_GWJ).includes(params.type) || Object.values(UPLOAD_FILE_TYPE_ENUM_AQD).includes(params.type);
|
if (!Object.values(UPLOAD_FILE_TYPE_ENUM).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_GWJ[params.type] || UPLOAD_FILE_PATH_ENUM_AQD[params.type];
|
const path = UPLOAD_FILE_PATH_ENUM[params.type];
|
||||||
if (!path) {
|
if (!path) {
|
||||||
console.error(`【uploadFile】未找到 type ${params.type} 对应的 path `);
|
console.error(`【uploadFile】未找到 type ${params.type} 对应的 path `);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue