@bit-sun/business-component 2.2.30 → 2.2.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/dist/components/Functional/AddSelect/helps.d.ts +1 -0
- package/dist/index.esm.js +29 -4
- package/dist/index.js +29 -4
- package/package.json +1 -1
- package/src/components/Business/AddSelectBusiness/index.tsx +1 -0
- package/src/components/Functional/AddSelect/helps.ts +14 -0
- package/src/components/Functional/AddSelect/index.tsx +5 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getSelectDataList: (record: any, item: any, selectKey: string) => any;
|
package/dist/index.esm.js
CHANGED
|
@@ -9867,6 +9867,27 @@ var getItemDefaultWidth$1 = function getItemDefaultWidth(item) {
|
|
|
9867
9867
|
return defaultWidth;
|
|
9868
9868
|
};
|
|
9869
9869
|
|
|
9870
|
+
// 下拉框数据源
|
|
9871
|
+
// 情况①:每条记录下拉框数据不同----查询接口每条记录返回字段,前后端约定好,用dataSourceCode记录
|
|
9872
|
+
// 情况②:所有查询记录共有一个数据源---选择器加载查询记录渲染给到dataSource
|
|
9873
|
+
// 特殊情况:要求每条记录下拉框数据不同,后端只能给出每条记录的code拿不到name,就用情况②处理方法配合filterDataSourceCode处理。
|
|
9874
|
+
var getSelectDataList = function getSelectDataList(record, item, selectKey) {
|
|
9875
|
+
var _item$dataSource;
|
|
9876
|
+
var result = [];
|
|
9877
|
+
if (item === null || item === void 0 ? void 0 : item.dataSourceCode) {
|
|
9878
|
+
result = record === null || record === void 0 ? void 0 : record[item === null || item === void 0 ? void 0 : item.dataSourceCode];
|
|
9879
|
+
}
|
|
9880
|
+
if (item === null || item === void 0 ? void 0 : (_item$dataSource = item.dataSource) === null || _item$dataSource === void 0 ? void 0 : _item$dataSource.length) {
|
|
9881
|
+
result = (item === null || item === void 0 ? void 0 : item.filterDataSourceCode) ? item.dataSource.filter(function (i) {
|
|
9882
|
+
var _record$item$filterDa;
|
|
9883
|
+
return (_record$item$filterDa = record[item === null || item === void 0 ? void 0 : item.filterDataSourceCode]) === null || _record$item$filterDa === void 0 ? void 0 : _record$item$filterDa.some(function (s) {
|
|
9884
|
+
return s == i[selectKey];
|
|
9885
|
+
});
|
|
9886
|
+
}) : item.dataSource;
|
|
9887
|
+
}
|
|
9888
|
+
return result;
|
|
9889
|
+
};
|
|
9890
|
+
|
|
9870
9891
|
var _excluded$3 = ["onResize", "width"];
|
|
9871
9892
|
var loadSelectSource = function loadSelectSource(url, params) {
|
|
9872
9893
|
return new Promise(function (resolve, reject) {
|
|
@@ -10231,8 +10252,11 @@ var AddSelect = function AddSelect(props) {
|
|
|
10231
10252
|
result = list.map(function (i) {
|
|
10232
10253
|
recordList.forEach(function (record) {
|
|
10233
10254
|
if (i.uuid == (record === null || record === void 0 ? void 0 : record.uuid)) {
|
|
10234
|
-
var _record$colorValues
|
|
10235
|
-
|
|
10255
|
+
var _record$colorValues;
|
|
10256
|
+
if (((_record$colorValues = record.colorValues) === null || _record$colorValues === void 0 ? void 0 : _record$colorValues.length) == 1) {
|
|
10257
|
+
var _record$colorValues$;
|
|
10258
|
+
i.colorName = (_record$colorValues$ = record.colorValues[0]) === null || _record$colorValues$ === void 0 ? void 0 : _record$colorValues$.value;
|
|
10259
|
+
}
|
|
10236
10260
|
i.selectPropertyGroupCode = record === null || record === void 0 ? void 0 : record.defaultMatchingCode;
|
|
10237
10261
|
}
|
|
10238
10262
|
});
|
|
@@ -10392,9 +10416,9 @@ var AddSelect = function AddSelect(props) {
|
|
|
10392
10416
|
var _item$dataSource;
|
|
10393
10417
|
if ((item === null || item === void 0 ? void 0 : (_item$dataSource = item.dataSource) === null || _item$dataSource === void 0 ? void 0 : _item$dataSource.length) || (item === null || item === void 0 ? void 0 : item.dataSourceCode)) {
|
|
10394
10418
|
var _item$dataSourceMappi, _item$dataSourceMappi2;
|
|
10395
|
-
var dataSourceList = item.dataSource || (record === null || record === void 0 ? void 0 : record[item === null || item === void 0 ? void 0 : item.dataSourceCode]) || [];
|
|
10396
10419
|
var selectKey = (item === null || item === void 0 ? void 0 : (_item$dataSourceMappi = item.dataSourceMapping) === null || _item$dataSourceMappi === void 0 ? void 0 : _item$dataSourceMappi[0]) || 'code';
|
|
10397
10420
|
var selectText = (item === null || item === void 0 ? void 0 : (_item$dataSourceMappi2 = item.dataSourceMapping) === null || _item$dataSourceMappi2 === void 0 ? void 0 : _item$dataSourceMappi2[1]) || 'name';
|
|
10421
|
+
var dataSourceList = getSelectDataList(record, item, selectKey);
|
|
10398
10422
|
return /*#__PURE__*/React.createElement(Select, {
|
|
10399
10423
|
value: text || null,
|
|
10400
10424
|
onChange: function () {
|
|
@@ -14897,7 +14921,8 @@ var AddSpuSelect = function AddSpuSelect(parProps) {
|
|
|
14897
14921
|
dataIndex: 'selectPropertyGroupCode',
|
|
14898
14922
|
width: 160,
|
|
14899
14923
|
isSelectItem: true,
|
|
14900
|
-
dataSource: propertyList
|
|
14924
|
+
dataSource: propertyList,
|
|
14925
|
+
filterDataSourceCode: 'matchingCodes'
|
|
14901
14926
|
}, {
|
|
14902
14927
|
title: '数量',
|
|
14903
14928
|
width: 100,
|
package/dist/index.js
CHANGED
|
@@ -9885,6 +9885,27 @@ var getItemDefaultWidth$1 = function getItemDefaultWidth(item) {
|
|
|
9885
9885
|
return defaultWidth;
|
|
9886
9886
|
};
|
|
9887
9887
|
|
|
9888
|
+
// 下拉框数据源
|
|
9889
|
+
// 情况①:每条记录下拉框数据不同----查询接口每条记录返回字段,前后端约定好,用dataSourceCode记录
|
|
9890
|
+
// 情况②:所有查询记录共有一个数据源---选择器加载查询记录渲染给到dataSource
|
|
9891
|
+
// 特殊情况:要求每条记录下拉框数据不同,后端只能给出每条记录的code拿不到name,就用情况②处理方法配合filterDataSourceCode处理。
|
|
9892
|
+
var getSelectDataList = function getSelectDataList(record, item, selectKey) {
|
|
9893
|
+
var _item$dataSource;
|
|
9894
|
+
var result = [];
|
|
9895
|
+
if (item === null || item === void 0 ? void 0 : item.dataSourceCode) {
|
|
9896
|
+
result = record === null || record === void 0 ? void 0 : record[item === null || item === void 0 ? void 0 : item.dataSourceCode];
|
|
9897
|
+
}
|
|
9898
|
+
if (item === null || item === void 0 ? void 0 : (_item$dataSource = item.dataSource) === null || _item$dataSource === void 0 ? void 0 : _item$dataSource.length) {
|
|
9899
|
+
result = (item === null || item === void 0 ? void 0 : item.filterDataSourceCode) ? item.dataSource.filter(function (i) {
|
|
9900
|
+
var _record$item$filterDa;
|
|
9901
|
+
return (_record$item$filterDa = record[item === null || item === void 0 ? void 0 : item.filterDataSourceCode]) === null || _record$item$filterDa === void 0 ? void 0 : _record$item$filterDa.some(function (s) {
|
|
9902
|
+
return s == i[selectKey];
|
|
9903
|
+
});
|
|
9904
|
+
}) : item.dataSource;
|
|
9905
|
+
}
|
|
9906
|
+
return result;
|
|
9907
|
+
};
|
|
9908
|
+
|
|
9888
9909
|
var _excluded$3 = ["onResize", "width"];
|
|
9889
9910
|
var loadSelectSource = function loadSelectSource(url, params) {
|
|
9890
9911
|
return new Promise(function (resolve, reject) {
|
|
@@ -10249,8 +10270,11 @@ var AddSelect = function AddSelect(props) {
|
|
|
10249
10270
|
result = list.map(function (i) {
|
|
10250
10271
|
recordList.forEach(function (record) {
|
|
10251
10272
|
if (i.uuid == (record === null || record === void 0 ? void 0 : record.uuid)) {
|
|
10252
|
-
var _record$colorValues
|
|
10253
|
-
|
|
10273
|
+
var _record$colorValues;
|
|
10274
|
+
if (((_record$colorValues = record.colorValues) === null || _record$colorValues === void 0 ? void 0 : _record$colorValues.length) == 1) {
|
|
10275
|
+
var _record$colorValues$;
|
|
10276
|
+
i.colorName = (_record$colorValues$ = record.colorValues[0]) === null || _record$colorValues$ === void 0 ? void 0 : _record$colorValues$.value;
|
|
10277
|
+
}
|
|
10254
10278
|
i.selectPropertyGroupCode = record === null || record === void 0 ? void 0 : record.defaultMatchingCode;
|
|
10255
10279
|
}
|
|
10256
10280
|
});
|
|
@@ -10410,9 +10434,9 @@ var AddSelect = function AddSelect(props) {
|
|
|
10410
10434
|
var _item$dataSource;
|
|
10411
10435
|
if ((item === null || item === void 0 ? void 0 : (_item$dataSource = item.dataSource) === null || _item$dataSource === void 0 ? void 0 : _item$dataSource.length) || (item === null || item === void 0 ? void 0 : item.dataSourceCode)) {
|
|
10412
10436
|
var _item$dataSourceMappi, _item$dataSourceMappi2;
|
|
10413
|
-
var dataSourceList = item.dataSource || (record === null || record === void 0 ? void 0 : record[item === null || item === void 0 ? void 0 : item.dataSourceCode]) || [];
|
|
10414
10437
|
var selectKey = (item === null || item === void 0 ? void 0 : (_item$dataSourceMappi = item.dataSourceMapping) === null || _item$dataSourceMappi === void 0 ? void 0 : _item$dataSourceMappi[0]) || 'code';
|
|
10415
10438
|
var selectText = (item === null || item === void 0 ? void 0 : (_item$dataSourceMappi2 = item.dataSourceMapping) === null || _item$dataSourceMappi2 === void 0 ? void 0 : _item$dataSourceMappi2[1]) || 'name';
|
|
10439
|
+
var dataSourceList = getSelectDataList(record, item, selectKey);
|
|
10416
10440
|
return /*#__PURE__*/React__default['default'].createElement(antd.Select, {
|
|
10417
10441
|
value: text || null,
|
|
10418
10442
|
onChange: function () {
|
|
@@ -14915,7 +14939,8 @@ var AddSpuSelect = function AddSpuSelect(parProps) {
|
|
|
14915
14939
|
dataIndex: 'selectPropertyGroupCode',
|
|
14916
14940
|
width: 160,
|
|
14917
14941
|
isSelectItem: true,
|
|
14918
|
-
dataSource: propertyList
|
|
14942
|
+
dataSource: propertyList,
|
|
14943
|
+
filterDataSourceCode: 'matchingCodes'
|
|
14919
14944
|
}, {
|
|
14920
14945
|
title: '数量',
|
|
14921
14946
|
width: 100,
|
package/package.json
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// 下拉框数据源
|
|
2
|
+
// 情况①:每条记录下拉框数据不同----查询接口每条记录返回字段,前后端约定好,用dataSourceCode记录
|
|
3
|
+
// 情况②:所有查询记录共有一个数据源---选择器加载查询记录渲染给到dataSource
|
|
4
|
+
// 特殊情况:要求每条记录下拉框数据不同,后端只能给出每条记录的code拿不到name,就用情况②处理方法配合filterDataSourceCode处理。
|
|
5
|
+
export const getSelectDataList = (record: any,item: any, selectKey: string) => {
|
|
6
|
+
let result = [];
|
|
7
|
+
if(item?.dataSourceCode) {
|
|
8
|
+
result = record?.[item?.dataSourceCode]
|
|
9
|
+
}
|
|
10
|
+
if(item?.dataSource?.length) {
|
|
11
|
+
result = item?.filterDataSourceCode ? item.dataSource.filter((i: any) => record[item?.filterDataSourceCode]?.some((s: any) => s == i[selectKey])) : item.dataSource
|
|
12
|
+
}
|
|
13
|
+
return result;
|
|
14
|
+
}
|
|
@@ -15,6 +15,7 @@ import { setInitialShowColumn } from '@/plugin/TableColumnSetting/utils';
|
|
|
15
15
|
import { handleAntdColumnsSpecialParams, uuid } from '@/utils/utils';
|
|
16
16
|
import { getItemDefaultWidth, noEmptyArray } from '@/components/Business/columnSettingTable/utils';
|
|
17
17
|
import { getEmployeeId } from '@/utils/LocalstorageUtils';
|
|
18
|
+
import { getSelectDataList } from './helps';
|
|
18
19
|
|
|
19
20
|
const loadSelectSource = (url: string, params?: any) => {
|
|
20
21
|
return new Promise((resolve, reject) => {
|
|
@@ -235,7 +236,9 @@ const AddSelect = (props: any) => {
|
|
|
235
236
|
result = list.map((i: any) => {
|
|
236
237
|
recordList.forEach((record: any) => {
|
|
237
238
|
if(i.uuid == record?.uuid) {
|
|
238
|
-
|
|
239
|
+
if(record.colorValues?.length == 1) {
|
|
240
|
+
i.colorName = record.colorValues[0]?.value;
|
|
241
|
+
}
|
|
239
242
|
i.selectPropertyGroupCode = record?.defaultMatchingCode;
|
|
240
243
|
}
|
|
241
244
|
})
|
|
@@ -390,9 +393,9 @@ const AddSelect = (props: any) => {
|
|
|
390
393
|
...item,
|
|
391
394
|
render: (text, record, index) => {
|
|
392
395
|
if (item?.dataSource?.length || item?.dataSourceCode) {
|
|
393
|
-
const dataSourceList = item.dataSource || record?.[item?.dataSourceCode] || [];
|
|
394
396
|
const selectKey = item?.dataSourceMapping?.[0] || 'code';
|
|
395
397
|
const selectText = item?.dataSourceMapping?.[1] || 'name';
|
|
398
|
+
const dataSourceList = getSelectDataList(record,item,selectKey);
|
|
396
399
|
return (
|
|
397
400
|
<Select
|
|
398
401
|
value={text || null}
|