zy-react-library 2.0.9 → 2.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -167,19 +167,19 @@ import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
167
167
 
168
168
  ### OptionItem
169
169
 
170
- | 参数 | 类型 | 必填 | 说明 |
171
- | --- | --- | --- | --- |
172
- | `bianma` | `any` | 否 | 默认选项值字段。 |
173
- | `name` | `string \| ReactNode` | 否 | 默认选项标签字段。 |
174
- | `disabled` | `boolean` | 否 | 是否禁用当前选项。 |
175
- | `[key: string]` | `any` | 否 | 允许携带业务自定义字段。 |
170
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
171
+ | --- | --- | --- | --- | --- |
172
+ | `bianma` | `any` | 否 | - | 默认选项值字段。 |
173
+ | `name` | `string \| ReactNode` | 否 | - | 默认选项标签字段。 |
174
+ | `disabled` | `boolean` | 否 | `false` | 是否禁用当前选项。 |
175
+ | `[key: string]` | `any` | 否 | - | 允许携带业务自定义字段。 |
176
176
 
177
177
  ### ItemsFieldConfig
178
178
 
179
- | 参数 | 类型 | 必填 | 说明 |
180
- | --- | --- | --- | --- |
181
- | `valueKey` | `string` | 否 | 选项值字段名,默认使用 `bianma`。 |
182
- | `labelKey` | `string \| ((item) => ReactNode)` | 否 | 选项标签字段名或自定义标签渲染函数,默认使用 `name`。 |
179
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
180
+ | --- | --- | --- | --- | --- |
181
+ | `valueKey` | `string` | 否 | `"bianma"` | 选项值字段名。 |
182
+ | `labelKey` | `string \| ((item) => ReactNode)` | 否 | `"name"` | 选项标签字段名或自定义标签渲染函数。 |
183
183
 
184
184
  ### FormListUniqueProps
185
185
 
@@ -218,23 +218,41 @@ import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
218
218
  | `Page` | `isShowHeader=true`、`headerPrevious=true`、`isShowFooter=true`、`isShowAllAction=true`、`loading=false`、`backButtonText="关闭"`、`contentPadding="20px"`。 |
219
219
  | `HeaderBack` | `previous=true`。 |
220
220
  | `Upload` | `value=[]`、`ratio=""`、`showTip=true`、`multiple=true`;未传 `fileType` 时根据 `accept` 推断,默认按图片;图片默认 `accept=".jpg,.jpeg,.png"`、`maxCount=4`、`size=10`;视频默认 `accept=".mp4"`、`maxCount=1`、`size=100`;文档默认 `accept=".pdf,.doc,.docx"`、`maxCount=4`、`size=10`。 |
221
- | `ImportFile` | `title="导入"`、`labelCol={ span: 4 }`、`exportTemplateButtonText="导出模板"`;弹窗宽度 `600`,内置附件上传 `accept=".xls,.xlsx"`、`listType="text"`、`maxCount=1`。 |
222
- | `Pdf` | `visible=false`、`inline=false`、`title="PDF预览"`、`style={}`。 |
223
- | `TooltipPreviewImg` | `files=[]`、`fileUrlKey="filePath"`。 |
224
- | `BasicSelect` | `placeholder=""`、`data=[]`、`nameKey="name"`、`idKey="id"`,内置 `showSearch=true`、`allowClear=true`、`optionFilterProp="children"`。 |
225
- | `DictionarySelect` | `appKey=DICTIONARY_APP_KEY_ENUM.DEFAULT`、`dictValue=""`、`nameKey="dictLabel"`、`idKey="dictValue"`。 |
226
- | `PersonnelSelect` | `params={}`、`placeholder="人员"`、`isNeedCorpInfoId=false`、`isNeedDepartmentId=true`、`isNeedPostId=false`、`extraParams={}`,内部默认额外参数 `{ noMain: "", eqEmploymentFlag: 1 }`。 |
227
- | `BasicSelectTree` | `getNodePathsIsIncludeOneself=true`、`placeholder=""`、`treeData=[]`、`nameKey="name"`、`idKey="id"`、`childrenKey="children"`、`onlyLastLevel=false`,内置 `showSearch=true`、`allowClear=true`、`style={ width: "100%" }`。 |
228
- | `DictionarySelectTree` | `appKey=DICTIONARY_APP_KEY_ENUM.DEFAULT`、`dictValue=""`、`nameKey="dictLabel"`、`idKey="dictValue"`。 |
229
- | `HiddenLevelSelectTree` | `isShowNeglect=true`、`isShowLarger=true`、`isShowMajor=true`,内部固定 `placeholder="隐患级别"`、`onlyLastLevel=true`、`nameKey="dictLabel"`、`idKey="dictValue"`。 |
230
- | `BasicCascader` | `getNodePathsIsIncludeOneself=true`、`placeholder=""`、`data=[]`、`nameKey="name"`、`idKey="id"`、`childrenKey="children"`。 |
231
- | `AreaCascader` | 内部使用 `area.json`,默认 `nameKey="label"`、`idKey="value"`。 |
232
- | `IndustryCascader` | 内部使用 `industry.json`,默认 `nameKey="dict_label"`、`idKey="dict_value"`、`childrenKey="childrenList"`。 |
233
- | `DictionaryCascader` | `appKey=DICTIONARY_APP_KEY_ENUM.DEFAULT`、`dictValue=""`、`nameKey="dictLabel"`、`idKey="dictValue"`。 |
234
- | `BasicLeftTree` | `getNodePathsIsIncludeOneself=true`、`treeData=[]`、`nameKey="name"`、`idKey="id"`、`childrenKey="children"`,搜索框固定宽度容器 `300`。 |
235
- | `Map` | `longitudeProps="longitude"`、`latitudeProps="latitude"`、`required=true`、`area=""`、`showArea=false`、`disable=false`、`type="baidu"`。 |
236
- | `MapSelector` | `area=""`、`showArea=false`、`disable=false`、`type="baidu"`;弹窗宽度 `1000`、`maskClosable=false`、地图容器高度 `500px`。 |
237
- | `HiddenInfo` | `id=""`、`idKey="id"`、`hiddenId=""`、`hiddenIdKey="hiddenId"`、`history=false`。 |
221
+ | `ImportFile` | `title="导入"`、`labelCol={ span: 4 }`、`exportTemplateButtonText="导出模板"`;弹窗宽度 `600`,内置附件上传 `accept=".xls,.xlsx"`、`listType="text"`、`maxCount=1`。 |
222
+ | `PreviewImg` | `files=[]`、`fileUrlKey="filePath"`;图片固定 `width=100`、`height=100`,图片间距 `marginRight=10`、`marginBottom=10`。 |
223
+ | `PreviewPdf` | `files=[]`、`nameKey=""`、`urlKey=""`、`name=""`、`url=""`。 |
224
+ | `Pdf` | `visible=false`、`inline=false`、`title="PDF预览"`、`style={}`。 |
225
+ | `PreviewExcel` | `files=[]`、`nameKey=""`、`urlKey=""`、`name=""`、`url=""`。 |
226
+ | `Excel` | `visible=false`、`inline=false`、`title="Excel预览"`、`style={}`;弹窗宽度 `1000`,内容高度 `72vh`。 |
227
+ | `PreviewWord` | `files=[]`、`nameKey=""`、`urlKey=""`、`name=""`、`url=""`。 |
228
+ | `Word` | `visible=false`、`inline=false`、`title="Word预览"`、`style={}`;弹窗宽度 `900`,内容高度 `72vh`,默认背景 `#f5f5f5`、内边距 `24px`。 |
229
+ | `Video` | `source=""`、`vid=""`、`playAuth=""`、`cover=""`、`autoplay=true`、`showProgress=true`、`playTime=0`、`inline=false`、`isLive=false`、`width="100%"`、`height="600px"`、`title="视频"`、`visible=false`、`aliPlayerProps={}`;弹窗宽度 `800`。 |
230
+ | `AliPlayer` | `source=""`、`vid=""`、`playAuth=""`、`cover=""`、`width="100%"`、`height="600px"`、`autoplay=true`、`showProgress=true`、`isLive=false`、`playTime=0`。 |
231
+ | `Signature` | `width=752`、`height=300`、`url=""`;签名弹窗宽度 `800`,画笔颜色 `black`,画布背景 `rgb(255,255,255)`。 |
232
+ | `TooltipPreviewImg` | `files=[]`、`fileUrlKey="filePath"`。 |
233
+ | `SelectCreate` | `showDelete=true`、`label=""`、`maxCount=1`,内部固定 `mode="tags"`。 |
234
+ | `BasicSelect` | `placeholder=""`、`data=[]`、`nameKey="name"`、`idKey="id"`,内置 `showSearch=true`、`allowClear=true`、`optionFilterProp="children"`。 |
235
+ | `DictionarySelect` | `appKey=DICTIONARY_APP_KEY_ENUM.DEFAULT`、`dictValue=""`、`nameKey="dictLabel"`、`idKey="dictValue"`。 |
236
+ | `PersonnelSelect` | `params={}`、`placeholder="人员"`、`isNeedCorpInfoId=false`、`isNeedDepartmentId=true`、`isNeedPostId=false`、`extraParams={}`,内部默认额外参数 `{ noMain: "", eqEmploymentFlag: 1 }`。 |
237
+ | `BasicSelectTree` | `getNodePathsIsIncludeOneself=true`、`placeholder=""`、`treeData=[]`、`nameKey="name"`、`idKey="id"`、`childrenKey="children"`、`onlyLastLevel=false`,内置 `showSearch=true`、`allowClear=true`、`style={ width: "100%" }`。 |
238
+ | `AreaSelectTree` | 内部使用 `area.json`,默认 `nameKey="label"`、`idKey="value"`。 |
239
+ | `IndustrySelectTree` | 内部使用 `industry.json`,默认 `nameKey="dict_label"`、`idKey="dict_value"`、`childrenKey="childrenList"`。 |
240
+ | `DepartmentSelectTree` | `params={}`、`placeholder="部门"`、`isNeedCorpInfoId=false`、`isNeedParentId=false`、`searchType="current"`,内部固定 `childrenKey="childrenList"`。 |
241
+ | `DictionarySelectTree` | `appKey=DICTIONARY_APP_KEY_ENUM.DEFAULT`、`dictValue=""`、`nameKey="dictLabel"`、`idKey="dictValue"`。 |
242
+ | `HiddenLevelSelectTree` | `isShowNeglect=true`、`isShowLarger=true`、`isShowMajor=true`,内部固定 `placeholder="隐患级别"`、`onlyLastLevel=true`、`nameKey="dictLabel"`、`idKey="dictValue"`。 |
243
+ | `HiddenPartSelectTree` | `params={}`、`isNeedCorpInfoId=false`,内部固定 `placeholder="隐患部位"`、`nameKey="hiddenregion"`、`idKey="hiddenregionId"`。 |
244
+ | `BasicCascader` | `getNodePathsIsIncludeOneself=true`、`placeholder=""`、`data=[]`、`nameKey="name"`、`idKey="id"`、`childrenKey="children"`。 |
245
+ | `AreaCascader` | 内部使用 `area.json`,默认 `nameKey="label"`、`idKey="value"`。 |
246
+ | `IndustryCascader` | 内部使用 `industry.json`,默认 `nameKey="dict_label"`、`idKey="dict_value"`、`childrenKey="childrenList"`。 |
247
+ | `DictionaryCascader` | `appKey=DICTIONARY_APP_KEY_ENUM.DEFAULT`、`dictValue=""`、`nameKey="dictLabel"`、`idKey="dictValue"`。 |
248
+ | `BasicLeftTree` | `getNodePathsIsIncludeOneself=true`、`treeData=[]`、`nameKey="name"`、`idKey="id"`、`childrenKey="children"`,搜索框固定宽度容器 `300`。 |
249
+ | `AreaLeftTree` | 内部使用 `area.json`,默认 `nameKey="label"`、`idKey="value"`。 |
250
+ | `DictionaryLeftTree` | `appKey=DICTIONARY_APP_KEY_ENUM.DEFAULT`、`dictValue=""`、`nameKey="dictLabel"`、`idKey="dictValue"`。 |
251
+ | `DepartmentLeftTree` | `params={}`、`searchType="current"`,内部固定 `childrenKey="childrenList"`。 |
252
+ | `Map` | `longitudeProps="longitude"`、`latitudeProps="latitude"`、`required=true`、`area=""`、`showArea=false`、`disable=false`、`type="baidu"`。 |
253
+ | `MapSelector` | `area=""`、`showArea=false`、`disable=false`、`type="baidu"`;弹窗宽度 `1000`、`maskClosable=false`、地图容器高度 `500px`。 |
254
+ | `SeamlessScroll` | `value=true`、`list=[]`、`step=1`、`limitScrollNum=3`、`hover=true`、`direction="up"`、`singleHeight=0`、`singleWidth=0`、`singleWaitTime=1000`、`isRemUnit=false`、`isWatch=true`、`delay=0`、`ease="ease-in"`、`count=-1`、`copyNum=1`、`wheel=false`、`singleLine=false`。 |
255
+ | `HiddenInfo` | `id=""`、`idKey="id"`、`hiddenId=""`、`hiddenIdKey="hiddenId"`、`history=false`。 |
238
256
 
