@whgiimall/prototype-biz-selectors 0.1.0
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/BizTableFilter.vue.d.ts +38 -0
- package/dist/Platform.vue.d.ts +27 -0
- package/dist/Shop.vue.d.ts +13 -0
- package/dist/Site.vue.d.ts +23 -0
- package/dist/User.vue.d.ts +20 -0
- package/dist/api/global.d.ts +35 -0
- package/dist/chunks/register-Bc4_Z0wH.mjs +320 -0
- package/dist/chunks/register-Bc4_Z0wH.mjs.map +1 -0
- package/dist/config.d.ts +5 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.mjs +2 -0
- package/dist/register.d.ts +2 -0
- package/dist/register.mjs +2 -0
- package/dist/store/global.d.ts +69 -0
- package/package.json +48 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { PropType } from 'vue';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
|
+
customReset: {
|
|
4
|
+
type: BooleanConstructor;
|
|
5
|
+
default: boolean;
|
|
6
|
+
};
|
|
7
|
+
queryParams: {
|
|
8
|
+
type: PropType<Record<string, any>>;
|
|
9
|
+
};
|
|
10
|
+
filterGroup: {
|
|
11
|
+
type: PropType<any[]>;
|
|
12
|
+
};
|
|
13
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
14
|
+
search: (...args: any[]) => void;
|
|
15
|
+
reset: (...args: any[]) => void;
|
|
16
|
+
"update:queryParams": (value: Record<string, any>) => void;
|
|
17
|
+
"update:filterGroup": (value: any[]) => void;
|
|
18
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
19
|
+
customReset: {
|
|
20
|
+
type: BooleanConstructor;
|
|
21
|
+
default: boolean;
|
|
22
|
+
};
|
|
23
|
+
queryParams: {
|
|
24
|
+
type: PropType<Record<string, any>>;
|
|
25
|
+
};
|
|
26
|
+
filterGroup: {
|
|
27
|
+
type: PropType<any[]>;
|
|
28
|
+
};
|
|
29
|
+
}>> & Readonly<{
|
|
30
|
+
onSearch?: (...args: any[]) => any;
|
|
31
|
+
onReset?: (...args: any[]) => any;
|
|
32
|
+
"onUpdate:queryParams"?: (value: Record<string, any>) => any;
|
|
33
|
+
"onUpdate:filterGroup"?: (value: any[]) => any;
|
|
34
|
+
}>, {
|
|
35
|
+
customReset: boolean;
|
|
36
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
37
|
+
declare const _default: typeof __VLS_export;
|
|
38
|
+
export default _default;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
labelKey?: string;
|
|
3
|
+
valueKey?: string;
|
|
4
|
+
validPlatforms?: string[];
|
|
5
|
+
};
|
|
6
|
+
type __VLS_ModelProps = {
|
|
7
|
+
modelValue?: any;
|
|
8
|
+
};
|
|
9
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
10
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
11
|
+
name: () => any;
|
|
12
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
13
|
+
"update:modelValue": (value: any) => any;
|
|
14
|
+
} & {
|
|
15
|
+
change: (val: any) => any;
|
|
16
|
+
changeValue: (val: any) => any;
|
|
17
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
18
|
+
onChange?: (val: any) => any;
|
|
19
|
+
onChangeValue?: (val: any) => any;
|
|
20
|
+
"onUpdate:modelValue"?: (value: any) => any;
|
|
21
|
+
}>, {
|
|
22
|
+
labelKey: string;
|
|
23
|
+
valueKey: string;
|
|
24
|
+
validPlatforms: string[];
|
|
25
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
26
|
+
declare const _default: typeof __VLS_export;
|
|
27
|
+
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type __VLS_ModelProps = {
|
|
2
|
+
modelValue?: any;
|
|
3
|
+
};
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {
|
|
5
|
+
name: () => any;
|
|
6
|
+
currentShopInfo: () => Promise<unknown>;
|
|
7
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
"update:modelValue": (value: any) => any;
|
|
9
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
10
|
+
"onUpdate:modelValue"?: (value: any) => any;
|
|
11
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
12
|
+
declare const _default: typeof __VLS_export;
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
platform?: string | number;
|
|
3
|
+
};
|
|
4
|
+
type __VLS_ModelProps = {
|
|
5
|
+
modelValue?: any;
|
|
6
|
+
};
|
|
7
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
8
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
9
|
+
name: () => any;
|
|
10
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
11
|
+
"update:modelValue": (value: any) => any;
|
|
12
|
+
} & {
|
|
13
|
+
change: (val: any) => any;
|
|
14
|
+
changeValue: (val: any) => any;
|
|
15
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
16
|
+
onChange?: (val: any) => any;
|
|
17
|
+
onChangeValue?: (val: any) => any;
|
|
18
|
+
"onUpdate:modelValue"?: (value: any) => any;
|
|
19
|
+
}>, {
|
|
20
|
+
platform: string | number;
|
|
21
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
22
|
+
declare const _default: typeof __VLS_export;
|
|
23
|
+
export default _default;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CascaderValue } from 'element-plus';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
multiple?: boolean;
|
|
4
|
+
};
|
|
5
|
+
type __VLS_ModelProps = {
|
|
6
|
+
modelValue?: CascaderValue | null | undefined;
|
|
7
|
+
};
|
|
8
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
9
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
|
+
"update:modelValue": (value: CascaderValue) => any;
|
|
11
|
+
} & {
|
|
12
|
+
change: (val: CascaderValue) => any;
|
|
13
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
14
|
+
onChange?: (val: CascaderValue) => any;
|
|
15
|
+
"onUpdate:modelValue"?: (value: CascaderValue) => any;
|
|
16
|
+
}>, {
|
|
17
|
+
multiple: boolean;
|
|
18
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { AxiosRequestConfig } from 'axios';
|
|
2
|
+
/** 平台列表 */
|
|
3
|
+
export declare const apiGetPlatform: () => any;
|
|
4
|
+
/** 店铺下拉 */
|
|
5
|
+
export declare function useApiShopSelector(config?: AxiosRequestConfig, options?: {
|
|
6
|
+
immediate?: boolean;
|
|
7
|
+
}): {
|
|
8
|
+
exec: (axiosConfig?: AxiosRequestConfig) => Promise<import("giime").StrictUseAxiosReturn<any, import("axios").AxiosResponse<any, any, {}>, any, {
|
|
9
|
+
immediate: boolean;
|
|
10
|
+
}>>;
|
|
11
|
+
execute: (url?: string | AxiosRequestConfig<any>, config?: AxiosRequestConfig<any>) => Promise<import("giime").StrictUseAxiosReturn<any, import("axios").AxiosResponse<any, any, {}>, any, {
|
|
12
|
+
immediate: boolean;
|
|
13
|
+
}>>;
|
|
14
|
+
response: import("vue").ShallowRef<import("axios").AxiosResponse<any, any, {}>>;
|
|
15
|
+
data: import("vue").Ref<any, any>;
|
|
16
|
+
isFinished: import("vue").Ref<boolean>;
|
|
17
|
+
isLoading: import("vue").Ref<boolean>;
|
|
18
|
+
isAborted: import("vue").Ref<boolean>;
|
|
19
|
+
error: import("vue").ShallowRef<unknown | undefined>;
|
|
20
|
+
abort: (message?: string | undefined) => void;
|
|
21
|
+
cancel: (message?: string | undefined) => void;
|
|
22
|
+
isCanceled: import("vue").Ref<boolean>;
|
|
23
|
+
then<TResult1 = import("giime").StrictUseAxiosReturn<any, import("axios").AxiosResponse<any, any, {}>, any, {
|
|
24
|
+
immediate: boolean;
|
|
25
|
+
}>, TResult2 = never>(onfulfilled?: (value: import("giime").StrictUseAxiosReturn<any, import("axios").AxiosResponse<any, any, {}>, any, {
|
|
26
|
+
immediate: boolean;
|
|
27
|
+
}>) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>;
|
|
28
|
+
catch<TResult = never>(onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<import("giime").StrictUseAxiosReturn<any, import("axios").AxiosResponse<any, any, {}>, any, {
|
|
29
|
+
immediate: boolean;
|
|
30
|
+
}> | TResult>;
|
|
31
|
+
finally(onfinally?: () => void): Promise<import("giime").StrictUseAxiosReturn<any, import("axios").AxiosResponse<any, any, {}>, any, {
|
|
32
|
+
immediate: boolean;
|
|
33
|
+
}>>;
|
|
34
|
+
[Symbol.toStringTag]: string;
|
|
35
|
+
};
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import { createBlock as e, createCommentVNode as t, createSlots as n, createVNode as r, defineComponent as i, mergeModels as a, mergeProps as o, onBeforeMount as s, openBlock as c, ref as l, renderList as u, resolveComponent as d, unref as f, useModel as p, withCtx as m } from "vue";
|
|
2
|
+
import { useAxios as h, useOrgUserListStore as g, usePlatformLineListStore as _ } from "giime";
|
|
3
|
+
import { BaseSelect as v, TableFilter as y } from "@whgiimall/prototype-ui";
|
|
4
|
+
import { defineStore as b, storeToRefs as x } from "pinia";
|
|
5
|
+
import S from "@whgiimall/prototype-core/request";
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/Site.vue
|
|
8
|
+
var C = /* @__PURE__ */ i({
|
|
9
|
+
name: "Site",
|
|
10
|
+
inheritAttrs: !0,
|
|
11
|
+
__name: "Site",
|
|
12
|
+
props: /* @__PURE__ */ a({ platform: { default: "amazon" } }, {
|
|
13
|
+
modelValue: {},
|
|
14
|
+
modelModifiers: {}
|
|
15
|
+
}),
|
|
16
|
+
emits: /* @__PURE__ */ a(["change", "changeValue"], ["update:modelValue"]),
|
|
17
|
+
setup(t, { expose: n, emit: r }) {
|
|
18
|
+
let i = _(), a = t, s = l(), u = p(t, "modelValue"), d = computed(() => {
|
|
19
|
+
let e = "", t = null;
|
|
20
|
+
return /^[a-zA-Z]+$/.test(a.platform) ? (e = a.platform.toLowerCase(), e === "amazon" && (e = "aws")) : t = a.platform, i.cascaderList.find((n) => n.name === e || n.id === t)?.lineList || [];
|
|
21
|
+
}), m = r, h = (e) => {
|
|
22
|
+
m("change", e), m("changeValue", {
|
|
23
|
+
value: e,
|
|
24
|
+
name: s.value.name
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
return n({ name: () => s.value.name }), (t, n) => (c(), e(f(v), o({
|
|
28
|
+
ref_key: "selectRef",
|
|
29
|
+
ref: s,
|
|
30
|
+
modelValue: u.value,
|
|
31
|
+
"onUpdate:modelValue": n[0] ||= (e) => u.value = e,
|
|
32
|
+
"label-key": "name",
|
|
33
|
+
"value-key": "id",
|
|
34
|
+
options: f(d)
|
|
35
|
+
}, t.$attrs, { onChange: h }), null, 16, ["modelValue", "options"]));
|
|
36
|
+
}
|
|
37
|
+
}), w = { gatewayUrl: "" }, T = { ...w };
|
|
38
|
+
function E(e) {
|
|
39
|
+
T = {
|
|
40
|
+
...w,
|
|
41
|
+
...e
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function D() {
|
|
45
|
+
return T;
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/api/global.ts
|
|
49
|
+
function O() {
|
|
50
|
+
let { gatewayUrl: e } = D();
|
|
51
|
+
return {
|
|
52
|
+
productCenter: "/product-center",
|
|
53
|
+
amazonAgent: `${e}/amazon-agent`
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
var k = () => {
|
|
57
|
+
let { productCenter: e } = O();
|
|
58
|
+
return S({
|
|
59
|
+
url: `${e}/basic/v1/platform/getPlatformList`,
|
|
60
|
+
method: "post",
|
|
61
|
+
data: {
|
|
62
|
+
page: 1,
|
|
63
|
+
page_size: 9999
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
function A(e, t) {
|
|
68
|
+
let { amazonAgent: n } = O(), r = h(`${n}/basic/v1/shop/getShopSelect`, {
|
|
69
|
+
method: "post",
|
|
70
|
+
...e
|
|
71
|
+
}, S, {
|
|
72
|
+
immediate: !1,
|
|
73
|
+
...t
|
|
74
|
+
});
|
|
75
|
+
function i(e) {
|
|
76
|
+
return r.execute(e);
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
...r,
|
|
80
|
+
exec: i
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region src/store/global.ts
|
|
85
|
+
var j = b("global", () => {
|
|
86
|
+
let e = l([]), t = async ({ label: t = "platform_name", value: n = "platform_short_name" } = {}) => {
|
|
87
|
+
e.value.length || (e.value = (await k()).data.list.map((e) => ({
|
|
88
|
+
value: e[n],
|
|
89
|
+
label: e[t],
|
|
90
|
+
id: e.id
|
|
91
|
+
})));
|
|
92
|
+
}, { exec: n, data: r } = A(), i = l([]);
|
|
93
|
+
return {
|
|
94
|
+
shopSelector: i,
|
|
95
|
+
getShopSelector: async () => {
|
|
96
|
+
i.value.length || (await n(), i.value = r.value || []);
|
|
97
|
+
},
|
|
98
|
+
platformList: e,
|
|
99
|
+
getPlatformList: t
|
|
100
|
+
};
|
|
101
|
+
}), M = /* @__PURE__ */ i({
|
|
102
|
+
name: "Shop",
|
|
103
|
+
inheritAttrs: !0,
|
|
104
|
+
__name: "Shop",
|
|
105
|
+
props: {
|
|
106
|
+
modelValue: {},
|
|
107
|
+
modelModifiers: {}
|
|
108
|
+
},
|
|
109
|
+
emits: ["update:modelValue"],
|
|
110
|
+
setup(t, { expose: n }) {
|
|
111
|
+
let r = j(), { shopSelector: i } = x(r), a = l(), u = p(t, "modelValue");
|
|
112
|
+
return s(() => {
|
|
113
|
+
r.getShopSelector();
|
|
114
|
+
}), n({
|
|
115
|
+
name: () => a.value.name,
|
|
116
|
+
currentShopInfo: () => new Promise((e) => {
|
|
117
|
+
e(i.value.find((e) => Array.isArray(u.value) ? u.value.includes(e.shop_id) : u.value === e.shop_id) || {});
|
|
118
|
+
})
|
|
119
|
+
}), (t, n) => (c(), e(f(v), o({
|
|
120
|
+
ref_key: "selectRef",
|
|
121
|
+
ref: a,
|
|
122
|
+
modelValue: u.value,
|
|
123
|
+
"onUpdate:modelValue": n[0] ||= (e) => u.value = e,
|
|
124
|
+
"label-key": "shop_name",
|
|
125
|
+
"value-key": "shop_id",
|
|
126
|
+
options: f(i)
|
|
127
|
+
}, t.$attrs), null, 16, ["modelValue", "options"]));
|
|
128
|
+
}
|
|
129
|
+
}), N = /* @__PURE__ */ i({
|
|
130
|
+
name: "Platform",
|
|
131
|
+
inheritAttrs: !0,
|
|
132
|
+
__name: "Platform",
|
|
133
|
+
props: /* @__PURE__ */ a({
|
|
134
|
+
labelKey: { default: "platform_name" },
|
|
135
|
+
valueKey: { default: "platform_short_name" },
|
|
136
|
+
validPlatforms: { default: () => [] }
|
|
137
|
+
}, {
|
|
138
|
+
modelValue: {},
|
|
139
|
+
modelModifiers: {}
|
|
140
|
+
}),
|
|
141
|
+
emits: /* @__PURE__ */ a(["change", "changeValue"], ["update:modelValue"]),
|
|
142
|
+
setup(t, { expose: n, emit: r }) {
|
|
143
|
+
let i = j(), { platformList: a } = x(i), u = t, d = l(), m = p(t, "modelValue");
|
|
144
|
+
s(() => {
|
|
145
|
+
i.getPlatformList({
|
|
146
|
+
label: u.labelKey,
|
|
147
|
+
value: u.valueKey
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
let h = computed(() => u.validPlatforms?.length ? a.value?.filter((e) => u.validPlatforms.includes(e.value)) || [] : a.value || []), g = r, _ = (e) => {
|
|
151
|
+
g("change", e), g("changeValue", {
|
|
152
|
+
value: e,
|
|
153
|
+
name: d.value.name
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
return n({ name: () => d.value.name }), (t, n) => (c(), e(f(v), o({
|
|
157
|
+
ref_key: "selectRef",
|
|
158
|
+
ref: d,
|
|
159
|
+
modelValue: m.value,
|
|
160
|
+
"onUpdate:modelValue": n[0] ||= (e) => m.value = e,
|
|
161
|
+
"label-key": "label",
|
|
162
|
+
"value-key": "value",
|
|
163
|
+
options: f(h)
|
|
164
|
+
}, t.$attrs, { onChange: _ }), null, 16, ["modelValue", "options"]));
|
|
165
|
+
}
|
|
166
|
+
}), P = /* @__PURE__ */ i({
|
|
167
|
+
name: "User",
|
|
168
|
+
inheritAttrs: !0,
|
|
169
|
+
__name: "User",
|
|
170
|
+
props: /* @__PURE__ */ a({ multiple: {
|
|
171
|
+
type: Boolean,
|
|
172
|
+
default: !0
|
|
173
|
+
} }, {
|
|
174
|
+
modelValue: {},
|
|
175
|
+
modelModifiers: {}
|
|
176
|
+
}),
|
|
177
|
+
emits: /* @__PURE__ */ a(["change"], ["update:modelValue"]),
|
|
178
|
+
setup(t, { emit: n }) {
|
|
179
|
+
let r = t, i = p(t, "modelValue"), a = g(), s = computed(() => ({
|
|
180
|
+
expandTrigger: "hover",
|
|
181
|
+
multiple: r.multiple,
|
|
182
|
+
emitPath: !1
|
|
183
|
+
})), l = n, u = (e) => {
|
|
184
|
+
l("change", e);
|
|
185
|
+
};
|
|
186
|
+
return (t, n) => {
|
|
187
|
+
let r = d("el-cascader");
|
|
188
|
+
return c(), e(r, o({
|
|
189
|
+
modelValue: i.value,
|
|
190
|
+
"onUpdate:modelValue": n[0] ||= (e) => i.value = e,
|
|
191
|
+
class: "w-full",
|
|
192
|
+
options: f(a).orgUserList,
|
|
193
|
+
clearable: "",
|
|
194
|
+
filterable: "",
|
|
195
|
+
"collapse-tags": "",
|
|
196
|
+
props: f(s)
|
|
197
|
+
}, t.$attrs, { onChange: u }), null, 16, [
|
|
198
|
+
"modelValue",
|
|
199
|
+
"options",
|
|
200
|
+
"props"
|
|
201
|
+
]);
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
}), F = /* @__PURE__ */ i({
|
|
205
|
+
name: "BizTableFilter",
|
|
206
|
+
__name: "BizTableFilter",
|
|
207
|
+
props: /* @__PURE__ */ a({ customReset: {
|
|
208
|
+
type: Boolean,
|
|
209
|
+
default: !1
|
|
210
|
+
} }, {
|
|
211
|
+
queryParams: {
|
|
212
|
+
type: Object,
|
|
213
|
+
default: () => ({})
|
|
214
|
+
},
|
|
215
|
+
queryParamsModifiers: {},
|
|
216
|
+
filterGroup: {
|
|
217
|
+
type: Array,
|
|
218
|
+
default: () => []
|
|
219
|
+
},
|
|
220
|
+
filterGroupModifiers: {}
|
|
221
|
+
}),
|
|
222
|
+
emits: /* @__PURE__ */ a(["search", "reset"], ["update:queryParams", "update:filterGroup"]),
|
|
223
|
+
setup(i, { emit: a }) {
|
|
224
|
+
let s = N, l = new Set([
|
|
225
|
+
"site",
|
|
226
|
+
"shop",
|
|
227
|
+
"platform",
|
|
228
|
+
"user"
|
|
229
|
+
]), h = a, g = i, _ = p(i, "queryParams"), v = p(i, "filterGroup"), b = computed(() => v.value.map((e) => l.has(e.type) ? {
|
|
230
|
+
...e,
|
|
231
|
+
selfRender: !0
|
|
232
|
+
} : e)), x = computed(() => v.value.filter((e) => l.has(e.type)));
|
|
233
|
+
return (i, a) => {
|
|
234
|
+
let l = d("gm-form-item");
|
|
235
|
+
return c(), e(f(y), {
|
|
236
|
+
"query-params": _.value,
|
|
237
|
+
"onUpdate:queryParams": a[0] ||= (e) => _.value = e,
|
|
238
|
+
"filter-group": f(b),
|
|
239
|
+
"custom-reset": g.customReset,
|
|
240
|
+
onSearch: a[1] ||= (e) => h("search"),
|
|
241
|
+
onReset: a[2] ||= (e) => h("reset")
|
|
242
|
+
}, n({ _: 2 }, [u(f(x), (n) => ({
|
|
243
|
+
name: n.key,
|
|
244
|
+
fn: m(() => [r(l, null, {
|
|
245
|
+
default: m(() => [n.type === "site" ? (c(), e(C, o({
|
|
246
|
+
key: 0,
|
|
247
|
+
modelValue: _.value[n.key],
|
|
248
|
+
"onUpdate:modelValue": (e) => _.value[n.key] = e
|
|
249
|
+
}, n, {
|
|
250
|
+
class: "w-ipt",
|
|
251
|
+
placeholder: n.label
|
|
252
|
+
}), null, 16, [
|
|
253
|
+
"modelValue",
|
|
254
|
+
"onUpdate:modelValue",
|
|
255
|
+
"placeholder"
|
|
256
|
+
])) : n.type === "shop" ? (c(), e(M, o({
|
|
257
|
+
key: 1,
|
|
258
|
+
modelValue: _.value[n.key],
|
|
259
|
+
"onUpdate:modelValue": (e) => _.value[n.key] = e
|
|
260
|
+
}, n, {
|
|
261
|
+
class: "w-ipt",
|
|
262
|
+
placeholder: n.label
|
|
263
|
+
}), null, 16, [
|
|
264
|
+
"modelValue",
|
|
265
|
+
"onUpdate:modelValue",
|
|
266
|
+
"placeholder"
|
|
267
|
+
])) : n.type === "platform" ? (c(), e(f(s), o({
|
|
268
|
+
key: 2,
|
|
269
|
+
modelValue: _.value[n.key],
|
|
270
|
+
"onUpdate:modelValue": (e) => _.value[n.key] = e
|
|
271
|
+
}, n, {
|
|
272
|
+
class: "w-ipt",
|
|
273
|
+
placeholder: n.label
|
|
274
|
+
}), null, 16, [
|
|
275
|
+
"modelValue",
|
|
276
|
+
"onUpdate:modelValue",
|
|
277
|
+
"placeholder"
|
|
278
|
+
])) : n.type === "user" ? (c(), e(P, o({
|
|
279
|
+
key: 3,
|
|
280
|
+
modelValue: _.value[n.key],
|
|
281
|
+
"onUpdate:modelValue": (e) => _.value[n.key] = e
|
|
282
|
+
}, n, {
|
|
283
|
+
class: "w-ipt",
|
|
284
|
+
placeholder: n.label,
|
|
285
|
+
multiple: n.multiple !== !1
|
|
286
|
+
}), null, 16, [
|
|
287
|
+
"modelValue",
|
|
288
|
+
"onUpdate:modelValue",
|
|
289
|
+
"placeholder",
|
|
290
|
+
"multiple"
|
|
291
|
+
])) : t("", !0)]),
|
|
292
|
+
_: 2
|
|
293
|
+
}, 1024)])
|
|
294
|
+
}))]), 1032, [
|
|
295
|
+
"query-params",
|
|
296
|
+
"filter-group",
|
|
297
|
+
"custom-reset"
|
|
298
|
+
]);
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
}), I = [
|
|
302
|
+
["Site", C],
|
|
303
|
+
["Shop", M],
|
|
304
|
+
["Platform", N],
|
|
305
|
+
["User", P],
|
|
306
|
+
["BizTableFilter", F]
|
|
307
|
+
];
|
|
308
|
+
function L(e) {
|
|
309
|
+
I.forEach(([t, n]) => {
|
|
310
|
+
if (e.component(t) && e.component(t) !== n) {
|
|
311
|
+
console.warn(`[prototype-biz-selectors] 组件名 "${t}" 重复,已跳过`);
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
e.component(t, n);
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
//#endregion
|
|
318
|
+
export { M as a, A as c, C as d, N as i, D as l, F as n, j as o, P as r, k as s, L as t, E as u };
|
|
319
|
+
|
|
320
|
+
//# sourceMappingURL=register-Bc4_Z0wH.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-Bc4_Z0wH.mjs","names":["$attrs","$attrs","$attrs","$attrs"],"sources":["../../src/Site.vue","../../src/Site.vue","../../src/config.ts","../../src/api/global.ts","../../src/store/global.ts","../../src/Shop.vue","../../src/Shop.vue","../../src/Platform.vue","../../src/Platform.vue","../../src/User.vue","../../src/User.vue","../../src/BizTableFilter.vue","../../src/BizTableFilter.vue","../../src/register.ts"],"sourcesContent":["<template>\n <BaseSelect ref=\"selectRef\" v-model=\"modelVal\" label-key=\"name\" value-key=\"id\" :options=\"countryList\" v-bind=\"$attrs\" @change=\"handleChange\" />\n</template>\n<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { usePlatformLineListStore } from 'giime';\nimport { BaseSelect } from '@whgiimall/prototype-ui';\n\nconst platformLineListStore = usePlatformLineListStore();\n\ndefineOptions({\n name: 'Site',\n inheritAttrs: true\n});\n\nconst props = withDefaults(\n defineProps<{\n platform?: string | number; // 平台ID或平台名称\n }>(),\n {\n platform: 'amazon'\n }\n);\n\nconst selectRef = ref();\n// eslint-disable-next-line vue/require-prop-types\nconst modelVal = defineModel();\n\nconst countryList = computed(() => {\n let platformName = '';\n let platformId: number | null = null;\n\n if (/^[a-zA-Z]+$/.test(props.platform as string)) {\n platformName = (props.platform as string).toLowerCase();\n\n if (platformName === 'amazon') {\n platformName = 'aws';\n }\n } else {\n platformId = props.platform as number;\n }\n\n const currentSite = platformLineListStore.cascaderList.find((item: any) => {\n return item.name === platformName || item.id === platformId;\n });\n\n return currentSite?.lineList || [];\n});\n\nconst emit = defineEmits<{\n (e: 'change', val: any): void;\n (e: 'changeValue', val: any): void;\n}>();\nconst handleChange = (value: any) => {\n emit('change', value);\n emit('changeValue', {\n value,\n name: selectRef.value.name\n });\n};\n\ndefineExpose({\n name: () => selectRef.value.name\n});\n</script>\n","<template>\n <BaseSelect ref=\"selectRef\" v-model=\"modelVal\" label-key=\"name\" value-key=\"id\" :options=\"countryList\" v-bind=\"$attrs\" @change=\"handleChange\" />\n</template>\n<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { usePlatformLineListStore } from 'giime';\nimport { BaseSelect } from '@whgiimall/prototype-ui';\n\nconst platformLineListStore = usePlatformLineListStore();\n\ndefineOptions({\n name: 'Site',\n inheritAttrs: true\n});\n\nconst props = withDefaults(\n defineProps<{\n platform?: string | number; // 平台ID或平台名称\n }>(),\n {\n platform: 'amazon'\n }\n);\n\nconst selectRef = ref();\n// eslint-disable-next-line vue/require-prop-types\nconst modelVal = defineModel();\n\nconst countryList = computed(() => {\n let platformName = '';\n let platformId: number | null = null;\n\n if (/^[a-zA-Z]+$/.test(props.platform as string)) {\n platformName = (props.platform as string).toLowerCase();\n\n if (platformName === 'amazon') {\n platformName = 'aws';\n }\n } else {\n platformId = props.platform as number;\n }\n\n const currentSite = platformLineListStore.cascaderList.find((item: any) => {\n return item.name === platformName || item.id === platformId;\n });\n\n return currentSite?.lineList || [];\n});\n\nconst emit = defineEmits<{\n (e: 'change', val: any): void;\n (e: 'changeValue', val: any): void;\n}>();\nconst handleChange = (value: any) => {\n emit('change', value);\n emit('changeValue', {\n value,\n name: selectRef.value.name\n });\n};\n\ndefineExpose({\n name: () => selectRef.value.name\n});\n</script>\n","export interface BizSelectorsConfig {\n gatewayUrl: string;\n}\n\nconst defaultConfig: BizSelectorsConfig = {\n gatewayUrl: ''\n};\n\nlet bizSelectorsConfig: BizSelectorsConfig = { ...defaultConfig };\n\nexport function setupBizSelectors(config: BizSelectorsConfig) {\n bizSelectorsConfig = {\n ...defaultConfig,\n ...config\n };\n}\n\nexport function getBizSelectorsConfig(): BizSelectorsConfig {\n return bizSelectorsConfig;\n}\n","import type { AxiosRequestConfig } from 'axios';\r\nimport { useAxios } from 'giime';\r\nimport { getBizSelectorsConfig } from '../config';\r\n\r\nimport request from '@whgiimall/prototype-core/request';\r\n\r\nfunction getGatewayPrefix() {\r\n const { gatewayUrl } = getBizSelectorsConfig();\r\n return {\r\n productCenter: `/product-center`,\r\n amazonAgent: `${gatewayUrl}/amazon-agent`\r\n };\r\n}\r\n\r\n/** 平台列表 */\r\nexport const apiGetPlatform = () => {\r\n const { productCenter } = getGatewayPrefix();\r\n return request({\r\n url: `${productCenter}/basic/v1/platform/getPlatformList`,\r\n method: 'post',\r\n data: {\r\n page: 1,\r\n page_size: 9999\r\n }\r\n });\r\n};\r\n\r\n/** 店铺下拉 */\r\nexport function useApiShopSelector(config?: AxiosRequestConfig, options?: { immediate?: boolean }) {\r\n const { amazonAgent } = getGatewayPrefix();\r\n const useAxiosReturn = useAxios(`${amazonAgent}/basic/v1/shop/getShopSelect`, { method: 'post', ...config }, request, {\r\n immediate: false,\r\n ...options\r\n });\r\n\r\n function exec(axiosConfig?: AxiosRequestConfig) {\r\n return useAxiosReturn.execute(axiosConfig);\r\n }\r\n\r\n return { ...useAxiosReturn, exec };\r\n}\r\n","import { ref } from 'vue';\r\nimport { defineStore } from 'pinia';\r\nimport type { Ref } from 'vue';\r\n\r\nimport { apiGetPlatform, useApiShopSelector } from '../api/global';\r\n\r\nexport interface AmzShopSelectorItem {\r\n brand: any[];\r\n id: number;\r\n shop_id: string;\r\n shop_name: string;\r\n status: '1' | '2';\r\n}\r\n\r\nexport const useGlobalStore = defineStore('global', () => {\r\n const platformList: Ref<any[]> = ref([]);\r\n const getPlatformList = async ({ label = 'platform_name', value = 'platform_short_name' }: { label?: string; value?: string } = {}) => {\r\n if (platformList.value.length) return;\r\n const res = await apiGetPlatform();\r\n\r\n platformList.value = res.data.list.map((item: any) => ({\r\n value: item[value],\r\n label: item[label],\r\n id: item.id\r\n }));\r\n };\r\n\r\n const { exec: execShopSelector, data: shopSelectorData } = useApiShopSelector();\r\n const shopSelector = ref<AmzShopSelectorItem[]>([]);\r\n const getShopSelector = async () => {\r\n if (shopSelector.value.length) return;\r\n await execShopSelector();\r\n\r\n shopSelector.value = shopSelectorData.value || [];\r\n };\r\n\r\n return {\r\n shopSelector,\r\n getShopSelector,\r\n platformList,\r\n getPlatformList\r\n };\r\n});\r\n","<template>\n <BaseSelect ref=\"selectRef\" v-model=\"modelVal\" label-key=\"shop_name\" value-key=\"shop_id\" :options=\"shopSelector\" v-bind=\"$attrs\" />\n</template>\n<script setup lang=\"ts\">\nimport { onBeforeMount, ref } from 'vue';\nimport { storeToRefs } from 'pinia';\nimport { BaseSelect } from '@whgiimall/prototype-ui';\nimport { useGlobalStore } from './store/global';\n\nconst globalStore = useGlobalStore();\nconst { shopSelector } = storeToRefs(globalStore);\n\ndefineOptions({\n name: 'Shop',\n inheritAttrs: true\n});\n\nconst selectRef = ref();\n// eslint-disable-next-line vue/require-prop-types\nconst modelVal = defineModel();\n\nonBeforeMount(() => {\n globalStore.getShopSelector();\n});\n\nconst currentShopInfo = () => {\n return new Promise(resolve => {\n const shopInfo =\n shopSelector.value.find((shop: any) => {\n return Array.isArray(modelVal.value) ? modelVal.value.includes(shop.shop_id) : modelVal.value === shop.shop_id;\n }) || {};\n\n resolve(shopInfo);\n });\n};\n\ndefineExpose({\n name: () => selectRef.value.name,\n currentShopInfo\n});\n</script>\n","<template>\n <BaseSelect ref=\"selectRef\" v-model=\"modelVal\" label-key=\"shop_name\" value-key=\"shop_id\" :options=\"shopSelector\" v-bind=\"$attrs\" />\n</template>\n<script setup lang=\"ts\">\nimport { onBeforeMount, ref } from 'vue';\nimport { storeToRefs } from 'pinia';\nimport { BaseSelect } from '@whgiimall/prototype-ui';\nimport { useGlobalStore } from './store/global';\n\nconst globalStore = useGlobalStore();\nconst { shopSelector } = storeToRefs(globalStore);\n\ndefineOptions({\n name: 'Shop',\n inheritAttrs: true\n});\n\nconst selectRef = ref();\n// eslint-disable-next-line vue/require-prop-types\nconst modelVal = defineModel();\n\nonBeforeMount(() => {\n globalStore.getShopSelector();\n});\n\nconst currentShopInfo = () => {\n return new Promise(resolve => {\n const shopInfo =\n shopSelector.value.find((shop: any) => {\n return Array.isArray(modelVal.value) ? modelVal.value.includes(shop.shop_id) : modelVal.value === shop.shop_id;\n }) || {};\n\n resolve(shopInfo);\n });\n};\n\ndefineExpose({\n name: () => selectRef.value.name,\n currentShopInfo\n});\n</script>\n","<template>\n <BaseSelect\n ref=\"selectRef\"\n v-model=\"modelVal\"\n label-key=\"label\"\n value-key=\"value\"\n :options=\"validPlatformsOptions\"\n v-bind=\"$attrs\"\n @change=\"handleChange\"\n />\n</template>\n<script setup lang=\"ts\">\nimport { onBeforeMount, ref } from 'vue';\nimport { storeToRefs } from 'pinia';\nimport { BaseSelect } from '@whgiimall/prototype-ui';\nimport { useGlobalStore } from './store/global';\n\nconst globalStore = useGlobalStore();\nconst { platformList } = storeToRefs(globalStore);\n\ndefineOptions({\n name: 'Platform',\n inheritAttrs: true\n});\n\nconst props = withDefaults(\n defineProps<{\n labelKey?: string;\n valueKey?: string;\n validPlatforms?: string[];\n }>(),\n {\n labelKey: 'platform_name',\n valueKey: 'platform_short_name',\n validPlatforms: () => []\n }\n);\n\nconst selectRef = ref();\n// eslint-disable-next-line vue/require-prop-types\nconst modelVal = defineModel();\n\nonBeforeMount(() => {\n globalStore.getPlatformList({ label: props.labelKey, value: props.valueKey });\n});\n\nconst validPlatformsOptions = computed(() => {\n if (!props.validPlatforms?.length) return platformList.value || [];\n\n return platformList.value?.filter((item: any) => props.validPlatforms.includes(item.value)) || [];\n});\n\nconst emit = defineEmits<{\n (e: 'change', val: any): void;\n (e: 'changeValue', val: any): void;\n}>();\nconst handleChange = (value: any) => {\n emit('change', value);\n emit('changeValue', {\n value,\n name: selectRef.value.name\n });\n};\n\ndefineExpose({\n name: () => selectRef.value.name\n});\n</script>\n","<template>\n <BaseSelect\n ref=\"selectRef\"\n v-model=\"modelVal\"\n label-key=\"label\"\n value-key=\"value\"\n :options=\"validPlatformsOptions\"\n v-bind=\"$attrs\"\n @change=\"handleChange\"\n />\n</template>\n<script setup lang=\"ts\">\nimport { onBeforeMount, ref } from 'vue';\nimport { storeToRefs } from 'pinia';\nimport { BaseSelect } from '@whgiimall/prototype-ui';\nimport { useGlobalStore } from './store/global';\n\nconst globalStore = useGlobalStore();\nconst { platformList } = storeToRefs(globalStore);\n\ndefineOptions({\n name: 'Platform',\n inheritAttrs: true\n});\n\nconst props = withDefaults(\n defineProps<{\n labelKey?: string;\n valueKey?: string;\n validPlatforms?: string[];\n }>(),\n {\n labelKey: 'platform_name',\n valueKey: 'platform_short_name',\n validPlatforms: () => []\n }\n);\n\nconst selectRef = ref();\n// eslint-disable-next-line vue/require-prop-types\nconst modelVal = defineModel();\n\nonBeforeMount(() => {\n globalStore.getPlatformList({ label: props.labelKey, value: props.valueKey });\n});\n\nconst validPlatformsOptions = computed(() => {\n if (!props.validPlatforms?.length) return platformList.value || [];\n\n return platformList.value?.filter((item: any) => props.validPlatforms.includes(item.value)) || [];\n});\n\nconst emit = defineEmits<{\n (e: 'change', val: any): void;\n (e: 'changeValue', val: any): void;\n}>();\nconst handleChange = (value: any) => {\n emit('change', value);\n emit('changeValue', {\n value,\n name: selectRef.value.name\n });\n};\n\ndefineExpose({\n name: () => selectRef.value.name\n});\n</script>\n","<template>\r\n <el-cascader\r\n v-model=\"modelVal\"\r\n class=\"w-full\"\r\n :options=\"orgUserListStore.orgUserList\"\r\n clearable\r\n filterable\r\n collapse-tags\r\n :props=\"cascaderProps\"\r\n v-bind=\"$attrs\"\r\n @change=\"handleChange\"\r\n />\r\n</template>\r\n\r\n<script lang=\"ts\" setup>\r\nimport { useOrgUserListStore } from 'giime';\r\nimport type { CascaderValue } from 'element-plus';\r\n\r\ndefineOptions({\r\n name: 'User',\r\n inheritAttrs: true\r\n});\r\n\r\nconst props = withDefaults(\r\n defineProps<{\r\n multiple?: boolean;\r\n }>(),\r\n {\r\n multiple: true\r\n }\r\n);\r\n\r\n \r\nconst modelVal = defineModel<CascaderValue | null | undefined>();\r\n\r\nconst orgUserListStore = useOrgUserListStore();\r\n\r\nconst cascaderProps = computed(() => ({\r\n expandTrigger: 'hover' as const,\r\n multiple: props.multiple,\r\n emitPath: false\r\n}));\r\n\r\nconst emit = defineEmits<{\r\n (e: 'change', val: CascaderValue | null | undefined): void;\r\n}>();\r\n\r\nconst handleChange = (value: CascaderValue | null | undefined) => {\r\n emit('change', value);\r\n};\r\n</script>\r\n","<template>\r\n <el-cascader\r\n v-model=\"modelVal\"\r\n class=\"w-full\"\r\n :options=\"orgUserListStore.orgUserList\"\r\n clearable\r\n filterable\r\n collapse-tags\r\n :props=\"cascaderProps\"\r\n v-bind=\"$attrs\"\r\n @change=\"handleChange\"\r\n />\r\n</template>\r\n\r\n<script lang=\"ts\" setup>\r\nimport { useOrgUserListStore } from 'giime';\r\nimport type { CascaderValue } from 'element-plus';\r\n\r\ndefineOptions({\r\n name: 'User',\r\n inheritAttrs: true\r\n});\r\n\r\nconst props = withDefaults(\r\n defineProps<{\r\n multiple?: boolean;\r\n }>(),\r\n {\r\n multiple: true\r\n }\r\n);\r\n\r\n \r\nconst modelVal = defineModel<CascaderValue | null | undefined>();\r\n\r\nconst orgUserListStore = useOrgUserListStore();\r\n\r\nconst cascaderProps = computed(() => ({\r\n expandTrigger: 'hover' as const,\r\n multiple: props.multiple,\r\n emitPath: false\r\n}));\r\n\r\nconst emit = defineEmits<{\r\n (e: 'change', val: CascaderValue | null | undefined): void;\r\n}>();\r\n\r\nconst handleChange = (value: CascaderValue | null | undefined) => {\r\n emit('change', value);\r\n};\r\n</script>\r\n","<template>\r\n <TableFilter\r\n v-model:query-params=\"queryParams\"\r\n :filter-group=\"mappedFilterGroup\"\r\n :custom-reset=\"props.customReset\"\r\n @search=\"emit('search')\"\r\n @reset=\"emit('reset')\"\r\n >\r\n <template v-for=\"filter in bizFilters\" :key=\"filter.key\" #[filter.key]>\r\n <gm-form-item>\r\n <Site\r\n v-if=\"filter.type === 'site'\"\r\n v-model=\"queryParams[filter.key]\"\r\n v-bind=\"filter\"\r\n class=\"w-ipt\"\r\n :placeholder=\"filter.label\"\r\n />\r\n <Shop\r\n v-else-if=\"filter.type === 'shop'\"\r\n v-model=\"queryParams[filter.key]\"\r\n v-bind=\"filter\"\r\n class=\"w-ipt\"\r\n :placeholder=\"filter.label\"\r\n />\r\n <PlatForm\r\n v-else-if=\"filter.type === 'platform'\"\r\n v-model=\"queryParams[filter.key]\"\r\n v-bind=\"filter\"\r\n class=\"w-ipt\"\r\n :placeholder=\"filter.label\"\r\n />\r\n <User\r\n v-else-if=\"filter.type === 'user'\"\r\n v-model=\"queryParams[filter.key]\"\r\n v-bind=\"filter\"\r\n class=\"w-ipt\"\r\n :placeholder=\"filter.label\"\r\n :multiple=\"filter.multiple !== false\"\r\n />\r\n </gm-form-item>\r\n </template>\r\n </TableFilter>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { TableFilter } from '@whgiimall/prototype-ui';\r\nimport type { PropType } from 'vue';\r\n\r\nimport Platform from './Platform.vue';\r\nimport Shop from './Shop.vue';\r\nimport Site from './Site.vue';\r\nimport User from './User.vue';\r\n\r\nconst PlatForm = Platform;\r\n\r\ndefineOptions({\r\n name: 'BizTableFilter'\r\n});\r\n\r\nconst BIZ_SELECTOR_TYPES = new Set(['site', 'shop', 'platform', 'user']);\r\n\r\nconst emit = defineEmits(['search', 'reset']);\r\n\r\nconst props = defineProps({\r\n customReset: {\r\n type: Boolean,\r\n default: false\r\n }\r\n});\r\n\r\nconst queryParams = defineModel('queryParams', {\r\n type: Object as PropType<Record<string, any>>,\r\n default: (): Record<string, any> => ({})\r\n});\r\n\r\nconst filterGroup = defineModel('filterGroup', {\r\n type: Array as PropType<Record<string, any>[]>,\r\n default: () => []\r\n});\r\n\r\nconst mappedFilterGroup = computed(() =>\r\n filterGroup.value.map(filter =>\r\n BIZ_SELECTOR_TYPES.has(filter.type) ? { ...filter, selfRender: true } : filter\r\n )\r\n);\r\n\r\nconst bizFilters = computed(() => filterGroup.value.filter(filter => BIZ_SELECTOR_TYPES.has(filter.type)));\r\n</script>\r\n\r\n","<template>\r\n <TableFilter\r\n v-model:query-params=\"queryParams\"\r\n :filter-group=\"mappedFilterGroup\"\r\n :custom-reset=\"props.customReset\"\r\n @search=\"emit('search')\"\r\n @reset=\"emit('reset')\"\r\n >\r\n <template v-for=\"filter in bizFilters\" :key=\"filter.key\" #[filter.key]>\r\n <gm-form-item>\r\n <Site\r\n v-if=\"filter.type === 'site'\"\r\n v-model=\"queryParams[filter.key]\"\r\n v-bind=\"filter\"\r\n class=\"w-ipt\"\r\n :placeholder=\"filter.label\"\r\n />\r\n <Shop\r\n v-else-if=\"filter.type === 'shop'\"\r\n v-model=\"queryParams[filter.key]\"\r\n v-bind=\"filter\"\r\n class=\"w-ipt\"\r\n :placeholder=\"filter.label\"\r\n />\r\n <PlatForm\r\n v-else-if=\"filter.type === 'platform'\"\r\n v-model=\"queryParams[filter.key]\"\r\n v-bind=\"filter\"\r\n class=\"w-ipt\"\r\n :placeholder=\"filter.label\"\r\n />\r\n <User\r\n v-else-if=\"filter.type === 'user'\"\r\n v-model=\"queryParams[filter.key]\"\r\n v-bind=\"filter\"\r\n class=\"w-ipt\"\r\n :placeholder=\"filter.label\"\r\n :multiple=\"filter.multiple !== false\"\r\n />\r\n </gm-form-item>\r\n </template>\r\n </TableFilter>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { TableFilter } from '@whgiimall/prototype-ui';\r\nimport type { PropType } from 'vue';\r\n\r\nimport Platform from './Platform.vue';\r\nimport Shop from './Shop.vue';\r\nimport Site from './Site.vue';\r\nimport User from './User.vue';\r\n\r\nconst PlatForm = Platform;\r\n\r\ndefineOptions({\r\n name: 'BizTableFilter'\r\n});\r\n\r\nconst BIZ_SELECTOR_TYPES = new Set(['site', 'shop', 'platform', 'user']);\r\n\r\nconst emit = defineEmits(['search', 'reset']);\r\n\r\nconst props = defineProps({\r\n customReset: {\r\n type: Boolean,\r\n default: false\r\n }\r\n});\r\n\r\nconst queryParams = defineModel('queryParams', {\r\n type: Object as PropType<Record<string, any>>,\r\n default: (): Record<string, any> => ({})\r\n});\r\n\r\nconst filterGroup = defineModel('filterGroup', {\r\n type: Array as PropType<Record<string, any>[]>,\r\n default: () => []\r\n});\r\n\r\nconst mappedFilterGroup = computed(() =>\r\n filterGroup.value.map(filter =>\r\n BIZ_SELECTOR_TYPES.has(filter.type) ? { ...filter, selfRender: true } : filter\r\n )\r\n);\r\n\r\nconst bizFilters = computed(() => filterGroup.value.filter(filter => BIZ_SELECTOR_TYPES.has(filter.type)));\r\n</script>\r\n\r\n","import type { App, Component } from 'vue';\n\nimport BizTableFilter from './BizTableFilter.vue';\nimport Platform from './Platform.vue';\nimport Shop from './Shop.vue';\nimport Site from './Site.vue';\nimport User from './User.vue';\n\nconst components: Array<[string, Component]> = [\n ['Site', Site],\n ['Shop', Shop],\n ['Platform', Platform],\n ['User', User],\n ['BizTableFilter', BizTableFilter]\n];\n\nexport function registerBizSelectorComponents(app: App) {\n components.forEach(([name, component]) => {\n if (app.component(name) && app.component(name) !== component) {\n console.warn(`[prototype-biz-selectors] 组件名 \"${name}\" 重复,已跳过`);\n return;\n }\n app.component(name, component);\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;EAQA,IAAM,IAAwB,GAA0B,EAOlD,IAAQ,GASR,IAAY,GAAK,EAEjB,IAAW,EAAW,GAAA,aAAE,EAExB,IAAc,eAAe;GACjC,IAAI,IAAe,IACf,IAA4B;GAgBhC,OAdI,cAAc,KAAK,EAAM,SAAmB,IAC9C,IAAgB,EAAM,SAAoB,aAAa,EAEnD,MAAiB,aACnB,IAAe,UAGjB,IAAa,EAAM,UAGD,EAAsB,aAAa,MAAM,MACpD,EAAK,SAAS,KAAgB,EAAK,OAAO,EAG5C,EAAa,YAAY,EAAE;IAClC,EAEI,IAAO,GAIP,KAAgB,MAAe;GAEnC,AADA,EAAK,UAAU,EAAM,EACrB,EAAK,eAAe;IAClB;IACA,MAAM,EAAU,MAAM;IACvB,CAAC;;SAGJ,EAAa,EACX,YAAY,EAAU,MAAM,MAC7B,CAAC,kBA9DA,EAA+I,EAAA,EAAA,EAA/I,EAA+I;YAA/H;GAAJ,KAAI;eAAqB,EAAA;4CAAQ,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ts
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { default as Site } from './Site.vue';
|
|
2
|
+
export { default as Shop } from './Shop.vue';
|
|
3
|
+
export { default as Platform } from './Platform.vue';
|
|
4
|
+
export { default as User } from './User.vue';
|
|
5
|
+
export { default as BizTableFilter } from './BizTableFilter.vue';
|
|
6
|
+
export { setupBizSelectors, getBizSelectorsConfig } from './config';
|
|
7
|
+
export type { BizSelectorsConfig } from './config';
|
|
8
|
+
export { useGlobalStore } from './store/global';
|
|
9
|
+
export type { AmzShopSelectorItem } from './store/global';
|
|
10
|
+
export { apiGetPlatform, useApiShopSelector } from './api/global';
|
|
11
|
+
export { registerBizSelectorComponents } from './register';
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as e, c as t, d as n, i as r, l as i, n as a, o, r as s, s as c, t as l, u } from "./chunks/register-Bc4_Z0wH.mjs";
|
|
2
|
+
export { a as BizTableFilter, r as Platform, e as Shop, n as Site, s as User, c as apiGetPlatform, i as getBizSelectorsConfig, l as registerBizSelectorComponents, u as setupBizSelectors, t as useApiShopSelector, o as useGlobalStore };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
export interface AmzShopSelectorItem {
|
|
3
|
+
brand: any[];
|
|
4
|
+
id: number;
|
|
5
|
+
shop_id: string;
|
|
6
|
+
shop_name: string;
|
|
7
|
+
status: '1' | '2';
|
|
8
|
+
}
|
|
9
|
+
export declare const useGlobalStore: import("pinia").StoreDefinition<"global", Pick<{
|
|
10
|
+
shopSelector: Ref<{
|
|
11
|
+
brand: any[];
|
|
12
|
+
id: number;
|
|
13
|
+
shop_id: string;
|
|
14
|
+
shop_name: string;
|
|
15
|
+
status: "1" | "2";
|
|
16
|
+
}[], AmzShopSelectorItem[] | {
|
|
17
|
+
brand: any[];
|
|
18
|
+
id: number;
|
|
19
|
+
shop_id: string;
|
|
20
|
+
shop_name: string;
|
|
21
|
+
status: "1" | "2";
|
|
22
|
+
}[]>;
|
|
23
|
+
getShopSelector: () => Promise<void>;
|
|
24
|
+
platformList: Ref<any[], any[]>;
|
|
25
|
+
getPlatformList: ({ label, value }?: {
|
|
26
|
+
label?: string;
|
|
27
|
+
value?: string;
|
|
28
|
+
}) => Promise<void>;
|
|
29
|
+
}, "shopSelector" | "platformList">, Pick<{
|
|
30
|
+
shopSelector: Ref<{
|
|
31
|
+
brand: any[];
|
|
32
|
+
id: number;
|
|
33
|
+
shop_id: string;
|
|
34
|
+
shop_name: string;
|
|
35
|
+
status: "1" | "2";
|
|
36
|
+
}[], AmzShopSelectorItem[] | {
|
|
37
|
+
brand: any[];
|
|
38
|
+
id: number;
|
|
39
|
+
shop_id: string;
|
|
40
|
+
shop_name: string;
|
|
41
|
+
status: "1" | "2";
|
|
42
|
+
}[]>;
|
|
43
|
+
getShopSelector: () => Promise<void>;
|
|
44
|
+
platformList: Ref<any[], any[]>;
|
|
45
|
+
getPlatformList: ({ label, value }?: {
|
|
46
|
+
label?: string;
|
|
47
|
+
value?: string;
|
|
48
|
+
}) => Promise<void>;
|
|
49
|
+
}, never>, Pick<{
|
|
50
|
+
shopSelector: Ref<{
|
|
51
|
+
brand: any[];
|
|
52
|
+
id: number;
|
|
53
|
+
shop_id: string;
|
|
54
|
+
shop_name: string;
|
|
55
|
+
status: "1" | "2";
|
|
56
|
+
}[], AmzShopSelectorItem[] | {
|
|
57
|
+
brand: any[];
|
|
58
|
+
id: number;
|
|
59
|
+
shop_id: string;
|
|
60
|
+
shop_name: string;
|
|
61
|
+
status: "1" | "2";
|
|
62
|
+
}[]>;
|
|
63
|
+
getShopSelector: () => Promise<void>;
|
|
64
|
+
platformList: Ref<any[], any[]>;
|
|
65
|
+
getPlatformList: ({ label, value }?: {
|
|
66
|
+
label?: string;
|
|
67
|
+
value?: string;
|
|
68
|
+
}) => Promise<void>;
|
|
69
|
+
}, "getShopSelector" | "getPlatformList">>;
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@whgiimall/prototype-biz-selectors",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"access": "public",
|
|
11
|
+
"registry": "https://registry.npmjs.org/"
|
|
12
|
+
},
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"development": "./src/index.ts",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.mjs"
|
|
18
|
+
},
|
|
19
|
+
"./register": {
|
|
20
|
+
"development": "./src/register.ts",
|
|
21
|
+
"types": "./dist/register.d.ts",
|
|
22
|
+
"import": "./dist/register.mjs"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"vue": "^3.5.0",
|
|
28
|
+
"pinia": "^2.3.0",
|
|
29
|
+
"element-plus": "^2.14.0",
|
|
30
|
+
"giime": "^0.9.15",
|
|
31
|
+
"axios": "^1.16.0",
|
|
32
|
+
"@whgiimall/prototype-core": "0.1.0",
|
|
33
|
+
"@whgiimall/prototype-ui": "0.1.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@vitejs/plugin-vue": "6.0.6",
|
|
37
|
+
"@vue/tsconfig": "0.9.1",
|
|
38
|
+
"sass": "1.99.0",
|
|
39
|
+
"typescript": "5.8.3",
|
|
40
|
+
"vite": "8.0.12",
|
|
41
|
+
"vue-tsc": "3.2.8",
|
|
42
|
+
"@whgiimall/prototype-ui": "0.1.0",
|
|
43
|
+
"@whgiimall/prototype-core": "0.1.0"
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "vite build -c vite.lib.config.ts && vue-tsc -p tsconfig.build.json"
|
|
47
|
+
}
|
|
48
|
+
}
|