@bit-sun/business-component 2.3.28 → 2.4.0

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.
Files changed (29) hide show
  1. package/dist/index.esm.js +592 -456
  2. package/dist/index.js +592 -456
  3. package/dist/utils/CustomLoginInfo.d.ts +10 -0
  4. package/dist/utils/requestUtils.d.ts +28 -0
  5. package/dist/utils/utils.d.ts +0 -6
  6. package/package.json +1 -1
  7. package/src/components/Business/AddSelectBusiness/index.tsx +3 -2
  8. package/src/components/Business/BsSulaQueryTable/SearchItemSetting.tsx +9 -7
  9. package/src/components/Business/BsSulaQueryTable/index.tsx +11 -8
  10. package/src/components/Business/BsSulaQueryTable/setting.tsx +7 -5
  11. package/src/components/Business/JsonQueryTable/components/Formula.tsx +3 -2
  12. package/src/components/Business/JsonQueryTable/index.tsx +8 -6
  13. package/src/components/Business/SearchSelect/utils.ts +2 -1
  14. package/src/components/Business/columnSettingTable/columnSetting.tsx +5 -4
  15. package/src/components/Business/columnSettingTable/index.tsx +3 -2
  16. package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +3 -2
  17. package/src/components/Functional/AddSelect/helps.ts +2 -1
  18. package/src/components/Functional/AddSelect/index.tsx +3 -2
  19. package/src/components/Functional/BillEntry/index.tsx +3 -2
  20. package/src/components/Functional/DataImport/index.tsx +2 -1
  21. package/src/components/Functional/DataValidation/index.tsx +2 -1
  22. package/src/components/Functional/ExportFunctions/ExportIcon/index.tsx +2 -1
  23. package/src/components/Functional/SearchSelect/index.tsx +10 -9
  24. package/src/components/Functional/TreeSearchSelect/index.tsx +2 -1
  25. package/src/components/Solution/RuleComponent/ruleFiled.js +2 -1
  26. package/src/plugin/TableColumnSetting/index.tsx +4 -3
  27. package/src/utils/CustomLoginInfo.ts +39 -0
  28. package/src/utils/requestUtils.ts +139 -7
  29. package/src/utils/utils.ts +0 -21
@@ -0,0 +1,10 @@
1
+ export declare function getEekaSessionId(): any;
2
+ export declare function getEekaAccountId(): any;
3
+ export declare function getEekaEmployeeId(): any;
4
+ export declare function getEekaTenantId(): any;
5
+ export declare function getEekaToken(): any;
6
+ export declare function getGuoyaoshukeSessionId(): any;
7
+ export declare function getGuoyaoshukeAccountId(): any;
8
+ export declare function getGuoyaoshukeEmployeeId(): any;
9
+ export declare function getGuoyaoshukeTenantId(): any;
10
+ export declare function getGuoyaoshukeToken(): any;
@@ -1 +1,29 @@
1
1
  export declare function handleRequestAuthHeader(config?: any): void;
2
+ /**
3
+ * 处理请求路径前缀/请求路径等使用不一的问题
4
+ * @param {*} defaultUrl 默认请求路径
5
+ * @param {*} defaultPreFix 默认请求路径的前缀
6
+ * @param {*} config 更改请求前缀/路径集合
7
+ * 示例:
8
+ * appRequestConfig: {
9
+ * '/appConfig/saveUserOrder': ['/api/user-manage'],
10
+ * '/appConfig/saveQueryCriteria': ['/api/user-manage']
11
+ * }
12
+ */
13
+ export declare const handleRequestUrl: (defaultPreFix: string, defaultUrl: string, config: any) => string;
14
+ /**
15
+ * 处理错误请求
16
+ * @param {*} response 返回结果
17
+ * @param {*} needBackError 是否需要将错误回传到页面单独处理
18
+ */
19
+ export declare function handleError(response: object, needBackError?: boolean): boolean;
20
+ /**
21
+ * 判断为请求错误
22
+ * @param {*} res 响应体
23
+ * */
24
+ export declare const judgeIsRequestError: (res: any) => boolean;
25
+ /**
26
+ * 判断为请求成功
27
+ * @param {*} res 响应体
28
+ * */
29
+ export declare const judgeIsRequestSuccess: (res: any) => boolean;
@@ -15,9 +15,3 @@ export declare const handleAntdColumnsSpecialParams: (col: any) => void;
15
15
  export declare const getDictionarySource: (dicCode: string, needConvertInterger?: boolean) => any;