239
257
  ### Table
240
258
 
@@ -342,20 +360,20 @@ import Page from "zy-react-library/components/Page";
342
360
 
343
361
  页面容器组件。
344
362
 
345
- | 参数 | 类型 | 必填 | 说明 |
346
- | --- | --- | --- | --- |
347
- | `headerTitle` | `ReactNode` | 否 | 页头标题。 |
348
- | `history` | `{ goBack?: () => void; [key: string]: any }` | 否 | 路由历史对象,用于返回。 |
349
- | `isShowHeader` | `boolean` | 否 | 是否显示头部。 |
350
- | `headerPrevious` | `boolean` | 否 | 头部是否显示返回能力。 |
351
- | `isShowFooter` | `boolean` | 否 | 是否显示底部操作区。 |
352
- | `isShowAllAction` | `boolean` | 否 | 是否显示默认全部操作。 |
353
- | `loading` | `boolean` | 否 | 页面加载状态。 |
354
- | `backButtonText` | `string` | 否 | 返回按钮文案。 |
355
- | `contentPadding` | `string` | 否 | 内容区内边距。 |
356
- | `customActionButtons` | `ReactNode` | 否 | 自定义底部操作按钮。 |
357
- | `extraActionButtons` | `ReactNode` | 否 | 额外底部操作按钮。 |
358
- | `children` | `ReactNode \| (() => ReactNode)` | 是 | 页面内容。 |
363
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
364
+ | --- | --- | --- | --- | --- |
365
+ | `headerTitle` | `ReactNode` | 否 | - | 页头标题。 |
366
+ | `history` | `{ goBack?: () => void; [key: string]: any }` | 否 | `window.history.back` | 路由历史对象,用于返回;没有 `history.goBack` 时使用浏览器返回。 |
367
+ | `isShowHeader` | `boolean` | 否 | `true` | 是否显示头部。 |
368
+ | `headerPrevious` | `boolean` | 否 | `true` | 头部是否显示返回能力。 |
369
+ | `isShowFooter` | `boolean` | 否 | `true` | 是否显示底部操作区。 |
370
+ | `isShowAllAction` | `boolean` | 否 | `true` | 是否显示默认全部操作。 |
371
+ | `loading` | `boolean` | 否 | `false` | 页面加载状态,控制外层 `Spin`。 |
372
+ | `backButtonText` | `string` | 否 | `"关闭"` | 返回按钮文案。 |
373
+ | `contentPadding` | `string` | 否 | `"20px"` | 内容区内边距。 |
374
+ | `customActionButtons` | `ReactNode` | 否 | - | 自定义底部操作按钮;传入后替换默认底部按钮组。 |
375
+ | `extraActionButtons` | `ReactNode` | 否 | - | 额外底部操作按钮,插入默认关闭按钮前。 |
376
+ | `children` | `ReactNode \| (() => ReactNode)` | 是 | - | 页面内容。 |
359
377
 
360
378
  ### HeaderBack
361
379
 
@@ -367,11 +385,11 @@ import HeaderBack from "zy-react-library/components/HeaderBack";
367
385
 
368
386
  页头返回组件。
369
387
 
370
- | 参数 | 类型 | 必填 | 说明 |
371
- | --- | --- | --- | --- |
372
- | `title` | `ReactNode` | 是 | 标题内容。 |
373
- | `history` | `{ goBack?: () => void; [key: string]: any }` | 否 | 路由历史对象。 |
374
- | `previous` | `boolean` | 否 | 是否显示返回操作。 |
388
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
389
+ | --- | --- | --- | --- | --- |
390
+ | `title` | `ReactNode` | 是 | - | 标题内容。 |
391
+ | `history` | `{ goBack?: () => void; [key: string]: any }` | 否 | `window.history.back` | 路由历史对象;没有 `history.goBack` 时使用浏览器返回。 |
392
+ | `previous` | `boolean` | 否 | `true` | 是否显示返回操作。 |
375
393
 
376
394
  ### Upload
377
395
 
@@ -383,16 +401,20 @@ import Upload from "zy-react-library/components/Upload";
383
401
 
384
402
  上传组件,继承 `Omit<AntUploadProps, "fileList">`。
385
403
 
386
- | 参数 | 类型 | 必填 | 说明 |
387
- | --- | --- | --- | --- |
388
- | `value` | `UploadFile[]` | 否 | 当前文件列表。 |
389
- | `ratio` | `` `${number}*${number}` `` | 否 | 图片宽高比例提示,例如 `"16*9"`。 |
390
- | `showTip` | `boolean` | 否 | 是否显示上传提示。 |
391
- | `size` | `number` | 否 | 文件大小限制。 |
392
- | `tipContent` | `ReactNode` | 否 | 自定义提示内容。 |
393
- | `uploadButtonText` | `string` | 否 | 上传按钮文案。 |
394
- | `fileType` | `"image" \| "video" \| "document"` | 否 | 文件类型。 |
395
- | `onGetRemoveFile` | `(file: Omit<UploadFile, "originFileObj">) => void` | 否 | 删除文件时返回被移除的文件。 |
404
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
405
+ | --- | --- | --- | --- | --- |
406
+ | `value` | `UploadFile[]` | 否 | `[]` | 当前文件列表。 |
407
+ | `ratio` | `` `${number}*${number}` `` | 否 | `""` | 图片宽高比例提示,例如 `"16*9"`。 |
408
+ | `showTip` | `boolean` | 否 | `true` | 是否显示上传提示。 |
409
+ | `size` | `number` | 否 | 图片/文档 `10`,视频 `100` | 文件大小限制,单位 MB。 |
410
+ | `tipContent` | `ReactNode` | 否 | 自动生成提示文案 | 自定义提示内容。 |
411
+ | `uploadButtonText` | `string` | 否 | 视频 `"上传视频"`,其他 `"上传附件"` | 上传按钮文案。 |
412
+ | `fileType` | `"image" \| "video" \| "document"` | 否 | 根据 `accept` 推断,默认 `"image"` | 文件类型。 |
413
+ | `onGetRemoveFile` | `(file: Omit<UploadFile, "originFileObj">) => void` | 否 | - | 删除文件时返回被移除的文件。 |
414
+ | `multiple` | `boolean` | 否 | `true` | 是否允许多选,继承自 antd Upload。 |
415
+ | `maxCount` | `number` | 否 | 图片/文档 `4`,视频 `1` | 最大上传数量,继承自 antd Upload。 |
416
+ | `accept` | `string` | 否 | 图片 `.jpg,.jpeg,.png`;视频 `.mp4`;文档 `.pdf,.doc,.docx` | 允许的文件类型,继承自 antd Upload。 |
417
+ | `listType` | `string` | 否 | 图片 `"picture-card"`,其他 `"text"` | 上传列表样式,继承自 antd Upload。 |
396
418
 
397
419
  ### ImportFile
398
420
 
@@ -404,16 +426,17 @@ import ImportFile from "zy-react-library/components/ImportFile";
404
426
 
405
427
  文件导入弹窗,继承 `Omit<FormProps, "form">`。
406
428
 
407
- | 参数 | 类型 | 必填 | 说明 |
408
- | --- | --- | --- | --- |
409
- | `visible` | `boolean` | 是 | 是否显示弹窗。 |
410
- | `title` | `string` | 否 | 弹窗标题。 |
411
- | `templateUrl` | `string` | 否 | 导入模板下载地址。 |
412
- | `children` | `ReactNode \| ((props: { form: FormInstance }) => ReactNode)` | 否 | 自定义弹窗内容;函数形式可拿到内部表单实例。 |
413
- | `onConfirm` | `(values: { file?: UploadFile[]; [key: string]: any }) => void` | 是 | 确认导入回调。 |
414
- | `onCancel` | `() => void` | 是 | 取消回调。 |
415
- | `exportTemplateButtonText` | `ReactNode` | 否 | 下载模板按钮文案。 |
416
- | `extraButtons` | `ReactNode` | 否 | 额外按钮。 |
429
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
430
+ | --- | --- | --- | --- | --- |
431
+ | `visible` | `boolean` | 是 | - | 是否显示弹窗。 |
432
+ | `title` | `string` | 否 | `"导入"` | 弹窗标题。 |
433
+ | `templateUrl` | `string` | 否 | - | 导入模板下载地址。 |
434
+ | `children` | `ReactNode \| ((props: { form: FormInstance }) => ReactNode)` | 否 | - | 自定义弹窗内容;函数形式可拿到内部表单实例。 |
435
+ | `onConfirm` | `(values: { file?: UploadFile[]; [key: string]: any }) => void` | 是 | - | 确认导入回调。 |
436
+ | `onCancel` | `() => void` | 是 | - | 取消回调。 |
437
+ | `exportTemplateButtonText` | `ReactNode` | 否 | `"导出模板"` | 下载模板按钮文案。 |
438
+ | `extraButtons` | `ReactNode` | 否 | - | 额外按钮。 |
439
+ | `labelCol` | `ColProps` | 否 | `{ span: 4 }` | 表单标签栅格,继承自 `FormProps`。 |
417
440
 
418
441
  ### PreviewImg
419
442
 
@@ -425,10 +448,10 @@ import PreviewImg from "zy-react-library/components/PreviewImg";
425
448
 
426
449
  图片预览组件。
427
450
 
428
- | 参数 | 类型 | 必填 | 说明 |
429
- | --- | --- | --- | --- |
430
- | `files` | `string[] \| { filePath?: string; [key: string]: string }[]` | 是 | 图片地址数组,或包含图片地址字段的对象数组。 |
431
- | `fileUrlKey` | `string` | 否 | 对象数组中图片地址字段名。 |
451
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
452
+ | --- | --- | --- | --- | --- |
453
+ | `files` | `string[] \| { filePath?: string; [key: string]: string }[]` | 是 | `[]` | 图片地址数组,或包含图片地址字段的对象数组。 |
454
+ | `fileUrlKey` | `string` | 否 | `"filePath"` | 对象数组中图片地址字段名。 |
432
455
 
