@bit-sun/business-component 3.1.9 → 3.2.0-alpha.1
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/Solution/RuleComponent/CustomPlugin/CustomSelector/CustomSelectorModal.d.ts +3 -0
- package/dist/components/Solution/RuleComponent/CustomPlugin/CustomSelector/helps.d.ts +2 -0
- package/dist/components/Solution/RuleComponent/CustomPlugin/CustomSelector/index.d.ts +3 -0
- package/dist/index.esm.js +1061 -12
- package/dist/index.js +1062 -10
- package/dist/utils/requestUtils.d.ts +1 -0
- package/dist/utils/utils.d.ts +2 -0
- package/package.json +1 -1
- package/src/components/Business/SearchSelect/BusinessUtils.tsx +46 -1
- package/src/components/Business/SearchSelect/index.md +58 -0
- package/src/components/Business/SearchSelect/utils.ts +1 -1
- package/src/components/Solution/RuleComponent/CustomPlugin/CustomSelector/CustomSelectorModal.tsx +358 -0
- package/src/components/Solution/RuleComponent/CustomPlugin/CustomSelector/function.js +255 -0
- package/src/components/Solution/RuleComponent/CustomPlugin/CustomSelector/helps.tsx +58 -0
- package/src/components/Solution/RuleComponent/CustomPlugin/CustomSelector/index.tsx +129 -0
- package/src/components/Solution/RuleComponent/RenderCompItem.tsx +28 -0
- package/src/components/Solution/RuleComponent/index.js +10 -1
- package/src/components/Solution/RuleComponent/ruleFiled.js +118 -0
- package/src/utils/requestUtils.ts +6 -2
- package/src/utils/utils.ts +22 -0
package/dist/index.js
CHANGED
|
@@ -868,7 +868,10 @@ var handleRequestHeader = function handleRequestHeader(url, options) {
|
|
|
868
868
|
}
|
|
869
869
|
!!!config.headers['x-biz-code'] && handleRequestAuthHeader(config);
|
|
870
870
|
config.headers = _objectSpread2(_objectSpread2({}, commonHeaders), config.headers);
|
|
871
|
-
options
|
|
871
|
+
if (options) {
|
|
872
|
+
options.headers = config.headers;
|
|
873
|
+
}
|
|
874
|
+
return options || config;
|
|
872
875
|
};
|
|
873
876
|
request__default['default'].interceptors.request.use(function (url, options) {
|
|
874
877
|
handleRequestHeader(url, options);
|
|
@@ -1447,6 +1450,21 @@ var randomString = function randomString(len) {
|
|
|
1447
1450
|
var createUniqID = function createUniqID(length) {
|
|
1448
1451
|
return Number(Math.random().toString().substr(3, length) + Date.now()).toString(36);
|
|
1449
1452
|
};
|
|
1453
|
+
// 格式化table响应数据
|
|
1454
|
+
var handleConvertResponse = function handleConvertResponse(items, total) {
|
|
1455
|
+
var result = {
|
|
1456
|
+
list: (items === null || items === void 0 ? void 0 : items.length) && items.map(function (item, index) {
|
|
1457
|
+
return _objectSpread2(_objectSpread2({}, item), {}, {
|
|
1458
|
+
keyIndex: "".concat(index + 1)
|
|
1459
|
+
});
|
|
1460
|
+
}) || [],
|
|
1461
|
+
total: Number(total) || 0
|
|
1462
|
+
};
|
|
1463
|
+
return result;
|
|
1464
|
+
};
|
|
1465
|
+
var noEmptyArray = function noEmptyArray(targetObj) {
|
|
1466
|
+
return Array.isArray(targetObj) && targetObj.length !== 0;
|
|
1467
|
+
};
|
|
1450
1468
|
|
|
1451
1469
|
// 判断某个按钮/菜单 是否有权限,返回布尔值
|
|
1452
1470
|
var authFunc = function authFunc(code) {
|
|
@@ -5786,7 +5804,7 @@ var setInitialShowColumn = function setInitialShowColumn(tableCode, columns, cal
|
|
|
5786
5804
|
* @param arr 要判断的数据
|
|
5787
5805
|
* @returns boolean
|
|
5788
5806
|
*/
|
|
5789
|
-
var noEmptyArray = function noEmptyArray(arr) {
|
|
5807
|
+
var noEmptyArray$1 = function noEmptyArray(arr) {
|
|
5790
5808
|
return Array.isArray(arr) && arr.length > 0;
|
|
5791
5809
|
};
|
|
5792
5810
|
//设置queryTable默认列宽
|
|
@@ -6961,7 +6979,7 @@ var AddSelect = function AddSelect(props) {
|
|
|
6961
6979
|
var indexArrInside = [].concat(_toConsumableArray(indexArr), [index]).filter(function (i) {
|
|
6962
6980
|
return i || i === 0;
|
|
6963
6981
|
});
|
|
6964
|
-
if (noEmptyArray(item.children)) {
|
|
6982
|
+
if (noEmptyArray$1(item.children)) {
|
|
6965
6983
|
_handleColumns(item.children, indexArrInside);
|
|
6966
6984
|
} else {
|
|
6967
6985
|
item.width = item.width || getItemDefaultWidth$2(item);
|
|
@@ -8013,7 +8031,7 @@ var BillEntry = function BillEntry(_ref3) {
|
|
|
8013
8031
|
var indexArrInside = [].concat(_toConsumableArray(indexArr), [index]).filter(function (i) {
|
|
8014
8032
|
return i || i === 0;
|
|
8015
8033
|
});
|
|
8016
|
-
if (noEmptyArray(item.children)) {
|
|
8034
|
+
if (noEmptyArray$1(item.children)) {
|
|
8017
8035
|
_handleColumns(item.children, indexArrInside);
|
|
8018
8036
|
} else {
|
|
8019
8037
|
item.width = item.width || getItemDefaultWidth$2(item);
|
|
@@ -8257,6 +8275,7 @@ var handleDefaultPrefixUrl = function handleDefaultPrefixUrl(type) {
|
|
|
8257
8275
|
break;
|
|
8258
8276
|
case 'deliveryMode':
|
|
8259
8277
|
case 'ruleTemplate':
|
|
8278
|
+
case 'priceItem':
|
|
8260
8279
|
result = '/basic';
|
|
8261
8280
|
break;
|
|
8262
8281
|
default:
|
|
@@ -10637,6 +10656,48 @@ function commonFun(type, prefixUrl, requestConfigProp, modalTableBusProps, hidde
|
|
|
10637
10656
|
}]
|
|
10638
10657
|
}, modalTableBusProps);
|
|
10639
10658
|
}
|
|
10659
|
+
// 价格项选择器
|
|
10660
|
+
if (type === 'priceItem') {
|
|
10661
|
+
requestConfig = _objectSpread2({
|
|
10662
|
+
url: "".concat(prefixUrl.selectPrefix, "/priceType"),
|
|
10663
|
+
filter: 'qp-code,name-orGroup,like',
|
|
10664
|
+
mappingTextField: 'name',
|
|
10665
|
+
mappingTextShowKeyField: 'code',
|
|
10666
|
+
mappingValueField: 'code',
|
|
10667
|
+
otherParams: {
|
|
10668
|
+
'qp-enabled-eq': true,
|
|
10669
|
+
sorter: 'desc-id'
|
|
10670
|
+
},
|
|
10671
|
+
sourceName: 'priceCode'
|
|
10672
|
+
}, requestConfigProp);
|
|
10673
|
+
tableSearchForm = [{
|
|
10674
|
+
name: 'qp-code-like',
|
|
10675
|
+
label: '代码'
|
|
10676
|
+
}, {
|
|
10677
|
+
name: 'qp-name-like',
|
|
10678
|
+
label: '名称'
|
|
10679
|
+
}];
|
|
10680
|
+
modalTableProps = _objectSpread2({
|
|
10681
|
+
modalTableTitle: '选择价格项',
|
|
10682
|
+
tableSearchForm: tableSearchForm,
|
|
10683
|
+
tableColumns: [{
|
|
10684
|
+
title: '代码',
|
|
10685
|
+
dataIndex: 'code'
|
|
10686
|
+
}, {
|
|
10687
|
+
title: '名称',
|
|
10688
|
+
dataIndex: 'name'
|
|
10689
|
+
}, {
|
|
10690
|
+
title: '创建时间',
|
|
10691
|
+
dataIndex: 'createTime',
|
|
10692
|
+
render: function render(text) {
|
|
10693
|
+
return handleTooltip(text, true);
|
|
10694
|
+
}
|
|
10695
|
+
}, {
|
|
10696
|
+
title: '创建人',
|
|
10697
|
+
dataIndex: 'createUserName'
|
|
10698
|
+
}]
|
|
10699
|
+
}, modalTableBusProps);
|
|
10700
|
+
}
|
|
10640
10701
|
return {
|
|
10641
10702
|
modalTableProps: modalTableProps,
|
|
10642
10703
|
requestConfig: requestConfig,
|
|
@@ -13460,7 +13521,7 @@ var ColumnSettingSulaTable = /*#__PURE__*/function (_React$Component) {
|
|
|
13460
13521
|
var indexArrInside = [].concat(_toConsumableArray(indexArr), [index]).filter(function (i) {
|
|
13461
13522
|
return i || i === 0;
|
|
13462
13523
|
});
|
|
13463
|
-
if (noEmptyArray(item.children)) {
|
|
13524
|
+
if (noEmptyArray$1(item.children)) {
|
|
13464
13525
|
_handleColumns(item.children, indexArrInside);
|
|
13465
13526
|
} else {
|
|
13466
13527
|
item.width = item.width || getItemDefaultWidth$2(item);
|
|
@@ -13694,7 +13755,7 @@ var ColumnSettingTable = /*#__PURE__*/function (_React$Component) {
|
|
|
13694
13755
|
var indexArrInside = [].concat(_toConsumableArray(indexArr), [index]).filter(function (i) {
|
|
13695
13756
|
return i || i === 0;
|
|
13696
13757
|
});
|
|
13697
|
-
if (noEmptyArray(item.children)) {
|
|
13758
|
+
if (noEmptyArray$1(item.children)) {
|
|
13698
13759
|
_handleColumns(item.children, indexArrInside);
|
|
13699
13760
|
} else {
|
|
13700
13761
|
item.width = item.width || getItemDefaultWidth$2(item);
|
|
@@ -29493,6 +29554,807 @@ var isObj = function isObj(object) {
|
|
|
29493
29554
|
var dateFormat = 'YYYY-MM-DD';
|
|
29494
29555
|
var fullDateFormat = 'YYYY-MM-DD HH:mm:ss';
|
|
29495
29556
|
|
|
29557
|
+
// 处理表头
|
|
29558
|
+
var getColumnItem = function getColumnItem(_ref) {
|
|
29559
|
+
var item = _ref.item;
|
|
29560
|
+
var ites = {
|
|
29561
|
+
title: item.name,
|
|
29562
|
+
key: item.code,
|
|
29563
|
+
render: function render(_ref2) {
|
|
29564
|
+
var text = _ref2.text,
|
|
29565
|
+
record = _ref2.record;
|
|
29566
|
+
var showText = (record === null || record === void 0 ? void 0 : record["".concat(item.code, "_Name")]) || text;
|
|
29567
|
+
return showText;
|
|
29568
|
+
}
|
|
29569
|
+
};
|
|
29570
|
+
// 处理列展示类型基础数据
|
|
29571
|
+
if (item.choiceType == 20) {
|
|
29572
|
+
// 数据字典
|
|
29573
|
+
var dictionaryCode;
|
|
29574
|
+
try {
|
|
29575
|
+
if (JSON.parse(item.info || '{}').dictionaryCode) {
|
|
29576
|
+
dictionaryCode = JSON.parse(item.info || '{}').dictionaryCode;
|
|
29577
|
+
}
|
|
29578
|
+
} catch (e) {
|
|
29579
|
+
console.log('error', e);
|
|
29580
|
+
}
|
|
29581
|
+
ites.sourceList = dictionaryCode && getDictionarySource(dictionaryCode) || [];
|
|
29582
|
+
}
|
|
29583
|
+
if (item.choiceType == 10) {
|
|
29584
|
+
// 自定义枚举值
|
|
29585
|
+
var enumeration;
|
|
29586
|
+
try {
|
|
29587
|
+
if (JSON.parse(item.info || '{}').enumeration) {
|
|
29588
|
+
enumeration = JSON.parse(item.info || '{}').enumeration;
|
|
29589
|
+
}
|
|
29590
|
+
} catch (e) {
|
|
29591
|
+
console.log('error', e);
|
|
29592
|
+
}
|
|
29593
|
+
ites.sourceList = enumeration && Object.keys(enumeration).map(function (key) {
|
|
29594
|
+
return {
|
|
29595
|
+
value: key,
|
|
29596
|
+
text: enumeration[key]
|
|
29597
|
+
};
|
|
29598
|
+
}) || [];
|
|
29599
|
+
}
|
|
29600
|
+
return ites;
|
|
29601
|
+
};
|
|
29602
|
+
var formatListName = function formatListName(list, columns) {
|
|
29603
|
+
if (!(list === null || list === void 0 ? void 0 : list.length)) return [];
|
|
29604
|
+
if (!(columns === null || columns === void 0 ? void 0 : columns.length)) return list; // 下拉框无需格式化
|
|
29605
|
+
return list.map(function (item) {
|
|
29606
|
+
var resultItem = _objectSpread2({}, item);
|
|
29607
|
+
// 弹窗table编码展示名称
|
|
29608
|
+
var column = columns.filter(function (col) {
|
|
29609
|
+
var _Object$keys, _col$sourceList;
|
|
29610
|
+
return ((_Object$keys = Object.keys(item)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.includes(col.key)) && (col === null || col === void 0 ? void 0 : (_col$sourceList = col.sourceList) === null || _col$sourceList === void 0 ? void 0 : _col$sourceList.length);
|
|
29611
|
+
}) || [];
|
|
29612
|
+
Array.isArray(column) && (column === null || column === void 0 ? void 0 : column.length) && column.forEach(function (element) {
|
|
29613
|
+
if (element === null || element === void 0 ? void 0 : element.sourceList) {
|
|
29614
|
+
var _element$sourceList$f;
|
|
29615
|
+
resultItem["".concat(element.key, "_Name")] = element === null || element === void 0 ? void 0 : (_element$sourceList$f = element.sourceList.find(function (source) {
|
|
29616
|
+
return source.value == item[element.key];
|
|
29617
|
+
})) === null || _element$sourceList$f === void 0 ? void 0 : _element$sourceList$f.text;
|
|
29618
|
+
}
|
|
29619
|
+
});
|
|
29620
|
+
return resultItem;
|
|
29621
|
+
});
|
|
29622
|
+
};
|
|
29623
|
+
|
|
29624
|
+
var _excluded$j = ["sorter"];
|
|
29625
|
+
/**
|
|
29626
|
+
* 删掉查询条件的qp- 和 -eq等
|
|
29627
|
+
* @param {object} data
|
|
29628
|
+
* @return {object}
|
|
29629
|
+
* */
|
|
29630
|
+
function deleteQuerySymbol(data) {
|
|
29631
|
+
var result = {};
|
|
29632
|
+
Object.keys(data).map(function (item) {
|
|
29633
|
+
var newKey = deleteQuerySymbolSingle(item);
|
|
29634
|
+
result[newKey] = data[item];
|
|
29635
|
+
});
|
|
29636
|
+
return result;
|
|
29637
|
+
}
|
|
29638
|
+
function deleteQuerySymbolSingle(key) {
|
|
29639
|
+
return key.replace(/(qp-|-\w+)/g, '');
|
|
29640
|
+
}
|
|
29641
|
+
|
|
29642
|
+
// 把{G1001F1001:123} 换成 {G1001:{F1001: 123}}
|
|
29643
|
+
function convertToMapByKey(data) {
|
|
29644
|
+
var result = {};
|
|
29645
|
+
Object.keys(data).map(function (item) {
|
|
29646
|
+
var groupCode = item.match(/G\d+/);
|
|
29647
|
+
var fieldCode = item.match(/F\d+/);
|
|
29648
|
+
if ((groupCode === null || groupCode === void 0 ? void 0 : groupCode.length) > 0 && (fieldCode === null || fieldCode === void 0 ? void 0 : fieldCode.length) > 0) {
|
|
29649
|
+
if (result[groupCode]) {
|
|
29650
|
+
result[groupCode][fieldCode] = data[item];
|
|
29651
|
+
} else if (!result[groupCode]) {
|
|
29652
|
+
result[groupCode] = _defineProperty({}, fieldCode, data[item]);
|
|
29653
|
+
}
|
|
29654
|
+
}
|
|
29655
|
+
});
|
|
29656
|
+
return result;
|
|
29657
|
+
}
|
|
29658
|
+
|
|
29659
|
+
/**
|
|
29660
|
+
* 去掉查询表格的qp- -eq -in,与普通表格一样的格式
|
|
29661
|
+
* @param{string} prop 键
|
|
29662
|
+
* @param{boolean} flag 是不是查询表格
|
|
29663
|
+
* */
|
|
29664
|
+
function convertProp(prop, flag) {
|
|
29665
|
+
var _prop$replace, _prop$replace$replace, _prop$replace$replace2, _prop$replace$replace3;
|
|
29666
|
+
return flag ? prop === null || prop === void 0 ? void 0 : (_prop$replace = prop.replace(/(G\d+)/, '')) === null || _prop$replace === void 0 ? void 0 : (_prop$replace$replace = _prop$replace.replace('qp-', '')) === null || _prop$replace$replace === void 0 ? void 0 : (_prop$replace$replace2 = _prop$replace$replace.replace('-eq', '')) === null || _prop$replace$replace2 === void 0 ? void 0 : (_prop$replace$replace3 = _prop$replace$replace2.replace('-in', '')) === null || _prop$replace$replace3 === void 0 ? void 0 : _prop$replace$replace3.replace('-like', '') : prop;
|
|
29667
|
+
}
|
|
29668
|
+
// 获取元数据,是表格中列的数据来源
|
|
29669
|
+
function getMetaData(_x) {
|
|
29670
|
+
return _getMetaData.apply(this, arguments);
|
|
29671
|
+
}
|
|
29672
|
+
|
|
29673
|
+
// 获取数据
|
|
29674
|
+
function _getMetaData() {
|
|
29675
|
+
_getMetaData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(id) {
|
|
29676
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
29677
|
+
while (1) switch (_context.prev = _context.next) {
|
|
29678
|
+
case 0:
|
|
29679
|
+
return _context.abrupt("return", new Promise(function (resolve, reject) {
|
|
29680
|
+
umi.request('/basic/entityProperty/listNoPage', {
|
|
29681
|
+
params: {
|
|
29682
|
+
'qp-entityId-eq': id
|
|
29683
|
+
}
|
|
29684
|
+
}).then(function (res) {
|
|
29685
|
+
resolve(res.data);
|
|
29686
|
+
}).catch(function (error) {
|
|
29687
|
+
console.log(error, 'error');
|
|
29688
|
+
reject([]);
|
|
29689
|
+
});
|
|
29690
|
+
}));
|
|
29691
|
+
case 1:
|
|
29692
|
+
case "end":
|
|
29693
|
+
return _context.stop();
|
|
29694
|
+
}
|
|
29695
|
+
}, _callee);
|
|
29696
|
+
}));
|
|
29697
|
+
return _getMetaData.apply(this, arguments);
|
|
29698
|
+
}
|
|
29699
|
+
var remoteFetch = function remoteFetch(requestConfig, coloumns) {
|
|
29700
|
+
return {
|
|
29701
|
+
url: '/basic/function/sendRequest',
|
|
29702
|
+
method: 'post',
|
|
29703
|
+
convertParams: function convertParams(_ref) {
|
|
29704
|
+
var _requestConfig$method;
|
|
29705
|
+
var params = _ref.params;
|
|
29706
|
+
var sorter = params.sorter,
|
|
29707
|
+
paramsTemp = _objectWithoutProperties(params, _excluded$j);
|
|
29708
|
+
var queryParams = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, requestConfig.params), requestConfig.body), ___default['default'].omit(paramsTemp, ['filters', 'current'])), (paramsTemp === null || paramsTemp === void 0 ? void 0 : paramsTemp.filters) || {}), {
|
|
29709
|
+
currentPage: (paramsTemp === null || paramsTemp === void 0 ? void 0 : paramsTemp.currentPage) || paramsTemp.current || 1
|
|
29710
|
+
});
|
|
29711
|
+
|
|
29712
|
+
// 清除值为空的
|
|
29713
|
+
Object.keys(queryParams).forEach(function (itemKey) {
|
|
29714
|
+
if (judgeIsEmpty(queryParams[itemKey])) {
|
|
29715
|
+
delete queryParams[itemKey];
|
|
29716
|
+
}
|
|
29717
|
+
});
|
|
29718
|
+
return {
|
|
29719
|
+
path: requestConfig.url,
|
|
29720
|
+
httpMethod: requestConfig === null || requestConfig === void 0 ? void 0 : (_requestConfig$method = requestConfig.method) === null || _requestConfig$method === void 0 ? void 0 : _requestConfig$method.toUpperCase(),
|
|
29721
|
+
serviceName: requestConfig.serviceName,
|
|
29722
|
+
requestBody: JSON.stringify(queryParams),
|
|
29723
|
+
header: handleRequestHeader().headers
|
|
29724
|
+
};
|
|
29725
|
+
},
|
|
29726
|
+
converter: function converter(_ref2) {
|
|
29727
|
+
var data = _ref2.data;
|
|
29728
|
+
return _objectSpread2({}, handleConvertResponse(handleList(data, coloumns), handleListToTal(data)));
|
|
29729
|
+
}
|
|
29730
|
+
};
|
|
29731
|
+
};
|
|
29732
|
+
function handleList(data, coloumns) {
|
|
29733
|
+
var resultList = Array.isArray(data) ? data : Array.isArray(data === null || data === void 0 ? void 0 : data.list) ? data.list : Array.isArray(data === null || data === void 0 ? void 0 : data.items) ? data.items : [];
|
|
29734
|
+
return formatListName(resultList, coloumns);
|
|
29735
|
+
}
|
|
29736
|
+
function handleListToTal(data) {
|
|
29737
|
+
return Array.isArray(data) ? data.length : data.total || data.totalCount;
|
|
29738
|
+
}
|
|
29739
|
+
|
|
29740
|
+
// 路径
|
|
29741
|
+
function convertPath(path, formData) {
|
|
29742
|
+
var matchedGF = path.match(/G\d+F\d+/g);
|
|
29743
|
+
var matchedJavaCode = path.match(/{\w+\.\w+}/g);
|
|
29744
|
+
var url = path;
|
|
29745
|
+
if (!matchedGF && !matchedJavaCode) return url;
|
|
29746
|
+
if (matchedGF === null || matchedGF === void 0 ? void 0 : matchedGF.length) {
|
|
29747
|
+
matchedGF.map(function (item) {
|
|
29748
|
+
var _formData$group;
|
|
29749
|
+
var group = item.match(/G\d+/);
|
|
29750
|
+
var field = item.match(/F\d+/);
|
|
29751
|
+
var replaceValue = (formData === null || formData === void 0 ? void 0 : (_formData$group = formData[group]) === null || _formData$group === void 0 ? void 0 : _formData$group[field]) || (formData === null || formData === void 0 ? void 0 : formData[field]);
|
|
29752
|
+
url = url.replace(item, replaceValue);
|
|
29753
|
+
});
|
|
29754
|
+
} else if (matchedJavaCode === null || matchedJavaCode === void 0 ? void 0 : matchedJavaCode.length) {
|
|
29755
|
+
matchedJavaCode.map(function (item) {
|
|
29756
|
+
var group, field;
|
|
29757
|
+
try {
|
|
29758
|
+
var val = item.replace(/[{}]/g, '').split('.');
|
|
29759
|
+
group = val[0];
|
|
29760
|
+
field = val[1];
|
|
29761
|
+
} catch (e) {}
|
|
29762
|
+
if (group && field) {
|
|
29763
|
+
var _formData$group2;
|
|
29764
|
+
var replaceValue = (formData === null || formData === void 0 ? void 0 : (_formData$group2 = formData[group]) === null || _formData$group2 === void 0 ? void 0 : _formData$group2[field]) || (formData === null || formData === void 0 ? void 0 : formData[field]);
|
|
29765
|
+
url = url.replace(item, replaceValue);
|
|
29766
|
+
}
|
|
29767
|
+
});
|
|
29768
|
+
}
|
|
29769
|
+
return url;
|
|
29770
|
+
}
|
|
29771
|
+
|
|
29772
|
+
// 组装数据接口请求
|
|
29773
|
+
function assembleRequest(customSelectorConfig, _ref3) {
|
|
29774
|
+
var _customSelectorConfig, _customSelectorConfig2, _customSelectorConfig3;
|
|
29775
|
+
var isSearchForm = _ref3.isSearchForm,
|
|
29776
|
+
newestFormData = _ref3.newestFormData,
|
|
29777
|
+
searchFormData = _ref3.searchFormData;
|
|
29778
|
+
var functionInfo = customSelectorConfig === null || customSelectorConfig === void 0 ? void 0 : (_customSelectorConfig = customSelectorConfig.businessFunction) === null || _customSelectorConfig === void 0 ? void 0 : (_customSelectorConfig2 = _customSelectorConfig.functionInfo) === null || _customSelectorConfig2 === void 0 ? void 0 : (_customSelectorConfig3 = _customSelectorConfig2.actionList) === null || _customSelectorConfig3 === void 0 ? void 0 : _customSelectorConfig3[0];
|
|
29779
|
+
var requestTemplate = functionInfo === null || functionInfo === void 0 ? void 0 : functionInfo.requestTemplate;
|
|
29780
|
+
if (!functionInfo || !requestTemplate) {
|
|
29781
|
+
return false;
|
|
29782
|
+
}
|
|
29783
|
+
var isGet = requestTemplate.method.toLowerCase() === 'get';
|
|
29784
|
+
var requestBodyName = isGet ? 'params' : 'data';
|
|
29785
|
+
var params = requestTemplate.param;
|
|
29786
|
+
try {
|
|
29787
|
+
params = JSON.parse(requestTemplate.param);
|
|
29788
|
+
} catch (e) {}
|
|
29789
|
+
var path = requestTemplate.path;
|
|
29790
|
+
var requestBody = isGet ? params : requestTemplate.requestBody;
|
|
29791
|
+
if (!isSearchForm) {
|
|
29792
|
+
// 非查询表格,普通表格的数据组装
|
|
29793
|
+
path = convertPath(requestTemplate.path, newestFormData);
|
|
29794
|
+
requestBody = convertBody(requestBody, newestFormData);
|
|
29795
|
+
} else if (isSearchForm) {
|
|
29796
|
+
// 查询表格数据组装,key会带有qp- 和 -eq,并且转换成map的数据格式
|
|
29797
|
+
var newSearchFormData = convertToMapByKey(deleteQuerySymbol(searchFormData));
|
|
29798
|
+
path = convertPath(requestTemplate.path, newSearchFormData);
|
|
29799
|
+
requestBody = convertBody(requestBody, newSearchFormData);
|
|
29800
|
+
}
|
|
29801
|
+
var requestConfig = _defineProperty(_defineProperty({
|
|
29802
|
+
url: path,
|
|
29803
|
+
method: requestTemplate.method,
|
|
29804
|
+
headers: requestTemplate.header
|
|
29805
|
+
}, requestBodyName, requestBody), "serviceName", functionInfo.serviceName || (requestTemplate === null || requestTemplate === void 0 ? void 0 : requestTemplate.serviceName));
|
|
29806
|
+
return requestConfig;
|
|
29807
|
+
}
|
|
29808
|
+
|
|
29809
|
+
// 请求体
|
|
29810
|
+
function convertBody(param, formData) {
|
|
29811
|
+
var keys = Object.keys(param || {});
|
|
29812
|
+
if (!keys.length) return {};
|
|
29813
|
+
var result = {};
|
|
29814
|
+
keys.map(function (key) {
|
|
29815
|
+
var _param$key$match, _param$key$match2;
|
|
29816
|
+
var matchedGF = (_param$key$match = param[key].match(/G\d+F\d+/)) === null || _param$key$match === void 0 ? void 0 : _param$key$match[0];
|
|
29817
|
+
var matchedJavaCode = (_param$key$match2 = param[key].match(/{\w+\.\w+}/)) === null || _param$key$match2 === void 0 ? void 0 : _param$key$match2[0];
|
|
29818
|
+
if (matchedGF) {
|
|
29819
|
+
var _formData$group3;
|
|
29820
|
+
var group = matchedGF.match(/G\d+/);
|
|
29821
|
+
var field = matchedGF.match(/F\d+/);
|
|
29822
|
+
// 有值才赋值 【当formData中的值key是GxxxFxxx形式时】
|
|
29823
|
+
if ((formData === null || formData === void 0 ? void 0 : (_formData$group3 = formData[group]) === null || _formData$group3 === void 0 ? void 0 : _formData$group3[field]) && formData[group][field] !== '') {
|
|
29824
|
+
if (Array.isArray(formData[group][field])) {
|
|
29825
|
+
result[key] = formData[group][field].join(',');
|
|
29826
|
+
} else {
|
|
29827
|
+
result[key] = formData[group][field];
|
|
29828
|
+
}
|
|
29829
|
+
}
|
|
29830
|
+
// 有值才赋值 【当formData中的值key是Fxxx形式时】
|
|
29831
|
+
if ((formData === null || formData === void 0 ? void 0 : formData[field]) && formData[field] !== '') {
|
|
29832
|
+
if (Array.isArray(formData[field])) {
|
|
29833
|
+
result[key] = formData[field].join(',');
|
|
29834
|
+
} else {
|
|
29835
|
+
result[key] = formData[field];
|
|
29836
|
+
}
|
|
29837
|
+
}
|
|
29838
|
+
} else if (matchedJavaCode) {
|
|
29839
|
+
var _formData$_group;
|
|
29840
|
+
var _group, _field;
|
|
29841
|
+
try {
|
|
29842
|
+
var _matchedJavaCode$repl = matchedJavaCode.replace(/[{}]/g).split('.');
|
|
29843
|
+
var _matchedJavaCode$repl2 = _slicedToArray(_matchedJavaCode$repl, 2);
|
|
29844
|
+
_group = _matchedJavaCode$repl2[0];
|
|
29845
|
+
_field = _matchedJavaCode$repl2[1];
|
|
29846
|
+
} catch (e) {}
|
|
29847
|
+
if ((formData === null || formData === void 0 ? void 0 : (_formData$_group = formData[_group]) === null || _formData$_group === void 0 ? void 0 : _formData$_group[_field]) && formData[_group][_field] !== '') {
|
|
29848
|
+
if (Array.isArray(formData[_group][_field])) {
|
|
29849
|
+
result[key] = formData[_group][_field].join(',');
|
|
29850
|
+
} else {
|
|
29851
|
+
result[key] = formData[_group][_field];
|
|
29852
|
+
}
|
|
29853
|
+
}
|
|
29854
|
+
} else {
|
|
29855
|
+
if (param[key] !== '') {
|
|
29856
|
+
result[key] = param[key];
|
|
29857
|
+
}
|
|
29858
|
+
}
|
|
29859
|
+
});
|
|
29860
|
+
return result;
|
|
29861
|
+
}
|
|
29862
|
+
|
|
29863
|
+
var CustomSelectorModal = /*#__PURE__*/React$1.forwardRef(function (props, ref) {
|
|
29864
|
+
var _props$ctx, _props$ctx2, _props$ctx2$form, _Object$keys, _Object$keys2, _props$ctx3, _props$customSelector3, _props$customSelector4, _props$customSelector5, _ref3, _fieldMappingItem$cod, _props$selectProps4;
|
|
29865
|
+
React$1.useImperativeHandle(ref, function () {
|
|
29866
|
+
return {
|
|
29867
|
+
handleOk: handleOk,
|
|
29868
|
+
refreshSelectSource: refreshSelectSource
|
|
29869
|
+
};
|
|
29870
|
+
});
|
|
29871
|
+
var prop = convertProp(props === null || props === void 0 ? void 0 : (_props$ctx = props.ctx) === null || _props$ctx === void 0 ? void 0 : _props$ctx.name, props.isSearchForm);
|
|
29872
|
+
var newFormData = (props === null || props === void 0 ? void 0 : (_props$ctx2 = props.ctx) === null || _props$ctx2 === void 0 ? void 0 : (_props$ctx2$form = _props$ctx2.form) === null || _props$ctx2$form === void 0 ? void 0 : _props$ctx2$form.getFieldsValue()) || {};
|
|
29873
|
+
var newestFormData = newFormData && ((_Object$keys = Object.keys(newFormData)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.length) ? newFormData : (props === null || props === void 0 ? void 0 : props.formData) || {}; // 最新的formData,用来下面监听最新值的改变,做级联效果
|
|
29874
|
+
var searchFormData = newFormData && ((_Object$keys2 = Object.keys(newFormData)) === null || _Object$keys2 === void 0 ? void 0 : _Object$keys2.length) ? newFormData : (props === null || props === void 0 ? void 0 : props.formData) || {}; // 如果是表格上面的查询表单情况
|
|
29875
|
+
var isView = (props === null || props === void 0 ? void 0 : (_props$ctx3 = props.ctx) === null || _props$ctx3 === void 0 ? void 0 : _props$ctx3.mode) == 'view';
|
|
29876
|
+
var queryTableRef = React$1.useRef(null);
|
|
29877
|
+
var _useState = React$1.useState({}),
|
|
29878
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
29879
|
+
requestConfig = _useState2[0],
|
|
29880
|
+
setRequestConfig = _useState2[1];
|
|
29881
|
+
var _useState3 = React$1.useState({
|
|
29882
|
+
pages: {
|
|
29883
|
+
page: 1,
|
|
29884
|
+
limit: 20,
|
|
29885
|
+
total: 0
|
|
29886
|
+
},
|
|
29887
|
+
columns: [],
|
|
29888
|
+
fields: [],
|
|
29889
|
+
dataList: [],
|
|
29890
|
+
currentQuery: {},
|
|
29891
|
+
selectedLine: {}
|
|
29892
|
+
}),
|
|
29893
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
29894
|
+
tableState = _useState4[0],
|
|
29895
|
+
setTableState = _useState4[1];
|
|
29896
|
+
var handleOpen = /*#__PURE__*/function () {
|
|
29897
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
29898
|
+
var _props$customSelector, _props$customSelector2, _props$ctx4, _props$value, _props$value$map, _props$ctx5, _props$ctx5$form, _props$selectProps;
|
|
29899
|
+
var requestConfigNew, metaDataId, metaData, realMetaData, columns, fields, initValue, _queryTableRef$curren, _queryTableRef$curren2, _queryTableRef$curren3;
|
|
29900
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
29901
|
+
while (1) switch (_context.prev = _context.next) {
|
|
29902
|
+
case 0:
|
|
29903
|
+
requestConfigNew = assembleRequest(props.customSelectorConfig, {
|
|
29904
|
+
isSearchForm: props.isSearchForm,
|
|
29905
|
+
newestFormData: newestFormData,
|
|
29906
|
+
searchFormData: searchFormData
|
|
29907
|
+
});
|
|
29908
|
+
if (requestConfigNew) {
|
|
29909
|
+
_context.next = 3;
|
|
29910
|
+
break;
|
|
29911
|
+
}
|
|
29912
|
+
return _context.abrupt("return");
|
|
29913
|
+
case 3:
|
|
29914
|
+
metaDataId = (_props$customSelector = props.customSelectorConfig) === null || _props$customSelector === void 0 ? void 0 : (_props$customSelector2 = _props$customSelector.targetMetaData) === null || _props$customSelector2 === void 0 ? void 0 : _props$customSelector2.id;
|
|
29915
|
+
_context.next = 6;
|
|
29916
|
+
return getMetaData(metaDataId);
|
|
29917
|
+
case 6:
|
|
29918
|
+
metaData = _context.sent;
|
|
29919
|
+
realMetaData = (metaData === null || metaData === void 0 ? void 0 : metaData.filter(function (item) {
|
|
29920
|
+
return (item === null || item === void 0 ? void 0 : item.inputType) != 1;
|
|
29921
|
+
})) || [];
|
|
29922
|
+
columns = realMetaData.map(function (item) {
|
|
29923
|
+
return getColumnItem({
|
|
29924
|
+
item: item,
|
|
29925
|
+
props: props
|
|
29926
|
+
});
|
|
29927
|
+
}); // tableState.columns = columns
|
|
29928
|
+
fields = realMetaData === null || realMetaData === void 0 ? void 0 : realMetaData.filter(function (item) {
|
|
29929
|
+
var _item$infoVo;
|
|
29930
|
+
return (_item$infoVo = item.infoVo) === null || _item$infoVo === void 0 ? void 0 : _item$infoVo.isQuery;
|
|
29931
|
+
}).map(function (item) {
|
|
29932
|
+
var name = "qp-".concat(item.code, "-eq");
|
|
29933
|
+
try {
|
|
29934
|
+
if (JSON.parse(item.info).isLikeQuery) {
|
|
29935
|
+
name = "qp-".concat(item.code, "-like");
|
|
29936
|
+
}
|
|
29937
|
+
} catch (e) {
|
|
29938
|
+
console.log('error', e);
|
|
29939
|
+
}
|
|
29940
|
+
return {
|
|
29941
|
+
name: name,
|
|
29942
|
+
label: item.name,
|
|
29943
|
+
field: 'input'
|
|
29944
|
+
};
|
|
29945
|
+
});
|
|
29946
|
+
setTableState(_objectSpread2(_objectSpread2({}, tableState), {}, {
|
|
29947
|
+
columns: columns,
|
|
29948
|
+
fields: fields
|
|
29949
|
+
}));
|
|
29950
|
+
setRequestConfig(requestConfigNew);
|
|
29951
|
+
initValue = !(props === null || props === void 0 ? void 0 : (_props$ctx4 = props.ctx) === null || _props$ctx4 === void 0 ? void 0 : _props$ctx4.form) && (props === null || props === void 0 ? void 0 : (_props$value = props.value) === null || _props$value === void 0 ? void 0 : (_props$value$map = _props$value.map) === null || _props$value$map === void 0 ? void 0 : _props$value$map.call(_props$value, function (v) {
|
|
29952
|
+
return v.key || v;
|
|
29953
|
+
})) || (props === null || props === void 0 ? void 0 : (_props$ctx5 = props.ctx) === null || _props$ctx5 === void 0 ? void 0 : (_props$ctx5$form = _props$ctx5.form) === null || _props$ctx5$form === void 0 ? void 0 : _props$ctx5$form.getFieldValue(props.id));
|
|
29954
|
+
if ((props === null || props === void 0 ? void 0 : (_props$selectProps = props.selectProps) === null || _props$selectProps === void 0 ? void 0 : _props$selectProps.multipleForQuery) && !isView && initValue) {
|
|
29955
|
+
// @ts-ignore
|
|
29956
|
+
queryTableRef === null || queryTableRef === void 0 ? void 0 : (_queryTableRef$curren = queryTableRef.current) === null || _queryTableRef$curren === void 0 ? void 0 : (_queryTableRef$curren2 = _queryTableRef$curren.tableRef) === null || _queryTableRef$curren2 === void 0 ? void 0 : (_queryTableRef$curren3 = _queryTableRef$curren2.current) === null || _queryTableRef$curren3 === void 0 ? void 0 : _queryTableRef$curren3.bsSetSelectInfo(initValue);
|
|
29957
|
+
}
|
|
29958
|
+
case 14:
|
|
29959
|
+
case "end":
|
|
29960
|
+
return _context.stop();
|
|
29961
|
+
}
|
|
29962
|
+
}, _callee);
|
|
29963
|
+
}));
|
|
29964
|
+
return function handleOpen() {
|
|
29965
|
+
return _ref.apply(this, arguments);
|
|
29966
|
+
};
|
|
29967
|
+
}();
|
|
29968
|
+
var fieldMapping = ((_props$customSelector3 = props.customSelectorConfig) === null || _props$customSelector3 === void 0 ? void 0 : _props$customSelector3.fieldMapping) || [];
|
|
29969
|
+
var fieldMappingItem = fieldMapping.find(function (item) {
|
|
29970
|
+
return item.codeMappingTo === prop;
|
|
29971
|
+
});
|
|
29972
|
+
var echoLabel = (_props$customSelector4 = props.customSelectorConfig) === null || _props$customSelector4 === void 0 ? void 0 : (_props$customSelector5 = _props$customSelector4.extraData) === null || _props$customSelector5 === void 0 ? void 0 : _props$customSelector5.echoLabel;
|
|
29973
|
+
//初始获取下拉列表
|
|
29974
|
+
var fetchFieldSource = function fetchFieldSource(obj, init) {
|
|
29975
|
+
var _params$path;
|
|
29976
|
+
var url = obj.url,
|
|
29977
|
+
method = obj.method,
|
|
29978
|
+
convertParams = obj.convertParams,
|
|
29979
|
+
converter = obj.converter;
|
|
29980
|
+
var params = convertParams({
|
|
29981
|
+
params: _objectSpread2({
|
|
29982
|
+
pageSize: 20,
|
|
29983
|
+
currentPage: 1
|
|
29984
|
+
}, init)
|
|
29985
|
+
});
|
|
29986
|
+
// 容错处理
|
|
29987
|
+
if (!(params === null || params === void 0 ? void 0 : params.path) || (params === null || params === void 0 ? void 0 : (_params$path = params.path) === null || _params$path === void 0 ? void 0 : _params$path.indexOf('undefined')) > -1) return;
|
|
29988
|
+
bssula.request({
|
|
29989
|
+
url: url,
|
|
29990
|
+
method: method,
|
|
29991
|
+
params: params
|
|
29992
|
+
}).then(function (res) {
|
|
29993
|
+
var _converter = converter({
|
|
29994
|
+
data: res
|
|
29995
|
+
}),
|
|
29996
|
+
list = _converter.list;
|
|
29997
|
+
var currentField = fieldMappingItem;
|
|
29998
|
+
var sourceList = [];
|
|
29999
|
+
var codeList = [];
|
|
30000
|
+
var options = list.map(function (item) {
|
|
30001
|
+
if (currentField && echoLabel) {
|
|
30002
|
+
return {
|
|
30003
|
+
label: item[echoLabel],
|
|
30004
|
+
value: item[currentField.codeMappingFrom]
|
|
30005
|
+
};
|
|
30006
|
+
}
|
|
30007
|
+
if (echoLabel && !currentField) {
|
|
30008
|
+
return {
|
|
30009
|
+
label: item[echoLabel],
|
|
30010
|
+
value: item[echoLabel]
|
|
30011
|
+
};
|
|
30012
|
+
}
|
|
30013
|
+
return {
|
|
30014
|
+
label: item[currentField.codeMappingTo],
|
|
30015
|
+
value: item[currentField.codeMappingTo]
|
|
30016
|
+
};
|
|
30017
|
+
});
|
|
30018
|
+
options.forEach(function (item) {
|
|
30019
|
+
if (!codeList.includes(item.value)) {
|
|
30020
|
+
codeList.push(item.value);
|
|
30021
|
+
sourceList.push(item);
|
|
30022
|
+
}
|
|
30023
|
+
});
|
|
30024
|
+
props.setFieldSource(sourceList);
|
|
30025
|
+
props.setAllListData(list || []);
|
|
30026
|
+
});
|
|
30027
|
+
};
|
|
30028
|
+
React$1.useEffect(function () {
|
|
30029
|
+
if (props.visible) {
|
|
30030
|
+
handleOpen();
|
|
30031
|
+
}
|
|
30032
|
+
}, [props.visible]);
|
|
30033
|
+
var refreshSelectSource = function refreshSelectSource() {
|
|
30034
|
+
var init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
30035
|
+
var requestConfigNew = assembleRequest(props.customSelectorConfig, {
|
|
30036
|
+
isSearchForm: props.isSearchForm,
|
|
30037
|
+
newestFormData: newestFormData,
|
|
30038
|
+
searchFormData: searchFormData
|
|
30039
|
+
});
|
|
30040
|
+
var obj = remoteFetch(requestConfigNew);
|
|
30041
|
+
//初始化请求下拉列表
|
|
30042
|
+
fetchFieldSource(obj, init);
|
|
30043
|
+
};
|
|
30044
|
+
React$1.useEffect(function () {
|
|
30045
|
+
var _props$ctx6, _props$ctx7, _props$ctx7$form;
|
|
30046
|
+
var isNeedBack = (props === null || props === void 0 ? void 0 : (_props$ctx6 = props.ctx) === null || _props$ctx6 === void 0 ? void 0 : _props$ctx6.mode) != 'create' || props.disabled;
|
|
30047
|
+
var initValue = props === null || props === void 0 ? void 0 : (_props$ctx7 = props.ctx) === null || _props$ctx7 === void 0 ? void 0 : (_props$ctx7$form = _props$ctx7.form) === null || _props$ctx7$form === void 0 ? void 0 : _props$ctx7$form.getFieldValue(props.id);
|
|
30048
|
+
var formCodeKey = "".concat(fieldMappingItem === null || fieldMappingItem === void 0 ? void 0 : fieldMappingItem.codeMappingFrom);
|
|
30049
|
+
var initKey = Array.isArray(initValue) && (initValue === null || initValue === void 0 ? void 0 : initValue.length) > 1 ? "qp-".concat(formCodeKey, "-in") : "qp-".concat(formCodeKey, "-eq");
|
|
30050
|
+
var initParams = isNeedBack && formCodeKey && initValue ? _defineProperty({}, initKey, Array.isArray(initValue) ? initValue.join(',') : initValue) : {};
|
|
30051
|
+
refreshSelectSource(null, initParams);
|
|
30052
|
+
}, []);
|
|
30053
|
+
var remoteDataSource = React$1.useMemo(function () {
|
|
30054
|
+
if (Object.keys(requestConfig).length) {
|
|
30055
|
+
var obj = remoteFetch(requestConfig, tableState.columns);
|
|
30056
|
+
return obj;
|
|
30057
|
+
} else {
|
|
30058
|
+
return {};
|
|
30059
|
+
}
|
|
30060
|
+
}, [requestConfig, tableState.columns]);
|
|
30061
|
+
var rowKey = (_ref3 = (_fieldMappingItem$cod = fieldMappingItem === null || fieldMappingItem === void 0 ? void 0 : fieldMappingItem.codeMappingFrom) !== null && _fieldMappingItem$cod !== void 0 ? _fieldMappingItem$cod : 'id') !== null && _ref3 !== void 0 ? _ref3 : 'code';
|
|
30062
|
+
var handleOk = function handleOk(rowData) {
|
|
30063
|
+
var _props$selectProps2, _props$customSelector6, _props$customSelector7, _queryTableRef$curren13, _queryTableRef$curren14, _queryTableRef$curren15;
|
|
30064
|
+
var setSource = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
30065
|
+
//多选数据处理
|
|
30066
|
+
if (props === null || props === void 0 ? void 0 : (_props$selectProps2 = props.selectProps) === null || _props$selectProps2 === void 0 ? void 0 : _props$selectProps2.multipleForQuery) {
|
|
30067
|
+
var _queryTableRef$curren4, _queryTableRef$curren5, _queryTableRef$curren6, _queryTableRef$curren7, _queryTableRef$curren8, _queryTableRef$curren9;
|
|
30068
|
+
// @ts-ignore
|
|
30069
|
+
var selectedKesys = (queryTableRef === null || queryTableRef === void 0 ? void 0 : (_queryTableRef$curren4 = queryTableRef.current) === null || _queryTableRef$curren4 === void 0 ? void 0 : (_queryTableRef$curren5 = _queryTableRef$curren4.tableRef) === null || _queryTableRef$curren5 === void 0 ? void 0 : (_queryTableRef$curren6 = _queryTableRef$curren5.current) === null || _queryTableRef$curren6 === void 0 ? void 0 : _queryTableRef$curren6.getSelectedRowKeys()) || [];
|
|
30070
|
+
// @ts-ignore
|
|
30071
|
+
var selectedRows = (queryTableRef === null || queryTableRef === void 0 ? void 0 : (_queryTableRef$curren7 = queryTableRef.current) === null || _queryTableRef$curren7 === void 0 ? void 0 : (_queryTableRef$curren8 = _queryTableRef$curren7.tableRef) === null || _queryTableRef$curren8 === void 0 ? void 0 : (_queryTableRef$curren9 = _queryTableRef$curren8.current) === null || _queryTableRef$curren9 === void 0 ? void 0 : _queryTableRef$curren9.getSelectedRows()) || [];
|
|
30072
|
+
var realSelectedRows = selectedRows;
|
|
30073
|
+
if (!rowData && (selectedKesys === null || selectedKesys === void 0 ? void 0 : selectedKesys.length) !== (selectedRows === null || selectedRows === void 0 ? void 0 : selectedRows.length)) {
|
|
30074
|
+
var _queryTableRef$curren10, _queryTableRef$curren11, _queryTableRef$curren12;
|
|
30075
|
+
// @ts-ignore
|
|
30076
|
+
var dataSource = (queryTableRef === null || queryTableRef === void 0 ? void 0 : (_queryTableRef$curren10 = queryTableRef.current) === null || _queryTableRef$curren10 === void 0 ? void 0 : (_queryTableRef$curren11 = _queryTableRef$curren10.tableRef) === null || _queryTableRef$curren11 === void 0 ? void 0 : (_queryTableRef$curren12 = _queryTableRef$curren11.current) === null || _queryTableRef$curren12 === void 0 ? void 0 : _queryTableRef$curren12.getDataSource()) || [];
|
|
30077
|
+
realSelectedRows = dataSource === null || dataSource === void 0 ? void 0 : dataSource.filter(function (s) {
|
|
30078
|
+
return selectedKesys.includes(s[rowKey]);
|
|
30079
|
+
});
|
|
30080
|
+
}
|
|
30081
|
+
//@ts-ignore
|
|
30082
|
+
var rowDataList = rowData ? rowData : realSelectedRows;
|
|
30083
|
+
var rowDataTemp = {};
|
|
30084
|
+
rowDataList.forEach(function (item, index) {
|
|
30085
|
+
Object.keys(item).forEach(function (key) {
|
|
30086
|
+
if (!Reflect.has(rowDataTemp, key)) {
|
|
30087
|
+
rowDataTemp[key] = [item[key]];
|
|
30088
|
+
} else {
|
|
30089
|
+
rowDataTemp[key].push(item[key]);
|
|
30090
|
+
//数组去重
|
|
30091
|
+
rowDataTemp[key] = _toConsumableArray(new Set(rowDataTemp[key]));
|
|
30092
|
+
}
|
|
30093
|
+
});
|
|
30094
|
+
});
|
|
30095
|
+
rowData = rowDataTemp;
|
|
30096
|
+
}
|
|
30097
|
+
var mappings = props.customSelectorConfig.fieldMapping;
|
|
30098
|
+
var values = {};
|
|
30099
|
+
//没有映射且有echoLabel的话,默认塞入一条
|
|
30100
|
+
if ((!mappings || Array.isArray(mappings) && !mappings.length) && ((_props$customSelector6 = props.customSelectorConfig) === null || _props$customSelector6 === void 0 ? void 0 : (_props$customSelector7 = _props$customSelector6.extraData) === null || _props$customSelector7 === void 0 ? void 0 : _props$customSelector7.echoLabel)) {
|
|
30101
|
+
var _props$customSelector8, _props$customSelector9;
|
|
30102
|
+
mappings.push({
|
|
30103
|
+
codeMappingFrom: (_props$customSelector8 = props.customSelectorConfig) === null || _props$customSelector8 === void 0 ? void 0 : (_props$customSelector9 = _props$customSelector8.extraData) === null || _props$customSelector9 === void 0 ? void 0 : _props$customSelector9.echoLabel,
|
|
30104
|
+
codeMappingTo: prop,
|
|
30105
|
+
uuid: ''
|
|
30106
|
+
});
|
|
30107
|
+
}
|
|
30108
|
+
mappings.map(function (item) {
|
|
30109
|
+
var _props$customSelector10, _props$customSelector11, _props$customSelector12, _props$customSelector13;
|
|
30110
|
+
if (((_props$customSelector10 = props.customSelectorConfig) === null || _props$customSelector10 === void 0 ? void 0 : (_props$customSelector11 = _props$customSelector10.extraData) === null || _props$customSelector11 === void 0 ? void 0 : _props$customSelector11.echoLabel) && item.codeMappingTo === prop && rowData[(_props$customSelector12 = props.customSelectorConfig) === null || _props$customSelector12 === void 0 ? void 0 : (_props$customSelector13 = _props$customSelector12.extraData) === null || _props$customSelector13 === void 0 ? void 0 : _props$customSelector13.echoLabel]) {
|
|
30111
|
+
var _props$customSelector14, _props$customSelector15;
|
|
30112
|
+
values["".concat(item.codeMappingTo, "Name")] = rowData[(_props$customSelector14 = props.customSelectorConfig) === null || _props$customSelector14 === void 0 ? void 0 : (_props$customSelector15 = _props$customSelector14.extraData) === null || _props$customSelector15 === void 0 ? void 0 : _props$customSelector15.echoLabel];
|
|
30113
|
+
}
|
|
30114
|
+
values[item.codeMappingTo] = rowData[item.codeMappingFrom];
|
|
30115
|
+
});
|
|
30116
|
+
// 表单查询项就不给其他字段赋值
|
|
30117
|
+
if (!props.isSearchForm) {
|
|
30118
|
+
Object.keys(values).map(function (key, index, list) {
|
|
30119
|
+
if (key.includes('Name')) {
|
|
30120
|
+
var valueKey = key.replace('Name', '');
|
|
30121
|
+
if (setSource) {
|
|
30122
|
+
if (Array.isArray(values[valueKey])) {
|
|
30123
|
+
var valueList = [];
|
|
30124
|
+
values[valueKey].forEach(function (item, index) {
|
|
30125
|
+
valueList.push({
|
|
30126
|
+
label: values[key][index],
|
|
30127
|
+
value: values[valueKey][index]
|
|
30128
|
+
});
|
|
30129
|
+
});
|
|
30130
|
+
props.setFieldSource(valueList);
|
|
30131
|
+
} else {
|
|
30132
|
+
props.setFieldSource([{
|
|
30133
|
+
label: values[key],
|
|
30134
|
+
value: values[valueKey]
|
|
30135
|
+
}]);
|
|
30136
|
+
}
|
|
30137
|
+
}
|
|
30138
|
+
} else {
|
|
30139
|
+
var _props$setFieldValue;
|
|
30140
|
+
props === null || props === void 0 ? void 0 : (_props$setFieldValue = props.setFieldValue) === null || _props$setFieldValue === void 0 ? void 0 : _props$setFieldValue.call(props, key, values[key]);
|
|
30141
|
+
}
|
|
30142
|
+
});
|
|
30143
|
+
} else {
|
|
30144
|
+
var _props$ctx8;
|
|
30145
|
+
if (setSource) {
|
|
30146
|
+
if (Array.isArray(values[prop])) {
|
|
30147
|
+
var valueList = [];
|
|
30148
|
+
values[prop].forEach(function (item, index) {
|
|
30149
|
+
valueList.push({
|
|
30150
|
+
label: values["".concat(prop, "Name")][index],
|
|
30151
|
+
value: values[prop][index]
|
|
30152
|
+
});
|
|
30153
|
+
});
|
|
30154
|
+
props.setFieldSource(valueList);
|
|
30155
|
+
} else {
|
|
30156
|
+
props.setFieldSource([{
|
|
30157
|
+
label: values["".concat(prop, "Name")],
|
|
30158
|
+
value: values[prop]
|
|
30159
|
+
}]);
|
|
30160
|
+
}
|
|
30161
|
+
}
|
|
30162
|
+
var fieldKey = (props === null || props === void 0 ? void 0 : (_props$ctx8 = props.ctx) === null || _props$ctx8 === void 0 ? void 0 : _props$ctx8.name) || prop;
|
|
30163
|
+
props.setFieldValue(fieldKey, values[prop], props.fieldSource);
|
|
30164
|
+
}
|
|
30165
|
+
props.onCancel();
|
|
30166
|
+
//@ts-ignore
|
|
30167
|
+
queryTableRef === null || queryTableRef === void 0 ? void 0 : (_queryTableRef$curren13 = queryTableRef.current) === null || _queryTableRef$curren13 === void 0 ? void 0 : (_queryTableRef$curren14 = _queryTableRef$curren13.tableRef) === null || _queryTableRef$curren14 === void 0 ? void 0 : (_queryTableRef$curren15 = _queryTableRef$curren14.current) === null || _queryTableRef$curren15 === void 0 ? void 0 : _queryTableRef$curren15.clearRowSelection();
|
|
30168
|
+
};
|
|
30169
|
+
var config = React$1.useMemo(function () {
|
|
30170
|
+
var _props$selectProps3, _props$ctx9, _props$value2, _props$ctx10, _props$ctx10$form;
|
|
30171
|
+
var returnConfig = {
|
|
30172
|
+
size: 'small',
|
|
30173
|
+
needPageHeader: false,
|
|
30174
|
+
tableWrapperStyle: {},
|
|
30175
|
+
isHorizontally: false,
|
|
30176
|
+
rowSelection: (props === null || props === void 0 ? void 0 : (_props$selectProps3 = props.selectProps) === null || _props$selectProps3 === void 0 ? void 0 : _props$selectProps3.multipleForQuery) && !isView ? {
|
|
30177
|
+
selectedRowKeys: !(props === null || props === void 0 ? void 0 : (_props$ctx9 = props.ctx) === null || _props$ctx9 === void 0 ? void 0 : _props$ctx9.form) && (props === null || props === void 0 ? void 0 : (_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.map(function (v) {
|
|
30178
|
+
return v.key || v;
|
|
30179
|
+
})) || (props === null || props === void 0 ? void 0 : (_props$ctx10 = props.ctx) === null || _props$ctx10 === void 0 ? void 0 : (_props$ctx10$form = _props$ctx10.form) === null || _props$ctx10$form === void 0 ? void 0 : _props$ctx10$form.getFieldValue(props.id))
|
|
30180
|
+
} : false,
|
|
30181
|
+
remoteDataSource: remoteDataSource,
|
|
30182
|
+
fields: tableState.fields,
|
|
30183
|
+
columns: tableState.columns,
|
|
30184
|
+
rowKey: rowKey,
|
|
30185
|
+
tableProps: !isView && {
|
|
30186
|
+
rowClassName: function rowClassName(record) {
|
|
30187
|
+
var _props$ctx11, _props$value3, _props$ctx12, _props$ctx12$form;
|
|
30188
|
+
return record[rowKey] == (!(props === null || props === void 0 ? void 0 : (_props$ctx11 = props.ctx) === null || _props$ctx11 === void 0 ? void 0 : _props$ctx11.form) && ((props === null || props === void 0 ? void 0 : (_props$value3 = props.value) === null || _props$value3 === void 0 ? void 0 : _props$value3.key) || (props === null || props === void 0 ? void 0 : props.value)) || (props === null || props === void 0 ? void 0 : (_props$ctx12 = props.ctx) === null || _props$ctx12 === void 0 ? void 0 : (_props$ctx12$form = _props$ctx12.form) === null || _props$ctx12$form === void 0 ? void 0 : _props$ctx12$form.getFieldValue(props.id))) ? 'tableSelectedRow' : '';
|
|
30189
|
+
},
|
|
30190
|
+
onRow: function onRow(record) {
|
|
30191
|
+
return {
|
|
30192
|
+
onDoubleClick: function onDoubleClick() {
|
|
30193
|
+
handleOk(record);
|
|
30194
|
+
} //双击
|
|
30195
|
+
};
|
|
30196
|
+
}
|
|
30197
|
+
} || {}
|
|
30198
|
+
};
|
|
30199
|
+
if (Object.keys(remoteDataSource).length) {
|
|
30200
|
+
return returnConfig;
|
|
30201
|
+
} else {
|
|
30202
|
+
return false;
|
|
30203
|
+
}
|
|
30204
|
+
}, [tableState, remoteDataSource]);
|
|
30205
|
+
return /*#__PURE__*/React__default['default'].createElement(antd.Modal, {
|
|
30206
|
+
title: "",
|
|
30207
|
+
width: 1300,
|
|
30208
|
+
open: props.visible,
|
|
30209
|
+
footer: null,
|
|
30210
|
+
onCancel: function onCancel() {
|
|
30211
|
+
props.onCancel();
|
|
30212
|
+
},
|
|
30213
|
+
destroyOnClose: true
|
|
30214
|
+
}, config && /*#__PURE__*/React__default['default'].createElement(bssula.QueryTable, _objectSpread2({
|
|
30215
|
+
ref: queryTableRef
|
|
30216
|
+
}, config)), (props === null || props === void 0 ? void 0 : (_props$selectProps4 = props.selectProps) === null || _props$selectProps4 === void 0 ? void 0 : _props$selectProps4.multipleForQuery) && !isView && ( /*#__PURE__*/React__default['default'].createElement(antd.Row, {
|
|
30217
|
+
justify: "center",
|
|
30218
|
+
style: {
|
|
30219
|
+
marginBottom: 30,
|
|
30220
|
+
marginTop: 10
|
|
30221
|
+
}
|
|
30222
|
+
}, /*#__PURE__*/React__default['default'].createElement(antd.Button, {
|
|
30223
|
+
type: "primary",
|
|
30224
|
+
style: {
|
|
30225
|
+
marginRight: 20
|
|
30226
|
+
},
|
|
30227
|
+
onClick: function onClick() {
|
|
30228
|
+
return handleOk();
|
|
30229
|
+
}
|
|
30230
|
+
}, "\u63D0\u4EA4"), /*#__PURE__*/React__default['default'].createElement(antd.Button, {
|
|
30231
|
+
type: "default",
|
|
30232
|
+
onClick: function onClick() {
|
|
30233
|
+
var _queryTableRef$curren16, _queryTableRef$curren17, _queryTableRef$curren18;
|
|
30234
|
+
props.onCancel();
|
|
30235
|
+
//@ts-ignore
|
|
30236
|
+
queryTableRef === null || queryTableRef === void 0 ? void 0 : (_queryTableRef$curren16 = queryTableRef.current) === null || _queryTableRef$curren16 === void 0 ? void 0 : (_queryTableRef$curren17 = _queryTableRef$curren16.tableRef) === null || _queryTableRef$curren17 === void 0 ? void 0 : (_queryTableRef$curren18 = _queryTableRef$curren17.current) === null || _queryTableRef$curren18 === void 0 ? void 0 : _queryTableRef$curren18.clearRowSelection();
|
|
30237
|
+
}
|
|
30238
|
+
}, "\u53D6\u6D88"))));
|
|
30239
|
+
});
|
|
30240
|
+
|
|
30241
|
+
var CustomSelector = (function (props) {
|
|
30242
|
+
var _props$ctx, _props$customSelector3, _props$customSelector4, _props$customSelector5, _props$selectProps2, _props$ctx4, _props$ctx5, _props$ctx6, _props$ctx6$form;
|
|
30243
|
+
var showType = React$1.useMemo(function () {
|
|
30244
|
+
var _props$customSelector, _props$customSelector2;
|
|
30245
|
+
return (props === null || props === void 0 ? void 0 : (_props$customSelector = props.customSelectorConfig) === null || _props$customSelector === void 0 ? void 0 : (_props$customSelector2 = _props$customSelector.extraData) === null || _props$customSelector2 === void 0 ? void 0 : _props$customSelector2.showType) || 'modalTable';
|
|
30246
|
+
}, [props]);
|
|
30247
|
+
var _useState = React$1.useState({
|
|
30248
|
+
visible: false,
|
|
30249
|
+
onShow: function onShow() {
|
|
30250
|
+
setModalConfig(_objectSpread2(_objectSpread2({}, modalConfig), {}, {
|
|
30251
|
+
visible: true
|
|
30252
|
+
}));
|
|
30253
|
+
},
|
|
30254
|
+
onCancel: function onCancel() {
|
|
30255
|
+
setModalConfig(_objectSpread2(_objectSpread2({}, modalConfig), {}, {
|
|
30256
|
+
visible: false
|
|
30257
|
+
}));
|
|
30258
|
+
}
|
|
30259
|
+
}),
|
|
30260
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
30261
|
+
modalConfig = _useState2[0],
|
|
30262
|
+
setModalConfig = _useState2[1];
|
|
30263
|
+
var _useState3 = React$1.useState([]),
|
|
30264
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
30265
|
+
fieldSource = _useState4[0],
|
|
30266
|
+
setFieldSource = _useState4[1];
|
|
30267
|
+
var _useState5 = React$1.useState([]),
|
|
30268
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
30269
|
+
allListData = _useState6[0],
|
|
30270
|
+
setAllListData = _useState6[1];
|
|
30271
|
+
var customRef = React$1.useRef();
|
|
30272
|
+
var prop = convertProp(props === null || props === void 0 ? void 0 : (_props$ctx = props.ctx) === null || _props$ctx === void 0 ? void 0 : _props$ctx.name, props.isSearchForm);
|
|
30273
|
+
var fieldMapping = ((_props$customSelector3 = props.customSelectorConfig) === null || _props$customSelector3 === void 0 ? void 0 : _props$customSelector3.fieldMapping) || [];
|
|
30274
|
+
var fieldMappingItem = fieldMapping.find(function (item) {
|
|
30275
|
+
return item.codeMappingTo === prop;
|
|
30276
|
+
});
|
|
30277
|
+
var echoLabel = (_props$customSelector4 = props.customSelectorConfig) === null || _props$customSelector4 === void 0 ? void 0 : (_props$customSelector5 = _props$customSelector4.extraData) === null || _props$customSelector5 === void 0 ? void 0 : _props$customSelector5.echoLabel;
|
|
30278
|
+
React$1.useEffect(function () {
|
|
30279
|
+
if (props.source && noEmptyArray(props.source)) {
|
|
30280
|
+
var source = (props === null || props === void 0 ? void 0 : props.source) || [];
|
|
30281
|
+
if ((source === null || source === void 0 ? void 0 : source[0]) === true) {
|
|
30282
|
+
var _customRef$current;
|
|
30283
|
+
//@ts-ignore
|
|
30284
|
+
customRef === null || customRef === void 0 ? void 0 : (_customRef$current = customRef.current) === null || _customRef$current === void 0 ? void 0 : _customRef$current.refreshSelectSource();
|
|
30285
|
+
} else if ((source === null || source === void 0 ? void 0 : source[0]) === false) {
|
|
30286
|
+
var _customRef$current2;
|
|
30287
|
+
//@ts-ignore
|
|
30288
|
+
customRef === null || customRef === void 0 ? void 0 : (_customRef$current2 = customRef.current) === null || _customRef$current2 === void 0 ? void 0 : _customRef$current2.refreshSelectSource(true);
|
|
30289
|
+
}
|
|
30290
|
+
}
|
|
30291
|
+
}, [props.source]);
|
|
30292
|
+
var setFieldValue = function setFieldValue(key, value, sourceList) {
|
|
30293
|
+
var _props$ctx2, _props$ctx2$form, _props$ctx2$form$setF, _props$onChange;
|
|
30294
|
+
props === null || props === void 0 ? void 0 : (_props$ctx2 = props.ctx) === null || _props$ctx2 === void 0 ? void 0 : (_props$ctx2$form = _props$ctx2.form) === null || _props$ctx2$form === void 0 ? void 0 : (_props$ctx2$form$setF = _props$ctx2$form.setFieldValue) === null || _props$ctx2$form$setF === void 0 ? void 0 : _props$ctx2$form$setF.call(_props$ctx2$form, key, value);
|
|
30295
|
+
props === null || props === void 0 ? void 0 : (_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, value, sourceList);
|
|
30296
|
+
};
|
|
30297
|
+
var onChange = function onChange(value) {
|
|
30298
|
+
if (!value) return;
|
|
30299
|
+
var dataItem = allListData.filter(function (item) {
|
|
30300
|
+
return Array.isArray(value) ? value.includes(item === null || item === void 0 ? void 0 : item[(fieldMappingItem === null || fieldMappingItem === void 0 ? void 0 : fieldMappingItem.codeMappingFrom) || echoLabel]) : (item === null || item === void 0 ? void 0 : item[(fieldMappingItem === null || fieldMappingItem === void 0 ? void 0 : fieldMappingItem.codeMappingFrom) || echoLabel]) == value;
|
|
30301
|
+
}) || [];
|
|
30302
|
+
if (showType === 'modalTable') {
|
|
30303
|
+
var _props$selectProps, _customRef$current3;
|
|
30304
|
+
var rowData = (props === null || props === void 0 ? void 0 : (_props$selectProps = props.selectProps) === null || _props$selectProps === void 0 ? void 0 : _props$selectProps.multipleForQuery) ? dataItem : (dataItem === null || dataItem === void 0 ? void 0 : dataItem[0]) || {};
|
|
30305
|
+
//@ts-ignore
|
|
30306
|
+
customRef === null || customRef === void 0 ? void 0 : (_customRef$current3 = customRef.current) === null || _customRef$current3 === void 0 ? void 0 : _customRef$current3.handleOk(rowData, false);
|
|
30307
|
+
} else {
|
|
30308
|
+
var _props$ctx3;
|
|
30309
|
+
setFieldValue((_props$ctx3 = props.ctx) === null || _props$ctx3 === void 0 ? void 0 : _props$ctx3.name, value, fieldSource);
|
|
30310
|
+
}
|
|
30311
|
+
};
|
|
30312
|
+
var multipleForQuery = props === null || props === void 0 ? void 0 : (_props$selectProps2 = props.selectProps) === null || _props$selectProps2 === void 0 ? void 0 : _props$selectProps2.multipleForQuery;
|
|
30313
|
+
var isView = (props === null || props === void 0 ? void 0 : (_props$ctx4 = props.ctx) === null || _props$ctx4 === void 0 ? void 0 : _props$ctx4.mode) == 'view';
|
|
30314
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
30315
|
+
style: {
|
|
30316
|
+
display: 'flex'
|
|
30317
|
+
}
|
|
30318
|
+
}, /*#__PURE__*/React__default['default'].createElement(antd.Select, _objectSpread2(_objectSpread2({}, props === null || props === void 0 ? void 0 : props.selectProps), {}, {
|
|
30319
|
+
showSearch: true,
|
|
30320
|
+
optionFilterProp: 'label',
|
|
30321
|
+
placeholder: "\u8BF7\u9009\u62E9",
|
|
30322
|
+
onChange: onChange,
|
|
30323
|
+
options: fieldSource,
|
|
30324
|
+
value: !(props === null || props === void 0 ? void 0 : (_props$ctx5 = props.ctx) === null || _props$ctx5 === void 0 ? void 0 : _props$ctx5.form) && (props === null || props === void 0 ? void 0 : props.value) || (props === null || props === void 0 ? void 0 : (_props$ctx6 = props.ctx) === null || _props$ctx6 === void 0 ? void 0 : (_props$ctx6$form = _props$ctx6.form) === null || _props$ctx6$form === void 0 ? void 0 : _props$ctx6$form.getFieldValue(props.id)),
|
|
30325
|
+
disabled: isView || props.disabled,
|
|
30326
|
+
mode: multipleForQuery ? 'multiple' : undefined,
|
|
30327
|
+
allowClear: props === null || props === void 0 ? void 0 : props.allowClear,
|
|
30328
|
+
onClear: function onClear() {
|
|
30329
|
+
var _props$ctx7;
|
|
30330
|
+
return setFieldValue((_props$ctx7 = props.ctx) === null || _props$ctx7 === void 0 ? void 0 : _props$ctx7.name, multipleForQuery ? [] : '', fieldSource);
|
|
30331
|
+
}
|
|
30332
|
+
})), showType === 'modalTable' && ( /*#__PURE__*/React__default['default'].createElement(antd.Button, {
|
|
30333
|
+
type: "primary",
|
|
30334
|
+
style: {
|
|
30335
|
+
width: '30px',
|
|
30336
|
+
display: 'flex',
|
|
30337
|
+
justifyContent: 'center',
|
|
30338
|
+
alignItems: 'center'
|
|
30339
|
+
},
|
|
30340
|
+
onClick: function onClick() {
|
|
30341
|
+
modalConfig.onShow();
|
|
30342
|
+
},
|
|
30343
|
+
disabled: props.disabled
|
|
30344
|
+
}, /*#__PURE__*/React__default['default'].createElement(icons.SearchOutlined, {
|
|
30345
|
+
className: "site-form-item-icon"
|
|
30346
|
+
}))), /*#__PURE__*/React__default['default'].createElement(CustomSelectorModal, _objectSpread2(_objectSpread2(_objectSpread2({
|
|
30347
|
+
ref: customRef
|
|
30348
|
+
}, modalConfig), props), {}, {
|
|
30349
|
+
showType: showType,
|
|
30350
|
+
fieldSource: fieldSource,
|
|
30351
|
+
setFieldSource: setFieldSource,
|
|
30352
|
+
setFieldValue: setFieldValue,
|
|
30353
|
+
setAllListData: setAllListData,
|
|
30354
|
+
ismultiple: multipleForQuery
|
|
30355
|
+
})));
|
|
30356
|
+
});
|
|
30357
|
+
|
|
29496
30358
|
var RangePicker = antd.DatePicker.RangePicker;
|
|
29497
30359
|
var RuleField = /*#__PURE__*/function (_Component) {
|
|
29498
30360
|
function RuleField(props) {
|
|
@@ -29658,7 +30520,12 @@ var RuleField = /*#__PURE__*/function (_Component) {
|
|
|
29658
30520
|
callback = _this$props2.callback,
|
|
29659
30521
|
queryIdentify = _this$props2.queryIdentify,
|
|
29660
30522
|
disabled = _this$props2.disabled,
|
|
29661
|
-
customerWidth = _this$props2.customerWidth
|
|
30523
|
+
customerWidth = _this$props2.customerWidth,
|
|
30524
|
+
_this$props2$itemDeta = _this$props2.itemDetail,
|
|
30525
|
+
itemDetail = _this$props2$itemDeta === void 0 ? {} : _this$props2$itemDeta,
|
|
30526
|
+
_this$props2$others = _this$props2.others,
|
|
30527
|
+
others = _this$props2$others === void 0 ? {} : _this$props2$others,
|
|
30528
|
+
propertyCode = _this$props2.propertyCode;
|
|
29662
30529
|
var thresholdList = _this.state.thresholdList;
|
|
29663
30530
|
var styleCommon = {
|
|
29664
30531
|
width: customerWidth || '150px'
|
|
@@ -31889,6 +32756,147 @@ var RuleField = /*#__PURE__*/function (_Component) {
|
|
|
31889
32756
|
});
|
|
31890
32757
|
}
|
|
31891
32758
|
}
|
|
32759
|
+
// 自定义选择器
|
|
32760
|
+
if (dataChoiceBusinessType == 40) {
|
|
32761
|
+
if (INTERVAL_TYPE.indexOf(selectOperation) > -1) {
|
|
32762
|
+
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(CustomSelector, {
|
|
32763
|
+
selectProps: _objectSpread2(_objectSpread2({
|
|
32764
|
+
style: styleCommon,
|
|
32765
|
+
placeholder: '请选择'
|
|
32766
|
+
}, dataInputBusinessType === 12 ? {
|
|
32767
|
+
mode: 'multiple',
|
|
32768
|
+
maxTagCount: 1,
|
|
32769
|
+
multipleForQuery: true
|
|
32770
|
+
} : {}), {}, {
|
|
32771
|
+
getPopupContainer: function getPopupContainer() {
|
|
32772
|
+
return document.body;
|
|
32773
|
+
}
|
|
32774
|
+
}),
|
|
32775
|
+
ctx: {
|
|
32776
|
+
name: propertyCode || (itemDetail === null || itemDetail === void 0 ? void 0 : itemDetail.propertyPath)
|
|
32777
|
+
},
|
|
32778
|
+
isSearchForm: true,
|
|
32779
|
+
customSelectorConfig: (others === null || others === void 0 ? void 0 : others.customSelectorConfig) || {},
|
|
32780
|
+
disabled: disabled,
|
|
32781
|
+
value: values[0],
|
|
32782
|
+
onChange: function onChange(value, sourceList) {
|
|
32783
|
+
if (dataInputBusinessType === 12) {
|
|
32784
|
+
var _value$map, _sourceList$filter;
|
|
32785
|
+
values[0] = (value === null || value === void 0 ? void 0 : (_value$map = value.map) === null || _value$map === void 0 ? void 0 : _value$map.call(value, function (i) {
|
|
32786
|
+
return i;
|
|
32787
|
+
})) || [];
|
|
32788
|
+
valueNames[0] = (sourceList === null || sourceList === void 0 ? void 0 : (_sourceList$filter = sourceList.filter(function (s) {
|
|
32789
|
+
return s.value == value;
|
|
32790
|
+
})) === null || _sourceList$filter === void 0 ? void 0 : _sourceList$filter.map(function (i) {
|
|
32791
|
+
return i.label || '';
|
|
32792
|
+
})) || [];
|
|
32793
|
+
} else {
|
|
32794
|
+
var _sourceList$find;
|
|
32795
|
+
var vLabel = sourceList === null || sourceList === void 0 ? void 0 : (_sourceList$find = sourceList.find(function (s) {
|
|
32796
|
+
return s.value == value;
|
|
32797
|
+
})) === null || _sourceList$find === void 0 ? void 0 : _sourceList$find.label;
|
|
32798
|
+
values[0] = value ? [value] : [];
|
|
32799
|
+
valueNames[0] = vLabel ? [vLabel] : [];
|
|
32800
|
+
}
|
|
32801
|
+
callback(values, valueNames);
|
|
32802
|
+
}
|
|
32803
|
+
}), /*#__PURE__*/React__default['default'].createElement("span", null, "~"), /*#__PURE__*/React__default['default'].createElement(CustomSelector, {
|
|
32804
|
+
selectProps: _objectSpread2(_objectSpread2({
|
|
32805
|
+
style: styleCommon,
|
|
32806
|
+
placeholder: '请选择'
|
|
32807
|
+
}, dataInputBusinessType === 12 ? {
|
|
32808
|
+
mode: 'multiple',
|
|
32809
|
+
maxTagCount: 1,
|
|
32810
|
+
multipleForQuery: true
|
|
32811
|
+
} : {}), {}, {
|
|
32812
|
+
getPopupContainer: function getPopupContainer() {
|
|
32813
|
+
return document.body;
|
|
32814
|
+
}
|
|
32815
|
+
}),
|
|
32816
|
+
ctx: {
|
|
32817
|
+
name: propertyCode || (itemDetail === null || itemDetail === void 0 ? void 0 : itemDetail.propertyPath)
|
|
32818
|
+
},
|
|
32819
|
+
isSearchForm: true,
|
|
32820
|
+
customSelectorConfig: (others === null || others === void 0 ? void 0 : others.customSelectorConfig) || {},
|
|
32821
|
+
disabled: disabled,
|
|
32822
|
+
value: values[1],
|
|
32823
|
+
onChange: function onChange(value, sourceList) {
|
|
32824
|
+
if (dataInputBusinessType === 12) {
|
|
32825
|
+
var _value$map2, _sourceList$filter2;
|
|
32826
|
+
values[1] = (value === null || value === void 0 ? void 0 : (_value$map2 = value.map) === null || _value$map2 === void 0 ? void 0 : _value$map2.call(value, function (i) {
|
|
32827
|
+
return i;
|
|
32828
|
+
})) || [];
|
|
32829
|
+
valueNames[1] = (sourceList === null || sourceList === void 0 ? void 0 : (_sourceList$filter2 = sourceList.filter(function (s) {
|
|
32830
|
+
return s.value == value;
|
|
32831
|
+
})) === null || _sourceList$filter2 === void 0 ? void 0 : _sourceList$filter2.map(function (i) {
|
|
32832
|
+
return i.label || '';
|
|
32833
|
+
})) || [];
|
|
32834
|
+
} else {
|
|
32835
|
+
var _sourceList$find2;
|
|
32836
|
+
var vLabel = sourceList === null || sourceList === void 0 ? void 0 : (_sourceList$find2 = sourceList.find(function (s) {
|
|
32837
|
+
return s.value == value;
|
|
32838
|
+
})) === null || _sourceList$find2 === void 0 ? void 0 : _sourceList$find2.label;
|
|
32839
|
+
values[1] = value ? [value] : [];
|
|
32840
|
+
valueNames[1] = vLabel ? [vLabel] : [];
|
|
32841
|
+
}
|
|
32842
|
+
callback(values, valueNames);
|
|
32843
|
+
}
|
|
32844
|
+
}));
|
|
32845
|
+
} else {
|
|
32846
|
+
var _values14;
|
|
32847
|
+
var _currentValue13 = dataInputBusinessType === 12 ? ((_values14 = values) === null || _values14 === void 0 ? void 0 : _values14.map(function (s, vIndex) {
|
|
32848
|
+
return {
|
|
32849
|
+
key: s,
|
|
32850
|
+
label: valueNames[vIndex]
|
|
32851
|
+
};
|
|
32852
|
+
})) || [] : values[0] && {
|
|
32853
|
+
key: values[0],
|
|
32854
|
+
label: valueNames[0]
|
|
32855
|
+
} || {};
|
|
32856
|
+
return /*#__PURE__*/React__default['default'].createElement(CustomSelector, {
|
|
32857
|
+
selectProps: _objectSpread2(_objectSpread2({
|
|
32858
|
+
style: styleCommon,
|
|
32859
|
+
placeholder: '请选择'
|
|
32860
|
+
}, dataInputBusinessType === 12 ? {
|
|
32861
|
+
mode: 'multiple',
|
|
32862
|
+
maxTagCount: 1,
|
|
32863
|
+
multipleForQuery: true
|
|
32864
|
+
} : {}), {}, {
|
|
32865
|
+
getPopupContainer: function getPopupContainer() {
|
|
32866
|
+
return document.body;
|
|
32867
|
+
}
|
|
32868
|
+
}),
|
|
32869
|
+
ctx: {
|
|
32870
|
+
name: propertyCode || (itemDetail === null || itemDetail === void 0 ? void 0 : itemDetail.propertyPath)
|
|
32871
|
+
},
|
|
32872
|
+
isSearchForm: true,
|
|
32873
|
+
customSelectorConfig: (others === null || others === void 0 ? void 0 : others.customSelectorConfig) || {},
|
|
32874
|
+
disabled: disabled,
|
|
32875
|
+
value: _currentValue13,
|
|
32876
|
+
onChange: function onChange(value, sourceList) {
|
|
32877
|
+
if (dataInputBusinessType === 12) {
|
|
32878
|
+
var _value$map3, _sourceList$filter3;
|
|
32879
|
+
values = (value === null || value === void 0 ? void 0 : (_value$map3 = value.map) === null || _value$map3 === void 0 ? void 0 : _value$map3.call(value, function (i) {
|
|
32880
|
+
return i;
|
|
32881
|
+
})) || [];
|
|
32882
|
+
valueNames = (sourceList === null || sourceList === void 0 ? void 0 : (_sourceList$filter3 = sourceList.filter(function (s) {
|
|
32883
|
+
return s.value == value;
|
|
32884
|
+
})) === null || _sourceList$filter3 === void 0 ? void 0 : _sourceList$filter3.map(function (i) {
|
|
32885
|
+
return i.label || '';
|
|
32886
|
+
})) || [];
|
|
32887
|
+
} else {
|
|
32888
|
+
var _sourceList$find3;
|
|
32889
|
+
var vLabel = sourceList === null || sourceList === void 0 ? void 0 : (_sourceList$find3 = sourceList.find(function (s) {
|
|
32890
|
+
return s.value == value;
|
|
32891
|
+
})) === null || _sourceList$find3 === void 0 ? void 0 : _sourceList$find3.label;
|
|
32892
|
+
values = value ? [value] : [];
|
|
32893
|
+
valueNames = vLabel ? [vLabel] : [];
|
|
32894
|
+
}
|
|
32895
|
+
callback(values, valueNames);
|
|
32896
|
+
}
|
|
32897
|
+
});
|
|
32898
|
+
}
|
|
32899
|
+
}
|
|
31892
32900
|
} else {
|
|
31893
32901
|
if (dataTypeCode == 22 || dataTypeCode == 21 || dataTypeCode == 24 || dataTypeCode == 23) {
|
|
31894
32902
|
//数值22, 字符串21, 布尔类型24, long23
|
|
@@ -32011,6 +33019,7 @@ var RuleField = /*#__PURE__*/function (_Component) {
|
|
|
32011
33019
|
dataTypeCode: '',
|
|
32012
33020
|
dataChoiceBusinessType: '',
|
|
32013
33021
|
dataInputBusinessType: '',
|
|
33022
|
+
others: {},
|
|
32014
33023
|
fieldValues: [],
|
|
32015
33024
|
thresholdQuery: {},
|
|
32016
33025
|
thresholdList: [],
|
|
@@ -32028,6 +33037,7 @@ var RuleField = /*#__PURE__*/function (_Component) {
|
|
|
32028
33037
|
dataTypeCode = _this$props3.dataTypeCode,
|
|
32029
33038
|
dataChoiceBusinessType = _this$props3.dataChoiceBusinessType,
|
|
32030
33039
|
dataInputBusinessType = _this$props3.dataInputBusinessType,
|
|
33040
|
+
others = _this$props3.others,
|
|
32031
33041
|
options = _this$props3.options,
|
|
32032
33042
|
values = _this$props3.values,
|
|
32033
33043
|
initialThresholdQuery = _this$props3.initialThresholdQuery,
|
|
@@ -32040,6 +33050,7 @@ var RuleField = /*#__PURE__*/function (_Component) {
|
|
|
32040
33050
|
dataTypeCode: dataTypeCode,
|
|
32041
33051
|
dataChoiceBusinessType: dataChoiceBusinessType,
|
|
32042
33052
|
dataInputBusinessType: dataInputBusinessType,
|
|
33053
|
+
others: others,
|
|
32043
33054
|
fieldValues: _toConsumableArray(values),
|
|
32044
33055
|
options: options
|
|
32045
33056
|
}, function () {
|
|
@@ -32076,6 +33087,11 @@ var RuleField = /*#__PURE__*/function (_Component) {
|
|
|
32076
33087
|
dataInputBusinessType: nextProps.dataInputBusinessType
|
|
32077
33088
|
});
|
|
32078
33089
|
}
|
|
33090
|
+
if (nextProps.others != this.props.others) {
|
|
33091
|
+
this.setState({
|
|
33092
|
+
others: nextProps.others
|
|
33093
|
+
});
|
|
33094
|
+
}
|
|
32079
33095
|
// if (nextProps.selectOperation != this.props.selectOperation) {
|
|
32080
33096
|
// this.setState({
|
|
32081
33097
|
// options: nextProps.options
|
|
@@ -32622,6 +33638,7 @@ var InnerSelect = (function (props) {
|
|
|
32622
33638
|
|
|
32623
33639
|
var RangePicker$1 = antd.DatePicker.RangePicker;
|
|
32624
33640
|
function RenderCompItem(props) {
|
|
33641
|
+
var _others;
|
|
32625
33642
|
var regularDataList = props.regularDataList,
|
|
32626
33643
|
ites = props.ites,
|
|
32627
33644
|
showValue = props.showValue,
|
|
@@ -33176,6 +34193,29 @@ function RenderCompItem(props) {
|
|
|
33176
34193
|
getPopupContainer: function getPopupContainer() {
|
|
33177
34194
|
return document.body;
|
|
33178
34195
|
}
|
|
34196
|
+
})) || null, ((ites === null || ites === void 0 ? void 0 : ites.inputType) === 20 || (ites === null || ites === void 0 ? void 0 : ites.inputType) === 30) && (ites === null || ites === void 0 ? void 0 : ites.choiceType) === 40 && ( /*#__PURE__*/React__default['default'].createElement(CustomSelector, {
|
|
34197
|
+
selectProps: _objectSpread2(_objectSpread2({
|
|
34198
|
+
style: styleCommon,
|
|
34199
|
+
placeholder: '请选择'
|
|
34200
|
+
}, (ites === null || ites === void 0 ? void 0 : ites.inputType) === 30 ? {
|
|
34201
|
+
mode: 'multiple',
|
|
34202
|
+
maxTagCount: 1,
|
|
34203
|
+
multipleForQuery: true
|
|
34204
|
+
} : {}), {}, {
|
|
34205
|
+
getPopupContainer: function getPopupContainer() {
|
|
34206
|
+
return document.body;
|
|
34207
|
+
}
|
|
34208
|
+
}),
|
|
34209
|
+
ctx: {
|
|
34210
|
+
name: ites.code
|
|
34211
|
+
},
|
|
34212
|
+
isSearchForm: true,
|
|
34213
|
+
customSelectorConfig: ((_others = others) === null || _others === void 0 ? void 0 : _others.customSelectorConfig) || {},
|
|
34214
|
+
disabled: disabled,
|
|
34215
|
+
value: showValue(ites.code),
|
|
34216
|
+
onChange: function onChange(value) {
|
|
34217
|
+
handleEdit(ites.code, value);
|
|
34218
|
+
}
|
|
33179
34219
|
})) || null, (ites === null || ites === void 0 ? void 0 : ites.inputType) === 40 && ( /*#__PURE__*/React__default['default'].createElement("div", {
|
|
33180
34220
|
style: {
|
|
33181
34221
|
display: 'flex'
|
|
@@ -33250,7 +34290,10 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
|
|
|
33250
34290
|
dataTypeCode: element.valueType,
|
|
33251
34291
|
dataChoiceBusinessType: element.choiceType,
|
|
33252
34292
|
dataInputBusinessType: element.inputType,
|
|
33253
|
-
info: element.info
|
|
34293
|
+
info: element.info,
|
|
34294
|
+
otherMainInfo: {
|
|
34295
|
+
customSelectorConfig: element.customSelectorConfig
|
|
34296
|
+
}
|
|
33254
34297
|
};
|
|
33255
34298
|
if (element === null || element === void 0 ? void 0 : (_element$propertyList = element.propertyList) === null || _element$propertyList === void 0 ? void 0 : _element$propertyList.length) {
|
|
33256
34299
|
child.children = _this.parseChildTreeData(element.propertyList, "".concat(element.code), "".concat(item.name, "-").concat(element.name), item.code);
|
|
@@ -33301,7 +34344,10 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
|
|
|
33301
34344
|
dataTypeCode: element.valueType,
|
|
33302
34345
|
dataChoiceBusinessType: element.choiceType,
|
|
33303
34346
|
dataInputBusinessType: element.inputType,
|
|
33304
|
-
info: element.info
|
|
34347
|
+
info: element.info,
|
|
34348
|
+
otherMainInfo: {
|
|
34349
|
+
customSelectorConfig: element.customSelectorConfig
|
|
34350
|
+
}
|
|
33305
34351
|
};
|
|
33306
34352
|
if (element.propertyList) {
|
|
33307
34353
|
child.children = _this.parseChildTreeData(element.propertyList, "".concat(parentKey, ".").concat(element.code), "".concat(parentTitle, "-").concat(element.name), rootObjCode);
|
|
@@ -33700,6 +34746,8 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
|
|
|
33700
34746
|
alignItems: 'center'
|
|
33701
34747
|
}
|
|
33702
34748
|
}, /*#__PURE__*/React__default['default'].createElement(antd.TreeSelect, {
|
|
34749
|
+
showSearch: true,
|
|
34750
|
+
treeNodeFilterProp: "title",
|
|
33703
34751
|
value: itemDetail.elementId,
|
|
33704
34752
|
disabled: disabled,
|
|
33705
34753
|
onChange: function onChange(value, name, nodeInfo) {
|
|
@@ -33760,6 +34808,7 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
|
|
|
33760
34808
|
// propertyCode={`${itemDetail.metaObjectCode}.${itemDetail.propertyPath}`}
|
|
33761
34809
|
,
|
|
33762
34810
|
relateDatas: relateDatas,
|
|
34811
|
+
others: currentTreeItem === null || currentTreeItem === void 0 ? void 0 : currentTreeItem.otherMainInfo,
|
|
33763
34812
|
values: itemDetail.params || [],
|
|
33764
34813
|
valueNames: itemDetail.paramNames || [],
|
|
33765
34814
|
callback: function callback(newValues, newValueNames) {
|
|
@@ -34347,12 +35396,12 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
|
|
|
34347
35396
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
34348
35397
|
className: 'base_rule_content'
|
|
34349
35398
|
}, headerButtonComponentFun ? headerButtonComponentFun(this.handleAddRule) : /*#__PURE__*/React__default['default'].createElement("div", {
|
|
34350
|
-
disabled: disabled,
|
|
34351
35399
|
style: {
|
|
34352
35400
|
display: onlyOneRule ? 'none' : 'block'
|
|
34353
35401
|
},
|
|
34354
35402
|
className: 'base_rule_line_title'
|
|
34355
35403
|
}, /*#__PURE__*/React__default['default'].createElement(antd.Button, {
|
|
35404
|
+
disabled: disabled,
|
|
34356
35405
|
onClick: this.handleAddRule,
|
|
34357
35406
|
className: 'base_rule_btn_style',
|
|
34358
35407
|
type: "link"
|
|
@@ -35451,12 +36500,14 @@ exports.handleBaseUrlPre = handleBaseUrlPre;
|
|
|
35451
36500
|
exports.handleBeforeUpload = handleBeforeUpload;
|
|
35452
36501
|
exports.handleBssulaColumnsSpecialParams = handleBssulaColumnsSpecialParams;
|
|
35453
36502
|
exports.handleCommonTimeRender = handleCommonTimeRender$1;
|
|
36503
|
+
exports.handleConvertResponse = handleConvertResponse;
|
|
35454
36504
|
exports.handleError = handleError;
|
|
35455
36505
|
exports.handleExport = handleExport;
|
|
35456
36506
|
exports.handleExportBarCode = handleExportBarCode;
|
|
35457
36507
|
exports.handleJudgeAuthButtons = handleJudgeAuthButtons;
|
|
35458
36508
|
exports.handleOssUrl = handleOssUrl;
|
|
35459
36509
|
exports.handleRequestAuthHeader = handleRequestAuthHeader;
|
|
36510
|
+
exports.handleRequestHeader = handleRequestHeader;
|
|
35460
36511
|
exports.handleRequestUrl = handleRequestUrl;
|
|
35461
36512
|
exports.handleStatusBadge = handleStatusBadge;
|
|
35462
36513
|
exports.handleTextBreakSpaces = handleTextBreakSpaces;
|
|
@@ -35476,6 +36527,7 @@ exports.judgeIsRequestSuccess = judgeIsRequestSuccess;
|
|
|
35476
36527
|
exports.keyToWord = keyToWord;
|
|
35477
36528
|
exports.memoizeOneFormatter = memoizeOneFormatter;
|
|
35478
36529
|
exports.noEmptyArr = noEmptyArr;
|
|
36530
|
+
exports.noEmptyArray = noEmptyArray;
|
|
35479
36531
|
exports.paramsControl = paramsControl;
|
|
35480
36532
|
exports.parseWidth = parseWidth;
|
|
35481
36533
|
exports.precisionQuantity = precisionQuantity;
|