@kmkf-fe-packages/kmkf-work-order-service-component 0.8.7-alpha.2 → 0.8.7-alpha.20
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/esm/FlowTemplateDetail/components/FormRender/index.js +8 -5
- package/dist/esm/FlowTemplateDetail/index.js +15 -12
- package/dist/esm/FlowTemplateDetail/index.less +9 -0
- package/dist/esm/WorkOrder/index.js +1 -1
- package/dist/esm/WorkOrder/index.less +3 -1
- package/dist/esm/common/utils/tools.d.ts +20 -0
- package/dist/esm/common/utils/tools.js +200 -40
- package/dist/esm/index.d.ts +0 -1
- package/dist/esm/index.js +0 -1
- package/package.json +4 -4
- package/dist/esm/BatchSubmitFormList/BatchSubmitProgress.d.ts +0 -9
- package/dist/esm/BatchSubmitFormList/BatchSubmitProgress.js +0 -41
- package/dist/esm/BatchSubmitFormList/VirtualForm.d.ts +0 -11
- package/dist/esm/BatchSubmitFormList/VirtualForm.js +0 -190
- package/dist/esm/BatchSubmitFormList/common.d.ts +0 -1
- package/dist/esm/BatchSubmitFormList/common.js +0 -71
- package/dist/esm/BatchSubmitFormList/index.d.ts +0 -17
- package/dist/esm/BatchSubmitFormList/index.js +0 -207
|
@@ -190,6 +190,7 @@ var FormRender = function FormRender(props) {
|
|
|
190
190
|
return prv;
|
|
191
191
|
}, {});
|
|
192
192
|
if (workOrderId) {
|
|
193
|
+
var _record$jsonMap;
|
|
193
194
|
// 先初始化端上内容
|
|
194
195
|
var newRecord = cloneDeep(record);
|
|
195
196
|
newRecord.jsonMap = _objectSpread(_objectSpread({}, jsonMap), newRecord.jsonMap);
|
|
@@ -204,10 +205,10 @@ var FormRender = function FormRender(props) {
|
|
|
204
205
|
orderBackReplace(transData, templateDetail);
|
|
205
206
|
// TODO: 非开始节点录入,都会有workOrderId,这里判断是否有前置组件含有订单号;如果存在订单号,进行订单反填。
|
|
206
207
|
var tradeIdUniqueKey = hasComponent(templateDetail === null || templateDetail === void 0 ? void 0 : templateDetail.preNodeComponentDtoList, 'TRADE_ID_INPUT');
|
|
207
|
-
if (tradeIdUniqueKey) {
|
|
208
|
-
var _record$
|
|
208
|
+
if (tradeIdUniqueKey && shopId && record !== null && record !== void 0 && (_record$jsonMap = record.jsonMap) !== null && _record$jsonMap !== void 0 && _record$jsonMap["".concat(tradeIdUniqueKey, "_tradeId")]) {
|
|
209
|
+
var _record$jsonMap2;
|
|
209
210
|
orderBack({
|
|
210
|
-
order_no: record === null || record === void 0 ? void 0 : (_record$
|
|
211
|
+
order_no: record === null || record === void 0 ? void 0 : (_record$jsonMap2 = record.jsonMap) === null || _record$jsonMap2 === void 0 ? void 0 : _record$jsonMap2["".concat(tradeIdUniqueKey, "_tradeId")],
|
|
211
212
|
form: form,
|
|
212
213
|
shopId: shopId,
|
|
213
214
|
shopList: shopList,
|
|
@@ -224,7 +225,8 @@ var FormRender = function FormRender(props) {
|
|
|
224
225
|
shopId: shopId
|
|
225
226
|
}));
|
|
226
227
|
//如果有订单号 订单返填 通过订单号入口进行工单录入,需要将订单数据反填到工单
|
|
227
|
-
|
|
228
|
+
|
|
229
|
+
if (orderNo && shopId) {
|
|
228
230
|
orderBack({
|
|
229
231
|
order_no: orderNo,
|
|
230
232
|
form: form,
|
|
@@ -250,7 +252,8 @@ var FormRender = function FormRender(props) {
|
|
|
250
252
|
buyerId: buyerId,
|
|
251
253
|
buyerNick: buyerNick
|
|
252
254
|
});
|
|
253
|
-
}, [workOrderId, record]);
|
|
255
|
+
}, [workOrderId, record, shopId]);
|
|
256
|
+
|
|
254
257
|
//订单返填
|
|
255
258
|
var changeHandle = function changeHandle(order_no) {
|
|
256
259
|
if (!order_no) return;
|
|
@@ -38,7 +38,7 @@ import { verifyHandle, submitParams, FLOW_STATUS_V2, getTag } from "./common";
|
|
|
38
38
|
import { saveWorkOrder, submitWorkOrder, addRemark, stopWorkOrder, closeWorkOrder, startWorkOrder, forwardWorkOrder, returnWorkOrder } from "../model/flowTemplateDetail/api";
|
|
39
39
|
import "./index.less";
|
|
40
40
|
var FlowTemplateDetail = function FlowTemplateDetail(props) {
|
|
41
|
-
var _currentNodeDetail$no, _currentNodeDetail$
|
|
41
|
+
var _currentNodeDetail$no, _currentNodeDetail$no13, _currentNodeDetail$no14, _currentNodeDetail$no15;
|
|
42
42
|
var flowTemplateKey = props.flowTemplateKey,
|
|
43
43
|
_props$shopList = props.shopList,
|
|
44
44
|
shopList = _props$shopList === void 0 ? [] : _props$shopList,
|
|
@@ -568,16 +568,19 @@ var FlowTemplateDetail = function FlowTemplateDetail(props) {
|
|
|
568
568
|
initHandle();
|
|
569
569
|
}, []);
|
|
570
570
|
var isCurrentNodeHandler = useMemo(function () {
|
|
571
|
-
var _currentNodeDetail$no7, _currentNodeDetail$no8, _currentNodeDetail$no9, _currentNodeDetail$no10;
|
|
572
|
-
var
|
|
571
|
+
var _currentNodeDetail$no7, _currentNodeDetail$no8, _currentNodeDetail$no9, _currentNodeDetail$no10, _currentNodeDetail$wo11, _currentNodeDetail$wo12, _currentNodeDetail$wo13, _currentNodeDetail$wo14, _currentNodeDetail$wo15;
|
|
572
|
+
var groupCanOperate = (currentNodeDetail === null || currentNodeDetail === void 0 ? void 0 : (_currentNodeDetail$no7 = currentNodeDetail.nodeInfo) === null || _currentNodeDetail$no7 === void 0 ? void 0 : (_currentNodeDetail$no8 = _currentNodeDetail$no7.assistants) === null || _currentNodeDetail$no8 === void 0 ? void 0 : _currentNodeDetail$no8.operateDataPermission) === 'HANDLE_ALL';
|
|
573
573
|
var staffs = currentNodeDetail === null || currentNodeDetail === void 0 ? void 0 : (_currentNodeDetail$no9 = currentNodeDetail.nodeInfo) === null || _currentNodeDetail$no9 === void 0 ? void 0 : (_currentNodeDetail$no10 = _currentNodeDetail$no9.assistants) === null || _currentNodeDetail$no10 === void 0 ? void 0 : _currentNodeDetail$no10.staffIds;
|
|
574
|
-
if (
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
574
|
+
if (Array.isArray(currentNodeDetail === null || currentNodeDetail === void 0 ? void 0 : (_currentNodeDetail$wo11 = currentNodeDetail.workOrder) === null || _currentNodeDetail$wo11 === void 0 ? void 0 : _currentNodeDetail$wo11.handlerList) && (currentNodeDetail === null || currentNodeDetail === void 0 ? void 0 : (_currentNodeDetail$wo12 = currentNodeDetail.workOrder) === null || _currentNodeDetail$wo12 === void 0 ? void 0 : (_currentNodeDetail$wo13 = _currentNodeDetail$wo12.handlerList) === null || _currentNodeDetail$wo13 === void 0 ? void 0 : _currentNodeDetail$wo13.length) === 0) {
|
|
575
|
+
return true;
|
|
576
|
+
}
|
|
577
|
+
if (groupCanOperate) {
|
|
578
|
+
var _currentNodeDetail$no11, _currentNodeDetail$no12;
|
|
579
|
+
return (currentNodeDetail === null || currentNodeDetail === void 0 ? void 0 : (_currentNodeDetail$no11 = currentNodeDetail.nodeInfo) === null || _currentNodeDetail$no11 === void 0 ? void 0 : (_currentNodeDetail$no12 = _currentNodeDetail$no11.assistants) === null || _currentNodeDetail$no12 === void 0 ? void 0 : _currentNodeDetail$no12.isAllStaff) || (staffs === null || staffs === void 0 ? void 0 : staffs.includes(plat.userKey));
|
|
579
580
|
}
|
|
580
|
-
return (
|
|
581
|
+
return !!(currentNodeDetail !== null && currentNodeDetail !== void 0 && (_currentNodeDetail$wo14 = currentNodeDetail.workOrder) !== null && _currentNodeDetail$wo14 !== void 0 && (_currentNodeDetail$wo15 = _currentNodeDetail$wo14.handlerList) !== null && _currentNodeDetail$wo15 !== void 0 && _currentNodeDetail$wo15.find(function (item) {
|
|
582
|
+
return item.account === plat.accountName;
|
|
583
|
+
}));
|
|
581
584
|
}, [currentNodeDetail, plat]);
|
|
582
585
|
return /*#__PURE__*/React.createElement(Spin, {
|
|
583
586
|
spinning: loading
|
|
@@ -618,8 +621,8 @@ var FlowTemplateDetail = function FlowTemplateDetail(props) {
|
|
|
618
621
|
handleOpenRemarkList: handleOpenRemarkList,
|
|
619
622
|
handleOpenAddRemark: handleOpenAddRemark
|
|
620
623
|
}))), getTag({
|
|
621
|
-
nodeIsAuto: currentNodeDetail === null || currentNodeDetail === void 0 ? void 0 : (_currentNodeDetail$
|
|
622
|
-
nodeType: currentNodeDetail === null || currentNodeDetail === void 0 ? void 0 : (_currentNodeDetail$
|
|
624
|
+
nodeIsAuto: currentNodeDetail === null || currentNodeDetail === void 0 ? void 0 : (_currentNodeDetail$no13 = currentNodeDetail.nodeInfo) === null || _currentNodeDetail$no13 === void 0 ? void 0 : _currentNodeDetail$no13.isAuto,
|
|
625
|
+
nodeType: currentNodeDetail === null || currentNodeDetail === void 0 ? void 0 : (_currentNodeDetail$no14 = currentNodeDetail.nodeInfo) === null || _currentNodeDetail$no14 === void 0 ? void 0 : _currentNodeDetail$no14.nodeType
|
|
623
626
|
}) === 'artificial' && (!(currentNodeDetail !== null && currentNodeDetail !== void 0 && currentNodeDetail.workOrder) || isCurrentNodeHandler) && /*#__PURE__*/React.createElement("div", {
|
|
624
627
|
className: "footer"
|
|
625
628
|
}, /*#__PURE__*/React.createElement(ActionList, {
|
|
@@ -629,7 +632,7 @@ var FlowTemplateDetail = function FlowTemplateDetail(props) {
|
|
|
629
632
|
hasPreNode: (flowRecordList === null || flowRecordList === void 0 ? void 0 : flowRecordList.length) > 0
|
|
630
633
|
})), /*#__PURE__*/React.createElement(RemarkListModal, null), /*#__PURE__*/React.createElement(ForWardModal, {
|
|
631
634
|
flowWorkOrderId: flowWorkOrderId,
|
|
632
|
-
nodeId: currentNodeDetail === null || currentNodeDetail === void 0 ? void 0 : (_currentNodeDetail$
|
|
635
|
+
nodeId: currentNodeDetail === null || currentNodeDetail === void 0 ? void 0 : (_currentNodeDetail$no15 = currentNodeDetail.nodeInfo) === null || _currentNodeDetail$no15 === void 0 ? void 0 : _currentNodeDetail$no15.id,
|
|
633
636
|
handleForWard: handleForWard
|
|
634
637
|
}), /*#__PURE__*/React.createElement(StopModal, {
|
|
635
638
|
handleStop: handleStop
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PlatFormInfo } from '../../model/flowTemplateDetail/types';
|
|
1
2
|
/**
|
|
2
3
|
* 多级下拉框数据转换成aPaas数据结构
|
|
3
4
|
* @param {*} sourceOptions
|
|
@@ -71,3 +72,22 @@ export declare const getReplaceWarnValues: (templateDetail: {
|
|
|
71
72
|
}) => any;
|
|
72
73
|
export declare const HasFilterHandle: (templateDetail: any, filterList: string[]) => any;
|
|
73
74
|
export declare const HasErpItemSelectHandle: (templateDetail?: any) => any;
|
|
75
|
+
export declare const platformMap: any;
|
|
76
|
+
declare type SubmitParams = {
|
|
77
|
+
update: boolean;
|
|
78
|
+
formData: Record<string, any>;
|
|
79
|
+
currentNodeDetail?: {
|
|
80
|
+
workOrderTemplateInfo?: any;
|
|
81
|
+
nodeInfo?: any;
|
|
82
|
+
workOrder?: any;
|
|
83
|
+
};
|
|
84
|
+
plat: PlatFormInfo;
|
|
85
|
+
shopUniqueKey?: string;
|
|
86
|
+
operateParams: Record<string, any>;
|
|
87
|
+
};
|
|
88
|
+
export declare const submitParams: ({ update, formData, currentNodeDetail, plat, operateParams, shopUniqueKey, }: SubmitParams) => any;
|
|
89
|
+
export declare const verifyHandle: (data: any, componentDtoList: Array<any>) => {
|
|
90
|
+
success: boolean;
|
|
91
|
+
message: string;
|
|
92
|
+
};
|
|
93
|
+
export {};
|
|
@@ -22,6 +22,9 @@ import V from 'voca';
|
|
|
22
22
|
import { orderDetail, jstOrderDetail, bsOrderDetail } from "../../model/servers/api";
|
|
23
23
|
import moment from 'moment';
|
|
24
24
|
import { AddressData, ExpressData, orderBackFormValues, findLabelBySelectValue, request } from '@kmkf-fe-packages/kmkf-utils';
|
|
25
|
+
import { cloneDeep, isEqual, set } from 'lodash';
|
|
26
|
+
import { isNull } from '@kmkf-fe-packages/kmkf-utils';
|
|
27
|
+
import { PlatForm } from "../../model/flowTemplateDetail/types";
|
|
25
28
|
import cache from "../cache";
|
|
26
29
|
|
|
27
30
|
// 淘宝商品组件信息处理
|
|
@@ -958,7 +961,10 @@ var transDataSource = function transDataSource(templateColumns) {
|
|
|
958
961
|
logisticsCompany: null,
|
|
959
962
|
logisticsCode: null
|
|
960
963
|
}]);
|
|
961
|
-
return _objectSpread(_objectSpread({}, cur), {}, _defineProperty({}, "".concat(nex.uniqueKey), _itemList2
|
|
964
|
+
return _objectSpread(_objectSpread({}, cur), {}, _defineProperty({}, "".concat(nex.uniqueKey), _itemList2 !== null && _itemList2 !== void 0 && _itemList2.length ? _itemList2 : [{
|
|
965
|
+
logisticsCompany: null,
|
|
966
|
+
logisticsCode: null
|
|
967
|
+
}]));
|
|
962
968
|
} else if (nex.workOrderComponentType === 'JST_ITEM_SELECT_THIRD') {
|
|
963
969
|
var _itemList3 = jsonParseSecurity(item.jsonMap["".concat(nex.uniqueKey, "_jstItemList")], []);
|
|
964
970
|
return _objectSpread(_objectSpread({}, cur), {}, _defineProperty({}, "".concat(nex.uniqueKey), _itemList3));
|
|
@@ -966,13 +972,18 @@ var transDataSource = function transDataSource(templateColumns) {
|
|
|
966
972
|
var _itemList4 = jsonParseSecurity(item.jsonMap["".concat(nex.uniqueKey, "_jstItemList")], [{
|
|
967
973
|
supplyId: null
|
|
968
974
|
}]);
|
|
969
|
-
return _objectSpread(_objectSpread({}, cur), {}, _defineProperty({}, "".concat(nex.uniqueKey), _itemList4
|
|
975
|
+
return _objectSpread(_objectSpread({}, cur), {}, _defineProperty({}, "".concat(nex.uniqueKey), _itemList4 !== null && _itemList4 !== void 0 && _itemList4.length ? _itemList4 : [{
|
|
976
|
+
supplyId: null
|
|
977
|
+
}]));
|
|
970
978
|
} else if (nex.workOrderComponentType === 'JST_SEND_GOOD') {
|
|
971
979
|
var _itemList5 = jsonParseSecurity(item.jsonMap["".concat(nex.uniqueKey, "_jstItemList")], [{
|
|
972
980
|
sendName: '',
|
|
973
981
|
sendId: ''
|
|
974
982
|
}]);
|
|
975
|
-
return _objectSpread(_objectSpread({}, cur), {}, _defineProperty({}, "".concat(nex.uniqueKey), _itemList5
|
|
983
|
+
return _objectSpread(_objectSpread({}, cur), {}, _defineProperty({}, "".concat(nex.uniqueKey), _itemList5 !== null && _itemList5 !== void 0 && _itemList5.length ? _itemList5 : [{
|
|
984
|
+
sendName: '',
|
|
985
|
+
sendId: ''
|
|
986
|
+
}]));
|
|
976
987
|
} else if (nex.workOrderComponentType === 'BS_SIGNING_TIME') {
|
|
977
988
|
return _objectSpread(_objectSpread({}, cur), {}, _defineProperty({}, "".concat(nex.uniqueKey), item.jsonMap["".concat(nex.uniqueKey, "_bsSigningTime")]));
|
|
978
989
|
} else if (nex.workOrderComponentType === 'BS_SEND_TIME') {
|
|
@@ -995,13 +1006,19 @@ var transDataSource = function transDataSource(templateColumns) {
|
|
|
995
1006
|
logisticsCompany: null,
|
|
996
1007
|
logisticsCode: null
|
|
997
1008
|
}]);
|
|
998
|
-
return _objectSpread(_objectSpread({}, cur), {}, _defineProperty({}, "".concat(nex.uniqueKey), _itemList6
|
|
1009
|
+
return _objectSpread(_objectSpread({}, cur), {}, _defineProperty({}, "".concat(nex.uniqueKey), _itemList6 !== null && _itemList6 !== void 0 && _itemList6.length ? _itemList6 : [{
|
|
1010
|
+
logisticsCompany: null,
|
|
1011
|
+
logisticsCode: null
|
|
1012
|
+
}]));
|
|
999
1013
|
} else if (nex.workOrderComponentType === 'BS_SEND_GOOD') {
|
|
1000
1014
|
var _itemList7 = jsonParseSecurity(item.jsonMap["".concat(nex.uniqueKey, "_bsSendGood")], [{
|
|
1001
1015
|
sendName: '',
|
|
1002
1016
|
sendId: ''
|
|
1003
1017
|
}]);
|
|
1004
|
-
return _objectSpread(_objectSpread({}, cur), {}, _defineProperty({}, "".concat(nex.uniqueKey), _itemList7
|
|
1018
|
+
return _objectSpread(_objectSpread({}, cur), {}, _defineProperty({}, "".concat(nex.uniqueKey), _itemList7 !== null && _itemList7 !== void 0 && _itemList7.length ? _itemList7 : [{
|
|
1019
|
+
sendName: '',
|
|
1020
|
+
sendId: ''
|
|
1021
|
+
}]));
|
|
1005
1022
|
} else if (nex.workOrderComponentType === 'BS_POSTING') {
|
|
1006
1023
|
var BsAddress = [transTextToNumber(item.jsonMap["".concat(nex.uniqueKey, "_bsPostingProvince")]), transTextToNumber(item.jsonMap["".concat(nex.uniqueKey, "_bsPostingCity")])];
|
|
1007
1024
|
//兼容地址是只有省市的
|
|
@@ -1144,7 +1161,7 @@ var taobaoGoodHandle = /*#__PURE__*/function () {
|
|
|
1144
1161
|
//订单返填
|
|
1145
1162
|
export var orderBack = /*#__PURE__*/function () {
|
|
1146
1163
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref2) {
|
|
1147
|
-
var order_no, form, shopId, shopList, templateDetail, _ref2$type, type, callback, fromQNCreateWorkOrderByOrderNo, JOIN_SHOP, _ref4, shopSourceStr, _ref4$thirdUserNick, thirdUserNick, _data$value, _jstOrder$value, _jstOrder$value$data, _bsOrder$value, promise, hasJst,
|
|
1164
|
+
var order_no, form, shopId, shopList, templateDetail, _ref2$type, type, callback, fromQNCreateWorkOrderByOrderNo, JOIN_SHOP, hasBs, _ref4, shopSourceStr, _ref4$thirdUserNick, thirdUserNick, _data$value, _jstOrder$value, _jstOrder$value$data, _bsOrder$value, promise, hasJst, _yield$Promise$allSet, _yield$Promise$allSet2, data, jstOrder, bsOrder, orderInfo, jstInfo, bsInfo, formValue, detail, hasSelectItem, erpPromiseList, list, promises, _detail$itemList, values, _templateDetail$compo, paymentUniqueKey;
|
|
1148
1165
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1149
1166
|
while (1) switch (_context2.prev = _context2.next) {
|
|
1150
1167
|
case 0:
|
|
@@ -1152,36 +1169,50 @@ export var orderBack = /*#__PURE__*/function () {
|
|
|
1152
1169
|
//是否是对接平台,只有对接平台才能返填订单号
|
|
1153
1170
|
JOIN_SHOP = shopList.find(function (item) {
|
|
1154
1171
|
return !item.notJoin && item.shopId == shopId;
|
|
1155
|
-
});
|
|
1156
|
-
|
|
1157
|
-
|
|
1172
|
+
}); //判断是否有百胜组件 有就请求bs订单接口
|
|
1173
|
+
hasBs = HasFilterHandle(templateDetail, ['BS_SIGNING_TIME', 'BS_SEND_TIME', 'BS_TRADE_PAYMENT_TIME', 'BS_NET_RECEIPTS', 'BS_PACKAGE_WEIGHT', 'BS_GOODS', 'BS_DEPOSIT', 'BS_LOGISTICS', 'BS_SEND_GOOD', 'BS_POSTING']); //如果不是对接店铺且百胜组件都没有
|
|
1174
|
+
if (!(!JOIN_SHOP && !hasBs)) {
|
|
1175
|
+
_context2.next = 5;
|
|
1158
1176
|
break;
|
|
1159
1177
|
}
|
|
1160
1178
|
return _context2.abrupt("return");
|
|
1161
|
-
case
|
|
1179
|
+
case 5:
|
|
1162
1180
|
_ref4 = shopList.find(function (item) {
|
|
1163
1181
|
return item.shopId == shopId;
|
|
1164
1182
|
}) || {}, shopSourceStr = _ref4.shopSourceStr, _ref4$thirdUserNick = _ref4.thirdUserNick, thirdUserNick = _ref4$thirdUserNick === void 0 ? '' : _ref4$thirdUserNick;
|
|
1165
|
-
_context2.prev =
|
|
1166
|
-
promise = [
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1183
|
+
_context2.prev = 6;
|
|
1184
|
+
promise = [];
|
|
1185
|
+
if (!JOIN_SHOP) {
|
|
1186
|
+
promise.push(new Promise(function (resolve) {
|
|
1187
|
+
resolve([]);
|
|
1188
|
+
}));
|
|
1189
|
+
} else {
|
|
1190
|
+
promise.push(orderDetail({
|
|
1191
|
+
shopId: shopId,
|
|
1192
|
+
//店铺id
|
|
1193
|
+
orderNo: order_no,
|
|
1194
|
+
//订单id
|
|
1195
|
+
templateId: templateDetail.uniqueKey
|
|
1196
|
+
}));
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
//判断是否有聚水潭组件 有就请求jst订单接口
|
|
1173
1200
|
hasJst = HasFilterHandle(templateDetail, ['JST_LOGISTICS', 'JST_ITEM_SELECT_THIRD', 'JST_SUPPLY', 'JST_SEND_GOOD']);
|
|
1174
1201
|
if (hasJst) {
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1202
|
+
if (!JOIN_SHOP) {
|
|
1203
|
+
promise.push(new Promise(function (resolve) {
|
|
1204
|
+
resolve([]);
|
|
1205
|
+
}));
|
|
1206
|
+
} else {
|
|
1207
|
+
promise.push(jstOrderDetail({
|
|
1208
|
+
soId: order_no
|
|
1209
|
+
}));
|
|
1210
|
+
}
|
|
1178
1211
|
} else {
|
|
1179
1212
|
promise.push(new Promise(function (resolve) {
|
|
1180
1213
|
resolve([]);
|
|
1181
1214
|
}));
|
|
1182
1215
|
}
|
|
1183
|
-
//判断是否有百胜组件 有就请求bs订单接口
|
|
1184
|
-
hasBs = HasFilterHandle(templateDetail, ['BS_SIGNING_TIME', 'BS_SEND_TIME', 'BS_TRADE_PAYMENT_TIME', 'BS_NET_RECEIPTS', 'BS_PACKAGE_WEIGHT', 'BS_GOODS', 'BS_DEPOSIT', 'BS_LOGISTICS', 'BS_SEND_GOOD', 'BS_POSTING']);
|
|
1185
1216
|
if (hasBs) {
|
|
1186
1217
|
promise.push(bsOrderDetail({
|
|
1187
1218
|
billNo: order_no
|
|
@@ -1191,9 +1222,9 @@ export var orderBack = /*#__PURE__*/function () {
|
|
|
1191
1222
|
resolve({});
|
|
1192
1223
|
}));
|
|
1193
1224
|
}
|
|
1194
|
-
_context2.next =
|
|
1225
|
+
_context2.next = 14;
|
|
1195
1226
|
return Promise.allSettled(promise);
|
|
1196
|
-
case
|
|
1227
|
+
case 14:
|
|
1197
1228
|
_yield$Promise$allSet = _context2.sent;
|
|
1198
1229
|
_yield$Promise$allSet2 = _slicedToArray(_yield$Promise$allSet, 3);
|
|
1199
1230
|
data = _yield$Promise$allSet2[0];
|
|
@@ -1218,7 +1249,7 @@ export var orderBack = /*#__PURE__*/function () {
|
|
|
1218
1249
|
hasSelectItem = HasErpItemSelectHandle(templateDetail);
|
|
1219
1250
|
erpPromiseList = [];
|
|
1220
1251
|
if (!(shopSourceStr === 'TAOBAO' && hasSelectItem)) {
|
|
1221
|
-
_context2.next =
|
|
1252
|
+
_context2.next = 41;
|
|
1222
1253
|
break;
|
|
1223
1254
|
}
|
|
1224
1255
|
list = detail['itemList'];
|
|
@@ -1233,10 +1264,10 @@ export var orderBack = /*#__PURE__*/function () {
|
|
|
1233
1264
|
}
|
|
1234
1265
|
});
|
|
1235
1266
|
});
|
|
1236
|
-
_context2.prev =
|
|
1237
|
-
_context2.next =
|
|
1267
|
+
_context2.prev = 31;
|
|
1268
|
+
_context2.next = 34;
|
|
1238
1269
|
return Promise.all(promises);
|
|
1239
|
-
case
|
|
1270
|
+
case 34:
|
|
1240
1271
|
erpPromiseList = _context2.sent;
|
|
1241
1272
|
detail['itemList'] = (_detail$itemList = detail['itemList']) === null || _detail$itemList === void 0 ? void 0 : _detail$itemList.map(function (item, index) {
|
|
1242
1273
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
@@ -1246,13 +1277,13 @@ export var orderBack = /*#__PURE__*/function () {
|
|
|
1246
1277
|
})
|
|
1247
1278
|
});
|
|
1248
1279
|
});
|
|
1249
|
-
_context2.next =
|
|
1280
|
+
_context2.next = 41;
|
|
1250
1281
|
break;
|
|
1251
|
-
case
|
|
1252
|
-
_context2.prev =
|
|
1253
|
-
_context2.t0 = _context2["catch"](
|
|
1282
|
+
case 38:
|
|
1283
|
+
_context2.prev = 38;
|
|
1284
|
+
_context2.t0 = _context2["catch"](31);
|
|
1254
1285
|
console.error('调用erp获取宝贝编码错误', _context2.t0);
|
|
1255
|
-
case
|
|
1286
|
+
case 41:
|
|
1256
1287
|
values = orderBackFormValues({
|
|
1257
1288
|
detail: detail,
|
|
1258
1289
|
order_no: order_no,
|
|
@@ -1273,17 +1304,17 @@ export var orderBack = /*#__PURE__*/function () {
|
|
|
1273
1304
|
}
|
|
1274
1305
|
form.setFieldsValue(_objectSpread(_objectSpread({}, formValue), values));
|
|
1275
1306
|
callback === null || callback === void 0 ? void 0 : callback(detail, templateDetail);
|
|
1276
|
-
_context2.next =
|
|
1307
|
+
_context2.next = 50;
|
|
1277
1308
|
break;
|
|
1278
|
-
case
|
|
1279
|
-
_context2.prev =
|
|
1280
|
-
_context2.t1 = _context2["catch"](
|
|
1309
|
+
case 47:
|
|
1310
|
+
_context2.prev = 47;
|
|
1311
|
+
_context2.t1 = _context2["catch"](6);
|
|
1281
1312
|
console.error(_context2.t1);
|
|
1282
|
-
case
|
|
1313
|
+
case 50:
|
|
1283
1314
|
case "end":
|
|
1284
1315
|
return _context2.stop();
|
|
1285
1316
|
}
|
|
1286
|
-
}, _callee2, null, [[
|
|
1317
|
+
}, _callee2, null, [[6, 47], [31, 38]]);
|
|
1287
1318
|
}));
|
|
1288
1319
|
return function orderBack(_x) {
|
|
1289
1320
|
return _ref3.apply(this, arguments);
|
|
@@ -1402,4 +1433,133 @@ export var HasErpItemSelectHandle = function HasErpItemSelectHandle() {
|
|
|
1402
1433
|
return templateDetail.componentDtoList.some(function (item) {
|
|
1403
1434
|
return ['ITEM_SELECT_THIRD'].includes(item.workOrderComponentType);
|
|
1404
1435
|
});
|
|
1436
|
+
};
|
|
1437
|
+
export var platformMap = {
|
|
1438
|
+
tb: '淘宝',
|
|
1439
|
+
fxg: '抖音',
|
|
1440
|
+
ks: '快手',
|
|
1441
|
+
pdd: '拼多多',
|
|
1442
|
+
jd: '京东',
|
|
1443
|
+
xiaozhi: '小智',
|
|
1444
|
+
pc: '客服工作台'
|
|
1445
|
+
};
|
|
1446
|
+
export var submitParams = function submitParams(_ref5) {
|
|
1447
|
+
var _currentNodeDetail$no;
|
|
1448
|
+
var update = _ref5.update,
|
|
1449
|
+
formData = _ref5.formData,
|
|
1450
|
+
currentNodeDetail = _ref5.currentNodeDetail,
|
|
1451
|
+
plat = _ref5.plat,
|
|
1452
|
+
operateParams = _ref5.operateParams,
|
|
1453
|
+
shopUniqueKey = _ref5.shopUniqueKey;
|
|
1454
|
+
var newTemplateDetail = cloneDeep(currentNodeDetail === null || currentNodeDetail === void 0 ? void 0 : currentNodeDetail.workOrderTemplateInfo) || {};
|
|
1455
|
+
var params = {
|
|
1456
|
+
isAdd: !update,
|
|
1457
|
+
operateParams: _objectSpread({
|
|
1458
|
+
nodeId: currentNodeDetail === null || currentNodeDetail === void 0 ? void 0 : (_currentNodeDetail$no = currentNodeDetail.nodeInfo) === null || _currentNodeDetail$no === void 0 ? void 0 : _currentNodeDetail$no.id
|
|
1459
|
+
}, operateParams)
|
|
1460
|
+
};
|
|
1461
|
+
if (update) {
|
|
1462
|
+
var _currentNodeDetail$wo, _currentNodeDetail$wo2, _currentNodeDetail$wo3, _currentNodeDetail$wo4, _currentNodeDetail$wo5;
|
|
1463
|
+
params.updateInfo = {
|
|
1464
|
+
templateId: currentNodeDetail === null || currentNodeDetail === void 0 ? void 0 : (_currentNodeDetail$wo = currentNodeDetail.workOrder) === null || _currentNodeDetail$wo === void 0 ? void 0 : _currentNodeDetail$wo.templateId,
|
|
1465
|
+
workOrderId: currentNodeDetail === null || currentNodeDetail === void 0 ? void 0 : (_currentNodeDetail$wo2 = currentNodeDetail.workOrder) === null || _currentNodeDetail$wo2 === void 0 ? void 0 : _currentNodeDetail$wo2.id,
|
|
1466
|
+
updateTime: currentNodeDetail === null || currentNodeDetail === void 0 ? void 0 : (_currentNodeDetail$wo3 = currentNodeDetail.workOrder) === null || _currentNodeDetail$wo3 === void 0 ? void 0 : _currentNodeDetail$wo3.update
|
|
1467
|
+
};
|
|
1468
|
+
params.workOrderUpdateKeyVos = {
|
|
1469
|
+
// 这个参数在submitDataTransOldFormat中使用到
|
|
1470
|
+
workOrderId: currentNodeDetail === null || currentNodeDetail === void 0 ? void 0 : (_currentNodeDetail$wo4 = currentNodeDetail.workOrder) === null || _currentNodeDetail$wo4 === void 0 ? void 0 : _currentNodeDetail$wo4.id,
|
|
1471
|
+
workOrderUpdateKeySupVos: []
|
|
1472
|
+
};
|
|
1473
|
+
var submitData = submitDataTransOldFormat(formData, newTemplateDetail, !!(currentNodeDetail !== null && currentNodeDetail !== void 0 && (_currentNodeDetail$wo5 = currentNodeDetail.workOrder) !== null && _currentNodeDetail$wo5 !== void 0 && _currentNodeDetail$wo5.id), currentNodeDetail === null || currentNodeDetail === void 0 ? void 0 : currentNodeDetail.workOrder, params, plat.accountName);
|
|
1474
|
+
var updateList = submitData === null || submitData === void 0 ? void 0 : submitData.reduce(function (cur, nxt) {
|
|
1475
|
+
var _nxt$contentList;
|
|
1476
|
+
nxt === null || nxt === void 0 ? void 0 : (_nxt$contentList = nxt.contentList) === null || _nxt$contentList === void 0 ? void 0 : _nxt$contentList.map(function (item) {
|
|
1477
|
+
if (!isEqual(item.oldContent, item.content)) {
|
|
1478
|
+
cur.push({
|
|
1479
|
+
dataKey: item.uniqueKey,
|
|
1480
|
+
name: item.name,
|
|
1481
|
+
oldValue: item.oldContent,
|
|
1482
|
+
dataValue: item.content
|
|
1483
|
+
});
|
|
1484
|
+
}
|
|
1485
|
+
});
|
|
1486
|
+
return cur;
|
|
1487
|
+
}, []);
|
|
1488
|
+
params.updateInfo.updateList = updateList;
|
|
1489
|
+
params.updateInfo.needTransForm = params.needTransForm;
|
|
1490
|
+
delete params.workOrderUpdateKeyVos;
|
|
1491
|
+
delete params.needTransForm;
|
|
1492
|
+
} else {
|
|
1493
|
+
var _Object$keys, _currentNodeDetail$wo6, _currentNodeDetail$wo7, _currentNodeDetail$wo8, _currentNodeDetail$wo9, _currentNodeDetail$wo10, _currentNodeDetail$wo11, _currentNodeDetail$wo12, _currentNodeDetail$wo13, _currentNodeDetail$wo14, _currentNodeDetail$wo15, _currentNodeDetail$wo16, _currentNodeDetail$wo17, _currentNodeDetail$wo18, _currentNodeDetail$wo19;
|
|
1494
|
+
// TODO: 新保存工单
|
|
1495
|
+
// 获取当前表单中非空字段
|
|
1496
|
+
var finalComponentList = (_Object$keys = Object.keys(formData)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.filter(function (i) {
|
|
1497
|
+
return !isNull(formData[i]);
|
|
1498
|
+
});
|
|
1499
|
+
// 获取非空字段对应的组件
|
|
1500
|
+
var finalDtoList = currentNodeDetail === null || currentNodeDetail === void 0 ? void 0 : (_currentNodeDetail$wo6 = currentNodeDetail.workOrderTemplateInfo) === null || _currentNodeDetail$wo6 === void 0 ? void 0 : (_currentNodeDetail$wo7 = _currentNodeDetail$wo6.componentDtoList) === null || _currentNodeDetail$wo7 === void 0 ? void 0 : _currentNodeDetail$wo7.filter(function (item) {
|
|
1501
|
+
return finalComponentList.includes(item.uniqueKey);
|
|
1502
|
+
});
|
|
1503
|
+
set(newTemplateDetail, 'componentDtoList', finalDtoList);
|
|
1504
|
+
params.workOrder = {
|
|
1505
|
+
templateId: currentNodeDetail === null || currentNodeDetail === void 0 ? void 0 : (_currentNodeDetail$wo8 = currentNodeDetail.workOrderTemplateInfo) === null || _currentNodeDetail$wo8 === void 0 ? void 0 : _currentNodeDetail$wo8.uniqueKey,
|
|
1506
|
+
handleWorkOrderId: currentNodeDetail === null || currentNodeDetail === void 0 ? void 0 : (_currentNodeDetail$wo9 = currentNodeDetail.workOrder) === null || _currentNodeDetail$wo9 === void 0 ? void 0 : _currentNodeDetail$wo9.id,
|
|
1507
|
+
buyerNick: plat === null || plat === void 0 ? void 0 : plat.buyerNick,
|
|
1508
|
+
buyerOpenUid: plat === null || plat === void 0 ? void 0 : plat.buyerId,
|
|
1509
|
+
shopUniqueKey: shopUniqueKey,
|
|
1510
|
+
tid: plat === null || plat === void 0 ? void 0 : plat.orderNo,
|
|
1511
|
+
workOrderComponents: [],
|
|
1512
|
+
source: get(platformMap, "".concat(plat === null || plat === void 0 ? void 0 : plat.platform), '工单通')
|
|
1513
|
+
};
|
|
1514
|
+
|
|
1515
|
+
// 判断是否有订单号组建,订单号数据需要特殊处理
|
|
1516
|
+
var tradeIdUniqueKey = currentNodeDetail === null || currentNodeDetail === void 0 ? void 0 : (_currentNodeDetail$wo10 = currentNodeDetail.workOrderTemplateInfo) === null || _currentNodeDetail$wo10 === void 0 ? void 0 : (_currentNodeDetail$wo11 = _currentNodeDetail$wo10.componentDtoList) === null || _currentNodeDetail$wo11 === void 0 ? void 0 : (_currentNodeDetail$wo12 = _currentNodeDetail$wo11.find(function (item) {
|
|
1517
|
+
return item.workOrderComponentType === 'TRADE_ID_INPUT';
|
|
1518
|
+
})) === null || _currentNodeDetail$wo12 === void 0 ? void 0 : _currentNodeDetail$wo12.uniqueKey;
|
|
1519
|
+
// 判断是否有订单号组建,订单号数据需要特殊处理
|
|
1520
|
+
var paymentTradeIdUniqueKey = currentNodeDetail === null || currentNodeDetail === void 0 ? void 0 : (_currentNodeDetail$wo13 = currentNodeDetail.workOrderTemplateInfo) === null || _currentNodeDetail$wo13 === void 0 ? void 0 : (_currentNodeDetail$wo14 = _currentNodeDetail$wo13.componentDtoList) === null || _currentNodeDetail$wo14 === void 0 ? void 0 : (_currentNodeDetail$wo15 = _currentNodeDetail$wo14.find(function (item) {
|
|
1521
|
+
return item.workOrderComponentType === 'ENTERPRISE_PAYMENT';
|
|
1522
|
+
})) === null || _currentNodeDetail$wo15 === void 0 ? void 0 : _currentNodeDetail$wo15.uniqueKey;
|
|
1523
|
+
|
|
1524
|
+
// 判断是否有买家昵称或者
|
|
1525
|
+
var buyerNickUniqueKey = currentNodeDetail === null || currentNodeDetail === void 0 ? void 0 : (_currentNodeDetail$wo16 = currentNodeDetail.workOrderTemplateInfo) === null || _currentNodeDetail$wo16 === void 0 ? void 0 : (_currentNodeDetail$wo17 = _currentNodeDetail$wo16.componentDtoList) === null || _currentNodeDetail$wo17 === void 0 ? void 0 : (_currentNodeDetail$wo18 = _currentNodeDetail$wo17.find(function (item) {
|
|
1526
|
+
return item.workOrderComponentType === 'BUYER_NICK_INPUT';
|
|
1527
|
+
})) === null || _currentNodeDetail$wo18 === void 0 ? void 0 : _currentNodeDetail$wo18.uniqueKey;
|
|
1528
|
+
if (paymentTradeIdUniqueKey) {
|
|
1529
|
+
var _formData, _formData2;
|
|
1530
|
+
params.workOrder.tid = formData === null || formData === void 0 ? void 0 : (_formData = formData["".concat(paymentTradeIdUniqueKey)]) === null || _formData === void 0 ? void 0 : _formData.enterprisePaymentTid;
|
|
1531
|
+
params.workOrder.buyerOpenUid = formData === null || formData === void 0 ? void 0 : (_formData2 = formData["".concat(paymentTradeIdUniqueKey)]) === null || _formData2 === void 0 ? void 0 : _formData2.enterprisePaymentBuyerOpenUid;
|
|
1532
|
+
}
|
|
1533
|
+
if (tradeIdUniqueKey) {
|
|
1534
|
+
params.workOrder.tid = formData === null || formData === void 0 ? void 0 : formData[tradeIdUniqueKey];
|
|
1535
|
+
}
|
|
1536
|
+
if (buyerNickUniqueKey) {
|
|
1537
|
+
var _formData$buyerNickUn;
|
|
1538
|
+
params.workOrder.buyerOpenUid = formData === null || formData === void 0 ? void 0 : (_formData$buyerNickUn = formData[buyerNickUniqueKey]) === null || _formData$buyerNickUn === void 0 ? void 0 : _formData$buyerNickUn.buyerOpenUid;
|
|
1539
|
+
}
|
|
1540
|
+
params.workOrder.workOrderComponents = submitDataTransOldFormat(formData, newTemplateDetail, !!(currentNodeDetail !== null && currentNodeDetail !== void 0 && (_currentNodeDetail$wo19 = currentNodeDetail.workOrder) !== null && _currentNodeDetail$wo19 !== void 0 && _currentNodeDetail$wo19.id), currentNodeDetail === null || currentNodeDetail === void 0 ? void 0 : currentNodeDetail.workOrder, params.workOrder, (plat === null || plat === void 0 ? void 0 : plat.accountName) || '');
|
|
1541
|
+
//端上有买家id 就返填当前买家 即使不是当前买家的订单
|
|
1542
|
+
if (plat.platform !== PlatForm.PC && plat !== null && plat !== void 0 && plat.buyerId) {
|
|
1543
|
+
params.workOrder.buyerOpenUid = plat === null || plat === void 0 ? void 0 : plat.buyerId;
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1546
|
+
return params;
|
|
1547
|
+
};
|
|
1548
|
+
export var verifyHandle = function verifyHandle(data, componentDtoList) {
|
|
1549
|
+
var _componentDtoList$fin, _componentDtoList$fin2, _data$paymentUniqueKe, _data$paymentUniqueKe2;
|
|
1550
|
+
var res = {
|
|
1551
|
+
success: true,
|
|
1552
|
+
message: ''
|
|
1553
|
+
};
|
|
1554
|
+
var tradeIdUniqueKey = (_componentDtoList$fin = componentDtoList.find(function (item) {
|
|
1555
|
+
return item.workOrderComponentType === 'TRADE_ID_INPUT';
|
|
1556
|
+
})) === null || _componentDtoList$fin === void 0 ? void 0 : _componentDtoList$fin.uniqueKey;
|
|
1557
|
+
var paymentUniqueKey = (_componentDtoList$fin2 = componentDtoList.find(function (item) {
|
|
1558
|
+
return item.workOrderComponentType === 'ENTERPRISE_PAYMENT';
|
|
1559
|
+
})) === null || _componentDtoList$fin2 === void 0 ? void 0 : _componentDtoList$fin2.uniqueKey;
|
|
1560
|
+
if (tradeIdUniqueKey && paymentUniqueKey && data[tradeIdUniqueKey] && (_data$paymentUniqueKe = data[paymentUniqueKey]) !== null && _data$paymentUniqueKe !== void 0 && _data$paymentUniqueKe.enterprisePaymentTid && data[tradeIdUniqueKey] != ((_data$paymentUniqueKe2 = data[paymentUniqueKey]) === null || _data$paymentUniqueKe2 === void 0 ? void 0 : _data$paymentUniqueKe2.enterprisePaymentTid)) {
|
|
1561
|
+
res.success = false;
|
|
1562
|
+
res.message = '订单组件和打款组件的订单号必须一致';
|
|
1563
|
+
}
|
|
1564
|
+
return res;
|
|
1405
1565
|
};
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -4,6 +4,5 @@ export { default as SingleShopWorkOrder } from './SingleShopWorkOrder';
|
|
|
4
4
|
export { default as FormRender } from './FormRender';
|
|
5
5
|
export { default as FormRenderTemplateId } from './FormRenderTemplateId';
|
|
6
6
|
export { default as FlowWorkOrderDetail } from './FlowTemplateDetail';
|
|
7
|
-
export { default as BatchSubmitFormList } from './BatchSubmitFormList';
|
|
8
7
|
export * as utils from './common/utils/tools';
|
|
9
8
|
export * from './WorkOrder/types';
|
package/dist/esm/index.js
CHANGED
|
@@ -14,7 +14,6 @@ export { default as SingleShopWorkOrder } from "./SingleShopWorkOrder";
|
|
|
14
14
|
export { default as FormRender } from "./FormRender";
|
|
15
15
|
export { default as FormRenderTemplateId } from "./FormRenderTemplateId";
|
|
16
16
|
export { default as FlowWorkOrderDetail } from "./FlowTemplateDetail";
|
|
17
|
-
export { default as BatchSubmitFormList } from "./BatchSubmitFormList";
|
|
18
17
|
import * as _utils from "./common/utils/tools";
|
|
19
18
|
export { _utils as utils };
|
|
20
19
|
export * from "./WorkOrder/types";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kmkf-fe-packages/kmkf-work-order-service-component",
|
|
3
|
-
"version": "0.8.7-alpha.
|
|
3
|
+
"version": "0.8.7-alpha.20",
|
|
4
4
|
"module": "dist/esm/index.js",
|
|
5
5
|
"typings": "dist/esm/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@ant-design/icons": "^4.7.0",
|
|
35
|
-
"@kmkf-fe-packages/basic-components": "^0.8.7-alpha.
|
|
35
|
+
"@kmkf-fe-packages/basic-components": "^0.8.7-alpha.18",
|
|
36
36
|
"@kmkf-fe-packages/kmkf-utils": "^0.8.7-alpha.0",
|
|
37
|
-
"@kmkf-fe-packages/services-components": "^0.8.7-alpha.
|
|
37
|
+
"@kmkf-fe-packages/services-components": "^0.8.7-alpha.18",
|
|
38
38
|
"@reduxjs/toolkit": "^1.8.5",
|
|
39
39
|
"ahooks": "^3.7.4",
|
|
40
40
|
"copy-to-clipboard": "^3.3.3",
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"gitHooks": {
|
|
76
76
|
"pre-commit": "lint-staged"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "6a95ad7995db03eaf5a85a8e8e2b9809ccf6624f"
|
|
79
79
|
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
6
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
-
import React, { useEffect, useState, useRef } from 'react';
|
|
8
|
-
import { Progress } from 'antd';
|
|
9
|
-
import { isEmpty } from 'lodash';
|
|
10
|
-
var BatchSubmitProgress = function BatchSubmitProgress(_ref) {
|
|
11
|
-
var result = _ref.result;
|
|
12
|
-
var _useState = useState(0),
|
|
13
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
14
|
-
percent = _useState2[0],
|
|
15
|
-
setPercent = _useState2[1];
|
|
16
|
-
var timer = useRef(null);
|
|
17
|
-
useEffect(function () {
|
|
18
|
-
timer.current = setInterval(function () {
|
|
19
|
-
setPercent(function (p) {
|
|
20
|
-
return ++p;
|
|
21
|
-
});
|
|
22
|
-
}, 2000);
|
|
23
|
-
return function () {
|
|
24
|
-
return clearInterval(timer.current);
|
|
25
|
-
};
|
|
26
|
-
}, []);
|
|
27
|
-
useEffect(function () {
|
|
28
|
-
if (!isEmpty(result)) {
|
|
29
|
-
clearInterval(timer.current);
|
|
30
|
-
setPercent(100);
|
|
31
|
-
}
|
|
32
|
-
}, [result]);
|
|
33
|
-
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, percent !== 100 && '工单提交中,请勿关闭弹框'), /*#__PURE__*/React.createElement(Progress, {
|
|
34
|
-
percent: percent
|
|
35
|
-
}), !isEmpty(result) && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, "\u6210\u529F\u6570\u91CF: ".concat(result === null || result === void 0 ? void 0 : result.success)), /*#__PURE__*/React.createElement("span", {
|
|
36
|
-
style: {
|
|
37
|
-
marginLeft: '16px'
|
|
38
|
-
}
|
|
39
|
-
}, "\u5931\u8D25\u6570\u91CF: ".concat(result === null || result === void 0 ? void 0 : result.failed))));
|
|
40
|
-
};
|
|
41
|
-
export default BatchSubmitProgress;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { FormInstance } from 'antd';
|
|
3
|
-
import { FlowTemplateNodeDetailT } from '../model/flowTemplateDetail/api';
|
|
4
|
-
declare type VirtualFormProps = {
|
|
5
|
-
callBackPushForm: (p: FormInstance, workOrderId: string) => void;
|
|
6
|
-
record: any;
|
|
7
|
-
detail: FlowTemplateNodeDetailT;
|
|
8
|
-
shopList: any[];
|
|
9
|
-
};
|
|
10
|
-
declare const VirtualForm: ({ callBackPushForm, record, detail: templateDetail, shopList }: VirtualFormProps) => React.JSX.Element;
|
|
11
|
-
export default VirtualForm;
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
var _excluded = ["displayConfig", "disabled"];
|
|
3
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
5
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
6
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
9
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
11
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
13
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
14
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
15
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
16
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
17
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
18
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
19
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
|
-
import React, { useEffect, useMemo, useRef } from 'react';
|
|
21
|
-
import { Form } from 'antd';
|
|
22
|
-
import { get, every, some, cloneDeep } from 'lodash';
|
|
23
|
-
import { factory } from '@kmkf-fe-packages/services-components';
|
|
24
|
-
import { getExpression, formatDisplayConfig } from '@kmkf-fe-packages/kmkf-utils';
|
|
25
|
-
import { calcWorkOrderList } from "../common/utils/tools";
|
|
26
|
-
import ShopName from "../FlowTemplateDetail/components/ShopName";
|
|
27
|
-
var VirtualForm = function VirtualForm(_ref) {
|
|
28
|
-
var callBackPushForm = _ref.callBackPushForm,
|
|
29
|
-
record = _ref.record,
|
|
30
|
-
templateDetail = _ref.detail,
|
|
31
|
-
shopList = _ref.shopList;
|
|
32
|
-
console.log('record', record);
|
|
33
|
-
console.log('templateDetail', templateDetail);
|
|
34
|
-
var _Form$useForm = Form.useForm(),
|
|
35
|
-
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
36
|
-
form = _Form$useForm2[0];
|
|
37
|
-
var queryDetail = function queryDetail(record) {
|
|
38
|
-
// 先初始化端上内容
|
|
39
|
-
var newRecord = cloneDeep(record);
|
|
40
|
-
newRecord.jsonMap = _objectSpread({}, newRecord.jsonMap);
|
|
41
|
-
var transData = calcWorkOrderList([newRecord], [].concat(_toConsumableArray((templateDetail === null || templateDetail === void 0 ? void 0 : templateDetail.preNodeComponentDtoList) || []), _toConsumableArray((templateDetail === null || templateDetail === void 0 ? void 0 : templateDetail.componentDtoList) || [])));
|
|
42
|
-
form.setFieldsValue(_objectSpread(_objectSpread({}, get(transData, '0', {})), {}, {
|
|
43
|
-
shopId: record === null || record === void 0 ? void 0 : record.shopId,
|
|
44
|
-
shopName: newRecord.shopName,
|
|
45
|
-
submitter: newRecord.submitter,
|
|
46
|
-
created: newRecord.created,
|
|
47
|
-
processTime: newRecord.processTime
|
|
48
|
-
}));
|
|
49
|
-
};
|
|
50
|
-
useEffect(function () {
|
|
51
|
-
callBackPushForm(form, record === null || record === void 0 ? void 0 : record.id);
|
|
52
|
-
}, []);
|
|
53
|
-
useEffect(function () {
|
|
54
|
-
queryDetail(record);
|
|
55
|
-
}, [record, templateDetail]);
|
|
56
|
-
var currentComponentDisplayStatus = useRef({});
|
|
57
|
-
// 根据字段id获取组件信息
|
|
58
|
-
var getComponentDetailByFieldId = function getComponentDetailByFieldId(id) {
|
|
59
|
-
var info = [].concat(_toConsumableArray(get(templateDetail, 'componentDtoList', [])), _toConsumableArray(get(templateDetail, 'preNodeComponentDtoList', []))).find(function (item) {
|
|
60
|
-
return item.uniqueKey === id;
|
|
61
|
-
});
|
|
62
|
-
if (!info) return {};
|
|
63
|
-
return factory(info.workOrderComponentType, {
|
|
64
|
-
id: info.uniqueKey,
|
|
65
|
-
name: info.name,
|
|
66
|
-
componentConfig: info.componentConfig,
|
|
67
|
-
effects: {},
|
|
68
|
-
type: info.workOrderComponentType
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
|
-
var newRenderColumnItem = function newRenderColumnItem(effects) {
|
|
72
|
-
return function (item) {
|
|
73
|
-
var _item$componentConfig = item.componentConfig,
|
|
74
|
-
componentConfig = _item$componentConfig === void 0 ? {} : _item$componentConfig,
|
|
75
|
-
workOrderComponentType = item.workOrderComponentType,
|
|
76
|
-
uniqueKey = item.uniqueKey,
|
|
77
|
-
name = item.name;
|
|
78
|
-
var displayConfig = effects.displayConfig,
|
|
79
|
-
disabled = effects.disabled,
|
|
80
|
-
others = _objectWithoutProperties(effects, _excluded);
|
|
81
|
-
var newComponentConfig = _objectSpread(_objectSpread({}, componentConfig), {}, {
|
|
82
|
-
disabled: disabled
|
|
83
|
-
});
|
|
84
|
-
var idConditionListMap = formatDisplayConfig(displayConfig);
|
|
85
|
-
var instance = factory(workOrderComponentType, {
|
|
86
|
-
id: uniqueKey,
|
|
87
|
-
name: name,
|
|
88
|
-
componentConfig: newComponentConfig,
|
|
89
|
-
effects: others,
|
|
90
|
-
type: workOrderComponentType
|
|
91
|
-
});
|
|
92
|
-
if (Reflect.has(idConditionListMap, instance.id)) {
|
|
93
|
-
var currentIdDependenceOtherFields = idConditionListMap[instance.id];
|
|
94
|
-
// 需要增加显隐处理逻辑
|
|
95
|
-
return /*#__PURE__*/React.createElement(Form.Item, {
|
|
96
|
-
noStyle: true,
|
|
97
|
-
shouldUpdate: function shouldUpdate() {
|
|
98
|
-
return true; // TODO: 修复重复依赖的问题 https://tb.raycloud.com/task/64e4491e0b8b5c001e1099b9
|
|
99
|
-
}
|
|
100
|
-
}, function (_ref2) {
|
|
101
|
-
var getFieldValue = _ref2.getFieldValue;
|
|
102
|
-
var show = currentIdDependenceOtherFields === null || currentIdDependenceOtherFields === void 0 ? void 0 : currentIdDependenceOtherFields.reduce(function (cur, nxt) {
|
|
103
|
-
// 如果有一项满足展示条件则展示
|
|
104
|
-
if (cur) {
|
|
105
|
-
return cur;
|
|
106
|
-
}
|
|
107
|
-
var conditionList = nxt.rules;
|
|
108
|
-
var linkCondition = nxt.linkCondition;
|
|
109
|
-
// 满足所有
|
|
110
|
-
if (linkCondition === 'every') {
|
|
111
|
-
return every(conditionList, function (item) {
|
|
112
|
-
var _item$compareSymbol;
|
|
113
|
-
var dependenceDetail = getComponentDetailByFieldId(item.leftValue);
|
|
114
|
-
var leftValue = getFieldValue(item.leftValue);
|
|
115
|
-
if (typeof dependenceDetail.formDataTransform === 'function') {
|
|
116
|
-
leftValue = dependenceDetail.formDataTransform(leftValue);
|
|
117
|
-
}
|
|
118
|
-
// TODO: 如果依赖的组件是隐藏的,当前依赖项为false
|
|
119
|
-
if (Reflect.has(currentComponentDisplayStatus.current, item.leftValue) && !currentComponentDisplayStatus.current[item.leftValue]) {
|
|
120
|
-
console.log('every', item.leftValue, currentComponentDisplayStatus.current[item.leftValue]);
|
|
121
|
-
return false;
|
|
122
|
-
}
|
|
123
|
-
return getExpression((_item$compareSymbol = item.compareSymbol) === null || _item$compareSymbol === void 0 ? void 0 : _item$compareSymbol.toUpperCase(), leftValue, item.rightValue);
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
// 满足其中之一
|
|
127
|
-
return some(conditionList, function (item) {
|
|
128
|
-
var _item$compareSymbol2;
|
|
129
|
-
var dependenceDetail = getComponentDetailByFieldId(item.leftValue);
|
|
130
|
-
var leftValue = getFieldValue(item.leftValue);
|
|
131
|
-
if (typeof dependenceDetail.formDataTransform === 'function') {
|
|
132
|
-
leftValue = dependenceDetail.formDataTransform(leftValue);
|
|
133
|
-
}
|
|
134
|
-
// TODO: 如果依赖的组件是隐藏的,当前依赖项为false
|
|
135
|
-
if (Reflect.has(currentComponentDisplayStatus.current, item.leftValue) && !currentComponentDisplayStatus.current[item.leftValue]) {
|
|
136
|
-
return false;
|
|
137
|
-
}
|
|
138
|
-
return getExpression((_item$compareSymbol2 = item.compareSymbol) === null || _item$compareSymbol2 === void 0 ? void 0 : _item$compareSymbol2.toUpperCase(), leftValue, item.rightValue);
|
|
139
|
-
});
|
|
140
|
-
}, false);
|
|
141
|
-
currentComponentDisplayStatus.current[instance === null || instance === void 0 ? void 0 : instance.id] = show;
|
|
142
|
-
return instance.editRender({
|
|
143
|
-
hidden: !show
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
return instance.editRender({});
|
|
148
|
-
};
|
|
149
|
-
};
|
|
150
|
-
var finalFormItems = useMemo(function () {
|
|
151
|
-
// TODO: 这里是正常的表单显隐逻辑
|
|
152
|
-
var otherItems = get(templateDetail, 'componentDtoList', []).map(newRenderColumnItem({
|
|
153
|
-
form: form,
|
|
154
|
-
shopList: shopList,
|
|
155
|
-
shopId: record === null || record === void 0 ? void 0 : record.shopId,
|
|
156
|
-
isEditing: true,
|
|
157
|
-
workOrderDetail: record,
|
|
158
|
-
templateDetail: templateDetail,
|
|
159
|
-
disabled: false,
|
|
160
|
-
displayConfig: get(templateDetail, 'flowTemplateConfig.showHideRule.rules', [])
|
|
161
|
-
}));
|
|
162
|
-
// TODO: 这里只是为了把前置组件的值能够set到当前form表单中去
|
|
163
|
-
// TODO: 为什么不直接把前置和当前放在同一个form里面呢?因为放在同一个里面会有必填校验等逻辑,前置节点在当前表单中只是做展示,但是还必须有控制显隐功能
|
|
164
|
-
var hiddenPreNode = get(templateDetail, 'preNodeComponentDtoList', []).map(function (item) {
|
|
165
|
-
var instance = factory(item.workOrderComponentType, {
|
|
166
|
-
id: item.uniqueKey,
|
|
167
|
-
name: item.name,
|
|
168
|
-
componentConfig: item.componentConfig,
|
|
169
|
-
effects: {},
|
|
170
|
-
type: item.workOrderComponentType
|
|
171
|
-
});
|
|
172
|
-
return /*#__PURE__*/React.createElement(Form.Item, {
|
|
173
|
-
name: instance.id,
|
|
174
|
-
noStyle: true
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
return [].concat(_toConsumableArray(hiddenPreNode), _toConsumableArray(otherItems));
|
|
178
|
-
}, [templateDetail, shopList, record]);
|
|
179
|
-
return /*#__PURE__*/React.createElement(Form, {
|
|
180
|
-
form: form
|
|
181
|
-
}, /*#__PURE__*/React.createElement(ShopName, {
|
|
182
|
-
shopList: shopList,
|
|
183
|
-
handleChangeShopId: function handleChangeShopId() {
|
|
184
|
-
return null;
|
|
185
|
-
},
|
|
186
|
-
hidden: false,
|
|
187
|
-
disabled: false
|
|
188
|
-
}), finalFormItems);
|
|
189
|
-
};
|
|
190
|
-
export default VirtualForm;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const concurrencyRequest: (promises: any[], maxNum: number) => Promise<unknown>;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
3
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
-
// 并发请求函数
|
|
6
|
-
export var concurrencyRequest = function concurrencyRequest(promises, maxNum) {
|
|
7
|
-
return new Promise(function (resolve) {
|
|
8
|
-
if (promises.length === 0) {
|
|
9
|
-
resolve([]);
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
var results = [];
|
|
13
|
-
var index = 0; // 下一个请求的下标
|
|
14
|
-
var count = 0; // 当前请求完成的数量
|
|
15
|
-
|
|
16
|
-
// 发送请求
|
|
17
|
-
function request() {
|
|
18
|
-
return _request.apply(this, arguments);
|
|
19
|
-
} // maxNum和urls.length取最小进行调用
|
|
20
|
-
function _request() {
|
|
21
|
-
_request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
22
|
-
var i, promise, resp;
|
|
23
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
24
|
-
while (1) switch (_context.prev = _context.next) {
|
|
25
|
-
case 0:
|
|
26
|
-
if (!(index === promises.length)) {
|
|
27
|
-
_context.next = 2;
|
|
28
|
-
break;
|
|
29
|
-
}
|
|
30
|
-
return _context.abrupt("return");
|
|
31
|
-
case 2:
|
|
32
|
-
i = index; // 保存序号,使result和urls相对应
|
|
33
|
-
promise = promises[index];
|
|
34
|
-
index++;
|
|
35
|
-
_context.prev = 5;
|
|
36
|
-
_context.next = 8;
|
|
37
|
-
return promise();
|
|
38
|
-
case 8:
|
|
39
|
-
resp = _context.sent;
|
|
40
|
-
// resp 加入到results
|
|
41
|
-
results[i] = resp;
|
|
42
|
-
_context.next = 15;
|
|
43
|
-
break;
|
|
44
|
-
case 12:
|
|
45
|
-
_context.prev = 12;
|
|
46
|
-
_context.t0 = _context["catch"](5);
|
|
47
|
-
// err 加入到results
|
|
48
|
-
results[i] = _context.t0;
|
|
49
|
-
case 15:
|
|
50
|
-
_context.prev = 15;
|
|
51
|
-
count++;
|
|
52
|
-
// 判断是否所有的请求都已完成
|
|
53
|
-
if (count === promises.length) {
|
|
54
|
-
resolve(results);
|
|
55
|
-
}
|
|
56
|
-
request();
|
|
57
|
-
return _context.finish(15);
|
|
58
|
-
case 20:
|
|
59
|
-
case "end":
|
|
60
|
-
return _context.stop();
|
|
61
|
-
}
|
|
62
|
-
}, _callee, null, [[5, 12, 15, 20]]);
|
|
63
|
-
}));
|
|
64
|
-
return _request.apply(this, arguments);
|
|
65
|
-
}
|
|
66
|
-
var times = Math.min(maxNum, promises.length);
|
|
67
|
-
for (var i = 0; i < times; i++) {
|
|
68
|
-
request();
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { PlatForm } from '../model/flowTemplateDetail/types';
|
|
3
|
-
declare type Props = {
|
|
4
|
-
workOrderList: Array<{
|
|
5
|
-
flowWorkOrderId: string;
|
|
6
|
-
flowTemplateKey: string;
|
|
7
|
-
[prop: string]: any;
|
|
8
|
-
}>;
|
|
9
|
-
shopList: any[];
|
|
10
|
-
plat: {
|
|
11
|
-
accountName: string;
|
|
12
|
-
platform: PlatForm;
|
|
13
|
-
};
|
|
14
|
-
callBackComplete: (list: any) => void;
|
|
15
|
-
};
|
|
16
|
-
declare const BatchSubmitFormList: ({ workOrderList, shopList, plat, callBackComplete }: Props, ref: any) => React.JSX.Element;
|
|
17
|
-
export default BatchSubmitFormList;
|
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
3
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
10
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
12
|
-
import { groupBy, get, find } from 'lodash';
|
|
13
|
-
import { AddressData, ExpressData, ExpressInterceptData, PlatData, LogisticsAddressData } from '@kmkf-fe-packages/kmkf-utils';
|
|
14
|
-
import VirtualForm from "./VirtualForm";
|
|
15
|
-
import { verifyHandle, submitParams } from "../FlowTemplateDetail/common";
|
|
16
|
-
import { submitWorkOrder } from "../model/flowTemplateDetail/api";
|
|
17
|
-
import { concurrencyRequest } from "./common";
|
|
18
|
-
import { batchQueryNodeDetail } from "../model/flowTemplateDetail/api";
|
|
19
|
-
import BatchSubmitProgress from "./BatchSubmitProgress";
|
|
20
|
-
var BatchSubmitFormList = function BatchSubmitFormList(_ref, ref) {
|
|
21
|
-
var workOrderList = _ref.workOrderList,
|
|
22
|
-
shopList = _ref.shopList,
|
|
23
|
-
plat = _ref.plat,
|
|
24
|
-
callBackComplete = _ref.callBackComplete;
|
|
25
|
-
var formInstanceList = useRef([]);
|
|
26
|
-
var _useState = useState([]),
|
|
27
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
28
|
-
flowTemplateNodeDetailList = _useState2[0],
|
|
29
|
-
setFlowTemplateNodeDetailList = _useState2[1];
|
|
30
|
-
var _useState3 = useState({}),
|
|
31
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
32
|
-
result = _useState4[0],
|
|
33
|
-
setResult = _useState4[1];
|
|
34
|
-
AddressData.getInstance();
|
|
35
|
-
ExpressData.getInstance();
|
|
36
|
-
ExpressInterceptData.getInstance();
|
|
37
|
-
PlatData.getInstance();
|
|
38
|
-
LogisticsAddressData.getInstance();
|
|
39
|
-
// 批量查询所选择数据记录
|
|
40
|
-
var queryRecordList = /*#__PURE__*/function () {
|
|
41
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
|
|
42
|
-
var _formInstanceList$cur, _filter;
|
|
43
|
-
var _yield$batchQueryNode, _yield$batchQueryNode2, data, promises, list, successTotal, failedTotal;
|
|
44
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
45
|
-
while (1) switch (_context.prev = _context.next) {
|
|
46
|
-
case 0:
|
|
47
|
-
_context.next = 2;
|
|
48
|
-
return batchQueryNodeDetail({
|
|
49
|
-
paramList: params
|
|
50
|
-
});
|
|
51
|
-
case 2:
|
|
52
|
-
_yield$batchQueryNode = _context.sent;
|
|
53
|
-
_yield$batchQueryNode2 = _yield$batchQueryNode.data;
|
|
54
|
-
data = _yield$batchQueryNode2 === void 0 ? [] : _yield$batchQueryNode2;
|
|
55
|
-
setFlowTemplateNodeDetailList(data);
|
|
56
|
-
// TODO: 等待表单渲染时间
|
|
57
|
-
_context.next = 8;
|
|
58
|
-
return new Promise(function (resolve) {
|
|
59
|
-
return setTimeout(function () {
|
|
60
|
-
return resolve(null);
|
|
61
|
-
}, 1500 * ((workOrderList === null || workOrderList === void 0 ? void 0 : workOrderList.length) % 15 + 1));
|
|
62
|
-
});
|
|
63
|
-
case 8:
|
|
64
|
-
promises = (_formInstanceList$cur = formInstanceList.current) === null || _formInstanceList$cur === void 0 ? void 0 : _formInstanceList$cur.map(function (formInstance) {
|
|
65
|
-
return function () {
|
|
66
|
-
return submitSingleRecord(formInstance);
|
|
67
|
-
};
|
|
68
|
-
});
|
|
69
|
-
_context.next = 11;
|
|
70
|
-
return concurrencyRequest(promises, 6);
|
|
71
|
-
case 11:
|
|
72
|
-
list = _context.sent;
|
|
73
|
-
successTotal = list === null || list === void 0 ? void 0 : (_filter = list.filter(function (l) {
|
|
74
|
-
return l === null || l === void 0 ? void 0 : l.success;
|
|
75
|
-
})) === null || _filter === void 0 ? void 0 : _filter.length;
|
|
76
|
-
failedTotal = (list === null || list === void 0 ? void 0 : list.length) - successTotal;
|
|
77
|
-
setResult({
|
|
78
|
-
success: successTotal,
|
|
79
|
-
failed: failedTotal
|
|
80
|
-
});
|
|
81
|
-
typeof callBackComplete === 'function' && callBackComplete(list);
|
|
82
|
-
case 16:
|
|
83
|
-
case "end":
|
|
84
|
-
return _context.stop();
|
|
85
|
-
}
|
|
86
|
-
}, _callee);
|
|
87
|
-
}));
|
|
88
|
-
return function queryRecordList(_x2) {
|
|
89
|
-
return _ref2.apply(this, arguments);
|
|
90
|
-
};
|
|
91
|
-
}();
|
|
92
|
-
var getNodeDetail = function getNodeDetail(_ref3) {
|
|
93
|
-
var flowTemplateId = _ref3.flowTemplateId,
|
|
94
|
-
nodeId = _ref3.nodeId;
|
|
95
|
-
return flowTemplateNodeDetailList === null || flowTemplateNodeDetailList === void 0 ? void 0 : flowTemplateNodeDetailList.find(function (item) {
|
|
96
|
-
return (item === null || item === void 0 ? void 0 : item.flowTemplateId) === flowTemplateId && (item === null || item === void 0 ? void 0 : item.nodeId) === nodeId;
|
|
97
|
-
});
|
|
98
|
-
};
|
|
99
|
-
useEffect(function () {
|
|
100
|
-
if ((workOrderList === null || workOrderList === void 0 ? void 0 : workOrderList.length) > 0) {
|
|
101
|
-
var _Object$getOwnPropert;
|
|
102
|
-
var FlowTemplateIdGroup = groupBy(workOrderList, 'flowTemplateId');
|
|
103
|
-
var params = (_Object$getOwnPropert = Object.getOwnPropertyNames(FlowTemplateIdGroup)) === null || _Object$getOwnPropert === void 0 ? void 0 : _Object$getOwnPropert.map(function (item) {
|
|
104
|
-
var _FlowTemplateIdGroup$;
|
|
105
|
-
return {
|
|
106
|
-
flowTemplateId: item,
|
|
107
|
-
nodeIdList: Array.from(new Set(FlowTemplateIdGroup === null || FlowTemplateIdGroup === void 0 ? void 0 : (_FlowTemplateIdGroup$ = FlowTemplateIdGroup[item]) === null || _FlowTemplateIdGroup$ === void 0 ? void 0 : _FlowTemplateIdGroup$.map(function (i) {
|
|
108
|
-
return i.nodeId;
|
|
109
|
-
})))
|
|
110
|
-
};
|
|
111
|
-
});
|
|
112
|
-
queryRecordList(params);
|
|
113
|
-
}
|
|
114
|
-
}, [workOrderList]);
|
|
115
|
-
var submitSingleRecord = /*#__PURE__*/function () {
|
|
116
|
-
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref4) {
|
|
117
|
-
var form, workOrderId, formData, record, _ref6, nodeDetail, _result, params, res;
|
|
118
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
119
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
120
|
-
case 0:
|
|
121
|
-
form = _ref4.form, workOrderId = _ref4.workOrderId;
|
|
122
|
-
_context2.prev = 1;
|
|
123
|
-
_context2.next = 4;
|
|
124
|
-
return form.validateFields();
|
|
125
|
-
case 4:
|
|
126
|
-
formData = _context2.sent;
|
|
127
|
-
// todo: 通过工单id找到对应的record记录
|
|
128
|
-
record = workOrderList === null || workOrderList === void 0 ? void 0 : workOrderList.find(function (item) {
|
|
129
|
-
return item.id === workOrderId;
|
|
130
|
-
});
|
|
131
|
-
_ref6 = getNodeDetail({
|
|
132
|
-
flowTemplateId: record === null || record === void 0 ? void 0 : record.flowTemplateId,
|
|
133
|
-
nodeId: record === null || record === void 0 ? void 0 : record.nodeId
|
|
134
|
-
}) || {}, nodeDetail = _ref6.workOrderTemplateInfo;
|
|
135
|
-
_result = verifyHandle(formData, (nodeDetail === null || nodeDetail === void 0 ? void 0 : nodeDetail.componentDtoList) || []);
|
|
136
|
-
if (_result.success) {
|
|
137
|
-
_context2.next = 10;
|
|
138
|
-
break;
|
|
139
|
-
}
|
|
140
|
-
return _context2.abrupt("return");
|
|
141
|
-
case 10:
|
|
142
|
-
params = submitParams({
|
|
143
|
-
update: true,
|
|
144
|
-
formData: formData,
|
|
145
|
-
currentNodeDetail: {
|
|
146
|
-
workOrder: record,
|
|
147
|
-
workOrderTemplateInfo: nodeDetail
|
|
148
|
-
},
|
|
149
|
-
plat: plat,
|
|
150
|
-
operateParams: {
|
|
151
|
-
flowTemplateKey: record === null || record === void 0 ? void 0 : record.flowTemplateKey,
|
|
152
|
-
workOrderUpdateTime: record === null || record === void 0 ? void 0 : record.update,
|
|
153
|
-
flowWorkOrderUpdateTime: record === null || record === void 0 ? void 0 : record.flowWorkOrderUpdateTime,
|
|
154
|
-
flowTemplateId: record === null || record === void 0 ? void 0 : record.flowTemplateId,
|
|
155
|
-
flowWorkOrderId: record === null || record === void 0 ? void 0 : record.flowWorkOrderId,
|
|
156
|
-
workOrderId: record === null || record === void 0 ? void 0 : record.id,
|
|
157
|
-
nodeId: record === null || record === void 0 ? void 0 : record.currentNodeId,
|
|
158
|
-
flowVersion: record === null || record === void 0 ? void 0 : record.flowTemplateVersion
|
|
159
|
-
},
|
|
160
|
-
shopUniqueKey: get(find(shopList, function (s) {
|
|
161
|
-
return s.shopId === formData.shopId;
|
|
162
|
-
}), 'accessToken', '')
|
|
163
|
-
});
|
|
164
|
-
_context2.next = 13;
|
|
165
|
-
return submitWorkOrder(params);
|
|
166
|
-
case 13:
|
|
167
|
-
res = _context2.sent;
|
|
168
|
-
return _context2.abrupt("return", res);
|
|
169
|
-
case 17:
|
|
170
|
-
_context2.prev = 17;
|
|
171
|
-
_context2.t0 = _context2["catch"](1);
|
|
172
|
-
console.log('表单校验失败');
|
|
173
|
-
case 20:
|
|
174
|
-
case "end":
|
|
175
|
-
return _context2.stop();
|
|
176
|
-
}
|
|
177
|
-
}, _callee2, null, [[1, 17]]);
|
|
178
|
-
}));
|
|
179
|
-
return function submitSingleRecord(_x3) {
|
|
180
|
-
return _ref5.apply(this, arguments);
|
|
181
|
-
};
|
|
182
|
-
}();
|
|
183
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
184
|
-
style: {
|
|
185
|
-
display: 'none'
|
|
186
|
-
}
|
|
187
|
-
}, workOrderList === null || workOrderList === void 0 ? void 0 : workOrderList.map(function (item) {
|
|
188
|
-
var _getNodeDetail;
|
|
189
|
-
return /*#__PURE__*/React.createElement(VirtualForm, {
|
|
190
|
-
callBackPushForm: function callBackPushForm(form, workOrderId) {
|
|
191
|
-
return formInstanceList.current.push({
|
|
192
|
-
form: form,
|
|
193
|
-
workOrderId: workOrderId
|
|
194
|
-
});
|
|
195
|
-
},
|
|
196
|
-
record: item,
|
|
197
|
-
detail: (_getNodeDetail = getNodeDetail({
|
|
198
|
-
flowTemplateId: item === null || item === void 0 ? void 0 : item.flowTemplateId,
|
|
199
|
-
nodeId: item === null || item === void 0 ? void 0 : item.nodeId
|
|
200
|
-
})) === null || _getNodeDetail === void 0 ? void 0 : _getNodeDetail.workOrderTemplateInfo,
|
|
201
|
-
shopList: shopList
|
|
202
|
-
});
|
|
203
|
-
})), /*#__PURE__*/React.createElement(BatchSubmitProgress, {
|
|
204
|
-
result: result
|
|
205
|
-
}));
|
|
206
|
-
};
|
|
207
|
-
export default BatchSubmitFormList;
|