433
456
  ### TooltipPreviewImg
434
457
 
@@ -450,17 +473,17 @@ import PreviewPdf from "zy-react-library/components/PreviewPdf";
450
473
 
451
474
  PDF 预览入口组件。
452
475
 
453
- | 参数 | 类型 | 必填 | 说明 |
454
- | --- | --- | --- | --- |
455
- | `files` | `{ filePath?: string; fileName?: string; name?: string; [key: string]: string }[]` | 否 | PDF 文件对象数组。 |
456
- | `nameKey` | `string` | 否 | 文件名字段名。 |
457
- | `urlKey` | `string` | 否 | 文件地址字段名。 |
458
- | `name` | `string` | 否 | 单文件文件名。 |
459
- | `url` | `string` | 否 | 单文件地址。 |
476
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
477
+ | --- | --- | --- | --- | --- |
478
+ | `files` | `{ filePath?: string; fileName?: string; name?: string; [key: string]: string }[]` | 否 | `[]` | PDF 文件对象数组。 |
479
+ | `nameKey` | `string` | 否 | `""` | 文件名字段名;不传时优先取 `name`、`fileName`。 |
480
+ | `urlKey` | `string` | 否 | `""` | 文件地址字段名;不传时优先取 `filePath`。 |
481
+ | `name` | `string` | 否 | `""` | 单文件文件名。 |
482
+ | `url` | `string` | 否 | `""` | 单文件地址。 |
460
483
 
461
- ### Pdf
462
-
463
- 引入:
484
+ ### Pdf
485
+
486
+ 引入:
464
487
 
465
488
  ```tsx
466
489
  import Pdf from "zy-react-library/components/Pdf";
@@ -468,19 +491,95 @@ import Pdf from "zy-react-library/components/Pdf";
468
491
 
469
492
  PDF 展示组件。
470
493
 
471
- | 参数 | 类型 | 必填 | 说明 |
472
- | --- | --- | --- | --- |
473
- | `file` | `string` | 是 | PDF 文件地址。 |
474
- | `name` | `string` | 否 | 文件名。 |
475
- | `visible` | `boolean` | 否 | 是否以弹窗形式显示。 |
476
- | `title` | `string` | 否 | 弹窗标题。 |
477
- | `onCancel` | `() => void` | 否 | 关闭弹窗回调。 |
478
- | `inline` | `boolean` | 否 | 是否内联展示。 |
479
- | `style` | `CSSProperties` | 否 | 外层样式。 |
480
-
481
- ### Video
482
-
483
- 引入:
494
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
495
+ | --- | --- | --- | --- | --- |
496
+ | `file` | `string` | 是 | - | PDF 文件地址。 |
497
+ | `name` | `string` | 否 | - | 文件名。 |
498
+ | `visible` | `boolean` | 否 | `false` | 是否以弹窗形式显示。 |
499
+ | `title` | `string` | 否 | `"PDF预览"` | 弹窗标题。 |
500
+ | `onCancel` | `() => void` | 否 | - | 关闭弹窗回调。 |
501
+ | `inline` | `boolean` | 否 | `false` | 是否内联展示。 |
502
+ | `style` | `CSSProperties` | 否 | `{}` | 外层样式。 |
503
+
504
+ ### PreviewExcel
505
+
506
+ 引入:
507
+
508
+ ```tsx
509
+ import PreviewExcel from "zy-react-library/components/PreviewExcel";
510
+ ```
511
+
512
+ Excel 预览入口组件,使用方式和 `PreviewPdf` 一致,负责展示文件名和预览按钮。
513
+
514
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
515
+ | --- | --- | --- | --- | --- |
516
+ | `files` | `{ filePath?: string; fileName?: string; name?: string; url?: string; [key: string]: string }[]` | 否 | `[]` | Excel 文件对象数组;和 `name`、`url` 单文件模式互斥。 |
517
+ | `nameKey` | `string` | 否 | `""` | 文件名字段名;不传时优先取 `name`、`fileName`。 |
518
+ | `urlKey` | `string` | 否 | `""` | 文件地址字段名;不传时优先取 `filePath`、`url`。 |
519
+ | `name` | `string` | 否 | `""` | 单文件文件名;和 `files` 互斥。 |
520
+ | `url` | `string` | 否 | `""` | 单文件地址;和 `files` 互斥。 |
521
+
522
+ ### Excel
523
+
524
+ 引入:
525
+
526
+ ```tsx
527
+ import Excel from "zy-react-library/components/Excel";
528
+ ```
529
+
530
+ Excel 展示组件,使用 `exceljs` 解析 `xlsx`,再通过 `x-data-spreadsheet` 渲染表格预览。
531
+
532
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
533
+ | --- | --- | --- | --- | --- |
534
+ | `visible` | `boolean` | 否 | `false` | 是否以弹窗形式显示。 |
535
+ | `onCancel` | `() => void` | 否 | - | 关闭弹窗回调。 |
536
+ | `file` | `string` | 否 | - | `xlsx` 文件地址;非完整文件服务地址时会自动拼接 `getFileUrl()`。 |
537
+ | `name` | `string` | 否 | - | 文件名,用于下载。 |
538
+ | `inline` | `boolean` | 否 | `false` | 是否内联展示。 |
539
+ | `title` | `string` | 否 | `"Excel预览"` | 弹窗标题。 |
540
+ | `style` | `Record<string, any>` | 否 | `{}` | 内容区域样式,会合并到高度为 `72vh` 的外层容器。 |
541
+
542
+ ### PreviewWord
543
+
544
+ 引入:
545
+
546
+ ```tsx
547
+ import PreviewWord from "zy-react-library/components/PreviewWord";
548
+ ```
549
+
550
+ Word 预览入口组件,使用方式和 `PreviewPdf` 一致,负责展示文件名和预览按钮。
551
+
552
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
553
+ | --- | --- | --- | --- | --- |
554
+ | `files` | `{ filePath?: string; fileName?: string; name?: string; url?: string; [key: string]: string }[]` | 否 | `[]` | Word 文件对象数组;和 `name`、`url` 单文件模式互斥。 |
555
+ | `nameKey` | `string` | 否 | `""` | 文件名字段名;不传时优先取 `name`、`fileName`。 |
556
+ | `urlKey` | `string` | 否 | `""` | 文件地址字段名;不传时优先取 `filePath`、`url`。 |
557
+ | `name` | `string` | 否 | `""` | 单文件文件名;和 `files` 互斥。 |
558
+ | `url` | `string` | 否 | `""` | 单文件地址;和 `files` 互斥。 |
559
+
560
+ ### Word
561
+
562
+ 引入:
563
+
564
+ ```tsx
565
+ import Word from "zy-react-library/components/Word";
566
+ ```
567
+
568
+ Word 展示组件,使用 `docx-preview` 渲染 `docx` 文件。
569
+
570
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
571
+ | --- | --- | --- | --- | --- |
572
+ | `visible` | `boolean` | 否 | `false` | 是否以弹窗形式显示。 |
573
+ | `onCancel` | `() => void` | 否 | - | 关闭弹窗回调。 |
574
+ | `file` | `string` | 否 | - | `docx` 文件地址;非完整文件服务地址时会自动拼接 `getFileUrl()`。 |
575
+ | `name` | `string` | 否 | - | 文件名,用于下载。 |
576
+ | `inline` | `boolean` | 否 | `false` | 是否内联展示。 |
577
+ | `title` | `string` | 否 | `"Word预览"` | 弹窗标题。 |
578
+ | `style` | `Record<string, any>` | 否 | `{}` | 内容区域样式,会合并到默认高度 `72vh`、背景 `#f5f5f5`、内边距 `24px` 的外层容器。 |
579
+
580
+ ### Video
581
+
582
+ 引入:
484
583
 
