@bit-sun/business-component 2.0.1 → 2.0.4

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/index.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import axios from 'axios';
2
2
  import React, { createContext, useContext, useEffect, forwardRef, createElement, useState, useMemo, useRef } from 'react';
3
- import { message, Menu, Space, Dropdown, Tooltip, Button, Checkbox, Input, Modal, Select, Form, Divider, Spin, Table, TreeSelect, Tag } from 'antd';
3
+ import { message, Menu, Space, Dropdown, Tooltip, Button, Checkbox, Input, Modal, Select, Form, Divider, Spin, Table, TreeSelect, Tag, InputNumber } from 'antd';
4
4
  import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
5
5
  import classNames from 'classnames';
6
6
  import _ from 'loadsh';
@@ -1921,6 +1921,19 @@ var CaretLeftOutlined$1 = function CaretLeftOutlined$1(props, ref) {
1921
1921
  CaretLeftOutlined$1.displayName = 'CaretLeftOutlined';
1922
1922
  var CaretLeftOutlined$2 = /*#__PURE__*/forwardRef(CaretLeftOutlined$1);
1923
1923
 
1924
+ // This icon file is generated automatically.
1925
+ var CloseCircleOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M685.4 354.8c0-4.4-3.6-8-8-8l-66 .3L512 465.6l-99.3-118.4-66.1-.3c-4.4 0-8 3.5-8 8 0 1.9.7 3.7 1.9 5.2l130.1 155L340.5 670a8.32 8.32 0 00-1.9 5.2c0 4.4 3.6 8 8 8l66.1-.3L512 564.4l99.3 118.4 66 .3c4.4 0 8-3.5 8-8 0-1.9-.7-3.7-1.9-5.2L553.5 515l130.1-155c1.2-1.4 1.8-3.3 1.8-5.2z" } }, { "tag": "path", "attrs": { "d": "M512 65C264.6 65 64 265.6 64 513s200.6 448 448 448 448-200.6 448-448S759.4 65 512 65zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }] }, "name": "close-circle", "theme": "outlined" };
1926
+
1927
+ var CloseCircleOutlined$1 = function CloseCircleOutlined$1(props, ref) {
1928
+ return /*#__PURE__*/createElement(Icon, _objectSpread2$1(_objectSpread2$1({}, props), {}, {
1929
+ ref: ref,
1930
+ icon: CloseCircleOutlined
1931
+ }));
1932
+ };
1933
+
1934
+ CloseCircleOutlined$1.displayName = 'CloseCircleOutlined';
1935
+ var CloseCircleOutlined$2 = /*#__PURE__*/forwardRef(CloseCircleOutlined$1);
1936
+
1924
1937
  // This icon file is generated automatically.
1925
1938
  var CopyOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z" } }] }, "name": "copy", "theme": "outlined" };
1926
1939
 
@@ -2350,16 +2363,26 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
2350
2363
  var _this$props = _this.props,
2351
2364
  validDataUrl = _this$props.validDataUrl,
2352
2365
  updateData = _this$props.updateData,
2353
- columns = _this$props.columns;
2366
+ columns = _this$props.columns,
2367
+ isBrandAuth = _this$props.isBrandAuth;
2354
2368
 
2355
2369
  var resultData = _this.getData().filter(function (d) {
2356
2370
  return _.compact(Object.values(d)).length;
2357
- });
2371
+ }); // 处理业务参数
2358
2372
 
2359
- axios.post(validDataUrl, {
2373
+
2374
+ var otherParams = {};
2375
+
2376
+ if (isBrandAuth) {
2377
+ otherParams = {
2378
+ brandAuth: 'ctl-withAuth'
2379
+ };
2380
+ }
2381
+
2382
+ axios.post(validDataUrl, _objectSpread2(_objectSpread2({}, otherParams), {}, {
2360
2383
  columns: columns,
2361
2384
  data: resultData
2362
- }).then(function (result) {
2385
+ })).then(function (result) {
2363
2386
  result = result.data;
2364
2387
 
2365
2388
  if (result.status !== '0') {
@@ -2949,7 +2972,6 @@ var DataImport = /*#__PURE__*/function (_React$Component) {
2949
2972
  console.time();
2950
2973
  var sheetData = luckysheet$1.getSheetData();
2951
2974
  var data = JSON.parse(JSON.stringify(sheetData)).filter(function (item) {
2952
- debugger;
2953
2975
  return item[0];
2954
2976
  }).map(function (item) {
2955
2977
  var obj = {};
@@ -4373,88 +4395,8 @@ var SearchSelect = function SearchSelect(props) {
4373
4395
  }), " \u5168\u9009\u6240\u6709\u9875\u9762") : '')))));
4374
4396
  };
4375
4397
 
4376
- var shopFileType = [{
4377
- text: "线上",
4378
- value: 'online'
4379
- }, {
4380
- text: "线下",
4381
- value: 'offline'
4382
- }];
4383
- var shopFile2Type = [{
4384
- text: "第三方线上",
4385
- value: 'online'
4386
- }, {
4387
- text: "线下",
4388
- value: 'offline'
4389
- }, {
4390
- text: "自营B2B",
4391
- value: 'B2B'
4392
- }, {
4393
- text: "自营B2C",
4394
- value: 'B2C'
4395
- }];
4396
- var arrivalPaySupportList = [{
4397
- text: "支持",
4398
- value: 1
4399
- }, {
4400
- text: "不支持",
4401
- value: 0
4402
- }];
4403
- var sharingType = [{
4404
- text: "共享",
4405
- value: '10'
4406
- }, {
4407
- text: "私有",
4408
- value: '20'
4409
- }];
4410
-
4411
- var getDicData = function getDicData(dicCode) {
4412
- var dicData = {};
4413
-
4414
- {
4415
- var storageDic = localStorage.getItem('dicData') ? JSON.parse(localStorage.getItem('dicData') || '{}') : {};
4416
- dicData = storageDic[dicCode];
4417
- } // @ts-ignore
4418
-
4419
-
4420
- if (!dicData || !dicData.length) ;
4421
-
4422
- return dicData;
4423
- };
4424
-
4425
- var getDictionarySource = function getDictionarySource(dicCode) {
4426
- var needConvertInterger = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
4427
- var dicData = getDicData(dicCode);
4428
-
4429
- try {
4430
- if (needConvertInterger) {
4431
- // @ts-ignore
4432
- dicData = dicData.map(function (item) {
4433
- return _objectSpread2(_objectSpread2({}, item), {}, {
4434
- value: parseFloat(item.value)
4435
- });
4436
- });
4437
- }
4438
- } catch (e) {}
4439
-
4440
- return dicData;
4441
- };
4442
-
4443
- var getDictionaryTextByValue = function getDictionaryTextByValue(dicCode, value) {
4444
- var dicData = getDicData(dicCode);
4445
- if (value === undefined) return ''; // @ts-ignore
4446
-
4447
- var dicItemArray = dicData === null || dicData === void 0 ? void 0 : dicData.filter(function (item) {
4448
- return item.value === value.toString();
4449
- });
4450
-
4451
- if (!(dicItemArray === null || dicItemArray === void 0 ? void 0 : dicItemArray.length)) {
4452
- // throw new Error(`当前${dicCode}字典值合没有${value}的数据`)
4453
- return value;
4454
- }
4455
-
4456
- return dicItemArray[0].text;
4457
- };
4398
+ var css_248z$4 = ".add_select_show {\n display: flex;\n}\n.add_select_expand_button {\n position: relative;\n width: 30px;\n color: #ffffff;\n cursor: pointer;\n}\n.add_select_expand_button span {\n position: absolute;\n height: 20px;\n line-height: 14px;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n}\n.add_select_header {\n border-bottom: 1px solid #D9D9D9;\n height: 24px;\n height: 40px;\n font-family: PingFangSC-Medium;\n font-weight: 500;\n font-size: 18px;\n color: #000000;\n letter-spacing: 0;\n line-height: 40px;\n margin-bottom: 10px;\n padding-left: 10px;\n}\n.add_select_header > span {\n margin-left: 20px;\n font-weight: 400;\n font-size: 12px;\n color: #666666;\n letter-spacing: 0;\n line-height: 40px;\n}\n.add_select_header > span > span {\n color: #ff0000;\n}\n.add_select_header_close span {\n position: absolute;\n color: black !important;\n right: 10px;\n top: 10px;\n}\n.add_select_wrapper {\n position: relative;\n display: flex;\n max-height: 60vh;\n overflow: hidden;\n font-size: 14px;\n margin: 5px 10px;\n}\n.add_select_wrapper .ant-table-pagination.ant-pagination {\n margin: 5px;\n padding-right: 5px;\n}\n.add_select_wrapper .ant-checkbox-wrapper {\n justify-content: center;\n}\n.add_select_wrapper .ant-form-item-label {\n padding: 0PX;\n line-height: 23px !important;\n}\n.add_select_wrapper .ant-form-item-label > label {\n font-size: 12px;\n}\n.add_select_wrapper .ant-table-thead th {\n height: 20px !important;\n padding: 0px 8px !important;\n font-size: 12px !important;\n font-weight: 600 !important;\n line-height: 20px !important;\n}\n.add_select_wrapper .ant-modal-body {\n padding: 10px;\n}\n.add_select_wrapper .ant-table-wrapper {\n padding: 0px !important;\n}\n.add_select_wrapper .row-class {\n height: 24px;\n}\n.add_select_wrapper .row-class td {\n font-size: 12px !important;\n height: 24px !important;\n padding: 0px 8px !important;\n line-height: 20px !important;\n}\n.add_select_wrapper .ant-table-body {\n height: 240px;\n overflow-y: auto !important;\n}\n.add_select_wrapper .ant-row.ant-form-item {\n margin-bottom: 10px;\n}\n.add_select_wrapper_click_flag {\n position: absolute;\n z-index: 10;\n}\n.add_select_wrapper_click_flag_arrow {\n transform: rotate(0deg);\n transition: transform 0.5s;\n}\n.add_select_wrapper_click_flag_arrow_1 {\n transform: rotate(-180deg);\n transition: transform 0.5s;\n}\n.add_select_wrapper_left {\n flex-basis: 298px;\n width: 298px;\n overflow-y: hidden;\n transition: all 0.3s;\n margin-right: 10px;\n border: 1px solid #D9D9D9;\n border-radius: 5px;\n}\n.add_select_wrapper_left1 {\n width: 0;\n height: 0;\n transition: all 0.3s;\n display: none;\n}\n.add_select_wrapper_right {\n width: 872px;\n border: 1px solid #D9D9D9;\n border-radius: 5px;\n}\n.add_select_wrapper_right1 {\n width: 100%;\n margin-left: 10px;\n}\n.add_select_wrapper_right,\n.add_select_wrapper_right1 {\n overflow-x: auto;\n}\n.add_select_wrapper .select_list_columns {\n height: 272px;\n overflow-y: auto;\n border-bottom: 1px solid #D9D9D9;\n}\n.add_select_wrapper .select_list_columns_tips {\n background: #eee;\n padding: 6px 20px;\n margin-bottom: 10px;\n}\n.add_select_wrapper .select_list_columns_formItems {\n padding: 7px 10px;\n}\n.add_select_wrapper .select_list_searchButton {\n display: flex;\n margin: 10px;\n justify-content: flex-end;\n}\n.add_select_wrapper .select_list_button_space {\n margin-right: 10px;\n}\n.add_select_wrapper .select_list_selectTips {\n display: flex;\n justify-content: space-between;\n height: 24px;\n font-size: 12px;\n line-height: 24px;\n background: #F7F8FB;\n padding: 0 5px;\n border-bottom: 1px solid #D9D9D9;\n}\n.add_select_wrapper .select_list_selectAll {\n position: relative;\n top: -40px;\n left: 20px;\n width: 160px;\n}\n.add_select_wrapper_select {\n margin-top: 4px;\n border: 1px solid #D9D9D9;\n border-radius: 5px;\n margin: 5px 10px;\n}\n.add_select_wrapper_select .ant-table-pagination.ant-pagination {\n margin: 9px;\n padding-right: 5px;\n}\n.add_select_wrapper_select .ant-modal-body {\n padding: 10px;\n}\n.add_select_wrapper_select .ant-table-wrapper {\n padding: 0px !important;\n}\n.add_select_wrapper_select .ant-table-thead th {\n height: 23px !important;\n padding: 0px 8px !important;\n font-size: 12px !important;\n font-weight: 600 !important;\n line-height: 23px !important;\n}\n.add_select_wrapper_select .ant-modal-close-x {\n height: 30px;\n}\n.add_select_wrapper_select .row-class {\n height: 30px;\n}\n.add_select_wrapper_select .row-class td {\n font-size: 12px !important;\n height: 30px !important;\n padding: 4px 8px !important;\n}\n.add_select_wrapper_select .ant-table-body {\n height: 200px;\n overflow-y: auto !important;\n}\n.add_select_wrapper_select .ant-row.ant-form-item {\n margin-bottom: 10px;\n}\n.add_select_wrapper_select .ant-input-number-input {\n height: auto;\n}\n.add_select_wrapper_select .select_list_selectTips {\n display: flex;\n justify-content: space-between;\n height: 24px;\n font-size: 12px;\n line-height: 24px;\n background: #F7F8FB;\n padding: 0 3px;\n border-bottom: 1px solid #D9D9D9;\n}\n";
4399
+ styleInject(css_248z$4);
4458
4400
 
