@bit-sun/business-component 4.0.13-alpha.3 → 4.0.13-alpha.5

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.13-alpha.3",
3
+ "version": "4.0.13-alpha.5",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -53,6 +53,7 @@
53
53
  "querystring": "^0.2.1",
54
54
  "react": "^16.12.0",
55
55
  "react-beautiful-dnd": "10.0.0",
56
+ "react-dom": "^16.12.0",
56
57
  "react-resizable": "^3.0.4",
57
58
  "react-sortable-hoc": "^2.0.0",
58
59
  "serialize-javascript": "^6.0.0",
@@ -1,5 +1,6 @@
1
1
  // @ts-nocheck
2
2
  import React, { useState } from 'react';
3
+ import * as ReactDOMServer from 'react-dom/server';
3
4
  import {
4
5
  Tooltip,
5
6
  Badge,
@@ -722,7 +723,7 @@ export const authFn = (code?: any) => {
722
723
  export const renderToString = (
723
724
  render: ReactElement<any, string | JSXElementConstructor<any>> | string,
724
725
  ) => {
725
- return render;
726
+ // return render;
726
727
  return typeof render === 'string'
727
728
  ? render
728
729
  : ReactDOMServer.renderToString(render);
@@ -342,6 +342,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
342
342
  specialBracket: true,
343
343
  otherParams: {
344
344
  'ownOrgSign': getCurrentTargetBgId(),
345
+ 'ctl-count': true
345
346
  }, // 默认参数
346
347
  },
347
348
  }
@@ -360,6 +361,10 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
360
361
  mappingValueField: 'itemCode',
361
362
  sourceName: 'qp-itemCode-in',
362
363
  specialBracket: true,
364
+ otherParams: {
365
+ 'ownOrgSign': getCurrentTargetBgId(),
366
+ 'ctl-count': true
367
+ }, // 默认参数
363
368
  },
364
369
  }
365
370
  } },
@@ -54,7 +54,7 @@ export default () => {
54
54
  setValue(value)
55
55
  },
56
56
  selectBusinessType: 'supplier',
57
- disabled: true,
57
+ // disabled: true,
58
58
  };
59
59
 