485
584
  ```tsx
486
585
  import Video from "zy-react-library/components/Video";
@@ -488,12 +587,12 @@ import Video from "zy-react-library/components/Video";
488
587
 
489
588
  视频播放组件,继承 `AliPlayerProps`。
490
589
 
491
- | 参数 | 类型 | 必填 | 说明 |
492
- | --- | --- | --- | --- |
493
- | `title` | `string` | 否 | 弹窗标题。 |
494
- | `visible` | `boolean` | 否 | 是否显示弹窗。 |
495
- | `inline` | `boolean` | 否 | 是否内联展示。 |
496
- | `onCancel` | `() => void` | 否 | 关闭回调。 |
590
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
591
+ | --- | --- | --- | --- | --- |
592
+ | `title` | `string` | 否 | `"视频"` | 弹窗标题。 |
593
+ | `visible` | `boolean` | 否 | `false` | 是否显示弹窗;传 `onCancel` 时由外部控制。 |
594
+ | `inline` | `boolean` | 否 | `false` | 是否内联展示。 |
595
+ | `onCancel` | `() => void` | 否 | 内部状态关闭 | 关闭回调;不传时组件内部维护弹窗显隐。 |
497
596
 
498
597
  ### AliPlayer
499
598
 
@@ -505,22 +604,22 @@ import AliPlayer from "zy-react-library/components/Video/AliPlayer";
505
604
 
506
605
  阿里云播放器封装,支持 `ref`。
507
606
 
508
- | 参数 | 类型 | 必填 | 说明 |
509
- | --- | --- | --- | --- |
510
- | `source` | `string \| string[]` | 否 | 视频播放地址。 |
511
- | `vid` | `string` | 否 | 阿里云视频 ID。 |
512
- | `playAuth` | `string` | 否 | 阿里云播放凭证。 |
513
- | `cover` | `string` | 否 | 封面地址。 |
514
- | `width` | `string` | 否 | 播放器宽度。 |
515
- | `height` | `string` | 否 | 播放器高度。 |
516
- | `autoplay` | `boolean` | 否 | 是否自动播放。 |
517
- | `showProgress` | `boolean` | 否 | 是否显示进度条。 |
518
- | `isLive` | `boolean` | 否 | 是否为直播。 |
519
- | `playTime` | `number` | 否 | 初始播放时间。 |
520
- | `onEnded` | `() => void` | 否 | 播放结束回调。 |
521
- | `onTimeupdate` | `(currentTime: number) => void` | 否 | 播放时间更新回调。 |
522
- | `onGetPlayerInstance` | `(player: any) => void` | 否 | 获取播放器实例。 |
523
- | `aliPlayerProps` | `Record<string, any>` | 否 | 透传给 AliPlayer 的额外属性。 |
607
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
608
+ | --- | --- | --- | --- | --- |
609
+ | `source` | `string \| string[]` | 否 | `""` | 视频播放地址。 |
610
+ | `vid` | `string` | 否 | `""` | 阿里云视频 ID。 |
611
+ | `playAuth` | `string` | 否 | `""` | 阿里云播放凭证。 |
612
+ | `cover` | `string` | 否 | `""` | 封面地址。 |
613
+ | `width` | `string` | 否 | `"100%"` | 播放器宽度。 |
614
+ | `height` | `string` | 否 | `"600px"` | 播放器高度。 |
615
+ | `autoplay` | `boolean` | 否 | `true` | 是否自动播放。 |
616
+ | `showProgress` | `boolean` | 否 | `true` | 是否显示进度条。 |
617
+ | `isLive` | `boolean` | 否 | `false` | 是否为直播。 |
618
+ | `playTime` | `number` | 否 | `0` | 初始播放时间,大于 0 时会 seek 到该时间。 |
619
+ | `onEnded` | `() => void` | 否 | - | 播放结束回调。 |
620
+ | `onTimeupdate` | `(currentTime: number) => void` | 否 | - | 播放时间更新回调。 |
621
+ | `onGetPlayerInstance` | `(player: any) => void` | 否 | - | 获取播放器实例。 |
622
+ | `aliPlayerProps` | `Record<string, any>` | 否 | - | 透传给 AliPlayer 的额外属性。 |
524
623
 
525
624
  Ref 方法:
526
625
 
@@ -540,11 +639,11 @@ import Editor from "zy-react-library/components/Editor";
540
639
 
541
640
  富文本编辑器组件,支持 `ref`。
542
641
 
543
- | 参数 | 类型 | 必填 | 说明 |
544
- | --- | --- | --- | --- |
545
- | `value` | `string` | 否 | HTML 内容。 |
546
- | `onChange` | `(html: string) => void` | 否 | 内容变化回调。 |
547
- | `disabled` | `boolean` | 否 | 是否禁用编辑。 |
642
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
643
+ | --- | --- | --- | --- | --- |
644
+ | `value` | `string` | 否 | - | HTML 内容。 |
645
+ | `onChange` | `(html: string) => void` | 否 | - | 内容变化回调。 |
646
+ | `disabled` | `boolean` | 否 | - | 是否禁用编辑。 |
548
647
 
549
648
  Ref 方法:
550
649
 
@@ -565,12 +664,12 @@ import Signature from "zy-react-library/components/Signature";
565
664
 
566
665
  手写签名组件。
567
666
 
568
- | 参数 | 类型 | 必填 | 说明 |
569
- | --- | --- | --- | --- |
570
- | `onConfirm` | `(value: SignatureValue) => void` | 是 | 确认签名回调。 |
571
- | `width` | `number` | 否 | 画布宽度。 |
572
- | `height` | `number` | 否 | 画布高度。 |
573
- | `url` | `string` | 否 | 已有签名图片地址。 |
667
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
668
+ | --- | --- | --- | --- | --- |
669
+ | `onConfirm` | `(value: SignatureValue) => void` | 是 | - | 确认签名回调。 |
670
+ | `width` | `number` | 否 | `752` | 签名画布宽度。 |
671
+ | `height` | `number` | 否 | `300` | 签名画布高度,也用于已签名图片预览高度。 |
672
+ | `url` | `string` | 否 | `""` | 已有签名图片地址。 |
574
673
 
575
674
  `SignatureValue`:
576
675
 
@@ -590,16 +689,16 @@ import Map from "zy-react-library/components/Map";
590
689
 
591
690
  地图选择组件。
592
691
 
593
- | 参数 | 类型 | 必填 | 说明 |
594
- | --- | --- | --- | --- |
595
- | `longitudeProps` | `string` | 否 | 经度字段名。 |
596
- | `latitudeProps` | `string` | 否 | 纬度字段名。 |
597
- | `required` | `boolean` | 否 | 是否必填。 |
598
- | `area` | `string` | 否 | 区域文本。 |
599
- | `showArea` | `boolean` | 否 | 是否显示区域。 |
600
- | `disable` | `boolean` | 否 | 是否禁用选择。 |
601
- | `onConfirm` | `(longitude, latitude, extra: { area: string }) => void` | 否 | 确认选择回调。 |
602
- | `type` | `"baidu" \| "cesium"` | 否 | 地图类型。 |
692
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
693
+ | --- | --- | --- | --- | --- |
694
+ | `longitudeProps` | `string` | 否 | `"longitude"` | 经度字段名。 |
695
+ | `latitudeProps` | `string` | 否 | `"latitude"` | 纬度字段名。 |
696
+ | `required` | `boolean` | 否 | `true` | 是否必填。 |
697
+ | `area` | `string` | 否 | `""` | 区域文本。 |
698
+ | `showArea` | `boolean` | 否 | `false` | 是否显示区域。 |
699
+ | `disable` | `boolean` | 否 | `false` | 是否禁用选择。 |
700
+ | `onConfirm` | `(longitude, latitude, extra: { area: string }) => void` | 否 | - | 确认选择回调。 |
701
+ | `type` | `"baidu" \| "cesium"` | 否 | `"baidu"` | 地图类型。 |
603
702
 
604
703
  ### MapSelector
605
704
 
@@ -611,17 +710,17 @@ import MapSelector from "zy-react-library/components/Map/MapSelector";
611
710
 
612
711
  地图选择弹窗。
613
712
 
614
- | 参数 | 类型 | 必填 | 说明 |
615
- | --- | --- | --- | --- |
616
- | `visible` | `boolean` | 是 | 是否显示弹窗。 |
617
- | `onClose` | `() => void` | 是 | 关闭回调。 |
618
- | `longitude` | `number \| string` | 否 | 初始经度。 |
619
- | `latitude` | `number \| string` | 否 | 初始纬度。 |
620
- | `area` | `string` | 否 | 初始区域文本。 |
621
- | `showArea` | `boolean` | 否 | 是否显示区域。 |
622
- | `disable` | `boolean` | 否 | 是否禁用选择。 |
623
- | `onConfirm` | `(longitude, latitude, extra: { area: string }) => void` | 否 | 确认选择回调。 |
624
- | `type` | `"baidu" \| "cesium"` | 否 | 地图类型。 |
713
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
714
+ | --- | --- | --- | --- | --- |
715
+ | `visible` | `boolean` | 是 | - | 是否显示弹窗。 |
716
+ | `onClose` | `() => void` | 是 | - | 关闭回调。 |
717
+ | `longitude` | `number \| string` | 否 | `""` | 初始经度;不传时使用 `window.mapLongitude` 初始化地图中心。 |
718
+ | `latitude` | `number \| string` | 否 | `""` | 初始纬度;不传时使用 `window.mapLatitude` 初始化地图中心。 |
719
+ | `area` | `string` | 否 | `""` | 初始区域文本。 |
720
+ | `showArea` | `boolean` | 否 | `false` | 是否显示区域。 |
721
+ | `disable` | `boolean` | 否 | `false` | 是否禁用选择。 |
722
+ | `onConfirm` | `(longitude, latitude, extra: { area: string }) => void` | 否 | - | 确认选择回调。 |
723
+ | `type` | `"baidu" \| "cesium"` | 否 | `"baidu"` | 地图类型。 |
625
724
 
626
725
  ### SeamlessScroll
627
726
 
@@ -633,26 +732,26 @@ import SeamlessScroll from "zy-react-library/components/SeamlessScroll";
633
732
 
634
733
  无缝滚动组件,支持 `ref.reset()`。
635
734
 
636
- | 参数 | 类型 | 必填 | 说明 |
637
- | --- | --- | --- | --- |
638
- | `value` | `boolean` | 否 | 是否启用滚动。 |
639
- | `list` | `unknown[]` | 是 | 滚动数据列表。 |
640
- | `step` | `number` | 否 | 滚动步长。 |
641
- | `limitScrollNum` | `number` | 否 | 触发滚动的最小数据条数。 |
642
- | `hover` | `boolean` | 否 | 鼠标悬浮时是否暂停。 |
643
- | `direction` | `"up" \| "down" \| "left" \| "right"` | 否 | 滚动方向。 |
644
- | `singleHeight` | `number` | 否 | 单条高度。 |
645
- | `singleWidth` | `number` | 否 | 单条宽度。 |
646
- | `singleWaitTime` | `number` | 否 | 单步滚动等待时间。 |
647
- | `isRemUnit` | `boolean` | 否 | 尺寸是否使用 rem 单位。 |
648
- | `isWatch` | `boolean` | 否 | 是否监听数据变化并重置滚动。 |
649
- | `delay` | `number` | 否 | 动画延迟。 |
650
- | `ease` | `string \| { x1: number; y1: number; x2: number; y2: number }` | 否 | 动画缓动函数。 |
651
- | `count` | `number` | 否 | 滚动次数。 |
652
- | `copyNum` | `number` | 否 | 复制列表份数。 |
653
- | `wheel` | `boolean` | 否 | 是否支持滚轮。 |
654
- | `singleLine` | `boolean` | 否 | 是否单行滚动。 |
655
- | `className` | `string` | 否 | 自定义类名。 |
735
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
736
+ | --- | --- | --- | --- | --- |
737
+ | `value` | `boolean` | 否 | `true` | 是否启用滚动。 |
738
+ | `list` | `unknown[]` | 是 | `[]` | 滚动数据列表。 |
739
+ | `step` | `number` | 否 | `1` | 滚动步长。 |
740
+ | `limitScrollNum` | `number` | 否 | `3` | 触发滚动的最小数据条数。 |
741
+ | `hover` | `boolean` | 否 | `true` | 鼠标悬浮时是否暂停。 |
742
+ | `direction` | `"up" \| "down" \| "left" \| "right"` | 否 | `"up"` | 滚动方向。 |
743
+ | `singleHeight` | `number` | 否 | `0` | 单条高度;大于 0 时按单条高度做停顿。 |
744
+ | `singleWidth` | `number` | 否 | `0` | 单条宽度;横向滚动时可用于单步停顿。 |
745
+ | `singleWaitTime` | `number` | 否 | `1000` | 单步滚动等待时间。 |
746
+ | `isRemUnit` | `boolean` | 否 | `false` | 尺寸是否使用 rem 单位。 |
747
+ | `isWatch` | `boolean` | 否 | `true` | 是否监听数据变化并重置滚动。 |
748
+ | `delay` | `number` | 否 | `0` | 动画延迟。 |
749
+ | `ease` | `string \| { x1: number; y1: number; x2: number; y2: number }` | 否 | `"ease-in"` | 动画缓动函数。 |
750
+ | `count` | `number` | 否 | `-1` | 滚动次数;`-1` 表示不限制次数。 |
751
+ | `copyNum` | `number` | 否 | `1` | 复制列表份数。 |
752
+ | `wheel` | `boolean` | 否 | `false` | 是否支持滚轮。 |
753
+ | `singleLine` | `boolean` | 否 | `false` | 是否单行滚动。 |
754
+ | `className` | `string` | 否 | - | 自定义类名。 |
656
755
 
657
756
  ### SelectCreate
658
757
 
@@ -664,12 +763,13 @@ import SelectCreate from "zy-react-library/components/SelectCreate";
664
763
 
665
764
  可创建/删除选项的选择器,继承 `antd SelectProps`。
666
765
 
667
- | 参数 | 类型 | 必填 | 说明 |
668
- | --- | --- | --- | --- |
669
- | `items` | `SelectCreateOption[]` | 是 | 选项列表。 |
670
- | `showDelete` | `boolean` | 否 | 是否显示删除选项能力。 |
671
- | `label` | `string` | 否 | 创建项标签文案。 |
672
- | `onDelete` | `(option: SelectCreateOption) => void` | | 删除选项回调。 |
766
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
767
+ | --- | --- | --- | --- | --- |
768
+ | `items` | `SelectCreateOption[]` | 是 | - | 选项列表。 |
769
+ | `showDelete` | `boolean` | 否 | `true` | 是否显示删除选项能力。 |
770
+ | `label` | `string` | 否 | `""` | 创建项标签文案,会拼到默认 placeholder 中。 |
771
+ | `maxCount` | `number` | | `1` | 最大选择数量,继承自 antd Select。 |
772
+ | `onDelete` | `(option: SelectCreateOption) => void` | 否 | - | 删除选项回调。 |
673
773
 
674
774
  `SelectCreateOption`:
675
775
 
@@ -688,14 +788,14 @@ import HiddenInfo from "zy-react-library/components/HiddenInfo/gwj";
688
788
 
689
789
  隐患信息展示组件。
690
790
 
691
- | 参数 | 类型 | 必填 | 说明 |
692
- | --- | --- | --- | --- |
693
- | `id` | `string` | 否 | 业务 ID。 |
694
- | `idKey` | `string` | 否 | 业务 ID 字段名。 |
695
- | `hiddenId` | `string` | 否 | 隐患 ID。 |
696
- | `hiddenIdKey` | `string` | 否 | 隐患 ID 字段名。 |
697
- | `history` | `boolean` | 否 | 是否展示历史相关内容。 |
698
- | `onGetData` | `(data: Record<string, any>) => void` | 否 | 获取详情数据后的回调。 |
791
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
792
+ | --- | --- | --- | --- | --- |
793
+ | `id` | `string` | 否 | `""` | 业务 ID。 |
794
+ | `idKey` | `string` | 否 | `"id"` | URL 查询参数中的业务 ID 字段名。 |
795
+ | `hiddenId` | `string` | 否 | `""` | 隐患 ID。 |
796
+ | `hiddenIdKey` | `string` | 否 | `"hiddenId"` | URL 查询参数中的隐患 ID 字段名。 |
797
+ | `history` | `boolean` | 否 | `false` | 是否请求历史详情接口。 |
798
+ | `onGetData` | `(data: Record<string, any>) => void` | 否 | - | 获取详情数据后的回调。 |
699
799
 
700
800
  ## Select 选择器
701
801
 
@@ -709,16 +809,16 @@ import BasicSelect from "zy-react-library/components/Select/Basic";
709
809
 
710
810
  基础选择器,继承 `antd SelectProps`。
711
811
 
712
- | 参数 | 类型 | 必填 | 说明 |
713
- | --- | --- | --- | --- |
714
- | `data` | `Record<string, any>[]` | 是 | 选项数据。 |
715
- | `nameKey` | `string` | 否 | 标签字段名。 |
716
- | `idKey` | `string` | 否 | 值字段名。 |
717
- | `placeholder` | `string` | 否 | 占位文案。 |
718
- | `onGetLabel` | `(label: string \| string[]) => void` | 否 | 选择后返回标签。 |
719
- | `onGetOption` | `(option: Record<string, any> \| Record<string, any>[]) => void` | 否 | 选择后返回选项对象。 |
720
- | `onGetData` | `(data: Record<string, any>[]) => void` | 否 | 返回处理后的选项数据。 |
721
- | `labelRender` | `(item: Record<string, any>) => ReactNode` | 否 | 自定义选项标签渲染。 |
812
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
813
+ | --- | --- | --- | --- | --- |
814
+ | `data` | `Record<string, any>[]` | 是 | `[]` | 选项数据。 |
815
+ | `nameKey` | `string` | 否 | `"name"` | 标签字段名。 |
816
+ | `idKey` | `string` | 否 | `"id"` | 值字段名。 |
817
+ | `placeholder` | `string` | 否 | `""` | 占位文案,最终显示为 `请选择${placeholder}`。 |
818
+ | `onGetLabel` | `(label: string \| string[]) => void` | 否 | - | 选择后返回标签。 |
819
+ | `onGetOption` | `(option: Record<string, any> \| Record<string, any>[]) => void` | 否 | - | 选择后返回选项对象。 |
820
+ | `onGetData` | `(data: Record<string, any>[]) => void` | 否 | - | 返回处理后的选项数据。 |
821
+ | `labelRender` | `(item: Record<string, any>) => ReactNode` | 否 | - | 自定义选项标签渲染。 |
722
822
 
723
823
  ### DictionarySelect
724
824
 
@@ -730,14 +830,14 @@ import DictionarySelect from "zy-react-library/components/Select/Dictionary";
730
830
 
731
831
  字典选择器,继承 `BasicSelectProps`,但内部接管 `data`、默认字段和部分回调。
732
832
 
733
- | 参数 | 类型 | 必填 | 说明 |
734
- | --- | --- | --- | --- |
735
- | `appKey` | `string` | 否 | 字典应用 key。 |
736
- | `dictValue` | `string` | 是 | 字典类型值。 |
737
- | `nameKey` | `string` | 否 | 标签字段名。 |
738
- | `idKey` | `string` | 否 | 值字段名。 |
739
- | `onGetOption` | `(option: DictionarySelectItem \| DictionarySelectItem[]) => void` | 否 | 选择后返回字典项。 |
740
- | `onGetData` | `(data: DictionarySelectItem[]) => void` | 否 | 返回字典数据。 |
833
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
834
+ | --- | --- | --- | --- | --- |
835
+ | `appKey` | `string` | 否 | `DICTIONARY_APP_KEY_ENUM.DEFAULT` | 字典应用 key。 |
836
+ | `dictValue` | `string` | 是 | `""` | 字典类型值;为空会输出缺少参数错误。 |
837
+ | `nameKey` | `string` | 否 | `"dictLabel"` | 标签字段名。 |
838
+ | `idKey` | `string` | 否 | `"dictValue"` | 值字段名。 |
839
+ | `onGetOption` | `(option: DictionarySelectItem \| DictionarySelectItem[]) => void` | 否 | - | 选择后返回字典项。 |
840
+ | `onGetData` | `(data: DictionarySelectItem[]) => void` | 否 | - | 返回字典数据。 |
741
841
 
742
842
  `DictionarySelectItem`:
743
843
 
@@ -756,16 +856,16 @@ import PersonnelSelect from "zy-react-library/components/Select/Personnel/Gwj";
756
856
 
757
857
  人员选择器,继承 `BasicSelectProps`,内部接管人员数据源和默认字段。
758
858
 
759
- | 参数 | 类型 | 必填 | 说明 |
760
- | --- | --- | --- | --- |
761
- | `params` | `Params` | 否 | 人员查询基础参数。 |
762
- | `placeholder` | `string` | 否 | 占位文案。 |
763
- | `isNeedCorpInfoId` | `boolean` | 否 | 是否需要企业 ID。 |
764
- | `isNeedPostId` | `boolean` | 否 | 是否需要岗位 ID。 |
765
- | `isNeedDepartmentId` | `boolean` | 否 | 是否需要部门 ID。 |
766
- | `extraParams` | `ExtraParams` | 否 | 人员查询额外参数。 |
767
- | `onGetOption` | `(option: PersonnelSelectItem \| PersonnelSelectItem[]) => void` | 否 | 选择后返回人员项。 |
768
- | `onGetData` | `(data: PersonnelSelectItem[]) => void` | 否 | 返回人员数据。 |
859
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
860
+ | --- | --- | --- | --- | --- |
861
+ | `params` | `Params` | 否 | `{}` | 人员查询基础参数。 |
862
+ | `placeholder` | `string` | 否 | `"人员"` | 占位文案,最终显示为 `请选择人员`。 |
863
+ | `isNeedCorpInfoId` | `boolean` | 否 | `false` | 是否需要企业 ID。 |
864
+ | `isNeedPostId` | `boolean` | 否 | `false` | 是否需要岗位 ID。 |
865
+ | `isNeedDepartmentId` | `boolean` | 否 | `true` | 是否需要部门 ID。 |
866
+ | `extraParams` | `ExtraParams` | 否 | `{}`,内部再合并 `{ noMain: "", eqEmploymentFlag: 1 }` | 人员查询额外参数。 |
867
+ | `onGetOption` | `(option: PersonnelSelectItem \| PersonnelSelectItem[]) => void` | 否 | - | 选择后返回人员项。 |
868
+ | `onGetData` | `(data: PersonnelSelectItem[]) => void` | 否 | - | 返回人员数据。 |
769
869
 
770
870
  `Params`:
771
871
 
@@ -811,18 +911,18 @@ import BasicSelectTree from "zy-react-library/components/SelectTree/Basic";
811
911
 
812
912
  基础树选择器,继承 `Omit<TreeSelectProps, "fieldNames">`。
813
913
 
814
- | 参数 | 类型 | 必填 | 说明 |
815
- | --- | --- | --- | --- |
816
- | `nameKey` | `string` | 否 | 节点标签字段名。 |
817
- | `idKey` | `string` | 否 | 节点值字段名。 |
818
- | `childrenKey` | `string` | 否 | 子节点字段名。 |
819
- | `getNodePathsIsIncludeOneself` | `boolean` | 否 | 获取节点路径时是否包含当前节点。 |
820
- | `onGetNodePaths` | `(nodes: Record<string, any>[]) => void` | 否 | 返回当前节点路径。 |
821
- | `placeholder` | `string` | 否 | 占位文案。 |
822
- | `level` | `number` | 否 | 限制展示层级。 |
823
- | `onGetLabel` | `(label: string \| string[]) => void` | 否 | 返回选中标签。 |
824
- | `onGetData` | `(data, processedData) => void` | 否 | 返回原始数据和处理后的数据。 |
825
- | `onlyLastLevel` | `boolean` | 否 | 是否只允许选择最后一级。 |
914
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
915
+ | --- | --- | --- | --- | --- |
916
+ | `nameKey` | `string` | 否 | `"name"` | 节点标签字段名。 |
917
+ | `idKey` | `string` | 否 | `"id"` | 节点值字段名。 |
918
+ | `childrenKey` | `string` | 否 | `"children"` | 子节点字段名。 |
919
+ | `getNodePathsIsIncludeOneself` | `boolean` | 否 | `true` | 获取节点路径时是否包含当前节点。 |
920
+ | `onGetNodePaths` | `(nodes: Record<string, any>[]) => void` | 否 | - | 返回当前节点路径。 |
921
+ | `placeholder` | `string` | 否 | `""` | 占位文案,最终显示为 `请选择${placeholder}`。 |
922
+ | `level` | `number` | 否 | - | 限制展示层级。 |
923
+ | `onGetLabel` | `(label: string \| string[]) => void` | 否 | - | 返回选中标签。 |
924
+ | `onGetData` | `(data, processedData) => void` | 否 | - | 返回原始数据和处理后的数据。 |
925
+ | `onlyLastLevel` | `boolean` | 否 | `false` | 是否只允许选择最后一级。 |
826
926
 
827
927
  ### AreaSelectTree
828
928
 
@@ -834,10 +934,10 @@ import AreaSelectTree from "zy-react-library/components/SelectTree/Area";
834
934
 
835
935
  地区树选择器,继承 `BasicSelectTree` 能力,内部接管地区数据、默认字段和占位文案。
836
936
 
837
- | 参数 | 类型 | 必填 | 说明 |
838
- | --- | --- | --- | --- |
839
- | `onGetNodePaths` | `(nodes: AreaSelectTreeItem[]) => void` | 否 | 返回地区节点路径。 |
840
- | `onGetData` | `(data: AreaSelectTreeItem[], processedData: AreaSelectTreeItem[]) => void` | 否 | 返回原始地区数据和处理后的地区数据。 |
937
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
938
+ | --- | --- | --- | --- | --- |
939
+ | `onGetNodePaths` | `(nodes: AreaSelectTreeItem[]) => void` | 否 | - | 返回地区节点路径。 |
940
+ | `onGetData` | `(data: AreaSelectTreeItem[], processedData: AreaSelectTreeItem[]) => void` | 否 | - | 返回原始地区数据和处理后的地区数据。 |
841
941
 
842
942
  `AreaSelectTreeItem`:`value: string`、`label: string`、`children: AreaSelectTreeItem[]`。
843
943
 
@@ -851,10 +951,10 @@ import IndustrySelectTree from "zy-react-library/components/SelectTree/Industry"
851
951
 
852
952
  行业树选择器。
853
953
 
854
- | 参数 | 类型 | 必填 | 说明 |
855
- | --- | --- | --- | --- |
856
- | `onGetNodePaths` | `(nodes: IndustrySelectTreeItem[]) => void` | 否 | 返回行业节点路径。 |
857
- | `onGetData` | `(data: IndustrySelectTreeItem[], processedData: IndustrySelectTreeItem[]) => void` | 否 | 返回原始行业数据和处理后的行业数据。 |
954
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
955
+ | --- | --- | --- | --- | --- |
956
+ | `onGetNodePaths` | `(nodes: IndustrySelectTreeItem[]) => void` | 否 | - | 返回行业节点路径。 |
957
+ | `onGetData` | `(data: IndustrySelectTreeItem[], processedData: IndustrySelectTreeItem[]) => void` | 否 | - | 返回原始行业数据和处理后的行业数据。 |
858
958
 
859
959
  `IndustrySelectTreeItem`:`dict_value: string`、`dict_label: string`、`childrenList: IndustrySelectTreeItem[]`。
860
960
 
@@ -868,10 +968,10 @@ import DictionarySelectTree from "zy-react-library/components/SelectTree/Diction
868
968
 
869
969
  字典树选择器。
870
970
 
871
- | 参数 | 类型 | 必填 | 说明 |
872
- | --- | --- | --- | --- |
873
- | `appKey` | `string` | 否 | 字典应用 key。 |
874
- | `dictValue` | `string` | 是 | 字典类型值。 |
971
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
972
+ | --- | --- | --- | --- | --- |
973
+ | `appKey` | `string` | 否 | `DICTIONARY_APP_KEY_ENUM.DEFAULT` | 字典应用 key。 |
974
+ | `dictValue` | `string` | 是 | - | 字典类型值。 |
875
975
  | `nameKey` | `string` | 否 | 节点标签字段名。 |
876
976
  | `idKey` | `string` | 否 | 节点值字段名。 |
877
977
  | `onGetNodePaths` | `(nodes: DictionarySelectTreeItem[]) => void` | 否 | 返回字典节点路径。 |
@@ -889,15 +989,15 @@ import DepartmentSelectTree from "zy-react-library/components/SelectTree/Departm
889
989
 
890
990
  部门树选择器。
891
991
 
892
- | 参数 | 类型 | 必填 | 说明 |
893
- | --- | --- | --- | --- |
894
- | `params` | `Params` | 否 | 部门查询参数。 |
895
- | `placeholder` | `string` | 否 | 占位文案。 |
896
- | `isNeedCorpInfoId` | `boolean` | 否 | 是否需要企业 ID。 |
897
- | `isNeedParentId` | `boolean` | 否 | 是否需要父级 ID。 |
898
- | `searchType` | `"current" \| "all" \| "inType"` | 否 | 查询范围类型。 |
899
- | `onGetNodePaths` | `(nodes: DepartmentSelectTreeItem[]) => void` | 否 | 返回部门节点路径。 |
900
- | `onGetData` | `(data: DepartmentSelectTreeItem[], processedData: DepartmentSelectTreeItem[]) => void` | 否 | 返回原始部门数据和处理后的部门数据。 |
992
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
993
+ | --- | --- | --- | --- | --- |
994
+ | `params` | `Params` | 否 | `{}` | 部门查询参数。 |
995
+ | `placeholder` | `string` | 否 | `"部门"` | 占位文案。 |
996
+ | `isNeedCorpInfoId` | `boolean` | 否 | `false` | 是否需要企业 ID。 |
997
+ | `isNeedParentId` | `boolean` | 否 | `false` | 是否需要父级 ID。 |
998
+ | `searchType` | `"current" \| "all" \| "inType"` | 否 | `"current"` | 查询范围类型。 |
999
+ | `onGetNodePaths` | `(nodes: DepartmentSelectTreeItem[]) => void` | 否 | - | 返回部门节点路径。 |
1000
+ | `onGetData` | `(data: DepartmentSelectTreeItem[], processedData: DepartmentSelectTreeItem[]) => void` | 否 | - | 返回原始部门数据和处理后的部门数据。 |
901
1001
 
902
1002
  `Params`:
903
1003
 
@@ -920,13 +1020,13 @@ import HiddenLevelSelectTree from "zy-react-library/components/SelectTree/Hidden
920
1020
 
921
1021
  隐患等级树选择器。
922
1022
 
923
- | 参数 | 类型 | 必填 | 说明 |
924
- | --- | --- | --- | --- |
925
- | `isShowNeglect` | `boolean` | 否 | 是否显示可忽略等级。 |
926
- | `isShowLarger` | `boolean` | 否 | 是否显示较大等级。 |
927
- | `isShowMajor` | `boolean` | 否 | 是否显示重大等级。 |
928
- | `onGetNodePaths` | `(nodes: HiddenLevelSelectTreeItem[]) => void` | 否 | 返回隐患等级节点路径。 |
929
- | `onGetData` | `(data: HiddenLevelSelectTreeItem[], processedData: HiddenLevelSelectTreeItem[]) => void` | 否 | 返回原始数据和处理后的数据。 |
1023
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
1024
+ | --- | --- | --- | --- | --- |
1025
+ | `isShowNeglect` | `boolean` | 否 | `true` | 是否显示可忽略等级。 |
1026
+ | `isShowLarger` | `boolean` | 否 | `true` | 是否显示较大等级。 |
1027
+ | `isShowMajor` | `boolean` | 否 | `true` | 是否显示重大等级。 |
1028
+ | `onGetNodePaths` | `(nodes: HiddenLevelSelectTreeItem[]) => void` | 否 | - | 返回隐患等级节点路径。 |
1029
+ | `onGetData` | `(data: HiddenLevelSelectTreeItem[], processedData: HiddenLevelSelectTreeItem[]) => void` | 否 | - | 返回原始数据和处理后的数据。 |
930
1030
 
931
1031
  `HiddenLevelSelectTreeItem`:`dictValue: string`、`dictLabel: string`、`children: HiddenLevelSelectTreeItem[]`。
932
1032
 
@@ -940,12 +1040,12 @@ import HiddenPartSelectTree from "zy-react-library/components/SelectTree/HiddenP
940
1040
 
941
1041
  隐患部位树选择器。
942
1042
 
943
- | 参数 | 类型 | 必填 | 说明 |
944
- | --- | --- | --- | --- |
945
- | `params` | `{ eqCorpinfoId?: string }` | 否 | 查询参数。 |
946
- | `isNeedCorpInfoId` | `boolean` | 否 | 是否需要企业 ID。 |
947
- | `onGetNodePaths` | `(nodes: HiddenPartSelectTreeItem[]) => void` | 否 | 返回隐患部位节点路径。 |
948
- | `onGetData` | `(data: HiddenPartSelectTreeItem[], processedData: HiddenPartSelectTreeItem[]) => void` | 否 | 返回原始数据和处理后的数据。 |
1043
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
1044
+ | --- | --- | --- | --- | --- |
1045
+ | `params` | `{ eqCorpinfoId?: string }` | 否 | `{}` | 查询参数。 |
1046
+ | `isNeedCorpInfoId` | `boolean` | 否 | `false` | 是否需要企业 ID。 |
1047
+ | `onGetNodePaths` | `(nodes: HiddenPartSelectTreeItem[]) => void` | 否 | - | 返回隐患部位节点路径。 |
1048
+ | `onGetData` | `(data: HiddenPartSelectTreeItem[], processedData: HiddenPartSelectTreeItem[]) => void` | 否 | - | 返回原始数据和处理后的数据。 |
949
1049
 
950
1050
  `HiddenPartSelectTreeItem`:`hiddenregionId: string`、`hiddenregion: string`、`children: HiddenPartSelectTreeItem[]`。
951
1051
 
@@ -961,16 +1061,16 @@ import BasicCascader from "zy-react-library/components/Cascader/Basic";
961
1061
 
962
1062
  基础级联选择器,继承 `Omit<CascaderProps, "fieldNames">`。
963
1063
 
964
- | 参数 | 类型 | 必填 | 说明 |
965
- | --- | --- | --- | --- |
966
- | `nameKey` | `string` | 否 | 节点标签字段名。 |
967
- | `idKey` | `string` | 否 | 节点值字段名。 |
968
- | `childrenKey` | `string` | 否 | 子节点字段名。 |
969
- | `getNodePathsIsIncludeOneself` | `boolean` | 否 | 获取节点路径时是否包含当前节点。 |
970
- | `onGetNodePaths` | `(nodes: Record<string, any>[]) => void` | 否 | 返回当前节点路径。 |
971
- | `placeholder` | `string` | 否 | 占位文案。 |
972
- | `level` | `number` | 否 | 限制展示层级。 |
973
- | `onGetData` | `(data, processedData) => void` | 否 | 返回原始数据和处理后的数据。 |
1064
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
1065
+ | --- | --- | --- | --- | --- |
1066
+ | `nameKey` | `string` | 否 | `"name"` | 节点标签字段名。 |
1067
+ | `idKey` | `string` | 否 | `"id"` | 节点值字段名。 |
1068
+ | `childrenKey` | `string` | 否 | `"children"` | 子节点字段名。 |
1069
+ | `getNodePathsIsIncludeOneself` | `boolean` | 否 | `true` | 获取节点路径时是否包含当前节点。 |
1070
+ | `onGetNodePaths` | `(nodes: Record<string, any>[]) => void` | 否 | - | 返回当前节点路径。 |
1071
+ | `placeholder` | `string` | 否 | `""` | 占位文案,最终显示为 `请选择${placeholder}`。 |
1072
+ | `level` | `number` | 否 | - | 限制展示层级。 |
1073
+ | `onGetData` | `(data, processedData) => void` | 否 | - | 返回原始数据和处理后的数据。 |
974
1074
 
975
1075
  ### AreaCascader
976
1076
 
@@ -982,10 +1082,10 @@ import AreaCascader from "zy-react-library/components/Cascader/Area";
982
1082
 
983
1083
  地区级联选择器。
984
1084
 
985
- | 参数 | 类型 | 必填 | 说明 |
986
- | --- | --- | --- | --- |
987
- | `onGetNodePaths` | `(nodes: AreaCascaderItem[]) => void` | 否 | 返回地区节点路径。 |
988
- | `onGetData` | `(data: AreaCascaderItem[], processedData: AreaCascaderItem[]) => void` | 否 | 返回原始地区数据和处理后的地区数据。 |
1085
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
1086
+ | --- | --- | --- | --- | --- |
1087
+ | `onGetNodePaths` | `(nodes: AreaCascaderItem[]) => void` | 否 | - | 返回地区节点路径。 |
1088
+ | `onGetData` | `(data: AreaCascaderItem[], processedData: AreaCascaderItem[]) => void` | 否 | - | 返回原始地区数据和处理后的地区数据。 |
989
1089
 
990
1090
  `AreaCascaderItem`:`value: string`、`label: string`、`children: AreaCascaderItem[]`。
991
1091
 
@@ -999,10 +1099,10 @@ import IndustryCascader from "zy-react-library/components/Cascader/Industry";
999
1099
 
1000
1100
  行业级联选择器。
1001
1101
 
1002
- | 参数 | 类型 | 必填 | 说明 |
1003
- | --- | --- | --- | --- |
1004
- | `onGetNodePaths` | `(nodes: IndustryCascaderItem[]) => void` | 否 | 返回行业节点路径。 |
1005
- | `onGetData` | `(data: IndustryCascaderItem[], processedData: IndustryCascaderItem[]) => void` | 否 | 返回原始行业数据和处理后的行业数据。 |
1102
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
1103
+ | --- | --- | --- | --- | --- |
1104
+ | `onGetNodePaths` | `(nodes: IndustryCascaderItem[]) => void` | 否 | - | 返回行业节点路径。 |
1105
+ | `onGetData` | `(data: IndustryCascaderItem[], processedData: IndustryCascaderItem[]) => void` | 否 | - | 返回原始行业数据和处理后的行业数据。 |
1006
1106
 
1007
1107
  `IndustryCascaderItem`:`dict_value: string`、`dict_label: string`、`childrenList: IndustryCascaderItem[]`。
1008
1108
 
@@ -1016,10 +1116,10 @@ import DictionaryCascader from "zy-react-library/components/Cascader/Dictionary"
1016
1116
 
1017
1117
  字典级联选择器。
1018
1118
 
1019
- | 参数 | 类型 | 必填 | 说明 |
1020
- | --- | --- | --- | --- |
1021
- | `appKey` | `string` | 否 | 字典应用 key。 |
1022
- | `dictValue` | `string` | 是 | 字典类型值。 |
1119
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
1120
+ | --- | --- | --- | --- | --- |
1121
+ | `appKey` | `string` | 否 | `DICTIONARY_APP_KEY_ENUM.DEFAULT` | 字典应用 key。 |
1122
+ | `dictValue` | `string` | 是 | - | 字典类型值。 |
1023
1123
  | `nameKey` | `string` | 否 | 节点标签字段名。 |
1024
1124
  | `idKey` | `string` | 否 | 节点值字段名。 |
1025
1125
  | `onGetNodePaths` | `(nodes: DictionaryCascaderItem[]) => void` | 否 | 返回字典节点路径。 |
@@ -1039,14 +1139,14 @@ import BasicLeftTree from "zy-react-library/components/LeftTree/Basic";
1039
1139
 
1040
1140
  基础树组件,继承 `Omit<TreeProps, "fieldNames">`。
1041
1141
 
1042
- | 参数 | 类型 | 必填 | 说明 |
1043
- | --- | --- | --- | --- |
1044
- | `nameKey` | `string` | 否 | 节点标题字段名。 |
1045
- | `idKey` | `string` | 否 | 节点 key 字段名。 |
1046
- | `childrenKey` | `string` | 否 | 子节点字段名。 |
1047
- | `getNodePathsIsIncludeOneself` | `boolean` | 否 | 获取节点路径时是否包含当前节点。 |
1048
- | `onGetNodePaths` | `(nodes: Record<string, any>[]) => void` | 否 | 返回当前节点路径。 |
1049
- | `onGetData` | `(data: Record<string, any>[]) => void` | 否 | 返回树数据。 |
1142
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
1143
+ | --- | --- | --- | --- | --- |
1144
+ | `nameKey` | `string` | 否 | `"name"` | 节点标题字段名。 |
1145
+ | `idKey` | `string` | 否 | `"id"` | 节点 key 字段名。 |
1146
+ | `childrenKey` | `string` | 否 | `"children"` | 子节点字段名。 |
1147
+ | `getNodePathsIsIncludeOneself` | `boolean` | 否 | `true` | 获取节点路径时是否包含当前节点。 |
1148
+ | `onGetNodePaths` | `(nodes: Record<string, any>[]) => void` | 否 | - | 返回当前节点路径。 |
1149
+ | `onGetData` | `(data: Record<string, any>[]) => void` | 否 | - | 返回树数据。 |
1050
1150
 
1051
1151
  ### AreaLeftTree
1052
1152
 
@@ -1058,10 +1158,10 @@ import AreaLeftTree from "zy-react-library/components/LeftTree/Area";
1058
1158
 
1059
1159
  地区左侧树。
1060
1160
 
1061
- | 参数 | 类型 | 必填 | 说明 |
1062
- | --- | --- | --- | --- |
1063
- | `onGetNodePaths` | `(nodes: AreaLeftTreeItem[]) => void` | 否 | 返回地区节点路径。 |
1064
- | `onGetData` | `(data: AreaLeftTreeItem[], processedData: AreaLeftTreeItem[]) => void` | 否 | 返回原始地区数据和处理后的地区数据。 |
1161
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
1162
+ | --- | --- | --- | --- | --- |
1163
+ | `onGetNodePaths` | `(nodes: AreaLeftTreeItem[]) => void` | 否 | - | 返回地区节点路径。 |
1164
+ | `onGetData` | `(data: AreaLeftTreeItem[], processedData: AreaLeftTreeItem[]) => void` | 否 | - | 返回原始地区数据和处理后的地区数据。 |
1065
1165
 
1066
1166
  `AreaLeftTreeItem`:`value: string`、`label: string`、`children: AreaLeftTreeItem[]`。
1067
1167
 
@@ -1075,14 +1175,14 @@ import DictionaryLeftTree from "zy-react-library/components/LeftTree/Dictionary"
1075
1175
 
1076
1176
  字典左侧树。
1077
1177
 
1078
- | 参数 | 类型 | 必填 | 说明 |
1079
- | --- | --- | --- | --- |
1080
- | `appKey` | `string` | 否 | 字典应用 key。 |
1081
- | `dictValue` | `string` | 是 | 字典类型值。 |
1082
- | `nameKey` | `string` | 否 | 节点标题字段名。 |
1083
- | `idKey` | `string` | 否 | 节点 key 字段名。 |
1084
- | `onGetNodePaths` | `(nodes: DictionaryLeftTreeItem[]) => void` | 否 | 返回字典节点路径。 |
1085
- | `onGetData` | `(data: DictionaryLeftTreeItem[], processedData: DictionaryLeftTreeItem[]) => void` | 否 | 返回原始字典数据和处理后的字典数据。 |
1178
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
1179
+ | --- | --- | --- | --- | --- |
1180
+ | `appKey` | `string` | 否 | `DICTIONARY_APP_KEY_ENUM.DEFAULT` | 字典应用 key。 |
1181
+ | `dictValue` | `string` | 是 | `""` | 字典类型值;为空会输出缺少参数错误。 |
1182
+ | `nameKey` | `string` | 否 | `"dictLabel"` | 节点标题字段名。 |
1183
+ | `idKey` | `string` | 否 | `"dictValue"` | 节点 key 字段名。 |
1184
+ | `onGetNodePaths` | `(nodes: DictionaryLeftTreeItem[]) => void` | 否 | - | 返回字典节点路径。 |
1185
+ | `onGetData` | `(data: DictionaryLeftTreeItem[], processedData: DictionaryLeftTreeItem[]) => void` | 否 | - | 返回原始字典数据和处理后的字典数据。 |
1086
1186
 
1087
1187
  `DictionaryLeftTreeItem`:`dictValue: string`、`dictLabel: string`、`children: DictionaryLeftTreeItem[]`。
1088
1188
 
@@ -1096,12 +1196,12 @@ import DepartmentLeftTree from "zy-react-library/components/LeftTree/Department/
1096
1196
 
1097
1197
  部门左侧树。
1098
1198
 
1099
- | 参数 | 类型 | 必填 | 说明 |
1100
- | --- | --- | --- | --- |
1101
- | `params` | `DepartmentSelectTreeProps["params"]` | 否 | 部门查询参数。 |
1102
- | `searchType` | `DepartmentSelectTreeProps["searchType"]` | 否 | 查询范围类型。 |
1103
- | `onGetNodePaths` | `(nodes: DepartmentLeftTreeItem[]) => void` | 否 | 返回部门节点路径。 |
1104
- | `onGetData` | `(data: DepartmentLeftTreeItem[], processedData: DepartmentLeftTreeItem[]) => void` | 否 | 返回原始部门数据和处理后的部门数据。 |
1199
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
1200
+ | --- | --- | --- | --- | --- |
1201
+ | `params` | `DepartmentSelectTreeProps["params"]` | 否 | `{}` | 部门查询参数。 |
1202
+ | `searchType` | `DepartmentSelectTreeProps["searchType"]` | 否 | `"current"` | 查询范围类型。 |
1203
+ | `onGetNodePaths` | `(nodes: DepartmentLeftTreeItem[]) => void` | 否 | - | 返回部门节点路径。 |
1204
+ | `onGetData` | `(data: DepartmentLeftTreeItem[], processedData: DepartmentLeftTreeItem[]) => void` | 否 | - | 返回原始部门数据和处理后的部门数据。 |
1105
1205
 
1106
1206
  `DepartmentLeftTreeItem`:`id: string`、`name: string`、`childrenList: DepartmentLeftTreeItem[]`。
1107
1207
 
@@ -1125,11 +1225,28 @@ import DepartmentLeftTree from "zy-react-library/components/LeftTree/Department/
1125
1225
  | `VideoIcon` | `zy-react-library/components/Icon/VideoIcon` |
1126
1226
  | `ViewIcon` | `zy-react-library/components/Icon/ViewIcon` |
1127
1227
 
1128
- ## Hooks
1129
-
1130
- ### useTable
1131
-
1132
- 引入:
1228
+ ## Hooks
1229
+
1230
+ ### Hook 默认值速查
1231
+
1232
+ | Hook | 默认值 |
1233
+ | --- | --- |
1234
+ | `useTable` | `usePagination=true`、`useStorageQueryCriteria=true`、`usePermission=true`、`defaultType="advance"`、`defaultPagination={ current: 1, pageSize: 20 }`。 |
1235
+ | `useUploadFile` | `returnType="object"`;执行上传时 `files=[]`、`single=true`。 |
1236
+ | `useGetFile` | `returnType="object"`;执行获取时 `single=true`。 |
1237
+ | `useDeleteFile` | `returnType="object"`;执行删除时 `files=[]`、`single=true`。 |
1238
+ | `useImportFile` | `returnType="object"`;执行导入时 `options.files=[]`、`options.params={}`。 |
1239
+ | `useDownloadBlob` | `returnType="object"`;执行下载时 `options.name=""`、`options.type=""`、`options.params={}`,未传 `type` 时使用 `application/vnd.ms-excel`,未传 `name` 时使用当前时间 `YYYY-MM-DD HH:mm:ss`。 |
1240
+ | `useDownloadFile` | `returnType="object"`;未传 `name` 时从 `url` 中截取文件名。 |
1241
+ | `useDictionary` | `returnType="object"`;执行获取时 `appKey=DICTIONARY_APP_KEY_ENUM.DEFAULT`。 |
1242
+ | `useGetUserInfo` | `returnType="object"`。 |
1243
+ | `useIdle` | `timeout=10000`、`events=["mousemove","mousedown","resize","keydown","touchstart","wheel"]`。 |
1244
+ | `useIsExistenceDuplicateSelection` | `message="存在重复项,请勿重复选择"`。 |
1245
+ | `useUrlQueryCriteria` | URL 状态初始值 `{ searchFormKeys: "", searchFormValues: "", paginationKeys: "", paginationValues: "" }`,`navigateMode="replace"`。 |
1246
+
1247
+ ### useTable
1248
+
1249
+ 引入:
1133
1250
 
1134
1251
  ```tsx
