@bit-sun/business-component 4.2.0-alpha.4 → 4.2.0-alpha.6

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
@@ -2,7 +2,7 @@ import axios from 'axios';
2
2
  import request$1 from 'umi-request';
3
3
  import cookie from 'js-cookie';
4
4
  import { message as message$1, Tooltip, Image, Popover, Card, Avatar, Badge, Menu, Input, InputNumber, Space, Button, Dropdown, Upload, Checkbox, Modal, ConfigProvider, Tag, Select, Spin, Form, Table, Empty, Row, Col, Tabs, TreeSelect, DatePicker, Typography, Alert, Breadcrumb, Drawer as Drawer$1, List, Radio, Tree, Result, Affix, Cascader, TimePicker, Divider, Switch, Collapse } from 'antd';
5
- import _, { omit, uniqBy, escapeRegExp, isNil, debounce, cloneDeep as cloneDeep$1, throttle, isEmpty } from 'lodash';
5
+ import _, { omit, uniqBy, escapeRegExp, isNil, isBoolean, debounce, cloneDeep as cloneDeep$1, throttle, isEmpty } from 'lodash';
6
6
  import memoizeOne from 'memoize-one';
7
7
  import { formatMessage, history, useLocation, Link, useModel, setLocale, useIntl, request as request$3 } from 'umi';
8
8
  import isEqual from 'lodash/isEqual';
@@ -10002,7 +10002,7 @@ function commonFun(type, prefixUrl, parentProps) {
10002
10002
  parentId: treeDataItem.parent,
10003
10003
  data: _objectSpread2({}, treeDataItem),
10004
10004
  isLeaf: !haveChildren,
10005
- disabled: disabledJudge !== undefined ? disabledJudge : haveChildren,
10005
+ disabled: disabledJudge !== undefined ? isBoolean(disabledJudge) ? disabledJudge : disabledJudge(treeDataItem) : haveChildren,
10006
10006
  children: haveChildren ? treeDataItem[childrenKey].map(function (i) {
10007
10007
  return _mapSearchTree(i, resKeyValue, disabledJudge, childrenKey);
10008
10008
  }) : []
@@ -10012,12 +10012,16 @@ function commonFun(type, prefixUrl, parentProps) {
10012
10012
  var _reData$position2;
10013
10013
  var resKeyValue = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : ['id', 'name'];
10014
10014
  var childrenKey = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'children';
10015
+ var nodeDisabledJudge = arguments.length > 6 ? arguments[6] : undefined;
10015
10016
  var data = reData && ((_reData$position2 = reData[position]) === null || _reData$position2 === void 0 ? void 0 : _reData$position2.data);
10016
10017
  var disabledJudge;
10017
10018
  if (data && _typeof(data) === 'object' && !Array.isArray(data) && Object.keys(data).length > 0) {
10018
10019
  data = [data];
10019
10020
  disabledJudge = false;
10020
10021
  }
10022
+ if (nodeDisabledJudge) {
10023
+ disabledJudge = nodeDisabledJudge;
10024
+ }
10021
10025
  var formatData = data && Array.isArray(data) && data.length && data.map(function (ites) {
10022
10026
  return _mapSearchTree(ites, resKeyValue, disabledJudge, childrenKey);
10023
10027
  }) || [];
@@ -11914,9 +11918,6 @@ function commonFun(type, prefixUrl, parentProps) {
11914
11918
  filterOption: function filterOption(input, option) {
11915
11919
  return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
11916
11920
  },
11917
- disabledJude: function disabledJude(data) {
11918
- return data['parentCode'] === '0';
11919
- },
11920
11921
  showCheckedStrategy: 'TreeSelect.SHOW_ALL'
11921
11922
  }
11922
11923
  }
@@ -11939,9 +11940,6 @@ function commonFun(type, prefixUrl, parentProps) {
11939
11940
  filterOption: function filterOption(input, option) {
11940
11941
  return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
11941
11942
  },
11942
- disabledJude: function disabledJude(data) {
11943
- return data['parent'] === '0';
11944
- },
11945
11943
  showCheckedStrategy: 'TreeSelect.SHOW_ALL'
11946
11944
  }
11947
11945
  }