60
60
  const props2 = {
@@ -9,7 +9,7 @@ title: 批量搜索查询组件
9
9
  order: 2
10
10
  ---
11
11
 
12
- ## QueryMutipleInput
12
+ ## QueryMutipleSearchSelect
13
13
 
14
14
  Demo:
15
15
 
@@ -20,8 +20,7 @@ import { QueryMutipleSearchSelect } from '../../../index';
20
20
  export default () => {
21
21
  const requestConfig = {
22
22
  url: '/items/item/listNoPage/Simple',
23
- filter: 'qp-name-like', // qp-itemCode-like
24
- // filter: 'qp-skuCode,name-orGroup,like',
23
+ filter: 'qp-itemCode,name-orGroup,like',
25
24
  mappingTextField: 'name',
26
25
  mappingValueField: 'itemCode',
27
26
  sourceName: 'qp-itemCode-in'
@@ -167,7 +167,7 @@ const QueryMutipleSearchSelect = ({ onValueChange, requestConfig={}, selectProps
167
167
  <Spin size="small" className='searchSelectSpin' />
168
168
  ) : (
169
169
  <div style={{ textAlign: 'center' }}>
170
- <div>{searchValue?'无匹配结果,请更换其他内容再试':`请录入内容模糊查询`}</div>
170
+ <div>{searchValue?'无匹配结果,请更换其他内容再试': (selectProps?.notFoundText||`请录入编码/名称模糊查询`)}</div>
171
171
  </div>
172
172
  )
173
173
  }
@@ -73,11 +73,6 @@
73
73
  &_dropdown_table {
74
74
  // padding: 4px 10px 6px;
75
75
 
76
- // 下拉table 复选框为单选时候隐藏
77
- .ant-table-cell .ant-table-selection-column .ant-radio,table tr td.ant-table-selection-column .ant-radio-wrapper {
78
- display: none;
79
- }
80
-
81
76
  // 下拉table 表头表体样式
82
77
  .ant-table.ant-table-bordered > .ant-table-container > .ant-table-header > table {
83
78
  font-family: MiSans-Regular;
@@ -103,7 +98,18 @@
103
98
  .ant-table.ant-table-bordered > .ant-table-container {
104
99
  .ant-table-body > table > tbody > tr > td.ant-table-selection-column,
105
100
  .ant-table-header > table > thead > tr > th.ant-table-selection-column {
106
- display: none;
101
+ visibility: hidden; // 不使用 display: none; 是因为此设置不占位,会导致表格scroll.x: 'max-content' 计算不准确
102
+ padding: 0;
103
+ margin: 0;
104
+ width: 0;
105
+ height: 0;
106
+ min-width: 0;
107
+ min-height: 0;
108
+ border: none;
109
+
110
+ .ant-radio-wrapper {
111
+ display: none;
112
+ }
107
113
  }
108
114
  }
109
115
  }
@@ -7,7 +7,7 @@ import request from '@/utils/request';
7
7
  import _, { escapeRegExp, isNil, values } from "lodash"
8
8
  import './index.less';
9
9
  import { BusinessSearchSelect, QueryMutipleInput, QueryMutipleSearchSelect } from '@/index';
10
- import { handleSourceName, getFormRowInfo, hasMoreQueryFields, defaultVisibleFieldsCount, getRealStr, ColSpan, getTableHeigth, getCurrentSRKs, getRenderSource, handleParams, convertUrlQueryParams, convertBodyParams, formatSelectedValue, convertResData, makeUniqueValue, handleSelectOptionsShowValue, LightHeightOption, maxTagPlaceholder } from './utils';
10
+ import { handleSourceName, getFormRowInfo, hasMoreQueryFields, defaultVisibleFieldsCount, getRealStr, ColSpan, getTableHeigth, getCurrentSRKs, getRenderSource, handleParams, convertUrlQueryParams, convertBodyParams, formatSelectedValue, convertResData, makeUniqueValue, handleSelectOptionsShowValue, LightHeightOption, maxTagPlaceholder, getShowStr } from './utils';
11
11
  import { judgeIsRequestError } from '@/utils/requestUtils';
12
12
  import zhankaitiaojian from '../../../assets/zhankaitiaojian-icon.svg';
13
13
  import PropertySelector from '@/components/Business/PropertyModal';
@@ -21,7 +21,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
21
21
  selectProps = {},
22
22
  modalTableProps = {},
23
23
  labelInValue = false,
24
- requestConfig,
24
+ requestConfig:rCTemp,
25
25
  ctx,
26
26
  onlyShowStr = false,
27
27
  sourceName,
@@ -51,7 +51,8 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
51
51
  noOperate, // 级联禁用按钮设置字段
52
52
  viewShowValueStr, // 详情展示值,不传展示组件处理的默认值
53
53
  searchStartLength, // 默认不校验长度去搜索,如果配置了,则按照配置项长度进行处理搜索
54
- } = requestConfig || {};
54
+ } = rCTemp || {};
55
+ const requestConfig = {url,method,otherParams,isMap,fixedparameter,fieldValToParam,fixedparamsDisabled,mappingTextField,mappingTextShowKeyField,mappingValueField,mappingTextShowTextField,init,extralHeaders,specialBracket,noNeedSplit,noOperate,viewShowValueStr,searchStartLength,...rCTemp};
55
56
  const resultSourceKey = handleSourceName(sourceName || requestConfig?.sourceName || ctx?.name || 'supplierCode')
56
57
 
57
58
  const selectMode = selectProps?.mode // 设定当前选择器 为单选或者多选模式 无设定为单选模式(默认)
@@ -80,7 +81,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
80
81
 
81
82
  const initPagination = { showQuickJumper: true, showSizeChanger: true, showTotal: (total: any) => `共 ${total} 条`, pageSize: tableInitPageSize }
82
83
  const tableInitPagination = { ...initPagination, total: 0, current: 1 }
83
- const disabled = noOperate || selectProps?.disabled || props?.disabled;
84
+ const disabled = !!noOperate || selectProps?.disabled || props?.disabled;
84
85
  const isHaveDependency = fixedparameter && fieldValToParam && ctx;
85
86
  const isHaveDValue = () => {
86
87
  let formValueList = [];
@@ -233,7 +234,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
233
234
  }
234
235
 
235
236
  let getRequest;
236
- const methodName = method?.toLocaleLowerCase();
237
+ const methodName = method?.toLocaleLowerCase?.();
237
238
  if(['post','patch','put'].includes(methodName)) {
238
239
  getRequest = request[methodName](`${url}${convertUrlQueryParams(queryParams)}`,convertBodyParams(queryParams))
239
240
  } else {
@@ -811,34 +812,6 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
811
812
  );
812
813
  }
813
814
 
814
- const getShowLabelTextStr = (kongValue): string => {
815
- if (selectMode) {
816
- return Array.isArray(value) && value?.map(item => item.label || item.text || '')?.join(',') || kongValue;
817
- }
818
- return (value?.label || value?.text || kongValue) as string;
819
- };
820
- const getSelectValueText = (v: any) => {
821
- return (items || []).filter(item => item.value === v)?.[0]?.text || v || '';
822
- }
823
- const getShowValueStr = (kongValue): string => {
824
- if (selectMode) {
825
- return Array.isArray(value) && value?.map(item => getSelectValueText(item))?.join(',') || kongValue;
826
- }
827
- return (getSelectValueText(value) || kongValue) as string;
828
- }
829
- const getShowStr = () => {
830
- // 优先使用业务使用传入的展示
831
- if(viewShowValueStr) return viewShowValueStr;
832
-
833
- const kongValue = '无'
834
- // 先判断labelInValue与否,labelInValue可以直接去value中获取字段名称,否则去下拉框数据里面去拿;
835
- // 再判断是单选还是多选,数据类型不同取值方式也不同
836
- if (labelInValue) {
837
- return getShowLabelTextStr(kongValue);
838
- }
839
- return getShowValueStr(kongValue);
840
- }
841
-
842
815
  const isShouldShowStr = (props.disabled && ctx) || ctx?.mode == 'view';
843
816
  return (
844
817
  <div className={'search_select'}>
@@ -853,8 +826,8 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
853
826
  </div>
854
827
  ) : (
855
828
  isShouldShowStr ?
856
- (<div title={getShowStr()} style={{overflow:'hidden',textOverflow:'ellipsis',whiteSpace:'nowrap'}} className={'search_select_show'}>
857
- {getShowStr()}
829
+ (<div title={getShowStr({ viewShowValueStr, labelInValue, selectMode, value, items })} style={{overflow:'hidden',textOverflow:'ellipsis',whiteSpace:'nowrap'}} className={'search_select_show'}>
830
+ {getShowStr({viewShowValueStr, labelInValue, selectMode, value, items })}
858
831
  </div>) :
859
832
  <div
860
833
  className={`${isFormPage ? '' : 'search_select_show_list'} search_select_show`}
@@ -397,4 +397,36 @@ export const maxTagPlaceholder = (selectedValues: any, { selectProps, onChange,
397
397
  )
398
398
  }
399
399
 
400
- // ------------------------------------------ 数据源展示 相关处理--结束----------------------------------------
400
+ // ------------------------------------------ 数据源展示 相关处理--结束----------------------------------------
401
+
402
+
403
+
404
+ // ------------------------------------------ 选中数据展示 相关处理--开始----------------------------------------
405
+ const getShowLabelTextStr = ({ kongValue, selectMode, value, items }: any) => {
406
+ if (selectMode) {
407
+ return Array.isArray(value) && value?.map(item => item.label || item.text || '')?.join(',') || kongValue;
408
+ }
409
+ return (value?.label || value?.text || kongValue) as string;
410
+ };
411
+ const getSelectValueText = (v: any, items: any) => {
412
+ return (items || []).filter((item: any) => item.value === v)?.[0]?.text || v || '';
413
+ }
414
+ const getShowValueStr = ({ kongValue, selectMode, value, items }: any): string => {
415
+ if (selectMode) {
416
+ return Array.isArray(value) && value?.map(item => getSelectValueText(item, items))?.join(',') || kongValue;
417
+ }
418
+ return (getSelectValueText(value, items) || kongValue) as string;
419
+ }
420
+ export const getShowStr = ({ viewShowValueStr, labelInValue, selectMode, value, items }: any) => {
421
+ // 优先使用业务使用传入的展示
422
+ if(viewShowValueStr) return viewShowValueStr;
423
+
424
+ const kongValue = '无'
425
+ // 先判断labelInValue与否,labelInValue可以直接去value中获取字段名称,否则去下拉框数据里面去拿;
426
+ // 再判断是单选还是多选,数据类型不同取值方式也不同
427
+ if (labelInValue) {
428
+ return getShowLabelTextStr({ kongValue, selectMode, value, items});
429
+ }
430
+ return getShowValueStr({ kongValue, selectMode, value, items });
431
+ }
432
+ // ------------------------------------------ 选中数据展示 相关处理--结束---------------------------------------