1135
1252
  import useTable from "zy-react-library/hooks/useTable";
@@ -1194,21 +1311,21 @@ useUploadFile("object"): { loading: boolean; uploadFile: UploadFileFunction }
1194
1311
 
1195
1312
  单文件上传参数:
1196
1313
 
1197
- | 参数 | 类型 | 必填 | 说明 |
1198
- | --- | --- | --- | --- |
1199
- | `files` | `UploadFile[]` | 是 | 待上传文件。 |
1200
- | `single` | `true` | 否 | 单文件上传标识。 |
1201
- | `params` | `SingleParams` | 是 | 上传参数。 |
1314
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
1315
+ | --- | --- | --- | --- | --- |
1316
+ | `files` | `UploadFile[]` | 是 | `[]` | 待上传文件;为空时直接返回空文件结果。 |
1317
+ | `single` | `true` | 否 | `true` | 单文件上传标识。 |
1318
+ | `params` | `SingleParams` | 是 | - | 上传参数。 |
1202
1319
 
1203
1320
  `SingleParams`:`type: number`、`corpinfoId?: string`、`foreignKey?: string`。
1204
1321
 
1205
1322
  多文件上传参数:
1206
1323
 
1207
- | 参数 | 类型 | 必填 | 说明 |
1208
- | --- | --- | --- | --- |
1209
- | `files` | `UploadFile[]` | 是 | 待上传文件。 |
1210
- | `single` | `false` | 是 | 多文件上传标识。 |
1211
- | `params` | `MultipleParams` | 是 | 上传参数。 |
1324
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
1325
+ | --- | --- | --- | --- | --- |
1326
+ | `files` | `UploadFile[]` | 是 | `[]` | 待上传文件;为空时直接返回原 `foreignKey`。 |
1327
+ | `single` | `false` | 是 | - | 多文件上传标识。 |
1328
+ | `params` | `MultipleParams` | 是 | - | 上传参数。 |
1212
1329
 