4459
4401
  var loadSelectSource = function loadSelectSource(url, params) {
4460
4402
  return new Promise(function (resolve, reject) {
@@ -4475,123 +4417,1243 @@ var loadSelectSource = function loadSelectSource(url, params) {
4475
4417
  });
4476
4418
  };
4477
4419
 
4478
- var handleDefaultPrefixUrl = function handleDefaultPrefixUrl(type) {
4479
- var result;
4480
-
4481
- switch (type) {
4482
- case 'supplier2':
4483
- case 'customer2':
4484
- case 'shopFile2':
4485
- result = '/channel-manage';
4486
- break;
4487
-
4488
- case 'skuCommodity':
4489
- case 'skuPropertyValue':
4490
- case 'spuCommodity':
4491
- result = '/items';
4492
- break;
4420
+ var formatSource = function formatSource(reData, position, changePosition, changeSearchForm) {
4421
+ var _reData$position;
4493
4422
 
4494
- case 'physicalWarehouse':
4495
- case 'realWarehouse':
4496
- case 'virtualWarehouse':
4497
- case 'channelWarehouse':
4498
- result = '/stock';
4499
- break;
4423
+ var resKeyValue = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : ['code', 'name'];
4424
+ var data = reData && ((_reData$position = reData[position]) === null || _reData$position === void 0 ? void 0 : _reData$position.data);
4425
+ var list = Array.isArray(data) ? data : (data === null || data === void 0 ? void 0 : data.items) || (data === null || data === void 0 ? void 0 : data.list) || (data === null || data === void 0 ? void 0 : data.children) || [];
4426
+ var formatData = (list === null || list === void 0 ? void 0 : list.length) ? list.map(function (v) {
4427
+ return {
4428
+ text: v[resKeyValue[1]],
4429
+ value: v[resKeyValue[0]]
4430
+ };
4431
+ }) : [];
4432
+ changeSearchForm[changePosition] = _objectSpread2(_objectSpread2({}, changeSearchForm[changePosition]), {}, {
4433
+ initialSource: formatData
4434
+ });
4435
+ }; // 格式化树选择器数据源
4500
4436
 
4501
- case 'inventoryOrg2':
4502
- case 'purchaseOrg':
4503
- case 'salesOrg':
4504
- case 'employee2':
4505
- result = '/user';
4506
- break;
4507
4437
 
4508
- case 'deliveryMode':
4509
- result = '/basic';
4510
- break;
4438
+ var mapSearchTree = function mapSearchTree(treeDataItem, resKeyValue) {
4439
+ var haveChildren = Array.isArray(treeDataItem.children) && treeDataItem.children.length > 0;
4440
+ return {
4441
+ title: treeDataItem[resKeyValue[1]],
4442
+ value: treeDataItem[resKeyValue[0]],
4443
+ parentId: treeDataItem.parent,
4444
+ data: _objectSpread2({}, treeDataItem),
4445
+ isLeaf: !haveChildren,
4446
+ disabled: haveChildren,
4447
+ children: haveChildren ? treeDataItem.children.map(function (i) {
4448
+ return mapSearchTree(i, resKeyValue);
4449
+ }) : []
4450
+ };
4451
+ };
4511
4452
 
4512
- default:
4513
- result = '/bop/api';
4514
- break;
4515
- }
4453
+ var formatTreeDataSource = function formatTreeDataSource(reData, position, changePosition, changeSearchForm) {
4454
+ var _reData$position2;
4516
4455
 
4517
- return result;
4456
+ var resKeyValue = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : ['id', 'name'];
4457
+ var data = reData && ((_reData$position2 = reData[position]) === null || _reData$position2 === void 0 ? void 0 : _reData$position2.data);
4458
+ var formatData = data && Array.isArray(data) && data.length && data.map(function (ites) {
4459
+ return mapSearchTree(ites, resKeyValue);
4460
+ }) || [];
4461
+ changeSearchForm[changePosition].field.props.treeData = formatData;
4518
4462
  };
4519
4463
 
4520
- var _getDictionarySource;
4521
- var hasDictSharingType = (_getDictionarySource = getDictionarySource('UC000013')) === null || _getDictionarySource === void 0 ? void 0 : _getDictionarySource.length;
4522
- var sharingTypeDataList = hasDictSharingType && getDictionarySource('UC000013') || sharingType;
4523
- function commonFun(type, prefixUrl, requestConfigProp, modalTableBusProps) {
4524
- // 默认type === 'supplier' 供应商选择器
4525
- var requestConfig = _objectSpread2({
4526
- url: "".concat(prefixUrl.selectPrefix, "/supplier"),
4527
- filter: 'qp-name,code-orGroup,like',
4528
- otherParams: {
4529
- sorter: 'desc-id'
4530
- }
4531
- }, requestConfigProp);
4532
- /*
4533
- * 处理 格式化下拉框数据源
4534
- * reData 必传 promise返回响应的数据 格式为[{},{},{},...] Promise.all第一个参数数组有多少个数组长度就是多少,其中每个对象为每次请求的结果数据
4535
- * 每个结果数据格式为{ status: '0', msg: 'success', data: { items: [], total: 1, size: 1, page: 1 }, traceId: 'baba..'}
4536
- * position 必传 为获取Promise.all请求结果的位置
4537
- * changePosition 必传 为搜索表单Form中需要更改数据源的Item项的位置
4538
- * changeSearchForm 必传 为搜索表单Form数据
4539
- * */
4464
+ var Option$1 = Select.Option;
4540
4465
 
4466
+ var AddSelect = function AddSelect(props) {
4467
+ var value = props.value,
4468
+ onChange = props.onChange,
4469
+ _props$selectProps = props.selectProps,
4470
+ selectProps = _props$selectProps === void 0 ? {} : _props$selectProps,
4471
+ _props$modalTableProp = props.modalTableProps,
4472
+ modalTableProps = _props$modalTableProp === void 0 ? {} : _props$modalTableProp,
4473
+ _props$labelInValue = props.labelInValue,
4474
+ labelInValue = _props$labelInValue === void 0 ? false : _props$labelInValue,
4475
+ requestConfig = props.requestConfig,
4476
+ ctx = props.ctx,
4477
+ sourceName = props.sourceName,
4478
+ _props$needModalTable = props.needModalTable,
4479
+ needModalTable = _props$needModalTable === void 0 ? true : _props$needModalTable,
4480
+ _props$getPopupContai = props.getPopupContainer,
4481
+ onSaveCallback = props.onSaveCallback,
4482
+ _props$buttonText = props.buttonText,
4483
+ buttonText = _props$buttonText === void 0 ? '添加' : _props$buttonText,
4484
+ beforeShowModal = props.beforeShowModal;
4541
4485
 
4542
- var formatSource = function formatSource(reData, position, changePosition, changeSearchForm) {
4543
- var _reData$position;
4486
+ var _ref = requestConfig || {},
4487
+ url = _ref.url,
4488
+ otherParams = _ref.otherParams,
4489
+ isMap = _ref.isMap,
4490
+ fixedparameter = _ref.fixedparameter,
4491
+ fieldValToParam = _ref.fieldValToParam,
4492
+ _ref$mappingTextField = _ref.mappingTextField,
4493
+ mappingTextField = _ref$mappingTextField === void 0 ? 'name' : _ref$mappingTextField,
4494
+ mappingTextShowKeyField = _ref.mappingTextShowKeyField,
4495
+ _ref$mappingValueFiel = _ref.mappingValueField,
4496
+ mappingValueField = _ref$mappingValueFiel === void 0 ? 'code' : _ref$mappingValueFiel,
4497
+ mappingTextShowTextField = _ref.mappingTextShowTextField;
4544
4498
 
4545
- var resKeyValue = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : ['code', 'name'];
4546
- var data = reData && ((_reData$position = reData[position]) === null || _reData$position === void 0 ? void 0 : _reData$position.data);
4547
- var list = Array.isArray(data) ? data : (data === null || data === void 0 ? void 0 : data.items) || (data === null || data === void 0 ? void 0 : data.list) || (data === null || data === void 0 ? void 0 : data.children) || [];
4548
- var formatData = (list === null || list === void 0 ? void 0 : list.length) ? list.map(function (v) {
4549
- return {
4550
- text: v[resKeyValue[1]],
4551
- value: v[resKeyValue[0]]
4552
- };
4553
- }) : [];
4554
- changeSearchForm[changePosition] = _objectSpread2(_objectSpread2({}, changeSearchForm[changePosition]), {}, {
4555
- initialSource: formatData
4556
- });
4557
- }; // 格式化树选择器数据源
4499
+ var resultSourceKey = sourceName || (requestConfig === null || requestConfig === void 0 ? void 0 : requestConfig.sourceName) || 'supplierCode';
4500
+ var selectMode = selectProps === null || selectProps === void 0 ? void 0 : selectProps.mode; // 设定当前选择器 为单选或者多选模式 无设定为单选模式(默认)
4558
4501
 
4502
+ var initVal = value || (selectMode ? [] : null);
4503
+ var pageSize = 100; // 下拉框默认分页 条数
4559
4504
 
4560
- var mapSearchTree = function mapSearchTree(treeDataItem, resKeyValue) {
4561
- var haveChildren = Array.isArray(treeDataItem.children) && treeDataItem.children.length > 0;
4562
- return {
4563
- title: treeDataItem[resKeyValue[1]],
4564
- value: treeDataItem[resKeyValue[0]],
4565
- parentId: treeDataItem.parent,
4566
- data: _objectSpread2({}, treeDataItem),
4567
- isLeaf: !haveChildren,
4568
- disabled: haveChildren,
4569
- children: haveChildren ? treeDataItem.children.map(function (i) {
4570
- return mapSearchTree(i, resKeyValue);
4571
- }) : []
4572
- };
4573
- };
4505
+ var tableInitPageSize = 10; // 弹框默认分页 条数
4574
4506
 
4575
- var formatTreeDataSource = function formatTreeDataSource(reData, position, changePosition, changeSearchForm) {
4576
- var _reData$position2;
4507
+ var currentPage = 1;
4508
+ var selectParamsKey = (requestConfig === null || requestConfig === void 0 ? void 0 : requestConfig.filter) || 'qp-codeAndName-like';
4509
+ var selectParamsInitKey = (requestConfig === null || requestConfig === void 0 ? void 0 : requestConfig.filterInit) || selectParamsKey;
4577
4510
 
4578
- var resKeyValue = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : ['id', 'name'];
4579
- var data = reData && ((_reData$position2 = reData[position]) === null || _reData$position2 === void 0 ? void 0 : _reData$position2.data);
4580
- var formatData = data && Array.isArray(data) && data.length && data.map(function (ites) {
4581
- return mapSearchTree(ites, resKeyValue);
4582
- }) || [];
4583
- changeSearchForm[changePosition].field.props.treeData = formatData;
4584
- };
4511
+ var currentSelectProps = _objectSpread2(_objectSpread2({}, selectProps), {}, {
4512
+ // 以下属性不可更改----设计配置项
4513
+ showSearch: false,
4514
+ filterOption: false,
4515
+ allowClear: true,
4516
+ listHeight: 160,
4517
+ optionLabelProp: "label",
4518
+ autoClearSearchValue: false
4519
+ });
4585
4520
 
4586
- var tableSearchForm = [];
4521
+ var _useState = useState([]),
4522
+ _useState2 = _slicedToArray(_useState, 2),
4523
+ items = _useState2[0],
4524
+ setItems = _useState2[1];
4587
4525
 
4588
- var modalTableProps = _objectSpread2({
4589
- modalTableTitle: '',
4590
- tableSearchForm: tableSearchForm,
4591
- tableColumns: []
4592
- }, modalTableBusProps);
4526
+ var _useState3 = useState(1),
4527
+ _useState4 = _slicedToArray(_useState3, 2),
4528
+ scrollPage = _useState4[0],
4529
+ setScrollPage = _useState4[1];
4593
4530
 
4594
- var needModalTable = (modalTableBusProps === null || modalTableBusProps === void 0 ? void 0 : modalTableBusProps.needModalTable) !== undefined ? modalTableBusProps === null || modalTableBusProps === void 0 ? void 0 : modalTableBusProps.needModalTable : true; // 供应商选择器
4531
+ var _useState5 = useState(0),
4532
+ _useState6 = _slicedToArray(_useState5, 2),
4533
+ itemsTotal = _useState6[0],
4534
+ setItemsTotal = _useState6[1];
4535
+
4536
+ var _useState7 = useState(false),
4537
+ _useState8 = _slicedToArray(_useState7, 2),
4538
+ fetching = _useState8[0],
4539
+ setFetching = _useState8[1];
4540
+
4541
+ var _useState9 = useState(''),
4542
+ _useState10 = _slicedToArray(_useState9, 2),
4543
+ searchValue = _useState10[0],
4544
+ setSearchValue = _useState10[1];
4545
+
4546
+ var _useState11 = useState(false),
4547
+ _useState12 = _slicedToArray(_useState11, 2),
4548
+ isModalVisible = _useState12[0],
4549
+ setIsModalVisible = _useState12[1];
4550
+
4551
+ var _useState13 = useState(initVal),
4552
+ _useState14 = _slicedToArray(_useState13, 2),
4553
+ popvalue = _useState14[0],
4554
+ setPopValue = _useState14[1];
4555
+
4556
+ var _useState15 = useState(sourceName),
4557
+ _useState16 = _slicedToArray(_useState15, 2),
4558
+ uniqueValue = _useState16[0],
4559
+ setUniqueValue = _useState16[1];
4560
+
4561
+ var _useDebounceFn = useDebounceFn(function (v) {
4562
+ // 优化搜索参数 支持传多个
4563
+ var searchParams = {};
4564
+
4565
+ if (typeof selectParamsKey === 'string') {
4566
+ searchParams = v ? _defineProperty({}, selectParamsInitKey, initVal) : _defineProperty({}, selectParamsKey, searchValue);
4567
+ }
4568
+
4569
+ if (Array.isArray(selectParamsKey)) {
4570
+ selectParamsKey.forEach(function (i) {
4571
+ searchParams = _objectSpread2(_objectSpread2({}, searchParams), {}, _defineProperty({}, i, searchValue));
4572
+ });
4573
+ } // 防抖函数 待定
4574
+
4575
+
4576
+ getData(searchParams);
4577
+ }, {
4578
+ wait: 1000
4579
+ }),
4580
+ run = _useDebounceFn.run;
4581
+
4582
+ var _Form$useForm = Form.useForm(),
4583
+ _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
4584
+ form = _Form$useForm2[0];
4585
+
4586
+ var _useState17 = useState(modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.tableSearchForm),
4587
+ _useState18 = _slicedToArray(_useState17, 2),
4588
+ tableSearchForm = _useState18[0],
4589
+ setTableSearchForm = _useState18[1];
4590
+
4591
+ var _useState19 = useState(true),
4592
+ _useState20 = _slicedToArray(_useState19, 2),
4593
+ caretLeftFlag = _useState20[0],
4594
+ setCaretLeftFlag = _useState20[1];
4595
+
4596
+ var _useState21 = useState([]),
4597
+ _useState22 = _slicedToArray(_useState21, 2),
4598
+ tableData = _useState22[0],
4599
+ setTableData = _useState22[1];
4600
+
4601
+ var _useState23 = useState({
4602
+ total: 0,
4603
+ size: "small",
4604
+ current: 1,
4605
+ pageSize: tableInitPageSize
4606
+ }),
4607
+ _useState24 = _slicedToArray(_useState23, 2),
4608
+ tablePagination = _useState24[0],
4609
+ setTablePagination = _useState24[1];
4610
+
4611
+ var _useState25 = useState([]),
4612
+ _useState26 = _slicedToArray(_useState25, 2),
4613
+ selectedRowKeys = _useState26[0],
4614
+ setSelectedRowKeys = _useState26[1];
4615
+
4616
+ var _useState27 = useState([]),
4617
+ _useState28 = _slicedToArray(_useState27, 2),
4618
+ doubleArr = _useState28[0],
4619
+ setDoubleArr = _useState28[1]; // 存放双数组的数组
4620
+
4621
+
4622
+ var _useState29 = useState(false),
4623
+ _useState30 = _slicedToArray(_useState29, 2),
4624
+ checkedAll = _useState30[0],
4625
+ setCheckedAll = _useState30[1];
4626
+
4627
+ var _useState31 = useState(false),
4628
+ _useState32 = _slicedToArray(_useState31, 2),
4629
+ indeterminate = _useState32[0],
4630
+ setIndeterminate = _useState32[1];
4631
+
4632
+ var _useState33 = useState({}),
4633
+ _useState34 = _slicedToArray(_useState33, 2),
4634
+ tableFormParams = _useState34[0],
4635
+ setTableFormParams = _useState34[1]; // 获取数据源 (type: 1下拉框 2弹框 不传值默认为下拉框)
4636
+
4637
+
4638
+ var getData = function getData() {
4639
+ var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4640
+ var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
4641
+ if (!requestConfig) return;
4642
+ setFetching(true); // 处理dependence参数
4643
+
4644
+ var fixedParam = {};
4645
+
4646
+ if (fixedparameter && fieldValToParam && ctx) {
4647
+ fixedparameter.forEach(function (item, index) {
4648
+ var fixedParamVal = ctx.form.getFieldValue(fieldValToParam[index]);
4649
+
4650
+ if (fixedParamVal) {
4651
+ fixedParam[item] = fixedParamVal;
4652
+ form.setFieldsValue(_objectSpread2(_objectSpread2({}, form === null || form === void 0 ? void 0 : form.getFieldsValue()), {}, _defineProperty({}, item, fixedParamVal)));
4653
+ }
4654
+ });
4655
+ } // 数组对象处理,对带有特殊标记的name进行处理
4656
+
4657
+
4658
+ for (var key in params) {
4659
+ if (Object.prototype.hasOwnProperty.call(params, key)) {
4660
+ (function () {
4661
+ var element = params[key];
4662
+
4663
+ if (element && key.indexOf('*number*') >= 0) {
4664
+ var dataParams = key.split('*number*');
4665
+ dataParams.forEach(function (value, index) {
4666
+ params[value] = element[index];
4667
+ });
4668
+ delete params[key];
4669
+ } else if (element && key.indexOf('*address*') >= 0) {
4670
+ var _dataParams = key.split('*address*');
4671
+
4672
+ _dataParams.forEach(function (value, index) {
4673
+ params[value] = element.PCDCode[index];
4674
+ });
4675
+
4676
+ delete params[key];
4677
+ } else if (element && key.indexOf('*costType*') >= 0) {
4678
+ var _dataParams2 = key.split('*costType*'); // eslint-disable-next-line prefer-destructuring
4679
+
4680
+
4681
+ params[_dataParams2[0]] = element[1];
4682
+ delete params[key];
4683
+ } else if (element && key.indexOf('*fullDate*') >= 0) {
4684
+ var _dataParams3 = key.split('*fullDate*');
4685
+
4686
+ _dataParams3.forEach(function (value, index) {
4687
+ if (index === 0) {
4688
+ params[value] = moment(element[index]).millisecond(0).second(0).minute(0).hour(0).format('YYYY-MM-DD HH:mm:ss');
4689
+ } else {
4690
+ params[value] = moment(element[index]).millisecond(59).second(59).minute(59).hour(23).format('YYYY-MM-DD HH:mm:ss');
4691
+ }
4692
+ });
4693
+
4694
+ delete params[key];
4695
+ } else if (typeof element === 'boolean' && key.indexOf('*checkBox*') >= 0) {
4696
+ var _dataParams4 = key.split('*checkBox*');
4697
+
4698
+ if (element) {
4699
+ params[_dataParams4[0]] = 0;
4700
+ }
4701
+
4702
+ delete params[key];
4703
+ } else if (element && key.indexOf('*cascader*') >= 0) {
4704
+ var _dataParams5 = key.split('*cascader*');
4705
+
4706
+ params[_dataParams5[0]] = element[element.length - 1];
4707
+ delete params[key];
4708
+ } else if (element && key.indexOf('*date*') >= 0) {
4709
+ var _dataParams6 = key.split('*date*');
4710
+
4711
+ _dataParams6.forEach(function (value, index) {
4712
+ if (index === 0) {
4713
+ params[value] = moment(element[index]).format('YYYY-MM-DD');
4714
+ } else {
4715
+ params[value] = moment(element[index]).format('YYYY-MM-DD');
4716
+ }
4717
+ });
4718
+
4719
+ delete params[key];
4720
+ } else if (element && key.indexOf('*') >= 0) {
4721
+ var _dataParams7 = key.split('*');
4722
+
4723
+ _dataParams7.forEach(function (value, index) {
4724
+ params[value] = element[index].format('YYYY-MM-DD HH:mm:ss');
4725
+ });
4726
+
4727
+ delete params[key];
4728
+ } else if (element && key.indexOf('_selectNumberRange') >= 0) {
4729
+ // key = xxxxx_selectNumberRange qp-xxxxx-gt
4730
+ var _dataParams8 = key.split('_selectNumberRange')[0];
4731
+
4732
+ if (params[key][0] === 'range') {
4733
+ if (params[key][1][0]) {
4734
+ params["qp-".concat(_dataParams8, "-ge")] = params[key][1][0];
4735
+ }
4736
+
4737
+ if (params[key][1][1]) {
4738
+ params["qp-".concat(_dataParams8, "-le")] = params[key][1][1];
4739
+ }
4740
+ } else {
4741
+ params["qp-".concat(_dataParams8, "-").concat(params[key][0])] = params[key][1];
4742
+ }
4743
+
4744
+ delete params[key];
4745
+ } else if (Array.isArray(element)) {
4746
+ params[key] = element.join(',');
4747
+ } else if (element == null || element === undefined || String(element).trim() === '') {
4748
+ delete params[key];
4749
+ }
4750
+ })();
4751
+ }
4752
+ }
4753
+
4754
+ var queryParams = _objectSpread2(_objectSpread2(_objectSpread2({
4755
+ pageSize: pageSize,
4756
+ currentPage: currentPage
4757
+ }, otherParams), fixedParam), params);
4758
+
4759
+ axios.get("".concat(url, "?").concat(stringify(queryParams))).then(function (result) {
4760
+ var _result3, _result4;
4761
+
4762
+ setFetching(false);
4763
+ result = result.data;
4764
+
4765
+ if (((_result3 = result) === null || _result3 === void 0 ? void 0 : _result3.status) && result.status !== '0' || ((_result4 = result) === null || _result4 === void 0 ? void 0 : _result4.code) && result.code !== '000000') {
4766
+ message.error(result.msg);
4767
+ return;
4768
+ }
4769
+
4770
+ var res = result.data;
4771
+ var source = [];
4772
+
4773
+ if (isMap) {
4774
+ source = Object.keys(res).map(function (d, i) {
4775
+ return {
4776
+ text: Object.values(res)[i],
4777
+ value: d
4778
+ };
4779
+ });
4780
+ } else {
4781
+ var keys = res.list ? 'list' : 'items';
4782
+ source = res ? res[keys] ? res[keys].map(function (item) {
4783
+ var _item$packingUnitList, _item$packingUnitList2;
4784
+
4785
+ var textShowText = item[mappingTextField];
4786
+
4787
+ if (mappingTextShowTextField) {
4788
+ textShowText = [];
4789
+
4790
+ if (Array.isArray(mappingTextShowTextField)) {
4791
+ mappingTextShowTextField.forEach(function (r) {
4792
+ textShowText.push(item[r]);
4793
+ });
4794
+ } else {
4795
+ textShowText = item[mappingTextShowTextField];
4796
+ }
4797
+ }
4798
+
4799
+ return _objectSpread2(_objectSpread2({}, item), {}, {
4800
+ text: item[mappingTextField],
4801
+ textShowText: textShowText,
4802
+ textShowKey: item[mappingTextShowKeyField || mappingValueField],
4803
+ value: item[mappingValueField],
4804
+ baseUnitCode: item === null || item === void 0 ? void 0 : (_item$packingUnitList = item.packingUnitList) === null || _item$packingUnitList === void 0 ? void 0 : (_item$packingUnitList2 = _item$packingUnitList.find(function (item) {
4805
+ return item.baseUnit === true;
4806
+ })) === null || _item$packingUnitList2 === void 0 ? void 0 : _item$packingUnitList2.unitCode
4807
+ });
4808
+ }) : Array.isArray(res) && (res === null || res === void 0 ? void 0 : res.map(function (item) {
4809
+ var _item$packingUnitList3, _item$packingUnitList4;
4810
+
4811
+ var textShowText = item[mappingTextField];
4812
+
4813
+ if (mappingTextShowTextField) {
4814
+ textShowText = [];
4815
+
4816
+ if (Array.isArray(mappingTextShowTextField)) {
4817
+ mappingTextShowTextField.forEach(function (r) {
4818
+ textShowText.push(item[r]);
4819
+ });
4820
+ } else {
4821
+ textShowText = item[mappingTextShowTextField];
4822
+ }
4823
+ }
4824
+
4825
+ return _objectSpread2(_objectSpread2({}, item), {}, {
4826
+ text: item[mappingTextField],
4827
+ textShowText: textShowText,
4828
+ textShowKey: item[mappingTextShowKeyField || mappingValueField],
4829
+ value: item[mappingValueField],
4830
+ baseUnitCode: item === null || item === void 0 ? void 0 : (_item$packingUnitList3 = item.packingUnitList) === null || _item$packingUnitList3 === void 0 ? void 0 : (_item$packingUnitList4 = _item$packingUnitList3.find(function (item) {
4831
+ return item.baseUnit === true;
4832
+ })) === null || _item$packingUnitList4 === void 0 ? void 0 : _item$packingUnitList4.unitCode
4833
+ });
4834
+ })) : [];
4835
+ }
4836
+
4837
+ source = Array.isArray(source) ? source : [];
4838
+
4839
+ if (type === 1) {
4840
+ var _ctx$form;
4841
+
4842
+ ctx === null || ctx === void 0 ? void 0 : (_ctx$form = ctx.form) === null || _ctx$form === void 0 ? void 0 : _ctx$form.setFieldSource(resultSourceKey, source);
4843
+ setItems(source);
4844
+ setItemsTotal(Number((res === null || res === void 0 ? void 0 : res.total) || (res === null || res === void 0 ? void 0 : res.totalCount) || source.length));
4845
+ } else {
4846
+ setTableData(source);
4847
+ setTablePagination(_objectSpread2(_objectSpread2({}, tablePagination), {}, {
4848
+ total: Number((res === null || res === void 0 ? void 0 : res.total) || (res === null || res === void 0 ? void 0 : res.totalCount) || source.length),
4849
+ pageSize: Number((res === null || res === void 0 ? void 0 : res.size) || (res === null || res === void 0 ? void 0 : res.pageSize) || (params === null || params === void 0 ? void 0 : params.pageSize) || pageSize),
4850
+ current: Number((res === null || res === void 0 ? void 0 : res.page) || (res === null || res === void 0 ? void 0 : res.currentPage) || (params === null || params === void 0 ? void 0 : params.currentPage) || currentPage)
4851
+ }));
4852
+ }
4853
+ }).catch(function (err) {
4854
+ setFetching(false);
4855
+ });
4856
+ };
4857
+
4858
+ useEffect(function () {
4859
+ Promise.all([loadSelectSource("/items/brand/queryBrandList", {
4860
+ pageSize: 5000,
4861
+ currentPage: 1,
4862
+ 'ctl-withAuth': true
4863
+ }), loadSelectSource("/items/category/queryCategoryTree", {
4864
+ pageSize: 5000,
4865
+ currentPage: 1
4866
+ })]).then(function (x) {
4867
+ formatSource(x, 0, 2, tableSearchForm, ['id', 'name']);
4868
+ formatTreeDataSource(x, 1, 3, tableSearchForm);
4869
+ });
4870
+ }, []);
4871
+ useEffect(function () {
4872
+ if (value) {
4873
+ setPopValue(value);
4874
+ }
4875
+ }, [value]);
4876
+ useEffect(function () {
4877
+ makeUniqueValue();
4878
+ }, [sourceName]);
4879
+
4880
+ var showModal = function showModal() {
4881
+ // getData({ pageSize: tableInitPageSize, currentPage: 1 }, 2)
4882
+ setIsModalVisible(true); // 回显
4883
+
4884
+ if (value) {
4885
+ if (selectMode) {
4886
+ setSelectedRowKeys(labelInValue ? value.map(function (i) {
4887
+ return i.key;
4888
+ }) : value);
4889
+ setPopValue(labelInValue ? value.map(function (i) {
4890
+ return {
4891
+ value: i.key,
4892
+ text: i.label
4893
+ };
4894
+ }) : value.map(function (i) {
4895
+ return {
4896
+ value: i
4897
+ };
4898
+ }));
4899
+ setIndeterminate(!!value.length && value.length < itemsTotal);
4900
+ setCheckedAll(itemsTotal && value.length === itemsTotal); // 需清空数据
4901
+
4902
+ if (!value.length) {
4903
+ setDoubleArr([]);
4904
+ }
4905
+ } else {
4906
+ setSelectedRowKeys(labelInValue ? [value.key] : [value]);
4907
+ setPopValue(labelInValue ? [{
4908
+ value: value.key,
4909
+ text: value.label
4910
+ }] : [{
4911
+ value: value
4912
+ }]);
4913
+ }
4914
+ }
4915
+
4916
+ setTimeout(function () {
4917
+ var _document$getElementB;
4918
+
4919
+ (_document$getElementB = document.getElementById("first-query")) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.focus();
4920
+ }, 50);
4921
+ };
4922
+
4923
+ var handleShowModal = function handleShowModal() {
4924
+ if (beforeShowModal) {
4925
+ beforeShowModal(popvalue).then(function (res) {
4926
+ showModal();
4927
+ }).catch(function (Error) {
4928
+ message.warning(Error);
4929
+ });
4930
+ } else {
4931
+ showModal();
4932
+ }
4933
+ };
4934
+
4935
+ var handleOk = function handleOk(isContinue) {
4936
+ if (!popvalue.length) {
4937
+ message.warning('至少选中一条数据');
4938
+ return;
4939
+ } // handleSelectOver(popvalue)
4940
+
4941
+
4942
+ if (onSaveCallback) {
4943
+ onSaveCallback(popvalue).then(function (res) {
4944
+ {
4945
+ var _document$getElementB2;
4946
+
4947
+ message.success('保存成功');
4948
+ deleteSelectRows();
4949
+ (_document$getElementB2 = document.getElementById('first-query')) === null || _document$getElementB2 === void 0 ? void 0 : _document$getElementB2.focus();
4950
+ !isContinue && handleCancel();
4951
+ }
4952
+ }).catch(function (Error) {
4953
+ message.error(Error);
4954
+ });
4955
+ } else {
4956
+ !isContinue && handleCancel();
4957
+ }
4958
+ };
4959
+
4960
+ var handleCancel = function handleCancel() {
4961
+ form.resetFields();
4962
+ setTableFormParams({});
4963
+ setIsModalVisible(false);
4964
+ setTableData([]); // if (selectMode) {
4965
+ // run();
4966
+ // }
4967
+ };
4968
+
4969
+ var onSearchTable = function onSearchTable() {
4970
+ var params = form.getFieldsValue();
4971
+ setTableFormParams(params);
4972
+ getData(_objectSpread2(_objectSpread2({}, params), {}, {
4973
+ pageSize: tableInitPageSize
4974
+ }), 2);
4975
+
4976
+ if (selectMode) {
4977
+ getData(params);
4978
+ }
4979
+ };
4980
+
4981
+ var onResetTable = function onResetTable() {
4982
+ form.resetFields();
4983
+ setTableFormParams({});
4984
+ getData({
4985
+ pageSize: tableInitPageSize,
4986
+ currentPage: 1
4987
+ }, 2);
4988
+ };
4989
+
4990
+ var handleTableChange = function handleTableChange(pagination) {
4991
+ getData(_objectSpread2(_objectSpread2({}, tableFormParams), {}, {
4992
+ pageSize: pagination.pageSize,
4993
+ currentPage: pagination.current
4994
+ }), 2);
4995
+ }; // 扁平化二维数组的方法
4996
+
4997
+ var onChangeSelectedKeys = function onChangeSelectedKeys(selectKeys, selectRows) {
4998
+ if (selectKeys.length - selectedRowKeys.length > 0) {
4999
+ if (selectKeys.length - selectedRowKeys.length === 1) {
5000
+ selectRows[selectRows.length - 1]['needFocus'] = true;
5001
+ } else {
5002
+ selectRows[selectedRowKeys.length]['needFocus'] = true;
5003
+ }
5004
+ }
5005
+
5006
+ setPopValue(selectRows);
5007
+ setSelectedRowKeys(selectKeys); // setIndeterminate(!!filterRows.length && filterRows.length < tablePagination?.total);
5008
+ // setCheckedAll(filterRows.length === tablePagination?.total);
5009
+ }; // 生成唯一值
5010
+
5011
+
5012
+ var makeUniqueValue = function makeUniqueValue() {
5013
+ var generateUnitKey = ((1 + Math.random()) * 0x10000 | 0).toString(16);
5014
+ setUniqueValue(generateUnitKey);
5015
+ return generateUnitKey;
5016
+ };
5017
+
5018
+ var rowSelection = {
5019
+ type: 'checkbox',
5020
+ selectedRowKeys: selectedRowKeys,
5021
+ preserveSelectedRowKeys: true,
5022
+ onChange: function onChange(sks, srs) {
5023
+ onChangeSelectedKeys(sks, srs);
5024
+ },
5025
+ getCheckboxProps: function getCheckboxProps() {
5026
+ return {
5027
+ disabled: (selectProps === null || selectProps === void 0 ? void 0 : selectProps.disabled) || (props === null || props === void 0 ? void 0 : props.disabled)
5028
+ };
5029
+ }
5030
+ };
5031
+
5032
+ var onDoubleClickSelect = function onDoubleClickSelect(e, record) {
5033
+ if (!selectMode) {
5034
+ var srs = [JSON.parse(JSON.stringify(record))];
5035
+ var sks = srs.map(function (i) {
5036
+ return i.value;
5037
+ });
5038
+ onChangeSelectedKeys(sks, srs);
5039
+ }
5040
+ };
5041
+
5042
+ var themeColor = {
5043
+ color: '#005CFF'
5044
+ };
5045
+
5046
+ var formItem = function formItem(list) {
5047
+ if (isModalVisible && (list === null || list === void 0 ? void 0 : list.length)) {
5048
+ return list.map(function (i, index) {
5049
+ var _i$field, _i$field3, _i$field5, _i$field6, _i$field7;
5050
+
5051
+ if ((i === null || i === void 0 ? void 0 : i.type) === 'select' || (i === null || i === void 0 ? void 0 : (_i$field = i.field) === null || _i$field === void 0 ? void 0 : _i$field.type) === 'select') {
5052
+ var _i$field2, _i$initialSource;
5053
+
5054
+ return /*#__PURE__*/React.createElement(Form.Item, {
5055
+ name: i.name,
5056
+ label: i.label,
5057
+ key: i.name
5058
+ }, /*#__PURE__*/React.createElement(Select, _objectSpread2({
5059
+ style: {
5060
+ width: '100%'
5061
+ },
5062
+ placeholder: "\u8BF7\u9009\u62E9"
5063
+ }, i === null || i === void 0 ? void 0 : (_i$field2 = i.field) === null || _i$field2 === void 0 ? void 0 : _i$field2.props), (i === null || i === void 0 ? void 0 : (_i$initialSource = i.initialSource) === null || _i$initialSource === void 0 ? void 0 : _i$initialSource.length) && (i === null || i === void 0 ? void 0 : i.initialSource.map(function (m) {
5064
+ return /*#__PURE__*/React.createElement(Option$1, {
5065
+ value: m.value,
5066
+ key: m.value
5067
+ }, m.text);
5068
+ }))));
5069
+ }
5070
+
5071
+ if ((i === null || i === void 0 ? void 0 : i.type) === 'treeSelect' || (i === null || i === void 0 ? void 0 : (_i$field3 = i.field) === null || _i$field3 === void 0 ? void 0 : _i$field3.type) === 'treeSelect') {
5072
+ var _i$field4;
5073
+
5074
+ return /*#__PURE__*/React.createElement(Form.Item, {
5075
+ name: i.name,
5076
+ label: i.label,
5077
+ key: i.name
5078
+ }, /*#__PURE__*/React.createElement(TreeSelect, _objectSpread2({
5079
+ style: {
5080
+ width: '100%'
5081
+ },
5082
+ placeholder: "\u8BF7\u9009\u62E9"
5083
+ }, i === null || i === void 0 ? void 0 : (_i$field4 = i.field) === null || _i$field4 === void 0 ? void 0 : _i$field4.props)));
5084
+ }
5085
+
5086
+ if ((i === null || i === void 0 ? void 0 : i.type) === 'BusinessSearchSelect' || (i === null || i === void 0 ? void 0 : (_i$field5 = i.field) === null || _i$field5 === void 0 ? void 0 : _i$field5.type) === 'BusinessSearchSelect') {
5087
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Form.Item, {
5088
+ name: i.name,
5089
+ label: i.label,
5090
+ key: i.name
5091
+ }, /*#__PURE__*/React.createElement(BusinessSearchSelect$1, _objectSpread2({}, i.field.props))));
5092
+ }
5093
+
5094
+ if ((i === null || i === void 0 ? void 0 : i.type) === 'multipleQueryInput' || (i === null || i === void 0 ? void 0 : (_i$field6 = i.field) === null || _i$field6 === void 0 ? void 0 : _i$field6.type) === 'multipleQueryInput') {
5095
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Form.Item, {
5096
+ name: i.name,
5097
+ label: i.label,
5098
+ key: i.name
5099
+ }, /*#__PURE__*/React.createElement(QueryMutipleInput, {
5100
+ onValueChange: function onValueChange(value) {
5101
+ form.setFieldsValue(_defineProperty({}, i.name, value));
5102
+ }
5103
+ })));
5104
+ } // 默认type是input
5105
+
5106
+
5107
+ return /*#__PURE__*/React.createElement(Form.Item, {
5108
+ name: i.name,
5109
+ label: i.label,
5110
+ key: i.name
5111
+ }, /*#__PURE__*/React.createElement(Input, _objectSpread2({
5112
+ id: index === 0 ? "first-query" : 'index',
5113
+ style: {
5114
+ width: '100%'
5115
+ },
5116
+ onKeyDown: function onKeyDown(e) {
5117
+ if (e.keyCode === 13) {
5118
+ onSearchTable();
5119
+ }
5120
+ },
5121
+ placeholder: "\u8BF7\u8F93\u5165",
5122
+ allowClear: true,
5123
+ maxLength: 100
5124
+ }, i === null || i === void 0 ? void 0 : (_i$field7 = i.field) === null || _i$field7 === void 0 ? void 0 : _i$field7.props)));
5125
+ });
5126
+ } else {
5127
+ return null;
5128
+ }
5129
+ };
5130
+
5131
+ var deleteSelectRows = function deleteSelectRows() {
5132
+ setPopValue([]);
5133
+ setSelectedRowKeys([]);
5134
+ };
5135
+
5136
+ var deleteRecord = function deleteRecord(record) {
5137
+ setPopValue(popvalue.filter(function (item) {
5138
+ return item.skuCode !== record.skuCode;
5139
+ }));
5140
+ setSelectedRowKeys(_toConsumableArray(selectedRowKeys.filter(function (item) {
5141
+ return item !== record.skuCode;
5142
+ })));
5143
+ };
5144
+
5145
+ var inputIndex = 0;
5146
+ var selectColumns = [].concat(_toConsumableArray(modalTableProps.selectColumn.map(function (item) {
5147
+ var inputLength = modalTableProps.selectColumn.filter(function (item) {
5148
+ return item.isInputItem;
5149
+ }).length;
5150
+ var currentIndex = inputIndex;
5151
+
5152
+ if (item.isInputItem) {
5153
+ inputIndex++;
5154
+ return _objectSpread2(_objectSpread2({}, item), {}, {
5155
+ render: function render(text, record, index) {
5156
+ // let
5157
+ if (record.needFocus === true && currentIndex === 0) ;
5158
+
5159
+ return /*#__PURE__*/React.createElement(InputNumber, {
5160
+ defaultValue: text || 0,
5161
+ min: 0,
5162
+ autoFocus: record.needFocus,
5163
+ keyboard: false,
5164
+ onChange: function onChange(value) {
5165
+ record[item.dataIndex] = value;
5166
+ },
5167
+ // onFocus={(e)=> {
5168
+ // let dom1 = e.currentTarget;
5169
+ // dom1.setSelectionRange(100, 0);
5170
+ // dom1.select(text);
5171
+ // }}
5172
+ onKeyDown: function onKeyDown(e) {
5173
+ if (e.keyCode === 13 && e.ctrlKey) {
5174
+ var _document$getElementB3;
5175
+
5176
+ handleOk(true);
5177
+ (_document$getElementB3 = document.getElementById("first-query")) === null || _document$getElementB3 === void 0 ? void 0 : _document$getElementB3.focus();
5178
+ }
5179
+
5180
+ if (e.keyCode === 8 && e.ctrlKey) {
5181
+ var _e$nativeEvent$path$;
5182
+
5183
+ message.success('删除当前行');
5184
+ e.stopPropagation();
5185
+ e.preventDefault();
5186
+ var dom = (_e$nativeEvent$path$ = e.nativeEvent.path[5].children[index + 2]) === null || _e$nativeEvent$path$ === void 0 ? void 0 : _e$nativeEvent$path$.getElementsByTagName('input')[currentIndex];
5187
+
5188
+ if (dom) {
5189
+ dom.select();
5190
+ dom.focus();
5191
+ dom.scrollIntoView(false);
5192
+ }
5193
+
5194
+ dom = null;
5195
+ deleteRecord(record);
5196
+ }
5197
+
5198
+ if (e.keyCode === 37 && e.shiftKey) {
5199
+ var _e$nativeEvent$path$2;
5200
+
5201
+ // 左滑动
5202
+ e.stopPropagation();
5203
+ e.preventDefault();
5204
+
5205
+ var _dom = (_e$nativeEvent$path$2 = e.nativeEvent.path[5].children[index + 1]) === null || _e$nativeEvent$path$2 === void 0 ? void 0 : _e$nativeEvent$path$2.getElementsByTagName('input')[currentIndex - 1];
5206
+
5207
+ if (_dom) {
5208
+ _dom.select();
5209
+
5210
+ _dom.focus();
5211
+
5212
+ _dom.scrollIntoView(false);
5213
+ }
5214
+
5215
+ _dom = null;
5216
+ }
5217
+
5218
+ if (e.keyCode === 39 && e.shiftKey) {
5219
+ var _e$nativeEvent$path$3;
5220
+
5221
+ // 右滑
5222
+ e.stopPropagation();
5223
+ e.preventDefault();
5224
+
5225
+ var _dom2 = (_e$nativeEvent$path$3 = e.nativeEvent.path[5].children[index + 1]) === null || _e$nativeEvent$path$3 === void 0 ? void 0 : _e$nativeEvent$path$3.getElementsByTagName('input')[currentIndex + 1];
5226
+
5227
+ if (_dom2) {
5228
+ _dom2.select();
5229
+
5230
+ _dom2.focus();
5231
+
5232
+ _dom2.scrollIntoView(false);
5233
+ }
5234
+
5235
+ _dom2 = null;
5236
+ }
5237
+
5238
+ if (e.keyCode === 40) {
5239
+ var _e$nativeEvent$path$4;
5240
+
5241
+ e.stopPropagation();
5242
+ e.preventDefault();
5243
+
5244
+ var _dom3 = (_e$nativeEvent$path$4 = e.nativeEvent.path[5].children[index + 2]) === null || _e$nativeEvent$path$4 === void 0 ? void 0 : _e$nativeEvent$path$4.getElementsByTagName('input')[currentIndex];
5245
+
5246
+ if (_dom3) {
5247
+ _dom3.select();
5248
+
5249
+ _dom3.focus();
5250
+
5251
+ _dom3.scrollIntoView(false);
5252
+ }
5253
+
5254
+ _dom3 = null;
5255
+ } else if (e.keyCode === 38) {
5256
+ var _e$nativeEvent$path$5;
5257
+
5258
+ e.stopPropagation();
5259
+ e.preventDefault();
5260
+ var dom1 = (_e$nativeEvent$path$5 = e.nativeEvent.path[5].children[index]) === null || _e$nativeEvent$path$5 === void 0 ? void 0 : _e$nativeEvent$path$5.getElementsByTagName('input')[currentIndex];
5261
+
5262
+ if (dom1) {
5263
+ // dom1.value=""
5264
+ // dom1.setSelectionRange(100, 0);
5265
+ dom1.select();
5266
+ dom1.focus();
5267
+ dom1.scrollIntoViewIfNeeded(false); // dom1.value=record['count']
5268
+ }
5269
+
5270
+ dom1 = null;
5271
+ } else if (e.keyCode === 9 && index === selectedRowKeys.length - 1 && currentIndex === inputLength - 1) {
5272
+ e.stopPropagation();
5273
+ e.preventDefault();
5274
+ }
5275
+ }
5276
+ });
5277
+ }
5278
+ });
5279
+ }
5280
+
5281
+ return item;
5282
+ })), [{
5283
+ title: '操作',
5284
+ width: 50,
5285
+ fixed: 'right',
5286
+ render: function render(text, record, index) {
5287
+ return /*#__PURE__*/React.createElement("span", {
5288
+ style: {
5289
+ cursor: 'pointer',
5290
+ color: '#005CFF'
5291
+ },
5292
+ onClick: function onClick() {
5293
+ deleteRecord(record);
5294
+ },
5295
+ type: "text"
5296
+ }, "\u5220\u9664");
5297
+ }
5298
+ }]);
5299
+ return /*#__PURE__*/React.createElement("div", {
5300
+ className: 'add_select'
5301
+ }, /*#__PURE__*/React.createElement("div", {
5302
+ className: "add_select_show",
5303
+ id: "add_select_div_".concat(uniqueValue)
5304
+ }, /*#__PURE__*/React.createElement(Button, {
5305
+ onClick: handleShowModal,
5306
+ type: "primary"
5307
+ }, buttonText)), needModalTable && isModalVisible && /*#__PURE__*/React.createElement(Modal, {
5308
+ width: '1200px',
5309
+ style: {
5310
+ top: 20
5311
+ },
5312
+ bodyStyle: {
5313
+ padding: '0px'
5314
+ },
5315
+ // title={modalTableProps?.modalTableTitle}
5316
+ visible: isModalVisible,
5317
+ onOk: handleOk,
5318
+ closable: false,
5319
+ onCancel: handleCancel,
5320
+ footer: selectMode ? [/*#__PURE__*/React.createElement(Button, {
5321
+ key: "back",
5322
+ onClick: handleCancel
5323
+ }, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(Button, {
5324
+ key: "submit",
5325
+ style: {
5326
+ color: '#005CFF',
5327
+ borderColor: '#005CFF'
5328
+ },
5329
+ onClick: function onClick() {
5330
+ handleOk(true);
5331
+ },
5332
+ disabled: !tableData.length || (selectProps === null || selectProps === void 0 ? void 0 : selectProps.disabled) || (props === null || props === void 0 ? void 0 : props.disabled)
5333
+ }, "\u4FDD\u5B58\u5E76\u7EE7\u7EED"), /*#__PURE__*/React.createElement(Button, {
5334
+ key: "submit",
5335
+ type: "primary",
5336
+ onClick: function onClick() {
5337
+ handleOk(false);
5338
+ },
5339
+ disabled: !tableData.length || (selectProps === null || selectProps === void 0 ? void 0 : selectProps.disabled) || (props === null || props === void 0 ? void 0 : props.disabled)
5340
+ }, "\u786E\u5B9A")] : null
5341
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
5342
+ className: 'add_select_header'
5343
+ }, modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.modalTableTitle, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("span", null, "*"), " \xA0\u5FEB\u6377\u952E\uFF1A\u3010Tab\u3011-\u8DF3\u683C\u5207\u6362\uFF1B\u3010Shift+\u2190\u3001\u2192\u3011-\u5F53\u524D\u884C\u5DE6\u3001\u53F3\u79FB\u52A8\uFF1B\u3010 \u2191\u3001\u2193\u3011-\u5F53\u524D\u5217\u4E0A\u3001\u4E0B\u79FB\u52A8\uFF1B\u3010ctrl+Enter\u3011-\u4FDD\u5B58\u5E76\u7EE7\u7EED\uFF1B\u3010ctrl+Delete\u3011-\u5220\u9664\u5F53\u524D\u884C\uFF1B"), /*#__PURE__*/React.createElement("span", {
5344
+ className: 'add_select_header_close'
5345
+ }, /*#__PURE__*/React.createElement(CloseCircleOutlined$2, {
5346
+ style: {
5347
+ fontSize: '20px'
5348
+ },
5349
+ onClick: handleCancel
5350
+ }))), /*#__PURE__*/React.createElement("div", {
5351
+ className: 'add_select_wrapper'
5352
+ }, /*#__PURE__*/React.createElement("div", {
5353
+ className: caretLeftFlag ? 'add_select_wrapper_left' : 'add_select_wrapper_left1'
5354
+ }, /*#__PURE__*/React.createElement("div", {
5355
+ className: 'select_list_columns'
5356
+ }, /*#__PURE__*/React.createElement("div", {
5357
+ className: 'select_list_columns_formItems'
5358
+ }, /*#__PURE__*/React.createElement(Form, {
5359
+ form: form,
5360
+ layout: 'vertical',
5361
+ key: 'modalForm'
5362
+ }, formItem(tableSearchForm)))), /*#__PURE__*/React.createElement("div", {
5363
+ className: 'select_list_searchButton'
5364
+ }, /*#__PURE__*/React.createElement(Button, {
5365
+ key: 'reset',
5366
+ className: 'select_list_button_space',
5367
+ onClick: onResetTable
5368
+ }, "\u91CD\u7F6E"), /*#__PURE__*/React.createElement(Button, {
5369
+ key: 'search',
5370
+ type: "primary",
5371
+ onClick: onSearchTable
5372
+ }, "\u67E5\u8BE2"))), /*#__PURE__*/React.createElement("div", {
5373
+ className: caretLeftFlag ? 'add_select_wrapper_right' : 'add_select_wrapper_right1'
5374
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
5375
+ className: 'select_list_selectTips'
5376
+ }, /*#__PURE__*/React.createElement("div", {
5377
+ style: {
5378
+ marginLeft: 8
5379
+ }
5380
+ }, "\u641C\u7D22\u7ED3\u679C\u5171\xA0", /*#__PURE__*/React.createElement("span", {
5381
+ style: themeColor
5382
+ }, (tablePagination === null || tablePagination === void 0 ? void 0 : tablePagination.total) || 0), "\xA0\u9879", selectMode ? /*#__PURE__*/React.createElement("span", null, "\uFF0C \u672C\u6B21\u5DF2\u9009\xA0", /*#__PURE__*/React.createElement("span", {
5383
+ style: themeColor
5384
+ }, (selectedRowKeys === null || selectedRowKeys === void 0 ? void 0 : selectedRowKeys.length) || 0), "\xA0\u9879") : '')), /*#__PURE__*/React.createElement(Table, {
5385
+ size: 'small',
5386
+ rowSelection: rowSelection,
5387
+ columns: _toConsumableArray(modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.tableColumns),
5388
+ dataSource: tableData,
5389
+ pagination: tablePagination,
5390
+ loading: fetching,
5391
+ onChange: handleTableChange,
5392
+ rowKey: mappingValueField,
5393
+ rowClassName: 'row-class',
5394
+ scroll: {
5395
+ y: 500
5396
+ }
5397
+ })))), /*#__PURE__*/React.createElement("div", {
5398
+ className: 'add_select_wrapper_select'
5399
+ }, /*#__PURE__*/React.createElement("div", {
5400
+ className: 'select_list_selectTips'
5401
+ }, /*#__PURE__*/React.createElement("div", {
5402
+ style: {
5403
+ marginLeft: 8
5404
+ }
5405
+ }, /*#__PURE__*/React.createElement("span", null, "\u672C\u6B21\u5DF2\u9009\xA0", /*#__PURE__*/React.createElement("span", {
5406
+ style: themeColor
5407
+ }, (selectedRowKeys === null || selectedRowKeys === void 0 ? void 0 : selectedRowKeys.length) || 0), "\xA0\u9879")), /*#__PURE__*/React.createElement("div", {
5408
+ style: {
5409
+ marginRight: 8
5410
+ }
5411
+ }, /*#__PURE__*/React.createElement("span", {
5412
+ onClick: deleteSelectRows,
5413
+ style: _objectSpread2(_objectSpread2({}, themeColor), {}, {
5414
+ cursor: 'pointer'
5415
+ })
5416
+ }, "\u6E05\u7A7A\u6240\u9009\u5546\u54C1"))), /*#__PURE__*/React.createElement(Table, {
5417
+ size: 'small',
5418
+ // rowSelection={rowSelection}
5419
+ columns: selectColumns,
5420
+ dataSource: popvalue,
5421
+ pagination: false,
5422
+ // onChange={handleTableChange}
5423
+ rowKey: mappingValueField,
5424
+ rowClassName: 'row-class',
5425
+ scroll: {
5426
+ y: 500
5427
+ },
5428
+ onRow: function onRow(record) {
5429
+ return {
5430
+ onDoubleClick: function onDoubleClick(event) {
5431
+ return onDoubleClickSelect(event, record);
5432
+ }
5433
+ };
5434
+ }
5435
+ })))));
5436
+ };
5437
+
5438
+ var shopFileType = [{
5439
+ text: "线上",
5440
+ value: 'online'
5441
+ }, {
5442
+ text: "线下",
5443
+ value: 'offline'
5444
+ }];
5445
+ var shopFile2Type = [{
5446
+ text: "第三方线上",
5447
+ value: 'online'
5448
+ }, {
5449
+ text: "线下",
5450
+ value: 'offline'
5451
+ }, {
5452
+ text: "自营B2B",
5453
+ value: 'B2B'
5454
+ }, {
5455
+ text: "自营B2C",
5456
+ value: 'B2C'
5457
+ }];
5458
+ var arrivalPaySupportList = [{
5459
+ text: "支持",
5460
+ value: 1
5461
+ }, {
5462
+ text: "不支持",
5463
+ value: 0
5464
+ }];
5465
+ var sharingType = [{
5466
+ text: "共享",
5467
+ value: '10'
5468
+ }, {
5469
+ text: "私有",
5470
+ value: '20'
5471
+ }];
5472
+
5473
+ var getDicData = function getDicData(dicCode) {
5474
+ var dicData = {};
5475
+
5476
+ {
5477
+ var storageDic = localStorage.getItem('dicData') ? JSON.parse(localStorage.getItem('dicData') || '{}') : {};
5478
+ dicData = storageDic[dicCode];
5479
+ } // @ts-ignore
5480
+
5481
+
5482
+ if (!dicData || !dicData.length) ;
5483
+
5484
+ return dicData;
5485
+ };
5486
+
5487
+ var getDictionarySource = function getDictionarySource(dicCode) {
5488
+ var needConvertInterger = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
5489
+ var dicData = getDicData(dicCode);
5490
+
5491
+ try {
5492
+ if (needConvertInterger) {
5493
+ // @ts-ignore
5494
+ dicData = dicData.map(function (item) {
5495
+ return _objectSpread2(_objectSpread2({}, item), {}, {
5496
+ value: parseFloat(item.value)
5497
+ });
5498
+ });
5499
+ }
5500
+ } catch (e) {}
5501
+
5502
+ return dicData;
5503
+ };
5504
+
5505
+ var getDictionaryTextByValue = function getDictionaryTextByValue(dicCode, value) {
5506
+ var dicData = getDicData(dicCode);
5507
+ if (value === undefined) return ''; // @ts-ignore
5508
+
5509
+ var dicItemArray = dicData === null || dicData === void 0 ? void 0 : dicData.filter(function (item) {
5510
+ return item.value === value.toString();
5511
+ });
5512
+
5513
+ if (!(dicItemArray === null || dicItemArray === void 0 ? void 0 : dicItemArray.length)) {
5514
+ // throw new Error(`当前${dicCode}字典值合没有${value}的数据`)
5515
+ return value;
5516
+ }
5517
+
5518
+ return dicItemArray[0].text;
5519
+ };
5520
+
5521
+ var loadSelectSource$1 = function loadSelectSource(url, params) {
5522
+ return new Promise(function (resolve, reject) {
5523
+ axios.get("".concat(url, "?").concat(stringify(params))).then(function (result) {
5524
+ var _result, _result2;
5525
+
5526
+ result = result.data;
5527
+
5528
+ if (((_result = result) === null || _result === void 0 ? void 0 : _result.status) && result.status !== '0' || ((_result2 = result) === null || _result2 === void 0 ? void 0 : _result2.code) && result.code !== '000000') {
5529
+ message.error(result.msg);
5530
+ return;
5531
+ }
5532
+
5533
+ resolve(result);
5534
+ }).catch(function (err) {
5535
+ reject(err);
5536
+ });
5537
+ });
5538
+ };
5539
+
5540
+ var handleDefaultPrefixUrl = function handleDefaultPrefixUrl(type) {
5541
+ var result;
5542
+
5543
+ switch (type) {
5544
+ case 'supplier2':
5545
+ case 'customer2':
5546
+ case 'shopFile2':
5547
+ result = '/channel-manage';
5548
+ break;
5549
+
5550
+ case 'skuCommodity':
5551
+ case 'skuPropertyValue':
5552
+ case 'spuCommodity':
5553
+ result = '/items';
5554
+ break;
5555
+
5556
+ case 'physicalWarehouse':
5557
+ case 'realWarehouse':
5558
+ case 'virtualWarehouse':
5559
+ case 'channelWarehouse':
5560
+ result = '/stock';
5561
+ break;
5562
+
5563
+ case 'inventoryOrg2':
5564
+ case 'purchaseOrg':
5565
+ case 'salesOrg':
5566
+ case 'employee2':
5567
+ result = '/user';
5568
+ break;
5569
+
5570
+ case 'deliveryMode':
5571
+ result = '/basic';
5572
+ break;
5573
+
5574
+ default:
5575
+ result = '/bop/api';
5576
+ break;
5577
+ }
5578
+
5579
+ return result;
5580
+ };
5581
+
5582
+ var _getDictionarySource;
5583
+ var hasDictSharingType = (_getDictionarySource = getDictionarySource('UC000013')) === null || _getDictionarySource === void 0 ? void 0 : _getDictionarySource.length;
5584
+ var sharingTypeDataList = hasDictSharingType && getDictionarySource('UC000013') || sharingType;
5585
+ function commonFun(type, prefixUrl, requestConfigProp, modalTableBusProps) {
5586
+ // 默认type === 'supplier' 供应商选择器
5587
+ var requestConfig = _objectSpread2({
5588
+ url: "".concat(prefixUrl.selectPrefix, "/supplier"),
5589
+ filter: 'qp-name,code-orGroup,like',
5590
+ otherParams: {
5591
+ sorter: 'desc-id'
5592
+ }
5593
+ }, requestConfigProp);
5594
+ /*
5595
+ * 处理 格式化下拉框数据源
5596
+ * reData 必传 promise返回响应的数据 格式为[{},{},{},...] Promise.all第一个参数数组有多少个数组长度就是多少,其中每个对象为每次请求的结果数据
5597
+ * 每个结果数据格式为{ status: '0', msg: 'success', data: { items: [], total: 1, size: 1, page: 1 }, traceId: 'baba..'}
5598
+ * position 必传 为获取Promise.all请求结果的位置
5599
+ * changePosition 必传 为搜索表单Form中需要更改数据源的Item项的位置
5600
+ * changeSearchForm 必传 为搜索表单Form数据
5601
+ * */
5602
+
5603
+
5604
+ var formatSource = function formatSource(reData, position, changePosition, changeSearchForm) {
5605
+ var _reData$position;
5606
+
5607
+ var resKeyValue = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : ['code', 'name'];
5608
+ var data = reData && ((_reData$position = reData[position]) === null || _reData$position === void 0 ? void 0 : _reData$position.data);
5609
+ var list = Array.isArray(data) ? data : (data === null || data === void 0 ? void 0 : data.items) || (data === null || data === void 0 ? void 0 : data.list) || (data === null || data === void 0 ? void 0 : data.children) || [];
5610
+ var formatData = (list === null || list === void 0 ? void 0 : list.length) ? list.map(function (v) {
5611
+ return {
5612
+ text: v[resKeyValue[1]],
5613
+ value: v[resKeyValue[0]]
5614
+ };
5615
+ }) : [];
5616
+ changeSearchForm[changePosition] = _objectSpread2(_objectSpread2({}, changeSearchForm[changePosition]), {}, {
5617
+ initialSource: formatData
5618
+ });
5619
+ }; // 格式化树选择器数据源
5620
+
5621
+
5622
+ var mapSearchTree = function mapSearchTree(treeDataItem, resKeyValue) {
5623
+ var haveChildren = Array.isArray(treeDataItem.children) && treeDataItem.children.length > 0;
5624
+ return {
5625
+ title: treeDataItem[resKeyValue[1]],
5626
+ value: treeDataItem[resKeyValue[0]],
5627
+ parentId: treeDataItem.parent,
5628
+ data: _objectSpread2({}, treeDataItem),
5629
+ isLeaf: !haveChildren,
5630
+ disabled: haveChildren,
5631
+ children: haveChildren ? treeDataItem.children.map(function (i) {
5632
+ return mapSearchTree(i, resKeyValue);
5633
+ }) : []
5634
+ };
5635
+ };
5636
+
5637
+ var formatTreeDataSource = function formatTreeDataSource(reData, position, changePosition, changeSearchForm) {
5638
+ var _reData$position2;
5639
+
5640
+ var resKeyValue = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : ['id', 'name'];
5641
+ var data = reData && ((_reData$position2 = reData[position]) === null || _reData$position2 === void 0 ? void 0 : _reData$position2.data);
5642
+ var formatData = data && Array.isArray(data) && data.length && data.map(function (ites) {
5643
+ return mapSearchTree(ites, resKeyValue);
5644
+ }) || [];
5645
+ changeSearchForm[changePosition].field.props.treeData = formatData;
5646
+ };
5647
+
5648
+ var tableSearchForm = [];
5649
+
5650
+ var modalTableProps = _objectSpread2({
5651
+ modalTableTitle: '',
5652
+ tableSearchForm: tableSearchForm,
5653
+ tableColumns: []
5654
+ }, modalTableBusProps);
5655
+
5656
+ var needModalTable = (modalTableBusProps === null || modalTableBusProps === void 0 ? void 0 : modalTableBusProps.needModalTable) !== undefined ? modalTableBusProps === null || modalTableBusProps === void 0 ? void 0 : modalTableBusProps.needModalTable : true; // 供应商选择器
4595
5657
 
4596
5658
  if (type === 'supplier') {
4597
5659
  tableSearchForm = [{
@@ -4663,14 +5725,14 @@ function commonFun(type, prefixUrl, requestConfigProp, modalTableBusProps) {
4663
5725
  label: '共享类型',
4664
5726
  initialSource: sharingTypeDataList
4665
5727
  }];
4666
- Promise.all([loadSelectSource("".concat(prefixUrl.formSelectFix, "/company"), {
5728
+ Promise.all([loadSelectSource$1("".concat(prefixUrl.formSelectFix, "/company"), {
4667
5729
  pageSize: 5000,
4668
5730
  currentPage: 1,
4669
5731
  'qp-companyType-eq': '30'
4670
- }), loadSelectSource("".concat(prefixUrl.formSelectFix, "/accountingSubject"), {
5732
+ }), loadSelectSource$1("".concat(prefixUrl.formSelectFix, "/accountingSubject"), {
4671
5733
  pageSize: 5000,
4672
5734
  currentPage: 1
4673
- }), loadSelectSource("".concat(prefixUrl.formSelectFix, "/company"), {
5735
+ }), loadSelectSource$1("".concat(prefixUrl.formSelectFix, "/company"), {
4674
5736
  pageSize: 5000,
4675
5737
  currentPage: 1,
4676
5738
  'qp-companyType-eq': '20'
@@ -4758,7 +5820,7 @@ function commonFun(type, prefixUrl, requestConfigProp, modalTableBusProps) {
4758
5820
  }
4759
5821
  }
4760
5822
  }];
4761
- Promise.all([loadSelectSource("".concat(prefixUrl.formSelectFix, "/org/listNoPage"), {}), loadSelectSource("".concat(prefixUrl.formSelectFix, "/org/listNoPage"), {})]).then(function (x) {
5823
+ Promise.all([loadSelectSource$1("".concat(prefixUrl.formSelectFix, "/org/listNoPage"), {}), loadSelectSource$1("".concat(prefixUrl.formSelectFix, "/org/listNoPage"), {})]).then(function (x) {
4762
5824
  formatSource(x, 0, 2, tableSearchForm);
4763
5825
  formatSource(x, 1, 3, tableSearchForm);
4764
5826
  });
@@ -4988,14 +6050,14 @@ function commonFun(type, prefixUrl, requestConfigProp, modalTableBusProps) {
4988
6050
  }
4989
6051
  }
4990
6052
  }];
4991
- Promise.all([loadSelectSource("".concat(prefixUrl.formSelectFix, "/brand/queryBrandList"), {
6053
+ Promise.all([loadSelectSource$1("".concat(prefixUrl.formSelectFix, "/brand/queryBrandList"), {
4992
6054
  pageSize: 5000,
4993
6055
  currentPage: 1,
4994
6056
  'ctl-withAuth': true
4995
- }), loadSelectSource("".concat(prefixUrl.formSelectFix, "/category/queryCategoryTree"), {
6057
+ }), loadSelectSource$1("".concat(prefixUrl.formSelectFix, "/category/queryCategoryTree"), {
4996
6058
  pageSize: 5000,
4997
6059
  currentPage: 1
4998
- }), loadSelectSource("".concat(prefixUrl.formSelectFix, "/class/withProperty"), {
6060
+ }), loadSelectSource$1("".concat(prefixUrl.formSelectFix, "/class/withProperty"), {
4999
6061
  pageSize: 5000,
5000
6062
  currentPage: 1
5001
6063
  })]).then(function (x) {
@@ -5151,14 +6213,14 @@ function commonFun(type, prefixUrl, requestConfigProp, modalTableBusProps) {
5151
6213
  }
5152
6214
  }
5153
6215
  }];
5154
- Promise.all([loadSelectSource("".concat(prefixUrl.formSelectFix, "/brand/queryBrandList"), {
6216
+ Promise.all([loadSelectSource$1("".concat(prefixUrl.formSelectFix, "/brand/queryBrandList"), {
5155
6217
  pageSize: 5000,
5156
6218
  currentPage: 1,
5157
6219
  'ctl-withAuth': true
5158
- }), loadSelectSource("".concat(prefixUrl.formSelectFix, "/category/queryCategoryTree"), {
6220
+ }), loadSelectSource$1("".concat(prefixUrl.formSelectFix, "/category/queryCategoryTree"), {
5159
6221
  pageSize: 5000,
5160
6222
  currentPage: 1
5161
- }), loadSelectSource("".concat(prefixUrl.formSelectFix, "/class/withProperty"), {
6223
+ }), loadSelectSource$1("".concat(prefixUrl.formSelectFix, "/class/withProperty"), {
5162
6224
  pageSize: 5000,
5163
6225
  currentPage: 1
5164
6226
  })]).then(function (x) {
@@ -5249,7 +6311,7 @@ function commonFun(type, prefixUrl, requestConfigProp, modalTableBusProps) {
5249
6311
  }
5250
6312
  }
5251
6313
  }];
5252
- Promise.all([loadSelectSource("".concat(prefixUrl.formSelectFix, "/company"), {
6314
+ Promise.all([loadSelectSource$1("".concat(prefixUrl.formSelectFix, "/company"), {
5253
6315
  pageSize: 5000,
5254
6316
  currentPage: 1,
5255
6317
  'qp-companyType-eq': 20
@@ -5437,14 +6499,14 @@ function commonFun(type, prefixUrl, requestConfigProp, modalTableBusProps) {
5437
6499
  label: '共享类型',
5438
6500
  initialSource: sharingTypeDataList
5439
6501
  }];
5440
- Promise.all([loadSelectSource("".concat(prefixUrl.formSelectFix, "/company"), {
6502
+ Promise.all([loadSelectSource$1("".concat(prefixUrl.formSelectFix, "/company"), {
5441
6503
  pageSize: 5000,
5442
6504
  currentPage: 1,
5443
6505
  'qp-companyType-eq': '30'
5444
- }), loadSelectSource("".concat(prefixUrl.formSelectFix, "/accountingSubject"), {
6506
+ }), loadSelectSource$1("".concat(prefixUrl.formSelectFix, "/accountingSubject"), {
5445
6507
  pageSize: 5000,
5446
6508
  currentPage: 1
5447
- }), loadSelectSource("".concat(prefixUrl.formSelectFix, "/company"), {
6509
+ }), loadSelectSource$1("".concat(prefixUrl.formSelectFix, "/company"), {
5448
6510
  pageSize: 5000,
5449
6511
  currentPage: 1,
5450
6512
  'qp-companyType-eq': '20'
@@ -5542,7 +6604,7 @@ function commonFun(type, prefixUrl, requestConfigProp, modalTableBusProps) {
5542
6604
  }
5543
6605
  }
5544
6606
  }];
5545
- Promise.all([loadSelectSource("".concat(prefixUrl.formSelectFix, "/org/listNoPage"), {}), loadSelectSource("".concat(prefixUrl.formSelectFix, "/org/listNoPage"), {})]).then(function (x) {
6607
+ Promise.all([loadSelectSource$1("".concat(prefixUrl.formSelectFix, "/org/listNoPage"), {}), loadSelectSource$1("".concat(prefixUrl.formSelectFix, "/org/listNoPage"), {})]).then(function (x) {
5546
6608
  formatSource(x, 0, 2, tableSearchForm);
5547
6609
  formatSource(x, 1, 3, tableSearchForm);
5548
6610
  });
@@ -5665,19 +6727,19 @@ function commonFun(type, prefixUrl, requestConfigProp, modalTableBusProps) {
5665
6727
  }
5666
6728
  }
5667
6729
  }];
5668
- Promise.all([loadSelectSource("".concat(prefixUrl.formSelectFix, "/company"), {
6730
+ Promise.all([loadSelectSource$1("".concat(prefixUrl.formSelectFix, "/company"), {
5669
6731
  pageSize: 5000,
5670
6732
  currentPage: 1,
5671
6733
  'qp-companyType-eq': '30'
5672
- }), loadSelectSource("".concat(prefixUrl.formSelectFix, "/company"), {
6734
+ }), loadSelectSource$1("".concat(prefixUrl.formSelectFix, "/company"), {
5673
6735
  pageSize: 5000,
5674
6736
  currentPage: 1,
5675
6737
  'qp-companyType-eq': '20'
5676
- }), loadSelectSource("".concat(prefixUrl.formSelectFix, "/platformRecord/getPlatformRecordList"), {
6738
+ }), loadSelectSource$1("".concat(prefixUrl.formSelectFix, "/platformRecord/getPlatformRecordList"), {
5677
6739
  // pageSize: 5000,
5678
6740
  // currentPage: 1,
5679
6741
  'qp-status-eq': '1'
5680
- }), loadSelectSource("".concat(prefixUrl.formSelectFix, "/accountingSubject"), {
6742
+ }), loadSelectSource$1("".concat(prefixUrl.formSelectFix, "/accountingSubject"), {
5681
6743
  pageSize: 5000,
5682
6744
  currentPage: 1
5683
6745
  })]).then(function (x) {
@@ -5765,7 +6827,7 @@ function commonFun(type, prefixUrl, requestConfigProp, modalTableBusProps) {
5765
6827
  }
5766
6828
  }
5767
6829
  }];
5768
- Promise.all([loadSelectSource("".concat(prefixUrl.formSelectFix, "/orgView/getTree/sales-organizational-view"), {
6830
+ Promise.all([loadSelectSource$1("".concat(prefixUrl.formSelectFix, "/orgView/getTree/sales-organizational-view"), {
5769
6831
  'qp-employeeCode-eq': (_JSON$parse = JSON.parse(localStorage.getItem('userInfo') || '{}')) === null || _JSON$parse === void 0 ? void 0 : (_JSON$parse$employeeR = _JSON$parse.employeeResVo) === null || _JSON$parse$employeeR === void 0 ? void 0 : _JSON$parse$employeeR.employeeNumber,
5770
6832
  'qp-realOrg-eq': true,
5771
6833
  'qp-status-eq': 10
@@ -5892,7 +6954,7 @@ function commonFun(type, prefixUrl, requestConfigProp, modalTableBusProps) {
5892
6954
  name: 'qp-officeTelephone-like',
5893
6955
  label: '手机号'
5894
6956
  }];
5895
- Promise.all([loadSelectSource("".concat(prefixUrl.formSelectFix, "/company"), {
6957
+ Promise.all([loadSelectSource$1("".concat(prefixUrl.formSelectFix, "/company"), {
5896
6958
  pageSize: 5000,
5897
6959
  currentPage: 1,
5898
6960
  'qp-companyType-eq': 20
@@ -5967,7 +7029,7 @@ function commonFun(type, prefixUrl, requestConfigProp, modalTableBusProps) {
5967
7029
  name: 'qp-officeTelephone-like',
5968
7030
  label: '手机号'
5969
7031
  }];
5970
- Promise.all([loadSelectSource("".concat(prefixUrl.formSelectFix, "/org/listNoPage"), {})]).then(function (x) {
7032
+ Promise.all([loadSelectSource$1("".concat(prefixUrl.formSelectFix, "/org/listNoPage"), {})]).then(function (x) {
5971
7033
  formatSource(x, 0, 2, tableSearchForm);
5972
7034
  });
5973
7035
  modalTableProps = _objectSpread2({
@@ -6063,10 +7125,10 @@ function commonFun(type, prefixUrl, requestConfigProp, modalTableBusProps) {
6063
7125
  name: 'qp-remark-like',
6064
7126
  label: '备注'
6065
7127
  }];
6066
- Promise.all([loadSelectSource("".concat(prefixUrl.formSelectFix, "/logisCompany"), {
7128
+ Promise.all([loadSelectSource$1("".concat(prefixUrl.formSelectFix, "/logisCompany"), {
6067
7129
  pageSize: 5000,
6068
7130
  currentPage: 1
6069
- }), loadSelectSource("".concat(prefixUrl.formSelectFix, "/printTemplate"), {
7131
+ }), loadSelectSource$1("".concat(prefixUrl.formSelectFix, "/printTemplate"), {
6070
7132
  pageSize: 5000,
6071
7133
  currentPage: 1
6072
7134
  })]).then(function (x) {
@@ -6154,18 +7216,334 @@ var BusinessSearchSelect$1 = /*#__PURE__*/React.memo(BusinessSearchSelect, funct
6154
7216
  return true;
6155
7217
  });
6156
7218
 
7219
+ var AddSkuSelect = function AddSkuSelect(parProps) {
7220
+ var selectProps = {
7221
+ mode: 'multiple'
7222
+ };
7223
+
7224
+ var _useState = useState((selectProps === null || selectProps === void 0 ? void 0 : selectProps.mode) ? [] : null),
7225
+ _useState2 = _slicedToArray(_useState, 2),
7226
+ value = _useState2[0],
7227
+ setValue = _useState2[1];
7228
+
7229
+ var props = {
7230
+ buttonText: parProps.buttonText || '新增',
7231
+ value: value,
7232
+ // labelInValue: true, // 非必填 默认为false
7233
+ requestConfig: {
7234
+ url: "/items/sku/pager/v2",
7235
+ filter: 'qp-name-like',
7236
+ otherParams: {},
7237
+ mappingTextField: 'name',
7238
+ mappingValueField: 'skuCode'
7239
+ },
7240
+ selectProps: selectProps,
7241
+ onChange: function onChange(value) {
7242
+ console.log(value);
7243
+ setValue(value);
7244
+ },
7245
+ beforeShowModal: parProps === null || parProps === void 0 ? void 0 : parProps.beforeShowModal,
7246
+ onSaveCallback: parProps.onSaveCallback // onSaveCallback: (rows) => {
7247
+ // console.log('save call', rows);
7248
+ // // return Promise.resolve(true);
7249
+ // // return Promise.reject('FAILE')
7250
+ // }
7251
+
7252
+ };
7253
+ var modalTableProps = {
7254
+ modalTableTitle: '选择商品',
7255
+ tableSearchForm: [{
7256
+ name: 'qp-skuCode-like',
7257
+ label: 'SKU编码'
7258
+ }, {
7259
+ name: 'qp-skuName-like',
7260
+ label: 'SKU名称'
7261
+ }, {
7262
+ name: 'qp-brandId-in',
7263
+ type: 'select',
7264
+ label: '品牌',
7265
+ field: {
7266
+ type: 'select',
7267
+ props: {
7268
+ mode: 'multiple',
7269
+ notFoundContent: '暂无数据',
7270
+ allowClear: true,
7271
+ showSearch: true,
7272
+ showArrow: true,
7273
+ maxTagCount: 1,
7274
+ optionFilterProp: 'children',
7275
+ filterOption: function filterOption(input, option) {
7276
+ return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
7277
+ }
7278
+ }
7279
+ }
7280
+ }, {
7281
+ name: 'qp-categoryId-in',
7282
+ type: 'treeSelect',
7283
+ label: '类目',
7284
+ field: {
7285
+ type: 'treeSelect',
7286
+ props: {
7287
+ treeData: [],
7288
+ treeCheckable: true,
7289
+ showSearch: true,
7290
+ allowClear: true,
7291
+ showArrow: true,
7292
+ treeNodeFilterProp: 'title',
7293
+ treeDefaultExpandAll: true,
7294
+ maxTagCount: 1,
7295
+ placeholder: '请选择',
7296
+ style: {
7297
+ width: '100%'
7298
+ },
7299
+ dropdownStyle: {
7300
+ maxHeight: 400,
7301
+ maxWidth: 100,
7302
+ overflow: 'auto'
7303
+ }
7304
+ }
7305
+ }
7306
+ }],
7307
+ tableColumns: [{
7308
+ title: 'SKU编码',
7309
+ width: 150,
7310
+ dataIndex: 'skuCode'
7311
+ }, {
7312
+ title: 'SKU名称',
7313
+ width: 200,
7314
+ ellipsis: {
7315
+ showTitle: false
7316
+ },
7317
+ render: function render(text) {
7318
+ return /*#__PURE__*/React.createElement(Tooltip, {
7319
+ placement: "topLeft",
7320
+ title: text
7321
+ }, text);
7322
+ },
7323
+ dataIndex: 'name'
7324
+ }, {
7325
+ title: '国际条码',
7326
+ width: 100,
7327
+ ellipsis: {
7328
+ showTitle: false
7329
+ },
7330
+ dataIndex: 'barCode',
7331
+ render: function render(text) {
7332
+ return /*#__PURE__*/React.createElement(Tooltip, {
7333
+ placement: "topLeft",
7334
+ title: text
7335
+ }, text);
7336
+ }
7337
+ }, {
7338
+ title: '所属SPU名称',
7339
+ width: 100,
7340
+ ellipsis: {
7341
+ showTitle: false
7342
+ },
7343
+ dataIndex: 'itemName',
7344
+ render: function render(text) {
7345
+ return /*#__PURE__*/React.createElement(Tooltip, {
7346
+ placement: "topLeft",
7347
+ title: text
7348
+ }, text);
7349
+ }
7350
+ }, {
7351
+ title: '所属SPU编码',
7352
+ width: 100,
7353
+ ellipsis: {
7354
+ showTitle: false
7355
+ },
7356
+ dataIndex: 'itemCode',
7357
+ render: function render(text) {
7358
+ return /*#__PURE__*/React.createElement(Tooltip, {
7359
+ placement: "topLeft",
7360
+ title: text
7361
+ }, text);
7362
+ }
7363
+ }, {
7364
+ title: '外部编码',
7365
+ width: 100,
7366
+ ellipsis: {
7367
+ showTitle: false
7368
+ },
7369
+ render: function render(text) {
7370
+ return /*#__PURE__*/React.createElement(Tooltip, {
7371
+ placement: "topLeft",
7372
+ title: text
7373
+ }, text);
7374
+ },
7375
+ dataIndex: 'externalCode'
7376
+ }, {
7377
+ title: '规格',
7378
+ width: 100,
7379
+ ellipsis: {
7380
+ showTitle: false
7381
+ },
7382
+ render: function render(text) {
7383
+ return /*#__PURE__*/React.createElement(Tooltip, {
7384
+ placement: "topLeft",
7385
+ title: text
7386
+ }, text);
7387
+ },
7388
+ dataIndex: 'propertyNameAndValue'
7389
+ }, {
7390
+ title: '类目',
7391
+ width: 100,
7392
+ ellipsis: {
7393
+ showTitle: false
7394
+ },
7395
+ render: function render(text) {
7396
+ return /*#__PURE__*/React.createElement(Tooltip, {
7397
+ placement: "topLeft",
7398
+ title: text
7399
+ }, text);
7400
+ },
7401
+ dataIndex: 'categoryName'
7402
+ }, {
7403
+ title: '品类',
7404
+ width: 100,
7405
+ ellipsis: {
7406
+ showTitle: false
7407
+ },
7408
+ render: function render(text) {
7409
+ return /*#__PURE__*/React.createElement(Tooltip, {
7410
+ placement: "topLeft",
7411
+ title: text
7412
+ }, text);
7413
+ },
7414
+ dataIndex: 'className'
7415
+ }, {
7416
+ title: '品牌',
7417
+ width: 100,
7418
+ ellipsis: {
7419
+ showTitle: false
7420
+ },
7421
+ render: function render(text) {
7422
+ return /*#__PURE__*/React.createElement(Tooltip, {
7423
+ placement: "topLeft",
7424
+ title: text
7425
+ }, text);
7426
+ },
7427
+ dataIndex: 'brandName'
7428
+ }],
7429
+ selectColumn: [{
7430
+ title: 'SKU编码',
7431
+ width: 150,
7432
+ dataIndex: 'skuCode'
7433
+ }, {
7434
+ title: 'SKU名称',
7435
+ width: 200,
7436
+ ellipsis: {
7437
+ showTitle: false
7438
+ },
7439
+ render: function render(text) {
7440
+ return /*#__PURE__*/React.createElement(Tooltip, {
7441
+ placement: "topLeft",
7442
+ title: text
7443
+ }, text);
7444
+ },
7445
+ dataIndex: 'name'
7446
+ }, {
7447
+ title: '数量',
7448
+ width: 100,
7449
+ isInputItem: true,
7450
+ dataIndex: 'count'
7451
+ }, {
7452
+ title: '单位',
7453
+ dataIndex: 'selectUnitCode',
7454
+ width: 80,
7455
+ ellipsis: {
7456
+ showTitle: false
7457
+ },
7458
+ render: function render(text, record) {
7459
+ var baseUnitCode = '';
7460
+
7461
+ if (record === null || record === void 0 ? void 0 : record.packingUnitList) {
7462
+ var base = record.packingUnitList.filter(function (item) {
7463
+ return item.unitCode;
7464
+ });
7465
+
7466
+ if (base.length) {
7467
+ var _base$;
7468
+
7469
+ baseUnitCode = base[0].unitCode;
7470
+ record.selectUnitCode = base[0].unitCode;
7471
+ record.selectedScale = ((_base$ = base[0]) === null || _base$ === void 0 ? void 0 : _base$.baseUnitScale) || 1;
7472
+ }
7473
+ }
7474
+
7475
+ if (baseUnitCode) {
7476
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Select, {
7477
+ defaultValue: baseUnitCode,
7478
+ onChange: function onChange(value) {
7479
+ var _record$packingUnitLi, _record$packingUnitLi2;
7480
+
7481
+ record.selectUnitCode = value;
7482
+ record.selectedScale = (record === null || record === void 0 ? void 0 : (_record$packingUnitLi = record.packingUnitList) === null || _record$packingUnitLi === void 0 ? void 0 : (_record$packingUnitLi2 = _record$packingUnitLi.find(function (item) {
7483
+ return item.unitCode === value;
7484
+ })) === null || _record$packingUnitLi2 === void 0 ? void 0 : _record$packingUnitLi2.baseUnitScale) || 1;
7485
+ },
7486
+ style: {
7487
+ width: '60px'
7488
+ }
7489
+ }, record.packingUnitList && record.packingUnitList.map(function (item) {
7490
+ return /*#__PURE__*/React.createElement(Select.Option, {
7491
+ value: item.unitCode
7492
+ }, item.name);
7493
+ })));
7494
+ }
7495
+
7496
+ return /*#__PURE__*/React.createElement(React.Fragment, null);
7497
+ }
7498
+ }, {
7499
+ title: '所属SPU编码',
7500
+ width: 150,
7501
+ ellipsis: {
7502
+ showTitle: false
7503
+ },
7504
+ dataIndex: 'itemCode',
7505
+ render: function render(text) {
7506
+ return /*#__PURE__*/React.createElement(Tooltip, {
7507
+ placement: "topLeft",
7508
+ title: text
7509
+ }, text);
7510
+ }
7511
+ }, {
7512
+ title: '规格',
7513
+ width: 200,
7514
+ ellipsis: {
7515
+ showTitle: false
7516
+ },
7517
+ render: function render(text) {
7518
+ return /*#__PURE__*/React.createElement(Tooltip, {
7519
+ placement: "topLeft",
7520
+ title: text
7521
+ }, text);
7522
+ },
7523
+ dataIndex: 'propertyNameAndValue'
7524
+ }]
7525
+ };
7526
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(AddSelect, _objectSpread2(_objectSpread2({}, props), {}, {
7527
+ modalTableProps: modalTableProps
7528
+ })));
7529
+ };
7530
+
6157
7531
  var CommodityEntry = function CommodityEntry(props) {
6158
7532
  var dataValidationRef = useRef();
6159
7533
  var _props$buttonName = props.buttonName,
6160
7534
  buttonName = _props$buttonName === void 0 ? ' + 录入商品' : _props$buttonName,
6161
7535
  _props$modalTitle = props.modalTitle,
6162
7536
  modalTitle = _props$modalTitle === void 0 ? '录入商品' : _props$modalTitle,
7537
+ _props$buttonProps = props.buttonProps,
7538
+ buttonProps = _props$buttonProps === void 0 ? {} : _props$buttonProps,
6163
7539
  callbackHideModal = props.callbackHideModal,
6164
7540
  callbackHandleOk = props.callbackHandleOk,
6165
7541
  _props$columns = props.columns,
6166
7542
  columns = _props$columns === void 0 ? ["skuCode", "quantity", "price"] : _props$columns,
6167
7543
  _props$validDataUrl = props.validDataUrl,
6168
- validDataUrl = _props$validDataUrl === void 0 ? "/items/api/recordDetailImport/check" : _props$validDataUrl;
7544
+ validDataUrl = _props$validDataUrl === void 0 ? "/items/sku/import/check" : _props$validDataUrl,
7545
+ _props$isBrandAuth = props.isBrandAuth,
7546
+ isBrandAuth = _props$isBrandAuth === void 0 ? true : _props$isBrandAuth;
6169
7547
 
6170
7548
  var _useState = useState({
6171
7549
  maskClosable: false,
@@ -6216,9 +7594,9 @@ var CommodityEntry = function CommodityEntry(props) {
6216
7594
  modalProps.hideModal();
6217
7595
  };
6218
7596
 
6219
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Button, {
7597
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Button, _objectSpread2({
6220
7598
  onClick: handleShowModal
6221
- }, buttonName), modalProps.visible && /*#__PURE__*/React.createElement(Modal, _objectSpread2(_objectSpread2({}, modalProps), {}, {
7599
+ }, buttonProps), buttonName), modalProps.visible && /*#__PURE__*/React.createElement(Modal, _objectSpread2(_objectSpread2({}, modalProps), {}, {
6222
7600
  onOk: handleOk,
6223
7601
  onCancel: handleCancel,
6224
7602
  destroyOnClose: true,
@@ -6228,7 +7606,8 @@ var CommodityEntry = function CommodityEntry(props) {
6228
7606
  dataValidationRef = ref;
6229
7607
  },
6230
7608
  columns: columns,
6231
- validDataUrl: validDataUrl
7609
+ validDataUrl: validDataUrl,
7610
+ isBrandAuth: isBrandAuth
6232
7611
  })) || '');
6233
7612
  };
6234
7613
 
@@ -6620,4 +7999,4 @@ if (localStorage.getItem('x-user-auth-context')) {
6620
7999
  axios.defaults.headers.common['x-user-auth-context'] = localStorage.getItem('x-user-auth-context');
6621
8000
  }
6622
8001
 
6623
- export { BusinessSearchSelect$1 as BusinessSearchSelect, index$1 as BusinessTreeSearchSelect, index as CheckOneUser, CommodityEntry, DataImport, DataValidation, QueryMutipleInput, SearchSelect, TreeSearchSelect };
8002
+ export { AddSelect, AddSkuSelect, BusinessSearchSelect$1 as BusinessSearchSelect, index$1 as BusinessTreeSearchSelect, index as CheckOneUser, CommodityEntry, DataImport, DataValidation, QueryMutipleInput, SearchSelect, TreeSearchSelect };