@bit-sun/business-component 2.4.24 → 2.4.26-beta01
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Business/BsLayouts/service.d.ts +1 -1
- package/dist/components/Business/BsSulaQueryTable/index.d.ts +0 -1
- package/dist/components/Business/BsSulaQueryTable/setting.d.ts +1 -1
- package/dist/components/Business/BsSulaQueryTable/utils.d.ts +0 -1
- package/dist/components/Business/columnSettingTable/columnSetting.d.ts +0 -1
- package/dist/components/Functional/ExportFunctions/ExportIcon/index.d.ts +1 -1
- package/dist/components/Functional/QueryMutipleInput/index.d.ts +1 -2
- package/dist/components/Solution/RuleComponent/services.d.ts +1 -1
- package/dist/index.esm.js +1185 -1739
- package/dist/index.js +1179 -1735
- package/dist/utils/TableUtils.d.ts +2 -93
- package/dist/utils/index.d.ts +4 -6
- package/dist/utils/utils.d.ts +0 -13
- package/package.json +4 -7
- package/src/assets/32.svg +27 -27
- package/src/assets/addIcon.svg +17 -17
- package/src/assets/allfunc.svg +27 -27
- package/src/assets/arrowRight.svg +24 -24
- package/src/assets/btn-delete.svg +29 -29
- package/src/assets/btn-edit.svg +19 -19
- package/src/assets/btn-more.svg +17 -17
- package/src/assets/btn-submit.svg +19 -19
- package/src/assets/close.svg +26 -26
- package/src/assets/drag.svg +17 -17
- package/src/assets/fixed-left.svg +15 -15
- package/src/assets/fixed-right.svg +15 -15
- package/src/assets/guanbi.svg +15 -15
- package/src/assets/icon-quanping.svg +15 -15
- package/src/assets/icon-shezhi.svg +17 -17
- package/src/assets/label_icon_bottom.svg +25 -25
- package/src/assets/list-no-img.svg +21 -21
- package/src/assets/morentouxiang-32.svg +23 -23
- package/src/assets/scanning.svg +24 -24
- package/src/assets/upExport.svg +22 -22
- package/src/common/ENUM.ts +41 -41
- package/src/components/Business/AddSelectBusiness/index.tsx +22 -40
- package/src/components/Business/BsLayouts/Components/AllFunc/index.less +153 -153
- package/src/components/Business/BsLayouts/Components/AllFunc/index.tsx +70 -70
- package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.less +90 -90
- package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.tsx +37 -37
- package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/leftTree.tsx +242 -242
- package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/rightTree.tsx +384 -384
- package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.tsx +74 -74
- package/src/components/Business/BsLayouts/Components/CustomerMenu/index.less +64 -64
- package/src/components/Business/BsLayouts/Components/CustomerMenu/index.tsx +153 -153
- package/src/components/Business/BsLayouts/Components/GlobalHeader/index.tsx +157 -163
- package/src/components/Business/BsLayouts/Components/RightContent/LoginModal.tsx +85 -85
- package/src/components/Business/BsLayouts/Components/RightContent/index.tsx +2 -19
- package/src/components/Business/BsLayouts/Components/SearchFunc/index.tsx +75 -75
- package/src/components/Business/BsLayouts/index.less +79 -79
- package/src/components/Business/BsLayouts/index.tsx +1484 -1494
- package/src/components/Business/BsLayouts/service.ts +2 -2
- package/src/components/Business/BsLayouts/utils.tsx +203 -203
- package/src/components/Business/BsSulaQueryTable/SearchItemSetting.tsx +9 -9
- package/src/components/Business/BsSulaQueryTable/index.less +221 -221
- package/src/components/Business/BsSulaQueryTable/index.tsx +175 -346
- package/src/components/Business/BsSulaQueryTable/setting.tsx +87 -125
- package/src/components/Business/BsSulaQueryTable/utils.tsx +34 -57
- package/src/components/Business/CommodityEntry/index.md +70 -70
- package/src/components/Business/CommodityEntry/index.tsx +81 -80
- package/src/components/Business/CommonGuideWrapper/index.less +112 -121
- package/src/components/Business/CommonGuideWrapper/index.md +39 -39
- package/src/components/Business/CommonGuideWrapper/index.tsx +84 -94
- package/src/components/Business/DetailPageWrapper/index.less +1 -9
- package/src/components/Business/DetailPageWrapper/index.tsx +110 -121
- package/src/components/Business/HomePageWrapper/index.md +45 -45
- package/src/components/Business/HomePageWrapper/index.tsx +162 -162
- package/src/components/Business/JsonQueryTable/configButton/index.js +20 -20
- package/src/components/Business/JsonQueryTable/configTree/component/compactArrayView.js +25 -25
- package/src/components/Business/JsonQueryTable/configTree/component/compactObjectView.js +30 -30
- package/src/components/Business/JsonQueryTable/configTree/index.js +82 -82
- package/src/components/Business/JsonQueryTable/configTree/index.less +44 -44
- package/src/components/Business/JsonQueryTable/configTree/parser/highlight.js +57 -57
- package/src/components/Business/JsonQueryTable/configTree/parser/index.js +124 -124
- package/src/components/Business/JsonQueryTable/configTree/render/iconRender.js +29 -29
- package/src/components/Business/JsonQueryTable/configTree/render/nameRender.js +22 -22
- package/src/components/Business/JsonQueryTable/configTree/treeNode.js +116 -116
- package/src/components/Business/JsonQueryTable/drawer/index.tsx +12 -12
- package/src/components/Business/JsonQueryTable/index.less +16 -16
- package/src/components/Business/JsonQueryTable/index.md +328 -328
- package/src/components/Business/JsonQueryTable/index.tsx +537 -535
- package/src/components/Business/JsonQueryTable/jsonEditor/index.js +346 -346
- package/src/components/Business/JsonQueryTable/jsonEditor/index.less +22 -22
- package/src/components/Business/JsonQueryTable/jsonEditor/lint/basicType.js +147 -147
- package/src/components/Business/JsonQueryTable/jsonEditor/lint/index.js +389 -389
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/actions.js +118 -118
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/dependency.js +22 -22
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/index.js +21 -21
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/request.js +65 -65
- package/src/components/Business/SearchSelect/utils.ts +3 -3
- package/src/components/Business/StateFlow/index.md +60 -60
- package/src/components/Business/StateFlow/index.tsx +29 -29
- package/src/components/Business/columnSettingTable/columnSetting.tsx +8 -10
- package/src/components/Business/columnSettingTable/index.less +247 -247
- package/src/components/Business/columnSettingTable/index.md +357 -357
- package/src/components/Business/columnSettingTable/utils.tsx +71 -71
- package/src/components/Business/moreTreeTable/FixedScrollBar.tsx +87 -87
- package/src/components/Business/moreTreeTable/hooks/useSticky.ts +21 -21
- package/src/components/Business/moreTreeTable/index.less +99 -99
- package/src/components/Business/moreTreeTable/index.tsx +387 -387
- package/src/components/Business/moreTreeTable/utils.ts +126 -126
- package/src/components/Functional/AddSelect/helps.ts +3 -4
- package/src/components/Functional/AddSelect/index.less +367 -367
- package/src/components/Functional/AddSelect/index.tsx +33 -79
- package/src/components/Functional/BillEntry/index.less +371 -371
- package/src/components/Functional/BillEntry/index.tsx +3 -3
- package/src/components/Functional/BsAntdSula/index.ts +2 -2
- package/src/components/Functional/DataImport/index.less +63 -63
- package/src/components/Functional/DataImport/index.tsx +3 -3
- package/src/components/Functional/DataValidation/index.less +63 -63
- package/src/components/Functional/DataValidation/index.tsx +3 -3
- package/src/components/Functional/EllipsisTooltip/index.d.ts +5 -5
- package/src/components/Functional/EllipsisTooltip/index.js +36 -36
- package/src/components/Functional/ExportFunctions/ExportIcon/index.tsx +5 -10
- package/src/components/Functional/QueryMutipleInput/index.less +37 -37
- package/src/components/Functional/QueryMutipleInput/index.tsx +1 -2
- package/src/components/Functional/SearchSelect/index.less +0 -6
- package/src/components/Functional/SearchSelect/index.tsx +45 -152
- package/src/components/Functional/SearchSelect/utils.ts +3 -3
- package/src/components/Functional/TreeSearchSelect/index.tsx +22 -24
- package/src/components/Solution/RuleComponent/Formula.tsx +335 -335
- package/src/components/Solution/RuleComponent/index.d.ts +29 -29
- package/src/components/Solution/RuleComponent/index.js +652 -7
- package/src/components/Solution/RuleComponent/index.less +230 -230
- package/src/components/Solution/RuleComponent/renderSpecificAction.js +99 -99
- package/src/components/Solution/RuleComponent/services.ts +13 -13
- package/src/plugin/TableColumnSetting/index.less +247 -247
- package/src/plugin/TableColumnSetting/index.md +50 -50
- package/src/plugin/TableColumnSetting/index.tsx +2 -2
- package/src/plugin/TableColumnSetting/utils.ts +19 -19
- package/src/utils/CheckOneUser/index.md +39 -39
- package/src/utils/CheckOneUser/index.ts +51 -51
- package/src/utils/LocalstorageUtils.ts +95 -95
- package/src/utils/TableUtils.tsx +18 -691
- package/src/utils/checkUtils.ts +39 -39
- package/src/utils/enumConfig.ts +11 -11
- package/src/utils/getFormMode.js +12 -12
- package/src/utils/index.ts +4 -6
- package/src/utils/requestUtils.ts +2 -29
- package/src/utils/serialize.js +7 -7
- package/src/utils/utils.ts +21 -64
- package/dist/components/Business/BsLayouts/Components/ChooseStore/index.d.ts +0 -3
- package/dist/components/Business/BsLayouts/Components/ChooseStore/services.d.ts +0 -1
- package/dist/components/Business/BsLayouts/Components/RightContent/i18n.d.ts +0 -9
- package/dist/components/Solution/RuleComponent/RenderCompItem.d.ts +0 -2
- package/dist/utils/businessUtils.d.ts +0 -27
- package/dist/utils/constant.d.ts +0 -37
- package/dist/utils/request.d.ts +0 -2
- package/src/assets/arrow_top.svg +0 -18
- package/src/components/Business/BsLayouts/Components/ChooseStore/index.less +0 -0
- package/src/components/Business/BsLayouts/Components/ChooseStore/index.tsx +0 -193
- package/src/components/Business/BsLayouts/Components/ChooseStore/services.ts +0 -10
- package/src/components/Business/BsLayouts/Components/RightContent/i18n.ts +0 -9
- package/src/components/Business/BsSulaQueryTable/bssulaquerytable.less +0 -5
- package/src/components/Solution/RuleComponent/RenderCompItem.tsx +0 -637
- package/src/utils/TableUtils.less +0 -52
- package/src/utils/businessUtils.ts +0 -441
- package/src/utils/constant.ts +0 -39
- package/src/utils/request.ts +0 -53
|
@@ -1,441 +0,0 @@
|
|
|
1
|
-
import { message } from 'antd';
|
|
2
|
-
import {
|
|
3
|
-
FUNCTION_GET,
|
|
4
|
-
APPLICATION_SHEET,
|
|
5
|
-
NUMBER_VALUE,
|
|
6
|
-
FORMAT_ARRAY_START,
|
|
7
|
-
FORMAT_ARRAY_END,
|
|
8
|
-
REQUEST_SUCCESS_CODE,
|
|
9
|
-
MENU_AUTH_KEY,
|
|
10
|
-
DIC_DATA_KEY,
|
|
11
|
-
} from '@/utils/constant';
|
|
12
|
-
import _ from 'lodash';
|
|
13
|
-
import moment from 'moment';
|
|
14
|
-
import { request } from 'bssula';
|
|
15
|
-
import { handleError } from './requestUtils';
|
|
16
|
-
import { downloadExcel } from '@/utils/utils';
|
|
17
|
-
|
|
18
|
-
// 获取后端地址前缀 - 针对业务
|
|
19
|
-
const handleBaseUrlPre = (baseName: string) => {
|
|
20
|
-
const baseUrlMap = new Map([
|
|
21
|
-
['basicDataFront', '/basic'],
|
|
22
|
-
['basicDchannelataFront', '/channel-manage'],
|
|
23
|
-
['dcop', '/dcopis/api'],
|
|
24
|
-
['bop', '/bop/api'],
|
|
25
|
-
['purchasing', '/purchasing/api'],
|
|
26
|
-
['mca', '/marketingChannel/api'],
|
|
27
|
-
['sca', '/sca/'],
|
|
28
|
-
['scd', '/scd/'],
|
|
29
|
-
['userFront', '/user'],
|
|
30
|
-
['itemFront', '/items'],
|
|
31
|
-
['settleFront', '/settle'],
|
|
32
|
-
['stockFront', '/stock'],
|
|
33
|
-
]);
|
|
34
|
-
let result = baseUrlMap.get(baseName) || null;
|
|
35
|
-
return result;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* 统一参数处理逻辑
|
|
40
|
-
* 增量补充
|
|
41
|
-
* @param newParams
|
|
42
|
-
*/
|
|
43
|
-
const paramsControl = (params: any) => {
|
|
44
|
-
const newParams = _.cloneDeep(params);
|
|
45
|
-
for (const key in newParams) {
|
|
46
|
-
if (Object.prototype.hasOwnProperty.call(newParams, key)) {
|
|
47
|
-
const element = newParams[key];
|
|
48
|
-
if (element && key.indexOf('*NotAParam') >= NUMBER_VALUE.ZERO) {
|
|
49
|
-
delete newParams[key];
|
|
50
|
-
} else if (element && key.indexOf('*number*') >= NUMBER_VALUE.ZERO) {
|
|
51
|
-
const dataParams = key.split('*number*');
|
|
52
|
-
dataParams.forEach((value, index) => {
|
|
53
|
-
newParams[value] = element[index];
|
|
54
|
-
});
|
|
55
|
-
delete newParams[key];
|
|
56
|
-
} else if (element && key.indexOf('*address*') >= NUMBER_VALUE.ZERO) {
|
|
57
|
-
const dataParams = key.split('*address*');
|
|
58
|
-
dataParams.forEach((value, index) => {
|
|
59
|
-
newParams[value] = element.PCDCode[index];
|
|
60
|
-
});
|
|
61
|
-
delete newParams[key];
|
|
62
|
-
} else if (element && key.indexOf('*costType*') >= NUMBER_VALUE.ZERO) {
|
|
63
|
-
const dataParams = key.split('*costType*');
|
|
64
|
-
newParams[dataParams[NUMBER_VALUE.ZERO]] = element[1];
|
|
65
|
-
delete newParams[key];
|
|
66
|
-
} else if (element && key.indexOf('*fullDate*') >= NUMBER_VALUE.ZERO) {
|
|
67
|
-
const dataParams = key.split('*fullDate*');
|
|
68
|
-
dataParams.forEach((value, index) => {
|
|
69
|
-
if (index == NUMBER_VALUE.ZERO) {
|
|
70
|
-
newParams[value] = moment(element[index])
|
|
71
|
-
.millisecond(NUMBER_VALUE.ZERO)
|
|
72
|
-
.second(NUMBER_VALUE.ZERO)
|
|
73
|
-
.minute(NUMBER_VALUE.ZERO)
|
|
74
|
-
.hour(NUMBER_VALUE.ZERO)
|
|
75
|
-
.format('YYYY-MM-DD HH:mm:ss');
|
|
76
|
-
} else {
|
|
77
|
-
newParams[value] = moment(element[index])
|
|
78
|
-
.millisecond(Number(`${NUMBER_VALUE.FIVE}${NUMBER_VALUE.NINE}`))
|
|
79
|
-
.second(Number(`${NUMBER_VALUE.FIVE}${NUMBER_VALUE.NINE}`))
|
|
80
|
-
.minute(Number(`${NUMBER_VALUE.FIVE}${NUMBER_VALUE.NINE}`))
|
|
81
|
-
.hour(Number(`${NUMBER_VALUE.TWO}${NUMBER_VALUE.THREE}`))
|
|
82
|
-
.format('YYYY-MM-DD HH:mm:ss');
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
delete newParams[key];
|
|
86
|
-
} else if (element && key.indexOf('*originDate*') >= 0) {
|
|
87
|
-
const dataParams = key.split('*originDate*');
|
|
88
|
-
dataParams.forEach((value, index) => {
|
|
89
|
-
if (index === 0) {
|
|
90
|
-
newParams[value] = moment(element[index]).format(
|
|
91
|
-
'YYYY-MM-DD HH:mm:ss',
|
|
92
|
-
);
|
|
93
|
-
} else {
|
|
94
|
-
newParams[value] = moment(element[index]).format(
|
|
95
|
-
'YYYY-MM-DD HH:mm:ss',
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
delete newParams[key];
|
|
100
|
-
} else if (element && key.indexOf('*date*') >= 0) {
|
|
101
|
-
const dataParams = key.split('*date*');
|
|
102
|
-
dataParams.forEach((value, index) => {
|
|
103
|
-
if (index === 0) {
|
|
104
|
-
newParams[value] = moment(element[index]).format('YYYY-MM-DD');
|
|
105
|
-
} else {
|
|
106
|
-
newParams[value] = moment(element[index]).format('YYYY-MM-DD');
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
delete newParams[key];
|
|
110
|
-
} else if (element && key.indexOf('_selectNumberRange') >= 0) {
|
|
111
|
-
// key = xxxxx_selectNumberRange qp-xxxxx-gt
|
|
112
|
-
const dataParams = key.split('_selectNumberRange')[0];
|
|
113
|
-
if (newParams[key][0] === 'range') {
|
|
114
|
-
if (newParams[key][1][0]) {
|
|
115
|
-
newParams[`qp-${dataParams}-ge`] = newParams[key][1][0];
|
|
116
|
-
}
|
|
117
|
-
if (newParams[key][1][1]) {
|
|
118
|
-
newParams[`qp-${dataParams}-le`] = newParams[key][1][1];
|
|
119
|
-
}
|
|
120
|
-
} else {
|
|
121
|
-
newParams[`qp-${dataParams}-${newParams[key][0]}`] =
|
|
122
|
-
newParams[key][1];
|
|
123
|
-
}
|
|
124
|
-
delete newParams[key];
|
|
125
|
-
} else if (element && key.indexOf('*size*') >= 0) {
|
|
126
|
-
const dataParams = key.split('*size*')[0];
|
|
127
|
-
newParams[dataParams] =
|
|
128
|
-
typeof element === 'string' ? element.toUpperCase() : element;
|
|
129
|
-
delete newParams[key];
|
|
130
|
-
} else if (element && key.indexOf('*') >= 0) {
|
|
131
|
-
const dataParams = key.split('*');
|
|
132
|
-
dataParams.forEach((value, index) => {
|
|
133
|
-
newParams[value] = element[index].format('YYYY-MM-DD HH:mm:ss');
|
|
134
|
-
});
|
|
135
|
-
delete newParams[key];
|
|
136
|
-
} else if (Array.isArray(element)) {
|
|
137
|
-
newParams[key] = element.join(',');
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
return newParams;
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
// 处理由form和上传组件构成的结构中 需要上传的url
|
|
145
|
-
const handleOssUrl = (fileList: any[]) => {
|
|
146
|
-
let result = {};
|
|
147
|
-
|
|
148
|
-
if (fileList && fileList.length) {
|
|
149
|
-
if (handleError(fileList[0].response)) {
|
|
150
|
-
result = {
|
|
151
|
-
imgUrl: fileList[0].response.data.url,
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
return result;
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
const getDictionaryTextByValue = (dicCode: string, value: string) => {
|
|
160
|
-
let dicData = [];
|
|
161
|
-
let dictionaryData: any;
|
|
162
|
-
if (!dictionaryData) {
|
|
163
|
-
const storageDic = localStorage.getItem(DIC_DATA_KEY)
|
|
164
|
-
? JSON.parse(localStorage.getItem(DIC_DATA_KEY) || '[]')
|
|
165
|
-
: {};
|
|
166
|
-
dicData = storageDic[dicCode];
|
|
167
|
-
} else {
|
|
168
|
-
dicData = dictionaryData[dicCode];
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
if (!dicData || !dicData.length) {
|
|
172
|
-
// throw new Error(`当前没有${dicCode}字典值`);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
if (value === undefined) return '- -';
|
|
176
|
-
|
|
177
|
-
const dicItemArray = dicData?.filter(
|
|
178
|
-
(item: { value: string }) => item.value === value.toString(),
|
|
179
|
-
);
|
|
180
|
-
|
|
181
|
-
if (!dicItemArray?.length) {
|
|
182
|
-
// throw new Error(`当前${dicCode}字典值合没有${value}的数据`)
|
|
183
|
-
return value;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
return dicItemArray[0].text;
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
const getJoinDictionaryText = (dicCode: string, value: string) => {
|
|
190
|
-
let dicData = [];
|
|
191
|
-
let dictionaryData: any;
|
|
192
|
-
if (!dictionaryData) {
|
|
193
|
-
const storageDic = localStorage.getItem(DIC_DATA_KEY)
|
|
194
|
-
? JSON.parse(localStorage.getItem(DIC_DATA_KEY) || '[]')
|
|
195
|
-
: {};
|
|
196
|
-
dicData = storageDic[dicCode];
|
|
197
|
-
} else {
|
|
198
|
-
dicData = dictionaryData[dicCode];
|
|
199
|
-
}
|
|
200
|
-
if (value === undefined) return '- -';
|
|
201
|
-
const newValue = value.split(',');
|
|
202
|
-
const dicItemArray = dicData?.filter((item: any) => {
|
|
203
|
-
return newValue.find((d: any) => d == item.value);
|
|
204
|
-
});
|
|
205
|
-
if (!dicItemArray?.length) {
|
|
206
|
-
return value;
|
|
207
|
-
}
|
|
208
|
-
return dicItemArray.map((d: any) => d.text).join(',');
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
const authFunc = (code: string) => {
|
|
212
|
-
return JSON.parse(localStorage.getItem(MENU_AUTH_KEY) || '[]')?.find(
|
|
213
|
-
(d: any) => d === code,
|
|
214
|
-
);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// 文件校验
|
|
218
|
-
const handleBeforeUpload = (file: any, size: any, suffixRule: any) => {
|
|
219
|
-
const extName = file.name.substring(file.name.lastIndexOf('.')).toLowerCase();
|
|
220
|
-
const isFileType = suffixRule.length > 0 && suffixRule.includes(extName);
|
|
221
|
-
console.log(
|
|
222
|
-
file,
|
|
223
|
-
extName,
|
|
224
|
-
isFileType,
|
|
225
|
-
suffixRule,
|
|
226
|
-
suffixRule.includes(extName),
|
|
227
|
-
);
|
|
228
|
-
if (!isFileType) {
|
|
229
|
-
message.error(`请上传${suffixRule.toString()}等格式的文件!`);
|
|
230
|
-
}
|
|
231
|
-
const isLtSize = file.size / 1024 / 1024 < size;
|
|
232
|
-
if (!isLtSize) {
|
|
233
|
-
message.error(`上传文件不能超过${size}M!`);
|
|
234
|
-
}
|
|
235
|
-
return new Promise((resolve, reject) => {
|
|
236
|
-
if (isFileType && isLtSize) {
|
|
237
|
-
return resolve(file);
|
|
238
|
-
}
|
|
239
|
-
return reject(false);
|
|
240
|
-
});
|
|
241
|
-
};
|
|
242
|
-
|
|
243
|
-
/*
|
|
244
|
-
导出类型: type(1-全部导出 2-只导出勾选的 3-按查询结果导出数据)
|
|
245
|
-
|
|
246
|
-
* */
|
|
247
|
-
const handleExport = (
|
|
248
|
-
type: number,
|
|
249
|
-
params: any,
|
|
250
|
-
url: any,
|
|
251
|
-
methods?: any,
|
|
252
|
-
fileName?: any,
|
|
253
|
-
promiseResult?: any,
|
|
254
|
-
) => {
|
|
255
|
-
if (type === 3) {
|
|
256
|
-
params = {
|
|
257
|
-
params: { ...paramsControl(params) },
|
|
258
|
-
type: 3,
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
request({
|
|
263
|
-
url: `${handleBaseUrlPre('basicDataFront')}/${url}`,
|
|
264
|
-
method: methods || FUNCTION_GET,
|
|
265
|
-
params,
|
|
266
|
-
responseType: 'blob',
|
|
267
|
-
converter: (res: any) => {
|
|
268
|
-
const { data } = res;
|
|
269
|
-
if (data?.type !== APPLICATION_SHEET && data?.type !== 'java/*') {
|
|
270
|
-
message.error(data?.message || '下载失败,请确保在良好网络条件下下载');
|
|
271
|
-
promiseResult.reject();
|
|
272
|
-
} else if (data?.type === 'java/*') {
|
|
273
|
-
message.error('数据超出10000条,无法导出,建议筛选近期数据或分批导出');
|
|
274
|
-
promiseResult.reject();
|
|
275
|
-
} else {
|
|
276
|
-
message.success('导出成功,最多可导出十万条数据');
|
|
277
|
-
downloadExcel(data, fileName);
|
|
278
|
-
promiseResult.resolve();
|
|
279
|
-
}
|
|
280
|
-
},
|
|
281
|
-
});
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
// 导出条码对照表 - 没看出应用中 代码差异 先一起抛出去
|
|
285
|
-
const handleExportBarCode = handleExport;
|
|
286
|
-
|
|
287
|
-
const getBreadcrumbNameMap = (menuData: any) => {
|
|
288
|
-
const routerMap: any = {};
|
|
289
|
-
|
|
290
|
-
const flattenMenuData = (data: any) => {
|
|
291
|
-
data.forEach((menuItem: any) => {
|
|
292
|
-
if (menuItem.children) {
|
|
293
|
-
flattenMenuData(menuItem.children);
|
|
294
|
-
}
|
|
295
|
-
// Reduce memory usage
|
|
296
|
-
routerMap[menuItem.path] = menuItem;
|
|
297
|
-
});
|
|
298
|
-
};
|
|
299
|
-
flattenMenuData(menuData);
|
|
300
|
-
return routerMap;
|
|
301
|
-
};
|
|
302
|
-
|
|
303
|
-
const ergodicMenuRoutes = (routes: any) => {
|
|
304
|
-
const codeArray: any = [];
|
|
305
|
-
|
|
306
|
-
function ergodicRoutes(routesParam: any) {
|
|
307
|
-
routesParam.forEach((element: any) => {
|
|
308
|
-
// element.code &&
|
|
309
|
-
if (element.hideInMenu) {
|
|
310
|
-
codeArray.push(element);
|
|
311
|
-
}
|
|
312
|
-
if (element.routes) {
|
|
313
|
-
ergodicRoutes(element.routes);
|
|
314
|
-
}
|
|
315
|
-
});
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
ergodicRoutes(routes);
|
|
319
|
-
|
|
320
|
-
return codeArray;
|
|
321
|
-
};
|
|
322
|
-
|
|
323
|
-
// 菜鸟打印方法
|
|
324
|
-
const socketFunctions = {
|
|
325
|
-
/**
|
|
326
|
-
* 请求打印机列表demo
|
|
327
|
-
* */
|
|
328
|
-
getPrinterList: (socket: any) => {
|
|
329
|
-
const request = socketFunctions.getRequestObject('getPrinters');
|
|
330
|
-
if (socket.readyState === 1) {
|
|
331
|
-
console.log(request, socket, 'getPrintList');
|
|
332
|
-
socket.send(JSON.stringify(request));
|
|
333
|
-
}
|
|
334
|
-
},
|
|
335
|
-
/* **
|
|
336
|
-
* 构造request对象
|
|
337
|
-
*/
|
|
338
|
-
getRequestObject: (cmd: any) => {
|
|
339
|
-
const request: any = new Object();
|
|
340
|
-
request.requestId = socketFunctions.getUUID(8, 16);
|
|
341
|
-
request.version = '1.0';
|
|
342
|
-
request.cmd = cmd;
|
|
343
|
-
return request;
|
|
344
|
-
},
|
|
345
|
-
/* **
|
|
346
|
-
*
|
|
347
|
-
* 获取请求的UUID,指定长度和进制,如
|
|
348
|
-
* getUUID(8, 2) //"01001010" 8 character (base=2)
|
|
349
|
-
* getUUID(8, 10) // "47473046" 8 character ID (base=10)
|
|
350
|
-
* getUUID(8, 16) // "098F4D35"。 8 character ID (base=16)
|
|
351
|
-
*
|
|
352
|
-
*/
|
|
353
|
-
getUUID: (len: any, radix: any) => {
|
|
354
|
-
const chars =
|
|
355
|
-
'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split(
|
|
356
|
-
'',
|
|
357
|
-
);
|
|
358
|
-
const uuid = [];
|
|
359
|
-
let i;
|
|
360
|
-
radix = radix || chars.length;
|
|
361
|
-
if (len) {
|
|
362
|
-
for (i = 0; i < len; i++) {
|
|
363
|
-
uuid[i] = chars[0 | (Math.random() * radix)];
|
|
364
|
-
}
|
|
365
|
-
} else {
|
|
366
|
-
let r;
|
|
367
|
-
uuid[8] = uuid[3] = uuid[18] = uuid[23] = '-';
|
|
368
|
-
uuid[14] = '4';
|
|
369
|
-
for (i = 0; i < 36; i++) {
|
|
370
|
-
if (!uuid[i]) {
|
|
371
|
-
r = 0 | (Math.random() * 16);
|
|
372
|
-
uuid[i] = chars[i === 19 ? (r & 0x3) | 0x8 : r];
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
return uuid.join('');
|
|
377
|
-
},
|
|
378
|
-
// 打印销售订单
|
|
379
|
-
doSalesPrint: (
|
|
380
|
-
socket: WebSocket,
|
|
381
|
-
data: number[],
|
|
382
|
-
printer: string,
|
|
383
|
-
preview = false,
|
|
384
|
-
) => {
|
|
385
|
-
if (socket.readyState === 3) {
|
|
386
|
-
message.warn('请打开菜鸟打印组件');
|
|
387
|
-
return;
|
|
388
|
-
}
|
|
389
|
-
// if (printer === '' || printer === undefined) {
|
|
390
|
-
// message.warn(`没有打印机,请添加`);
|
|
391
|
-
// return;
|
|
392
|
-
// }
|
|
393
|
-
const documents: any = [];
|
|
394
|
-
data.forEach((v: any, i: number) => {
|
|
395
|
-
documents.push({
|
|
396
|
-
documentID: socketFunctions.getUUID(8, 10),
|
|
397
|
-
contents: [
|
|
398
|
-
{
|
|
399
|
-
data: v.data,
|
|
400
|
-
templateURL: `${window.location.origin}/basic/printTemplate/getXmlTemplate/${v.templateURL}`,
|
|
401
|
-
},
|
|
402
|
-
],
|
|
403
|
-
});
|
|
404
|
-
});
|
|
405
|
-
const requestID = `${socketFunctions.getUUID(8, 16)}`;
|
|
406
|
-
const taskID = socketFunctions.getUUID(8, 10);
|
|
407
|
-
const request = {
|
|
408
|
-
cmd: 'print',
|
|
409
|
-
requestID,
|
|
410
|
-
version: '1.0',
|
|
411
|
-
notifyType: ['print'],
|
|
412
|
-
task: {
|
|
413
|
-
taskID,
|
|
414
|
-
preview,
|
|
415
|
-
printer,
|
|
416
|
-
previewType: 'oneByOne',
|
|
417
|
-
documents,
|
|
418
|
-
totalDocumentCount: 100,
|
|
419
|
-
},
|
|
420
|
-
};
|
|
421
|
-
console.log(socket, '打印前的最后一步', request);
|
|
422
|
-
socket.send(JSON.stringify(request));
|
|
423
|
-
},
|
|
424
|
-
};
|
|
425
|
-
|
|
426
|
-
export {
|
|
427
|
-
socketFunctions,
|
|
428
|
-
ergodicMenuRoutes,
|
|
429
|
-
paramsControl,
|
|
430
|
-
// handleError,
|
|
431
|
-
handleOssUrl,
|
|
432
|
-
downloadExcel,
|
|
433
|
-
getDictionaryTextByValue,
|
|
434
|
-
getJoinDictionaryText,
|
|
435
|
-
authFunc,
|
|
436
|
-
handleBeforeUpload,
|
|
437
|
-
handleExport,
|
|
438
|
-
handleBaseUrlPre,
|
|
439
|
-
handleExportBarCode,
|
|
440
|
-
getBreadcrumbNameMap,
|
|
441
|
-
};
|
package/src/utils/constant.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
export const FORMAT_TIME_STR = 'YYYY-MM-DD HH:mm:ss';
|
|
2
|
-
export const FORMAT_DAY_STR = 'YYYY-MM-DD';
|
|
3
|
-
export const FUNCTION_UNDEFINED = 'undefined'
|
|
4
|
-
export const FUNCTION_GET = 'GET'
|
|
5
|
-
export const REQUEST_SUCCESS_CODE = '000000'
|
|
6
|
-
export const FORMAT_ARRAY_START = 'YYYY-MM-DD 00:00:00';
|
|
7
|
-
export const FORMAT_ARRAY_END = 'YYYY-MM-DD 23:59:59';
|
|
8
|
-
export const APPLICATION_SHEET = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
|
9
|
-
export const MENU_AUTH_KEY = 'menuAuth_mainProject'
|
|
10
|
-
export const DIC_DATA_KEY = 'dicData'
|
|
11
|
-
/* 字面量 */
|
|
12
|
-
// 字面量数字
|
|
13
|
-
export const NUMBER_VALUE = Object.freeze({
|
|
14
|
-
ZERO: 0,
|
|
15
|
-
ONE: 1,
|
|
16
|
-
TWO: 2,
|
|
17
|
-
THREE: 3,
|
|
18
|
-
FOUR: 4,
|
|
19
|
-
FIVE: 5,
|
|
20
|
-
SIX: 6,
|
|
21
|
-
SEVEN: 7,
|
|
22
|
-
EIGHT: 8,
|
|
23
|
-
NINE: 9,
|
|
24
|
-
TEN: 10,
|
|
25
|
-
ELEVEN: 11,
|
|
26
|
-
TWELVE: 12,
|
|
27
|
-
THIRTEEN: 13,
|
|
28
|
-
FOURTEEN: 14,
|
|
29
|
-
FIFTEEN: 15,
|
|
30
|
-
SIXTEEN: 16,
|
|
31
|
-
SEVENTEEN: 17,
|
|
32
|
-
EIGHTEEN: 18,
|
|
33
|
-
NINETEEN: 19,
|
|
34
|
-
TWENTY: 20,
|
|
35
|
-
TWENTY_ONE: 21,
|
|
36
|
-
TWENTY_TWO: 22,
|
|
37
|
-
TWENTY_THREE: 23,
|
|
38
|
-
TWENTY_FOUR: 24,
|
|
39
|
-
});
|
package/src/utils/request.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import request from "umi-request";
|
|
3
|
-
|
|
4
|
-
const get = (url, params?: any) => {
|
|
5
|
-
return request.get(url, {
|
|
6
|
-
...params,
|
|
7
|
-
}).then(handleResponseData);
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const post = (url, data?: any) => {
|
|
11
|
-
return request.post(url, {
|
|
12
|
-
data,
|
|
13
|
-
}).then(handleResponseData);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const patch = (url, data?: any) => {
|
|
17
|
-
return request.patch(url, {
|
|
18
|
-
data,
|
|
19
|
-
}).then(handleResponseData);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const put = (url, data?: any) => {
|
|
23
|
-
return request.put(url, {
|
|
24
|
-
data,
|
|
25
|
-
}).then(handleResponseData);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const deleteS = (url, data?: any) => {
|
|
29
|
-
return request.delete(url, {
|
|
30
|
-
data,
|
|
31
|
-
}).then(handleResponseData);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const requestUtil: any = ({ url, ...parms }: { url: string; parms: any }) => {
|
|
35
|
-
return request(url, parms).then(handleResponseData);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const handleResponseData = async (response: any) => {
|
|
41
|
-
return Promise.resolve({
|
|
42
|
-
data: response,
|
|
43
|
-
status: response.status
|
|
44
|
-
})
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
requestUtil.get = get;
|
|
48
|
-
requestUtil.post = post;
|
|
49
|
-
requestUtil.patch = patch;
|
|
50
|
-
requestUtil.put = put;
|
|
51
|
-
requestUtil.delete = deleteS;
|
|
52
|
-
|
|
53
|
-
export default requestUtil;
|