zy-react-library 1.0.153 → 1.0.156

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.
@@ -481,14 +481,16 @@ const FormItemsRenderer = ({
481
481
  required={getRequired(listOption.required)}
482
482
  {...getFormItemProps(listOption)}
483
483
  >
484
- <div style={{ display: "flex", gap: 10, alignItems: "center" }}>
485
- <Form.Item
486
- noStyle
487
- rules={getRules(listOption)}
488
- name={listOption.name}
489
- >
490
- {renderFormControl(listOption)}
491
- </Form.Item>
484
+ <div style={{ display: "flex", gap: 10, alignItems: "center", justifyContent: "space-between" }}>
485
+ <div style={{ flex: 1 }}>
486
+ <Form.Item
487
+ noStyle
488
+ rules={getRules(listOption)}
489
+ name={listOption.name}
490
+ >
491
+ {renderFormControl(listOption)}
492
+ </Form.Item>
493
+ </div>
492
494
  {
493
495
  // 只有当不是第一行时才显示删除按钮
494
496
  fieldIndex >= 1
@@ -19,6 +19,7 @@ const MapSelector = (props) => {
19
19
 
20
20
  const mapContainerRef = useRef(null);
21
21
  const mapInstanceRef = useRef(null);
22
+ const local = useRef(null);
22
23
  const [loading, setLoading] = useState(false);
23
24
  const [currentLongitude, setCurrentLongitude] = useState(longitude || "");
24
25
  const [currentLatitude, setCurrentLatitude] = useState(latitude || "");
@@ -86,10 +87,10 @@ const MapSelector = (props) => {
86
87
  // 搜索功能
87
88
  const handleLocalSearch = () => {
88
89
  if (localSearch && mapInstanceRef.current) {
89
- const local = new window.BMapGL.LocalSearch(mapInstanceRef.current, {
90
+ local.current = new window.BMapGL.LocalSearch(mapInstanceRef.current, {
90
91
  renderOptions: { map: mapInstanceRef.current },
91
92
  });
92
- local.search(localSearch);
93
+ local.current.search(localSearch);
93
94
  }
94
95
  };
95
96
 
@@ -97,10 +98,7 @@ const MapSelector = (props) => {
97
98
  const handleLocalClear = () => {
98
99
  setLocalSearch("");
99
100
  if (mapInstanceRef.current) {
100
- const local = new window.BMapGL.LocalSearch(mapInstanceRef.current, {
101
- renderOptions: { map: mapInstanceRef.current },
102
- });
103
- local.search("");
101
+ local.current.search("");
104
102
  }
105
103
  };
106
104
 
@@ -206,7 +204,7 @@ const MapSelector = (props) => {
206
204
  <Button type="primary" onClick={handleLocalSearch}>
207
205
  搜索
208
206
  </Button>
209
- <Button onClick={handleLocalClear}>
207
+ <Button onClick={handleLocalClear} style={{ marginLeft: 8 }}>
210
208
  重置
211
209
  </Button>
212
210
  </Form.Item>
@@ -16,7 +16,7 @@ const PreviewImg = (props) => {
16
16
  <Image
17
17
  key={item[fileUrlKey] || item}
18
18
  src={item[fileUrlKey] ? fileUrl + item[fileUrlKey] : fileUrl + item}
19
- style={{ marginLeft: index > 0 ? 10 : 0 }}
19
+ wrapperStyle={{ marginLeft: index > 0 ? 10 : 0 }}
20
20
  width={100}
21
21
  height={100}
22
22
  alt=""
@@ -25,11 +25,11 @@ function BasicSelectTree(props) {
25
25
  // 根据 level 处理树数据
26
26
  let processedTreeData = level
27
27
  ? processTreeDataByLevel({
28
- data: treeData,
29
- level,
30
- childrenKey,
31
- currentLevel: 1,
32
- })
28
+ data: treeData,
29
+ level,
30
+ childrenKey,
31
+ currentLevel: 1,
32
+ })
33
33
  : treeData;
34
34
 
35
35
  // 根据 onlyLastLevel 处理树数据
@@ -40,22 +40,25 @@ function BasicSelectTree(props) {
40
40
  if (getDataType(value) === "Array") {
41
41
  const parentNodes = [];
42
42
  for (let i = 0; i < value.length; i++) {
43
+ const targetId = (restProps.labelInValue || restProps.treeCheckStrictly) ? value[i].value : value[i];
43
44
  const currentParentNodes = getTreeNodePaths({
44
45
  data: treeData,
45
- targetId: value[i],
46
+ targetId,
46
47
  idKey,
47
48
  childrenKey,
48
49
  isIncludeOneself: onGetNodePathsIsIncludeOneself,
49
50
  });
50
51
  parentNodes.push(...currentParentNodes);
51
52
  }
52
- onGetNodePaths?.(arrayObjectDeduplication(parentNodes, idKey));
53
- onGetLabel?.(label);
53
+ const deduplicationParentNodes = arrayObjectDeduplication(parentNodes, idKey);
54
+ onGetNodePaths?.(deduplicationParentNodes);
55
+ onGetLabel?.((restProps.labelInValue || restProps.treeCheckStrictly) ? value.map(item => item.label) : label);
54
56
  }
55
57
  else {
58
+ const targetId = (restProps.labelInValue || restProps.treeCheckStrictly) ? value.value : value;
56
59
  const parentNodes = getTreeNodePaths({
57
60
  data: treeData,
58
- targetId: value,
61
+ targetId,
59
62
  idKey,
60
63
  childrenKey,
61
64
  isIncludeOneself: onGetNodePathsIsIncludeOneself,
@@ -68,7 +71,7 @@ function BasicSelectTree(props) {
68
71
  onGetNodePaths?.([]);
69
72
  onGetLabel?.("");
70
73
  }
71
- onChange?.(value, label, extra);
74
+ onChange?.((restProps.labelInValue || restProps.treeCheckStrictly) ? value.map(item => item.value) : value, label, extra);
72
75
  };
73
76
 
74
77
  useEffect(() => {
@@ -88,6 +91,7 @@ function BasicSelectTree(props) {
88
91
  treeData={processedTreeData}
89
92
  fieldNames={{ label: nameKey, value: idKey, children: childrenKey }}
90
93
  treeNodeFilterProp={nameKey}
94
+ showCheckedStrategy={TreeSelect.SHOW_ALL}
91
95
  {...restProps}
92
96
  />
93
97
  );
@@ -85,6 +85,7 @@ export const UPLOAD_FILE_TYPE_ENUM = {
85
85
  153: 153, // regulations_resource_library - 安全生产操作规程资源库
86
86
  154: 154, // responsibility_based_resource_library - 安全生产责任制资源库
87
87
  155: 155, // institutional_resource_library - 安全生产管理制度资源库
88
+ 156: 156, // security_management_agreement - 相关方-安全管理协议
88
89
  };
89
90
 
90
91
  /**
@@ -171,4 +172,5 @@ export const UPLOAD_FILE_PATH_ENUM = {
171
172
  153: "regulations_resource_library",
172
173
  154: "responsibility_based_resource_library",
173
174
  155: "institutional_resource_library",
175
+ 156: "security_management_agreement",
174
176
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zy-react-library",
3
3
  "private": false,
4
- "version": "1.0.153",
4
+ "version": "1.0.156",
5
5
  "type": "module",
6
6
  "description": "",
7
7
  "author": "LiuJiaNan",
package/utils/index.d.ts CHANGED
@@ -329,14 +329,14 @@ export function processTreeDataForOnlyLastLevel(
329
329
  /**
330
330
  * 验证结束时间是否大于开始时间
331
331
  */
332
- export function validatorEndTime(timeStart: string): {
332
+ export function validatorEndTime(timeStart: string, message: string): {
333
333
  validator: (_: any, value: any) => Promise<void | string>;
334
334
  };
335
335
 
336
336
  /**
337
337
  * 验证时间是否大于等于当前时间
338
338
  */
339
- export function validatorTimeGTCurrentDay(): {
339
+ export function validatorTimeGTCurrentDay(message: string): {
340
340
  validator: (_: any, value: any) => Promise<void | string>;
341
341
  };
342
342
 
package/utils/index.js CHANGED
@@ -511,11 +511,11 @@ export const processTreeDataForOnlyLastLevel = (options) => {
511
511
  /**
512
512
  * 验证结束时间是否大于开始时间
513
513
  */
514
- export const validatorEndTime = (timeStart) => {
514
+ export const validatorEndTime = (timeStart, message = "结束时间不能早于开始时间") => {
515
515
  return {
516
516
  validator: (_, value) => {
517
517
  if (value && timeStart && value < timeStart) {
518
- return Promise.reject("结束时间不能早于开始时间");
518
+ return Promise.reject(message);
519
519
  }
520
520
  else {
521
521
  return Promise.resolve();
@@ -527,11 +527,11 @@ export const validatorEndTime = (timeStart) => {
527
527
  /**
528
528
  * 验证时间是否大于等于当前时间
529
529
  */
530
- export const validatorTimeGTCurrentDay = () => {
530
+ export const validatorTimeGTCurrentDay = (message = "需要大于当前时间") => {
531
531
  return {
532
532
  validator: (_, value) => {
533
533
  if (value && value <= dayjs().format("YYYY-MM-DD hh:mm:ss")) {
534
- return Promise.reject("需要大于当前时间");
534
+ return Promise.reject(message);
535
535
  }
536
536
  else {
537
537
  return Promise.resolve();