16
16
  export declare function uuid(): string;
17
17
  export declare const judgeIsEmpty: (value: any) => boolean;
18
- /**
19
- * 处理错误请求
20
- * @param {*} response 返回结果
21
- * @param {*} needBackError 是否需要将错误回传到页面单独处理
22
- */
23
- export declare function handleError(response: object, needBackError?: boolean): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "2.3.28",
3
+ "version": "2.4.0",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -11,6 +11,7 @@ import axios from 'axios';
11
11
  import { AddSelect } from '../../../index';
12
12
  import { tableColumnsImage } from '@/components/Business/BsSulaQueryTable/utils';
13
13
  import { getSkuImg } from '@/utils/TableUtils';
14
+ import { judgeIsRequestError } from '@/utils/requestUtils';
14
15
  import { getEmployeeId } from '@/utils/LocalstorageUtils';
15
16
  // import { getCurrentTargetBgId } from '@/utils/LocalstorageUtils';
16
17
 
@@ -460,7 +461,7 @@ export const AddSkcSelect = (parProps: any) => {
460
461
  // type: 1 尺码组; 2 配码组
461
462
  axios.get(`/items/itemPropertyValueGroup/listNoPage?qp-type-eq=2&qp-status-eq=1`).then((result: any) => {
462
463
  result = result.data;
463
- if ((result?.status && result.status !== '0') || (result?.code && result.code !== '000000')) {
464
+ if (judgeIsRequestError(result)) {
464
465
  message.error(result.msg);
465
466
  return;
466
467
  }
@@ -765,7 +766,7 @@ export const AddSpuSelect = (parProps: any) => {
765
766
  // type: 1 尺码组; 2 配码组
766
767
  axios.get(`/items/itemPropertyValueGroup/listNoPage?qp-type-eq=2&qp-status-eq=1`).then((result: any) => {
767
768
  result = result.data;
768
- if ((result?.status && result.status !== '0') || (result?.code && result.code !== '000000')) {
769
+ if (judgeIsRequestError(result)) {
769
770
  message.error(result.msg);
770
771
  return;
771
772
  }
@@ -21,6 +21,7 @@ import close from '../../../assets/close.svg';
21
21
  import drag from '../../../assets/drag.svg';
22
22
  import './index.less';
23
23
  import ENUM from '@/utils/enumConfig';
24
+ import { handleRequestUrl, judgeIsRequestSuccess } from '@/utils/requestUtils';
24
25
 
25
26
  const DragHandle = SortableHandle(() => <img width={25} src={drag} />);
26
27
  const SortableItem = SortableElement((props) => <tr {...props} />);
@@ -41,6 +42,7 @@ class SearchItemTable extends React.Component {
41
42
  };
42
43
 
43
44
  patchUserSearchFieldsConfig = (config) => {
45
+ const { appRequestConfig } = this.props;
44
46
  let that = this;
45
47
  let configvalue = config
46
48
  ? config.map((item) => ({
@@ -50,14 +52,14 @@ class SearchItemTable extends React.Component {
50
52
  : '';
51
53
 
52
54
  axios({
53
- url: '/user/appConfig/saveQueryCriteria',
55
+ url: handleRequestUrl('/user','/appConfig/saveQueryCriteria', appRequestConfig),
54
56
  method: 'POST',
55
57
  data: {
56
58
  code: that.state.bsTableCode,
57
59
  detail: configvalue ? JSON.stringify(configvalue) : '',
58
60
  },
59
61
  }).then((res:any) => {
60
- if (res?.data?.status === '0') {
62
+ if (judgeIsRequestSuccess(res?.data)) {
61
63
  this.patchConfigToLocalstorage(configvalue)
62
64
  } else {
63
65
  message.error('保存搜索项自定义失败,请稍后尝试');
@@ -92,7 +94,7 @@ class SearchItemTable extends React.Component {
92
94
  "detail": JSON.stringify(configvalue)
93
95
  })
94
96
  }
95
-
97
+
96
98
  localStorage.setItem(ENUM.BROWSER_CACHE.SEARCH_FIELDS_CONDITION, JSON.stringify(configArray));
97
99
  this.setState({
98
100
  visible: false,
@@ -152,10 +154,10 @@ class SearchItemTable extends React.Component {
152
154
  };
153
155
 
154
156
  componentDidMount() {
155
- const {
156
- datasource,
157
- showSearchFields,
158
- bsTableCode
157
+ const {
158
+ datasource,
159
+ showSearchFields,
160
+ bsTableCode
159
161
  }: any = this.props;
160
162
 
161
163
  let config = this.getConfigFromlocalstorage();
@@ -56,7 +56,7 @@ export default (props: any) => {
56
56
  const [value, setValue]: any = useState(props);
57
57
  const [showColumn, setShowColumns] = useState([]); // 列字段
58
58
  const [showSearchFields, setShowSearchFields] = useState(props.fields || []); //搜索项字段
59
- const { isPage = true, pagination, tableCode } = props;
59
+ const { isPage = true, pagination, tableCode, appRequestConfig } = props;
60
60
 
61
61
  const [height, setHeight]: any = useState('100vh');
62
62
  const sortTableRef = useRef(null);
@@ -71,12 +71,12 @@ export default (props: any) => {
71
71
  window.top.document.fullScreen ||
72
72
  window.top.document.webkitIsFullScreen ||
73
73
  window.top.document.mozFullScreen;
74
-
74
+
75
75
  // wujie子应用iframe首次加载获取不到client以及dom元素高度兼容处理
76
76
  let realIframeClientHeight = document.body.clientHeight ? document.body.clientHeight : window.top?.document.body.clientHeight - 76;
77
- let summaryHeight = document.querySelector(`.ant-tabs-tabpane-active .table-bssula-summary`) ?
78
- (document.querySelector(`.ant-tabs-tabpane-active .table-bssula-summary`)?.clientHeight || 22) : 0;
79
- let listTabHeight = document.querySelector(`.ant-tabs-tabpane-active .list_top_tab .ant-tabs-nav`) ?
77
+ let summaryHeight = document.querySelector(`.ant-tabs-tabpane-active .table-bssula-summary`) ?
78
+ (document.querySelector(`.ant-tabs-tabpane-active .table-bssula-summary`)?.clientHeight || 22) : 0;
79
+ let listTabHeight = document.querySelector(`.ant-tabs-tabpane-active .list_top_tab .ant-tabs-nav`) ?
80
80
  (document.querySelector(`.ant-tabs-tabpane-active .list_top_tab .ant-tabs-nav`)?.clientHeight || 48) : 0;
81
81
 
82
82
 
@@ -371,8 +371,8 @@ export default (props: any) => {
371
371
  <Dropdown overlay={
372
372
  <Menu>
373
373
  <Menu.Item>
374
- <div
375
- onClick={sortTableRef?.current?.showModal}
374
+ <div
375
+ onClick={sortTableRef?.current?.showModal}
376
376
  style={{fontSize:14, textAlign: 'center'}}
377
377
  >列设置</div>
378
378
  </Menu.Item>
@@ -383,9 +383,10 @@ export default (props: any) => {
383
383
  showSearchFields={showSearchFields}
384
384
  datasource={value?.fields || []}
385
385
  bsTableCode={bsTableCode}
386
+ appRequestConfig={appRequestConfig}
386
387
  />
387
388
  </Menu.Item>
388
- </Menu>
389
+ </Menu>
389
390
  } placement="bottomRight" >
390
391
  <span className="ant-dropdown-link">
391
392
  <img width={32} src={shezhi} />
@@ -518,6 +519,7 @@ export default (props: any) => {
518
519
  ...config,
519
520
  summary: props.summary,
520
521
  statusMapping: props.statusMapping,
522
+ appRequestConfig: props.appRequestConfig
521
523
  }),
522
524
  [value, checkedList, showColumn, props.statusMapping, showSearchFields],
523
525
  );
@@ -529,6 +531,7 @@ export default (props: any) => {
529
531
  showColumn={showColumn}
530
532
  datasource={value?.columns || []}
531
533
  bsTableCode={bsTableCode}
534
+ appRequestConfig={appRequestConfig}
532
535
  onlyModal
533
536
  />
534
537
  </>;
@@ -27,6 +27,7 @@ import fixedRight from '../../../assets/fixed-right.svg';
27
27
  import fixedRightActive from '../../../assets/fixed-right-active.svg';
28
28
  import './index.less';
29
29
  import ENUM from '@/utils/enumConfig';
30
+ import { handleRequestUrl, judgeIsRequestSuccess } from '@/utils/requestUtils';
30
31
 
31
32
  const DragHandle = SortableHandle(() => <img width={25} src={drag} />);
32
33
 
@@ -47,6 +48,7 @@ class SortableTable extends React.Component {
47
48
  };
48
49
 
49
50
  patchUserColumnConfig = (config) => {
51
+ const { appRequestConfig } = this.props;
50
52
  let that = this;
51
53
  let configvalue = config
52
54
  ? config.map((item) => ({
@@ -59,14 +61,14 @@ class SortableTable extends React.Component {
59
61
  : '';
60
62
  return new Promise((resolve: any, reject: any) => {
61
63
  axios({
62
- url: '/user/appConfig/saveUserOrder',
64
+ url: handleRequestUrl('/user','/appConfig/saveUserOrder', appRequestConfig),
63
65
  method: 'POST',
64
66
  data: {
65
67
  code: that.state.bsTableCode,
66
68
  detail: configvalue ? JSON.stringify(configvalue) : '',
67
69
  },
68
70
  }).then((res:any) => {
69
- if (res?.data?.status === '0') {
71
+ if (judgeIsRequestSuccess(res?.data)) {
70
72
  this.patchConfigToLocalstorage(configvalue);
71
73
  resolve({ status: '0' });
72
74
  } else {
@@ -104,7 +106,7 @@ class SortableTable extends React.Component {
104
106
  "detail": JSON.stringify(configvalue)
105
107
  })
106
108
  }
107
-
109
+
108
110
  localStorage.setItem(ENUM.BROWSER_CACHE.COLUMN_CONDITION, JSON.stringify(configArray));
109
111
  this.setState({
110
112
  visible: false,
@@ -485,7 +487,7 @@ class SortableTable extends React.Component {
485
487
  () => {
486
488
  this.handleOk()
487
489
  .then((res: any) => {
488
- if (res.status === '0') {
490
+ if (judgeIsRequestSuccess(res)) {
489
491
  message.success(<span>
490
492
  字段已隐藏,如需重新显示请前往<Typography.Link
491
493
  underline
@@ -840,7 +842,7 @@ class SortableTable extends React.Component {
840
842
  </Modal>
841
843
  )}
842
844
  {
843
- !onlyModal
845
+ !onlyModal
844
846
  ? <div onClick={this.showModal} style={{fontSize:14}}>列设置</div>
845
847
  : ''
846
848
  }
@@ -8,6 +8,7 @@ import {
8
8
  } from 'react-sortable-hoc';
9
9
  import { arrayMoveImmutable } from 'array-move';
10
10
  import { ModalForm, request } from 'bssula';
11
+ import { judgeIsRequestSuccess } from '@/utils/requestUtils';
11
12
 
12
13
 
13
14
  const App = ({
@@ -31,7 +32,7 @@ const App = ({
31
32
  'qp-fieldGroup-eq': record.fieldGroup,
32
33
  },
33
34
  converter: ({ response, data }:any) => {
34
- if (response.code === '000000') {
35
+ if (judgeIsRequestSuccess(response)) {
35
36
  // UpdateFiedList(data.filter(item => item.valueType == 20 || item.valueType == 21 || item.valueType == 22))
36
37
  const resData = data.filter((item:any) => item.inputType != 40 && (item.valueType == 20 || item.valueType == 21 || item.valueType == 22)).map((item:any) => ({value: item.code, name: item.name}))
37
38
  UpdateFiedList(resData)
@@ -97,7 +98,7 @@ const App = ({
97
98
  deleteItem(value, sortIndex)
98
99
  }} /></span>
99
100
  });
100
-
101
+
101
102
  const SortableList = SortableContainer(({ items }:any) => {
102
103
  return (
103
104
  <div style={{ display: 'flex', flexWrap: 'wrap' }}>
@@ -9,6 +9,7 @@ import FieldsSettingsTable from './components/FieldsSettingsTable';
9
9
  import { isEmpty } from "lodash"
10
10
  import './index.less';
11
11
  import { getUserId } from '@/utils/LocalstorageUtils';
12
+ import { judgeIsRequestError } from '@/utils/requestUtils';
12
13
 
13
14
  function iterFileds (fields) {
14
15
  let filedsValue = [];
@@ -90,14 +91,14 @@ function convertFileds (fields, falltValue, faltFieldRange, containerName) {
90
91
  } else {
91
92
  const returnField = field.isStaticCode ? falltValue[containerName ? (containerName + field.name) : field.name] : faltFieldRange[field.name];
92
93
  if (returnField) {
93
- returnField.label = field?.label;
94
+ returnField.label = field?.label;
94
95
  if(field?.disabled){ // 字段设置只读属性
95
96
  returnField.field.props.disabled = true;
96
97
  }
97
98
  if(field?.invisible){ // 字段设置不可见属性
98
99
  returnField.initialVisible = false;
99
100
  }
100
-
101
+
101
102
  if(Array.isArray(returnField.name)&&returnField.name?.includes("extensionFields")){
102
103
  returnField.notShowLabel = true;
103
104
  }
@@ -300,8 +301,9 @@ const JsonQueryTable = React.memo(props => {
300
301
  Promise.all([
301
302
  axios.get(`/basic/flow/businessFieldGroup/one?moduleType=2&layoutPoint=${pageType}`),
302
303
  ]).then(([res] )=> {
303
- const { code, data } = res?.data || {};
304
- if (code === '000000') {
304
+ const resD = res?.data || {}
305
+ const { data } = resD;
306
+ if (judgeIsRequestError(resD)) {
305
307
  if(data){
306
308
  const { businessType, code:fieldGroup, moduleType, moduleRelationId } = data;
307
309
  setModuleParams({
@@ -377,7 +379,7 @@ const JsonQueryTable = React.memo(props => {
377
379
  saveTableCallBack(lastRes, false);
378
380
  }
379
381
  },[detailTablesSetting.length]);
380
-
382
+
381
383
  const onClickRun = (value, isSave) => {
382
384
  setJsonEditorVal(value);
383
385
 
@@ -420,7 +422,7 @@ const JsonQueryTable = React.memo(props => {
420
422
  message.error(e);
421
423
  }
422
424
  }
423
-
425
+
424
426
  React.useEffect(() => {
425
427
  localStorage.setItem('jsonEditorVal',JSON.stringify(jsonEditorVal||{}))
426
428
  }, [jsonEditorVal]);
@@ -2,6 +2,7 @@ import axios from 'axios';
2
2
  import { message } from 'antd';
3
3
  import { stringify } from 'querystring';
4
4
  import ENUM from '@/utils/enumConfig';
5
+ import { judgeIsRequestError } from '@/utils/requestUtils';
5
6
 
6
7
  const getDicData = (dicCode: string) => {
7
8
  let dicData = {};
@@ -60,7 +61,7 @@ const loadSelectSource = (url: string, params?: any) => {
60
61
  .get(`${url}?${stringify(params)}`)
61
62
  .then((result: any) => {
62
63
  result = result.data;
63
- if ((result?.status && result.status !== '0') || (result?.code && result.code !== '000000')) {
64
+ if (judgeIsRequestError(result)) {
64
65
  message.error(result.msg);
65
66
  return;
66
67
  }
@@ -19,6 +19,7 @@ import axios from 'axios';
19
19
  // import { request } from 'umi';
20
20
  import './index.less';
21
21
  import ENUM from '@/utils/enumConfig';
22
+ import { handleRequestUrl, judgeIsRequestSuccess } from '@/utils/requestUtils';
22
23
 
23
24
  interface SortTableProps {
24
25
  [propName: string]: any;
@@ -66,7 +67,7 @@ class SortableTable extends React.Component<SortTableProps> {
66
67
  };
67
68
 
68
69
  patchUserColumnConfig = (config: any) => {
69
- const { tableCode }: any = this.props;
70
+ const { tableCode, appRequestConfig }: any = this.props;
70
71
  if (!tableCode) return;
71
72
  let configvalue = config.map((item:any) => ({
72
73
  key: item.key,
@@ -77,14 +78,14 @@ class SortableTable extends React.Component<SortTableProps> {
77
78
  }))
78
79
 
79
80
  axios({
80
- url: '/user/appConfig/saveUserOrder',
81
+ url: handleRequestUrl('/user','/appConfig/saveUserOrder',appRequestConfig),
81
82
  method:'POST',
82
83
  data: {
83
84
  "code": tableCode,
84
85
  "detail": JSON.stringify(configvalue)
85
86
  },
86
87
  }).then((res:any) => {
87
- if (res?.data?.status === '0') {
88
+ if (judgeIsRequestSuccess(res?.data)) {
88
89
  this.patchConfigToLocalstorage(configvalue, tableCode)
89
90
  } else {
90
91
  message.error('保存表头列自定义失败,请稍后尝试');
@@ -762,4 +763,4 @@ class SortableTable extends React.Component<SortTableProps> {
762
763
  }
763
764
  }
764
765
 
765
- export default SortableTable;
766
+ export default SortableTable;
@@ -154,7 +154,7 @@ export default class ColumnSettingTable extends React.Component {
154
154
  };
155
155
 
156
156
  render() {
157
- const { columns, tableCode, summary = undefined, dynamicColumns = [], scroll={}, ...restProps }: any = this.props;
157
+ const { columns, tableCode, appRequestConfig, summary = undefined, dynamicColumns = [], scroll={}, ...restProps }: any = this.props;
158
158
  let otherTableInfo = {
159
159
  ...restProps,
160
160
  };
@@ -212,6 +212,7 @@ export default class ColumnSettingTable extends React.Component {
212
212
  showColumns={this.state.showColumns}
213
213
  datasource={columns || []}
214
214
  tableCode={tableCode}
215
+ appRequestConfig={appRequestConfig}
215
216
  />
216
217
  </span>
217
218
  </div>
@@ -230,4 +231,4 @@ export default class ColumnSettingTable extends React.Component {
230
231
  )
231
232
  }
232
233
 
233
- }
234
+ }
@@ -160,7 +160,7 @@ export default class ColumnSettingSulaTable extends React.Component {
160
160
  };
161
161
 
162
162
  render() {
163
- const { style=null, columns, tableCode, summary = undefined, dynamicColumns = [], scroll={}, ...restProps }: any = this.props;
163
+ const { style=null, columns, tableCode, appRequestConfig, summary = undefined, dynamicColumns = [], scroll={}, ...restProps }: any = this.props;
164
164
  let otherTableInfo = {
165
165
  ...restProps,
166
166
  };
@@ -218,6 +218,7 @@ export default class ColumnSettingSulaTable extends React.Component {
218
218
  showColumns={this.state.showColumns}
219
219
  datasource={columns || []}
220
220
  tableCode={tableCode}
221
+ appRequestConfig={appRequestConfig}
221
222
  />
222
223
  </span>
223
224
  </div>
@@ -238,4 +239,4 @@ export default class ColumnSettingSulaTable extends React.Component {
238
239
  )
239
240
  }
240
241
 
241
- }
242
+ }
@@ -1,6 +1,7 @@
1
1
  import axios from 'axios';
2
2
  import { stringify } from 'querystring';
3
3
  import { message } from 'antd';
4
+ import { judgeIsRequestError } from '@/utils/requestUtils';
4
5
 
5
6
  // 下拉框数据源
6
7
  // 情况①:每条记录下拉框数据不同----查询接口每条记录返回字段,前后端约定好,用dataSourceCode记录
@@ -23,7 +24,7 @@ export const loadSelectSource = (url: string, params?: any) => {
23
24
  .get(`${url}?${stringify(params)}`)
24
25
  .then((result: any) => {
25
26
  result = result.data;
26
- if ((result?.status && result.status !== '0') || (result?.code && result.code !== '000000')) {
27
+ if (judgeIsRequestError(result)) {
27
28
  message.error(result.msg);
28
29
  resolve(result);
29
30
  return;
@@ -13,6 +13,7 @@ import { checkQuantityAccuracy, precisionQuantity } from '@/utils/checkUtils';
13
13
  import TableColumnSetting from '@/plugin/TableColumnSetting';
14
14
  import { setInitialShowColumn } from '@/plugin/TableColumnSetting/utils';
15
15
  import { handleAntdColumnsSpecialParams, uuid } from '@/utils/utils';
16
+ import { judgeIsRequestError } from '@/utils/requestUtils';
16
17
  import { getItemDefaultWidth, noEmptyArray } from '@/components/Business/columnSettingTable/utils';
17
18
  import { getEmployeeId } from '@/utils/LocalstorageUtils';
18
19
  import { getSelectDataList, loadSelectSource, formatFormSourceList } from './helps';
@@ -22,7 +23,7 @@ const checkSpuMatchCode = (data: any) => {
22
23
  axios.post(`/stock/rwFrontRecordSkcDetail/checkSpuMatchCode`,data)
23
24
  .then((result: any) => {
24
25
  result = result.data;
25
- if ((result?.status && result.status !== '0') || (result?.code && result.code !== '000000')) {
26
+ if (judgeIsRequestError(result)) {
26
27
  message.error(result.msg);
27
28
  reject(false);
28
29
  return;
@@ -517,7 +518,7 @@ const AddSelect = (props: any) => {
517
518
  .then((result: any) => {
518
519
  setFetching(false)
519
520
  result = result.data;
520
- if ((result?.status && result.status !== '0') || (result?.code && result.code !== '000000')) {
521
+ if (judgeIsRequestError(result)) {
521
522
  message.error(result.msg);
522
523
  return;
523
524
  }
@@ -13,6 +13,7 @@ import TableColumnSetting from '@/plugin/TableColumnSetting';
13
13
  import { setInitialShowColumn } from '@/plugin/TableColumnSetting/utils';
14
14
  import { getItemDefaultWidth, noEmptyArray } from '@/components/Business/columnSettingTable/utils';
15
15
  import { handleAntdColumnsSpecialParams } from '@/utils/utils';
16
+ import { judgeIsRequestSuccess, judgeIsRequestError } from '@/utils/requestUtils';
16
17
 
17
18
  const InputElement = ({
18
19
  record, text, currentIndex, inputLength, index, setData, data, item, callSelectItem
@@ -30,7 +31,7 @@ const InputElement = ({
30
31
  .get(`/items/sku/pager/v2?${stringify({ 'skuCodeAndSkuName': name, 'pageSize': 100, 'qp-combination-eq': false, 'qp-approveStatus-eq': 1, 'qp-status-eq': 1 })}`)
31
32
  .then(({ data, status }: any) => {
32
33
  if (status === 200) {
33
- if (data.status === '0') {
34
+ if (judgeIsRequestSuccess(data)) {
34
35
  const resultData = data.data.items.map((item: any, index: any) => ({
35
36
  ...item,
36
37
  index
@@ -632,7 +633,7 @@ const BillEntry: React.FC = ({ onSaveCallback, validDataUrl="/items/sku/import/c
632
633
  })
633
634
  .then((result) => {
634
635
  result = result.data;
635
- if (result.status !== '0') {
636
+ if (judgeIsRequestError(result)) {
636
637
  message.error(result.msg);
637
638
  return { flag: false }
638
639
  } else {
@@ -28,6 +28,7 @@ import {
28
28
  import axios from 'axios';
29
29
  import './index.less';
30
30
  import _ from "lodash"
31
+ import { judgeIsRequestError } from '@/utils/requestUtils';
31
32
 
32
33
  // const luckysheet = window.luckysheet;
33
34
 
@@ -435,7 +436,7 @@ class DataImport extends React.Component {
435
436
  })
436
437
  .then((result) => {
437
438
  result = result.data;
438
- if (result.status !== '0') {
439
+ if (judgeIsRequestError(result)) {
439
440
  message.error(result.msg);
440
441
  return;
441
442
  }
@@ -28,6 +28,7 @@ import {
28
28
  import axios from 'axios';
29
29
  import './index.less';
30
30
  import _ from "lodash"
31
+ import { judgeIsRequestError } from '@/utils/requestUtils';
31
32
 
32
33
  // const luckysheet = window.luckysheet;
33
34
 
@@ -427,7 +428,7 @@ class DataValidation extends React.Component {
427
428
  })
428
429
  .then((result) => {
429
430
  result = result.data;
430
- if (result.status !== '0') {
431
+ if (judgeIsRequestError(result)) {
431
432
  message.error(result.msg);
432
433
  return;
433
434
  }
@@ -4,6 +4,7 @@ import {message, Popconfirm, Tooltip} from "antd";
4
4
  import axios from 'axios'
5
5
  import exportlogo from '../../../../assets/exportlogo.png'
6
6
  import {omit} from 'lodash'
7
+ import { judgeIsRequestError } from '@/utils/requestUtils';
7
8
  interface exportIconType{
8
9
  /** others选填,使用axios发请求,*/
9
10
  request:{
@@ -44,7 +45,7 @@ const ExportIcon = ({request, tableRef}: exportIconType) => {
44
45
  })
45
46
  .then((result: any) => {
46
47
  result = result.data;
47
- if (result.code !== '000000') {
48
+ if (judgeIsRequestError(result)) {
48
49
  message.error(result?.msg);
49
50
  return;
50
51
  }
@@ -9,6 +9,7 @@ import _ from "lodash"
9
9
  import './index.less';
10
10
  import { BusinessSearchSelect, QueryMutipleInput } from '@/index';
11
11
  import { handleSourceName } from './utils';
12
+ import { judgeIsRequestError } from '@/utils/requestUtils';
12
13
 
13
14
  const { Option } = Select;
14
15
 
@@ -282,7 +283,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
282
283
  .then((result: any) => {
283
284
  setFetching(false)
284
285
  result = result.data;
285
- if ((result?.status && result.status !== '0') || (result?.code && result.code !== '000000')) {
286
+ if (judgeIsRequestError(result)) {
286
287
  message.error(result.msg);
287
288
  return;
288
289
  }
@@ -313,8 +314,8 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
313
314
  }
314
315
  return {
315
316
  ...item,
316
- text: specialBracket
317
- ? `【${item[mappingValueField]}】${item[mappingTextField]}`
317
+ text: specialBracket
318
+ ? `【${item[mappingValueField]}】${item[mappingTextField]}`
318
319
  : item[mappingTextField],
319
320
  textShowText,
320
321
  textShowKey: item[mappingTextShowKeyField || mappingValueField],
@@ -336,8 +337,8 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
336
337
  }
337
338
  return {
338
339
  ...item,
339
- text: specialBracket
340
- ? `【${item[mappingValueField]}】${item[mappingTextField]}`
340
+ text: specialBracket
341
+ ? `【${item[mappingValueField]}】${item[mappingTextField]}`
341
342
  : item[mappingTextField],
342
343
  textShowText,
343
344
  textShowKey: item[mappingTextShowKeyField || mappingValueField],
@@ -738,7 +739,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
738
739
  const handleSelectOptionsShowValue = (specialBracket: boolean, item: object) => {
739
740
  let showText = Array.isArray(item.textShowText) &&
740
741
  item.textShowText.join(' ') || item.textShowText;
741
- return specialBracket
742
+ return specialBracket
742
743
  ? `【${item.textShowKey}】${showText}`
743
744
  : `${item.textShowKey} ${showText}`
744
745
  };
@@ -792,9 +793,9 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
792
793
  >
793
794
  {items.map(item => (
794
795
  <Option key={item.value} label={item.text}>
795
- {LightHeightOption({
796
- text: handleSelectOptionsShowValue(specialBracket, item),
797
- filterTxt: searchValue
796
+ {LightHeightOption({
797
+ text: handleSelectOptionsShowValue(specialBracket, item),
798
+ filterTxt: searchValue
798
799
  })}
799
800
  </Option>
800
801
  ))}
@@ -3,6 +3,7 @@ import { TreeSelect, Tooltip, Tag } from 'antd';
3
3
  import axios from 'axios';
4
4
  import { stringify } from 'querystring';
5
5
  import _ from "lodash"
6
+ import { judgeIsRequestSuccess } from '@/utils/requestUtils';
6
7
 
7
8
  const TreeSearchSelect = (props: any) => {
8
9
  const [treeData, setTreeData] = useState([]);
@@ -76,7 +77,7 @@ const TreeSearchSelect = (props: any) => {
76
77
  const resData = res?.data || [];
77
78
  let coverData;
78
79
 
79
- if(resData.status === '0' || resData.code === '000000') {
80
+ if(judgeIsRequestSuccess(resData)) {
80
81
  const { data } = resData;
81
82
  if (remoteSource.converter) {
82
83
  coverData = await remoteSource.converter({ data: [data] })