jgy-public-component 0.0.22 → 0.0.24

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.
Files changed (33) hide show
  1. package/README.md +113 -1
  2. package/dist/components/JDocDetail/DocDetailHost.d.ts +3 -0
  3. package/dist/components/JDocDetail/DocNoLink.d.ts +38 -0
  4. package/dist/components/JDocDetail/index.d.ts +16 -0
  5. package/dist/components/JDocDetail/labels/inbound.d.ts +20 -0
  6. package/dist/components/JDocDetail/labels/putaway.d.ts +1 -0
  7. package/dist/components/JDocDetail/labels/receipt.d.ts +24 -0
  8. package/dist/components/JDocDetail/registry.d.ts +25 -0
  9. package/dist/components/JDocDetail/store.d.ts +31 -0
  10. package/dist/components/JDocDetail/types.d.ts +38 -0
  11. package/dist/components/JDocDetail/utils/copyText.d.ts +1 -0
  12. package/dist/components/JDocDetail/utils/flattenOrderItems.d.ts +7 -0
  13. package/dist/components/JDocDetail/views/DeliveryOrderDetailView.d.ts +22 -0
  14. package/dist/components/JDocDetail/views/InboundOrderDetailView.d.ts +22 -0
  15. package/dist/components/JDocDetail/views/PutawayOrderDetailView.d.ts +22 -0
  16. package/dist/components/JDocDetail/views/QcOrderDetailView.d.ts +22 -0
  17. package/dist/components/JDocDetail/views/ReceiptOrderDetailView.d.ts +22 -0
  18. package/dist/components/JDocDetail/views/TransferOrderDetailView.d.ts +22 -0
  19. package/dist/components/JDocDetail/views/WorkOrderDetailView.d.ts +22 -0
  20. package/dist/components/JDocDetail/wmsViews.d.ts +12 -0
  21. package/dist/components/JProductDetail/JProductDetailDialog.d.ts +4 -1
  22. package/dist/components/JProductDetail/index.d.ts +1 -0
  23. package/dist/components/JProductDetail/request.d.ts +28 -0
  24. package/dist/components/JProductDetail/types.d.ts +19 -11
  25. package/dist/components/JProductDetail/useProductDetailDialog.d.ts +20 -7
  26. package/dist/components/JUploadImg/JUploadImg.d.ts +1 -1
  27. package/dist/index.d.ts +6 -3
  28. package/dist/index.js +4682 -1347
  29. package/dist/index.js.map +1 -1
  30. package/dist/index.umd.cjs +2 -2
  31. package/dist/index.umd.cjs.map +1 -1
  32. package/dist/style.css +1 -1
  33. package/package.json +3 -1
package/README.md CHANGED
@@ -47,9 +47,121 @@ import 'jgy-public-component/dist/style.css'
47
47
  | JUploadImg | 图片上传 |
48
48
  | JSidebar / JSideMenuItem | 侧边栏菜单 |
49
49
  | JAdminLayout | 后台布局 |
50
- | JProductDetailDialog / JSkuLink | 产品详情 / SKU 链接 |
50
+ | JProductDetailDialog / JSkuLink | 产品详情 / SKU 链接(需注入 request) |
51
51
  | JIconRender | 图标渲染 |
52
52
 