1213
1330
  `MultipleParams`:`type: number`、`corpinfoId?: string`、`foreignKey: string`。
1214
1331
 
@@ -1231,20 +1348,20 @@ useGetFile("object"): { loading: boolean; getFile: GetFileFunction }
1231
1348
 
1232
1349
  单文件获取参数:
1233
1350
 
1234
- | 参数 | 类型 | 必填 | 说明 |
1235
- | --- | --- | --- | --- |
1236
- | `eqType` | `number` | 是 | 文件类型。 |
1237
- | `eqForeignKey` | `string` | 是 | 外键 ID。 |
1238
- | `single` | `true` | 否 | 单文件获取标识。 |
1351
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
1352
+ | --- | --- | --- | --- | --- |
1353
+ | `eqType` | `number` | 是 | - | 文件类型。 |
1354
+ | `eqForeignKey` | `string` | 是 | - | 外键 ID。 |
1355
+ | `single` | `true` | 否 | `true` | 单文件获取标识。 |
1239
1356
 
1240
1357
  多文件获取参数:
1241
1358
 
1242
- | 参数 | 类型 | 必填 | 说明 |
1243
- | --- | --- | --- | --- |
1244
- | `eqType` | `number` | 是 | 文件类型。 |
1245
- | `foreignKey` | `string` | 是 | `dataSource` 中外键 ID 的字段名。 |
1246
- | `single` | `false` | 是 | 多文件获取标识。 |
1247
- | `dataSource` | `Record<string, any>[]` | 是 | 原始数据源。 |
1359
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
1360
+ | --- | --- | --- | --- | --- |
1361
+ | `eqType` | `number` | 是 | - | 文件类型。 |
1362
+ | `foreignKey` | `string` | 是 | - | `dataSource` 中外键 ID 的字段名。 |
1363
+ | `single` | `false` | 是 | - | 多文件获取标识。 |
1364
+ | `dataSource` | `Record<string, any>[]` | 是 | - | 原始数据源;空数组时直接返回空数组。 |
1248
1365
 
