@bit-sun/business-component 2.2.49 → 2.3.0-alpha.2
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/dist/common/ENUM.d.ts +40 -0
- package/dist/components/Business/BsSulaQueryTable/setting.d.ts +2 -2
- package/dist/components/Business/SearchSelect/common.d.ts +9 -1
- package/dist/components/Business/TreeSearchSelect/utils.d.ts +3 -1
- package/dist/components/Functional/AddSelect/helps.d.ts +13 -0
- package/dist/components/Functional/BsAntdSula/BsCascader/index.d.ts +18 -0
- package/dist/components/Functional/BsAntdSula/index.d.ts +1 -0
- package/dist/components/Solution/RuleComponent/Formula.d.ts +8 -0
- package/dist/components/Solution/RuleComponent/services.d.ts +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.esm.js +10845 -11311
- package/dist/index.js +10806 -11268
- package/dist/utils/LocalstorageUtils.d.ts +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/utils.d.ts +7 -0
- package/package.json +2 -1
- package/src/common/ENUM.ts +41 -0
- package/src/components/Business/AddSelectBusiness/index.md +1 -0
- package/src/components/Business/AddSelectBusiness/index.tsx +375 -176
- package/src/components/Business/BsSulaQueryTable/SearchItemSetting.tsx +1 -1
- package/src/components/Business/BsSulaQueryTable/index.tsx +20 -12
- package/src/components/Business/BsSulaQueryTable/setting.tsx +36 -16
- package/src/components/Business/BsSulaQueryTable/utils.tsx +31 -29
- package/src/components/Business/JsonQueryTable/components/FieldsSettingsTable.tsx +4 -0
- package/src/components/Business/JsonQueryTable/index.tsx +248 -33
- package/src/components/Business/JsonQueryTable/static.ts +5 -5
- package/src/components/Business/SearchSelect/BusinessUtils.ts +37 -7
- package/src/components/Business/SearchSelect/common.ts +23 -1
- package/src/components/Business/SearchSelect/index.md +12 -2
- package/src/components/Business/SearchSelect/index.tsx +5 -2
- package/src/components/Business/TreeSearchSelect/index.md +2 -0
- package/src/components/Business/TreeSearchSelect/index.tsx +1 -2
- package/src/components/Business/TreeSearchSelect/utils.ts +7 -1
- package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +1 -1
- package/src/components/Business/columnSettingTable/utils.tsx +30 -28
- package/src/components/Business/moreTreeTable/FixedScrollBar.tsx +1 -0
- package/src/components/Business/moreTreeTable/index.md +2 -2
- package/src/components/Business/moreTreeTable/index.tsx +24 -17
- package/src/components/Functional/AddSelect/helps.ts +65 -0
- package/src/components/Functional/AddSelect/index.tsx +13 -122
- package/src/components/Functional/BsAntdSula/BsCascader/index.md +62 -0
- package/src/components/Functional/BsAntdSula/BsCascader/index.tsx +178 -0
- package/src/components/Functional/BsAntdSula/index.ts +2 -0
- package/src/components/Functional/EllipsisTooltip/index.d.ts +5 -0
- package/src/components/Functional/EllipsisTooltip/index.js +36 -0
- package/src/components/Functional/EllipsisTooltip/index.md +30 -0
- package/src/components/Functional/SearchSelect/index.tsx +97 -60
- package/src/components/Functional/TreeSearchSelect/index.tsx +44 -7
- package/src/components/Solution/RuleComponent/Formula.tsx +335 -0
- package/src/components/Solution/RuleComponent/index.d.ts +29 -0
- package/src/components/Solution/RuleComponent/index.js +2032 -0
- package/src/components/Solution/RuleComponent/index.less +230 -0
- package/src/components/Solution/RuleComponent/renderSpecificAction.js +99 -0
- package/src/components/Solution/RuleComponent/ruleFiled.js +2107 -0
- package/src/components/Solution/RuleComponent/services.ts +13 -0
- package/src/components/Solution/RuleComponent/util.js +139 -0
- package/src/index.ts +4 -0
- package/src/utils/LocalstorageUtils.ts +5 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/utils.ts +29 -0
|
@@ -60,6 +60,7 @@ export default (props: any) => {
|
|
|
60
60
|
|
|
61
61
|
const [height, setHeight]: any = useState('100vh');
|
|
62
62
|
const sortTableRef = useRef(null);
|
|
63
|
+
const searchTableRef = useRef(null);
|
|
63
64
|
|
|
64
65
|
const bsTableCode = tableCode || window.location.hash; //设置列字段的唯一标识
|
|
65
66
|
// 获取table高度
|
|
@@ -367,20 +368,17 @@ export default (props: any) => {
|
|
|
367
368
|
props: {
|
|
368
369
|
children: (
|
|
369
370
|
<span className="ant-dropdown-link">
|
|
370
|
-
<Dropdown overlay={
|
|
371
|
-
<Menu
|
|
371
|
+
<Dropdown overlay={
|
|
372
|
+
<Menu>
|
|
372
373
|
<Menu.Item>
|
|
373
|
-
<
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
datasource={value?.columns || []}
|
|
378
|
-
bsTableCode={bsTableCode}
|
|
379
|
-
/>
|
|
374
|
+
<div
|
|
375
|
+
onClick={sortTableRef?.current?.showModal}
|
|
376
|
+
style={{fontSize:14, textAlign: 'center'}}
|
|
377
|
+
>列设置</div>
|
|
380
378
|
</Menu.Item>
|
|
381
379
|
<Menu.Item>
|
|
382
380
|
<SearchItemTable
|
|
383
|
-
ref={
|
|
381
|
+
ref={searchTableRef}
|
|
384
382
|
setShowSearchFields={setShowSearchFields}
|
|
385
383
|
showSearchFields={showSearchFields}
|
|
386
384
|
datasource={value?.fields || []}
|
|
@@ -388,7 +386,7 @@ export default (props: any) => {
|
|
|
388
386
|
/>
|
|
389
387
|
</Menu.Item>
|
|
390
388
|
</Menu>
|
|
391
|
-
} placement="
|
|
389
|
+
} placement="bottomRight" >
|
|
392
390
|
<span className="ant-dropdown-link">
|
|
393
391
|
<img width={32} src={shezhi} />
|
|
394
392
|
</span>
|
|
@@ -523,5 +521,15 @@ export default (props: any) => {
|
|
|
523
521
|
}),
|
|
524
522
|
[value, checkedList, showColumn, props.statusMapping, showSearchFields],
|
|
525
523
|
);
|
|
526
|
-
return
|
|
524
|
+
return <>
|
|
525
|
+
<MemoQueryTable {...memoConfig} />
|
|
526
|
+
<SortableTable
|
|
527
|
+
ref={sortTableRef}
|
|
528
|
+
setShowColumns={setShowColumns}
|
|
529
|
+
showColumn={showColumn}
|
|
530
|
+
datasource={value?.columns || []}
|
|
531
|
+
bsTableCode={bsTableCode}
|
|
532
|
+
onlyModal
|
|
533
|
+
/>
|
|
534
|
+
</>;
|
|
527
535
|
};
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
Input,
|
|
9
9
|
Button,
|
|
10
10
|
Tooltip,
|
|
11
|
+
Typography,
|
|
11
12
|
} from 'antd';
|
|
12
13
|
import {
|
|
13
14
|
SortableContainer,
|
|
@@ -56,19 +57,23 @@ class SortableTable extends React.Component {
|
|
|
56
57
|
fixed: item.fixed,
|
|
57
58
|
}))
|
|
58
59
|
: '';
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
60
|
+
return new Promise((resolve: any, reject: any) => {
|
|
61
|
+
axios({
|
|
62
|
+
url: '/user/appConfig/saveUserOrder',
|
|
63
|
+
method: 'POST',
|
|
64
|
+
data: {
|
|
65
|
+
code: that.state.bsTableCode,
|
|
66
|
+
detail: configvalue ? JSON.stringify(configvalue) : '',
|
|
67
|
+
},
|
|
68
|
+
}).then((res:any) => {
|
|
69
|
+
if (res?.data?.status === '0') {
|
|
70
|
+
this.patchConfigToLocalstorage(configvalue);
|
|
71
|
+
resolve({ status: '0' });
|
|
72
|
+
} else {
|
|
73
|
+
message.error('保存表头列自定义失败,请稍后尝试');
|
|
74
|
+
reject('');
|
|
75
|
+
}
|
|
76
|
+
})
|
|
72
77
|
})
|
|
73
78
|
};
|
|
74
79
|
|
|
@@ -447,7 +452,7 @@ class SortableTable extends React.Component {
|
|
|
447
452
|
// this.patchUserColumnConfig('');
|
|
448
453
|
// return;
|
|
449
454
|
// }
|
|
450
|
-
this.patchUserColumnConfig(sortDataSource);
|
|
455
|
+
return this.patchUserColumnConfig(sortDataSource);
|
|
451
456
|
};
|
|
452
457
|
|
|
453
458
|
handleCancel = (e: React.MouseEvent<HTMLElement>) => {
|
|
@@ -478,7 +483,17 @@ class SortableTable extends React.Component {
|
|
|
478
483
|
],
|
|
479
484
|
},
|
|
480
485
|
() => {
|
|
481
|
-
this.handleOk()
|
|
486
|
+
this.handleOk()
|
|
487
|
+
.then((res: any) => {
|
|
488
|
+
if (res.status === '0') {
|
|
489
|
+
message.success(<span>
|
|
490
|
+
字段已隐藏,如需重新显示请前往<Typography.Link
|
|
491
|
+
underline
|
|
492
|
+
onClick={this.showModal}
|
|
493
|
+
>列设置</Typography.Link>
|
|
494
|
+
</span>)
|
|
495
|
+
}
|
|
496
|
+
});
|
|
482
497
|
},
|
|
483
498
|
);
|
|
484
499
|
};
|
|
@@ -606,6 +621,7 @@ class SortableTable extends React.Component {
|
|
|
606
621
|
};
|
|
607
622
|
|
|
608
623
|
render() {
|
|
624
|
+
const { onlyModal } = this.props;
|
|
609
625
|
const {
|
|
610
626
|
dataSource,
|
|
611
627
|
searchDataSource,
|
|
@@ -823,7 +839,11 @@ class SortableTable extends React.Component {
|
|
|
823
839
|
</div>
|
|
824
840
|
</Modal>
|
|
825
841
|
)}
|
|
826
|
-
|
|
842
|
+
{
|
|
843
|
+
!onlyModal
|
|
844
|
+
? <div onClick={this.showModal} style={{fontSize:14}}>列设置</div>
|
|
845
|
+
: ''
|
|
846
|
+
}
|
|
827
847
|
</div>
|
|
828
848
|
);
|
|
829
849
|
}
|
|
@@ -572,33 +572,35 @@ export const renderFixed2 = (text: any) => text;
|
|
|
572
572
|
//设置queryTable默认列宽
|
|
573
573
|
export const getItemDefaultWidth = (item: any) => {
|
|
574
574
|
let defaultWidth = 200;
|
|
575
|
-
let lowerCaseKey = (item.key || item.dataIndex)
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
575
|
+
let lowerCaseKey = (item.key || item.dataIndex)?.toLowerCase();
|
|
576
|
+
if (lowerCaseKey) {
|
|
577
|
+
switch (true) {
|
|
578
|
+
case item?.title === '操作' || lowerCaseKey === 'operate':
|
|
579
|
+
defaultWidth = 60;
|
|
580
|
+
break;
|
|
581
|
+
case lowerCaseKey.indexOf('number') > -1:
|
|
582
|
+
case lowerCaseKey.indexOf('quantity') > -1:
|
|
583
|
+
case lowerCaseKey.indexOf('amount') > -1:
|
|
584
|
+
defaultWidth = 90;
|
|
585
|
+
break;
|
|
586
|
+
case (lowerCaseKey.indexOf('no') > -1):
|
|
587
|
+
defaultWidth = 200;
|
|
588
|
+
break;
|
|
589
|
+
case lowerCaseKey.indexOf('code') > -1:
|
|
590
|
+
defaultWidth = 170;
|
|
591
|
+
break;
|
|
592
|
+
case lowerCaseKey.indexOf('time') > -1:
|
|
593
|
+
defaultWidth = 130;
|
|
594
|
+
break;
|
|
595
|
+
case lowerCaseKey.indexOf('status') > -1:
|
|
596
|
+
defaultWidth = 100;
|
|
597
|
+
break;
|
|
598
|
+
case lowerCaseKey.indexOf('user') > -1:
|
|
599
|
+
defaultWidth = 130;
|
|
600
|
+
break;
|
|
601
|
+
default:
|
|
602
|
+
break;
|
|
603
|
+
}
|
|
602
604
|
}
|
|
603
605
|
return defaultWidth;
|
|
604
606
|
};
|
|
@@ -608,7 +610,7 @@ export const getItemDefaultWidth = (item: any) => {
|
|
|
608
610
|
* @param params 要应用于查询的参数
|
|
609
611
|
* @returns 返回处理后的查询参数
|
|
610
612
|
*/
|
|
611
|
-
|
|
613
|
+
export function queryParams(params: any, flag?: any) {
|
|
612
614
|
for (const key in params) {
|
|
613
615
|
if (Object.prototype.hasOwnProperty.call(params, key)) {
|
|
614
616
|
const element = params[key];
|
|
@@ -678,7 +680,7 @@ export const getItemDefaultWidth = (item: any) => {
|
|
|
678
680
|
* @param code 对应权限值
|
|
679
681
|
* @returns boolean
|
|
680
682
|
*/
|
|
681
|
-
|
|
683
|
+
export const authFn = (code?: any) => {
|
|
682
684
|
const authButton = localStorage.getItem(ENUM.BROWSER_CACHE.MAIN_AUTH_CODES)
|
|
683
685
|
? JSON.parse(localStorage.getItem(ENUM.BROWSER_CACHE.MAIN_AUTH_CODES) as string)
|
|
684
686
|
: [];
|
|
@@ -12,6 +12,7 @@ export default (props:any)=>{
|
|
|
12
12
|
codeProps='',
|
|
13
13
|
moduleType,
|
|
14
14
|
moduleRelationId,
|
|
15
|
+
tableFlag = false
|
|
15
16
|
} = props;
|
|
16
17
|
|
|
17
18
|
const ref = useRef(null);
|
|
@@ -108,6 +109,9 @@ export default (props:any)=>{
|
|
|
108
109
|
key: 'codeSnippet',
|
|
109
110
|
title: '代码片段',
|
|
110
111
|
render: ({text,record}:any) => {
|
|
112
|
+
if(tableFlag){
|
|
113
|
+
return <div> 列表:{`{"key": "extensionFields,${record.code}","dataIndex": "extensionFields,${record.code}","title": "${record.name}"},`}</div>
|
|
114
|
+
}
|
|
111
115
|
if (!codeProps.columns) {
|
|
112
116
|
return <div>表单:{`{"name": "extensionFields,${record.code}","label": "${record.name}"},`}</div>
|
|
113
117
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import React, { useState, useRef, useEffect } from 'react';
|
|
3
|
-
import { message, Button, Table } from 'antd';
|
|
2
|
+
import React, { useState, useRef, useEffect, Fragment } from 'react';
|
|
3
|
+
import { message, Button, Table, Tabs } from 'antd';
|
|
4
4
|
import Drawer from './drawer';
|
|
5
5
|
import ConfigButton from './configButton';
|
|
6
6
|
import Editor from './jsonEditor';
|
|
@@ -76,13 +76,28 @@ function convertFileds (fields, falltValue, faltFieldRange, containerName) {
|
|
|
76
76
|
field.fields.forEach(item => {
|
|
77
77
|
const targetValue = convertFileds(item, falltValue, faltFieldRange, field?.container?.name);
|
|
78
78
|
if(targetValue){
|
|
79
|
+
if(item.dependency) {
|
|
80
|
+
targetValue.dependency = {
|
|
81
|
+
visible: {
|
|
82
|
+
...item.dependency.visible,
|
|
83
|
+
type: (new Function('axios','ctx', item.dependency.visible.type)).bind(null, axios)
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
79
87
|
filedsValue.push(targetValue)
|
|
80
88
|
}
|
|
81
89
|
})
|
|
82
90
|
} else {
|
|
83
91
|
const returnField = field.isStaticCode ? falltValue[containerName ? (containerName + field.name) : field.name] : faltFieldRange[field.name];
|
|
84
92
|
if (returnField) {
|
|
85
|
-
returnField.label = field?.label;
|
|
93
|
+
returnField.label = field?.label;
|
|
94
|
+
if(field?.disabled){ // 字段设置只读属性
|
|
95
|
+
returnField.field.props.disabled = true;
|
|
96
|
+
}
|
|
97
|
+
if(field?.invisible){ // 字段设置不可见属性
|
|
98
|
+
returnField.initialVisible = false;
|
|
99
|
+
}
|
|
100
|
+
|
|
86
101
|
if(Array.isArray(returnField.name)&&returnField.name?.includes("extensionFields")){
|
|
87
102
|
returnField.notShowLabel = true;
|
|
88
103
|
}
|
|
@@ -120,16 +135,45 @@ function faltCustomerFieldRange(fileds) {
|
|
|
120
135
|
return columnsValue;
|
|
121
136
|
}
|
|
122
137
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
138
|
+
//form存在新加container属性分组得情况 组合操作
|
|
139
|
+
function combineContainer(originFields, currentFields){
|
|
140
|
+
let newCurrentFields = [...originFields];
|
|
141
|
+
currentFields.map((item: any) => {
|
|
142
|
+
if(!originFields.find((i: any) => i?.container?.props?.name == item?.container?.name)){
|
|
143
|
+
newCurrentFields = [...newCurrentFields, {
|
|
144
|
+
container: {
|
|
145
|
+
type: 'card',
|
|
146
|
+
props: {
|
|
147
|
+
title: item?.container?.title,
|
|
148
|
+
level: 1,
|
|
149
|
+
id: Math.random(),
|
|
150
|
+
isWhiteCard: true,
|
|
151
|
+
bordered: false,
|
|
152
|
+
name: item?.container?.name,
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
fields: item?.fields || []
|
|
156
|
+
}];
|
|
157
|
+
}
|
|
158
|
+
})
|
|
159
|
+
return newCurrentFields;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function hanleCallbackValue(codeProps, value, customerFields, cacheColumns = []) {
|
|
163
|
+
const faltFieldRange = faltCustomerFieldRange(customerFields);
|
|
164
|
+
// const falltValue = flatFileds({fields: codeProps.fields})
|
|
165
|
+
const falltValue = flatFileds({fields: combineContainer(codeProps.fields, value?.fields)})
|
|
126
166
|
let newCodeProps = {...codeProps};
|
|
127
167
|
newCodeProps.fields = convertFileds({fields: value.fields}, falltValue, faltFieldRange).fields;
|
|
128
168
|
if (codeProps.columns) {
|
|
129
169
|
const faltColumnsValue = faltColumns(codeProps.columns)
|
|
130
170
|
newCodeProps.columns = value.columns.map(item => {
|
|
131
171
|
if (item.isStaticCode) {
|
|
132
|
-
|
|
172
|
+
const cacheFieldProperty = cacheColumns.find(k => (k.key||k.dataIndex) == (item.key||item.dataIndex));
|
|
173
|
+
return {
|
|
174
|
+
...faltColumnsValue[item.key],
|
|
175
|
+
...cacheFieldProperty
|
|
176
|
+
}
|
|
133
177
|
} else {
|
|
134
178
|
//自定义字段-列字段
|
|
135
179
|
if(item?.key&&item?.key.includes('extensionFields')&&item?.key.includes(',')){
|
|
@@ -137,10 +181,19 @@ function hanleCallbackValue(codeProps, value, customerFields) {
|
|
|
137
181
|
...item,
|
|
138
182
|
render: ({ record }: any) => {
|
|
139
183
|
try{
|
|
140
|
-
const
|
|
141
|
-
const
|
|
142
|
-
const
|
|
143
|
-
|
|
184
|
+
const { extensionFields = {} } = record;
|
|
185
|
+
const fieldName1= item?.key.split(',')[1]; //兼容没有fieldName的情况
|
|
186
|
+
const fieldName2 = `${fieldName1}Name`;
|
|
187
|
+
if(customerFields.length){
|
|
188
|
+
const targetField = customerFields.find(k => k.name.includes(fieldName1));
|
|
189
|
+
if(targetField){
|
|
190
|
+
const { initialSource = [] } = targetField
|
|
191
|
+
if(initialSource.length){
|
|
192
|
+
return initialSource.find((d => d.value == extensionFields[fieldName1]))?.text || extensionFields[fieldName1];
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return extensionFields[fieldName2] || extensionFields[fieldName1] || '';
|
|
144
197
|
}catch(e){
|
|
145
198
|
console.log('e',e);
|
|
146
199
|
}
|
|
@@ -205,11 +258,13 @@ const tableStyleList = [
|
|
|
205
258
|
];
|
|
206
259
|
const JsonQueryTable = React.memo(props => {
|
|
207
260
|
const {
|
|
208
|
-
callBack,
|
|
209
|
-
codeProps,
|
|
210
|
-
customerFields,
|
|
211
|
-
initialSetting,
|
|
212
|
-
pageType
|
|
261
|
+
callBack, // 主保存函数回调
|
|
262
|
+
codeProps, // 整体的配置数据
|
|
263
|
+
customerFields, //可选的配置字段
|
|
264
|
+
initialSetting, //上一次添加自定义字段后保存的数据
|
|
265
|
+
pageType, //页面权限code
|
|
266
|
+
detailTablesSetting = [], //详情明细表格列配置数据
|
|
267
|
+
saveTableCallBack, //详情明细保存函数回调
|
|
213
268
|
} = props;
|
|
214
269
|
|
|
215
270
|
let codeFilter = {};
|
|
@@ -229,7 +284,6 @@ const JsonQueryTable = React.memo(props => {
|
|
|
229
284
|
} else {
|
|
230
285
|
codeFilter.fields = iterFileds({fields: codeProps.fields}).fields
|
|
231
286
|
}
|
|
232
|
-
console.log('codeFilter',codeFilter)
|
|
233
287
|
|
|
234
288
|
const styleRef = useRef(null);
|
|
235
289
|
|
|
@@ -238,6 +292,9 @@ const JsonQueryTable = React.memo(props => {
|
|
|
238
292
|
const [init, setInit] = useState(true);
|
|
239
293
|
const [jsonEditorVal, setJsonEditorVal] = useState(initialSetting || codeFilter);
|
|
240
294
|
const [moduleParams, setModuleParams] = useState({});
|
|
295
|
+
const [activeKey, setActiveKey] = useState('main'); //默认详情页配置
|
|
296
|
+
const [tablesConfigParams, setTablesConfigParams] = useState({});
|
|
297
|
+
const [tableJsonEditorValsArr, setTableJsonEditorValsArr] = useState([]);
|
|
241
298
|
|
|
242
299
|
useEffect(()=>{
|
|
243
300
|
Promise.all([
|
|
@@ -258,6 +315,69 @@ const JsonQueryTable = React.memo(props => {
|
|
|
258
315
|
})
|
|
259
316
|
},[]);
|
|
260
317
|
|
|
318
|
+
useEffect(()=>{
|
|
319
|
+
//明细表的配置数据
|
|
320
|
+
const axiosArr = detailTablesSetting.map((item:any) => axios.get(`/basic/flow/businessFieldGroup/one?moduleType=2&layoutPoint=${item.tableCode}`));
|
|
321
|
+
Promise.all(axiosArr).then(([...resArr])=> {
|
|
322
|
+
let configParams = {};
|
|
323
|
+
detailTablesSetting.map((item:any, index:number)=>{
|
|
324
|
+
const { code, data } = resArr[index]?.data || {};
|
|
325
|
+
if(data){
|
|
326
|
+
const { businessType, code:fieldGroup, moduleType } = data;
|
|
327
|
+
configParams [item.tableCode] = {
|
|
328
|
+
businessType,
|
|
329
|
+
fieldGroup,
|
|
330
|
+
moduleType,
|
|
331
|
+
tableFlag: true
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
})
|
|
335
|
+
setTablesConfigParams({
|
|
336
|
+
...configParams,
|
|
337
|
+
});
|
|
338
|
+
})
|
|
339
|
+
|
|
340
|
+
const detailTableCodeFilter = detailTablesSetting.map(item => {
|
|
341
|
+
if(item?.initialSetting && item?.initialSetting.length){
|
|
342
|
+
return {
|
|
343
|
+
...item,
|
|
344
|
+
columns: item?.initialSetting
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
return {
|
|
348
|
+
...item,
|
|
349
|
+
columns: item?.columns.map(childItem => ({
|
|
350
|
+
key: childItem.key || childItem.dataIndex,
|
|
351
|
+
dataIndex: childItem.dataIndex || childItem.key,
|
|
352
|
+
isStaticCode: true,
|
|
353
|
+
title: childItem.title
|
|
354
|
+
}))
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
setTableJsonEditorValsArr([...detailTableCodeFilter]);
|
|
358
|
+
const lastRes = detailTableCodeFilter.map(item => {
|
|
359
|
+
if(item?.initialSetting && item?.initialSetting.length){
|
|
360
|
+
const codeProps = {
|
|
361
|
+
fields: [],
|
|
362
|
+
columns: item?.columns,
|
|
363
|
+
};
|
|
364
|
+
const newValue = {
|
|
365
|
+
fields: [],
|
|
366
|
+
columns: item.initialSetting
|
|
367
|
+
};
|
|
368
|
+
const result = hanleCallbackValue(codeProps, newValue, item?.customerFields, item?.cacheColumns);
|
|
369
|
+
return {
|
|
370
|
+
...item,
|
|
371
|
+
columns: result?.columns
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
return item;
|
|
375
|
+
});
|
|
376
|
+
if(lastRes.length){
|
|
377
|
+
saveTableCallBack(lastRes, false);
|
|
378
|
+
}
|
|
379
|
+
},[detailTablesSetting.length]);
|
|
380
|
+
|
|
261
381
|
const onClickRun = (value, isSave) => {
|
|
262
382
|
setJsonEditorVal(value);
|
|
263
383
|
|
|
@@ -269,6 +389,38 @@ const JsonQueryTable = React.memo(props => {
|
|
|
269
389
|
}
|
|
270
390
|
};
|
|
271
391
|
|
|
392
|
+
//明细表保存
|
|
393
|
+
const onClickRunDetailTables = (value, isSave, tableCode, tableSouce) =>{
|
|
394
|
+
const targetCode = tableCode || activeKey;
|
|
395
|
+
const targetTableSource = tableSouce || tableJsonEditorValsArr;
|
|
396
|
+
const newArr = targetTableSource.map(item => {
|
|
397
|
+
if(item.tableCode == targetCode){
|
|
398
|
+
return {
|
|
399
|
+
...item,
|
|
400
|
+
columns: value
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
return item
|
|
404
|
+
});
|
|
405
|
+
setTableJsonEditorValsArr([...newArr]);
|
|
406
|
+
|
|
407
|
+
try {
|
|
408
|
+
const target = targetTableSource.find(item=>item.tableCode == targetCode);
|
|
409
|
+
const codeProps = {
|
|
410
|
+
fields: [],
|
|
411
|
+
columns: target?.columns,
|
|
412
|
+
};
|
|
413
|
+
const newValue = {
|
|
414
|
+
fields: [],
|
|
415
|
+
columns: value
|
|
416
|
+
};
|
|
417
|
+
const result = hanleCallbackValue(codeProps, newValue, target?.customerFields, target?.cacheColumns);
|
|
418
|
+
saveTableCallBack({ columns: result.columns, tableCode: targetCode }, isSave, value);
|
|
419
|
+
} catch (e) {
|
|
420
|
+
message.error(e);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
272
424
|
React.useEffect(() => {
|
|
273
425
|
localStorage.setItem('jsonEditorVal',JSON.stringify(jsonEditorVal||{}))
|
|
274
426
|
}, [jsonEditorVal]);
|
|
@@ -291,25 +443,88 @@ const JsonQueryTable = React.memo(props => {
|
|
|
291
443
|
|
|
292
444
|
return (
|
|
293
445
|
<div>
|
|
294
|
-
<Drawer visible={visible} width={
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
446
|
+
<Drawer visible={visible} width={1400} onClose={() => setVisible(false)} className={'customFieldsDrawer'}>
|
|
447
|
+
{
|
|
448
|
+
detailTablesSetting.length == 0 &&(
|
|
449
|
+
<div style={{display: 'flex'}}>
|
|
450
|
+
<div style={{flex: 1, width: 500}}>
|
|
451
|
+
{
|
|
452
|
+
isEmpty(moduleParams)?(
|
|
453
|
+
<div style={{padding:"10px 0", fontSize:"16px", fontWeight:"bolder"}}>
|
|
454
|
+
提示:业务对象未维护,请在通用单据对应业务类型下维护业务对象
|
|
455
|
+
</div>
|
|
456
|
+
):(
|
|
457
|
+
<FieldsSettingsTable {...tableParams}/>
|
|
458
|
+
)
|
|
459
|
+
}
|
|
460
|
+
</div>
|
|
461
|
+
<div style={{flex: 1}}>
|
|
462
|
+
<Editor
|
|
463
|
+
type="table"
|
|
464
|
+
onRun={onClickRun}
|
|
465
|
+
value={jsonEditorVal}
|
|
466
|
+
shallowHeight={height}
|
|
467
|
+
/>
|
|
468
|
+
</div>
|
|
302
469
|
</div>
|
|
303
|
-
):(
|
|
304
|
-
<FieldsSettingsTable {...tableParams}/>
|
|
305
470
|
)
|
|
306
471
|
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
472
|
+
{
|
|
473
|
+
detailTablesSetting.length > 0 && (
|
|
474
|
+
<Tabs defaultActiveKey={activeKey} onChange={(v: any) => setActiveKey(v)}>
|
|
475
|
+
<Tabs.TabPane tab="详情页配置" key="main">
|
|
476
|
+
<div style={{display: 'flex'}}>
|
|
477
|
+
<div style={{flex: 1, width: 500}}>
|
|
478
|
+
{
|
|
479
|
+
isEmpty(moduleParams)?(
|
|
480
|
+
<div style={{padding:"10px 0", fontSize:"16px", fontWeight:"bolder"}}>
|
|
481
|
+
提示:业务对象未维护,请在通用单据对应业务类型下维护业务对象
|
|
482
|
+
</div>
|
|
483
|
+
):(
|
|
484
|
+
<FieldsSettingsTable {...tableParams}/>
|
|
485
|
+
)
|
|
486
|
+
}
|
|
487
|
+
</div>
|
|
488
|
+
<div style={{flex: 1}}>
|
|
489
|
+
<Editor
|
|
490
|
+
type="table"
|
|
491
|
+
onRun={onClickRun}
|
|
492
|
+
value={jsonEditorVal}
|
|
493
|
+
shallowHeight={height}
|
|
494
|
+
/>
|
|
495
|
+
</div>
|
|
496
|
+
</div>
|
|
497
|
+
</Tabs.TabPane>
|
|
498
|
+
{
|
|
499
|
+
tableJsonEditorValsArr.map((k:any)=>(
|
|
500
|
+
<Tabs.TabPane tab={k.title} key={k.tableCode}>
|
|
501
|
+
<div style={{display: 'flex'}}>
|
|
502
|
+
<div style={{flex: 1, width: 500}}>
|
|
503
|
+
{
|
|
504
|
+
!tablesConfigParams[k.tableCode]?(
|
|
505
|
+
<div style={{padding:"10px 0", fontSize:"16px", fontWeight:"bolder"}}>
|
|
506
|
+
提示:业务对象未维护,请在通用单据对应业务类型下维护业务对象
|
|
507
|
+
</div>
|
|
508
|
+
):(
|
|
509
|
+
<FieldsSettingsTable {...tablesConfigParams[k.tableCode]}/>
|
|
510
|
+
)
|
|
511
|
+
}
|
|
512
|
+
</div>
|
|
513
|
+
<div style={{flex: 1}}>
|
|
514
|
+
<Editor
|
|
515
|
+
type="table"
|
|
516
|
+
onRun={onClickRunDetailTables}
|
|
517
|
+
value={k.columns}
|
|
518
|
+
shallowHeight={height}
|
|
519
|
+
/>
|
|
520
|
+
</div>
|
|
521
|
+
</div>
|
|
522
|
+
</Tabs.TabPane>
|
|
523
|
+
))
|
|
524
|
+
}
|
|
525
|
+
</Tabs>
|
|
526
|
+
)
|
|
527
|
+
}
|
|
313
528
|
</Drawer>
|
|
314
529
|
|
|
315
530
|
{!visible && isAdmin() && <ConfigButton type='primary' onClick={() => setVisible(true)}>setting</ConfigButton>}
|
|
@@ -13,7 +13,7 @@ const normalMultipleSelectProps = {
|
|
|
13
13
|
},
|
|
14
14
|
};
|
|
15
15
|
// inputType显示类型 10输入框 20单选 30多选 40公式 ||||| valueType字段类型
|
|
16
|
-
export const inputTypes:any = {
|
|
16
|
+
export const inputTypes: any = {
|
|
17
17
|
20: {
|
|
18
18
|
10: {
|
|
19
19
|
type: 'select',
|
|
@@ -128,7 +128,7 @@ export const inputTypes:any = {
|
|
|
128
128
|
type: 'bs-employeeSearchSelect',
|
|
129
129
|
props: {
|
|
130
130
|
...normalSingleSelectProps,
|
|
131
|
-
requestConfig: { mappingValueField: 'employeeNumber' },
|
|
131
|
+
requestConfig: { mappingValueField: 'employeeNumber', filterInit: 'qp-employeeNumber-like', },
|
|
132
132
|
},
|
|
133
133
|
},
|
|
134
134
|
280: {
|
|
@@ -291,7 +291,7 @@ export const inputTypes:any = {
|
|
|
291
291
|
type: 'bs-employeeSearchSelect',
|
|
292
292
|
props: {
|
|
293
293
|
...normalMultipleSelectProps,
|
|
294
|
-
requestConfig: { mappingValueField: 'employeeNumber' },
|
|
294
|
+
requestConfig: { mappingValueField: 'employeeNumber', filterInit: 'qp-employeeNumber-like', },
|
|
295
295
|
},
|
|
296
296
|
},
|
|
297
297
|
280: {
|
|
@@ -368,13 +368,13 @@ export const choiceType = Object.freeze({
|
|
|
368
368
|
340: '规则模板选择器',
|
|
369
369
|
350: '营销区域选择器',
|
|
370
370
|
});
|
|
371
|
-
export const inputType:any ={
|
|
371
|
+
export const inputType: any = {
|
|
372
372
|
10: '输入',
|
|
373
373
|
20: '单选',
|
|
374
374
|
30: '多选',
|
|
375
375
|
40: '公式',
|
|
376
376
|
};
|
|
377
|
-
export const valueType:any = {
|
|
377
|
+
export const valueType: any = {
|
|
378
378
|
10: '文本',
|
|
379
379
|
20: '短整数',
|
|
380
380
|
21: '长整数',
|