@bit-sun/business-component 4.0.13-alpha.3 → 4.0.13-alpha.31
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/.umirc.ts +20 -9
- package/dist/components/Business/BsSulaQueryTable/utils.d.ts +1 -1
- package/dist/components/Business/DetailPageWrapper/index.d.ts +6 -0
- package/dist/components/Business/ItemPropertySelector/index.d.ts +3 -0
- package/dist/components/Functional/SearchSelect/utils.d.ts +4 -1
- package/dist/index.esm.js +1070 -626
- package/dist/index.js +1070 -626
- package/package.json +3 -2
- package/src/assets/btn-cancel.svg +3 -0
- package/src/assets/btn-copy.svg +3 -0
- package/src/assets/btn-delete.svg +2 -29
- package/src/assets/btn-edit.svg +2 -19
- package/src/assets/btn-hangUp.svg +3 -0
- package/src/assets/btn-print.svg +3 -0
- package/src/assets/btn-refresh.svg +3 -0
- package/src/assets/btn-unhook.svg +3 -0
- package/src/components/Business/BsSulaQueryTable/index.tsx +10 -10
- package/src/components/Business/BsSulaQueryTable/setting.tsx +3 -3
- package/src/components/Business/BsSulaQueryTable/utils.tsx +2 -1
- package/src/components/Business/CommodityEntry/index.tsx +11 -9
- package/src/components/Business/DetailPageWrapper/index.less +1 -1
- package/src/components/Business/DetailPageWrapper/index.tsx +24 -5
- package/src/components/Business/DetailPageWrapper/utils.tsx +7 -2
- package/src/components/Business/HomePageWrapper/index.less +1 -1
- package/src/components/Business/ItemPropertySelector/index.tsx +88 -0
- package/src/components/Business/SearchSelect/BusinessUtils.tsx +210 -12
- package/src/components/Business/SearchSelect/index.md +4 -4
- package/src/components/Business/SearchSelect/utils.ts +1 -1
- package/src/components/Functional/AddSelect/index.tsx +3 -3
- package/src/components/Functional/DataValidation/index.md +1 -0
- package/src/components/Functional/DataValidation/index.tsx +11 -4
- package/src/components/Functional/QueryMutipleSelect/index.md +2 -3
- package/src/components/Functional/QueryMutipleSelect/index.tsx +2 -1
- package/src/components/Functional/SearchSelect/index.less +16 -6
- package/src/components/Functional/SearchSelect/index.tsx +65 -50
- package/src/components/Functional/SearchSelect/utils.tsx +46 -6
- package/src/components/Solution/RuleComponent/index.js +59 -1
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
import React, { useState, useEffect, forwardRef, useImperativeHandle } from 'react';
|
|
3
3
|
import { useDebounceFn } from 'ahooks';
|
|
4
|
-
import { Input, Button, Modal, Select, Divider, message, Spin, Form, Table, Checkbox, TreeSelect, Tooltip, Tag, Row, Col, Space, Tabs } from 'antd';
|
|
4
|
+
import { Input, Button, Modal, Select, Divider, message, Spin, Form, Table, Checkbox, TreeSelect, Tooltip, Tag, Row, Col, Space, Tabs, Empty, DatePicker } from 'antd';
|
|
5
5
|
import { SearchOutlined, CopyOutlined, CaretLeftOutlined } from '@ant-design/icons';
|
|
6
6
|
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,
|
|
10
|
+
import { handleSourceName, getFormRowInfo, hasMoreQueryFields, defaultVisibleFieldsCount, getRealStr, getTableHeigth, getCurrentSRKs, getRenderSource, handleParams, convertUrlQueryParams, convertBodyParams, formatSelectedValue, convertResData, makeUniqueValue, handleSelectOptionsShowValue, LightHeightOption, maxTagPlaceholder, getShowStr, handleTableColumns } 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';
|
|
14
|
+
import ItemPropertySelector from '@/components/Business/ItemPropertySelector';
|
|
14
15
|
|
|
15
16
|
const { Option } = Select;
|
|
16
17
|
|
|
@@ -21,7 +22,8 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
21
22
|
selectProps = {},
|
|
22
23
|
modalTableProps = {},
|
|
23
24
|
labelInValue = false,
|
|
24
|
-
|
|
25
|
+
needTopSelectedSource,
|
|
26
|
+
requestConfig:rCTemp,
|
|
25
27
|
ctx,
|
|
26
28
|
onlyShowStr = false,
|
|
27
29
|
sourceName,
|
|
@@ -51,7 +53,8 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
51
53
|
noOperate, // 级联禁用按钮设置字段
|
|
52
54
|
viewShowValueStr, // 详情展示值,不传展示组件处理的默认值
|
|
53
55
|
searchStartLength, // 默认不校验长度去搜索,如果配置了,则按照配置项长度进行处理搜索
|
|
54
|
-
} =
|
|
56
|
+
} = rCTemp || {};
|
|
57
|
+
const requestConfig = {url,method,otherParams,isMap,fixedparameter,fieldValToParam,fixedparamsDisabled,mappingTextField,mappingTextShowKeyField,mappingValueField,mappingTextShowTextField,init,extralHeaders,specialBracket,noNeedSplit,noOperate,viewShowValueStr,searchStartLength,...rCTemp};
|
|
55
58
|
const resultSourceKey = handleSourceName(sourceName || requestConfig?.sourceName || ctx?.name || 'supplierCode')
|
|
56
59
|
|
|
57
60
|
const selectMode = selectProps?.mode // 设定当前选择器 为单选或者多选模式 无设定为单选模式(默认)
|
|
@@ -80,7 +83,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
80
83
|
|
|
81
84
|
const initPagination = { showQuickJumper: true, showSizeChanger: true, showTotal: (total: any) => `共 ${total} 条`, pageSize: tableInitPageSize }
|
|
82
85
|
const tableInitPagination = { ...initPagination, total: 0, current: 1 }
|
|
83
|
-
const disabled = noOperate || selectProps?.disabled || props?.disabled;
|
|
86
|
+
const disabled = !!noOperate || selectProps?.disabled || props?.disabled;
|
|
84
87
|
const isHaveDependency = fixedparameter && fieldValToParam && ctx;
|
|
85
88
|
const isHaveDValue = () => {
|
|
86
89
|
let formValueList = [];
|
|
@@ -139,7 +142,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
139
142
|
const [indeterminate, setIndeterminate] = useState(false)
|
|
140
143
|
const [tableFormParams, setTableFormParams] = useState({});
|
|
141
144
|
const [tooltipVisible, setTooltipVisible] = useState(false);
|
|
142
|
-
const [tableShowColumns, setTabletShowColumns] = useState(modalTableProps?.tableColumns
|
|
145
|
+
const [tableShowColumns, setTabletShowColumns] = useState(handleTableColumns(modalTableProps?.tableColumns)); // 默认展示表头-modalTableProps?.tableColumns
|
|
143
146
|
const [confirmLoading, setConfirmLoading] = useState(false);
|
|
144
147
|
const [modalSearched, setModalSearched]=useState(false);
|
|
145
148
|
|
|
@@ -228,12 +231,12 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
228
231
|
...fixedParam,
|
|
229
232
|
...params,
|
|
230
233
|
};
|
|
231
|
-
if (isNil(queryParams[selectParamsKey])) {
|
|
232
|
-
queryParams[selectParamsKey] = searchValue;
|
|
234
|
+
if (isNil(queryParams[selectParamsKey])&&searchValue?.length) {
|
|
235
|
+
queryParams[selectParamsKey] = searchValue?.trim?.();
|
|
233
236
|
}
|
|
234
237
|
|
|
235
238
|
let getRequest;
|
|
236
|
-
const methodName = method?.toLocaleLowerCase();
|
|
239
|
+
const methodName = method?.toLocaleLowerCase?.();
|
|
237
240
|
if(['post','patch','put'].includes(methodName)) {
|
|
238
241
|
getRequest = request[methodName](`${url}${convertUrlQueryParams(queryParams)}`,convertBodyParams(queryParams))
|
|
239
242
|
} else {
|
|
@@ -250,7 +253,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
250
253
|
return;
|
|
251
254
|
}
|
|
252
255
|
const res = result.data;
|
|
253
|
-
const source: any = convertResData(requestConfig, res, { selectMode, labelInValue, value, type, items, queryParams });
|
|
256
|
+
const source: any = convertResData(requestConfig, res, { selectMode, labelInValue, value, type, items, queryParams, needTopSelectedSource });
|
|
254
257
|
|
|
255
258
|
if(callback) {
|
|
256
259
|
callback(source)
|
|
@@ -321,6 +324,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
321
324
|
|
|
322
325
|
useEffect(() => {
|
|
323
326
|
setUniqueValue(makeUniqueValue());
|
|
327
|
+
setTabletShowColumns(handleTableColumns(modalTableProps?.tableColumns));
|
|
324
328
|
}, [resultSourceKey])
|
|
325
329
|
|
|
326
330
|
useEffect(() => {
|
|
@@ -464,7 +468,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
464
468
|
}
|
|
465
469
|
|
|
466
470
|
const onSearchChange = (v) => {
|
|
467
|
-
setSearchValue(v);
|
|
471
|
+
setSearchValue(v?.trim?.()||'');
|
|
468
472
|
if(!!searchStartLength && v?.length < searchStartLength) return;
|
|
469
473
|
refreshItems();
|
|
470
474
|
}
|
|
@@ -570,9 +574,10 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
570
574
|
}
|
|
571
575
|
};
|
|
572
576
|
|
|
573
|
-
const { emptyArray } = getFormRowInfo(list);
|
|
577
|
+
const { emptyArray, ColSpan } = getFormRowInfo(list, modalTableProps?.tableSearchColSpan);
|
|
574
578
|
const addKong = emptyArray?.map((i: any) =>({ type: 'kong'}))||[];
|
|
575
|
-
|
|
579
|
+
const searchList = modalTableProps?.noEmptySearchField ? list : list?.concat(addKong);
|
|
580
|
+
return searchList.map((i: any, index: number) => {
|
|
576
581
|
if(i?.type === 'kong') return <Col span={ColSpan} key={i}></Col>;
|
|
577
582
|
|
|
578
583
|
if (i?.type === 'select' || i?.field?.type === 'select') {
|
|
@@ -599,6 +604,25 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
599
604
|
)
|
|
600
605
|
}
|
|
601
606
|
|
|
607
|
+
if (i?.type === 'rangepicker' || i?.field?.type === 'rangepicker') {
|
|
608
|
+
return (
|
|
609
|
+
<Col span={ColSpan} key={i.name}>
|
|
610
|
+
<Form.Item name={i.name} label={i.label} key={i.name} initialValue={i?.initialValue ?? []}>
|
|
611
|
+
<DatePicker.RangePicker style={{ width: '100%' }} placeholder='请选择' {...i?.field?.props} disabled={setDisabled(i.name)}></DatePicker.RangePicker>
|
|
612
|
+
</Form.Item>
|
|
613
|
+
</Col>
|
|
614
|
+
)
|
|
615
|
+
}
|
|
616
|
+
if (i?.type === 'datepicker' || i?.field?.type === 'datepicker') {
|
|
617
|
+
return (
|
|
618
|
+
<Col span={ColSpan} key={i.name}>
|
|
619
|
+
<Form.Item name={i.name} label={i.label} key={i.name}>
|
|
620
|
+
<DatePicker style={{ width: '100%' }} placeholder='请选择' {...i?.field?.props} disabled={setDisabled(i.name)}></DatePicker>
|
|
621
|
+
</Form.Item>
|
|
622
|
+
</Col>
|
|
623
|
+
)
|
|
624
|
+
}
|
|
625
|
+
|
|
602
626
|
if (i?.type === 'businessSearchSelect' || i?.field?.type === 'businessSearchSelect') {
|
|
603
627
|
return (
|
|
604
628
|
<Col span={ColSpan} key={i.name}>
|
|
@@ -632,6 +656,19 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
632
656
|
</Col>
|
|
633
657
|
);
|
|
634
658
|
}
|
|
659
|
+
if (i?.type === 'itemPropertySelector' || i?.field?.type === 'itemPropertySelector') {
|
|
660
|
+
return (
|
|
661
|
+
<Col span={ColSpan} key={i.name}>
|
|
662
|
+
<Form.Item name={i.name} label={i.label} key={i.name}>
|
|
663
|
+
<ItemPropertySelector
|
|
664
|
+
style={{ width: '100%' }}
|
|
665
|
+
placeholder="请选择"
|
|
666
|
+
{...i?.field?.props}
|
|
667
|
+
></ItemPropertySelector>
|
|
668
|
+
</Form.Item>
|
|
669
|
+
</Col>
|
|
670
|
+
);
|
|
671
|
+
}
|
|
635
672
|
if (i?.field?.type === 'multipleQuerySearchSelect') {
|
|
636
673
|
return (
|
|
637
674
|
<Col span={ColSpan} key={i.name}>
|
|
@@ -664,9 +701,15 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
664
701
|
return collapsed ? formItem(list?.slice(0,viCount)) : formItem(list)
|
|
665
702
|
}
|
|
666
703
|
|
|
704
|
+
const renderEmptyText = (text: string,x: string) => {
|
|
705
|
+
return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description={text} style={{ margin: `${x} 0px`}} />
|
|
706
|
+
}
|
|
707
|
+
|
|
667
708
|
const renderShowTable = (tableList, type) => {
|
|
668
709
|
const tableBoxHeighth = getTableHeigth(modalTableProps?.tableSearchForm);
|
|
669
|
-
const
|
|
710
|
+
const x = tableList?.length ? 82 : 28; // 无数据没有分页,有数据计算减去:分页 24+16*2+10 「高 + margin * 2 + paddingBottom 10 」
|
|
711
|
+
const oSY = `calc(100vh - ${tableBoxHeighth}px - ${x}px)`;
|
|
712
|
+
const mTB = `calc(50vh - ${tableBoxHeighth/2}px - ${x/2}px - 40px)`
|
|
670
713
|
return (
|
|
671
714
|
<div style={{ height: `calc(100vh - ${tableBoxHeighth}px)` }}>
|
|
672
715
|
<Table
|
|
@@ -678,14 +721,14 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
678
721
|
{...type=='noPage'?{
|
|
679
722
|
pagination: { ...initPagination,showSizeChanger: false },
|
|
680
723
|
locale: {
|
|
681
|
-
emptyText: '暂无已选结果',
|
|
724
|
+
emptyText: renderEmptyText('暂无已选结果',mTB),
|
|
682
725
|
}
|
|
683
726
|
}:{
|
|
684
727
|
pagination: tablePagination,
|
|
685
728
|
onChange: handleTableChange,
|
|
686
729
|
loading: fetching,
|
|
687
730
|
locale: {
|
|
688
|
-
emptyText: modalSearched? '
|
|
731
|
+
emptyText: modalSearched? renderEmptyText('匹配结果,请更换其他内容再试',mTB) : renderEmptyText('请输入搜索条件',mTB),
|
|
689
732
|
}
|
|
690
733
|
}}
|
|
691
734
|
rowKey={mappingValueField}
|
|
@@ -811,34 +854,6 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
811
854
|
);
|
|
812
855
|
}
|
|
813
856
|
|
|
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
857
|
const isShouldShowStr = (props.disabled && ctx) || ctx?.mode == 'view';
|
|
843
858
|
return (
|
|
844
859
|
<div className={'search_select'}>
|
|
@@ -853,8 +868,8 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
853
868
|
</div>
|
|
854
869
|
) : (
|
|
855
870
|
isShouldShowStr ?
|
|
856
|
-
(<div title={getShowStr()} style={{overflow:'hidden',textOverflow:'ellipsis',whiteSpace:'nowrap'}} className={'search_select_show'}>
|
|
857
|
-
{getShowStr()}
|
|
871
|
+
(<div title={getShowStr({ viewShowValueStr, labelInValue, selectMode, value, items })} style={{overflow:'hidden',textOverflow:'ellipsis',whiteSpace:'nowrap'}} className={'search_select_show'}>
|
|
872
|
+
{getShowStr({viewShowValueStr, labelInValue, selectMode, value, items })}
|
|
858
873
|
</div>) :
|
|
859
874
|
<div
|
|
860
875
|
className={`${isFormPage ? '' : 'search_select_show_list'} search_select_show`}
|
|
@@ -906,7 +921,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
906
921
|
<Modal
|
|
907
922
|
maskClosable={false}
|
|
908
923
|
destroyOnClose
|
|
909
|
-
width=
|
|
924
|
+
width={`calc(100% - 320px)`}
|
|
910
925
|
title={modalTableProps?.modalTableTitle}
|
|
911
926
|
visible={isModalVisible}
|
|
912
927
|
confirmLoading={confirmLoading}
|
|
@@ -941,14 +956,14 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
941
956
|
{renderFormItem(modalTableProps?.tableSearchForm)}
|
|
942
957
|
<Col span={6}>
|
|
943
958
|
<Space>
|
|
944
|
-
<Button key="search" type="primary" onClick={onSearchTable}>
|
|
959
|
+
<Button key="search" type="primary" onClick={onSearchTable} disabled={fetching}>
|
|
945
960
|
查询 Enter
|
|
946
961
|
</Button>
|
|
947
|
-
<Button key="reset" onClick={onResetTable}>
|
|
962
|
+
<Button key="reset" onClick={onResetTable} disabled={fetching}>
|
|
948
963
|
重置 ctrl+U
|
|
949
964
|
</Button>
|
|
950
965
|
<div style={{position: 'absolute',top: 0,right: 0}}>
|
|
951
|
-
{hasMoreQueryFields(modalTableProps)
|
|
966
|
+
{hasMoreQueryFields(modalTableProps)
|
|
952
967
|
? <img onClick={() => {toggleCollapsed()}} style={{
|
|
953
968
|
cursor: 'pointer',
|
|
954
969
|
fontSize: '10px',
|
|
@@ -17,12 +17,13 @@ export const handleSourceName = (sName: any) => {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
// ------------------------------------------处理样式相关--开始----------------------------------------
|
|
20
|
-
export const getFormRowInfo = (list: any) => {
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
20
|
+
export const getFormRowInfo = (list: any, tableSearchColSpan: number) => {
|
|
21
|
+
const lastColumnsPerRow = tableSearchColSpan == 6 ? columnsPerRow : 3;
|
|
22
|
+
const totalRows = Math.ceil(list.length / lastColumnsPerRow); // 计算总行数
|
|
23
|
+
const lastRowColumns = (list.length+1) % lastColumnsPerRow; // 计算最后一行的实际列数
|
|
24
|
+
const emptySlots = lastRowColumns === 0 ? 0 : lastColumnsPerRow - lastRowColumns; // 计算最后一行的空位数
|
|
24
25
|
const emptyArray = new Array(emptySlots).fill(null); // 生成长度为 emptySlots 的数组
|
|
25
|
-
return { totalRows, emptyArray }
|
|
26
|
+
return { totalRows, emptyArray, ColSpan: tableSearchColSpan ?? ColSpan}
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
export const defaultVisibleFieldsCount = 7;
|
|
@@ -397,4 +398,43 @@ export const maxTagPlaceholder = (selectedValues: any, { selectProps, onChange,
|
|
|
397
398
|
)
|
|
398
399
|
}
|
|
399
400
|
|
|
400
|
-
//
|
|
401
|
+
// 弹窗数据表头处理
|
|
402
|
+
export const handleTableColumns = (tableColumns: any) => {
|
|
403
|
+
// 按照默认设置排序 > 没有排序字段的展示所有列表头 > 没有表头列不展示
|
|
404
|
+
const showTableColumns = tableColumns?.filter((s: any) => typeof s.defaultSort == 'number')||tableColumns||[];
|
|
405
|
+
return showTableColumns?.sort((a: any,b: any)=> a.defaultSort-b.defaultSort)||[]
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
// ------------------------------------------ 数据源展示 相关处理--结束----------------------------------------
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
// ------------------------------------------ 选中数据展示 相关处理--开始----------------------------------------
|
|
413
|
+
const getShowLabelTextStr = ({ kongValue, selectMode, value, items }: any) => {
|
|
414
|
+
if (selectMode) {
|
|
415
|
+
return Array.isArray(value) && value?.map(item => item.label || item.text || '')?.join(',') || kongValue;
|
|
416
|
+
}
|
|
417
|
+
return (value?.label || value?.text || kongValue) as string;
|
|
418
|
+
};
|
|
419
|
+
const getSelectValueText = (v: any, items: any) => {
|
|
420
|
+
return (items || []).filter((item: any) => item.value === v)?.[0]?.text || v || '';
|
|
421
|
+
}
|
|
422
|
+
const getShowValueStr = ({ kongValue, selectMode, value, items }: any): string => {
|
|
423
|
+
if (selectMode) {
|
|
424
|
+
return Array.isArray(value) && value?.map(item => getSelectValueText(item, items))?.join(',') || kongValue;
|
|
425
|
+
}
|
|
426
|
+
return (getSelectValueText(value, items) || kongValue) as string;
|
|
427
|
+
}
|
|
428
|
+
export const getShowStr = ({ viewShowValueStr, labelInValue, selectMode, value, items }: any) => {
|
|
429
|
+
// 优先使用业务使用传入的展示
|
|
430
|
+
if(viewShowValueStr) return viewShowValueStr;
|
|
431
|
+
|
|
432
|
+
const kongValue = '无'
|
|
433
|
+
// 先判断labelInValue与否,labelInValue可以直接去value中获取字段名称,否则去下拉框数据里面去拿;
|
|
434
|
+
// 再判断是单选还是多选,数据类型不同取值方式也不同
|
|
435
|
+
if (labelInValue) {
|
|
436
|
+
return getShowLabelTextStr({ kongValue, selectMode, value, items});
|
|
437
|
+
}
|
|
438
|
+
return getShowValueStr({ kongValue, selectMode, value, items });
|
|
439
|
+
}
|
|
440
|
+
// ------------------------------------------ 选中数据展示 相关处理--结束---------------------------------------
|
|
@@ -688,6 +688,7 @@ class RuleObjectComponent extends Component {
|
|
|
688
688
|
initialThresholdQuery = {},
|
|
689
689
|
disabled,
|
|
690
690
|
systemVariableList,
|
|
691
|
+
needShowInsertSQL,
|
|
691
692
|
} = this.props;
|
|
692
693
|
let thresholdQuery = {
|
|
693
694
|
...initialThresholdQuery,
|
|
@@ -825,6 +826,9 @@ class RuleObjectComponent extends Component {
|
|
|
825
826
|
itemDetail.metaObjectCode =
|
|
826
827
|
nodeInfo.triggerNode.props.metaObjectCode;
|
|
827
828
|
itemDetail.isInsertParam = false;
|
|
829
|
+
if(needShowInsertSQL) {
|
|
830
|
+
itemDetail.isInsertSQL = false;
|
|
831
|
+
}
|
|
828
832
|
this.setState(
|
|
829
833
|
{
|
|
830
834
|
ruleClassData,
|
|
@@ -862,7 +866,7 @@ class RuleObjectComponent extends Component {
|
|
|
862
866
|
),
|
|
863
867
|
)}
|
|
864
868
|
</Select>
|
|
865
|
-
{!itemDetail?.isInsertParam ? (
|
|
869
|
+
{(needShowInsertSQL ? (!itemDetail?.isInsertParam&&!itemDetail?.isInsertSQL): !itemDetail?.isInsertParam) ? (
|
|
866
870
|
<RuleField
|
|
867
871
|
customerWidth={this.props.customerWidth}
|
|
868
872
|
selectOperation={itemDetail?.operationCode || ''}
|
|
@@ -926,6 +930,30 @@ class RuleObjectComponent extends Component {
|
|
|
926
930
|
))
|
|
927
931
|
: null}
|
|
928
932
|
</Select>
|
|
933
|
+
<Input
|
|
934
|
+
disabled={disabled}
|
|
935
|
+
value={itemDetail?.params?.[0]||''}
|
|
936
|
+
style={{
|
|
937
|
+
width: '150px',
|
|
938
|
+
marginLeft: '10px',
|
|
939
|
+
display: needShowInsertSQL && itemDetail?.isInsertSQL ? '' : 'none',
|
|
940
|
+
}}
|
|
941
|
+
onChange={(e) => {
|
|
942
|
+
const value = e.target.value;
|
|
943
|
+
const { ruleClassData } = this.state;
|
|
944
|
+
itemDetail.params = [value || ''];
|
|
945
|
+
itemDetail.paramNames = [''];
|
|
946
|
+
this.setState(
|
|
947
|
+
{
|
|
948
|
+
ruleClassData,
|
|
949
|
+
},
|
|
950
|
+
() => {
|
|
951
|
+
callBack(ruleClassData);
|
|
952
|
+
},
|
|
953
|
+
);
|
|
954
|
+
}}
|
|
955
|
+
>
|
|
956
|
+
</Input>
|
|
929
957
|
<PlusCircleOutlined
|
|
930
958
|
className={'icon_btn_style'}
|
|
931
959
|
onClick={() => {
|
|
@@ -985,6 +1013,36 @@ class RuleObjectComponent extends Component {
|
|
|
985
1013
|
>
|
|
986
1014
|
{itemDetail?.isInsertParam ? '取消插入参数' : '插入参数'}
|
|
987
1015
|
</Button>
|
|
1016
|
+
<Button
|
|
1017
|
+
type="link"
|
|
1018
|
+
disabled={
|
|
1019
|
+
disabled ||
|
|
1020
|
+
(itemDetail.operationCode === '' || !itemDetail.operationCode
|
|
1021
|
+
? true
|
|
1022
|
+
: false)
|
|
1023
|
+
}
|
|
1024
|
+
style={needShowInsertSQL?{}:{ display: 'none'}}
|
|
1025
|
+
onClick={() => {
|
|
1026
|
+
const { ruleClassData } = this.state;
|
|
1027
|
+
itemDetail.isInsertSQL = !itemDetail.isInsertSQL;
|
|
1028
|
+
if (itemDetail.isInsertSQL) {
|
|
1029
|
+
itemDetail.type = 30;
|
|
1030
|
+
itemDetail.paramNames = [];
|
|
1031
|
+
itemDetail.params = [];
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
this.setState(
|
|
1035
|
+
{
|
|
1036
|
+
ruleClassData,
|
|
1037
|
+
},
|
|
1038
|
+
() => {
|
|
1039
|
+
callBack(ruleClassData);
|
|
1040
|
+
},
|
|
1041
|
+
);
|
|
1042
|
+
}}
|
|
1043
|
+
>
|
|
1044
|
+
{itemDetail?.isInsertSQL ? '取消插入SQL' : '插入SQL'}
|
|
1045
|
+
</Button>
|
|
988
1046
|
</div>
|
|
989
1047
|
)}
|
|
990
1048
|
<div
|