@@ -11981,9 +11979,15 @@ function commonFun(type, prefixUrl, parentProps) {
11981
11979
  }, getQueryHeadersItem(_queryHeaderParams11, 'qp-orgCode-in')), loadSelectSource$1("".concat(prefixUrl.formSelectFix, "/tagNode/getTree/10"), {
11982
11980
  'qp-status-eq': 1
11983
11981
  }, getQueryHeadersItem(_queryHeaderParams11, 'qp-orgCode-in'))]).then(function (x) {
11982
+ var channelDisabledJude = function channelDisabledJude(data) {
11983
+ return data['parentCode'] === '0';
11984
+ }; // 所属销售渠道 树节点不能点判断
11985
+ var areaDisabledJude = function areaDisabledJude(data) {
11986
+ return data['parent'] === '0';
11987
+ }; // 所属营销区域 树节点不能点判断
11984
11988
  formatSource(x, 0, 3, tableSearchForm);
11985
- formatTreeDataSource(x, 1, 4, tableSearchForm, ['id', 'name'], 'channelInfoSon');
11986
- formatTreeDataSource(x, 2, 5, tableSearchForm, ['code', 'name'], 'children');
11989
+ formatTreeDataSource(x, 1, 4, tableSearchForm, ['code', 'name'], 'channelInfoSon', channelDisabledJude);
11990
+ formatTreeDataSource(x, 2, 5, tableSearchForm, ['code', 'name'], 'children', areaDisabledJude);
11987
11991
  });
11988
11992
  modalTableProps = _objectSpread2({
11989
11993
  modalTableTitle: '选择商店',
package/dist/index.js CHANGED
@@ -10025,7 +10025,7 @@ function commonFun(type, prefixUrl, parentProps) {
10025
10025
  parentId: treeDataItem.parent,
10026
10026
  data: _objectSpread2({}, treeDataItem),
10027
10027
  isLeaf: !haveChildren,
10028
- disabled: disabledJudge !== undefined ? disabledJudge : haveChildren,
10028
+ disabled: disabledJudge !== undefined ? _.isBoolean(disabledJudge) ? disabledJudge : disabledJudge(treeDataItem) : haveChildren,
10029
10029
  children: haveChildren ? treeDataItem[childrenKey].map(function (i) {
10030
10030
  return _mapSearchTree(i, resKeyValue, disabledJudge, childrenKey);
10031
10031
  }) : []
@@ -10035,12 +10035,16 @@ function commonFun(type, prefixUrl, parentProps) {
10035
10035
  var _reData$position2;
10036
10036
  var resKeyValue = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : ['id', 'name'];
10037
10037
  var childrenKey = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'children';
10038
+ var nodeDisabledJudge = arguments.length > 6 ? arguments[6] : undefined;
10038
10039
  var data = reData && ((_reData$position2 = reData[position]) === null || _reData$position2 === void 0 ? void 0 : _reData$position2.data);
10039
10040
  var disabledJudge;
10040
10041
  if (data && _typeof(data) === 'object' && !Array.isArray(data) && Object.keys(data).length > 0) {
10041
10042
  data = [data];
10042
10043
  disabledJudge = false;
10043
10044
  }
10045
+ if (nodeDisabledJudge) {
10046
+ disabledJudge = nodeDisabledJudge;
10047
+ }
10044
10048
  var formatData = data && Array.isArray(data) && data.length && data.map(function (ites) {
10045
10049
  return _mapSearchTree(ites, resKeyValue, disabledJudge, childrenKey);
10046
10050
  }) || [];
@@ -11937,9 +11941,6 @@ function commonFun(type, prefixUrl, parentProps) {
11937
11941
  filterOption: function filterOption(input, option) {
11938
11942
  return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
11939
11943
  },
11940
- disabledJude: function disabledJude(data) {
11941
- return data['parentCode'] === '0';
11942
- },
11943
11944
  showCheckedStrategy: 'TreeSelect.SHOW_ALL'
11944
11945
  }
11945
11946
  }
@@ -11962,9 +11963,6 @@ function commonFun(type, prefixUrl, parentProps) {
11962
11963
  filterOption: function filterOption(input, option) {
11963
11964
  return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
11964
11965
  },
11965
- disabledJude: function disabledJude(data) {
11966
- return data['parent'] === '0';
11967
- },
11968
11966
  showCheckedStrategy: 'TreeSelect.SHOW_ALL'
11969
11967
  }
11970
11968
  }
@@ -12004,9 +12002,15 @@ function commonFun(type, prefixUrl, parentProps) {
12004
12002
  }, getQueryHeadersItem(_queryHeaderParams11, 'qp-orgCode-in')), loadSelectSource$1("".concat(prefixUrl.formSelectFix, "/tagNode/getTree/10"), {
12005
12003
  'qp-status-eq': 1
12006
12004
  }, getQueryHeadersItem(_queryHeaderParams11, 'qp-orgCode-in'))]).then(function (x) {
12005
+ var channelDisabledJude = function channelDisabledJude(data) {
12006
+ return data['parentCode'] === '0';
12007
+ }; // 所属销售渠道 树节点不能点判断
12008
+ var areaDisabledJude = function areaDisabledJude(data) {
12009
+ return data['parent'] === '0';
12010
+ }; // 所属营销区域 树节点不能点判断
12007
12011
  formatSource(x, 0, 3, tableSearchForm);
12008
- formatTreeDataSource(x, 1, 4, tableSearchForm, ['id', 'name'], 'channelInfoSon');
12009
- formatTreeDataSource(x, 2, 5, tableSearchForm, ['code', 'name'], 'children');
12012
+ formatTreeDataSource(x, 1, 4, tableSearchForm, ['code', 'name'], 'channelInfoSon', channelDisabledJude);
12013
+ formatTreeDataSource(x, 2, 5, tableSearchForm, ['code', 'name'], 'children', areaDisabledJude);
12010
12014
  });
