ftdsy-attr 2.1.8 → 2.1.10
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/ftdsy-attr.cjs.js +16 -182
- package/dist/ftdsy-attr.cjs.js.map +1 -1
- package/dist/ftdsy-attr.d.ts +3 -9
- package/dist/ftdsy-attr.esm.mjs +9 -179
- package/dist/ftdsy-attr.esm.mjs.map +1 -1
- package/package.json +4 -3
package/dist/ftdsy-attr.cjs.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
(function(l, r) { if (!l || l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (self.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.getElementsByTagName('head')[0].appendChild(r) })(self.document);
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
6
|
-
|
|
7
5
|
var axios = require('axios');
|
|
6
|
+
var globalThisThisUtils = require('@/globalThisThis-utils');
|
|
7
|
+
require('@/env');
|
|
8
8
|
|
|
9
9
|
function _arrayLikeToArray(r, a) {
|
|
10
10
|
(null == a || a > r.length) && (a = r.length);
|
|
@@ -329,7 +329,6 @@ var getPropertyType$9 = function getPropertyType(item) {
|
|
|
329
329
|
return 'input';
|
|
330
330
|
}
|
|
331
331
|
};
|
|
332
|
-
|
|
333
332
|
/**
|
|
334
333
|
* 根据拼多多分类规则与属性,生成自定义 上货属性
|
|
335
334
|
* */
|
|
@@ -344,7 +343,6 @@ function createCategoryProperties$a(categoryProperties) {
|
|
|
344
343
|
property_required: item.required,
|
|
345
344
|
property_name: item.name,
|
|
346
345
|
// 属性名称
|
|
347
|
-
|
|
348
346
|
property_type: getPropertyType$9(item),
|
|
349
347
|
// 控件类型
|
|
350
348
|
property_values: ((_item$values = item.values) === null || _item$values === void 0 ? void 0 : _item$values.map(function (option) {
|
|
@@ -375,7 +373,6 @@ function createCategoryProperties$a(categoryProperties) {
|
|
|
375
373
|
allParentId.push(conditionItem.parent_id);
|
|
376
374
|
});
|
|
377
375
|
}
|
|
378
|
-
|
|
379
376
|
// 当前为必填项,添加必填规则
|
|
380
377
|
if (result.property_required) {
|
|
381
378
|
result.rules.push({
|
|
@@ -383,7 +380,6 @@ function createCategoryProperties$a(categoryProperties) {
|
|
|
383
380
|
value: 'true'
|
|
384
381
|
});
|
|
385
382
|
}
|
|
386
|
-
|
|
387
383
|
// 当前为纯文本,添加文本输入最大字符数
|
|
388
384
|
if (result.property_type === 'input' && Number(item.max_value)) {
|
|
389
385
|
result.rules.push({
|
|
@@ -391,7 +387,6 @@ function createCategoryProperties$a(categoryProperties) {
|
|
|
391
387
|
value: item.max_value
|
|
392
388
|
});
|
|
393
389
|
}
|
|
394
|
-
|
|
395
390
|
// 当前为多选,添加多选选项数量规则
|
|
396
391
|
if (result.property_type === 'multiSelect' && item.choose_max_num) {
|
|
397
392
|
result.rules.push({
|
|
@@ -399,7 +394,6 @@ function createCategoryProperties$a(categoryProperties) {
|
|
|
399
394
|
value: String(item.choose_max_num)
|
|
400
395
|
});
|
|
401
396
|
}
|
|
402
|
-
|
|
403
397
|
// 当前为日期,添加日期格式规则 (拼多多日期格式为‘yyyy-MM-dd’, 目前仅发现”生产日期“)
|
|
404
398
|
if (result.property_type === 'date') {
|
|
405
399
|
result.rules.push({
|
|
@@ -407,7 +401,6 @@ function createCategoryProperties$a(categoryProperties) {
|
|
|
407
401
|
value: 'yyyy-MM-dd'
|
|
408
402
|
});
|
|
409
403
|
}
|
|
410
|
-
|
|
411
404
|
// 带单位
|
|
412
405
|
if (result.property_type === 'inputComponent' && item.value_unit && item.value_unit.length > 0) {
|
|
413
406
|
var units = item.value_unit.filter(function (unit) {
|
|
@@ -437,7 +430,6 @@ function createCategoryProperties$a(categoryProperties) {
|
|
|
437
430
|
}
|
|
438
431
|
return result;
|
|
439
432
|
});
|
|
440
|
-
|
|
441
433
|
// 遍历属性列表,根据属性值再检验一遍父属性是否为必填项
|
|
442
434
|
// 拼多多,'男装-短裤-短裤'中‘面料俗称’未非必填,但子项‘材质’为必填,提交数据的时候'面料俗称'也是必填项
|
|
443
435
|
attr.forEach(function (item) {
|
|
@@ -470,7 +462,6 @@ function createCategoryProperties$a(categoryProperties) {
|
|
|
470
462
|
});
|
|
471
463
|
});
|
|
472
464
|
}
|
|
473
|
-
|
|
474
465
|
/* 旧版 */
|
|
475
466
|
// function createCategoryProperties(categoryProperties: any[]): DsyAttr[] {
|
|
476
467
|
//
|
|
@@ -699,7 +690,6 @@ function createCategoryProperties$9(categoryProperties) {
|
|
|
699
690
|
result.property_required = rules.some(function (i) {
|
|
700
691
|
return i.name === 'requiredRule';
|
|
701
692
|
}) || false;
|
|
702
|
-
|
|
703
693
|
// 自定义输入
|
|
704
694
|
result.select_custom = rules.some(function (i) {
|
|
705
695
|
return i.name === 'valueAttributeRule';
|
|
@@ -758,7 +748,6 @@ function createCategoryProperties$9(categoryProperties) {
|
|
|
758
748
|
precision: i.type === 'input' && precision ? Number(precision) : undefined
|
|
759
749
|
});
|
|
760
750
|
});
|
|
761
|
-
|
|
762
751
|
// if (precision && precision !== '') {
|
|
763
752
|
// // 添加精度规则
|
|
764
753
|
// const txt = result.property_component.map(item => {
|
|
@@ -798,7 +787,6 @@ function createCategoryProperties$9(categoryProperties) {
|
|
|
798
787
|
return result;
|
|
799
788
|
});
|
|
800
789
|
}
|
|
801
|
-
|
|
802
790
|
// /* 旧版 */
|
|
803
791
|
// function createCategoryProperties(categoryProperties: any[]): PropertyItem[] {
|
|
804
792
|
//
|
|
@@ -1125,7 +1113,6 @@ function createCategoryProperties$8(categoryProperties) {
|
|
|
1125
1113
|
property_required: item.isRequired,
|
|
1126
1114
|
property_name: item.name,
|
|
1127
1115
|
// 属性名称
|
|
1128
|
-
|
|
1129
1116
|
property_type: getPropertyType$7(item.inputType),
|
|
1130
1117
|
// 控件类型
|
|
1131
1118
|
property_values: item.attrValueList.map(function (i) {
|
|
@@ -1153,7 +1140,6 @@ function createCategoryProperties$8(categoryProperties) {
|
|
|
1153
1140
|
value: 'true'
|
|
1154
1141
|
});
|
|
1155
1142
|
}
|
|
1156
|
-
|
|
1157
1143
|
// 部分类目属性在C店的情况下必填 部分属性则不能使用
|
|
1158
1144
|
if (item.features.findIndex(function (rule) {
|
|
1159
1145
|
return rule.key === 'isCStore' && rule.fvalue === '1';
|
|
@@ -1165,7 +1151,6 @@ function createCategoryProperties$8(categoryProperties) {
|
|
|
1165
1151
|
result.property_required = true;
|
|
1166
1152
|
}
|
|
1167
1153
|
}
|
|
1168
|
-
|
|
1169
1154
|
// 级联选择器需要过滤一遍可选值
|
|
1170
1155
|
if (result.property_type == 'treeSingleSelect') {
|
|
1171
1156
|
// 存在二级属性
|
|
@@ -1270,7 +1255,6 @@ function createCategoryProperties$8(categoryProperties) {
|
|
|
1270
1255
|
return result;
|
|
1271
1256
|
});
|
|
1272
1257
|
}
|
|
1273
|
-
|
|
1274
1258
|
// /* 旧版 */
|
|
1275
1259
|
// function createCategoryProperties(categoryProperties: any[]): PropertyItem[] {
|
|
1276
1260
|
//
|
|
@@ -1528,7 +1512,6 @@ function createCategoryProperties$7(categoryProperties) {
|
|
|
1528
1512
|
select_custom: Boolean(item.diy_type),
|
|
1529
1513
|
has_children: false
|
|
1530
1514
|
};
|
|
1531
|
-
|
|
1532
1515
|
// 必填时 添加规则
|
|
1533
1516
|
if (item.required === 1) result.rules.push({
|
|
1534
1517
|
name: 'requiredRule',
|
|
@@ -1538,7 +1521,6 @@ function createCategoryProperties$7(categoryProperties) {
|
|
|
1538
1521
|
name: 'maxItemsRule',
|
|
1539
1522
|
value: String(item.multi_select_max)
|
|
1540
1523
|
});
|
|
1541
|
-
|
|
1542
1524
|
// 材质(多集合)
|
|
1543
1525
|
if (result.property_type === 'multiComplex') {
|
|
1544
1526
|
result.measure_templates = item.measure_templates;
|
|
@@ -1555,7 +1537,6 @@ function createCategoryProperties$7(categoryProperties) {
|
|
|
1555
1537
|
options: []
|
|
1556
1538
|
}];
|
|
1557
1539
|
}
|
|
1558
|
-
|
|
1559
1540
|
// 输入控件
|
|
1560
1541
|
if (result.property_type === 'inputComponent') {
|
|
1561
1542
|
var _item$measure_templat;
|
|
@@ -1586,7 +1567,6 @@ function createCategoryProperties$7(categoryProperties) {
|
|
|
1586
1567
|
return result;
|
|
1587
1568
|
});
|
|
1588
1569
|
}
|
|
1589
|
-
|
|
1590
1570
|
// /* 旧版 */
|
|
1591
1571
|
// function createCategoryProperties(categoryProperties: any[]): PropertyItem[] {
|
|
1592
1572
|
//
|
|
@@ -1767,7 +1747,6 @@ function createCategoryProperties$6(categoryProperties) {
|
|
|
1767
1747
|
property_required: item.required,
|
|
1768
1748
|
property_name: item.propName,
|
|
1769
1749
|
// 属性名称
|
|
1770
|
-
|
|
1771
1750
|
property_type: getPropertyType$5(item.propInputType),
|
|
1772
1751
|
// 控件类型
|
|
1773
1752
|
select_custom: item.customInput,
|
|
@@ -1785,7 +1764,6 @@ function createCategoryProperties$6(categoryProperties) {
|
|
|
1785
1764
|
name: 'requiredRule',
|
|
1786
1765
|
value: 'true'
|
|
1787
1766
|
});
|
|
1788
|
-
|
|
1789
1767
|
// 携带单位
|
|
1790
1768
|
if ((_item$unitProp = item.unitProp) !== null && _item$unitProp !== void 0 && _item$unitProp.length) {
|
|
1791
1769
|
result.property_type = 'inputComponent';
|
|
@@ -1799,7 +1777,6 @@ function createCategoryProperties$6(categoryProperties) {
|
|
|
1799
1777
|
})
|
|
1800
1778
|
}];
|
|
1801
1779
|
}
|
|
1802
|
-
|
|
1803
1780
|
// 多选框 携带有最大选项数
|
|
1804
1781
|
if (result.property_type === 'multiSelect' && item.propValueMaximum) {
|
|
1805
1782
|
result.rules.push({
|
|
@@ -1810,7 +1787,6 @@ function createCategoryProperties$6(categoryProperties) {
|
|
|
1810
1787
|
return result;
|
|
1811
1788
|
});
|
|
1812
1789
|
}
|
|
1813
|
-
|
|
1814
1790
|
/* 旧版 */
|
|
1815
1791
|
// function createCategoryProperties(categoryProperties: any[]): PropertyItem[] {
|
|
1816
1792
|
//
|
|
@@ -2040,7 +2016,6 @@ function createCategoryProperties$5(categoryProperties) {
|
|
|
2040
2016
|
var result = createCategoryPropertyItem(item);
|
|
2041
2017
|
// 添加属性到属性列表
|
|
2042
2018
|
attrs.push(result);
|
|
2043
|
-
|
|
2044
2019
|
// 检测子属性
|
|
2045
2020
|
if (item.attribute_value_list) {
|
|
2046
2021
|
var _item$attribute_value;
|
|
@@ -2078,7 +2053,6 @@ function createCategoryProperties$5(categoryProperties) {
|
|
|
2078
2053
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
2079
2054
|
_loop();
|
|
2080
2055
|
}
|
|
2081
|
-
|
|
2082
2056
|
// console.log(attrs)
|
|
2083
2057
|
} catch (err) {
|
|
2084
2058
|
_iterator.e(err);
|
|
@@ -2097,7 +2071,6 @@ function createCategoryPropertyItem(item) {
|
|
|
2097
2071
|
property_required: item.mandatory,
|
|
2098
2072
|
property_name: (lang === null || lang === void 0 ? void 0 : lang.value) || item.name,
|
|
2099
2073
|
// 属性名称
|
|
2100
|
-
|
|
2101
2074
|
property_type: getPropertyType$4(item.attribute_info.input_type),
|
|
2102
2075
|
// 控件类型
|
|
2103
2076
|
property_values: ((_item$attribute_value2 = item.attribute_value_list) === null || _item$attribute_value2 === void 0 ? void 0 : _item$attribute_value2.map(function (i) {
|
|
@@ -2133,7 +2106,6 @@ function createCategoryPropertyItem(item) {
|
|
|
2133
2106
|
})
|
|
2134
2107
|
});
|
|
2135
2108
|
}
|
|
2136
|
-
|
|
2137
2109
|
// 多选,添加选择数量限制
|
|
2138
2110
|
if (result.property_type === 'multiSelect' && item.attribute_info.max_value_count) {
|
|
2139
2111
|
result.rules.push({
|
|
@@ -2143,7 +2115,6 @@ function createCategoryPropertyItem(item) {
|
|
|
2143
2115
|
}
|
|
2144
2116
|
return result;
|
|
2145
2117
|
}
|
|
2146
|
-
|
|
2147
2118
|
// /* 旧版 */
|
|
2148
2119
|
// function createCategoryProperties(categoryProperties: any[]): PropertyItem[] {
|
|
2149
2120
|
//
|
|
@@ -2279,7 +2250,6 @@ function createCategoryProperties$4(categoryProperties) {
|
|
|
2279
2250
|
property_required: item.isRequired,
|
|
2280
2251
|
property_name: item.name,
|
|
2281
2252
|
// 属性名称
|
|
2282
|
-
|
|
2283
2253
|
property_type: getPropertyType$3(item.inputType),
|
|
2284
2254
|
// 控件类型
|
|
2285
2255
|
select_custom: item.customizable,
|
|
@@ -2293,7 +2263,6 @@ function createCategoryProperties$4(categoryProperties) {
|
|
|
2293
2263
|
rules: [],
|
|
2294
2264
|
has_children: false
|
|
2295
2265
|
};
|
|
2296
|
-
|
|
2297
2266
|
// 官方没给 但提交时只能3个
|
|
2298
2267
|
if (result.property_type === 'multiComplex') result.rules.push({
|
|
2299
2268
|
name: 'maxItemsRule',
|
|
@@ -2302,7 +2271,6 @@ function createCategoryProperties$4(categoryProperties) {
|
|
|
2302
2271
|
return result;
|
|
2303
2272
|
});
|
|
2304
2273
|
}
|
|
2305
|
-
|
|
2306
2274
|
// /* 旧版 */
|
|
2307
2275
|
// function createCategoryProperties(categoryProperties: any[]): PropertyItem[] {
|
|
2308
2276
|
//
|
|
@@ -2487,7 +2455,6 @@ function createCategoryProperties$3(categoryProperties) {
|
|
|
2487
2455
|
return result;
|
|
2488
2456
|
});
|
|
2489
2457
|
}
|
|
2490
|
-
|
|
2491
2458
|
// function createCategoryProperties(categoryProperties: any[]): PropertyItem[] {
|
|
2492
2459
|
//
|
|
2493
2460
|
// const properties: PropertyItem[] = categoryProperties.map(item => {
|
|
@@ -2632,7 +2599,6 @@ function createCategoryProperties$2(categoryProperties) {
|
|
|
2632
2599
|
property_required: item._required,
|
|
2633
2600
|
property_name: item.name,
|
|
2634
2601
|
// 属性名称
|
|
2635
|
-
|
|
2636
2602
|
property_type: getPropertyType$1(item.type_v2),
|
|
2637
2603
|
// 控件类型
|
|
2638
2604
|
property_values: item.value ? item.value.split(';').map(function (i) {
|
|
@@ -2670,7 +2636,6 @@ function createCategoryProperties$2(categoryProperties) {
|
|
|
2670
2636
|
return result;
|
|
2671
2637
|
});
|
|
2672
2638
|
}
|
|
2673
|
-
|
|
2674
2639
|
// /* 旧版 */
|
|
2675
2640
|
// function createCategoryProperties(categoryProperties: any[]): PropertyItem[] {
|
|
2676
2641
|
//
|
|
@@ -2821,7 +2786,6 @@ function getOriginProperty$1(type) {
|
|
|
2821
2786
|
return 'unknown';
|
|
2822
2787
|
}
|
|
2823
2788
|
}
|
|
2824
|
-
|
|
2825
2789
|
/**
|
|
2826
2790
|
* 将Tiktok属性列表 转换自定义属性列表,
|
|
2827
2791
|
* */
|
|
@@ -5673,7 +5637,6 @@ var clothing_children = [{
|
|
|
5673
5637
|
tiktok: '',
|
|
5674
5638
|
tiktokUs: ''
|
|
5675
5639
|
}
|
|
5676
|
-
|
|
5677
5640
|
// {
|
|
5678
5641
|
// title: '童装/婴儿装/亲子装-',
|
|
5679
5642
|
// pdd: '',
|
|
@@ -6913,7 +6876,6 @@ var clothing_underwear = [{
|
|
|
6913
6876
|
}];
|
|
6914
6877
|
|
|
6915
6878
|
// 服饰配件
|
|
6916
|
-
|
|
6917
6879
|
var clothing_accessory = [{
|
|
6918
6880
|
title: '服饰配件-手帕',
|
|
6919
6881
|
pdd: '8699',
|
|
@@ -10313,7 +10275,6 @@ var shoes_women = [{
|
|
|
10313
10275
|
tiktok: '',
|
|
10314
10276
|
tiktokUs: ''
|
|
10315
10277
|
}
|
|
10316
|
-
|
|
10317
10278
|
// {
|
|
10318
10279
|
// title: '',
|
|
10319
10280
|
// pdd: '',
|
|
@@ -11188,7 +11149,6 @@ var shoes_motion = [{
|
|
|
11188
11149
|
tiktok: '',
|
|
11189
11150
|
tiktokUs: ''
|
|
11190
11151
|
}
|
|
11191
|
-
|
|
11192
11152
|
// {
|
|
11193
11153
|
// title: '运动鞋-',
|
|
11194
11154
|
// pdd: '',
|
|
@@ -64695,7 +64655,6 @@ var vehicle_motorcycle = [{
|
|
|
64695
64655
|
* 分类模型,用于匹配分类
|
|
64696
64656
|
* */
|
|
64697
64657
|
var categoryMap = [].concat(_toConsumableArray(clothing_men), _toConsumableArray(clothing_women), _toConsumableArray(clothing_children), _toConsumableArray(clothing_underwear), _toConsumableArray(clothing_accessory), _toConsumableArray(clothing_motion), _toConsumableArray(clothing_jewelry), _toConsumableArray(shoes_men), _toConsumableArray(shoes_women), _toConsumableArray(shoes_children), _toConsumableArray(shoes_motion), _toConsumableArray(bags_leather), _toConsumableArray(bags_motion), _toConsumableArray(motherBaby_gravida), _toConsumableArray(motherBaby_bady), _toConsumableArray(numeral_accessory), _toConsumableArray(numeral_camera), _toConsumableArray(numeral_computer), _toConsumableArray(numeral_smart), _toConsumableArray(numeral_game), _toConsumableArray(sportsOutdoor_outdoors), _toConsumableArray(sportsOutdoor_sports), _toConsumableArray(departmentStore_bedding), _toConsumableArray(departmentStore_flower), _toConsumableArray(departmentStore_homefabric), _toConsumableArray(departmentStore_petanimal), _toConsumableArray(departmentStoreStorage), _toConsumableArray(departmentStoreTableware), _toConsumableArray(departmentStore_holidaysupplies), _toConsumableArray(departmentStore_commodity), _toConsumableArray(vehicle_cycling), _toConsumableArray(vehicle_electricvehicle), _toConsumableArray(vehicle_motorcycle));
|
|
64698
|
-
|
|
64699
64658
|
/**
|
|
64700
64659
|
* 检测获取具体分类,用于判断处理
|
|
64701
64660
|
* @param platform 平台编码
|
|
@@ -64731,7 +64690,6 @@ function perparePropertyGroup(properties) {
|
|
|
64731
64690
|
var propertiesData = {
|
|
64732
64691
|
list: [],
|
|
64733
64692
|
// 正常属性列表(不包含‘品牌’属性)
|
|
64734
|
-
|
|
64735
64693
|
require_total: 0,
|
|
64736
64694
|
// 必填属性总数
|
|
64737
64695
|
require_count: 0,
|
|
@@ -64742,12 +64700,10 @@ function perparePropertyGroup(properties) {
|
|
|
64742
64700
|
// 非必填属性列表
|
|
64743
64701
|
children_list: [],
|
|
64744
64702
|
// 子属性列表
|
|
64745
|
-
|
|
64746
64703
|
brand_property: {},
|
|
64747
64704
|
// '品牌'属性
|
|
64748
64705
|
material_quality_property: {} // ‘材料成分’属性
|
|
64749
64706
|
};
|
|
64750
|
-
|
|
64751
64707
|
//// 第一步,进行数据分组拆分, 拆分出:“品牌”属性,必填属性,非必填属性,子属性, 其中‘材料成分’属性外部登记(方便后期进行检测)
|
|
64752
64708
|
properties.forEach(function (item) {
|
|
64753
64709
|
var attrItem = _objectSpread2(_objectSpread2({}, item), {}, {
|
|
@@ -64782,17 +64738,14 @@ function perparePropertyGroup(properties) {
|
|
|
64782
64738
|
}
|
|
64783
64739
|
}
|
|
64784
64740
|
});
|
|
64785
|
-
|
|
64786
64741
|
//// 第二步,检测是否有子属性,有子属性需添加到 必填列表 与 非必填列表 中
|
|
64787
64742
|
if (propertiesData.children_list.length > 0) {
|
|
64788
64743
|
// 检测到当前有子属性,注意子属性可能存在多条件显示,或者 次级子属性的情况
|
|
64789
|
-
|
|
64790
64744
|
var required_list = [];
|
|
64791
64745
|
var other_list = [];
|
|
64792
64746
|
var children_list = _toConsumableArray(propertiesData.children_list).sort(function (a, b) {
|
|
64793
64747
|
return Number(b.has_children) - Number(a.has_children);
|
|
64794
64748
|
}); // 排序有子属性的排前
|
|
64795
|
-
|
|
64796
64749
|
propertiesData.required_list.forEach(function (item) {
|
|
64797
64750
|
// 遍历,按顺序添加到新列表中
|
|
64798
64751
|
required_list.push(item);
|
|
@@ -64809,7 +64762,6 @@ function perparePropertyGroup(properties) {
|
|
|
64809
64762
|
getChildrenProperty(other_list, item, children_list);
|
|
64810
64763
|
}
|
|
64811
64764
|
});
|
|
64812
|
-
|
|
64813
64765
|
// 将剩余的子属性分别添加到两个列表中
|
|
64814
64766
|
children_list.forEach(function (item) {
|
|
64815
64767
|
if (item.property_required) {
|
|
@@ -64821,12 +64773,10 @@ function perparePropertyGroup(properties) {
|
|
|
64821
64773
|
propertiesData.required_list = required_list;
|
|
64822
64774
|
propertiesData.other_list = other_list;
|
|
64823
64775
|
}
|
|
64824
|
-
|
|
64825
64776
|
//// 第三步,合成完整的列表
|
|
64826
64777
|
propertiesData.list = [].concat(_toConsumableArray(propertiesData.required_list), _toConsumableArray(propertiesData.other_list));
|
|
64827
64778
|
return propertiesData;
|
|
64828
64779
|
}
|
|
64829
|
-
|
|
64830
64780
|
/**
|
|
64831
64781
|
* 第二步,重新将子属性编排入 必填项列表 与 非必填项列表
|
|
64832
64782
|
* */
|
|
@@ -64841,7 +64791,6 @@ function getChildrenProperty(list, parentItem, children_list) {
|
|
|
64841
64791
|
if (childrenItem.show_condition.length === 1) {
|
|
64842
64792
|
// 子属性只有一个显示条件,直接添加
|
|
64843
64793
|
children_list.splice(index, 1); // 移除属性列表
|
|
64844
|
-
|
|
64845
64794
|
childrenItem.property_required = parentItem.property_required; // 子属性设置必选标识
|
|
64846
64795
|
list.push(childrenItem);
|
|
64847
64796
|
// 检测当时子属性是否有再下级子属性
|
|
@@ -65061,7 +65010,6 @@ var model = {
|
|
|
65061
65010
|
},
|
|
65062
65011
|
// {value: ['铜氨丝','铜氨丝(铜氨纤维)'], similarity: 1},
|
|
65063
65012
|
// {value: ['铜氨纤维(铜氨丝)','铜氨丝(铜氨纤维)'], similarity: 1},
|
|
65064
|
-
|
|
65065
65013
|
{
|
|
65066
65014
|
value: ['氨纶', '聚氨酯弹性纤维(氨纶)'],
|
|
65067
65015
|
similarity: 1
|
|
@@ -72688,7 +72636,6 @@ var map = [{
|
|
|
72688
72636
|
}];
|
|
72689
72637
|
var defaultModel = {
|
|
72690
72638
|
map: map
|
|
72691
|
-
|
|
72692
72639
|
// getAttrValue(matchInfo: object, propertyItem) {
|
|
72693
72640
|
//
|
|
72694
72641
|
// let attrDatas = map.find(item => item.attr.includes(propertyItem.property_name))
|
|
@@ -72802,17 +72749,14 @@ function checkValue(value) {
|
|
|
72802
72749
|
if (value === null || value === undefined || value === "") {
|
|
72803
72750
|
return false;
|
|
72804
72751
|
}
|
|
72805
|
-
|
|
72806
72752
|
// 数组类型
|
|
72807
72753
|
if (Array.isArray(value)) {
|
|
72808
72754
|
return value.length > 0;
|
|
72809
72755
|
}
|
|
72810
|
-
|
|
72811
72756
|
// 对象类型
|
|
72812
72757
|
if (_typeof(value) === "object" && value !== null) {
|
|
72813
72758
|
return Object.keys(value).length > 0;
|
|
72814
72759
|
}
|
|
72815
|
-
|
|
72816
72760
|
// 其他类型(数字、布尔值等)视为有效
|
|
72817
72761
|
return true;
|
|
72818
72762
|
} catch (error) {
|
|
@@ -72820,7 +72764,6 @@ function checkValue(value) {
|
|
|
72820
72764
|
return false;
|
|
72821
72765
|
}
|
|
72822
72766
|
}
|
|
72823
|
-
|
|
72824
72767
|
/**
|
|
72825
72768
|
* 获取2个字符串的相似度
|
|
72826
72769
|
* @param {string} str1 字符串1
|
|
@@ -72831,20 +72774,18 @@ function getStringSimilarity(str1, str2) {
|
|
|
72831
72774
|
// 优化点1:避免重复计数
|
|
72832
72775
|
var arr2 = str2.split(''); // 将字符串转为数组便于操作
|
|
72833
72776
|
var sameNum = 0;
|
|
72834
|
-
|
|
72835
72777
|
// 遍历时删除已匹配字符避免重复计数
|
|
72836
72778
|
var _iterator = _createForOfIteratorHelper(str1),
|
|
72837
72779
|
_step;
|
|
72838
72780
|
try {
|
|
72839
72781
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
72840
|
-
var
|
|
72841
|
-
var index = arr2.indexOf(
|
|
72782
|
+
var char = _step.value;
|
|
72783
|
+
var index = arr2.indexOf(char);
|
|
72842
72784
|
if (index !== -1) {
|
|
72843
72785
|
sameNum++;
|
|
72844
72786
|
arr2.splice(index, 1); // 移除已匹配字符
|
|
72845
72787
|
}
|
|
72846
72788
|
}
|
|
72847
|
-
|
|
72848
72789
|
// 优化点2:引入Dice系数计算相似度
|
|
72849
72790
|
} catch (err) {
|
|
72850
72791
|
_iterator.e(err);
|
|
@@ -72852,17 +72793,15 @@ function getStringSimilarity(str1, str2) {
|
|
|
72852
72793
|
_iterator.f();
|
|
72853
72794
|
}
|
|
72854
72795
|
var diceCoefficient = 2 * sameNum / (str1.length + str2.length);
|
|
72855
|
-
|
|
72856
72796
|
// 优化点3:短字符串完全包含时的加权处理
|
|
72857
72797
|
var _ref = str1.length > str2.length ? [str1, str2] : [str2, str1],
|
|
72858
72798
|
_ref2 = _slicedToArray(_ref, 2),
|
|
72859
72799
|
longer = _ref2[0],
|
|
72860
72800
|
shorter = _ref2[1];
|
|
72861
72801
|
var inclusionBonus = 0;
|
|
72862
|
-
|
|
72863
72802
|
// 如果短串是长串的子集则增加匹配度(字符全部包含权重增加)
|
|
72864
|
-
if (shorter.split('').every(function (
|
|
72865
|
-
return longer.includes(
|
|
72803
|
+
if (shorter.split('').every(function (char) {
|
|
72804
|
+
return longer.includes(char);
|
|
72866
72805
|
})) {
|
|
72867
72806
|
inclusionBonus = 0.3 * (shorter.length / longer.length);
|
|
72868
72807
|
// 判断是否字符串完成包含,增加权重
|
|
@@ -72870,16 +72809,13 @@ function getStringSimilarity(str1, str2) {
|
|
|
72870
72809
|
inclusionBonus += 0.2;
|
|
72871
72810
|
}
|
|
72872
72811
|
}
|
|
72873
|
-
|
|
72874
72812
|
// 优化点4:长度差异补偿(短串越接近长串得分越高)
|
|
72875
72813
|
var lengthRatio = shorter.length / longer.length;
|
|
72876
72814
|
var lengthCompensation = 0.2 * lengthRatio;
|
|
72877
|
-
|
|
72878
72815
|
// 最终相似度 = Dice系数 + 包含奖励 + 长度补偿
|
|
72879
72816
|
// 最终相似度不能大于1,方便多选时优先使用完全匹配和模型匹配
|
|
72880
72817
|
return Math.min(diceCoefficient + inclusionBonus + lengthCompensation, 0.99);
|
|
72881
72818
|
}
|
|
72882
|
-
|
|
72883
72819
|
/**
|
|
72884
72820
|
* 判断字符串中是否包含某些字符
|
|
72885
72821
|
*
|
|
@@ -72903,7 +72839,6 @@ function isTextInclude(text, arr) {
|
|
|
72903
72839
|
throw new Error('type 参数错误有误,只能是includeOne或includeAll');
|
|
72904
72840
|
}
|
|
72905
72841
|
}
|
|
72906
|
-
|
|
72907
72842
|
/* 获取当前时间节点 */
|
|
72908
72843
|
function getCurrentTime() {
|
|
72909
72844
|
var date = new Date();
|
|
@@ -72933,7 +72868,6 @@ function getCurrentTime() {
|
|
|
72933
72868
|
lastSeason: lastSeason
|
|
72934
72869
|
};
|
|
72935
72870
|
}
|
|
72936
|
-
|
|
72937
72871
|
/* 数值取随机数,获取指定数字内的随机数 */
|
|
72938
72872
|
function mathRandomNumber(num) {
|
|
72939
72873
|
if (num === 0 || !num) {
|
|
@@ -72982,7 +72916,6 @@ function getAttrDefaultValue(matchInfo, propertyItem) {
|
|
|
72982
72916
|
return undefined;
|
|
72983
72917
|
}
|
|
72984
72918
|
}
|
|
72985
|
-
|
|
72986
72919
|
// 根据属性选项进行预测筛选
|
|
72987
72920
|
var property_values = _toConsumableArray(propertyItem.select_values);
|
|
72988
72921
|
var _loop = function _loop() {
|
|
@@ -72995,7 +72928,6 @@ function getAttrDefaultValue(matchInfo, propertyItem) {
|
|
|
72995
72928
|
// console.log('跳过')
|
|
72996
72929
|
return 0; // continue
|
|
72997
72930
|
}
|
|
72998
|
-
|
|
72999
72931
|
// console.log(fieldValues)
|
|
73000
72932
|
// console.log(property_values)
|
|
73001
72933
|
if (propertyItem.property_type == 'input' || propertyItem.property_type == 'date' || propertyItem.property_type == 'inputComponent') {
|
|
@@ -73029,7 +72961,6 @@ function getAttrDefaultValue(matchInfo, propertyItem) {
|
|
|
73029
72961
|
}
|
|
73030
72962
|
} else {
|
|
73031
72963
|
// 选择单选
|
|
73032
|
-
|
|
73033
72964
|
// 先进行全匹配,匹配成功则直接返回
|
|
73034
72965
|
var valueItem = property_values.find(function (item) {
|
|
73035
72966
|
var result = fieldValues.findIndex(function (fieldValue) {
|
|
@@ -73038,7 +72969,6 @@ function getAttrDefaultValue(matchInfo, propertyItem) {
|
|
|
73038
72969
|
// console.log(item.name, result)
|
|
73039
72970
|
return result !== -1;
|
|
73040
72971
|
});
|
|
73041
|
-
|
|
73042
72972
|
// 如全内容匹配失败,进行内容包含匹配
|
|
73043
72973
|
if (!valueItem) {
|
|
73044
72974
|
valueItem = property_values.find(function (item) {
|
|
@@ -73066,7 +72996,6 @@ function getAttrDefaultValue(matchInfo, propertyItem) {
|
|
|
73066
72996
|
}
|
|
73067
72997
|
return undefined;
|
|
73068
72998
|
}
|
|
73069
|
-
|
|
73070
72999
|
/*
|
|
73071
73000
|
* 获取属性名匹配
|
|
73072
73001
|
* */
|
|
@@ -73075,7 +73004,6 @@ function attrSimilarity(attr_name1, attr_name2) {
|
|
|
73075
73004
|
if (attr_name1 === attr_name2) {
|
|
73076
73005
|
return 1;
|
|
73077
73006
|
}
|
|
73078
|
-
|
|
73079
73007
|
// 属性值互相包含,判断相似度相似
|
|
73080
73008
|
if (attr_name1.includes(attr_name2) || attr_name2.includes(attr_name1)) {
|
|
73081
73009
|
// 根据包含的字数多少判断相似度
|
|
@@ -73084,7 +73012,6 @@ function attrSimilarity(attr_name1, attr_name2) {
|
|
|
73084
73012
|
return similarity;
|
|
73085
73013
|
}
|
|
73086
73014
|
}
|
|
73087
|
-
|
|
73088
73015
|
// 按照模型进行匹配
|
|
73089
73016
|
var attr_map = model.attr_map;
|
|
73090
73017
|
var result = attr_map.find(function (item) {
|
|
@@ -73095,16 +73022,13 @@ function attrSimilarity(attr_name1, attr_name2) {
|
|
|
73095
73022
|
}
|
|
73096
73023
|
return 0;
|
|
73097
73024
|
}
|
|
73098
|
-
|
|
73099
73025
|
/* 获取属性值匹配 */
|
|
73100
73026
|
function attrValueSimilarity(attr, attr_value1, attr_value2) {
|
|
73101
73027
|
var min_similarity = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0.8;
|
|
73102
73028
|
if (!attr_value1 || !attr_value2) return 0;
|
|
73103
|
-
|
|
73104
73029
|
// 避免数字,导致includes报错
|
|
73105
73030
|
attr_value1 = "".concat(attr_value1);
|
|
73106
73031
|
attr_value2 = "".concat(attr_value2);
|
|
73107
|
-
|
|
73108
73032
|
// 属性值互相包含,判断相似度相似
|
|
73109
73033
|
var similarity = 0;
|
|
73110
73034
|
if (attr_value1.includes(attr_value2) || attr_value2.includes(attr_value1)) {
|
|
@@ -73163,7 +73087,6 @@ function matchPropertyItem(matchInfo, propertyItem) {
|
|
|
73163
73087
|
return;
|
|
73164
73088
|
}
|
|
73165
73089
|
var result = -1;
|
|
73166
|
-
|
|
73167
73090
|
// 第一步,针对特殊的情况进行匹配
|
|
73168
73091
|
if (matchInfo.platform === 'pdd' && propertyItem.property_name === '适用人群') {
|
|
73169
73092
|
// 拼多多的使用人群(建筑工人、医护人员。。。)与 淘宝、抖音的适用人群 匹配
|
|
@@ -73189,7 +73112,6 @@ function matchPropertyItem(matchInfo, propertyItem) {
|
|
|
73189
73112
|
return ['上市年份季节', '上市时节'].includes(item.attr_name);
|
|
73190
73113
|
});
|
|
73191
73114
|
}
|
|
73192
|
-
|
|
73193
73115
|
// 第二步,属性名称完全匹配
|
|
73194
73116
|
if (result === -1) {
|
|
73195
73117
|
result = attrs.findIndex(function (item) {
|
|
@@ -73207,7 +73129,6 @@ function matchPropertyItem(matchInfo, propertyItem) {
|
|
|
73207
73129
|
return;
|
|
73208
73130
|
}
|
|
73209
73131
|
}
|
|
73210
|
-
|
|
73211
73132
|
// 第三步,使用相识度进行匹配
|
|
73212
73133
|
var similarityAttr = [];
|
|
73213
73134
|
attrs.forEach(function (item) {
|
|
@@ -73237,7 +73158,6 @@ function matchPropertyItem(matchInfo, propertyItem) {
|
|
|
73237
73158
|
console.log(e);
|
|
73238
73159
|
}
|
|
73239
73160
|
}
|
|
73240
|
-
|
|
73241
73161
|
/**
|
|
73242
73162
|
* 初始化属性值
|
|
73243
73163
|
* */
|
|
@@ -73253,12 +73173,10 @@ function initPropertyValue(propertyItem) {
|
|
|
73253
73173
|
return '';
|
|
73254
73174
|
}
|
|
73255
73175
|
}
|
|
73256
|
-
|
|
73257
73176
|
/* 材质成分属性列表 */
|
|
73258
73177
|
var materialList = ['材质成分', '面料材质', '面料俗称', '材质', '面料名称', '主面料成分'];
|
|
73259
73178
|
/* 材质含量属性列表 */
|
|
73260
73179
|
var qualityList = ['成分含量', '面料材质成分含量', '面料材质成分含量(%)', '主面料成分的含量', '面料材质含量'];
|
|
73261
|
-
|
|
73262
73180
|
/**
|
|
73263
73181
|
* 进行属性值的匹配
|
|
73264
73182
|
* */
|
|
@@ -73272,7 +73190,6 @@ function matchPropertyValue(matchInfo, propertyItem, attr) {
|
|
|
73272
73190
|
// 参考值为空
|
|
73273
73191
|
return valueItem;
|
|
73274
73192
|
}
|
|
73275
|
-
|
|
73276
73193
|
// 参考值内容
|
|
73277
73194
|
var attr_values = [];
|
|
73278
73195
|
if (Array.isArray(attr.value)) {
|
|
@@ -73297,15 +73214,12 @@ function matchPropertyValue(matchInfo, propertyItem, attr) {
|
|
|
73297
73214
|
});
|
|
73298
73215
|
attr_values = n_attr_values;
|
|
73299
73216
|
}
|
|
73300
|
-
|
|
73301
73217
|
// console.log('匹配属性', propertyItem.property_name, propertyItem.property_type, attr_values
|
|
73302
|
-
|
|
73303
73218
|
if (propertyItem.property_type == 'input' || propertyItem.property_type == 'inputComponent' || propertyItem.property_type == 'date') {
|
|
73304
73219
|
// 输入类属性(纯文本,数值+单位,日期,范围输入)
|
|
73305
73220
|
valueItem = matchInputPropertyValue(matchInfo, propertyItem, attr_values);
|
|
73306
73221
|
} else {
|
|
73307
73222
|
// 选择类属性(单选、多选、组合多选、层级单选)
|
|
73308
|
-
|
|
73309
73223
|
var property_values = _toConsumableArray(propertyItem.select_values);
|
|
73310
73224
|
if (materialList.includes(propertyItem.property_name) || qualityList.includes(propertyItem.property_name)) {
|
|
73311
73225
|
// 匹配 材质成分以及成分含量 内容
|
|
@@ -73328,16 +73242,13 @@ function matchPropertyValue(matchInfo, propertyItem, attr) {
|
|
|
73328
73242
|
}
|
|
73329
73243
|
return valueItem;
|
|
73330
73244
|
}
|
|
73331
|
-
|
|
73332
73245
|
/**
|
|
73333
73246
|
* 特性属性匹配 匹配材质成分 含量,
|
|
73334
73247
|
* · 需要先进行解析在进行匹配
|
|
73335
73248
|
* */
|
|
73336
73249
|
function matchMaterialQualityValue(matchInfo, propertyItem, property_values, attr_values) {
|
|
73337
73250
|
var match_type = materialList.includes(propertyItem.property_name) ? 1 : 2;
|
|
73338
|
-
|
|
73339
73251
|
// console.log('匹配 材质含量类型' + match_type, propertyItem.property_name, attr_values)
|
|
73340
|
-
|
|
73341
73252
|
var material_values = [];
|
|
73342
73253
|
attr_values.forEach(function (item) {
|
|
73343
73254
|
// 优先解析 棉[100%] 棉100% 棉 等格式
|
|
@@ -73353,7 +73264,6 @@ function matchMaterialQualityValue(matchInfo, propertyItem, property_values, att
|
|
|
73353
73264
|
var options = parsePercentageRange(item);
|
|
73354
73265
|
if (options.min === null || options.min === undefined) {
|
|
73355
73266
|
// 范围解析失败,使用其他进行解析
|
|
73356
|
-
|
|
73357
73267
|
var materialOption = parseMaterial(item);
|
|
73358
73268
|
if (materialOption) {
|
|
73359
73269
|
options = {
|
|
@@ -73411,7 +73321,6 @@ function matchMaterialQualityValue(matchInfo, propertyItem, property_values, att
|
|
|
73411
73321
|
// 数值+单位,直接返回数值()
|
|
73412
73322
|
return "".concat(maxPercentage);
|
|
73413
73323
|
}
|
|
73414
|
-
|
|
73415
73324
|
// 处理其他类型
|
|
73416
73325
|
var percentageValue = '';
|
|
73417
73326
|
if (minPercentage < maxPercentage) {
|
|
@@ -73424,7 +73333,6 @@ function matchMaterialQualityValue(matchInfo, propertyItem, property_values, att
|
|
|
73424
73333
|
// 纯文本,直接返回
|
|
73425
73334
|
return percentageValue;
|
|
73426
73335
|
}
|
|
73427
|
-
|
|
73428
73336
|
// 选择,进行处理
|
|
73429
73337
|
var valueItem = property_values.find(function (item) {
|
|
73430
73338
|
return item.name === percentageValue;
|
|
@@ -73436,7 +73344,6 @@ function matchMaterialQualityValue(matchInfo, propertyItem, property_values, att
|
|
|
73436
73344
|
// 未匹配到,拆分处理进行处理
|
|
73437
73345
|
for (var i = 0; i < property_values.length; i++) {
|
|
73438
73346
|
var item = property_values[i];
|
|
73439
|
-
|
|
73440
73347
|
// 解析百分比范围选项
|
|
73441
73348
|
var options = parsePercentageRange(item.name);
|
|
73442
73349
|
if (isMatchNumberRange(minPercentage, maxPercentage, options)) {
|
|
@@ -73452,13 +73359,11 @@ function matchMaterialQualityValue(matchInfo, propertyItem, property_values, att
|
|
|
73452
73359
|
return undefined;
|
|
73453
73360
|
}
|
|
73454
73361
|
}
|
|
73455
|
-
|
|
73456
73362
|
/**
|
|
73457
73363
|
* 匹配输入项
|
|
73458
73364
|
* */
|
|
73459
73365
|
function matchInputPropertyValue(matchInfo, propertyItem, attr_values) {
|
|
73460
73366
|
// console.log(propertyItem.property_name, propertyItem.property_type,attr_values)
|
|
73461
|
-
|
|
73462
73367
|
var valueItem = '';
|
|
73463
73368
|
if (materialList.includes(propertyItem.property_name) || qualityList.includes(propertyItem.property_name)) {
|
|
73464
73369
|
// 匹配 材质成分以及成分含量 内容
|
|
@@ -73508,7 +73413,6 @@ function matchInputPropertyValue(matchInfo, propertyItem, attr_values) {
|
|
|
73508
73413
|
}
|
|
73509
73414
|
}
|
|
73510
73415
|
}
|
|
73511
|
-
|
|
73512
73416
|
// if (propertyItem.property_name.includes('CCC') || propertyItem.property_name.includes('3C')) {
|
|
73513
73417
|
// // 玩具3C认证
|
|
73514
73418
|
// let result = attrs.findIndex(item => item.attr_name.includes('CCC') || item.attr_name.includes('3C'))
|
|
@@ -73519,7 +73423,6 @@ function matchInputPropertyValue(matchInfo, propertyItem, attr_values) {
|
|
|
73519
73423
|
// return goodsAttr.value
|
|
73520
73424
|
// }
|
|
73521
73425
|
// }
|
|
73522
|
-
|
|
73523
73426
|
// if (propertyItem.property_name.includes('型号') && matchInfo.cate_path.includes('3C数码配件')) {
|
|
73524
73427
|
//
|
|
73525
73428
|
// let result = attrs.findIndex(item => item.attr_name.includes('货号'))
|
|
@@ -73533,14 +73436,12 @@ function matchInputPropertyValue(matchInfo, propertyItem, attr_values) {
|
|
|
73533
73436
|
// return goods.goods_sn
|
|
73534
73437
|
// }
|
|
73535
73438
|
// }
|
|
73536
|
-
|
|
73537
73439
|
if (propertyItem.property_type == 'input') {
|
|
73538
73440
|
// 纯文本输入
|
|
73539
73441
|
valueItem = attr_values.join('、');
|
|
73540
73442
|
} else if (propertyItem.property_type === 'inputComponent') ;
|
|
73541
73443
|
return valueItem;
|
|
73542
73444
|
}
|
|
73543
|
-
|
|
73544
73445
|
/**
|
|
73545
73446
|
* 匹配单选项
|
|
73546
73447
|
* */
|
|
@@ -73561,9 +73462,7 @@ function matchSingleSelectPropertyValue(matchInfo, propertyItem, property_values
|
|
|
73561
73462
|
// 有内容,并且相似度大于80%
|
|
73562
73463
|
return valueItem;
|
|
73563
73464
|
}
|
|
73564
|
-
|
|
73565
73465
|
// 没有完全匹配的属性值,开始根据最相似的值进行匹配
|
|
73566
|
-
|
|
73567
73466
|
// 当前属性支持自定义选项,如果筛选的数值小于0.8, 需要创建一个自定义属性
|
|
73568
73467
|
if (propertyItem.select_custom && propertyItem.property_name === '货号') {
|
|
73569
73468
|
// 相似度太小,创建一个自定义属性值
|
|
@@ -73578,7 +73477,6 @@ function matchSingleSelectPropertyValue(matchInfo, propertyItem, property_values
|
|
|
73578
73477
|
}
|
|
73579
73478
|
return valueItem;
|
|
73580
73479
|
}
|
|
73581
|
-
|
|
73582
73480
|
/**
|
|
73583
73481
|
* 匹配常规多选项属性值
|
|
73584
73482
|
* */
|
|
@@ -73601,13 +73499,11 @@ function matchMultiSelectPropertyValue(matchInfo, propertyItem, property_values,
|
|
|
73601
73499
|
}
|
|
73602
73500
|
return valueList;
|
|
73603
73501
|
}
|
|
73604
|
-
|
|
73605
73502
|
/**
|
|
73606
73503
|
* 匹配组合多选项
|
|
73607
73504
|
* */
|
|
73608
73505
|
function matchMultiComplexPropertyValue(matchInfo, propertyItem, property_values, attr_values) {
|
|
73609
73506
|
// console.log('组合多选', propertyItem.property_name, attr_values)
|
|
73610
|
-
|
|
73611
73507
|
// 获取材质 和 成分
|
|
73612
73508
|
var n_attr_values = attr_values.map(function (item) {
|
|
73613
73509
|
var _item;
|
|
@@ -73634,12 +73530,10 @@ function matchMultiComplexPropertyValue(matchInfo, propertyItem, property_values
|
|
|
73634
73530
|
}).filter(function (item) {
|
|
73635
73531
|
return item === null || item === void 0 ? void 0 : item.material;
|
|
73636
73532
|
});
|
|
73637
|
-
|
|
73638
73533
|
// 匹配结果
|
|
73639
73534
|
var valueList = [];
|
|
73640
73535
|
var totalPercentage = 0;
|
|
73641
73536
|
var disableContentNumber = 0;
|
|
73642
|
-
|
|
73643
73537
|
// 根据属性的来源属性值进行属性值匹配
|
|
73644
73538
|
n_attr_values.forEach(function (attrValue) {
|
|
73645
73539
|
// 获取对应的属性值
|
|
@@ -73659,7 +73553,6 @@ function matchMultiComplexPropertyValue(matchInfo, propertyItem, property_values
|
|
|
73659
73553
|
valueList.push(valueItem);
|
|
73660
73554
|
}
|
|
73661
73555
|
});
|
|
73662
|
-
|
|
73663
73556
|
// 当前选项数量超过属性最大选项数量限制
|
|
73664
73557
|
if (propertyItem !== null && propertyItem !== void 0 && propertyItem.select_max_num && valueList.length > propertyItem.select_max_num) {
|
|
73665
73558
|
// 按照相似度进行排序,相似的排最前
|
|
@@ -73679,7 +73572,6 @@ function matchMultiComplexPropertyValue(matchInfo, propertyItem, property_values
|
|
|
73679
73572
|
}
|
|
73680
73573
|
});
|
|
73681
73574
|
}
|
|
73682
|
-
|
|
73683
73575
|
// 整体需填写含量的总数不等于100,进行含量分配处理
|
|
73684
73576
|
if (totalPercentage !== 100 && disableContentNumber < valueList.length) {
|
|
73685
73577
|
// 需要填的成分含量 总数不等于100
|
|
@@ -73705,7 +73597,6 @@ function matchMultiComplexPropertyValue(matchInfo, propertyItem, property_values
|
|
|
73705
73597
|
}
|
|
73706
73598
|
return valueList;
|
|
73707
73599
|
}
|
|
73708
|
-
|
|
73709
73600
|
/**
|
|
73710
73601
|
* 获取数据模型匹配结果
|
|
73711
73602
|
* */
|
|
@@ -73724,7 +73615,6 @@ function modelMatchSimilarityValue(propertyItem, property_values, attrValue) {
|
|
|
73724
73615
|
property_values.splice(valueIndex, 1);
|
|
73725
73616
|
return valueItem;
|
|
73726
73617
|
}
|
|
73727
|
-
|
|
73728
73618
|
// 2.再进行相似度匹配
|
|
73729
73619
|
for (var i = 0; i < property_values.length; i++) {
|
|
73730
73620
|
var _valueItem6;
|
|
@@ -73745,7 +73635,6 @@ function modelMatchSimilarityValue(propertyItem, property_values, attrValue) {
|
|
|
73745
73635
|
}
|
|
73746
73636
|
return valueItem;
|
|
73747
73637
|
}
|
|
73748
|
-
|
|
73749
73638
|
/* 解析内容获取 材质成分 */
|
|
73750
73639
|
function parseMaterial(str) {
|
|
73751
73640
|
var regex = /^([\u4e00-\u9fa5()a-zA-Z0-9\-_]+?)(?:\[?(\d+\.?\d*)%\]?)?$/;
|
|
@@ -73757,14 +73646,11 @@ function parseMaterial(str) {
|
|
|
73757
73646
|
}
|
|
73758
73647
|
return materialInfo;
|
|
73759
73648
|
}
|
|
73760
|
-
|
|
73761
73649
|
/* 解析百分比,获取百分比数值,解析失败返回0 */
|
|
73762
73650
|
function parsePercentage(str) {
|
|
73763
73651
|
if (!str) return 0;
|
|
73764
|
-
|
|
73765
73652
|
// 要求字符串必须以%结尾
|
|
73766
73653
|
if (!str.trim().endsWith('%')) return 0;
|
|
73767
|
-
|
|
73768
73654
|
// 移除所有非数字字符(保留小数点和负号)
|
|
73769
73655
|
var numericString = str.replace(/[^\d.-]/g, '');
|
|
73770
73656
|
// 尝试解析为浮点数
|
|
@@ -73772,7 +73658,6 @@ function parsePercentage(str) {
|
|
|
73772
73658
|
// 返回有效数字或 0
|
|
73773
73659
|
return Number.isNaN(parsedValue) ? 0 : parsedValue;
|
|
73774
73660
|
}
|
|
73775
|
-
|
|
73776
73661
|
/* 解析百分比数值范围 */
|
|
73777
73662
|
function parsePercentageRange(str) {
|
|
73778
73663
|
var itemName = str.replace(/(/g, '(').replace(/)/g, ')').replace(/—/g, '-');
|
|
@@ -73831,21 +73716,17 @@ function parsePercentageRange(str) {
|
|
|
73831
73716
|
}
|
|
73832
73717
|
return optionsItem;
|
|
73833
73718
|
}
|
|
73834
|
-
|
|
73835
73719
|
/* 数值取整,保留小数点后一位 */
|
|
73836
73720
|
function mathRoundNumber(num) {
|
|
73837
73721
|
var number = Number(num);
|
|
73838
73722
|
return Math.round(number * 10) / 10;
|
|
73839
73723
|
}
|
|
73840
|
-
|
|
73841
73724
|
/* 解析匹配数值范围 */
|
|
73842
73725
|
function isMatchNumberRange(userMin, userMax, option) {
|
|
73843
73726
|
// 用户范围完全在选项左侧之外
|
|
73844
73727
|
if (option.min == null || userMax < option.min || userMax === option.min && !option.includeMin) return false;
|
|
73845
|
-
|
|
73846
73728
|
// 用户范围完全在选项右侧之外
|
|
73847
73729
|
if (option.max == null || userMin > option.max || userMin === option.max && !option.includeMax) return false;
|
|
73848
|
-
|
|
73849
73730
|
// 用户范围与选项范围有交集
|
|
73850
73731
|
return true;
|
|
73851
73732
|
}
|
|
@@ -73860,9 +73741,7 @@ function predictionPropertyItem(matchInfo, propertyItem, selectAttrs, goods) {
|
|
|
73860
73741
|
// 使用‘select_values’, 子属性会进行筛选
|
|
73861
73742
|
var property_type = propertyItem.property_type;
|
|
73862
73743
|
var property_values = _toConsumableArray(propertyItem.select_values);
|
|
73863
|
-
|
|
73864
73744
|
//// 1. 优先使用补充数据进行预测,如商品标题,备注,货号
|
|
73865
|
-
|
|
73866
73745
|
var goodsTitle = ((goods === null || goods === void 0 ? void 0 : goods.title) || '') + ((goods === null || goods === void 0 ? void 0 : goods.remark) || '');
|
|
73867
73746
|
// console.log("预测信息 - 商品", goodsTitle, propertyItem.property_name)
|
|
73868
73747
|
if (goodsTitle) {
|
|
@@ -73894,7 +73773,6 @@ function predictionPropertyItem(matchInfo, propertyItem, selectAttrs, goods) {
|
|
|
73894
73773
|
}
|
|
73895
73774
|
return;
|
|
73896
73775
|
}
|
|
73897
|
-
|
|
73898
73776
|
// 通过规格预测
|
|
73899
73777
|
if (goods.specs && goods.specs.length > 0 && ['颜色', '尺码'].includes(propertyItem.property_name)) {
|
|
73900
73778
|
var keys = [];
|
|
@@ -74074,7 +73952,6 @@ function predictionPropertyItem(matchInfo, propertyItem, selectAttrs, goods) {
|
|
|
74074
73952
|
return;
|
|
74075
73953
|
}
|
|
74076
73954
|
}
|
|
74077
|
-
|
|
74078
73955
|
/// 2.根据设定默认值
|
|
74079
73956
|
var defaultItem = getAttrDefaultValue(matchInfo, propertyItem);
|
|
74080
73957
|
if (defaultItem) {
|
|
@@ -74094,9 +73971,7 @@ function predictionPropertyItem(matchInfo, propertyItem, selectAttrs, goods) {
|
|
|
74094
73971
|
}
|
|
74095
73972
|
return;
|
|
74096
73973
|
}
|
|
74097
|
-
|
|
74098
73974
|
/// 3.设置普遍默认值,如:其他,其它,other等
|
|
74099
|
-
|
|
74100
73975
|
if (matchInfo.cate_path.includes('男装') || matchInfo.cate_path.includes('女装') || matchInfo.cate_path.includes('童装')) {
|
|
74101
73976
|
var _result2;
|
|
74102
73977
|
_result2 = property_values.find(function (item) {
|
|
@@ -74127,7 +74002,6 @@ function predictionPropertyItem(matchInfo, propertyItem, selectAttrs, goods) {
|
|
|
74127
74002
|
}
|
|
74128
74003
|
if (matchInfo.platform === 'albb' && ['产地', '服装风格'].includes(propertyItem.property_name) && ['singleSelect', 'multiSelect'].includes(property_type)) {
|
|
74129
74004
|
// 阿里巴巴,部分选项不清楚如何选择,直接随机选
|
|
74130
|
-
|
|
74131
74005
|
var index = mathRandomNumber(property_values.length);
|
|
74132
74006
|
if (index !== -1) {
|
|
74133
74007
|
var _valueItem6 = property_values[index];
|
|
@@ -74140,7 +74014,6 @@ function predictionPropertyItem(matchInfo, propertyItem, selectAttrs, goods) {
|
|
|
74140
74014
|
}
|
|
74141
74015
|
}
|
|
74142
74016
|
}
|
|
74143
|
-
|
|
74144
74017
|
/**
|
|
74145
74018
|
* 根据文本内容信息进行预测
|
|
74146
74019
|
* */
|
|
@@ -74266,7 +74139,7 @@ var fetchWithRetry = /*#__PURE__*/function () {
|
|
|
74266
74139
|
}
|
|
74267
74140
|
}, opt);
|
|
74268
74141
|
_context.n = 1;
|
|
74269
|
-
return axios(postDatas)
|
|
74142
|
+
return axios(postDatas).catch(function (err) {
|
|
74270
74143
|
return err;
|
|
74271
74144
|
});
|
|
74272
74145
|
case 1:
|
|
@@ -74383,7 +74256,6 @@ var getAlibabaItemPublihProps = /*#__PURE__*/function () {
|
|
|
74383
74256
|
var property = {
|
|
74384
74257
|
matchPropertiesValue: matchPropertiesValue
|
|
74385
74258
|
};
|
|
74386
|
-
|
|
74387
74259
|
/**
|
|
74388
74260
|
* 匹配属性值
|
|
74389
74261
|
* */
|
|
@@ -74427,7 +74299,6 @@ function _matchPropertiesValue() {
|
|
|
74427
74299
|
propertiesData.list.forEach(function (propertyItem) {
|
|
74428
74300
|
initMatchProperty(propertyItem);
|
|
74429
74301
|
});
|
|
74430
|
-
|
|
74431
74302
|
// 是否全部匹配完成
|
|
74432
74303
|
matchOver = true; // 已选属性值内容,后续可作为预测的依据之一
|
|
74433
74304
|
selectAttrs = []; // 开始进行模板数据匹配
|
|
@@ -74795,7 +74666,6 @@ function initMatchProperty(propertyItem) {
|
|
|
74795
74666
|
}
|
|
74796
74667
|
});
|
|
74797
74668
|
}
|
|
74798
|
-
|
|
74799
74669
|
/**
|
|
74800
74670
|
* 更新子属性的值,目前仅发现单选有子属性,其他类型暂未发现有子属性
|
|
74801
74671
|
* */
|
|
@@ -74868,7 +74738,6 @@ function _updateChildrenProperty() {
|
|
|
74868
74738
|
childrenList.forEach(function (propertyItem) {
|
|
74869
74739
|
if (childrenItem && childrenItem.property_id === propertyItem.property_id) {
|
|
74870
74740
|
// 当前列表中已经存在子属性,在该子属性下添加显示条件
|
|
74871
|
-
|
|
74872
74741
|
if (conditionItem && conditionItem.parent_value_ids) {
|
|
74873
74742
|
// 当前获取的显示条件,直接添加父属性的选择值
|
|
74874
74743
|
conditionItem.parent_value_ids.push(parentItemValueId);
|
|
@@ -74958,9 +74827,7 @@ var error = {
|
|
|
74958
74827
|
type: '系统报错'
|
|
74959
74828
|
};
|
|
74960
74829
|
}
|
|
74961
|
-
|
|
74962
74830
|
// 自定义错误
|
|
74963
|
-
|
|
74964
74831
|
var code = match[1];
|
|
74965
74832
|
var msg = match[2];
|
|
74966
74833
|
var type = '';
|
|
@@ -74977,42 +74844,6 @@ var error = {
|
|
|
74977
74844
|
}
|
|
74978
74845
|
};
|
|
74979
74846
|
|
|
74980
|
-
// 增强全局对象 polyfill
|
|
74981
|
-
(function () {
|
|
74982
|
-
if (typeof globalThisThis !== 'undefined') return globalThisThis;
|
|
74983
|
-
return globalThis;
|
|
74984
|
-
})();
|
|
74985
|
-
|
|
74986
|
-
// 确保所有全局对象引用都指向 globalThisThis
|
|
74987
|
-
Object.defineProperty(globalThisObject, 'globalThis', {
|
|
74988
|
-
value: globalThisObject,
|
|
74989
|
-
writable: true,
|
|
74990
|
-
enumerable: false,
|
|
74991
|
-
configurable: true
|
|
74992
|
-
});
|
|
74993
|
-
Object.defineProperty(globalThisObject, 'globalThis', {
|
|
74994
|
-
value: globalThisObject,
|
|
74995
|
-
writable: true,
|
|
74996
|
-
enumerable: false,
|
|
74997
|
-
configurable: true
|
|
74998
|
-
});
|
|
74999
|
-
Object.defineProperty(globalThisObject, 'globalThis', {
|
|
75000
|
-
value: globalThisObject,
|
|
75001
|
-
writable: true,
|
|
75002
|
-
enumerable: false,
|
|
75003
|
-
configurable: true
|
|
75004
|
-
});
|
|
75005
|
-
|
|
75006
|
-
// 导出全局对象
|
|
75007
|
-
var getGlobal = function getGlobal() {
|
|
75008
|
-
return globalThisObject;
|
|
75009
|
-
};
|
|
75010
|
-
var main = {
|
|
75011
|
-
createCategoryProperties: createCategoryProperties,
|
|
75012
|
-
getOriginProperty: getOriginProperty,
|
|
75013
|
-
matchCategoryProperties: matchCategoryProperties,
|
|
75014
|
-
createCategoryPropertyTemplate: createCategoryPropertyTemplate
|
|
75015
|
-
};
|
|
75016
74847
|
/**
|
|
75017
74848
|
* 转换自定义属性列表,
|
|
75018
74849
|
* */
|
|
@@ -75059,7 +74890,6 @@ function createCategoryProperties(platform, ptAttrs) {
|
|
|
75059
74890
|
return null;
|
|
75060
74891
|
}
|
|
75061
74892
|
}
|
|
75062
|
-
|
|
75063
74893
|
/**
|
|
75064
74894
|
* 自定义属性类型装换回原来的类型
|
|
75065
74895
|
* */
|
|
@@ -75091,7 +74921,6 @@ function getOriginProperty(platform, type) {
|
|
|
75091
74921
|
return '';
|
|
75092
74922
|
}
|
|
75093
74923
|
}
|
|
75094
|
-
|
|
75095
74924
|
/**
|
|
75096
74925
|
* 匹配属性值
|
|
75097
74926
|
* @param matchDatas 匹配数据
|
|
@@ -75154,7 +74983,7 @@ function _matchCategoryProperties() {
|
|
|
75154
74983
|
return _context.a(2, Promise.reject(error.getError('10001-没有检测到属性!')));
|
|
75155
74984
|
case 2:
|
|
75156
74985
|
_context.n = 3;
|
|
75157
|
-
return property.matchPropertiesValue(matchInfo, properties, attrs, goods)
|
|
74986
|
+
return property.matchPropertiesValue(matchInfo, properties, attrs, goods).catch(function (err) {
|
|
75158
74987
|
if (err instanceof Error) {
|
|
75159
74988
|
return Promise.reject(error.getError(err.message));
|
|
75160
74989
|
}
|
|
@@ -75220,7 +75049,6 @@ function _matchCategoryProperties() {
|
|
|
75220
75049
|
}));
|
|
75221
75050
|
return _matchCategoryProperties.apply(this, arguments);
|
|
75222
75051
|
}
|
|
75223
|
-
|
|
75224
75052
|
/**
|
|
75225
75053
|
* 创建分类属性模板
|
|
75226
75054
|
*
|
|
@@ -75263,6 +75091,12 @@ function createCategoryPropertyTemplate(properties) {
|
|
|
75263
75091
|
return attrs;
|
|
75264
75092
|
}
|
|
75265
75093
|
|
|
75266
|
-
exports
|
|
75267
|
-
|
|
75094
|
+
Object.defineProperty(exports, "getGlobal", {
|
|
75095
|
+
enumerable: true,
|
|
75096
|
+
get: function () { return globalThisThisUtils.getGlobal; }
|
|
75097
|
+
});
|
|
75098
|
+
exports.createCategoryProperties = createCategoryProperties;
|
|
75099
|
+
exports.createCategoryPropertyTemplate = createCategoryPropertyTemplate;
|
|
75100
|
+
exports.getOriginProperty = getOriginProperty;
|
|
75101
|
+
exports.matchCategoryProperties = matchCategoryProperties;
|
|
75268
75102
|
//# sourceMappingURL=ftdsy-attr.cjs.js.map
|