@bit-sun/business-component 4.0.12-alpha.22 → 4.0.12-alpha.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "4.0.12-alpha.22",
3
+ "version": "4.0.12-alpha.24",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -84,11 +84,11 @@ const PropertySelector = ({
84
84
 
85
85
  const newArr = (data?.data || []).map((item: any) => {
86
86
  return {
87
- propertyCode: item.property.propertyCode,
88
- propertyName: item.property.name,
89
- propertyId: item.property.id,
90
- isCommonUse: item.property.isCommonUse === 'commonUse',
91
- detailList: item.propertyValueList.map((detail: any) => ({
87
+ propertyCode: item.property?.propertyCode,
88
+ propertyName: item.property?.name,
89
+ propertyId: item.property?.id,
90
+ isCommonUse: item.property?.isCommonUse === 'commonUse',
91
+ detailList: (item.propertyValueList || []).map((detail: any) => ({
92
92
  name: detail.value,
93
93
  value: detail.value,
94
94
  isCommonUse: detail.isCommonUse === 'commonUse',
@@ -104,17 +104,19 @@ const PropertySelector = ({
104
104
 
105
105
 
106
106
  useEffect(() => {
107
- // 获取选中品类信息
108
- setChoosedClassify(value?.classifyCode);
109
-
107
+ if (visible) {
108
+ // 获取选中品类信息
109
+ setChoosedClassify(value?.classifyCode || classifyOptionList[0]?.value);
110
+ }
110
111
  // 获取选中属性值展示
111
112
  const choosedPropertyList = (value?.propertyList || []).map(item => (item.detailList || []).map(detail => detail.name)).flat();
112
113
  if ((value?.propertyList || []).some(item => !item.isCommonUse)) {
113
114
  setShowNotCommon(true);
114
115
  }
115
- setChoosedValues(choosedPropertyList);
116
116
  settingValue.current = {...value};
117
- }, [value])
117
+ setChoosedValues(choosedPropertyList);
118
+
119
+ }, [value, visible])
118
120
 
119
121
  // 关闭弹窗回传组件值
120
122
  const handleConfirm = () => {
@@ -2,29 +2,16 @@
2
2
  * @Description:
3
3
  * @Author: rodchen
4
4
  * @Date: 2021-12-01 10:52:08
5
- * @LastEditTime: 2024-11-15 15:25:29
6
- * @LastEditors: rodchen rodchen_king@outlook.com
5
+ * @LastEditTime: 2021-12-29 19:14:56
6
+ * @LastEditors: rodchen
7
7
  */
8
8
  // @ts-nocheck
9
9
  import React, { useState, useEffect } from 'react';
10
10
  import { useDebounceFn } from 'ahooks';
11
- import { debounce } from 'lodash';
12
11
  import { Input, Button, Modal, ConfigProvider } from 'antd';
13
12
  import './index.less';
14
13
 
15
- export const handlePressEnter = debounce((ctx) => {
16
- if (ctx?.table) {
17
- ctx?.form?.validateFields?.().then((data: any) => {
18
- const {
19
- pagination: { pageSize },
20
- sorter,
21
- } = ctx?.table?.getPaging();
22
- ctx?.table?.refreshTable({ pageSize, current: 1 }, data, sorter);
23
- });
24
- }
25
- }, 50);
26
-
27
- const QueryMutipleInput = ({ onValueChange,onPressEnter, ctx }) => {
14
+ const QueryMutipleInput = ({ onValueChange,onPressEnter }) => {
28
15
  const [isModalVisible, setIsModalVisible] = useState(false);
29
16
  const [value, setValue] = useState('');
30
17
  const [popvalue, setPopValue] = useState('');
@@ -90,12 +77,7 @@ const QueryMutipleInput = ({ onValueChange,onPressEnter, ctx }) => {
90
77
  style={{ width: 'calc(100%)' }}
91
78
  suffix={<div className="query_input_expand_button" onClick={showModal}>...</div>}
92
79
  placeholder="请输入(查询多个值请用 ; 或 , 分割)"
93
- onPressEnter={(e) => {
94
- if (onPressEnter) {
95
- onPressEnter(e);
96
- }
97
- if(ctx) handlePressEnter(ctx);
98
- }}
80
+ onPressEnter={()=>onPressEnter?.()}
99
81
  />
100
82
  </div>
101
83
  <Modal
@@ -20,7 +20,7 @@
20
20
 
21
21
  .ant-select-dropdown {
22
22
  top: 24px !important;
23
- width: calc(150%) !important;
23
+ width: calc(141%) !important;
24
24
  }
25
25
 
26
26
  // 下拉框清除图标位置调整
@@ -37,7 +37,7 @@
37
37
  &_show.search_select_show_list {
38
38
  .ant-select-dropdown {
39
39
  top: 24px !important;
40
- width: calc(141%) !important;
40
+ width: calc(100% + 110px) !important;
41
41
  }
42
42
  }
43
43
 
@@ -5,7 +5,7 @@ import { Input, Button, Modal, Select, Divider, message, Spin, Form, Table, Chec
5
5
  import { SearchOutlined, CopyOutlined, CaretLeftOutlined } from '@ant-design/icons';
6
6
  import request from '@/utils/request';
7
7
  import { stringify } from 'querystring';
8
- import _, { escapeRegExp, isNil, values, debounce } from "lodash"
8
+ import _, { escapeRegExp, isNil, values } from "lodash"
9
9
  import './index.less';
10
10
  import { BusinessSearchSelect, QueryMutipleInput } from '@/index';
11
11
  import { handleSourceName, getFormRowInfo, hasMoreQueryFields, defaultVisibleFieldsCount, getRealStr, ColSpan, getTableHeigth, getCurrentSRKs, getRenderSource } from './utils';
@@ -13,18 +13,6 @@ import { judgeIsRequestError } from '@/utils/requestUtils';
13
13
  import zhankaitiaojian from '../../../assets/zhankaitiaojian-icon.svg';
14
14
  import PropertySelector from '@/components/Business/PropertyModal';
15
15
 
16
- export const handlePressEnter = debounce((ctx) => {
17
- if (ctx?.table) {
18
- ctx?.form?.validateFields?.().then((data) => {
19
- const {
20
- pagination: { pageSize },
21
- sorter,
22
- } = ctx?.table?.getPaging();
23
- ctx?.table?.refreshTable({ pageSize, current: 1 }, data, sorter);
24
- });
25
- }
26
- }, 50);
27
-
28
16
  const { Option } = Select;
29
17
 
30
18
  const SearchSelect = forwardRef((props: any, ref: any) => {
@@ -1023,10 +1011,10 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
1023
1011
  { label: `已选(${selectedRowKeys?.length || 0})`, key: 'selected', children: renderShowTable(selectedRows?.map((s,index)=> ({...s,keyIndex:index+1}))||[],'noPage') },
1024
1012
  ];
1025
1013
 
1026
- const resetSelectDataSource = () => {
1014
+ const resetSelectDataSource = (isClear=false) => {
1027
1015
  setSearchValue('');
1028
1016
  // 有关联值 不需要清空下拉框数据 也不需要重新去请求了
1029
- if(isHaveDependency) return;
1017
+ if(!isClear && isHaveDependency) return; // 清空时需要放开:级联首次回之后,清空数据需要重新查询下拉框的值
1030
1018
  clearSelectDataSource();
1031
1019
  init && run('init')
1032
1020
  }
@@ -1038,7 +1026,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
1038
1026
  formaData([], items);
1039
1027
  onChangeSelectedKeys([], [])
1040
1028
  // 重置下拉框数据源
1041
- resetSelectDataSource();
1029
+ resetSelectDataSource(true);
1042
1030
  }
1043
1031
 
1044
1032
  const onDeselect = (...arg) => {
@@ -1243,22 +1231,6 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
1243
1231
  )
1244
1232
  }
1245
1233
  onPopupScroll={SelectScroll}
1246
- onKeyDown={(e) => {
1247
- if ((e.key === 'Enter' || e.keyCode === 13) && !selectOpen) {
1248
- if (props?.onPressEnter) {
1249
- props.onPressEnter?.(e);
1250
- }
1251
- handlePressEnter(ctx);
1252
- setSelectOpen(false)
1253
- e.preventDefault();
1254
- e.stopPropagation();
1255
- return;
1256
- } else if(e.keyCode === 9 || e.key === 'Tab') {
1257
- setSelectOpen(false)
1258
- } else {
1259
- setSelectOpen(true)
1260
- }
1261
- }}
1262
1234
  style={{ width: 'calc(100%)' }}
1263
1235
  placeholder="请选择"
1264
1236
  maxTagPlaceholder={maxTagPlaceholder}