12011
12015
  modalTableProps = _objectSpread2({
12012
12016
  modalTableTitle: '选择商店',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "4.2.0-alpha.4",
3
+ "version": "4.2.0-alpha.6",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -6,6 +6,7 @@ import { handleTextOverflow, tableColumnsImage, handleTooltip } from '@/componen
6
6
  import { getSkuImg } from '@/utils/TableUtils';
7
7
  import { getEmployeeCode, getCurrentTargetBgId } from '@/utils/LocalstorageUtils';
8
8
  import { Image } from 'antd';
9
+ import { isBoolean } from 'lodash';
9
10
 
10
11
  const hasDictSharingType = getDictionarySource('UC000013')?.length;
11
12
  const sharingTypeDataList = hasDictSharingType && getDictionarySource('UC000013') || sharingType
@@ -50,17 +51,28 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
50
51
  parentId: treeDataItem.parent,
51
52
  data: { ...treeDataItem },
52
53
  isLeaf: !haveChildren,
53
- disabled: disabledJudge!==undefined? disabledJudge : haveChildren,
54
+ disabled: disabledJudge !== undefined ? isBoolean(disabledJudge) ? disabledJudge : disabledJudge(treeDataItem) : haveChildren,
54
55
  children: haveChildren ? treeDataItem[childrenKey].map((i: any) => mapSearchTree(i, resKeyValue, disabledJudge, childrenKey)) : [],
55
56
  };
56
57
  };
57
- const formatTreeDataSource = (reData: any, position: number, changePosition: number,changeSearchForm: any,resKeyValue=['id', 'name'], childrenKey = 'children') => {
58
+ const formatTreeDataSource = (
59
+ reData: any,
60
+ position: number,
61
+ changePosition: number,
62
+ changeSearchForm: any,
63
+ resKeyValue=['id', 'name'],
64
+ childrenKey = 'children',
65
+ nodeDisabledJudge?: (data: any) => boolean, // 树节点能不能选 函数判断
66
+ ) => {
58
67
  let data = reData && reData[position]?.data;
59
68
  let disabledJudge;
60
69
  if(data && typeof data === 'object' && !Array.isArray(data) && Object.keys(data).length > 0) {
61
70
  data = [data];
62
71
  disabledJudge=false
63
72
  }
73
+ if(nodeDisabledJudge) {
74
+ disabledJudge = nodeDisabledJudge;
75
+ }
64
76
  const formatData = (data &&
65
77
  Array.isArray(data) &&
66
78
  data.length &&
@@ -1875,7 +1887,6 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
1875
1887
  optionFilterProp: 'children',
1876
1888
  filterOption: (input: string, option: { props: { children: string } }) =>
1877
1889
  option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
1878
- disabledJude: (data: any) => data['parentCode'] === '0',
1879
1890
  showCheckedStrategy: 'TreeSelect.SHOW_ALL',
1880
1891
  },
1881
1892
  } },
@@ -1893,7 +1904,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
1893
1904
  optionFilterProp: 'children',
1894
1905
  filterOption: (input: string, option: { props: { children: string } }) =>
1895
1906
  option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
1896
- disabledJude: (data: any) => data['parent'] === '0',
1907
+
1897
1908
  showCheckedStrategy: 'TreeSelect.SHOW_ALL',
1898
1909
  },
1899
1910
  } },
@@ -1930,9 +1941,11 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
1930
1941
  'qp-status-eq': 1,
1931
1942
  },getQueryHeadersItem(queryHeaderParams,'qp-orgCode-in')),
1932
1943
  ]).then((x: any)=>{
1944
+ const channelDisabledJude = (data: any) => data['parentCode'] === '0'; // 所属销售渠道 树节点不能点判断
1945
+ const areaDisabledJude = (data: any) => data['parent'] === '0'; // 所属营销区域 树节点不能点判断
1933
1946
  formatSource(x,0, 3, tableSearchForm);
1934
- formatTreeDataSource(x, 1, 4, tableSearchForm, ['id','name'], 'channelInfoSon')
1935
- formatTreeDataSource(x, 2, 5, tableSearchForm, ['code', 'name'], 'children')
1947
+ formatTreeDataSource(x, 1, 4, tableSearchForm, ['code','name'], 'channelInfoSon', channelDisabledJude)
1948
+ formatTreeDataSource(x, 2, 5, tableSearchForm, ['code', 'name'], 'children', areaDisabledJude)
1936
1949
  })
1937
1950
  modalTableProps = {
1938
1951
  modalTableTitle: '选择商店',