ftdsy-attr 2.1.20 → 2.1.21
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/api/tb/index.d.ts +3 -0
- package/dist/category/bags/bags_leather.d.ts +16 -0
- package/dist/category/bags/bags_motion.d.ts +16 -0
- package/dist/category/clothing/clothing_accessory.d.ts +16 -0
- package/dist/category/clothing/clothing_children.d.ts +16 -0
- package/dist/category/clothing/clothing_jewelry.d.ts +16 -0
- package/dist/category/clothing/clothing_men.d.ts +16 -0
- package/dist/category/clothing/clothing_motion.d.ts +16 -0
- package/dist/category/clothing/clothing_underwear.d.ts +16 -0
- package/dist/category/clothing/clothing_women.d.ts +16 -0
- package/dist/category/departmentStore/departmentStore_bedding.d.ts +16 -0
- package/dist/category/departmentStore/departmentStore_commodity.d.ts +17 -0
- package/dist/category/departmentStore/departmentStore_flower.d.ts +16 -0
- package/dist/category/departmentStore/departmentStore_holidaysupplies.d.ts +17 -0
- package/dist/category/departmentStore/departmentStore_homefabric.d.ts +16 -0
- package/dist/category/departmentStore/departmentStore_petanimal.d.ts +16 -0
- package/dist/category/departmentStore/departmentStore_storage.d.ts +16 -0
- package/dist/category/departmentStore/departmentStore_tableware.d.ts +17 -0
- package/dist/category/index.d.ts +7 -0
- package/dist/category/motherBaby/motherBaby_bady.d.ts +16 -0
- package/dist/category/motherBaby/motherBaby_gravida.d.ts +16 -0
- package/dist/category/numeral/numeral_accessory.d.ts +16 -0
- package/dist/category/numeral/numeral_camera.d.ts +16 -0
- package/dist/category/numeral/numeral_computer.d.ts +16 -0
- package/dist/category/numeral/numeral_game.d.ts +17 -0
- package/dist/category/numeral/numeral_smart.d.ts +17 -0
- package/dist/category/shoes/shoes_children.d.ts +16 -0
- package/dist/category/shoes/shoes_men.d.ts +16 -0
- package/dist/category/shoes/shoes_motion.d.ts +16 -0
- package/dist/category/shoes/shoes_women.d.ts +16 -0
- package/dist/category/sportsOutdoor/sportsOutdoor_outdoors.d.ts +16 -0
- package/dist/category/sportsOutdoor/sportsOutdoor_sports.d.ts +16 -0
- package/dist/category/type.d.ts +18 -0
- package/dist/category/vehicle/vehicle_cycling.d.ts +16 -0
- package/dist/category/vehicle/vehicle_electricvehicle.d.ts +16 -0
- package/dist/category/vehicle/vehicle_motorcycle.d.ts +16 -0
- package/dist/env.d.ts +3 -0
- package/dist/ftdsy-attr.cjs.js +1 -1
- package/dist/ftdsy-attr.cjs.js.map +1 -1
- package/dist/ftdsy-attr.esm.js +1 -1
- package/dist/ftdsy-attr.esm.js.map +1 -1
- package/dist/global-utils.d.ts +1 -0
- package/dist/main.d.ts +53 -0
- package/dist/models/defaultModel.d.ts +16 -0
- package/dist/models/index.d.ts +4 -0
- package/dist/models/modal.d.ts +11 -0
- package/dist/platform/albb.d.ts +6 -0
- package/dist/platform/albb.type.d.ts +27 -0
- package/dist/platform/dsy.d.ts +7 -0
- package/dist/platform/dsy.type.d.ts +12 -0
- package/dist/platform/dy.d.ts +3 -0
- package/dist/platform/dy.type.d.ts +48 -0
- package/dist/platform/jd.d.ts +3 -0
- package/dist/platform/jd.type.d.ts +30 -0
- package/dist/platform/ks.d.ts +3 -0
- package/dist/platform/ks.type.d.ts +41 -0
- package/dist/platform/pdd.d.ts +6 -0
- package/dist/platform/pdd.type.d.ts +28 -0
- package/dist/platform/shopee.d.ts +6 -0
- package/dist/platform/shopee.type.d.ts +28 -0
- package/dist/platform/tb.d.ts +7 -0
- package/dist/platform/tb.type.d.ts +63 -0
- package/dist/platform/tiktok.d.ts +6 -0
- package/dist/platform/tiktok.type.d.ts +1 -0
- package/dist/platform/tm.d.ts +5 -0
- package/dist/platform/tm.type.d.ts +1 -0
- package/dist/platform/wxsph.d.ts +6 -0
- package/dist/platform/wxsph.type.d.ts +9 -0
- package/dist/platform/xhs.d.ts +6 -0
- package/dist/platform/xhs.type.d.ts +16 -0
- package/dist/property/index.d.ts +10 -0
- package/dist/property/matchProperty.d.ts +6 -0
- package/dist/property/perpareProperty.d.ts +9 -0
- package/dist/property/predictionProperty.d.ts +8 -0
- package/dist/property/type.d.ts +69 -0
- package/dist/type.d.ts +67 -0
- package/dist/utils/axios.d.ts +15 -0
- package/dist/utils/error.d.ts +12 -0
- package/dist/utils/is/index.d.ts +23 -0
- package/dist/utils/utils.d.ts +34 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getGlobal: () => any;
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { DsyAttr, DsyAttrWithValue, goodsAttr, MatchDatas, Pt } from './type';
|
|
2
|
+
export * from './type';
|
|
3
|
+
import './global-utils';
|
|
4
|
+
import './env';
|
|
5
|
+
export { getGlobal } from './global-utils';
|
|
6
|
+
/**
|
|
7
|
+
* 转换自定义属性列表,
|
|
8
|
+
* */
|
|
9
|
+
export declare function createCategoryProperties(platform: Pt, ptAttrs: any): DsyAttr[] | null;
|
|
10
|
+
/**
|
|
11
|
+
* 自定义属性类型装换回原来的类型
|
|
12
|
+
* */
|
|
13
|
+
export declare function getOriginProperty(platform: Pt, type: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* 匹配属性值
|
|
16
|
+
* @param matchDatas 匹配数据
|
|
17
|
+
* @param matchLevel 匹配等级
|
|
18
|
+
* @param outType 匹配结果输出类型 group: 分组(已去除),template: 模板, list: 自定义属性列表(不含’品牌‘)
|
|
19
|
+
* */
|
|
20
|
+
export declare function matchCategoryProperties(matchDatas: MatchDatas, matchLevel?: number, outType?: 'template' | 'list'): Promise<{
|
|
21
|
+
msg: string;
|
|
22
|
+
data: DsyAttrWithValue[];
|
|
23
|
+
code: number;
|
|
24
|
+
} | {
|
|
25
|
+
msg: string;
|
|
26
|
+
data: goodsAttr[];
|
|
27
|
+
code: number;
|
|
28
|
+
}>;
|
|
29
|
+
/**
|
|
30
|
+
* 根据模板重新填写属性
|
|
31
|
+
*
|
|
32
|
+
* */
|
|
33
|
+
/**
|
|
34
|
+
* 创建分类属性模板
|
|
35
|
+
*
|
|
36
|
+
* 返回案例如下:
|
|
37
|
+
* input: { attr_name: '货号', value: 'abc' };
|
|
38
|
+
* date: { attr_name: '日期', value: '2025-8-1' };
|
|
39
|
+
* inputComponent: { attr_name: '含量', value: '100%' };
|
|
40
|
+
* singleSelect: { attr_name: '材质', value: '聚酯纤维' };
|
|
41
|
+
* singleSelect: { attr_name: '材质', value: '聚酯纤维' };
|
|
42
|
+
* multiSelect: { attr_name: '材质', value: '[聚酯纤维, 棉]' };
|
|
43
|
+
* multiComplex: { attr_name: '材质', value: '[聚酯纤维[80%], 棉[20%]]' };
|
|
44
|
+
* treeSingleSelect: { attr_name: '风格', value: '休闲风-简约风' };
|
|
45
|
+
* */
|
|
46
|
+
export declare function createCategoryPropertyTemplate(properties: (DsyAttrWithValue | goodsAttr)[]): goodsAttr[];
|
|
47
|
+
declare const ftdsyAttr: {
|
|
48
|
+
createCategoryProperties: typeof createCategoryProperties;
|
|
49
|
+
getOriginProperty: typeof getOriginProperty;
|
|
50
|
+
matchCategoryProperties: typeof matchCategoryProperties;
|
|
51
|
+
createCategoryPropertyTemplate: typeof createCategoryPropertyTemplate;
|
|
52
|
+
};
|
|
53
|
+
export default ftdsyAttr;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
type FieldValue = {
|
|
2
|
+
value: string[];
|
|
3
|
+
pt_limit: any[];
|
|
4
|
+
sort: number;
|
|
5
|
+
};
|
|
6
|
+
type FieldsType = {
|
|
7
|
+
[key: string]: FieldValue[];
|
|
8
|
+
};
|
|
9
|
+
export type defaultItem = {
|
|
10
|
+
attr: string[];
|
|
11
|
+
fields: FieldsType;
|
|
12
|
+
};
|
|
13
|
+
declare const _default: {
|
|
14
|
+
map: defaultItem[];
|
|
15
|
+
};
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { MatchInfo, MatchAttr } from "../property/type";
|
|
2
|
+
export declare function getAttrDefaultValue(matchInfo: MatchInfo, propertyItem: MatchAttr): any;
|
|
3
|
+
export declare function attrSimilarity(attr_name1: string, attr_name2: string): number;
|
|
4
|
+
export declare function attrValueSimilarity(attr: string, attr_value1: string, attr_value2: string, min_similarity?: number): number;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type DataSource = {
|
|
2
|
+
value: string;
|
|
3
|
+
text: string;
|
|
4
|
+
help?: string;
|
|
5
|
+
};
|
|
6
|
+
export type AlbbAttr = {
|
|
7
|
+
propertyId: string;
|
|
8
|
+
name: string;
|
|
9
|
+
label: string;
|
|
10
|
+
uiType: string;
|
|
11
|
+
required: boolean;
|
|
12
|
+
propType: string;
|
|
13
|
+
maxCustomItems: number;
|
|
14
|
+
maxItems: number;
|
|
15
|
+
maxLength: number;
|
|
16
|
+
supportLevelProp: boolean;
|
|
17
|
+
useAiAgent: boolean;
|
|
18
|
+
fieldType: string;
|
|
19
|
+
dataSource?: DataSource[];
|
|
20
|
+
asyncCheck: boolean;
|
|
21
|
+
customizable?: boolean;
|
|
22
|
+
supportValueSearch?: boolean;
|
|
23
|
+
unit: string;
|
|
24
|
+
async?: {
|
|
25
|
+
childPropUrl?: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DsyAttr } from '../type';
|
|
2
|
+
import type { FtdsyAttr } from "../platform/dsy.type";
|
|
3
|
+
export declare function getOriginProperty(type: string): string;
|
|
4
|
+
/**
|
|
5
|
+
* 将Tiktok属性列表 转换自定义属性列表,
|
|
6
|
+
* */
|
|
7
|
+
export declare function createCategoryProperties(categoryProperties: FtdsyAttr[]): DsyAttr[] | null;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export type Option = {
|
|
2
|
+
name: string;
|
|
3
|
+
sequence: number;
|
|
4
|
+
value: string;
|
|
5
|
+
value_id: number;
|
|
6
|
+
};
|
|
7
|
+
export type ValueModules = {
|
|
8
|
+
input_type: string;
|
|
9
|
+
module_id: number;
|
|
10
|
+
prefix: string;
|
|
11
|
+
suffix: string;
|
|
12
|
+
units: [];
|
|
13
|
+
validate_rule: {
|
|
14
|
+
data_type: string;
|
|
15
|
+
max: number;
|
|
16
|
+
min: number;
|
|
17
|
+
precision: number;
|
|
18
|
+
time_format: string;
|
|
19
|
+
unit_rules: [];
|
|
20
|
+
};
|
|
21
|
+
value_required: boolean;
|
|
22
|
+
values: {
|
|
23
|
+
value_name: string;
|
|
24
|
+
}[];
|
|
25
|
+
};
|
|
26
|
+
export type Measure = {
|
|
27
|
+
display_name: string;
|
|
28
|
+
template_id: number;
|
|
29
|
+
value_modules: ValueModules[];
|
|
30
|
+
};
|
|
31
|
+
export type DyAttr = {
|
|
32
|
+
category_id: number;
|
|
33
|
+
cid: number;
|
|
34
|
+
diy_type: 0 | 1;
|
|
35
|
+
has_sub_property: boolean;
|
|
36
|
+
important_type: 0 | 1;
|
|
37
|
+
measure_templates: Measure[];
|
|
38
|
+
multi_select_max: number;
|
|
39
|
+
options: Option[];
|
|
40
|
+
property_id: number;
|
|
41
|
+
property_name: string;
|
|
42
|
+
property_type: number;
|
|
43
|
+
relation_id: number;
|
|
44
|
+
required: 0 | 1;
|
|
45
|
+
sequence: number;
|
|
46
|
+
status: number;
|
|
47
|
+
type: 'select' | 'multi_select' | 'text' | 'multi_value_measure' | 'measure';
|
|
48
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type AttrValue = {
|
|
2
|
+
attId: number;
|
|
3
|
+
catId: number;
|
|
4
|
+
features: {
|
|
5
|
+
key: string;
|
|
6
|
+
fvalue: string;
|
|
7
|
+
}[];
|
|
8
|
+
id: number;
|
|
9
|
+
name: string;
|
|
10
|
+
orderSort: number;
|
|
11
|
+
};
|
|
12
|
+
export type Feature = {
|
|
13
|
+
cn: null;
|
|
14
|
+
fvalue: string;
|
|
15
|
+
key: string;
|
|
16
|
+
};
|
|
17
|
+
export type JdAttr = {
|
|
18
|
+
attrGroup: null;
|
|
19
|
+
attrValueList: AttrValue[];
|
|
20
|
+
attributeType: number;
|
|
21
|
+
catId: number;
|
|
22
|
+
features: Feature[];
|
|
23
|
+
graphic: string;
|
|
24
|
+
id: number;
|
|
25
|
+
inputType: number;
|
|
26
|
+
isRequired: boolean;
|
|
27
|
+
name: string;
|
|
28
|
+
orderSort: 1;
|
|
29
|
+
originCategoryId: null | number;
|
|
30
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
type InputFormatConfig = {
|
|
2
|
+
patternList: string[];
|
|
3
|
+
useLimit: boolean;
|
|
4
|
+
max: number;
|
|
5
|
+
min: number;
|
|
6
|
+
message: string;
|
|
7
|
+
};
|
|
8
|
+
type ImageInputConfig = {
|
|
9
|
+
minCount: number;
|
|
10
|
+
maxCount: number;
|
|
11
|
+
minWidth: number;
|
|
12
|
+
minHeight: number;
|
|
13
|
+
};
|
|
14
|
+
type PropInputConfig = {
|
|
15
|
+
dateInputConfig: null;
|
|
16
|
+
inputFormatConfig: InputFormatConfig | null;
|
|
17
|
+
imageInputConfig: ImageInputConfig | null;
|
|
18
|
+
};
|
|
19
|
+
export type Option = {
|
|
20
|
+
propValueId: number;
|
|
21
|
+
propValue: string;
|
|
22
|
+
};
|
|
23
|
+
export type UnitPropValue = {
|
|
24
|
+
unitPropValueId: string;
|
|
25
|
+
unitPropValueName: string;
|
|
26
|
+
};
|
|
27
|
+
export type KsAttr = {
|
|
28
|
+
propId: string;
|
|
29
|
+
propName: string;
|
|
30
|
+
preConstraint: boolean;
|
|
31
|
+
prePropValues: any[];
|
|
32
|
+
required: boolean;
|
|
33
|
+
propValueMaximum: number;
|
|
34
|
+
sortNum: number;
|
|
35
|
+
propInputConfig: PropInputConfig | null;
|
|
36
|
+
propInputType: string;
|
|
37
|
+
unitProp: UnitPropValue[];
|
|
38
|
+
customInput: boolean;
|
|
39
|
+
options: Option[];
|
|
40
|
+
};
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type Value = {
|
|
2
|
+
vid: number;
|
|
3
|
+
value: string;
|
|
4
|
+
parent_value: string[];
|
|
5
|
+
};
|
|
6
|
+
export type Condition = {
|
|
7
|
+
parent_ref_pid: number;
|
|
8
|
+
parent_vids: number[];
|
|
9
|
+
};
|
|
10
|
+
export type PddAttr = {
|
|
11
|
+
can_note: boolean;
|
|
12
|
+
choose_max_num: number;
|
|
13
|
+
input_max_num: number;
|
|
14
|
+
is_important: boolean;
|
|
15
|
+
is_sale: boolean;
|
|
16
|
+
is_sku: boolean;
|
|
17
|
+
max_value: string;
|
|
18
|
+
min_value: string;
|
|
19
|
+
name: string;
|
|
20
|
+
property_value_type: number;
|
|
21
|
+
ref_pid: number;
|
|
22
|
+
required: boolean;
|
|
23
|
+
required_rule_type: number;
|
|
24
|
+
show_condition: Condition[];
|
|
25
|
+
value_precision: number;
|
|
26
|
+
value_unit: string[];
|
|
27
|
+
values: Value[];
|
|
28
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type MultiLang = {
|
|
2
|
+
language: string;
|
|
3
|
+
value: string;
|
|
4
|
+
};
|
|
5
|
+
export type AttributeValue = {
|
|
6
|
+
value_id: number;
|
|
7
|
+
name: string;
|
|
8
|
+
multi_lang?: MultiLang[];
|
|
9
|
+
child_attribute_list?: ShopeeAttr[];
|
|
10
|
+
};
|
|
11
|
+
export type AttributeInfo = {
|
|
12
|
+
input_type: number;
|
|
13
|
+
input_validation_type: number;
|
|
14
|
+
format_type: number;
|
|
15
|
+
is_oem: boolean;
|
|
16
|
+
support_search_value: boolean;
|
|
17
|
+
max_value_count?: number;
|
|
18
|
+
mandatory_region?: string[];
|
|
19
|
+
attribute_unit_list?: string[];
|
|
20
|
+
};
|
|
21
|
+
export type ShopeeAttr = {
|
|
22
|
+
attribute_id: number;
|
|
23
|
+
mandatory: boolean;
|
|
24
|
+
name: string;
|
|
25
|
+
attribute_value_list?: AttributeValue[];
|
|
26
|
+
multi_lang?: MultiLang[];
|
|
27
|
+
attribute_info: AttributeInfo;
|
|
28
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DsyAttr } from "../type";
|
|
2
|
+
import type { TbAttr } from "./tb.type";
|
|
3
|
+
export declare const getOriginProperty: (type: string) => string;
|
|
4
|
+
/**
|
|
5
|
+
* 将淘宝属性列表 转换自定义属性列表,
|
|
6
|
+
* */
|
|
7
|
+
export declare function createCategoryProperties(categoryProperties: TbAttr[]): DsyAttr[] | null;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export type Rule = {
|
|
2
|
+
exProperty?: string;
|
|
3
|
+
name: string;
|
|
4
|
+
unit?: string;
|
|
5
|
+
value: string;
|
|
6
|
+
};
|
|
7
|
+
export type Option = {
|
|
8
|
+
displayName: string;
|
|
9
|
+
value: string;
|
|
10
|
+
};
|
|
11
|
+
export type Format = {
|
|
12
|
+
placeholder: string;
|
|
13
|
+
type: string;
|
|
14
|
+
text?: string;
|
|
15
|
+
};
|
|
16
|
+
export type UnitName = {
|
|
17
|
+
value: string;
|
|
18
|
+
};
|
|
19
|
+
export type Property = {
|
|
20
|
+
formats: {
|
|
21
|
+
format: Format | Format[];
|
|
22
|
+
};
|
|
23
|
+
key: string;
|
|
24
|
+
precision: {
|
|
25
|
+
name: string;
|
|
26
|
+
value: string;
|
|
27
|
+
};
|
|
28
|
+
taoSirType: {
|
|
29
|
+
value: string;
|
|
30
|
+
};
|
|
31
|
+
tip: {
|
|
32
|
+
value: string;
|
|
33
|
+
};
|
|
34
|
+
type: string;
|
|
35
|
+
unitNames: {
|
|
36
|
+
unitName: UnitName | UnitName[];
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export type Field = {
|
|
40
|
+
id: string;
|
|
41
|
+
name: string;
|
|
42
|
+
options: {
|
|
43
|
+
option: Option[];
|
|
44
|
+
};
|
|
45
|
+
type: string;
|
|
46
|
+
};
|
|
47
|
+
export type TbAttr = {
|
|
48
|
+
id: string;
|
|
49
|
+
name: string;
|
|
50
|
+
rules: {
|
|
51
|
+
rule: Rule | Rule[];
|
|
52
|
+
};
|
|
53
|
+
options: {
|
|
54
|
+
option: Option[];
|
|
55
|
+
};
|
|
56
|
+
properties: {
|
|
57
|
+
property: Property;
|
|
58
|
+
};
|
|
59
|
+
fields: {
|
|
60
|
+
field: Field | Field[];
|
|
61
|
+
};
|
|
62
|
+
type: 'singleCheck' | 'multiCheck' | 'input' | 'multiComplex';
|
|
63
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type TiktokAttr = {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type TmAttr = {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type AttributeValue = {
|
|
2
|
+
valueId: string;
|
|
3
|
+
valueName: string;
|
|
4
|
+
};
|
|
5
|
+
export type XhsAttr = {
|
|
6
|
+
id: string;
|
|
7
|
+
isRequired: boolean;
|
|
8
|
+
name: string;
|
|
9
|
+
enName: string;
|
|
10
|
+
acceptsImage: boolean;
|
|
11
|
+
isMulti: boolean;
|
|
12
|
+
inputType: number;
|
|
13
|
+
dataType: number;
|
|
14
|
+
customizable: boolean;
|
|
15
|
+
values_list: AttributeValue[];
|
|
16
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DsyAttr, DsyAttrWithValue, goodsAttr } from "../type";
|
|
2
|
+
import type { MatchInfo, MatchGoods } from "./type";
|
|
3
|
+
declare const _default: {
|
|
4
|
+
matchPropertiesValue: typeof matchPropertiesValue;
|
|
5
|
+
};
|
|
6
|
+
export default _default;
|
|
7
|
+
/**
|
|
8
|
+
* 匹配属性值
|
|
9
|
+
* */
|
|
10
|
+
declare function matchPropertiesValue(matchInfo: MatchInfo, properties: DsyAttr[], attrs?: goodsAttr[], goods?: MatchGoods): Promise<DsyAttrWithValue[]>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MatchInfo, MatchGoods, MatchAttr } from "./type";
|
|
2
|
+
/**
|
|
3
|
+
* 预测属性值
|
|
4
|
+
*
|
|
5
|
+
* 1.优先根据已有信息进行填写(标题,备注,货号等)
|
|
6
|
+
* 2.再设置默认值(使用默认值表)
|
|
7
|
+
* */
|
|
8
|
+
export declare function predictionPropertyItem(matchInfo: MatchInfo, propertyItem: MatchAttr, selectAttrs: string, goods: MatchGoods): void;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { DsyAttr, Pt, PropertyComponent } from "../type";
|
|
2
|
+
export type MatchInfo = {
|
|
3
|
+
cate_id: string;
|
|
4
|
+
cate_path: string;
|
|
5
|
+
platform: Pt;
|
|
6
|
+
is_prediction: boolean;
|
|
7
|
+
is_required_force: boolean;
|
|
8
|
+
is_other_force: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type MatchGoods = {
|
|
11
|
+
title?: string;
|
|
12
|
+
goods_sn?: string;
|
|
13
|
+
ccc_code?: string;
|
|
14
|
+
remark?: string;
|
|
15
|
+
specs?: MatchGoodsSpec[];
|
|
16
|
+
};
|
|
17
|
+
export type MatchGoodsSpec = {
|
|
18
|
+
spec_id: string;
|
|
19
|
+
spec_name: string;
|
|
20
|
+
is_upload_image: number;
|
|
21
|
+
list: MatchGoodsSpecValue[];
|
|
22
|
+
};
|
|
23
|
+
export type MatchGoodsSpecValue = {
|
|
24
|
+
value_id: string;
|
|
25
|
+
value: string;
|
|
26
|
+
};
|
|
27
|
+
export type MatchAttr = DsyAttr & {
|
|
28
|
+
show: boolean;
|
|
29
|
+
property_value?: number | string | MatchSelectOption[] | MatchSelectOption;
|
|
30
|
+
select_values: MatchSelectOption[];
|
|
31
|
+
select_max_num?: number;
|
|
32
|
+
input_values: MatchInputOption[];
|
|
33
|
+
input_units?: string[];
|
|
34
|
+
input_operator?: string;
|
|
35
|
+
date_format?: string;
|
|
36
|
+
};
|
|
37
|
+
export type MatchSelectOption = {
|
|
38
|
+
name: string;
|
|
39
|
+
value_id: string;
|
|
40
|
+
value: string;
|
|
41
|
+
parent_value?: string[];
|
|
42
|
+
value_path?: string;
|
|
43
|
+
disableContent?: boolean;
|
|
44
|
+
content?: number;
|
|
45
|
+
similarity?: number;
|
|
46
|
+
};
|
|
47
|
+
export type MatchInputOption = PropertyComponent & {
|
|
48
|
+
value: string;
|
|
49
|
+
};
|
|
50
|
+
export interface PropertiesData {
|
|
51
|
+
list: MatchAttr[];
|
|
52
|
+
require_total: number;
|
|
53
|
+
require_count: number;
|
|
54
|
+
required_list: MatchAttr[];
|
|
55
|
+
other_list: MatchAttr[];
|
|
56
|
+
children_list: MatchAttr[];
|
|
57
|
+
brand_property: MatchAttr;
|
|
58
|
+
material_quality_property: MatchAttr;
|
|
59
|
+
}
|
|
60
|
+
export interface MaterialInfo {
|
|
61
|
+
material: string;
|
|
62
|
+
percentage: number;
|
|
63
|
+
}
|
|
64
|
+
export type PercentageRange = {
|
|
65
|
+
min: number | null;
|
|
66
|
+
max: number | null;
|
|
67
|
+
includeMin: boolean;
|
|
68
|
+
includeMax: boolean;
|
|
69
|
+
};
|
package/dist/type.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export type Pt = 'pdd' | 'tb' | 'jd' | 'dy' | 'shopee' | 'xhs' | 'ks' | 'dsy' | 'albb' | 'shopeebt' | 'tgc' | 'wxsph' | 'tiktok' | 'tm' | 'tiktokUs';
|
|
2
|
+
export type PropertyType = 'unknown' | 'input' | 'singleSelect' | 'multiSelect' | 'treeSingleSelect' | 'inputComponent' | 'multiComplex' | 'date' | 'image';
|
|
3
|
+
export type RuleName = 'requiredRule' | 'maxLengthRule' | 'valueTypeRule' | 'maxItemsRule' | 'format' | 'regexRule';
|
|
4
|
+
export type ComponentType = 'input' | 'unit' | 'select' | 'operator' | 'label';
|
|
5
|
+
export type goodsAttr = {
|
|
6
|
+
id?: string;
|
|
7
|
+
attr_name: string;
|
|
8
|
+
value: string | string[];
|
|
9
|
+
value_id?: string | string[];
|
|
10
|
+
};
|
|
11
|
+
export type PropertyOption = {
|
|
12
|
+
label: string;
|
|
13
|
+
value: string;
|
|
14
|
+
parent_value?: string[];
|
|
15
|
+
value_path?: string;
|
|
16
|
+
value_ids_path?: string[];
|
|
17
|
+
children?: PropertyOption[];
|
|
18
|
+
};
|
|
19
|
+
export type PropertyComponent = {
|
|
20
|
+
type: string;
|
|
21
|
+
name?: string;
|
|
22
|
+
placeholder?: string;
|
|
23
|
+
options: PropertyOption[];
|
|
24
|
+
text?: string;
|
|
25
|
+
precision?: number;
|
|
26
|
+
};
|
|
27
|
+
export type Rule = {
|
|
28
|
+
name: RuleName;
|
|
29
|
+
value: string;
|
|
30
|
+
exProperty?: string;
|
|
31
|
+
};
|
|
32
|
+
export type Condition = {
|
|
33
|
+
parent_id: string;
|
|
34
|
+
parent_value_ids: string[];
|
|
35
|
+
};
|
|
36
|
+
export type DsyAttr = {
|
|
37
|
+
property_id: string;
|
|
38
|
+
property_required: boolean;
|
|
39
|
+
property_name: string;
|
|
40
|
+
property_type: PropertyType;
|
|
41
|
+
property_values: PropertyOption[];
|
|
42
|
+
property_component?: PropertyComponent[];
|
|
43
|
+
property_tips?: string;
|
|
44
|
+
rules: Rule[];
|
|
45
|
+
has_children: boolean;
|
|
46
|
+
select_custom?: boolean;
|
|
47
|
+
show_condition?: Condition[];
|
|
48
|
+
measure_templates?: any;
|
|
49
|
+
isCStore?: boolean;
|
|
50
|
+
};
|
|
51
|
+
export type DsyAttrValue = {
|
|
52
|
+
valueId: string | string[];
|
|
53
|
+
value: string | string[];
|
|
54
|
+
};
|
|
55
|
+
export type DsyAttrWithValue = DsyAttr & DsyAttrValue;
|
|
56
|
+
export type MatchDatas = {
|
|
57
|
+
cate_id: string | number;
|
|
58
|
+
cate_path: string | string[];
|
|
59
|
+
platform: string;
|
|
60
|
+
properties: any[];
|
|
61
|
+
attrs?: any[];
|
|
62
|
+
title?: string;
|
|
63
|
+
goods_sn?: string;
|
|
64
|
+
ccc_code?: string;
|
|
65
|
+
remark?: string;
|
|
66
|
+
specs?: any;
|
|
67
|
+
};
|