1249
1366
  `GetFileItem`:
1250
1367
 
@@ -1272,10 +1389,10 @@ useDeleteFile("array"): [boolean, DeleteFileFunction]
1272
1389
  useDeleteFile("object"): { loading: boolean; deleteFile: DeleteFileFunction }
1273
1390
  ```
1274
1391
 
1275
- | 参数 | 类型 | 必填 | 说明 |
1276
- | --- | --- | --- | --- |
1277
- | `files` | `DeleteFileItem[]` | 是 | 待删除文件。 |
1278
- | `single` | `boolean` | 否 | 是否按单文件删除。 |
1392
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
1393
+ | --- | --- | --- | --- | --- |
1394
+ | `files` | `DeleteFileItem[]` | 是 | `[]` | 待删除文件;为空时直接结束。 |
1395
+ | `single` | `boolean` | 否 | `true` | 是否按单文件删除。 |
1279
1396
 
1280
1397
  `DeleteFileItem`:`filePath?: string`、`id?: string`。
1281
1398
 
@@ -1296,11 +1413,11 @@ useImportFile("object"): { loading: boolean; importFile: ImportFileFunction }
1296
1413
 
1297
1414
  `importFile(url, options)` 参数:
1298
1415
 
1299
- | 参数 | 类型 | 必填 | 说明 |
1300
- | --- | --- | --- | --- |
1301
- | `url` | `string` | 是 | 导入接口地址。 |
1302
- | `options.files` | `UploadFile[]` | 是 | 上传文件数组。 |
1303
- | `options.params` | `Record<string, any>` | 否 | 额外提交参数。 |
1416
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
1417
+ | --- | --- | --- | --- | --- |
1418
+ | `url` | `string` | 是 | - | 导入接口地址。 |
1419
+ | `options.files` | `UploadFile[]` | 是 | `[]` | 上传文件数组。 |
1420
+ | `options.params` | `Record<string, any>` | 否 | `{}` | 额外提交参数。 |
1304
1421
 
1305
1422
  `UploadFile`:`originFileObj?: File`,并支持业务扩展字段。
1306
1423
 
@@ -1319,10 +1436,10 @@ useDownloadFile("array"): [boolean, DownloadFileFunction]
1319
1436
  useDownloadFile("object"): { loading: boolean; downloadFile: DownloadFileFunction }
1320
1437
  ```