53
+ ### JSkuLink + JProductDetailDialog(点击 SKU 弹产品详情)
54
+
55
+ 列表场景:**多行 `JSkuLink` + 页面底部一个 `JProductDetailDialog`**,不要每行挂一个弹窗。
56
+
57
+ #### 1. 入口注入 request(推荐,全项目一次)
58
+
59
+ ```ts
60
+ // main.ts
61
+ import { createApp } from 'vue'
62
+ import App from './App.vue'
63
+ import request from '@/api'
64
+ import JgyComponents, { provideProductRequest } from 'jgy-public-component'
65
+ import 'jgy-public-component/dist/style.css'
66
+
67
+ const app = createApp(App)
68
+ app.use(JgyComponents)
69
+
70
+ // 把项目统一的 axios 封装注入给产品详情组件
71
+ provideProductRequest(app, (config) => request(config))
72
+
73
+ app.mount('#app')
74
+ ```
75
+
76
+ #### 2. 页面用法
77
+
78
+ ```vue
79
+ <template>
80
+ <!-- 表格里:只放链接 -->
81
+ <JSkuLink :code="row.sku" @open="openProductDetailDialog" />
82
+
83
+ <!-- 页面底部:只挂一个弹窗 -->
84
+ <JProductDetailDialog
85
+ v-model:visible="productDetailDialogVisible"
86
+ :code="productDetailDialogCode"
87
+ type="sku"
88
+ />
89
+ <!-- 若未在 main.ts provide,需额外传 :request="request" -->
90
+ </template>
91
+
92
+ <script setup lang="ts">
93
+ import {
94
+ JSkuLink,
95
+ JProductDetailDialog,
96
+ useProductDetailDialog,
97
+ } from 'jgy-public-component'
98
+
99
+ const {
100
+ productDetailDialogVisible,
101
+ productDetailDialogCode,
102
+ openProductDetailDialog,
103
+ } = useProductDetailDialog()
104
+ </script>
105
+ ```
106
+
107
+ #### 3. 单页传入 request(不全局 provide 时)
108
+
109
+ ```vue
110
+ <script setup lang="ts">
111
+ import request from '@/api'
112
+ import { JProductDetailDialog, JSkuLink, useProductDetailDialog } from 'jgy-public-component'
113
+ // ...
114
+ </script>
115
+
116
+ <template>
117
+ <JSkuLink :code="row.sku" @open="openProductDetailDialog" />
118
+ <JProductDetailDialog
119
+ v-model:visible="productDetailDialogVisible"
120
+ :code="productDetailDialogCode"
121
+ type="sku"
122
+ :request="request"
123
+ />
124
+ </template>
125
+ ```
126
+
127
+ #### 4. Props / 事件
128
+
129
+ **JSkuLink**
130
+
131
+ | 属性 | 类型 | 默认 | 说明 |
132
+ |------|------|------|------|
133
+ | code | `string \| null` | - | SKU/编码 |
134
+ | emptyText | `string` | `'-'` | 无编码时展示 |
135
+
136
+ | 事件 | 参数 | 说明 |
137
+ |------|------|------|
138
+ | open | `(code: string)` | 有编码且点击时触发 |
139
+
140
+ **JProductDetailDialog**
141
+
142
+ | 属性 | 类型 | 默认 | 说明 |
143
+ |------|------|------|------|
144
+ | visible / v-model:visible | `boolean` | `false` | 显隐 |
145
+ | code | `string` | `''` | sku_code / spu_code |
146
+ | type | `'sku' \| 'spu'` | `'sku'` | 详情接口类型 |
147
+ | id | `number \| string` | - | 可选行 id |
148
+ | request | `JProductRequestFn` | - | 可选;未传则用全局 provide |
149
+
150
+ **主题色(可选)**
151
+
152
+ ```css
153
+ :root {
154
+ --j-sku-link-color: #409eff;
155
+ }
156
+ ```
157
+
158
+ #### 5. 宿主前置条件
159
+
160
+ 1. 已安装 `element-plus`(peerDependency)
161
+ 2. vite 已代理 `/bis-app` 到后端
162
+ 3. 后端具备同一套 bis 产品详情接口(`/bis-app/comm/sku/doDetail` 等)
163
+ 4. `request` 返回体已被拦截器解包为 `{ code, data, msg }`
164
+
53
165
  ### JSearchInputDialog 快速示例
54
166
 
