@kmkf-fe-packages/basic-components 0.7.15-alpha.55 → 0.7.15-alpha.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +94 -60
- package/dist/index.js +94 -60
- package/package.json +3 -3
- package/dist/src/bs/component/eventEmitter.d.ts +0 -4
package/dist/index.esm.js
CHANGED
|
@@ -9632,10 +9632,12 @@ var ItemList = function ItemList(props) {
|
|
|
9632
9632
|
var columns = [{
|
|
9633
9633
|
dataIndex: 'index',
|
|
9634
9634
|
title: '序号',
|
|
9635
|
-
// with: 70,
|
|
9636
|
-
ellipsis: true,
|
|
9637
9635
|
render: function render(val, record, index) {
|
|
9638
|
-
return /*#__PURE__*/React.createElement("
|
|
9636
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
9637
|
+
style: {
|
|
9638
|
+
width: '50px'
|
|
9639
|
+
}
|
|
9640
|
+
}, index + 1);
|
|
9639
9641
|
}
|
|
9640
9642
|
}, {
|
|
9641
9643
|
dataIndex: 'name',
|
|
@@ -9656,7 +9658,14 @@ var columns = [{
|
|
|
9656
9658
|
dataIndex: 'code',
|
|
9657
9659
|
title: '商品编码',
|
|
9658
9660
|
with: 200,
|
|
9659
|
-
ellipsis: true
|
|
9661
|
+
// ellipsis: true,
|
|
9662
|
+
render: function render(val) {
|
|
9663
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
9664
|
+
style: {
|
|
9665
|
+
width: '100px'
|
|
9666
|
+
}
|
|
9667
|
+
}, val);
|
|
9668
|
+
}
|
|
9660
9669
|
}, {
|
|
9661
9670
|
dataIndex: 'skuCode',
|
|
9662
9671
|
title: '商品sku编码',
|
|
@@ -9665,8 +9674,15 @@ var columns = [{
|
|
|
9665
9674
|
}, {
|
|
9666
9675
|
dataIndex: 'marketPrice',
|
|
9667
9676
|
title: '市场价',
|
|
9668
|
-
with: 200,
|
|
9669
|
-
ellipsis: true
|
|
9677
|
+
// with: 200,
|
|
9678
|
+
// ellipsis: true,
|
|
9679
|
+
render: function render(val) {
|
|
9680
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
9681
|
+
style: {
|
|
9682
|
+
width: '70px'
|
|
9683
|
+
}
|
|
9684
|
+
}, val);
|
|
9685
|
+
}
|
|
9670
9686
|
}];
|
|
9671
9687
|
var GoodsModal$1 = function GoodsModal(props, ref) {
|
|
9672
9688
|
useImperativeHandle(ref, function () {
|
|
@@ -9924,7 +9940,7 @@ var GoodItem = function GoodItem(props) {
|
|
|
9924
9940
|
var handleDelete = function handleDelete(record, index) {
|
|
9925
9941
|
onDelete === null || onDelete === void 0 ? void 0 : onDelete(value[index]);
|
|
9926
9942
|
var newList = _toConsumableArray(value).filter(function (item, i) {
|
|
9927
|
-
return
|
|
9943
|
+
return index !== i;
|
|
9928
9944
|
});
|
|
9929
9945
|
onChange === null || onChange === void 0 ? void 0 : onChange(_toConsumableArray(newList));
|
|
9930
9946
|
};
|
|
@@ -9991,6 +10007,8 @@ var GoodItem = function GoodItem(props) {
|
|
|
9991
10007
|
render: function render(val, record, index) {
|
|
9992
10008
|
return record.canUpdateNumber && !disabled ? /*#__PURE__*/React.createElement(InputNumber, {
|
|
9993
10009
|
value: val,
|
|
10010
|
+
min: 0,
|
|
10011
|
+
precision: 0,
|
|
9994
10012
|
onChange: function onChange(num) {
|
|
9995
10013
|
return updateHandle(num, index, 'number');
|
|
9996
10014
|
}
|
|
@@ -10056,7 +10074,7 @@ var GoodItem = function GoodItem(props) {
|
|
|
10056
10074
|
code: code,
|
|
10057
10075
|
sku: skuCode,
|
|
10058
10076
|
money: marketPrice || 0,
|
|
10059
|
-
share:
|
|
10077
|
+
share: marketPrice || 0,
|
|
10060
10078
|
number: 1,
|
|
10061
10079
|
type: '',
|
|
10062
10080
|
uuid: uuid(),
|
|
@@ -10136,53 +10154,36 @@ var BsGoods = function BsGoods(props) {
|
|
|
10136
10154
|
var reissueRef = useRef();
|
|
10137
10155
|
useEffect(function () {
|
|
10138
10156
|
ref.current = pubsub.subscribeOnce('type', function (type, val) {
|
|
10139
|
-
var _value$bsGoods;
|
|
10140
|
-
console.log(value);
|
|
10141
10157
|
if (disabled) return;
|
|
10142
10158
|
setWithInfo({
|
|
10143
10159
|
type: type,
|
|
10144
10160
|
val: val
|
|
10145
10161
|
});
|
|
10146
10162
|
setTableSelect(['2', '4'].includes(val));
|
|
10147
|
-
if (['1', '3'].includes(val) && (value === null || value === void 0 ? void 0 : (_value$bsGoods = value.bsGoods) === null || _value$bsGoods === void 0 ? void 0 : _value$bsGoods.length)) {
|
|
10148
|
-
var newGoods = cloneDeep(value === null || value === void 0 ? void 0 : value.bsGoods);
|
|
10149
|
-
pubsub.publish('selectList', {
|
|
10150
|
-
type: val,
|
|
10151
|
-
list: (newGoods || []).map(function (item) {
|
|
10152
|
-
item.canDelete = false;
|
|
10153
|
-
return item;
|
|
10154
|
-
})
|
|
10155
|
-
});
|
|
10156
|
-
}
|
|
10157
10163
|
});
|
|
10158
10164
|
//补发
|
|
10159
10165
|
reissueRef.current = pubsub.subscribeOnce('reissueType', function (type, val) {
|
|
10160
|
-
var _value$bsGoods2;
|
|
10161
10166
|
if (disabled) return;
|
|
10162
10167
|
setWithInfo({
|
|
10163
10168
|
type: type,
|
|
10164
10169
|
val: val
|
|
10165
10170
|
});
|
|
10166
10171
|
setTableSelect(['2', '4'].includes(val));
|
|
10167
|
-
if (['1', '3'].includes(val) && (value === null || value === void 0 ? void 0 : (_value$bsGoods2 = value.bsGoods) === null || _value$bsGoods2 === void 0 ? void 0 : _value$bsGoods2.length)) {
|
|
10168
|
-
var newGoods = cloneDeep(value === null || value === void 0 ? void 0 : value.bsGoods);
|
|
10169
|
-
pubsub.publish('reissueSelectList', {
|
|
10170
|
-
type: val,
|
|
10171
|
-
list: (newGoods || []).map(function (item) {
|
|
10172
|
-
item.canDelete = false;
|
|
10173
|
-
return item;
|
|
10174
|
-
})
|
|
10175
|
-
});
|
|
10176
|
-
}
|
|
10177
10172
|
});
|
|
10178
10173
|
return function () {
|
|
10179
10174
|
pubsub.unsubscribe(ref.current);
|
|
10180
10175
|
pubsub.unsubscribe(reissueRef.current);
|
|
10181
10176
|
};
|
|
10182
10177
|
}, [value, withInfo, disabled]);
|
|
10178
|
+
useEffect(function () {
|
|
10179
|
+
if (!disabled) {
|
|
10180
|
+
pubsub.publish('goodList', {
|
|
10181
|
+
list: cloneDeep((value === null || value === void 0 ? void 0 : value.bsGoods) || [])
|
|
10182
|
+
});
|
|
10183
|
+
}
|
|
10184
|
+
}, [value, disabled]);
|
|
10183
10185
|
var _onSelect = useCallback(function (list) {
|
|
10184
10186
|
if (disabled) return;
|
|
10185
|
-
console.log('withInfo', withInfo, list);
|
|
10186
10187
|
var newList = cloneDeep(list);
|
|
10187
10188
|
pubsub.publish(withInfo.type === 'reissueType' ? 'reissueSelectList' : 'selectList', {
|
|
10188
10189
|
type: withInfo.val,
|
|
@@ -10230,6 +10231,15 @@ var BsExchange = function BsExchange(props) {
|
|
|
10230
10231
|
reasonList = _props$reasonList === void 0 ? [] : _props$reasonList,
|
|
10231
10232
|
disabled = props.disabled,
|
|
10232
10233
|
other = _objectWithoutProperties(props, _excluded$b);
|
|
10234
|
+
var _useState = useState([]),
|
|
10235
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
10236
|
+
bsGoods = _useState2[0],
|
|
10237
|
+
setBsGoods = _useState2[1];
|
|
10238
|
+
useEffect(function () {
|
|
10239
|
+
pubsub.subscribe('goodList', function (_, data) {
|
|
10240
|
+
setBsGoods(data.list);
|
|
10241
|
+
});
|
|
10242
|
+
}, []);
|
|
10233
10243
|
useEffect(function () {
|
|
10234
10244
|
pubsub.subscribeOnce('deleteGood', function (_, data) {
|
|
10235
10245
|
if (disabled) return;
|
|
@@ -10251,6 +10261,15 @@ var BsExchange = function BsExchange(props) {
|
|
|
10251
10261
|
onChange(newValue);
|
|
10252
10262
|
}
|
|
10253
10263
|
});
|
|
10264
|
+
pubsub.subscribe('selectList', function (_, data) {
|
|
10265
|
+
if (disabled) return;
|
|
10266
|
+
if (value) {
|
|
10267
|
+
var newData = cloneDeep(data);
|
|
10268
|
+
onChange(_objectSpread2(_objectSpread2({}, value), {}, {
|
|
10269
|
+
bsExchangeReturnGoods: getListHandle(_toConsumableArray(newData.list), value)
|
|
10270
|
+
}));
|
|
10271
|
+
}
|
|
10272
|
+
});
|
|
10254
10273
|
}, [value]);
|
|
10255
10274
|
var getListHandle = function getListHandle(list, val) {
|
|
10256
10275
|
var _val$bsExchangeType, _val$bsExchangeType2;
|
|
@@ -10261,6 +10280,7 @@ var BsExchange = function BsExchange(props) {
|
|
|
10261
10280
|
//数量大于1 拆开
|
|
10262
10281
|
if (next.number > 1) {
|
|
10263
10282
|
var newList = Array(next.number).fill(_objectSpread2({}, next)).map(function (t) {
|
|
10283
|
+
t.money = t.share;
|
|
10264
10284
|
t.number = 1;
|
|
10265
10285
|
t.uuid = uuid();
|
|
10266
10286
|
return t;
|
|
@@ -10279,6 +10299,7 @@ var BsExchange = function BsExchange(props) {
|
|
|
10279
10299
|
//数量大于1 拆开
|
|
10280
10300
|
if (next.number > 1) {
|
|
10281
10301
|
var newList = Array(next.number).fill(_objectSpread2({}, next)).map(function (t) {
|
|
10302
|
+
t.money = t.share;
|
|
10282
10303
|
t.number = 1;
|
|
10283
10304
|
t.uuid = uuid();
|
|
10284
10305
|
return t;
|
|
@@ -10302,17 +10323,13 @@ var BsExchange = function BsExchange(props) {
|
|
|
10302
10323
|
newValue.bsExchangeType = val;
|
|
10303
10324
|
newValue.bsExchangeReturnGoods = [];
|
|
10304
10325
|
newValue.bsExchangeGiftGoods = [];
|
|
10326
|
+
if (['2', '4'].includes(val[0])) {
|
|
10327
|
+
pubsub.publish('type', val[0]);
|
|
10328
|
+
} else {
|
|
10329
|
+
console.log(bsGoods, value);
|
|
10330
|
+
newValue.bsExchangeReturnGoods = getListHandle(bsGoods, newValue);
|
|
10331
|
+
}
|
|
10305
10332
|
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
10306
|
-
pubsub.publish('type', val[0]);
|
|
10307
|
-
pubsub.subscribe('selectList', function (_, data) {
|
|
10308
|
-
if (disabled) return;
|
|
10309
|
-
if (newValue) {
|
|
10310
|
-
var newData = cloneDeep(data);
|
|
10311
|
-
onChange(_objectSpread2(_objectSpread2({}, newValue), {}, {
|
|
10312
|
-
bsExchangeReturnGoods: getListHandle(_toConsumableArray(newData.list), newValue)
|
|
10313
|
-
}));
|
|
10314
|
-
}
|
|
10315
|
-
});
|
|
10316
10333
|
};
|
|
10317
10334
|
var changeHandle = function changeHandle(val, key) {
|
|
10318
10335
|
var newValue = _objectSpread2({}, value);
|
|
@@ -10330,7 +10347,7 @@ var BsExchange = function BsExchange(props) {
|
|
|
10330
10347
|
}
|
|
10331
10348
|
};
|
|
10332
10349
|
var changeReturnHandle = function changeReturnHandle(val, index, key) {
|
|
10333
|
-
|
|
10350
|
+
console.log('changeReturnHandle', val, index, key);
|
|
10334
10351
|
var newValue = _objectSpread2({}, value);
|
|
10335
10352
|
newValue.bsExchangeReturnGoods[index][key] = (val || []).map(function (t) {
|
|
10336
10353
|
t.index = index;
|
|
@@ -10432,6 +10449,15 @@ var BsReissue = function BsReissue(props) {
|
|
|
10432
10449
|
reasonList = _props$reasonList === void 0 ? [] : _props$reasonList,
|
|
10433
10450
|
disabled = props.disabled,
|
|
10434
10451
|
other = _objectWithoutProperties(props, _excluded$c);
|
|
10452
|
+
var _useState = useState([]),
|
|
10453
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
10454
|
+
bsGoods = _useState2[0],
|
|
10455
|
+
setBsGoods = _useState2[1];
|
|
10456
|
+
useEffect(function () {
|
|
10457
|
+
pubsub.subscribe('goodList', function (_, data) {
|
|
10458
|
+
setBsGoods(data.list);
|
|
10459
|
+
});
|
|
10460
|
+
}, []);
|
|
10435
10461
|
useEffect(function () {
|
|
10436
10462
|
pubsub.subscribeOnce('reissueDeleteGood', function (_, data) {
|
|
10437
10463
|
if (disabled) return;
|
|
@@ -10443,36 +10469,44 @@ var BsReissue = function BsReissue(props) {
|
|
|
10443
10469
|
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
10444
10470
|
}
|
|
10445
10471
|
});
|
|
10472
|
+
pubsub.subscribeOnce('reissueSelectList', function (_, data) {
|
|
10473
|
+
if (disabled) return;
|
|
10474
|
+
if (value) {
|
|
10475
|
+
var newValue = _objectSpread2({}, value);
|
|
10476
|
+
newValue.bsReissueGoods = data === null || data === void 0 ? void 0 : data.list.map(function (item) {
|
|
10477
|
+
item.money = 0;
|
|
10478
|
+
item.share = 0;
|
|
10479
|
+
item.canUpdateNumber = true;
|
|
10480
|
+
return item;
|
|
10481
|
+
});
|
|
10482
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
10483
|
+
}
|
|
10484
|
+
});
|
|
10446
10485
|
}, [value, disabled]);
|
|
10447
10486
|
var changeHandle = function changeHandle(val, key) {
|
|
10448
10487
|
var newValue = _objectSpread2({}, value);
|
|
10449
10488
|
if (key === 'bsReissueGoods') {
|
|
10450
10489
|
val = (val || []).map(function (item) {
|
|
10451
10490
|
item.money = 0;
|
|
10491
|
+
item.share = 0;
|
|
10452
10492
|
return item;
|
|
10453
10493
|
});
|
|
10454
10494
|
}
|
|
10455
10495
|
newValue[key] = val;
|
|
10456
10496
|
if (key === 'bsReissueType') {
|
|
10457
10497
|
newValue.bsReissueGoods = [];
|
|
10498
|
+
if (['2', '4'].includes(val[0])) {
|
|
10499
|
+
pubsub.publish('reissueType', val[0]);
|
|
10500
|
+
} else if (['1', '3'].includes(val[0])) {
|
|
10501
|
+
newValue.bsReissueGoods = (bsGoods || []).map(function (item) {
|
|
10502
|
+
item.money = 0;
|
|
10503
|
+
item.share = 0;
|
|
10504
|
+
item.canUpdateNumber = false;
|
|
10505
|
+
return item;
|
|
10506
|
+
});
|
|
10507
|
+
}
|
|
10458
10508
|
}
|
|
10459
10509
|
onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2({}, newValue));
|
|
10460
|
-
if (key === 'bsReissueType') {
|
|
10461
|
-
pubsub.publish('reissueType', val[0]);
|
|
10462
|
-
pubsub.subscribe('reissueSelectList', function (_, data) {
|
|
10463
|
-
if (disabled) return;
|
|
10464
|
-
if (value) {
|
|
10465
|
-
var newData = cloneDeep(data);
|
|
10466
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, newValue), {}, {
|
|
10467
|
-
bsReissueGoods: ((newData === null || newData === void 0 ? void 0 : newData.list) || []).map(function (item) {
|
|
10468
|
-
item.money = 0;
|
|
10469
|
-
item.canUpdateNumber = ['2', '4'].includes(newData === null || newData === void 0 ? void 0 : newData.type);
|
|
10470
|
-
return item;
|
|
10471
|
-
})
|
|
10472
|
-
}));
|
|
10473
|
-
}
|
|
10474
|
-
});
|
|
10475
|
-
}
|
|
10476
10510
|
};
|
|
10477
10511
|
//显示选择商品按钮 原单换不显示选择商品
|
|
10478
10512
|
var showChangeBtn = useMemo(function () {
|
|
@@ -10490,7 +10524,7 @@ var BsReissue = function BsReissue(props) {
|
|
|
10490
10524
|
onChange: function onChange(val) {
|
|
10491
10525
|
return changeHandle(val, 'bsReissueType');
|
|
10492
10526
|
}
|
|
10493
|
-
}), /*#__PURE__*/React.createElement(
|
|
10527
|
+
}), /*#__PURE__*/React.createElement(GoodItem, _objectSpread2(_objectSpread2({
|
|
10494
10528
|
key: 'reissueGoods'
|
|
10495
10529
|
}, other), {}, {
|
|
10496
10530
|
disabled: disabled,
|
package/dist/index.js
CHANGED
|
@@ -9643,10 +9643,12 @@ var ItemList = function ItemList(props) {
|
|
|
9643
9643
|
var columns = [{
|
|
9644
9644
|
dataIndex: 'index',
|
|
9645
9645
|
title: '序号',
|
|
9646
|
-
// with: 70,
|
|
9647
|
-
ellipsis: true,
|
|
9648
9646
|
render: function render(val, record, index) {
|
|
9649
|
-
return /*#__PURE__*/React__default['default'].createElement("
|
|
9647
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
9648
|
+
style: {
|
|
9649
|
+
width: '50px'
|
|
9650
|
+
}
|
|
9651
|
+
}, index + 1);
|
|
9650
9652
|
}
|
|
9651
9653
|
}, {
|
|
9652
9654
|
dataIndex: 'name',
|
|
@@ -9667,7 +9669,14 @@ var columns = [{
|
|
|
9667
9669
|
dataIndex: 'code',
|
|
9668
9670
|
title: '商品编码',
|
|
9669
9671
|
with: 200,
|
|
9670
|
-
ellipsis: true
|
|
9672
|
+
// ellipsis: true,
|
|
9673
|
+
render: function render(val) {
|
|
9674
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
9675
|
+
style: {
|
|
9676
|
+
width: '100px'
|
|
9677
|
+
}
|
|
9678
|
+
}, val);
|
|
9679
|
+
}
|
|
9671
9680
|
}, {
|
|
9672
9681
|
dataIndex: 'skuCode',
|
|
9673
9682
|
title: '商品sku编码',
|
|
@@ -9676,8 +9685,15 @@ var columns = [{
|
|
|
9676
9685
|
}, {
|
|
9677
9686
|
dataIndex: 'marketPrice',
|
|
9678
9687
|
title: '市场价',
|
|
9679
|
-
with: 200,
|
|
9680
|
-
ellipsis: true
|
|
9688
|
+
// with: 200,
|
|
9689
|
+
// ellipsis: true,
|
|
9690
|
+
render: function render(val) {
|
|
9691
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
9692
|
+
style: {
|
|
9693
|
+
width: '70px'
|
|
9694
|
+
}
|
|
9695
|
+
}, val);
|
|
9696
|
+
}
|
|
9681
9697
|
}];
|
|
9682
9698
|
var GoodsModal$1 = function GoodsModal(props, ref) {
|
|
9683
9699
|
React.useImperativeHandle(ref, function () {
|
|
@@ -9935,7 +9951,7 @@ var GoodItem = function GoodItem(props) {
|
|
|
9935
9951
|
var handleDelete = function handleDelete(record, index) {
|
|
9936
9952
|
onDelete === null || onDelete === void 0 ? void 0 : onDelete(value[index]);
|
|
9937
9953
|
var newList = _toConsumableArray(value).filter(function (item, i) {
|
|
9938
|
-
return
|
|
9954
|
+
return index !== i;
|
|
9939
9955
|
});
|
|
9940
9956
|
onChange === null || onChange === void 0 ? void 0 : onChange(_toConsumableArray(newList));
|
|
9941
9957
|
};
|
|
@@ -10002,6 +10018,8 @@ var GoodItem = function GoodItem(props) {
|
|
|
10002
10018
|
render: function render(val, record, index) {
|
|
10003
10019
|
return record.canUpdateNumber && !disabled ? /*#__PURE__*/React__default['default'].createElement(antd.InputNumber, {
|
|
10004
10020
|
value: val,
|
|
10021
|
+
min: 0,
|
|
10022
|
+
precision: 0,
|
|
10005
10023
|
onChange: function onChange(num) {
|
|
10006
10024
|
return updateHandle(num, index, 'number');
|
|
10007
10025
|
}
|
|
@@ -10067,7 +10085,7 @@ var GoodItem = function GoodItem(props) {
|
|
|
10067
10085
|
code: code,
|
|
10068
10086
|
sku: skuCode,
|
|
10069
10087
|
money: marketPrice || 0,
|
|
10070
|
-
share:
|
|
10088
|
+
share: marketPrice || 0,
|
|
10071
10089
|
number: 1,
|
|
10072
10090
|
type: '',
|
|
10073
10091
|
uuid: kmkfUtils.uuid(),
|
|
@@ -10147,53 +10165,36 @@ var BsGoods = function BsGoods(props) {
|
|
|
10147
10165
|
var reissueRef = React.useRef();
|
|
10148
10166
|
React.useEffect(function () {
|
|
10149
10167
|
ref.current = pubsub__default['default'].subscribeOnce('type', function (type, val) {
|
|
10150
|
-
var _value$bsGoods;
|
|
10151
|
-
console.log(value);
|
|
10152
10168
|
if (disabled) return;
|
|
10153
10169
|
setWithInfo({
|
|
10154
10170
|
type: type,
|
|
10155
10171
|
val: val
|
|
10156
10172
|
});
|
|
10157
10173
|
setTableSelect(['2', '4'].includes(val));
|
|
10158
|
-
if (['1', '3'].includes(val) && (value === null || value === void 0 ? void 0 : (_value$bsGoods = value.bsGoods) === null || _value$bsGoods === void 0 ? void 0 : _value$bsGoods.length)) {
|
|
10159
|
-
var newGoods = lodash.cloneDeep(value === null || value === void 0 ? void 0 : value.bsGoods);
|
|
10160
|
-
pubsub__default['default'].publish('selectList', {
|
|
10161
|
-
type: val,
|
|
10162
|
-
list: (newGoods || []).map(function (item) {
|
|
10163
|
-
item.canDelete = false;
|
|
10164
|
-
return item;
|
|
10165
|
-
})
|
|
10166
|
-
});
|
|
10167
|
-
}
|
|
10168
10174
|
});
|
|
10169
10175
|
//补发
|
|
10170
10176
|
reissueRef.current = pubsub__default['default'].subscribeOnce('reissueType', function (type, val) {
|
|
10171
|
-
var _value$bsGoods2;
|
|
10172
10177
|
if (disabled) return;
|
|
10173
10178
|
setWithInfo({
|
|
10174
10179
|
type: type,
|
|
10175
10180
|
val: val
|
|
10176
10181
|
});
|
|
10177
10182
|
setTableSelect(['2', '4'].includes(val));
|
|
10178
|
-
if (['1', '3'].includes(val) && (value === null || value === void 0 ? void 0 : (_value$bsGoods2 = value.bsGoods) === null || _value$bsGoods2 === void 0 ? void 0 : _value$bsGoods2.length)) {
|
|
10179
|
-
var newGoods = lodash.cloneDeep(value === null || value === void 0 ? void 0 : value.bsGoods);
|
|
10180
|
-
pubsub__default['default'].publish('reissueSelectList', {
|
|
10181
|
-
type: val,
|
|
10182
|
-
list: (newGoods || []).map(function (item) {
|
|
10183
|
-
item.canDelete = false;
|
|
10184
|
-
return item;
|
|
10185
|
-
})
|
|
10186
|
-
});
|
|
10187
|
-
}
|
|
10188
10183
|
});
|
|
10189
10184
|
return function () {
|
|
10190
10185
|
pubsub__default['default'].unsubscribe(ref.current);
|
|
10191
10186
|
pubsub__default['default'].unsubscribe(reissueRef.current);
|
|
10192
10187
|
};
|
|
10193
10188
|
}, [value, withInfo, disabled]);
|
|
10189
|
+
React.useEffect(function () {
|
|
10190
|
+
if (!disabled) {
|
|
10191
|
+
pubsub__default['default'].publish('goodList', {
|
|
10192
|
+
list: lodash.cloneDeep((value === null || value === void 0 ? void 0 : value.bsGoods) || [])
|
|
10193
|
+
});
|
|
10194
|
+
}
|
|
10195
|
+
}, [value, disabled]);
|
|
10194
10196
|
var _onSelect = React.useCallback(function (list) {
|
|
10195
10197
|
if (disabled) return;
|
|
10196
|
-
console.log('withInfo', withInfo, list);
|
|
10197
10198
|
var newList = lodash.cloneDeep(list);
|
|
10198
10199
|
pubsub__default['default'].publish(withInfo.type === 'reissueType' ? 'reissueSelectList' : 'selectList', {
|
|
10199
10200
|
type: withInfo.val,
|
|
@@ -10241,6 +10242,15 @@ var BsExchange = function BsExchange(props) {
|
|
|
10241
10242
|
reasonList = _props$reasonList === void 0 ? [] : _props$reasonList,
|
|
10242
10243
|
disabled = props.disabled,
|
|
10243
10244
|
other = _objectWithoutProperties(props, _excluded$b);
|
|
10245
|
+
var _useState = React.useState([]),
|
|
10246
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
10247
|
+
bsGoods = _useState2[0],
|
|
10248
|
+
setBsGoods = _useState2[1];
|
|
10249
|
+
React.useEffect(function () {
|
|
10250
|
+
pubsub__default['default'].subscribe('goodList', function (_, data) {
|
|
10251
|
+
setBsGoods(data.list);
|
|
10252
|
+
});
|
|
10253
|
+
}, []);
|
|
10244
10254
|
React.useEffect(function () {
|
|
10245
10255
|
pubsub__default['default'].subscribeOnce('deleteGood', function (_, data) {
|
|
10246
10256
|
if (disabled) return;
|
|
@@ -10262,6 +10272,15 @@ var BsExchange = function BsExchange(props) {
|
|
|
10262
10272
|
onChange(newValue);
|
|
10263
10273
|
}
|
|
10264
10274
|
});
|
|
10275
|
+
pubsub__default['default'].subscribe('selectList', function (_, data) {
|
|
10276
|
+
if (disabled) return;
|
|
10277
|
+
if (value) {
|
|
10278
|
+
var newData = lodash.cloneDeep(data);
|
|
10279
|
+
onChange(_objectSpread2(_objectSpread2({}, value), {}, {
|
|
10280
|
+
bsExchangeReturnGoods: getListHandle(_toConsumableArray(newData.list), value)
|
|
10281
|
+
}));
|
|
10282
|
+
}
|
|
10283
|
+
});
|
|
10265
10284
|
}, [value]);
|
|
10266
10285
|
var getListHandle = function getListHandle(list, val) {
|
|
10267
10286
|
var _val$bsExchangeType, _val$bsExchangeType2;
|
|
@@ -10272,6 +10291,7 @@ var BsExchange = function BsExchange(props) {
|
|
|
10272
10291
|
//数量大于1 拆开
|
|
10273
10292
|
if (next.number > 1) {
|
|
10274
10293
|
var newList = Array(next.number).fill(_objectSpread2({}, next)).map(function (t) {
|
|
10294
|
+
t.money = t.share;
|
|
10275
10295
|
t.number = 1;
|
|
10276
10296
|
t.uuid = kmkfUtils.uuid();
|
|
10277
10297
|
return t;
|
|
@@ -10290,6 +10310,7 @@ var BsExchange = function BsExchange(props) {
|
|
|
10290
10310
|
//数量大于1 拆开
|
|
10291
10311
|
if (next.number > 1) {
|
|
10292
10312
|
var newList = Array(next.number).fill(_objectSpread2({}, next)).map(function (t) {
|
|
10313
|
+
t.money = t.share;
|
|
10293
10314
|
t.number = 1;
|
|
10294
10315
|
t.uuid = kmkfUtils.uuid();
|
|
10295
10316
|
return t;
|
|
@@ -10313,17 +10334,13 @@ var BsExchange = function BsExchange(props) {
|
|
|
10313
10334
|
newValue.bsExchangeType = val;
|
|
10314
10335
|
newValue.bsExchangeReturnGoods = [];
|
|
10315
10336
|
newValue.bsExchangeGiftGoods = [];
|
|
10337
|
+
if (['2', '4'].includes(val[0])) {
|
|
10338
|
+
pubsub__default['default'].publish('type', val[0]);
|
|
10339
|
+
} else {
|
|
10340
|
+
console.log(bsGoods, value);
|
|
10341
|
+
newValue.bsExchangeReturnGoods = getListHandle(bsGoods, newValue);
|
|
10342
|
+
}
|
|
10316
10343
|
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
10317
|
-
pubsub__default['default'].publish('type', val[0]);
|
|
10318
|
-
pubsub__default['default'].subscribe('selectList', function (_, data) {
|
|
10319
|
-
if (disabled) return;
|
|
10320
|
-
if (newValue) {
|
|
10321
|
-
var newData = lodash.cloneDeep(data);
|
|
10322
|
-
onChange(_objectSpread2(_objectSpread2({}, newValue), {}, {
|
|
10323
|
-
bsExchangeReturnGoods: getListHandle(_toConsumableArray(newData.list), newValue)
|
|
10324
|
-
}));
|
|
10325
|
-
}
|
|
10326
|
-
});
|
|
10327
10344
|
};
|
|
10328
10345
|
var changeHandle = function changeHandle(val, key) {
|
|
10329
10346
|
var newValue = _objectSpread2({}, value);
|
|
@@ -10341,7 +10358,7 @@ var BsExchange = function BsExchange(props) {
|
|
|
10341
10358
|
}
|
|
10342
10359
|
};
|
|
10343
10360
|
var changeReturnHandle = function changeReturnHandle(val, index, key) {
|
|
10344
|
-
|
|
10361
|
+
console.log('changeReturnHandle', val, index, key);
|
|
10345
10362
|
var newValue = _objectSpread2({}, value);
|
|
10346
10363
|
newValue.bsExchangeReturnGoods[index][key] = (val || []).map(function (t) {
|
|
10347
10364
|
t.index = index;
|
|
@@ -10443,6 +10460,15 @@ var BsReissue = function BsReissue(props) {
|
|
|
10443
10460
|
reasonList = _props$reasonList === void 0 ? [] : _props$reasonList,
|
|
10444
10461
|
disabled = props.disabled,
|
|
10445
10462
|
other = _objectWithoutProperties(props, _excluded$c);
|
|
10463
|
+
var _useState = React.useState([]),
|
|
10464
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
10465
|
+
bsGoods = _useState2[0],
|
|
10466
|
+
setBsGoods = _useState2[1];
|
|
10467
|
+
React.useEffect(function () {
|
|
10468
|
+
pubsub__default['default'].subscribe('goodList', function (_, data) {
|
|
10469
|
+
setBsGoods(data.list);
|
|
10470
|
+
});
|
|
10471
|
+
}, []);
|
|
10446
10472
|
React.useEffect(function () {
|
|
10447
10473
|
pubsub__default['default'].subscribeOnce('reissueDeleteGood', function (_, data) {
|
|
10448
10474
|
if (disabled) return;
|
|
@@ -10454,36 +10480,44 @@ var BsReissue = function BsReissue(props) {
|
|
|
10454
10480
|
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
10455
10481
|
}
|
|
10456
10482
|
});
|
|
10483
|
+
pubsub__default['default'].subscribeOnce('reissueSelectList', function (_, data) {
|
|
10484
|
+
if (disabled) return;
|
|
10485
|
+
if (value) {
|
|
10486
|
+
var newValue = _objectSpread2({}, value);
|
|
10487
|
+
newValue.bsReissueGoods = data === null || data === void 0 ? void 0 : data.list.map(function (item) {
|
|
10488
|
+
item.money = 0;
|
|
10489
|
+
item.share = 0;
|
|
10490
|
+
item.canUpdateNumber = true;
|
|
10491
|
+
return item;
|
|
10492
|
+
});
|
|
10493
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
10494
|
+
}
|
|
10495
|
+
});
|
|
10457
10496
|
}, [value, disabled]);
|
|
10458
10497
|
var changeHandle = function changeHandle(val, key) {
|
|
10459
10498
|
var newValue = _objectSpread2({}, value);
|
|
10460
10499
|
if (key === 'bsReissueGoods') {
|
|
10461
10500
|
val = (val || []).map(function (item) {
|
|
10462
10501
|
item.money = 0;
|
|
10502
|
+
item.share = 0;
|
|
10463
10503
|
return item;
|
|
10464
10504
|
});
|
|
10465
10505
|
}
|
|
10466
10506
|
newValue[key] = val;
|
|
10467
10507
|
if (key === 'bsReissueType') {
|
|
10468
10508
|
newValue.bsReissueGoods = [];
|
|
10509
|
+
if (['2', '4'].includes(val[0])) {
|
|
10510
|
+
pubsub__default['default'].publish('reissueType', val[0]);
|
|
10511
|
+
} else if (['1', '3'].includes(val[0])) {
|
|
10512
|
+
newValue.bsReissueGoods = (bsGoods || []).map(function (item) {
|
|
10513
|
+
item.money = 0;
|
|
10514
|
+
item.share = 0;
|
|
10515
|
+
item.canUpdateNumber = false;
|
|
10516
|
+
return item;
|
|
10517
|
+
});
|
|
10518
|
+
}
|
|
10469
10519
|
}
|
|
10470
10520
|
onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2({}, newValue));
|
|
10471
|
-
if (key === 'bsReissueType') {
|
|
10472
|
-
pubsub__default['default'].publish('reissueType', val[0]);
|
|
10473
|
-
pubsub__default['default'].subscribe('reissueSelectList', function (_, data) {
|
|
10474
|
-
if (disabled) return;
|
|
10475
|
-
if (value) {
|
|
10476
|
-
var newData = lodash.cloneDeep(data);
|
|
10477
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, newValue), {}, {
|
|
10478
|
-
bsReissueGoods: ((newData === null || newData === void 0 ? void 0 : newData.list) || []).map(function (item) {
|
|
10479
|
-
item.money = 0;
|
|
10480
|
-
item.canUpdateNumber = ['2', '4'].includes(newData === null || newData === void 0 ? void 0 : newData.type);
|
|
10481
|
-
return item;
|
|
10482
|
-
})
|
|
10483
|
-
}));
|
|
10484
|
-
}
|
|
10485
|
-
});
|
|
10486
|
-
}
|
|
10487
10521
|
};
|
|
10488
10522
|
//显示选择商品按钮 原单换不显示选择商品
|
|
10489
10523
|
var showChangeBtn = React.useMemo(function () {
|
|
@@ -10501,7 +10535,7 @@ var BsReissue = function BsReissue(props) {
|
|
|
10501
10535
|
onChange: function onChange(val) {
|
|
10502
10536
|
return changeHandle(val, 'bsReissueType');
|
|
10503
10537
|
}
|
|
10504
|
-
}), /*#__PURE__*/React__default['default'].createElement(
|
|
10538
|
+
}), /*#__PURE__*/React__default['default'].createElement(GoodItem, _objectSpread2(_objectSpread2({
|
|
10505
10539
|
key: 'reissueGoods'
|
|
10506
10540
|
}, other), {}, {
|
|
10507
10541
|
disabled: disabled,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kmkf-fe-packages/basic-components",
|
|
3
|
-
"version": "0.7.15-alpha.
|
|
3
|
+
"version": "0.7.15-alpha.57",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"homepage": "",
|
|
6
6
|
"license": "ISC",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"watch": "nodemon --ignore dist/ --ignore node_modules/ --watch src/ -C -e ts,tsx,less --debug -x 'yarn async'"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@kmkf-fe-packages/kmkf-utils": "^0.7.15-alpha.
|
|
23
|
+
"@kmkf-fe-packages/kmkf-utils": "^0.7.15-alpha.57",
|
|
24
24
|
"lodash": "^4.17.21",
|
|
25
25
|
"pubsub-js": "^1.9.4",
|
|
26
26
|
"umi-request": "^1.4.0"
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"publishConfig": {
|
|
59
59
|
"access": "public"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "f99147791d4b1ab930c7fbc4a401cd9ce49a19e2"
|
|
62
62
|
}
|