1321
1438
 
1322
- | 参数 | 类型 | 必填 | 说明 |
1323
- | --- | --- | --- | --- |
1324
- | `url` | `string` | 是 | 下载地址。 |
1325
- | `name` | `string` | 否 | 下载文件名。 |
1439
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
1440
+ | --- | --- | --- | --- | --- |
1441
+ | `url` | `string` | 是 | - | 下载地址。 |
1442
+ | `name` | `string` | 否 | `url` 截取文件名 | 下载文件名;传入无后缀文件名时会尝试使用 `url` 后缀补齐。 |
1326
1443
 
1327
1444
  ### useDownloadBlob
1328
1445
 
@@ -1341,12 +1458,12 @@ useDownloadBlob("object"): { loading: boolean; downloadBlob: DownloadBlobFunctio
1341
1458
 
1342
1459
  `downloadBlob(url, options?)` 参数:
1343
1460
 
1344
- | 参数 | 类型 | 必填 | 说明 |
1345
- | --- | --- | --- | --- |
1346
- | `url` | `string` | 是 | 下载接口地址。 |
1347
- | `options.name` | `string` | 否 | 自定义文件名,不含后缀。 |
1348
- | `options.type` | `string` | 否 | Blob MIME 类型。 |
1349
- | `options.params` | `Record<string, any>` | 否 | 请求查询参数。 |
1461
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
1462
+ | --- | --- | --- | --- | --- |
1463
+ | `url` | `string` | 是 | - | 下载接口地址。 |
1464
+ | `options.name` | `string` | 否 | 当前时间 `YYYY-MM-DD HH:mm:ss` | 自定义文件名,不含后缀。 |
1465
+ | `options.type` | `string` | 否 | `"application/vnd.ms-excel"` | Blob MIME 类型。 |
1466
+ | `options.params` | `Record<string, any>` | 否 | `{}` | 请求查询参数。 |
1350
1467
 
1351
1468
  返回:`Promise<{ data: Blob }>`。
1352
1469
 
@@ -1365,12 +1482,12 @@ useDictionary("array"): [boolean, getDictionaryFunction]
1365
1482
  useDictionary("object"): { loading: boolean; getDictionary: getDictionaryFunction }
1366
1483
  ```
1367
1484
 
1368
- `getDictionary(options)` 参数:
1369
-
1370
- | 参数 | 类型 | 必填 | 说明 |
1371
- | --- | --- | --- | --- |
1372
- | `appKey` | `string` | 否 | 字典应用 key。 |
1373
- | `dictValue` | `string` | 是 | 字典类型值。 |
1485
+ `getDictionary(options)` 参数:
1486
+
1487
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
1488
+ | --- | --- | --- | --- | --- |
1489
+ | `appKey` | `string` | 否 | `DICTIONARY_APP_KEY_ENUM.DEFAULT` | 字典应用 key。 |
1490
+ | `dictValue` | `string` | 是 | - | 字典类型值。 |
1374
1491
 
1375
1492
  返回 `Promise<DictionaryItem[]>`。
1376
1493
 
@@ -1451,10 +1568,10 @@ import useIdle from "zy-react-library/hooks/useIdle";
1451
1568
 
1452
1569
  检测用户是否空闲。
1453
1570
 
1454
- | 参数 | 类型 | 必填 | 说明 |
1455
- | --- | --- | --- | --- |
1456
- | `timeout` | `number` | 否 | 空闲超时时间。 |
1457
- | `events` | `string[]` | 否 | 用于判断活跃状态的事件名列表。 |
1571
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
1572
+ | --- | --- | --- | --- | --- |
1573
+ | `timeout` | `number` | 否 | `10000` | 空闲超时时间,单位毫秒。 |
1574
+ | `events` | `string[]` | 否 | `["mousemove","mousedown","resize","keydown","touchstart","wheel"]` | 用于判断活跃状态的事件名列表。 |
1458
1575
 
1459
1576
  返回:`boolean`,表示是否处于空闲状态。
1460
1577
 
@@ -1470,11 +1587,11 @@ import useIsExistenceDuplicateSelection from "zy-react-library/hooks/useIsExiste
1470
1587
 
1471
1588
  `isExistenceDuplicateSelection(options)` 参数:
1472
1589
 
1473
- | 参数 | 类型 | 必填 | 说明 |
1474
- | --- | --- | --- | --- |
1475
- | `data` | `T[]` | 是 | 需要检查重复项的目标数组。 |
1476
- | `key` | `keyof T \| string` | 是 | 用于判断重复的对象属性名。 |
1477
- | `message` | `string` | 否 | 存在重复项时的错误提示。 |
1590
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
1591
+ | --- | --- | --- | --- | --- |
1592
+ | `data` | `T[]` | 是 | - | 需要检查重复项的目标数组。 |
1593
+ | `key` | `keyof T \| string` | 是 | - | 用于判断重复的对象属性名。 |
1594
+ | `message` | `string` | 否 | `"存在重复项,请勿重复选择"` | 存在重复项时的错误提示。 |
1478
1595
 
1479
1596
  返回:`Promise<void>`。
1480
1597