55
167
  ```vue
@@ -0,0 +1,3 @@
1
+ import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
2
+ declare const _default: DefineComponent<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
3
+ export default _default;
@@ -0,0 +1,38 @@
1
+ import { DocDetailType } from './types';
2
+ import { DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions, PropType } from 'vue';
3
+
4
+ declare const _default: DefineComponent<ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
5
+ type: DocDetailType;
6
+ orderNo: string;
7
+ /** 是否显示复制按钮,默认 true */
8
+ showCopy?: boolean;
9
+ }>, {
10
+ showCopy: boolean;
11
+ }>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly< ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
12
+ type: DocDetailType;
13
+ orderNo: string;
14
+ /** 是否显示复制按钮,默认 true */
15
+ showCopy?: boolean;
16
+ }>, {
17
+ showCopy: boolean;
18
+ }>>> & Readonly<{}>, {
19
+ showCopy: boolean;
20
+ }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
21
+ export default _default;
22
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
23
+ type __VLS_TypePropsToRuntimeProps<T> = {
24
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
25
+ type: PropType<__VLS_NonUndefinedable<T[K]>>;
26
+ } : {
27
+ type: PropType<T[K]>;
28
+ required: true;
29
+ };
30
+ };
31
+ type __VLS_WithDefaults<P, D> = {
32
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
33
+ default: D[K];
34
+ }> : P[K];
35
+ };
36
+ type __VLS_Prettify<T> = {
37
+ [K in keyof T]: T[K];
38
+ } & {};
@@ -0,0 +1,16 @@
1
+ /**
2
+ * JDocDetail — 全局单据详情(传单号打开只读弹窗)
3
+ *
4
+ * 用法概要:
5
+ * 1. createDocDetail({ components, adapters }) // 注册组件 + 注入接口
6
+ * 2. MainLayout 挂载 <DocDetailHost />
7
+ * 3. 列表使用 <DocNoLink type="receipt" :order-no="xxx" />
8
+ *
9
+ * WMS 可直接用 wmsDocDetailComponents 作为 components。
10
+ */
11
+ export type { DocDetailType, DocDetailAdapters, DocDetailRegistryItem, DocDetailComponents, CreateDocDetailOptions, } from './types';
12
+ export { createDocDetail, registerDocDetail, getDocDetailRegistry, getDocDetailAdapters, getDocDetailEntry, isDocDetailInitialized, } from './registry';
13
+ export { useDocDetailStore } from './store';
14
+ export { default as DocNoLink } from './DocNoLink';
15
+ export { default as DocDetailHost } from './DocDetailHost';
16
+ export { wmsDocDetailComponents, ReceiptOrderDetailView, QcOrderDetailView, InboundOrderDetailView, PutawayOrderDetailView, DeliveryOrderDetailView, TransferOrderDetailView, WorkOrderDetailView, } from './wmsViews';
@@ -0,0 +1,20 @@
1
+ export declare const INBOUND_TYPE_MAP: Record<number, string>;
2
+ export declare const getInboundTypeLabel: (type?: number | string | null) => string;
3
+ export declare const INBOUND_STATUS_MAP: Record<number, string>;
4
+ export declare const getInboundStatusLabel: (status?: number | string | null) => string;
5
+ export interface InboundLocationItem {
6
+ inventory_status?: number;
7
+ location_code?: string;
8
+ inbound_qty?: number;
9
+ inventory_status_name?: string;
10
+ location_type?: string;
11
+ location_type_name?: string;
12
+ location_display?: string;
13
+ }
14
+ export declare const formatInboundLocationList: (locationList?: InboundLocationItem[] | null, inventoryStatus?: number) => string;
15
+ export declare const getInboundGoodLocation: (row?: {
16
+ location_list?: InboundLocationItem[];
17
+ } | null) => string;
18
+ export declare const getInboundBadLocation: (row?: {
19
+ location_list?: InboundLocationItem[];
20
+ } | null) => string;
@@ -0,0 +1 @@
1
+ export declare const PUTAWAY_STATUS_COMPLETED = 300;
@@ -0,0 +1,24 @@
1
+ export declare const RECEIPT_TYPE_MAP: Record<number, string>;
2
+ export declare const getReceiptTypeLabel: (type?: number | string | null) => string;
3
+ export declare const RECEIPT_STATUS_MAP: Record<number, string>;
4
+ export declare const ABNORMAL_INITIATE_STATUS_MAP: Record<number, string>;
5
+ export declare const calcAbnormalInitiateStatus: (orderItems: Array<{
6
+ id?: number;
7
+ receive_qty?: number;
8
+ notice_receive_qty?: number;
9
+ }>, occupiedItemIds?: number[]) => {
10
+ sub_status: number;
11
+ sub_status_name: string;
12
+ };
13
+ export declare const getReceiptStatusLabel: (status?: number, baseLabel?: string, subMemo?: string) => string;
14
+ export declare const resolveAbnormalSubMemo: (row: {
15
+ status?: number;
16
+ status_sub_memo?: string;
17
+ abnormal_sub_status_name?: string;
18
+ order_item?: any;
19
+ abnormal_occupied_item_ids?: number[];
20
+ }, flatOrderItems?: Array<{
21
+ id?: number;
22
+ receive_qty?: number;
23
+ notice_receive_qty?: number;
24
+ }>) => string;
@@ -0,0 +1,25 @@
1
+ import { Component } from 'vue';
2
+ import { CreateDocDetailOptions, DocDetailAdapters } from './types';
3
+
4
+ type NormalizedRegistry = Record<string, {
5
+ component: Component;
6
+ orderNoProp: string;
7
+ }>;
8
+ /**
9
+ * 注册全局单据详情:组件映射 + 接口适配器
10
+ * 建议在 main.ts 中 pinia 之后调用一次
11
+ */
12
+ export declare function createDocDetail(options: CreateDocDetailOptions): {
13
+ registry: NormalizedRegistry;
14
+ adapters: DocDetailAdapters;
15
+ };
16
+ /** 合并追加注册(可选,用于微前端/按模块懒注册) */
17
+ export declare function registerDocDetail(options: Partial<CreateDocDetailOptions>): void;
18
+ export declare function getDocDetailRegistry(): NormalizedRegistry;
19
+ export declare function getDocDetailAdapters(): DocDetailAdapters;
20
+ export declare function isDocDetailInitialized(): boolean;
21
+ export declare function getDocDetailEntry(type: string): {
22
+ component: Component;
23
+ orderNoProp: string;
24
+ };
25
+ export {};
@@ -0,0 +1,31 @@
1
+ import { DocDetailType } from './types';
2
+ import { StoreDefinition } from 'pinia';
3
+ import { Ref } from 'vue';
4
+
5
+ /**
6
+ * 全局单据详情状态
7
+ * 业务页:DocNoLink / store.open(type, orderNo)
8
+ * 宿主:DocDetailHost 按 registry 渲染
9
+ */
10
+ export declare const useDocDetailStore: StoreDefinition<"jgyDocDetail", Pick<{
11
+ visible: Ref<boolean, boolean>;
12
+ type: Ref<string, string>;
13
+ orderNo: Ref<string, string>;
14
+ open: (docType: DocDetailType, no: string) => Promise<void>;
15
+ close: () => void;
16
+ reset: () => void;
17
+ }, "type" | "orderNo" | "visible">, Pick<{
18
+ visible: Ref<boolean, boolean>;
19
+ type: Ref<string, string>;
20
+ orderNo: Ref<string, string>;
21
+ open: (docType: DocDetailType, no: string) => Promise<void>;
22
+ close: () => void;
23
+ reset: () => void;
24
+ }, never>, Pick<{
25
+ visible: Ref<boolean, boolean>;
26
+ type: Ref<string, string>;
27
+ orderNo: Ref<string, string>;
28
+ open: (docType: DocDetailType, no: string) => Promise<void>;
29
+ close: () => void;
30
+ reset: () => void;
31
+ }, "close" | "open" | "reset">>;
@@ -0,0 +1,38 @@
1
+ import { Component } from 'vue';
2
+
3
+ /** 单据类型:业务可扩展任意 string */
4
+ export type DocDetailType = string;
5
+ /**
6
+ * 详情数据适配器:由各业务项目注入真实接口
7
+ * 约定返回项目原有接口结构(通常为 { code, data, msg }),由对应 DetailView 解析
8
+ */
9
+ export type DocDetailAdapters = {
10
+ getReceiptDetail?: (orderNo: string) => Promise<any>;
11
+ getQcDetail?: (orderNo: string) => Promise<any>;
12
+ /** 质检标准等附属数据(可选) */
13
+ getSkuDetail?: (skuCode: string) => Promise<any>;
14
+ getInboundDetail?: (orderNo: string) => Promise<any>;
15
+ getPutawayDetail?: (orderNo: string) => Promise<any>;
16
+ getDeliveryDetail?: (orderNo: string) => Promise<any>;
17
+ getTransferDetail?: (orderNo: string) => Promise<any>;
18
+ getProcessingDetail?: (orderNo: string) => Promise<any>;
19
+ /** 业务方可自行扩展 key */
20
+ [key: string]: ((...args: any[]) => Promise<any>) | undefined;
21
+ };
22
+ /** 单个 type 的注册项 */
23
+ export type DocDetailRegistryItem = {
24
+ /** 纯展示详情组件 */
25
+ component: Component;
26
+ /**
27
+ * 详情组件接收单号的 prop 名
28
+ * 默认 orderNo;WMS 沿用 receiptOrderNo / qcOrderNo 等
29
+ */
30
+ orderNoProp?: string;
31
+ };
32
+ export type DocDetailComponents = Record<string, Component | DocDetailRegistryItem>;
33
+ export type CreateDocDetailOptions = {
34
+ /** type → 详情组件 */
35
+ components: DocDetailComponents;
36
+ /** 接口适配器(各项目自行注入) */
37
+ adapters?: DocDetailAdapters;
38
+ };
@@ -0,0 +1 @@
1
+ export declare function copyText(text?: string | number | null): Promise<void>;
@@ -0,0 +1,7 @@
1
+ export interface FlatOrderItem extends Record<string, any> {
2
+ _skuGroupSize?: number;
3
+ _skuGroupIndex?: number;
4
+ }
5
+ /** 将 order_item 按 SKU 分组对象或数组展平为子行 */
6
+ export declare function flattenOrderItems(orderItem: any, withSkuGroupMeta?: boolean): FlatOrderItem[];
7
+ export declare function sumOrderItemField(orderItem: any, field: string): number;
@@ -0,0 +1,22 @@
1
+ import { DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions, PropType } from 'vue';
2
+ declare const _default: DefineComponent<ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
3
+ modelValue: boolean;
4
+ outboundOrderNo: string;
5
+ }>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
6
+ "update:modelValue": (val: boolean) => void;
7
+ }, string, PublicProps, Readonly< ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
8
+ modelValue: boolean;
9
+ outboundOrderNo: string;
10
+ }>>> & Readonly<{
11
+ "onUpdate:modelValue"?: ((val: boolean) => any) | undefined;
12
+ }>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
13
+ export default _default;
14
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
15
+ type __VLS_TypePropsToRuntimeProps<T> = {
16
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
17
+ type: PropType<__VLS_NonUndefinedable<T[K]>>;
18
+ } : {
19
+ type: PropType<T[K]>;
20
+ required: true;
21
+ };
22
+ };
@@ -0,0 +1,22 @@
1
+ import { DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions, PropType } from 'vue';
2
+ declare const _default: DefineComponent<ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
3
+ modelValue: boolean;
4
+ inboundOrderNo: string;
5
+ }>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
6
+ "update:modelValue": (val: boolean) => void;
7
+ }, string, PublicProps, Readonly< ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
8
+ modelValue: boolean;
9
+ inboundOrderNo: string;
10
+ }>>> & Readonly<{
11
+ "onUpdate:modelValue"?: ((val: boolean) => any) | undefined;
12
+ }>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
13
+ export default _default;
14
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
15
+ type __VLS_TypePropsToRuntimeProps<T> = {
16
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
17
+ type: PropType<__VLS_NonUndefinedable<T[K]>>;
18
+ } : {
19
+ type: PropType<T[K]>;
20
+ required: true;
21
+ };
22
+ };
@@ -0,0 +1,22 @@
1
+ import { DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions, PropType } from 'vue';
2
+ declare const _default: DefineComponent<ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
3
+ modelValue: boolean;
4
+ putawayOrderNo: string;
5
+ }>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
6
+ "update:modelValue": (val: boolean) => void;
7
+ }, string, PublicProps, Readonly< ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
8
+ modelValue: boolean;
9
+ putawayOrderNo: string;
10
+ }>>> & Readonly<{
11
+ "onUpdate:modelValue"?: ((val: boolean) => any) | undefined;
12
+ }>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
13
+ export default _default;
14
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
15
+ type __VLS_TypePropsToRuntimeProps<T> = {
16
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
17
+ type: PropType<__VLS_NonUndefinedable<T[K]>>;
18
+ } : {
19
+ type: PropType<T[K]>;
20
+ required: true;
21
+ };
22
+ };
@@ -0,0 +1,22 @@
1
+ import { DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions, PropType } from 'vue';
2
+ declare const _default: DefineComponent<ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
3
+ modelValue: boolean;
4
+ qcOrderNo: string;
5
+ }>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
6
+ "update:modelValue": (val: boolean) => void;
7
+ }, string, PublicProps, Readonly< ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
8
+ modelValue: boolean;
9
+ qcOrderNo: string;
10
+ }>>> & Readonly<{
11
+ "onUpdate:modelValue"?: ((val: boolean) => any) | undefined;
12
+ }>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
13
+ export default _default;
14
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
15
+ type __VLS_TypePropsToRuntimeProps<T> = {
16
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
17
+ type: PropType<__VLS_NonUndefinedable<T[K]>>;
18
+ } : {
19
+ type: PropType<T[K]>;
20
+ required: true;
21
+ };
22
+ };
@@ -0,0 +1,22 @@
1
+ import { DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions, PropType } from 'vue';
2
+ declare const _default: DefineComponent<ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
3
+ modelValue: boolean;
4
+ receiptOrderNo: string;
5
+ }>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
6
+ "update:modelValue": (val: boolean) => void;
7
+ }, string, PublicProps, Readonly< ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
8
+ modelValue: boolean;
9
+ receiptOrderNo: string;
10
+ }>>> & Readonly<{
11
+ "onUpdate:modelValue"?: ((val: boolean) => any) | undefined;
12
+ }>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
13
+ export default _default;
14
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
15
+ type __VLS_TypePropsToRuntimeProps<T> = {
16
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
17
+ type: PropType<__VLS_NonUndefinedable<T[K]>>;
18
+ } : {
19
+ type: PropType<T[K]>;
20
+ required: true;
21
+ };
22
+ };
@@ -0,0 +1,22 @@
1
+ import { DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions, PropType } from 'vue';
2
+ declare const _default: DefineComponent<ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
3
+ modelValue: boolean;
4
+ transferOrderNo: string;
5
+ }>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
6
+ "update:modelValue": (val: boolean) => void;
7
+ }, string, PublicProps, Readonly< ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
8
+ modelValue: boolean;
9
+ transferOrderNo: string;
10
+ }>>> & Readonly<{
11
+ "onUpdate:modelValue"?: ((val: boolean) => any) | undefined;
12
+ }>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
13
+ export default _default;
14
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
15
+ type __VLS_TypePropsToRuntimeProps<T> = {
16
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
17
+ type: PropType<__VLS_NonUndefinedable<T[K]>>;
18
+ } : {
19
+ type: PropType<T[K]>;
20
+ required: true;
21
+ };
22
+ };
@@ -0,0 +1,22 @@
1
+ import { DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions, PropType } from 'vue';
2
+ declare const _default: DefineComponent<ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
3
+ modelValue: boolean;
4
+ processingOrderNo: string;
5
+ }>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
6
+ "update:modelValue": (val: boolean) => void;
7
+ }, string, PublicProps, Readonly< ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
8
+ modelValue: boolean;
9
+ processingOrderNo: string;
10
+ }>>> & Readonly<{
11
+ "onUpdate:modelValue"?: ((val: boolean) => any) | undefined;
12
+ }>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
13
+ export default _default;
14
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
15
+ type __VLS_TypePropsToRuntimeProps<T> = {
16
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
17
+ type: PropType<__VLS_NonUndefinedable<T[K]>>;
18
+ } : {
19
+ type: PropType<T[K]>;
20
+ required: true;
21
+ };
22
+ };
@@ -0,0 +1,12 @@
1
+ import { DocDetailComponents } from './types';
2
+ import { default as ReceiptOrderDetailView } from './views/ReceiptOrderDetailView';
3
+ import { default as QcOrderDetailView } from './views/QcOrderDetailView';
4
+ import { default as InboundOrderDetailView } from './views/InboundOrderDetailView';
5
+ import { default as PutawayOrderDetailView } from './views/PutawayOrderDetailView';
6
+ import { default as DeliveryOrderDetailView } from './views/DeliveryOrderDetailView';
7
+ import { default as TransferOrderDetailView } from './views/TransferOrderDetailView';
8
+ import { default as WorkOrderDetailView } from './views/WorkOrderDetailView';
9
+
10
+ /** WMS 默认只读详情组件映射(接口由业务项目 adapters 注入) */
11
+ export declare const wmsDocDetailComponents: DocDetailComponents;
12
+ export { ReceiptOrderDetailView, QcOrderDetailView, InboundOrderDetailView, PutawayOrderDetailView, DeliveryOrderDetailView, TransferOrderDetailView, WorkOrderDetailView, };
@@ -1,4 +1,4 @@
1
- import { JProductDetailDialogProps } from './types';
1
+ import { JProductRequestFn, JProductDetailDialogProps } from './types';
2
2
  import { DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions, PropType } from 'vue';
3
3
 
4
4
  declare const _default: DefineComponent<ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<JProductDetailDialogProps>, {
@@ -6,6 +6,7 @@ declare const _default: DefineComponent<ExtractPropTypes<__VLS_WithDefaults<__VL
6
6
  code: string;
7
7
  type: string;
8
8
  id: undefined;
9
+ request: undefined;
9
10
  }>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
10
11
  "update:visible": (args_0: boolean) => void;
11
12
  }, string, PublicProps, Readonly< ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<JProductDetailDialogProps>, {
@@ -13,6 +14,7 @@ declare const _default: DefineComponent<ExtractPropTypes<__VLS_WithDefaults<__VL
13
14
  code: string;
14
15
  type: string;
15
16
  id: undefined;
17
+ request: undefined;
16
18
  }>>> & Readonly<{
17
19
  "onUpdate:visible"?: ((args_0: boolean) => any) | undefined;
18
20
  }>, {
@@ -20,6 +22,7 @@ declare const _default: DefineComponent<ExtractPropTypes<__VLS_WithDefaults<__VL
20
22
  id: number | string;
21
23
  code: string;
22
24
  visible: boolean;
25
+ request: JProductRequestFn;
23
26
  }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
24
27
  export default _default;
25
28
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
@@ -1,4 +1,5 @@
1
1
  export { default as JProductDetailDialog } from './JProductDetailDialog';
2
2
  export { default as JSkuLink } from './JSkuLink';
3
3
  export { useProductDetailDialog } from './useProductDetailDialog';
4
+ export { provideProductRequest, resolveProductRequest, useInjectedProductRequest, J_PRODUCT_REQUEST_KEY, } from './request';
4
5
  export type { JProductDetailDialogProps, JSkuLinkProps, JProductRequestFn, JProductRequestConfig, } from './types';
@@ -0,0 +1,28 @@
1
+ import { App, InjectionKey } from 'vue';
2
+ import { JProductRequestFn } from './types';
3
+
4
+ /** provide/inject 用的 key,业务方一般无需直接使用 */
5
+ export declare const J_PRODUCT_REQUEST_KEY: InjectionKey<JProductRequestFn>;
6
+ /**
7
+ * 在应用入口注入 request(推荐,全项目只需一次)。
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * import { createApp } from 'vue'
12
+ * import request from '@/api'
13
+ * import { provideProductRequest } from 'jgy-public-component'
14
+ *
15
+ * const app = createApp(App)
16
+ * provideProductRequest(app, (config) => request(config))
17
+ * ```
18
+ */
19
+ export declare function provideProductRequest(app: App, request: JProductRequestFn): void;
20
+ /**
21
+ * 在 setup 中读取全局注入的 request(必须在 setup 同步阶段调用 inject)。
22
+ */
23
+ export declare function useInjectedProductRequest(): JProductRequestFn | null;
24
+ /**
25
+ * 解析最终 request:prop 优先,否则用全局 provide。
26
+ * 可在 setup 外调用,但需把 setup 阶段拿到的 injected 传进来。
27
+ */
28
+ export declare function resolveProductRequest(propRequest?: JProductRequestFn | null, injectedRequest?: JProductRequestFn | null): JProductRequestFn;
@@ -1,10 +1,14 @@
1
1
  /**
2
2
  * JProductDetail 相关类型
3
3
  *
4
- * 该组件依赖宿主项目注入 request 函数(各 *_front 项目 `@/api` 的默认导出),
4
+ * 该组件依赖宿主项目注入 request 函数(各 *_front 项目 `@/api` 的默认导出),
5
5
  * 组件内部不直接依赖任何具体项目的 request 封装。
6
+ *
7
+ * 注入方式二选一(推荐 1):
8
+ * 1. main.ts: provideProductRequest(app, request)
9
+ * 2. 组件 prop: <JProductDetailDialog :request="request" ... />
6
10
  */
7
- /** request 请求配置(与各项目 axios 实例调用签名对齐) */
11
+ /** request 请求配置(与各项目 axios 实例调用签名对齐) */
8
12
  export interface JProductRequestConfig {
9
13
  url: string;
10
14
  method?: string;
@@ -14,24 +18,28 @@ export interface JProductRequestConfig {
14
18
  }
15
19
  /**
16
20
  * 注入式 request 函数类型。
17
- * 传入 `@/api` 的默认导出即可:`(config) => Promise<res>`,
18
- * 其中 res 已被拦截器解包为后端返回体(含 code/data/msg)。
21
+ * 传入 `@/api` 的默认导出即可:`(config) => Promise<res>`,
22
+ * 其中 res 已被拦截器解包为后端返回体(含 code/data/msg)。
19
23
  */
20
24
  export type JProductRequestFn = (config: JProductRequestConfig) => Promise<any>;
21
25
  export interface JProductDetailDialogProps {
22
- /** 弹窗显隐,配合 v-model:visible 使用 */
26
+ /** 弹窗显隐,配合 v-model:visible 使用 */
23
27
  visible?: boolean;
24
- /** sku_code 或 spu_code,弹窗打开时自动请求详情 */
28
+ /** sku_code 或 spu_code,弹窗打开时自动请求详情 */
25
29
  code?: string;
26
- /** sku 走 /sku/doDetail,spu 走 /spu/doDetail */
30
+ /** sku 走 /sku/doDetailspu 走 /spu/doDetail */
27
31
  type?: 'sku' | 'spu';
28
- /** 行 id,可选 */
32
+ /** 行 id,可选 */
29
33
  id?: number | string;
30
- /** 注入的 request 函数(必传),传入宿主 `@/api` 默认导出 */
31
- request: JProductRequestFn;
34
+ /**
35
+ * request 函数。可选:
36
+ * - 未传时使用 provideProductRequest 注入的全局 request
37
+ * - 传入时优先使用 prop(便于单页覆盖)
38
+ */
39
+ request?: JProductRequestFn;
32
40
  }
33
41
  export interface JSkuLinkProps {
34
- /** 编码,有值时渲染为可点击链接 */
42
+ /** 编码,有值时渲染为可点击链接 */
35
43
  code?: string | null;
36
44
  /** 无编码时展示的占位文本 */
37
45
  emptyText?: string;